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 "<br>".$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:<hr>';
-	$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 "<br>" . $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:<hr>';
+    $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".'<br>';
-	}
-	
-	echo $ins;
-	
-	die();
+        $ins .= "\n" . '<br>';
+    }
+
+    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 '<div';
-		if( $i == 8 || $i == 13 || $i == 18 || $i == 23 ) { 
-			echo ' style="background-color:green;color:#fff;"';
-		}elseif( $i == 7 || $i == 12 || $i == 17 || $i == 22 ) { 
-			echo ' style="background-color:grey;color:#fff;"';
-		}
-		echo '>&nbsp;';
-		echo $i.' = '.yrn($i).'';
-		echo '</div>';
-		$i++;
-	}
-	
-	die();
+if (isset($_GET['test'])) {
+    $i = 3;
+
+
+    function yrn($sila)
+    {
+        return 2 + $_GET['test'] + $sila - round($sila / 5);
+    }
+
+
+    while ($i <= 100) {
+        echo '<div';
+        if ($i == 8 || $i == 13 || $i == 18 || $i == 23) {
+            echo ' style="background-color:green;color:#fff;"';
+        } elseif ($i == 7 || $i == 12 || $i == 17 || $i == 22) {
+            echo ' style="background-color:grey;color:#fff;"';
+        }
+        echo '>&nbsp;';
+        echo $i . ' = ' . yrn($i);
+        echo '</div>';
+        $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().'<br>'.$_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() . '<br>' . $_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').' (����������� ������): <b>'.mysql_real_escape_string($t).'</b>","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 '<hr>';
 }
-
-$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 '<hr>';
-}
-?>
diff --git a/_incl_data/.htaccess b/_incl_data/.htaccess
index 3418e55a..8d2f2563 100644
--- a/_incl_data/.htaccess
+++ b/_incl_data/.htaccess
@@ -1 +1 @@
-deny from all
\ No newline at end of file
+deny from all
diff --git a/_incl_data/__config.php b/_incl_data/__config.php
index ea039956..b7ba8941 100644
--- a/_incl_data/__config.php
+++ b/_incl_data/__config.php
@@ -5,81 +5,18 @@ ini_set('display_errors', 'Off');
 setlocale(LC_CTYPE, "ru_RU.CP1251");
 date_default_timezone_set('Europe/Moscow');
 
-$c = [
-    'ver' => '1.8.3.7',
-];
-/* ������������ ���� */
-$c['name'] = '���������� ����';
-$c['title'] = '�' . $c['name'] . '� - ����������,���������� ������ ����'; //�������� ����
-$c['title2'] = ' - ����������, ������ ���� ����������� ��������� � �����!';
-$c['title3'] = $c['name'];
-$c['keys'] = $c['name'] . ', combats.com, ' . $c['name'] . ' ����, ' . $c['name'] . ' ������, ���� ' . $c['name'] . ', ������ ' . $c['name'] . ', ' . $c['name'] . ' ������ ����, ' . $c['name'] . ' ���������� ����, ������ � ' . $c['name'] . ', ���� ��, �� ����, ������ ��, ������ � ��, �� ������ ����, ����� ��, ����������� ' . $c['name'] . ', ����������� ��, combats, �������, combats ru, combats com, OldBK, oldbk ru, oldbk com, �����, old bk, ��� ��, mycombats, rebk, recombats, oldcombats, obk2'; //�������� ����� META
-$c['desc'] = '�' . $c['name'] . '� � ��� ���������� ������������� ���������� ������ ���� 2004-2009�, � ������� ���������������� ��� ����� ������ �� ����������� ������ ���. � ���� ���������� ���� �������� ����� ���������� �������� ���� ��������� ������ ���� ��� ��������� �' . $c['name'] . ' 2004-2009�, �������, ������, ����� ����������������� ���� ���������� ���.'; //�������� META
+header('Cache-Control: no-cache, no-store, must-revalidate');
+header('Pragma: no-cache');
+header('Expires: 0');
 
-//�������
-$c['host'] = 'new-combats.com';
-$c['forum'] = 'forum.' . $c['host'];
-$c['img'] = 'img' . $c['host'];
-$c['thiscity'] = 'capitalcity';
-$c['capitalcity'] = $c['host'];
-$c['abandonedplain'] = $c['host'];
-$c['exit'] = '<script>top.location="https://' . $c['host'] . '/";</script><noscript><meta http-equiv="refresh" content="0; URL=https://' . $c['host'] . '/"></noscript>';
+require_once 'mysql_override.php';
 
-//������
-$c['curency_name'] = 'RUB';
-$c['curency_value'] = 36;
-
-//��� ����
-$c['bot_level'] = 0; // �� ������ ��� ��� (������������)
-$c['propsk_die'] = 0; //������ ��� �������� �����, 0 - ����. , >= 1 - ���������� ��������� �� ������ ��� ���������
-
-//������
-$c['exp'] = 0; //����� �����
-$c['shop_type1'] = 100; //� ��� �� �������
-$c['shop_type2'] = 90; //� ������� �� �������
-$c['shop_all'] = 0; //������ �� ���! , 0 - ������� ��� ���������� ������.
-$c['shop_all_type1'] = 100; //������ ������ � ����! , 0 - ������� ��� ���������� ������.
-$c['shop_all_type2'] = 100; //������ ������ � �������! , 0 - ������� ��� ���������� ������. 
-//
-$c['nosanich'] = true; //��������� ������ �� �������� - true , �������� - false
-$c['zuby'] = false; //����
-$c['limitedexp'] = false; //����� �����
-$c['infinity5level'] = false; //������ 5 ������
-$c['expstop'] = 2999999; //9; //���� �� ������� ��������������� 11 149999999
-$c['expstopu'] = 2999999; //���� �� ������� ���������������
-$c['noobgade'] = false; //��� ����� (������)
-$c['bonusonline'] = true; //����� �� ������
-$c['level_ransfer'] = 8; //� ������ ������ ��������� ��������
-$c['znahar'] = true; //���������� �������
-$c['nolevel'] = false; //������������� �������
-$c['noitembuy'] = false; //�� ������� ������� ��� �������
-$c['effz'] = 0; //�������� �������� ����� �����
-$c['money_haot'] = true; //�� �� �����
-$c['crtoecr'] = 500; //���� ������ �� �� ��� (���� 0, �� ���������)
-$c['ecrtocr'] = 200; //���� ������ ��� �� ��
-$c['bonuslevel'] = true; //����� ������
-$c['bonussocial'] = false; //����� ����������
-
-$c['w'] = date('w');
-$c['m'] = date('m');
-
-$code = '1';
-$c['counters'] = '';
-$c['counters_noFrm'] = '';
-$c['securetime'] = 0; //����� ���������� ���������� ������ ������ (������ ������ �� ����� ������ ������ ���)
-
-$c['copyright'] = 'Copyright � ' . date('Y') . ' � ����� ���������� ���� �';
-
-if (isset($_GET['version'])) {
-    die('Version: ' . $c['ver']);
-}
-
-// ��� ���� ���������, ���� ��� ������������ �������.
+// Для всех доработок, пока нет автозагрузки классов.
 require_once 'class/Insallah/Config.php';
 
-// ��������� � ������������.
-// ������� �� ���������� � ������ ���������� ������� � ������!
-// "�� �����."
+// Попробуем в автозагрузку.
+// Никогда не заработает с такими названиями классов и файлов!
+// "На потом."
 spl_autoload_register(function ($className) {
     # 1 with namespaces
     # 2 without
@@ -87,9 +24,16 @@ spl_autoload_register(function ($className) {
         __DIR__ . '/class/' . str_replace('\\', '/', $className . '.php'),
         __DIR__ . '/class/' . $className . '.php'
         ];
-    foreach ($fileName as $file)
-    if (file_exists($file)) {
-        require_once $file;
-        break;
+    foreach ($fileName as $file) {
+        if (file_exists($file)) {
+            require_once $file;
+            break;
+        }
     }
 });
+
+$code = '1';
+$c = (new \Core\Config())->get();
+if (isset($_GET['version'])) {
+    die('Version: ' . $c['ver']);
+}
diff --git a/_incl_data/autoload.php b/_incl_data/autoload.php
new file mode 100644
index 00000000..2cbd855d
--- /dev/null
+++ b/_incl_data/autoload.php
@@ -0,0 +1,45 @@
+<?php
+const GAME = true; // Для совместимости с этой "защитой".
+const GAME_VERSION = 'alpha-7.4';
+// Новая автозагрузка.
+// ВНИМАНИЕ! Не введено в эксплуатацию!
+
+require_once 'mysql_override.php';
+
+spl_autoload_register(function (string $className) {
+    # 1 with namespaces
+    # 2 without
+    $fileName = [
+        __DIR__ . '/class/' . str_replace('\\', DIRECTORY_SEPARATOR, $className . '.php'),
+        __DIR__ . '/class/' . $className . '.php'
+    ];
+    foreach ($fileName as $file) {
+        if (file_exists($file)) {
+            require_once $file;
+            break;
+        }
+    }
+});
+
+spl_autoload_register(function (string $classname) {
+    $classMap = [
+        'NewCombats' => __DIR__ . '/class/',
+        'Insallah' => __DIR__ . '/class/Insallah/',
+    ];
+    $parts = explode('\\', $classname);
+    $namespace = array_shift($parts);
+    $classFile = array_pop($parts) . '.php';
+
+    if (!array_key_exists($namespace, $classMap)) {
+        return;
+    }
+
+    $path = implode(DIRECTORY_SEPARATOR, $parts);
+    $file = $classMap[$namespace] . $path . DIRECTORY_SEPARATOR . $classFile;
+
+    if (!file_exists($file) && !class_exists($classname)) {
+        return;
+    }
+
+    require_once $file;
+});
diff --git a/_incl_data/class/Core/Mail.php b/_incl_data/class/Core/Mail.php
new file mode 100644
index 00000000..3683a255
--- /dev/null
+++ b/_incl_data/class/Core/Mail.php
@@ -0,0 +1,40 @@
+<?php
+
+namespace Core;
+
+use PHPMailer;
+
+class Mail
+{
+    public static function send($to, $message, $subject = '���������� ����')
+    {
+        require dirname(__DIR__) . '/mail/class.phpmailer.php';
+        $message = mb_convert_encoding($message, 'UTF-8', 'CP1251');
+        $subject = mb_convert_encoding($subject, 'UTF-8', 'CP1251');
+        $mail = new PHPMailer;
+
+        $mail->IsSMTP();                                      // Set mailer to use SMTP
+        $mail->Host = 'smtp.mail.yahoo.com';  // Specify main and backup server
+        $mail->SMTPAuth = true;                               // Enable SMTP authentication
+        $mail->Username = 'newcombats@yahoo.com';                            // SMTP username
+        $mail->Password = 'uqcdbnsoagxcyysh';
+        $mail->SMTPSecure = 'tls';                            // Enable encryption, 'ssl' also accepted
+        $mail->Port = 587;
+        $mail->CharSet = 'UTF-8';
+
+        $mail->From = 'newcombats@yahoo.com';
+        $mail->FromName = mb_convert_encoding('���������� ����', 'UTF-8', 'CP1251');
+        $mail->AddAddress($to);  // Add a recipient
+
+        $mail->IsHTML(true);                                  // Set email format to HTML
+
+        $mail->Subject = $subject;
+        $mail->Body = '<div>' . $message . '</div>';
+        $mail->AltBody = $message;
+
+        if (!$mail->Send()) {
+            return 'Message could not be sent. Mailer Error: ' . $mail->ErrorInfo;
+        }
+        return 1;
+    }
+}
\ No newline at end of file
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
index ab123b1b..02d1d4f9 100644
--- a/_incl_data/class/Insallah/Config.php
+++ b/_incl_data/class/Insallah/Config.php
@@ -10,7 +10,6 @@ require_once 'Tournament/Tournament.php';
 require_once 'Tournament/TournamentModel.php';
 require_once 'Achievements.php';
 
-
 //������ ����� ��� �������.
 if (Tournament::IS_ENABLED) {
     (new Tournament())->startAllBattles();
diff --git a/_incl_data/class/Insallah/Core/Db.php b/_incl_data/class/Insallah/Core/Db.php
index fcdcc9fe..e64b9728 100644
--- a/_incl_data/class/Insallah/Core/Db.php
+++ b/_incl_data/class/Insallah/Core/Db.php
@@ -2,7 +2,9 @@
 
 namespace Insallah;
 
+use Core\Database;
 use Exception;
+use http\Message;
 use PDO;
 use PDOException;
 use PDOStatement;
@@ -35,21 +37,23 @@ 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,
                     ]
                 );
+//                self::$db = Database::pdoinit();
             } catch (PDOException $e) {
-                throw new Exception ($e->getMessage());
+                throw new Exception($e->getMessage());
             }
         }
         return self::$instance;
@@ -59,7 +63,8 @@ class Db
      * @param $stmt
      * @return PDOStatement
      */
-    public static function query($stmt)  {
+    public static function query($stmt)
+    {
         return self::$db->query($stmt);
     }
 
@@ -67,7 +72,8 @@ class Db
      * @param $stmt
      * @return PDOStatement
      */
-    public static function prepare($stmt)  {
+    public static function prepare($stmt)
+    {
         return self::$db->prepare($stmt);
     }
 
@@ -75,25 +81,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 +115,32 @@ class Db
     }
 
     /**
-     * @param $query
+     * @param       $query
      * @param array $args
      * @return mixed
      */
-    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
      */
-    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
      */
-    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,11 +149,12 @@ class Db
     }
 
     /**
-     * @param $query
+     * @param       $query
      * @param array $args
      * @return array
      */
-    public static function getColumn($query, $args = [])  {
+    public static function getColumn($query, $args = [])
+    {
         return self::run($query, $args)->fetchAll(PDO::FETCH_COLUMN);
     }
 
diff --git a/_incl_data/class/Insallah/Runes/Runes.php b/_incl_data/class/Insallah/Runes/Runes.php
index e8cafdcc..e40b76c1 100644
--- a/_incl_data/class/Insallah/Runes/Runes.php
+++ b/_incl_data/class/Insallah/Runes/Runes.php
@@ -4,8 +4,7 @@ namespace Insallah;
 
 class Runes
 {
-    /** Создаём руну в зависимости от уровня.
-     *
+    /** ������ ���� � ����������� �� ������.
      * @param $level
      *
      * @return array
@@ -15,7 +14,7 @@ class Runes
         if (!in_array($level, [8, 9, 10])) {
             return [];
         }
-        $power = [8 => 3, 9 => 5, 10 => 7];
+        $power = [8 => 3, 9 => 3, 10 => 5];
         $stats = [8 => 1, 9 => 3, 10 => 3];
         $rand9 = array_rand(array_flip(['hpAll', 'm2', 'm5']));
         $runes = [
@@ -27,24 +26,24 @@ class Runes
             ['s5', 'm11', 'mpAll', 'pzm']
         ];
         $vars = [
-            's1' => ['Сила', mt_rand(1, $stats[$level])],
-            's2' => ['Ловкость', mt_rand(1, $stats[$level])],
-            's3' => ['Интуиция', mt_rand(1, $stats[$level])],
-            's5' => ['Интеллект', mt_rand(1, $stats[$level])],
-            'pa1' => ['Мощности Колющего урона', mt_rand(1, $power[$level])],
-            'pa2' => ['Мощности Рубящего урона', mt_rand(1, $power[$level])],
-            'pa3' => ['Мощности Дробящего урона', mt_rand(1, $power[$level])],
-            'pa4' => ['Мощности Режущего урона', mt_rand(1, $power[$level])],
-            'm2' => ['мф. Против Критического Удара', mt_rand(5, 15)],
-            'm3' => ['МК', mt_rand(1, 3)],
-            'antm3' => ['ПМК', mt_rand(1, 3)],
-            'm5' => ['мф. Против Увертывания', mt_rand(5, 10)],
-            'm11' => ['Мощности Магии стихии', mt_rand(1, $power[$level])],
+            's1' => ['����', mt_rand(1, $stats[$level])],
+            's2' => ['��������', mt_rand(1, $stats[$level])],
+            's3' => ['��������', mt_rand(1, $stats[$level])],
+            's5' => ['���������', mt_rand(1, $stats[$level])],
+            'pa1' => ['�������� �������� �����', mt_rand(1, $power[$level])],
+            'pa2' => ['�������� �������� �����', mt_rand(1, $power[$level])],
+            'pa3' => ['�������� ��������� �����', mt_rand(1, $power[$level])],
+            'pa4' => ['�������� �������� �����', mt_rand(1, $power[$level])],
+            'm2' => ['��. ������ ������������ �����', mt_rand(5, 15)],
+            'm3' => ['��', mt_rand(1, 3)],
+            'antm3' => ['���', mt_rand(1, 3)],
+            'm5' => ['��. ������ �����������', mt_rand(5, 10)],
+            'm11' => ['�������� ����� ������', mt_rand(1, $power[$level])],
             'hpAll' => ['HP', mt_rand(5, 15)],
             'mpAll' => ['MP', mt_rand(10, 20)],
-            'pzm' => ['Подавление защиты от магии', 1],
-            'za' => ['Защита от Урона', mt_rand(5, 10)],
-            'zma' => ['Защита от Магии', mt_rand(5, 10)]
+            'pzm' => ['���������� ������ �� �����', 1],
+            'za' => ['������ �� �����', mt_rand(5, 10)],
+            'zma' => ['������ �� �����', mt_rand(5, 10)]
         ];
 
         $rune = $runes[array_rand($runes)]; // arr (s, pa\m, rand9\mpAll, other)
@@ -52,40 +51,40 @@ class Runes
         $runeVals = [$vars[$rune[0]][1], $vars[$rune[1]][1], $vars[$rune[2]][1], $vars[$rune[3]][1]];
         $resultRune = array_combine($rune, $runeVals);
         $resultText = array_combine($runeTxt, $runeVals);
-        if ($level < 10) { // Отрезаем параметр 4.
+        if ($level < 10) { // �������� �������� 4.
             array_pop($resultRune);
             array_pop($resultText);
         }
-        if ($level < 9) { // Отрезаем параметр 3.
+        if ($level < 9) { // �������� �������� 3.
             array_pop($resultRune);
             array_pop($resultText);
         }
-        //Строчка data в базу
+        //������� data � ����
         $returnData = '|' . http_build_query($resultRune, '', '|');
         $returnData = str_replace('|', '|add_', $returnData);
-        //Строчка человекопонятных параметров в статус.
-        $returnText = urldecode(http_build_query($resultText, '', ', '));
-        $returnText = 'Характеристики Руны: ' . str_replace('=', ': +', $returnText) . '.';
+        //������� ���������������� ���������� � ������.
+        $returnText =  urldecode(http_build_query($resultText, '', ', '));
+        $returnText = '�������������� ����: ' . str_replace('=', ': +', $returnText) . '.';
         return [$returnData, $returnText];
     }
 
-    /** Выкусывает руну из предмета.
+    /** ���������� ���� �� ��������.
      *
      * @param array $itemDataArray
-     * data предмета
+     * data ��������
      *
-     * @return array массив, item - предмет, rune - руна из предмета, rune_id - id руны.
-     * Оба в подготовленном строчном формате для data
+     * @return array ������, item - �������, rune - ���� �� ��������, rune_id - id ����.
+     * ��� � �������������� �������� ������� ��� data
      */
     public static function removeRuneData($itemDataArray)
     {
-        # Ищем есть ли в предмете руна определённого типа.
+        # ���� ���� �� � �������� ���� ������������ ����.
         $runeid = array_search('rune_id', array_flip($itemDataArray));
         if (!in_array($runeid, [6001, 6002, 6003])) {
             return [];
         }
         $bonusArgs = 0;
-        # В зависимости от типа руны считаем количество элементов-бонусов.
+        # � ����������� �� ���� ���� ������� ���������� ���������-�������.
         if ($runeid === 6001) {
             $bonusArgs = 2;
         }
diff --git a/_incl_data/class/PriemsMain.php b/_incl_data/class/PriemsMain.php
deleted file mode 100644
index 3843c79c..00000000
--- a/_incl_data/class/PriemsMain.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-
-class PriemsMain extends priems
-{
-/**
- * �������� ���� ��� ������� ������.
- * �� ������ ����� - ������� �� ������������ �������������,
- * ������ ��� "������ ������� ������", ���� �� ����� ������ � ���� ������������.
- * ���� �������� _cron_, _cron_ �������� priems, priems �������� N.php
- * N.php �������� _cron_, _users, _battles.
- * �� ��� � ������ ������, ������ �� �������� � ����� �� ����� � �����.
- */
-}
\ No newline at end of file
diff --git a/_incl_data/class/UserStats.php b/_incl_data/class/UserStats.php
index 4b3a5588..55f85e31 100644
--- a/_incl_data/class/UserStats.php
+++ b/_incl_data/class/UserStats.php
@@ -7,7 +7,6 @@ class UserStats
     /**
      * �������� ����� ���� ������� � ������ ��������� � �������� �������.
      * @param $userId
-     * @param bool $showAll
      * @return array
      */
     public static function getAllBonuses($userId, $showAll = false)
@@ -18,7 +17,6 @@ class UserStats
 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);
diff --git a/_incl_data/class/__battle.php b/_incl_data/class/__battle.php
deleted file mode 100644
index a92357d4..00000000
--- a/_incl_data/class/__battle.php
+++ /dev/null
@@ -1,11806 +0,0 @@
-<?
-
-if (!defined('GAME')) {
-    die();
-}
-ignore_user_abort(true);
-ini_set('memory_limit', '512M');
-
-class battleClass
-{
-
-    public function maginfoattack($u1, $u2, $type)
-    {
-        /*
-		1 - �����,
-		2 - ������,
-		3 - ����,
-		4 - �����
-		*/
-        //$r = ' title=('.$u1.','.$u2.','.$type.') ';
-        $v_l = str_replace(' ', '&nbsp;', $this->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 .= '<div class=\"pimg\" pog=\"0\" col=\"0\" stl=\"0\" stt=\"��������\"><img src=\"https://img.new-combats.com/i/eff/effs_hide.gif\"/></div>';
-                $ef .= '<div class=\"pimg\" pog=\"0\" col=\"0\" stl=\"0\" stt=\"��������\"><img src=\"https://img.new-combats.com/i/eff/effs_hide.gif\"/ onclick=\"top.useMagicBattle(\'��������\',7777,\'effs_show.gif\',1,2);\" onmouseover=\"top.hi(this,\'<strong>��������</strong>\',event,3,1,1,1,\'\');\" onmouseout=\"top.hic();\" onmousedown=\"top.hic();\"></div>';
-
-                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 = '<strong><u>' . $eff[$i]['name'] . '</u></strong>';
-                            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 .= '<br>';
-
-                            $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.'<br>';
-                                } 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 .= '<br>�����: <strong>' . $this->users[$this->uids[$eff[$i]['user_use']]]['login2'] . '</strong>';
-                                } elseif ($this->users[$this->uids[$eff[$i]['user_use']]]['login'] != '') {
-                                    $ei .= '<br>�����: <strong>' . $this->users[$this->uids[$eff[$i]['user_use']]]['login'] . '</strong>';
-                                }
-                            }
-
-                            //�������� �������
-                            $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 .= '<br>' . $u->is[$n] . ': ' . $z . '' . $ed['add_' . $n];
-                                }
-                                $x++;
-                            }
-
-                            if ($ed['add_mib1'] != 0) {
-                                if ($ed['add_mab1'] != 0) {
-                                    $tr .= '<br>����� ������: ' . $ed['add_mib1'] . '-' . $ed['add_mab1'] . '';
-                                } else {
-                                    $m1l = $ed['add_mib1'];
-                                    if ($m1l > 0) {
-                                        $m1l = '+' . $m1l;
-                                    }
-                                    $tr .= '<br>����� ������: ' . $m1l . '';
-                                }
-                            }
-                            if ($ed['add_mib2'] != 0) {
-                                if ($ed['add_mab2'] != 0) {
-                                    $tr .= '<br>����� �������: ' . $ed['add_mib2'] . '-' . $ed['add_mab2'] . '';
-                                } else {
-                                    $m1l = $ed['add_mib2'];
-                                    if ($m1l > 0) {
-                                        $m1l = '+' . $m1l;
-                                    }
-                                    $tr .= '<br>����� �������: ' . $m1l . '';
-                                }
-                            }
-                            if ($ed['add_mib3'] != 0) {
-                                if ($ed['add_mab3'] != 0) {
-                                    $tr .= '<br>����� �����: ' . $ed['add_mib3'] . '-' . $ed['add_mab3'] . '';
-                                } else {
-                                    $m1l = $ed['add_mib3'];
-                                    if ($m1l > 0) {
-                                        $m1l = '+' . $m1l;
-                                    }
-                                    $tr .= '<br>����� �����: ' . $m1l . '';
-                                }
-                            }
-                            if ($ed['add_mib4'] != 0) {
-                                if ($ed['add_mab4'] != 0) {
-                                    $tr .= '<br>����� ���: ' . $ed['add_mib4'] . '-' . $ed['add_mab4'] . '';
-                                } else {
-                                    $m1l = $ed['add_mib4'];
-                                    if ($m1l > 0) {
-                                        $m1l = '+' . $m1l;
-                                    }
-                                    $tr .= '<br>����� ���: ' . $m1l . '';
-                                }
-                            }
-
-                            $efix = 0;
-                            if (isset($ed['add_pog2']) && $ed['add_pog2'] > 0) {
-                                $efix = $ed['add_pog2'];
-                            }
-                            if (isset($ed['add_pog'])) {
-                                $tr .= '<br>���������� ������ �������� ��������� ��� <strong>' . $ed['add_pog'] . '</strong> ��. �����';
-                            }
-                            if (isset($ed['add_pog2'])) {
-                                $tr .= '<br>���������� ������ �������� ��������� ��� <strong>' . $ed['add_pog2'] . '</strong> ��. ����� <small>(' . $ed['add_pog2p'] . '%)</small>';
-                            }
-
-                            if ($tr != '') {
-                                $ei .= $tr;
-                            }
-                            if ($eff[$i]['info'] != '') {
-                                $ei .= '<br><i>����������:</i><br>' . $eff[$i]['info'];
-                            }
-
-                            //$ef .= '<img width=\"38\" style=\"margin:1px;display:block;float:left;\" src=\"https://img.new-combats.com/i/eff/'.$eff[$i]['img'].'\" onMouseOver=\"top.hi(this,\''.$ei.'\',event,0,1,1,1,\'\');\" onMouseOut=\"top.hic();\" onMouseDown=\"top.hic();\" />';
-                            $ef .= '<div class=\"pimg\" pog=\"' . $efix . '\" col=\"' . $eff[$i]['x'] . '\" stl=\"0\" stt=\"' . $ei . '\"><img src=\"https://img.new-combats.com/i/eff/' . $eff[$i]['img'] . '\"/></div>';
-                            unset($efix);
-                        }
-                    } elseif ($eff[$i] != 'delete') {
-                        $i = -2;
-                    }
-                    $i++;
-                }
-            } else {
-                $ef .= '<div class=\"pimg\" pog=\"0\" col=\"0\" stl=\"0\" stt=\"����������\"><img src=\"https://img.new-combats.com/i/eff/effs_show.gif\"/ onclick=\"top.useMagicBattle(\'����������\',5555,\'effs_show.gif\',1,2);\" onmouseover=\"top.hi(this,\'<strong>����������</strong>\',event,3,1,1,1,\'\');\" onmouseout=\"top.hic();\" onmousedown=\"top.hic();\"></div>';
-            }
-            if ($st['itmslvl'] == 0 && $ur['bot_id'] == 0) {
-                //$ef .= '<div class=\"pimg\" pog=\"0\" col=\"0\" stl=\"0\" stt=\"<strong><u>������ ����������</u></strong> (������)<br>��������: <i>����������</i>\"><img src=\"https://img.new-combats.com/i/eff/light_armor.gif\"/></div>';
-            }
-
-            $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 = '<img src=\"https://img.new-combats.com/i/clan/' . $cl['name_mini'] . '.gif\" title=\"' . $cl['name'] . '\">';
-                }
-            }
-            if ($ur['align'] > 0) {
-                $ca = '<img src=\"https://img.new-combats.com/i/align/align' . $ur['align'] . '.gif\">' . $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 = '<strong>' . $ur['login2'] . '</strong>';
-            $stsua .= '<br>����: ' . $st['s1'];
-            $stsua .= '<br>��������: ' . $st['s2'];
-            $stsua .= '<br>��������: ' . $st['s3'];
-            $stsua .= '<br>������������: ' . $st['s4'];
-            if ($st['s5'] != 0) {
-                $stsua .= '<br>��������: ' . $st['s5'];
-            }
-            if ($st['s6'] != 0) {
-                $stsua .= '<br>��������: ' . $st['s6'];
-            }
-            if ($st['s7'] != 0) {
-                $stsua .= '<br>����������: ' . $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 . '<a href=\"javascript:void(0)\" onclick=\"top.chat.addto(\'' . $ur['login2'] . '\',\'to\');return false;\">' . $ur['login2'] . '</a> [' . $ur['level'] . ']<a href=\"info/' . $ur['id'] . '\" target=\"_blank\"><img src=\"https://img.new-combats.com/i/inf_' . $ur['cityreg'] . '.gif\" title=\"���. � ' . $ur['login2'] . '\"></a>&nbsp;","' . $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 = '<strong>' . $itm[$i]['name'] . '</strong>';
-                $td = $u->lookStats($itm[$i]['data']);
-                $lvar = '';
-                if ($td['add_hpAll'] > 0) {
-                    if ($td['add_hpAll'] > 0) {
-                        $td['add_hpAll'] = '+' . $td['add_hpAll'];
-                    }
-                    $lvar .= '<br>������� �����: ' . $td['add_hpAll'] . '';
-                }
-                if ($td['sv_yron_max'] > 0 || $td['sv_yron_min'] > 0) {
-                    $lvar .= '<br>����: ' . (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 .= '<br>����� ������: ' . $m1l . '' . (0 + $td['add_mab1']) . '';
-                    } else {
-                        $lvar .= '<br>����� ������: ' . (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 .= '<br>����� �������: ' . $m1l . '' . (0 + $td['add_mab2']) . '';
-                    } else {
-                        $lvar .= '<br>����� �������: ' . (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 .= '<br>����� �����: ' . $m1l . '' . (0 + $td['add_mab3']) . '';
-                    } else {
-                        $lvar .= '<br>����� �����: ' . (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 .= '<br>����� ���: ' . $m1l . '' . (0 + $td['add_mab4']) . '';
-                    } else {
-                        $lvar .= '<br>����� ���: ' . (0 + $td['add_mib4']) . '-' . (0 + $td['add_mab4']) . '';
-                    }
-                }
-                if ($itm[$i]['iznosMAX'] > 0) {
-                    if ($itm[$i]['iznosMAXi'] == 999999999) {
-                        $lvar .= '<br>�������������: <font color=brown>�����������</font>';
-                    } else {
-                        $lvar .= '<br>�������������: ' . 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 '<center><strong><font color=red>������������ �����...</font></strong></center>';
-                        //
-                        $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 . '<img width=12 height=15 src=https://img.new-combats.com/i/align/align' . $id['align'] . '.gif >';
-                            }
-                            if ($id['clan'] > 0) {
-                                $btxt = $btxt . '<img width=24 height=15 src=https://img.new-combats.com/i/clan/' . $id['clan'] . '.gif >';
-                            }
-                            $btxt = $btxt . '<strong>{u1}</strong>[' . $id['level'] . ']<a href=info/' . $id['id'] . ' target=_blank ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-                            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 . '<img width=12 height=15 src=https://img.new-combats.com/i/align/align' . $id['align'] . '.gif >';
-                            }
-                            if ($id['clan'] > 0) {
-                                $btxt = $btxt . '<img width=24 height=15 src=https://img.new-combats.com/i/clan/' . $id['clan'] . '.gif >';
-                            }
-                            $btxt = $btxt . '<strong>{u1}</strong>[' . $id['level'] . ']<a href=info/' . $id['id'] . ' target=_blank ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-                            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 . '<img width=12 height=15 src=https://img.new-combats.com/i/align/align' . $id['align'] . '.gif >';
-                            }
-                            if ($id['clan'] > 0) {
-                                $btxt = $btxt . '<img width=24 height=15 src=https://img.new-combats.com/i/clan/' . $id['clan'] . '.gif >';
-                            }
-                            $btxt = $btxt . '<strong>{u1}</strong>[' . $id['level'] . ']<a href=info/' . $id['id'] . ' target=_blank ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-                            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 . '<img width=12 height=15 src=https://img.new-combats.com/i/align/align' . $id['align'] . '.gif >';
-                                }
-                                if ($id['clan'] > 0) {
-                                    $btxt = $btxt . '<img width=24 height=15 src=https://img.new-combats.com/i/clan/' . $id['clan'] . '.gif >';
-                                }
-                                $btxt = $btxt . '<strong>{u1}</strong>[' . $id['level'] . ']<a href=info/' . $id['id'] . ' target=_blank ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-                                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 . '<img width=12 height=15 src=https://img.new-combats.com/i/align/align' . $id['align'] . '.gif >';
-                                    }
-                                    if ($id['clan'] > 0) {
-                                        $btxt = $btxt . '<img width=24 height=15 src=https://img.new-combats.com/i/clan/' . $id['clan'] . '.gif >';
-                                    }
-                                    $btxt = $btxt . '<strong>{u1}</strong>[' . $id['level'] . ']<a href=info/' . $id['id'] . ' target=_blank ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-                                    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($i<count($bots))
-							{
-								if($bots[$i]>0)
-								{
-									$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'] = '<span class=date>' . date('H:i') . '</span> <strong>' . $u->info['login'] . '</strong> ��������������� ������� &quot;<strong>���������</strong>&quot;.';
-                        } else {
-                            $mas['text'] = '<span class=date>' . date('H:i') . '</span> <strong>' . $u->info['login'] . '</strong> �������������� ������� &quot;<strong>���������</strong>&quot;.';
-                        }
-                        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'] .= ' <font color=#0066aa><strong>+' . $hpSks . '</strong></font>';
-                        } else {
-                            $hpSks = 0;
-                            $mas['text'] .= ' <font color=#0066aa><strong>--</strong></font>';
-                        }
-                        $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'] . "','�� ������� ������� &quot;�������&quot;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 .= '<strong>' . $this->users[$i]['login'] . '</strong>, ';
-                        }
-                        $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 = '<strong>' . $this->users[$i]['login'] . '</strong> �������� �����������: <font color=red>' . $tr_nm[$tr_tp] . ' ������</font>.<br>' . $vtvl;
-                                    } else {
-                                        $vtvl = '<strong>' . $this->users[$i]['login'] . '</strong> ������� �����������: <font color=red>' . $tr_nm[$tr_tp] . ' ������</font>.<br>' . $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 = '<strong>' . $this->users[$i]['login'] . '</strong> �������� ����������� (����������, �����: <strong>' . $this->users[$this->uids[$tr_pl['user_use']]]['login'] . '</strong>): <font color=red>' . $tr_nm[$tr_tp] . ' ������</font>.<br>' . $vtvl;
-                                } else {
-                                    $vtvl = '<strong>' . $this->users[$i]['login'] . '</strong> ������� ����������� (����������, �����: <strong>' . $this->users[$this->uids[$tr_pl['user_use']]]['login'] . '</strong>): <font color=red>' . $tr_nm[$tr_tp] . ' ������</font>.<br>' . $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 .= '<img src=https://img.new-combats.com/i/align/align' . $usr_real['align'] . '.gif width=12 height=15 >';
-                                }
-                                if ($usr_real['clan'] > 0) {
-                                    $usrreal .= '<img src=https://img.new-combats.com/i/clan/' . $usr_real['clan'] . '.gif width=24 height=15 >';
-                                }
-                                $usrreal .= '<strong>' . $usr_real['login'] . '</strong>[' . $usr_real['level'] . ']<a target=_blank href=https://new-combats.com/info/' . $usr_real['id'] . ' ><img width=12 hiehgt=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-                            } else {
-                                $mereal = '<i>���������</i>[??]';
-                            }
-                            $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 ("<font color=red>��������!</font> ' . mysql_real_escape_string(str_replace('{b}',
-                                            '<strong>' . $this->users[$i]['login'] . '</strong> [' . $this->users[$i]['level'] . ']<a target=_blank href=info/' . $this->users[$i]['id'] . ' ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>',
-                                            $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 .= '<img width=12 height=15 src=https://img.new-combats.com/i/align/align' . $this->users[$j]['align'] . '.gif >';
-                                                }
-                                                if ($this->users[$j]['clan'] > 0) {
-                                                    $usrwin .= '<img width=24 height=15 src=https://img.new-combats.com/i/clan/' . $this->users[$j]['clan'] . '.gif >';
-                                                }
-                                                $usrwin .= '<strong>' . $this->users[$j]['login'] . '</strong> [' . $this->users[$j]['level'] . ']<a target=_blank href=info/' . $this->users[$j]['id'] . ' ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-                                            }
-                                        }
-                                        $j++;
-                                    }
-                                    if ($usrwin != '') {
-                                        $usrwin = ltrim($usrwin, ', ');
-                                    } else {
-                                        $usrwin = '<i>������� ������</i>';
-                                    }
-
-
-                                    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 ("<font color=red>��������!</font> ' . mysql_real_escape_string(str_replace('{b}',
-                                            '<strong>' . $this->users[$i]['login'] . '</strong> [' . $this->users[$i]['level'] . ']<a target=_blank href=info/' . $this->users[$i]['id'] . ' ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>',
-                                            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 ("<font color=red>��������!</font> ' . mysql_real_escape_string(str_replace('{b}',
-                                            '<strong>' . $this->users[$i]['login'] . '</strong> [' . $this->users[$i]['level'] . ']<a target=_blank href=info/' . $this->users[$i]['id'] . ' ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>',
-                                            $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'] .= ' �� ����������� �������� �� ��������� <strong>�������� ������ (x5)</strong>. ';
-                                    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'] .= ' � <strong>����� ������</strong>. ';
-                                        }
-                                    }
-                                } else {
-                                    $pld['battle_text'] .= ' �� ������ �� ��������. <strong>����� ������ ������ 500 ����� �����</strong> .';
-                                }
-
-                                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 = '� <strong>' . $tbot2['login'] . '</strong> ��� ������� &quot;' . $itmnm . '&quot; � ��� ������ ����� ������� ���';
-                                                    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 = '� <strong>' . $tbot2['login'] . '</strong> ��� ������� &quot;' . $itmnm . '&quot; � ��� ������ ����� ������� ���';
-                                        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 = '� <strong>' . $tbot2['login'] . '</strong> ��� ������� &quot;' . $itmnm . '&quot; � ��� ������ ����� ������� ���';
-                                    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;
-                        //��������� ������ ����������
-                        /*if($this->users[$i]['level']>=4 && $this->info['dungeon'] == 0 && $this->stats[$i]['silver'] < 2){
-								$noOsl = 0;
-								$nn = 0;
-								while($nn<count($this->stats[$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'] . "'
-								,'��� ������� &quot;" . $a004['name'] . "&quot; ������� ����: <strong>" . $aexp . "</strong>','-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 .= ' �� �������� <strong>' . $gm[$i] . ' ��.</strong> �� ���� ���.';
-                            $u->addDelo(4, $this->users[$i]['id'],
-                                '&quot;<font color="olive">System.battle</font>&quot;: �������� ������� <strong>' . $gm[$i] . ' ��.</strong> (� ��� �' . $this->info['id'] . ').',
-                                time(), $this->info['city'], 'System.battle', 0, 0);
-                            $this->users[$i]['money'] += $gm[$i];
-                        } elseif (isset($bm[$i])) {
-                            $prc .= ' �� ��������� <strong>' . $bm[$i] . ' ��.</strong> �� ���� ���.';
-                            $u->addDelo(4, $this->users[$i]['id'],
-                                '&quot;<font color="olive">System.battle</font>&quot;: �������� <i>��������</i> <strong>' . $gm[$i] . ' ��.</strong> (� ��� �' . $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 .= ', ������� <strong>0 ���</strong> �� ���� ��� (���� ����� ������).';
-                                //}elseif( $this->stats[$i]['prckr'] < $trmn ) {
-                                //������������ ��������� �� �����
-                                //$prc .= ', ������� <strong>0 ���</strong> �� ���� ��� (� ��� ������� ��������).';
-                            } elseif ($admn > 0) {
-                                if ($this->info['type'] != 33) {
-                                    $prc .= ', ������� <strong>' . $admn . ' ���</strong> �� ���� ���.';
-                                }
-                                $u->addDelo(4, $this->users[$i]['id'],
-                                    '&quot;<font color="olive">System.battle</font>&quot;: �������� ������� <strong>' . $admn . ' ���</strong> (� ��� �' . $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 .= ', ������� <strong>0 ���</strong> �� ���� ���, ��������� ������ �����.';
-										}else{
-											$prc .= ', ������� <strong>'.$admnb.' ���</strong> �� ���� ���.';
-											$u->addDelo(4,$this->users[$i]['id'],'&quot;<font color="olive">System.battle</font>&quot;: �������� ������� <strong>'.$admnb.' ���</strong> (� ��� �'.$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 .= ' �� �������� <strong>' . $gms[$i] . ' $.</strong> �� ���� ���.';
-                            $u->addDelo(4, $this->users[$i]['id'],
-                                '&quot;<font color="olive">System.battle</font>&quot;: �������� ������� <strong>' . $gms[$i] . ' $.</strong> (� ��� �' . $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 .= ' �� ��������� <strong>' . $bms[$i] . ' $.</strong> �� ���� ���.';
-                            $u->addDelo(4, $this->users[$i]['id'],
-                                '&quot;<font color="olive">System.battle</font>&quot;: �������� <i>��������</i> <strong>' . $gms[$i] . ' $.</strong> (� ��� �' . $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 .= ' <img src=https://img.new-combats.com/king.gif width=20 height=20> �� �������� ����: '.$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'] = '��� ��������. ����� ���� �������� �����: <strong>' . floor($this->users[$i]['battle_yron']) . ' HP</strong>. �������� �����: <strong>' . (0 + $this->users[$i]['battle_exp']) . '</strong>' . $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'] .= ' �� �������� <small>' . $u->zuby($rzb,
-                                        1) . '</small> �� ���� ���.';
-                            }
-                        }
-                    }
-
-                    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'] .= ' �� ����������� �������� �� ��������� <strong>�������� ������ (x5)</strong>. ';
-									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'] .= ' � <strong>����� ������</strong>. ';
-											}
-
-									}
-									*/
-                        } 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'] .= ' �� �������� ���� �� ��������� <strong>�������� ����� (x' . floor($tmon / 2) . ')</strong>. (��� ������ �������� ������ �� ������� �� �����, ��� ������ ����� ���������� ������� ��� ������! �������� ������ �������� ������� ' . ($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'] .= ' �� ������ � ����� � ��������� ����� � <strong>' . $urcheck . '</strong> � ����� �� ��������� <strong>-5 ���.</strong> � ����� �� ������!';
-                            }
-                        }
-                        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'] .= ' �� ���� �� ��������� <strong>�������� ������ (' . $tmon . ')</strong>. ����� [' . ($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'] .= ' �� ��������� <strong>����� (x1)</strong>.';
-                            $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 = '<strong>' . $this->users[$i]['login'] . '</strong> ���������� ����� � ��������� � ������ ���������';
-                                } else {
-                                    $rtxt = '<strong>' . $this->users[$i]['login'] . '</strong> ���������� ������� � ��������� � ������ ���������';
-                                }
-                            } else {
-                                if ($this->users[$i]['sex'] == 0) {
-                                    $rtxt = '<strong>' . $this->users[$i]['login'] . '</strong> ���������� ����� � ��������� � ������� &quot;' . $r_n['name'] . '&quot;';
-                                } else {
-                                    $rtxt = '<strong>' . $this->users[$i]['login'] . '</strong> ���������� ������� � ��������� � ������� &quot;' . $r_n['name'] . '&quot;';
-                                }
-                            }
-                        } 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 = '<strong>' . $this->users[$i]['login'] . '</strong> ���������� ����� ��� ����� �� ����������� � �������� ����������' . $nld;
-                                } else {
-                                    $rtxt = '<strong>' . $this->users[$i]['login'] . '</strong> ���������� ������� ��� ����� �� ����������� � �������� ����������' . $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 .= ', ����� ������� ���������� &quot;' . $tinf['login'] . '&quot;';
-                                    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 = '<strong>' . $this->users[$i]['login'] . '</strong> ���������� ����� ��� ����� �� ����������� � �������� ����������' . $nld;
-                            } else {
-                                $rtxt = '<strong>' . $this->users[$i]['login'] . '</strong> ���������� ������� ��� ����� �� ����������� � �������� ����������' . $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'], '<strong>' . $a['name'] . '</strong> ��������� � ���...',
-                                    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 '<script>document.getElementById(\'teams\').style.display=\'none\';var battleFinishData = "' . $u->info['battle_text'] . '";</script>';
-                    }
-                } else {
-                    //echo '<font color=red><strong>�������� ����������, �� �� ������� ��� � 0-�� ������, �������� �������������!</strong></font>';
-                }
-            }
-            //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'] . "','<font color=#cb0000><strong>�� �������� �������:</strong> " . mysql_real_escape_string($cr) . " <strong>��.</strong></font>','-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'] . "','<font color=#cb0000><strong>�������� ��� ����!!!</strong></font>','-1','6','0')");
-                    $u->addDelo(4, $this->users[$this->uids[$uid]]['id'],
-                        '&quot;<font color="olive">System.battle</font>&quot;: (� ��� ��������), ����!!! ', 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'] . "','<font color=#cb0000><strong>�� �������� ����-�������:</strong> " . mysql_real_escape_string($ecr) . " <strong>���.</strong></font>','-1','6','0')");
-                    $u->addDelo(4, $this->users[$this->uids[$uid]]['id'],
-                        '&quot;<font color="olive">System.battle</font>&quot;: �������� ������� <strong>' . $ecr . ' ���</strong> (� ��� ��������), ������: <strong>' . $this->users[$this->uids[$uid]]['money2'] . ' ���</strong>',
-                        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 .= ', &quot;' . $ico_e[3] . ' (<small>����������</small>)&quot;';
-                                    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 .= ', &quot;' . $ico_e[3] . '&quot;';
-                        }
-                    }
-                    //
-                }
-                $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'] . "','<font color=#cb0000><strong>�� ��������� ������:</strong> " . mysql_real_escape_string($txt) . "</font>','-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 .= ', <strong>' . $this->ainm[$itm_e[0]]['name'] . '</strong>';
-                        if ($itm_e[1] > 1) {
-                            $txt .= ' <strong>(x' . $itm_e[1] . ')</strong>';
-                        }
-                    }
-                }
-                $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'] . "','<font color=#cb0000><strong>�� �������� ��������:</strong> " . mysql_real_escape_string($txt) . "</font>','-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 .= ',<br>';
-                    $j++;
-                }
-            }
-
-            $r = str_replace('u1', '<strong>' . $this->users[$this->uids[$u1]]['login'] . '</strong>', $r);
-            $r = str_replace('u2', '<strong>' . $this->users[$this->uids[$u2]]['login'] . '</strong>', $r);
-
-            $r .= '|<br>';
-            $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,
-            ],
-        ];
-
-        //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} <font color=#0071a3><strong>' . $this->addlt($b, 11, $s2,
-                                null) . '</strong></font> ' . $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} <font color=#356d37><strong>' . $this->addlt($b, 10, $s2,
-                                null) . '</strong></font> ' . $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) . ', <u><font color=red>������ ����</font></u>, ' . $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} ���������� <strong><font color=#c59400>���������</font></strong> ' . $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}, ���������������� <u><font color=#356d37>����� �����</font></u>, ' . $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} <font color=#0071a3><strong>' . $this->addlt($b, 11, $s2,
-                                null) . '</strong></font> ' . $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'] .= ', <font color=red>������ ���������� <strong>';
-                                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'] .= ' ������</strong></font>. ';
-                            }
-                        }
-                        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'] .= ' <i>������ �����</i>. ';
-                    }
-                    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'] = '(������&nbsp;����)';
-                        } elseif ($at[$a]['atack'][$j]['yron']['w'] == 14) {
-                            $mas['textWP'] = '(�����&nbsp;����)';
-                        } else {
-                            $mas['textWP'] = '(���������&nbsp;���)';
-                        }
-                        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'] .= ' <font title=' . $mas['textWP'] . ' color=#ff0000><strong>' . $at[$a]['atack'][$j]['yron']['r'] . '</strong></font>';
-                        } else {
-                            $mas['text'] .= ' <font title=' . $mas['textWP'] . ' color=#0066aa><strong>' . $at[$a]['atack'][$j]['yron']['r'] . '</strong></font>';
-                        }
-                        $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'] . ' �� <font Color=#006699><strong>' . $pvr['mpSee'] . '</strong></font> [' . $pvr['mpNow'] . '/' . $pvr['mpAll'] . '] (����)';
-                                $this->priemAddLog($id, 1, 2, $pvr['uid'], 0,
-                                    '<font color^^^^#' . $pvr['color2'] . '>' . $pvr['x'] . '</font>',
-                                    $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}','<span class=\"date {fru}\">'.date('H:i',$pl['time']).'</span>',$rt);
-						$rt = str_replace('{tm2}','<span class=\"date {fru}\">'.date('H:i',$pl['time']).'</span>',$rt);
-						$rt = str_replace('{tm3}','<span class=\"date {fru}\">'.date('d.m.Y H:i',$pl['time']).'</span>',$rt);
-						$rt = str_replace('{tm4}','<span class=\"date {fru}\">'.date('d.m.Y H:i',$pl['time']).'</span>',$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('"','&quot;',$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}','<span class=\"date {fru}\">'.date('H:i',$pl['time']).'</span>',$rt);
-						$rt = str_replace('{tm2}','<span class=\"date {fru}\">'.date('H:i',$pl['time']).'</span>',$rt);
-						$rt = str_replace('{tm3}','<span class=\"date {fru}\">'.date('d.m.Y H:i',$pl['time']).'</span>',$rt);
-						$rt = str_replace('{tm4}','<span class=\"date {fru}\">'.date('d.m.Y H:i',$pl['time']).'</span>',$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('"','&quot;',$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}', '<span class=\"date {fru}\">' . date('H:i', $pl['time']) . '</span>',
-                        $rt);
-                    $rt = str_replace('{tm2}', '<span class=\"date {fru}\">' . date('H:i', $pl['time']) . '</span>',
-                        $rt);
-                    $rt = str_replace('{tm3}',
-                        '<span class=\"date {fru}\">' . date('d.m.Y H:i', $pl['time']) . '</span>', $rt);
-                    $rt = str_replace('{tm4}',
-                        '<span class=\"date {fru}\">' . date('d.m.Y H:i', $pl['time']) . '</span>', $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('"',
-                        '&quot;', $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}', '<span class=\"date {fru}\">' . date('H:i', $pl['time']) . '</span>', $rt);
-                $rt = str_replace('{tm2}', '<span class=\"date {fru}\">' . date('H:i', $pl['time']) . '</span>', $rt);
-                $rt = str_replace('{tm3}', '<span class=\"date {fru}\">' . date('d.m.Y H:i', $pl['time']) . '</span>',
-                    $rt);
-                $rt = str_replace('{tm4}', '<span class=\"date {fru}\">' . date('d.m.Y H:i', $pl['time']) . '</span>',
-                    $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('"',
-                        '&quot;', $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}', '<span class=\"date {fru}\">' . date('H:i', $plm['time']) . '</span>', $rt);
-                $rt = str_replace('{tm2}', '<span class=\"date {fru}\">' . date('H:i', $plm['time']) . '</span>', $rt);
-                $rt = str_replace('{tm3}', '<span class=\"date {fru}\">' . date('d.m.Y H:i', $plm['time']) . '</span>',
-                    $rt);
-                $rt = str_replace('{tm4}', '<span class=\"date {fru}\">' . date('d.m.Y H:i', $plm['time']) . '</span>',
-                    $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('"',
-                        '&quot;', $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} <i>�����������: ' . $boycom[rand(0, count($boycom) - 1)] . '</i>';
-
-            $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<a href="/logs.php?log='.$this->info['id'].'" target="_blank">'.$this->info['id'].'</a>.(��� �����: 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 ("<font color=#cb0000>'.mysql_real_escape_string($t).'</font>","capitalcity","<font color=green>�������</font>","'.$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} ����� &quot;<strong>' . $pl['name'] . '</strong>&quot;.';
-                    $this->del_val['eff'][$pl['priem']['id']] = true;
-                }
-            } elseif ($t == 2) {
-                $mas1['text'] = '{tm1} � ��������� {u1} ����������� �������� ����� &quot;<strong>' . $pl['name'] . '</strong>&quot;.';
-            } elseif ($t == 99) {
-                $mas1['text'] = '{u1} ���� ����� &quot;<strong>' . $pl['name'] . '</strong>&quot; � ������� <strong>' . $rznm . '</strong> .';
-            } else {
-                if ($t == 100) {
-                    $mas1['id_hod']++;
-                }
-                $mas1['text'] = '{tm1} ����������� �������� ������� &quot;<strong>' . $pl['name'] . '</strong>&quot; ��� {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} ����� &quot;<strong>' . $pl['name'] . '</strong>&quot;.';
-                    $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($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'])
-				{
-					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 '<font color=red><strong>Fatal error: '.$smnr5.' #'.$j.'</strong></font>';
-					}
-					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} ������� �� ���������, � ������� �������� &quot;<strong>' . $tpa3[$a['type']] . ' [' . $a['level'] . ']</strong>&quot; �� {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'],'<strong>'.$a['name'].'</strong> ��������� � ���...',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 '<hr><hr><hr>';
-
-            //������� � ��� ������ ��������
-
-            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 = '���� ���������� <span class=\\\\\"date\\\\\">' . date('d.m.Y H:i',
-                                $this->info['time_start']) . '</span>, ����� ' . $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 = '<img width=24 height=15 title=�����&nbsp;������ src=https://img.new-combats.com/i/lead' . $this->users[$i]['team'] . '.gif \>';
-                }
-                $teams[$this->users[$i]['team']] .= ', ' . $ldr . '<span ' . $a1ms . ' class=\"CSSteam' . $this->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'] . '</span><small> [' . floor($this->stats[$i]['hpNow']) . '/' . $this->stats[$i]['hpAll'] . ']</small>';
-            }
-            $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]] = '<img src=\"https://img.new-combats.com/i/lock3.gif\" style=\"cursor:pointer\" width=\"20\" height=\"15\" onClick=\"top.chat.addto(\'team\',\'private\'); return false;\"> '.$teams[$tms[$i]];
-                //}else{
-                $teams[$tms[$i]] = '<img src=\"https://img.new-combats.com/i/lock3.gif\" style=\"cursor:pointer\" width=\"20\" height=\"15\" onClick=\"top.chat.addto(\'team' . $tms[$i] . '\',\'private\'); return false;\"> ' . $teams[$tms[$i]];
-                //}
-                $ret .= $teams[$tms[$i]];
-                if (count($tms) > $i + 1) {
-                    $ret .= ' <span class=\"CSSvs\">&nbsp; ������ &nbsp;</span> ';
-                }
-            }
-            $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 '<strong><font color=red>'.$name.'</font></strong>';
-        } 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} <strong>' . $this->stats[$this->uids[$u1]]['login'] . '</strong> ����...<strong>' . $this->stats[$this->uids[$u1]]['login'] . '</strong> ��� ������. ';
-                $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} <strong>' . $this->stats[$this->uids[$u1]]['login'] . '</strong> �����.';
-                    $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;
-?>
diff --git a/_incl_data/class/__battle.php-cleared b/_incl_data/class/__battle.php-cleared
deleted file mode 100644
index 49474796..00000000
--- a/_incl_data/class/__battle.php-cleared
+++ /dev/null
@@ -1,8360 +0,0 @@
-<?php
-
-
-use Insallah\Db;
-
-class battleClass
-{
-
-    private $db;
-
-    public function __construct(Db $db)
-    {
-        $this->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(' ', '&nbsp;', $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,
-    ];
-
-    /** �������� ������ (?)
-     * <br>act:
-     * <br>1 - ����� �������� �������� �����������
-     * <br>2 - ����� �������� ������� ����
-     * <br>type_of:
-     * <br>1 - ������
-     * <br>2 - ����
-     * <br>3 - �����
-     * <br>4 - ������
-     * <br>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;
-
-    /** ���������� ������� ����:
-     * <br>1 - ����� ����,
-     * <br>2 - ������� ��� ����������,
-     * <br>3 - ���������. ������� ���������� ��������
-     * @var int
-     */
-    public $mainStatus = 1;
-
-    /** ���������� � ��������
-     * @var array
-     */
-    public $info = [];
-
-    /** ���������� � ������������� � ���� ���
-     * @var array
-     */
-    public $users = [];
-
-    /** ���������� � ������ ������������� � ���� ���
-     * @var array
-     */
-    public $stats = [];
-
-    /** ������ ������������� � �� id � stats ��� users.
-     * <br> ������ id ������������ = 555 , �� $uids[555] ������ ��� ���������� ����� � ������� users \ stats
-     * @var array
-     */
-    public $uids = [];
-
-    /** ������ ������ � ���� ��� (�����������)
-     * @var array
-     */
-    public $atacks = [];
-
-    /** ������ uid ��� ����� ���� � �� ����
-     * <br>$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.
-     * <br> ������ ������ ���������� �� ���������.
-     * @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 .= '<div class=\"pimg\" pog=\"0\" col=\"0\" stl=\"0\" stt=\"��������\"><img src=\"https://img.new-combats.com/i/eff/effs_hide.gif\"/ onclick=\"top.useMagicBattle(\'��������\',7777,\'effs_show.gif\',1,2);\" onmouseover=\"top.hi(this,\'<strong>��������</strong>\',event,3,1,1,1,\'\');\" onmouseout=\"top.hic();\" onmousedown=\"top.hic();\"></div>';
-
-                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 = '<strong><u>' . $eff[$i]['name'] . '</u></strong>';
-                            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 .= '<br>';
-
-                            $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 .= '<br>�����: <strong>' . $this->users[$this->uids[$eff[$i]['user_use']]]['login2'] . '</strong>';
-                                } elseif ($this->users[$this->uids[$eff[$i]['user_use']]]['login'] != '') {
-                                    $ei .= '<br>�����: <strong>' . $this->users[$this->uids[$eff[$i]['user_use']]]['login'] . '</strong>';
-                                }
-                            }
-
-                            //�������� �������
-                            $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 .= '<br>' . $u->is[$n] . ': ' . $z . $ed['add_' . $n];
-                                }
-                                $x++;
-                            }
-
-                            if ($ed['add_mib1'] != 0) {
-                                if ($ed['add_mab1'] != 0) {
-                                    $tr .= '<br>����� ������: ' . $ed['add_mib1'] . '-' . $ed['add_mab1'];
-                                } else {
-                                    $m1l = $ed['add_mib1'];
-                                    if ($m1l > 0) {
-                                        $m1l = '+' . $m1l;
-                                    }
-                                    $tr .= '<br>����� ������: ' . $m1l;
-                                }
-                            }
-                            if ($ed['add_mib2'] != 0) {
-                                if ($ed['add_mab2'] != 0) {
-                                    $tr .= '<br>����� �������: ' . $ed['add_mib2'] . '-' . $ed['add_mab2'];
-                                } else {
-                                    $m1l = $ed['add_mib2'];
-                                    if ($m1l > 0) {
-                                        $m1l = '+' . $m1l;
-                                    }
-                                    $tr .= '<br>����� �������: ' . $m1l;
-                                }
-                            }
-                            if ($ed['add_mib3'] != 0) {
-                                if ($ed['add_mab3'] != 0) {
-                                    $tr .= '<br>����� �����: ' . $ed['add_mib3'] . '-' . $ed['add_mab3'];
-                                } else {
-                                    $m1l = $ed['add_mib3'];
-                                    if ($m1l > 0) {
-                                        $m1l = '+' . $m1l;
-                                    }
-                                    $tr .= '<br>����� �����: ' . $m1l;
-                                }
-                            }
-                            if ($ed['add_mib4'] != 0) {
-                                if ($ed['add_mab4'] != 0) {
-                                    $tr .= '<br>����� ���: ' . $ed['add_mib4'] . '-' . $ed['add_mab4'];
-                                } else {
-                                    $m1l = $ed['add_mib4'];
-                                    if ($m1l > 0) {
-                                        $m1l = '+' . $m1l;
-                                    }
-                                    $tr .= '<br>����� ���: ' . $m1l;
-                                }
-                            }
-
-                            $efix = 0;
-                            if (isset($ed['add_pog2']) && $ed['add_pog2'] > 0) {
-                                $efix = $ed['add_pog2'];
-                            }
-                            if (isset($ed['add_pog'])) {
-                                $tr .= '<br>���������� ������ �������� ��������� ��� <strong>' . $ed['add_pog'] . '</strong> ��. �����';
-                            }
-                            if (isset($ed['add_pog2'])) {
-                                $tr .= '<br>���������� ������ �������� ��������� ��� <strong>' . $ed['add_pog2'] . '</strong> ��. ����� <small>(' . $ed['add_pog2p'] . '%)</small>';
-                            }
-
-                            if ($tr != '') {
-                                $ei .= $tr;
-                            }
-                            if ($eff[$i]['info'] != '') {
-                                $ei .= '<br><i>����������:</i><br>' . $eff[$i]['info'];
-                            }
-
-                            $ef .= '<div class=\"pimg\" pog=\"' . $efix . '\" col=\"' . $eff[$i]['x'] . '\" stl=\"0\" stt=\"' . $ei . '\"><img src=\"https://img.new-combats.com/i/eff/' . $eff[$i]['img'] . '\"/></div>';
-                            unset($efix);
-                        }
-                    } elseif ($eff[$i] != 'delete') {
-                        $i = -2;
-                    }
-                    $i++;
-                }
-            } else {
-                $ef .= '<div class=\"pimg\" pog=\"0\" col=\"0\" stl=\"0\" stt=\"����������\"><img src=\"https://img.new-combats.com/i/eff/effs_show.gif\"/ onclick=\"top.useMagicBattle(\'����������\',5555,\'effs_show.gif\',1,2);\" onmouseover=\"top.hi(this,\'<strong>����������</strong>\',event,3,1,1,1,\'\');\" onmouseout=\"top.hic();\" onmousedown=\"top.hic();\"></div>';
-            }
-
-            $ca = '';
-            if ($ur['clan'] > 0) {
-                $cl = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = ' . $ur['clan']));
-                if (isset($cl['id'])) {
-                    $ca = '<img src=\"https://img.new-combats.com/i/clan/' . $cl['name_mini'] . '.gif\" title=\"' . $cl['name'] . '\">';
-                }
-            }
-            if ($ur['align'] > 0) {
-                $ca = '<img src=\"https://img.new-combats.com/i/align/align' . $ur['align'] . '.gif\">' . $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 = '<strong>' . $ur['login2'] . '</strong>';
-            $stsua .= '<br>����: ' . $st['s1'];
-            $stsua .= '<br>��������: ' . $st['s2'];
-            $stsua .= '<br>��������: ' . $st['s3'];
-            $stsua .= '<br>������������: ' . $st['s4'];
-            if ($st['s5'] != 0) {
-                $stsua .= '<br>��������: ' . $st['s5'];
-            }
-            if ($st['s6'] != 0) {
-                $stsua .= '<br>��������: ' . $st['s6'];
-            }
-            if ($st['s7'] != 0) {
-                $stsua .= '<br>����������: ' . $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 . '<a href=\"javascript:void(0)\" onclick=\"top.chat.addto(\'' . $ur['login2'] . '\',\'to\');return false;\">' . $ur['login2'] . '</a> [' . $ur['level'] . ']<a href=\"info/' . $ur['id'] . '\" target=\"_blank\"><img src=\"https://img.new-combats.com/i/inf_' . $ur['cityreg'] . '.gif\" title=\"���. � ' . $ur['login2'] . '\"></a>&nbsp;","' . $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 = '<strong>' . $itm[$i]['name'] . '</strong>';
-                $td = $this->lookStats($itm[$i]['data']);
-                $lvar = '';
-                if ($td['add_hpAll'] > 0) {
-                    $td['add_hpAll'] = '+' . $td['add_hpAll'];
-                    $lvar .= '<br>������� �����: ' . $td['add_hpAll'];
-                }
-                if ($td['sv_yron_max'] > 0 || $td['sv_yron_min'] > 0) {
-                    $lvar .= '<br>����: ' . (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 .= '<br>����� ������: ' . $m1l . (0 + $td['add_mab1']);
-                    } else {
-                        $lvar .= '<br>����� ������: ' . (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 .= '<br>����� �������: ' . $m1l . (0 + $td['add_mab2']);
-                    } else {
-                        $lvar .= '<br>����� �������: ' . (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 .= '<br>����� �����: ' . $m1l . (0 + $td['add_mab3']);
-                    } else {
-                        $lvar .= '<br>����� �����: ' . (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 .= '<br>����� ���: ' . $m1l . (0 + $td['add_mab4']);
-                    } else {
-                        $lvar .= '<br>����� ���: ' . (0 + $td['add_mib4']) . '-' . (0 + $td['add_mab4']);
-                    }
-                }
-                if ($itm[$i]['iznosMAX'] > 0) {
-                    if ($itm[$i]['iznosMAXi'] == 999999999) {
-                        $lvar .= '<br>�������������: <span style="color: brown;">�����������</span>';
-                    } else {
-                        $lvar .= '<br>�������������: ' . 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);
-    }
-
-    /** ��������� ���������� ���.
-     * <br>[����������� ����]: ����� ������������� ���������.
-     * @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 '<div style="color: red; font-weight: bold; text-align: center">������������ �����...</div>';
-                        //
-                        $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 . '<img width=12 height=15 src=https://img.new-combats.com/i/align/align' . $id['align'] . '.gif >';
-                            }
-                            if ($id['clan'] > 0) {
-                                $btxt = $btxt . '<img width=24 height=15 src=https://img.new-combats.com/i/clan/' . $id['clan'] . '.gif >';
-                            }
-                            $btxt = $btxt . '<strong>{u1}</strong>[' . $id['level'] . ']<a href=info/' . $id['id'] . ' target=_blank ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-                            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 . '<img width=12 height=15 src=https://img.new-combats.com/i/align/align' . $id['align'] . '.gif >';
-                            }
-                            if ($id['clan'] > 0) {
-                                $btxt = $btxt . '<img width=24 height=15 src=https://img.new-combats.com/i/clan/' . $id['clan'] . '.gif >';
-                            }
-                            $btxt = $btxt . '<strong>{u1}</strong>[' . $id['level'] . ']<a href=info/' . $id['id'] . ' target=_blank ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-                            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 . '<img width=12 height=15 src=https://img.new-combats.com/i/align/align' . $id['align'] . '.gif >';
-                            }
-                            if ($id['clan'] > 0) {
-                                $btxt = $btxt . '<img width=24 height=15 src=https://img.new-combats.com/i/clan/' . $id['clan'] . '.gif >';
-                            }
-                            $btxt = $btxt . '<strong>{u1}</strong>[' . $id['level'] . ']<a href=info/' . $id['id'] . ' target=_blank ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-                            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 . '<img width=12 height=15 src=https://img.new-combats.com/i/align/align' . $id['align'] . '.gif >';
-                                }
-                                if ($id['clan'] > 0) {
-                                    $btxt = $btxt . '<img width=24 height=15 src=https://img.new-combats.com/i/clan/' . $id['clan'] . '.gif >';
-                                }
-                                $btxt = $btxt . '<strong>{u1}</strong>[' . $id['level'] . ']<a href=info/' . $id['id'] . ' target=_blank ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-                                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 . '<img width=12 height=15 src=https://img.new-combats.com/i/align/align' . $id['align'] . '.gif >';
-                                    }
-                                    if ($id['clan'] > 0) {
-                                        $btxt = $btxt . '<img width=24 height=15 src=https://img.new-combats.com/i/clan/' . $id['clan'] . '.gif >';
-                                    }
-                                    $btxt = $btxt . '<strong>{u1}</strong>[' . $id['level'] . ']<a href=info/' . $id['id'] . ' target=_blank ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-                                    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'] = '<span class=date>' . date('H:i') . '</span> <strong>' . $u->info['login'] . '</strong> ��������������� ������� &quot;<strong>���������</strong>&quot;.';
-                        } else {
-                            $mas['text'] = '<span class=date>' . date('H:i') . '</span> <strong>' . $u->info['login'] . '</strong> �������������� ������� &quot;<strong>���������</strong>&quot;.';
-                        }
-                        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'] .= ' <font color=#0066aa><strong>+' . $hpSks . '</strong></font>';
-                        } else {
-                            $hpSks = 0;
-                            $mas['text'] .= ' <font color=#0066aa><strong>--</strong></font>';
-                        }
-                        $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'] . "','�� ������� ������� &quot;�������&quot;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);
-            }
-        }
-    }
-
-
-    /** ���������� ��������.
-     * <br>��������� ����! ���� �������� �Ѩ!
-     * <br>��� ������� ������� ������ ����� �������.
-     * @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 .= '<strong>' . $this->users[$i]['login'] . '</strong>, ';
-                        }
-                        $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 = '<strong>' . $this->users[$i]['login'] . '</strong> �������� �����������: <font color=red>' . $tr_nm[$tr_tp] . ' ������</font>.<br>' . $vtvl;
-                                    } else {
-                                        $vtvl = '<strong>' . $this->users[$i]['login'] . '</strong> ������� �����������: <font color=red>' . $tr_nm[$tr_tp] . ' ������</font>.<br>' . $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 = '<strong>' . $this->users[$i]['login'] . '</strong> �������� ����������� (����������, �����: <strong>' . $this->users[$this->uids[$tr_pl['user_use']]]['login'] . '</strong>): <font color=red>' . $tr_nm[$tr_tp] . ' ������</font>.<br>' . $vtvl;
-                                } else {
-                                    $vtvl = '<strong>' . $this->users[$i]['login'] . '</strong> ������� ����������� (����������, �����: <strong>' . $this->users[$this->uids[$tr_pl['user_use']]]['login'] . '</strong>): <font color=red>' . $tr_nm[$tr_tp] . ' ������</font>.<br>' . $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 .= '<img src=https://img.new-combats.com/i/align/align' . $usr_real['align'] . '.gif width=12 height=15 >';
-                                }
-                                if ($usr_real['clan'] > 0) {
-                                    $usrreal .= '<img src=https://img.new-combats.com/i/clan/' . $usr_real['clan'] . '.gif width=24 height=15 >';
-                                }
-                                $usrreal .= '<strong>' . $usr_real['login'] . '</strong>[' . $usr_real['level'] . ']<a target=_blank href=https://new-combats.com/info/' . $usr_real['id'] . ' ><img width=12 hiehgt=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-                            } else {
-                                $mereal = '<i>���������</i>[??]';
-                            }
-                            $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 ("<font color=red>��������!</font> ' . mysql_real_escape_string(str_replace('{b}',
-                                            '<strong>' . $this->users[$i]['login'] . '</strong> [' . $this->users[$i]['level'] . ']<a target=_blank href=info/' . $this->users[$i]['id'] . ' ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>',
-                                            $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 .= '<img width=12 height=15 src=https://img.new-combats.com/i/align/align' . $this->users[$j]['align'] . '.gif >';
-                                                }
-                                                if ($this->users[$j]['clan'] > 0) {
-                                                    $usrwin .= '<img width=24 height=15 src=https://img.new-combats.com/i/clan/' . $this->users[$j]['clan'] . '.gif >';
-                                                }
-                                                $usrwin .= '<strong>' . $this->users[$j]['login'] . '</strong> [' . $this->users[$j]['level'] . ']<a target=_blank href=info/' . $this->users[$j]['id'] . ' ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-                                            }
-                                        }
-                                        $j++;
-                                    }
-                                    if ($usrwin != '') {
-                                        $usrwin = ltrim($usrwin, ', ');
-                                    } else {
-                                        $usrwin = '<i>������� ������</i>';
-                                    }
-
-
-                                    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 ("<font color=red>��������!</font> ' . mysql_real_escape_string(str_replace('{b}',
-                                            '<strong>' . $this->users[$i]['login'] . '</strong> [' . $this->users[$i]['level'] . ']<a target=_blank href=info/' . $this->users[$i]['id'] . ' ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>',
-                                            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 ("<font color=red>��������!</font> ' . mysql_real_escape_string(str_replace('{b}',
-                                            '<strong>' . $this->users[$i]['login'] . '</strong> [' . $this->users[$i]['level'] . ']<a target=_blank href=info/' . $this->users[$i]['id'] . ' ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>',
-                                            $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'] .= ' �� ����������� �������� �� ��������� <strong>�������� ������ (x5)</strong>. ';
-                                    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'] .= ' � <strong>����� ������</strong>. ';
-                                        }
-                                    }
-                                } else {
-                                    $pld['battle_text'] .= ' �� ������ �� ��������. <strong>����� ������ ������ 500 ����� �����</strong> .';
-                                }
-
-                                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 = '� <strong>' . $tbot2['login'] . '</strong> ��� ������� &quot;' . $itmnm . '&quot; � ��� ������ ����� ������� ���';
-                                                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 = '� <strong>' . $tbot2['login'] . '</strong> ��� ������� &quot;' . $itmnm . '&quot; � ��� ������ ����� ������� ���';
-                                    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 = '� <strong>' . $tbot2['login'] . '</strong> ��� ������� &quot;' . $itmnm . '&quot; � ��� ������ ����� ������� ���';
-                                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'] . "'
-								,'��� ������� &quot;" . $a004['name'] . "&quot; ������� ����: <strong>" . $aexp . "</strong>','-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 .= ' �� �������� <strong>' . $gm[$i] . ' ��.</strong> �� ���� ���.';
-                        $u->addDelo(4, $this->users[$i]['id'],
-                            '&quot;<font color="olive">System.battle</font>&quot;: �������� ������� <strong>' . $gm[$i] . ' ��.</strong> (� ��� �' . $this->info['id'] . ').',
-                            time(), $this->info['city'], 'System.battle', 0, 0);
-                        $this->users[$i]['money'] += $gm[$i];
-                    } elseif (isset($bm[$i])) {
-                        $prc .= ' �� ��������� <strong>' . $bm[$i] . ' ��.</strong> �� ���� ���.';
-                        $u->addDelo(4, $this->users[$i]['id'],
-                            '&quot;<font color="olive">System.battle</font>&quot;: �������� <i>��������</i> <strong>' . $gm[$i] . ' ��.</strong> (� ��� �' . $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 .= ', ������� <strong>0 ���</strong> �� ���� ��� (���� ����� ������).';
-                            //������������ ��������� �� �����
-                        } elseif ($admn > 0) {
-                            if ($this->info['type'] != 33) {
-                                $prc .= ', ������� <strong>' . $admn . ' ���</strong> �� ���� ���.';
-                            }
-                            $u->addDelo(4, $this->users[$i]['id'],
-                                '&quot;<font color="olive">System.battle</font>&quot;: �������� ������� <strong>' . $admn . ' ���</strong> (� ��� �' . $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 .= ' �� �������� <strong>' . $gms[$i] . ' $.</strong> �� ���� ���.';
-                        $u->addDelo(4, $this->users[$i]['id'],
-                            '&quot;<font color="olive">System.battle</font>&quot;: �������� ������� <strong>' . $gms[$i] . ' $.</strong> (� ��� �' . $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 .= ' �� ��������� <strong>' . $bms[$i] . ' $.</strong> �� ���� ���.';
-                        $u->addDelo(4, $this->users[$i]['id'],
-                            '&quot;<font color="olive">System.battle</font>&quot;: �������� <i>��������</i> <strong>' . $gms[$i] . ' $.</strong> (� ��� �' . $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'] = '��� ��������. ����� ���� �������� �����: <strong>' . floor($this->users[$i]['battle_yron']) . ' HP</strong>. �������� �����: <strong>' . (0 + $this->users[$i]['battle_exp']) . '</strong>' . $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'] .= ' �� �������� <small>' . $u->zuby($rzb,
-                                    1) . '</small> �� ���� ���.';
-                        }
-                    }
-                }
-
-                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'] .= ' �� �������� ���� �� ��������� <strong>�������� ����� (x' . floor($tmon / 2) . ')</strong>. (��� ������ �������� ������ �� ������� �� �����, ��� ������ ����� ���������� ������� ��� ������! �������� ������ �������� ������� ' . ($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'] .= ' �� ������ � ����� � ��������� ����� � <strong>' . $urcheck . '</strong> � ����� �� ��������� <strong>-5 ���.</strong> � ����� �� ������!';
-                        }
-                    }
-                    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'] .= ' �� ���� �� ��������� <strong>�������� ������ (' . $tmon . ')</strong>. ����� [' . ($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'] .= ' �� ��������� <strong>����� (x1)</strong>.';
-                        $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 = '<strong>' . $this->users[$i]['login'] . '</strong> ���������� ����� � ��������� � ������ ���������';
-                            } else {
-                                $rtxt = '<strong>' . $this->users[$i]['login'] . '</strong> ���������� ������� � ��������� � ������ ���������';
-                            }
-                        } else {
-                            if ($this->users[$i]['sex'] == 0) {
-                                $rtxt = '<strong>' . $this->users[$i]['login'] . '</strong> ���������� ����� � ��������� � ������� &quot;' . $r_n['name'] . '&quot;';
-                            } else {
-                                $rtxt = '<strong>' . $this->users[$i]['login'] . '</strong> ���������� ������� � ��������� � ������� &quot;' . $r_n['name'] . '&quot;';
-                            }
-                        }
-                    } 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 = '<strong>' . $this->users[$i]['login'] . '</strong> ���������� ����� ��� ����� �� ����������� � �������� ����������' . $nld;
-                            } else {
-                                $rtxt = '<strong>' . $this->users[$i]['login'] . '</strong> ���������� ������� ��� ����� �� ����������� � �������� ����������' . $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 .= ', ����� ������� ���������� &quot;' . $tinf['login'] . '&quot;';
-                                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 = '<strong>' . $this->users[$i]['login'] . '</strong> ���������� ����� ��� ����� �� ����������� � �������� ����������' . $nld;
-                        } else {
-                            $rtxt = '<strong>' . $this->users[$i]['login'] . '</strong> ���������� ������� ��� ����� �� ����������� � �������� ����������' . $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'], '<strong>' . $a['name'] . '</strong> ��������� � ���...',
-                                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 '<script>document.getElementById(\'teams\').style.display=\'none\';var battleFinishData = "' . $u->info['battle_text'] . '";</script>';
-                }
-            }
-        } 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'] . "','<font color=#cb0000><strong>�� �������� �������:</strong> " . mysql_real_escape_string($cr) . " <strong>��.</strong></font>','-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'] . "','<font color=#cb0000><strong>�������� ��� ����!!!</strong></font>','-1','6','0')");
-                    $u->addDelo(4, $this->users[$this->uids[$uid]]['id'],
-                        '&quot;<span style="color: olive;">System.battle</span>>&quot;: (� ��� ��������), ����!!! ',
-                        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'] . "','<font color=#cb0000><strong>�� �������� ����-�������:</strong> " . mysql_real_escape_string($ecr) . " <strong>���.</strong></font>','-1','6','0')");
-                    $u->addDelo(4, $this->users[$this->uids[$uid]]['id'],
-                        '&quot;<span style="color: olive;">System.battle</span>&quot;: �������� ������� <strong>' . $ecr . ' ���</strong> (� ��� ��������), ������: <strong>' . $this->users[$this->uids[$uid]]['money2'] . ' ���</strong>',
-                        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 .= ', &quot;' . $ico_e[3] . ' (<small>����������</small>)&quot;';
-                                    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 .= ', &quot;' . $ico_e[3] . '&quot;';
-                        }
-                    }
-                }
-                $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'] . "','<font color=#cb0000><strong>�� ��������� ������:</strong> " . mysql_real_escape_string($txt) . "</font>','-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 .= ', <strong>' . $this->ainm[$itm_e[0]]['name'] . '</strong>';
-                        if ($itm_e[1] > 1) {
-                            $txt .= ' <strong>(x' . $itm_e[1] . ')</strong>';
-                        }
-                    }
-                }
-                $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'] . "','<font color=#cb0000><strong>�� �������� ��������:</strong> " . mysql_real_escape_string($txt) . "</font>','-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 = '��� ��� �������� ��������, �������� ���� �������� ������...';
-            }
-        }
-    }
-
-
-    /** ��������� ���������� ��������, ���� � ��� ���-�� ��������.
-     * ��� ���� ��������� ���� � ���������. �������������� ���������� ����� ������������ � �������.
-     * <br>�����: /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} <strong style="color: #0071a3;">' .
-                            $this->addlt($b, 11, $s2) . '</strong> ' .
-                            $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} <strong style="color: #356d37;">' .
-                            $this->addlt($b, 10, $s2) . '</strong> ' .
-                            $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) . ', <u style="color: #f00;">������ ����</u>, ' .
-                                $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} ���������� <strong style="color: #c59400">���������</strong> ' .
-                            $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}, ���������������� <u style="color: #356d37">����� �����</u>, ' .
-                            $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} <strong style="color: #0071a3">' .
-                            $this->addlt($b, 11, $s2) . '</strong> ' .
-                            $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'] .= ', <font color=red>������ ���������� <strong>';
-                                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'] .= ' ������</strong></font>. ';
-                            }
-                        }
-                        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'] .= ' <i>������ �����</i>. ';
-                    }
-                    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'] = '(������&nbsp;����)';
-                        } elseif ($at[$a]['atack'][$j]['yron']['w'] == 14) {
-                            $mas['textWP'] = '(�����&nbsp;����)';
-                        } else {
-                            $mas['textWP'] = '(���������&nbsp;���)';
-                        }
-                        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'] .= ' <font title=' . $mas['textWP'] . ' color=#ff0000><strong>' . $at[$a]['atack'][$j]['yron']['r'] . '</strong></font>';
-                        } else {
-                            $mas['text'] .= ' <font title=' . $mas['textWP'] . ' color=#0066aa><strong>' . $at[$a]['atack'][$j]['yron']['r'] . '</strong></font>';
-                        }
-                        $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'] . ' �� <font Color=#006699><strong>' . $pvr['mpSee'] . '</strong></font> [' . $pvr['mpNow'] . '/' . $pvr['mpAll'] . '] (����)';
-                            $this->priemAddLog($id, 1, 2, $pvr['uid'], 0,
-                                '<font color^^^^#' . $pvr['color2'] . '>' . $pvr['x'] . '</font>',
-                                $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}', '<span class=\"date {fru}\">' . date('H:i', $pl['time']) . '</span>', $rt);
-            $rt = str_replace('{tm2}', '<span class=\"date {fru}\">' . date('H:i', $pl['time']) . '</span>', $rt);
-            $rt = str_replace('{tm3}',
-                '<span class=\"date {fru}\">' . date('d.m.Y H:i', $pl['time']) . '</span>', $rt);
-            $rt = str_replace('{tm4}',
-                '<span class=\"date {fru}\">' . date('d.m.Y H:i', $pl['time']) . '</span>', $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('"',
-                    '&quot;', $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}', '<span class=\"date {fru}\">' . date('H:i', $plm['time']) . '</span>', $rt);
-                $rt = str_replace('{tm2}', '<span class=\"date {fru}\">' . date('H:i', $plm['time']) . '</span>', $rt);
-                $rt = str_replace('{tm3}', '<span class=\"date {fru}\">' . date('d.m.Y H:i', $plm['time']) . '</span>',
-                    $rt);
-                $rt = str_replace('{tm4}', '<span class=\"date {fru}\">' . date('d.m.Y H:i', $plm['time']) . '</span>',
-                    $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('"',
-                        '&quot;', $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} <i>�����������: ' . current($boycom) . '</i>',
-            '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} ����� &quot;<strong>' . $pl['name'] . '</strong>&quot;.';
-                    $this->del_val['eff'][$pl['priem']['id']] = true;
-                }
-            } elseif ($t == 2) {
-                $mas1['text'] = '{tm1} � ��������� {u1} ����������� �������� ����� &quot;<strong>' . $pl['name'] . '</strong>&quot;.';
-            } elseif ($t == 99) {
-                $mas1['text'] = '{u1} ���� ����� &quot;<strong>' . $pl['name'] . '</strong>&quot; � ������� <strong>' . $rznm . '</strong> .';
-            } else {
-                if ($t == 100) {
-                    $mas1['id_hod']++;
-                }
-                $mas1['text'] = '{tm1} ����������� �������� ������� &quot;<strong>' . $pl['name'] . '</strong>&quot; ��� {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} ������� �� ���������, � ������� �������� &quot;<strong>' . $tpa3[$a['type']] . ' [' . $a['level'] . ']</strong>&quot; �� {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 = '���� ���������� <span class=\\\\\"date\\\\\">' . date('d.m.Y H:i',
-                                $this->info['time_start']) . '</span>, ����� ' . $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 = '<img width=24 height=15 title=�����&nbsp;������ src=https://img.new-combats.com/i/lead' . $this->users[$i]['team'] . '.gif \>';
-                }
-                $teams[$this->users[$i]['team']] .= ', ' . $ldr . '<span ' . $a1ms . ' class=\"CSSteam' . $this->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'] . '</span><small> [' . floor($this->stats[$i]['hpNow']) . '/' . $this->stats[$i]['hpAll'] . ']</small>';
-            }
-            $i++;
-        }
-
-        //���������� �������
-        $i = 0;
-        while ($i < count($tms)) {
-            $teams[$tms[$i]] = ltrim($teams[$tms[$i]], ', ');
-            if ($teams[$tms[$i]] != '') {
-                $teams[$tms[$i]] = '<img src=\"https://img.new-combats.com/i/lock3.gif\" style=\"cursor:pointer\" width=\"20\" height=\"15\" onClick=\"top.chat.addto(\'team' . $tms[$i] . '\',\'private\'); return false;\"> ' . $teams[$tms[$i]];
-                $ret .= $teams[$tms[$i]];
-                if (count($tms) > $i + 1) {
-                    $ret .= ' <span class=\"CSSvs\">&nbsp; ������ &nbsp;</span> ';
-                }
-            }
-            $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} <strong>' . $this->stats[$this->uids[$u1]]['login'] . '</strong> ����...<strong>' . $this->stats[$this->uids[$u1]]['login'] . '</strong> ��� ������. ';
-                $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} <strong>' . $this->stats[$this->uids[$u1]]['login'] . '</strong> �����.';
-                    $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 @@
-<?
-if(!defined('GAME'))
-{
-	die();
-}
-
-class Chat {	
-	
-	var $smilesWorld = array(
-	'laugh' => 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 => '�������: &quot;������ ���������, �� ����� ��������..&quot; ������������ � ����� ���������� ������...',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('/','&frasl;',$text).' ';
-		
-		if(preg_match("/&frasl;(.*?) /", $txt, $retxt))
-		{
-			if(isset($this->smilesWorld[$retxt[1]]))
-			{
-				if($tol == '')
-				{
-					$tol = str_replace('&frasl;'.$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 = '<script>'.$rt.'</script>';
-		}
-		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..fc8860b8 100644
--- a/_incl_data/class/__db_connect.php
+++ b/_incl_data/class/__db_connect.php
@@ -1,28 +1,20 @@
 <?php
-if(!defined('GAME'))
-{
-	die();
+if (!defined('GAME')) {
+    die();
 }
 
-if( function_exists('date_default_timezone_set') ) {
-	date_default_timezone_set('Europe/Moscow');
-}
+$db = [
+    's' => 'localhost',     // server
+    'd' => 'newcom1_abk',   // database
+    'u' => 'newcom1_abk',   // user
+    'p' => '4nWYsIM[c?}P'   // password
+];
+$dsn = 'mysql:host=' . $db['s'] . ';dbname=' . $db['d'];
 
-$dbgo = mysql_pconnect('localhost','newcom1_abk','4nWYsIM[c?}P');
-mysql_select_db('newcom1_abk',$dbgo);
+include './_incl_data/mysql_override.php';
+
+$dbgo = mysql_connect($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();
-}
-
-$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"]);
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 @@
-<?
-if(!defined('GAME'))
-{
-	die();
-}
-
-class dungeon
-{
-	public $bs,$info,$see,$error,$gs = 1,$information, $map = array(
-				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 = '<b>'.$u->info['login'].'</b> ���������'.$asex.' ������� &quot;'.$itm['name'].'&quot; � &quot;'.$obj['name'].'&quot;';
-			}else{
-				$rtxt = '<b>'.$u->info['login'].'</b> ���������'.$asex.' ������� &quot;'.$itm['name'].'&quot; � &quot;'.$obj['name'].'&quot;, � �� ������ ��������� ���';
-			}
-			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 = '<b>�� �� �����...</b>';
-   } elseif(!isset($to['id'])) {
-     $this->error = '<b>�������� �� ������...</b>';
-   } elseif($to['id'] == $this->info['uid']) {
-     $this->error = '<b>�� � ��� �����...</b>';
-   } elseif($to['dnow'] != $this->info['id']) {
-     $this->error = '<b>�������� �� ������ � ����� �������...</b>';
-   } 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('<b>'.$u->info['login'].'</b> ������� ��������� � ������ ��������� <b>'.$to['login'].'</b>');
-	 } else {
-	   $this->sys_chat('<b>'.$u->info['login'].'</b> �������� ��������� � ������ ��������� <b>'.$to['login'].'</b>');
-	 }
-     //header('Location: main.php');
-	 die('<script>top.frames[\'main\'].location = "main.php";</script>');
-   }
- }
- 
- 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 = '<b>�� �� �����...</b>';
-   } elseif(!isset($to['id'])) {
-     $this->error = '<b>�������� �� ������...</b>';
-   } elseif($to['id'] == $this->info['uid']) {
-     $this->error = '<b>������ ������ �������...</b>';
-   } elseif($to['dnow'] != $this->info['id']) {
-     $this->error = '<b>�������� �� ������ � ����� �������...</b>';
-   } 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('<b>'.$u->info['login'].'</b> ������ �� ������ ��������� <b>'.$to['login'].'</b>');
-	 } else {
-	   $this->sys_chat('<b>'.$u->info['login'].'</b> ������� �� ������ ��������� <b>'.$to['login'].'</b>');
-	 }
-     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 .= '<table border="0" cellspacing="0" cellpadding="0" height="20">
-<tr><td valign="middle"> &nbsp; <font color="#990000">'.$u->microLogin($pl['id'],1).'</font> &nbsp; </td>
-<td valign="middle" width="120" ';
-			if( $stt['mpAll'] < 1 ) {
-				$r .= 'style="padding-top:12px"';
-			}
-$r .= '>
-<div style="position:relative;"><div id="vhp'.($pl['id']+1000000000000).'" title="������� �����" align="left" class="seehp" style="position:absolute; top:-10px; width:120px; height:10px; z-index:12;"> '.floor($stt['hpNow']).'/'.$stt['hpAll'].'</div>
-<div title="������� �����" class="hpborder" style="position:absolute; top:-10px; width:120px; height:9px; z-index:13;"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
-<div class="hp_3 senohp" style="height:9px; width:'.floor(120/100*$ph).'px; position:absolute; top:-10px; z-index:11;" id="lhp'.($pl['id']+1000000000000).'"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
-<div title="������� �����" class="hp_none" style="position:absolute; top:-10px; width:120px; height:10px; z-index:10;"><img src="https://img.new-combats.com/1x1.gif" height="10"></div>
-';
-if($stt['mpAll']>0)
-{
-	$r .= '<div id="vmp'.($pl['id']+1000000000000).'" title="������� ����" align="left" class="seemp" style="position:absolute; top:0px; width:120px; height:10px; z-index:12;"> '.floor($stt['mpNow']).'/'.$stt['mpAll'].'</div>
-<div title="������� ����" class="hpborder" style="position:absolute; top:0px; width:120px; height:9px; z-index:13;"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
-<div class="hp_mp senohp" style="height:9px; position:absolute; top:0px; width:'.floor(120/100*$pm).'px; z-index:11;" id="lmp'.($pl['id']+1000000000000).'"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
-<div title="������� ����" class="hp_none" style="position:absolute; top:0px; width:120px; height:10px; z-index:10;"></div>';
-}
-$r .= '</div></td><td>';
-if( $this->info['uid'] == $pl['id'] ) {
-	$r .= '<img src="https://img.new-combats.com/i/lead1.gif" title="����� ������" >';
-}
-if($this->info['uid'] == $u->info['id'] && $pl['id'] == $u->info['id'] && $d->info['id2'] != 15) {
-       $r .= '<a href="javascript: void(0);" onclick="top.n_lead();"><img src="https://img.new-combats.com/i/ico/ico_change_leader.gif" title="����� �����" /></a> ';
-       $r .= '<a href="javascript: void(0);" onclick="top.go_from_psh();"><img src="https://img.new-combats.com/i/ico/ico_kill_member.gif" title="������� ���������" /></a> ';
-     }
-$r .= '</td></tr></table><br>';
-$r .= '<script>top.startHpRegen("main",'.($pl['id']+1000000000000).','.(0+$stt['hpNow']).','.(0+$stt['hpAll']).','.(0+$stt['mpNow']).','.(0+$stt['mpAll']).',0,0,0,0,1);</script>';
-		}
-		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 = '�������� ... '; // <script>location="main.php?rnd='.$code.'";</script>*/
-					//header('location: main.php');
-					die('<script>top.frames[\'main\'].location = "main.php";</script>');
-				} 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 = '�������� ...';// <script>location="main.php?rnd='.$code.'";</script>*/
-							//
-							//header('location: main.php');
-							die('<script>top.frames[\'main\'].location = "main.php";</script>');
-						}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} <a target=_blank href=/logs.php?log='.$tbtl['id'].' >��</a>';
-								}else{
-									$text = '{u1} ��������� � �������� ����� �� {u2} <a target=_blank href=/logs.php?log='.$tbtl['id'].' >��</a>';
-								}								
-								if( isset($usr_real['id'])) {
-									$usrreal = '';
-									if( $usr_real['align'] > 0 ) {
-										$usrreal .= '<img src=https://img.new-combats.com/i/align/align'.$usr_real['align'].'.gif width=12 height=15 >';
-									}
-									if( $usr_real['clan'] > 0 ) {
-										$usrreal .= '<img src=https://img.new-combats.com/i/clan/'.$usr_real['clan'].'.gif width=24 height=15 >';
-									}
-									$usrreal .= '<b>'.$usr_real['login'].'</b>['.$usr_real['level'].']<a target=_blank href=https://new-combats.com/info/'.$usr_real['id'].' ><img width=12 hiehgt=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-								}else{
-									$mereal = '<i>���������</i>[??]';
-								}
-								if( isset($me_real['id']) ) {
-									$mereal = '';
-									if( $me_real['align'] > 0 ) {
-										$mereal .= '<img src=https://img.new-combats.com/i/align/align'.$me_real['align'].'.gif width=12 height=15 >';
-									}
-									if( $me_real['clan'] > 0 ) {
-										$mereal .= '<img src=https://img.new-combats.com/i/clan/'.$me_real['clan'].'.gif width=24 height=15 >';
-									}
-									$mereal .= '<b>'.$me_real['login'].'</b>['.$me_real['level'].']<a target=_blank href=https://new-combats.com/info/'.$me_real['id'].' ><img width=12 hiehgt=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-								}else{
-									$mereal = '<i>���������</i>[??]';
-								}
-								$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 = '�������� ... <script>location="main.php?rnd='.$code.'";</script>';
-					}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} ��������� ��� <a target=_blank href=/logs.php?log='.$btl_id.' >��</a>';
-								}else{
-									$text = '{u1} ������ �� {u2} ��������� ��� <a target=_blank href=/logs.php?log='.$btl_id.' >��</a>';
-								}								
-								if( isset($usr_real['id'])) {
-									$usrreal = '';
-									if( $usr_real['align'] > 0 ) {
-										$usrreal .= '<img src=https://img.new-combats.com/i/align/align'.$usr_real['align'].'.gif width=12 height=15 >';
-									}
-									if( $usr_real['clan'] > 0 ) {
-										$usrreal .= '<img src=https://img.new-combats.com/i/clan/'.$usr_real['clan'].'.gif width=24 height=15 >';
-									}
-									$usrreal .= '<b>'.$usr_real['login'].'</b>['.$usr_real['level'].']<a target=_blank href=https://new-combats.com/info/'.$usr_real['id'].' ><img width=12 hiehgt=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-								}else{
-									$mereal = '<i>���������</i>[??]';
-								}
-								if( isset($me_real['id']) ) {
-									$mereal = '';
-									if( $me_real['align'] > 0 ) {
-										$mereal .= '<img src=https://img.new-combats.com/i/align/align'.$me_real['align'].'.gif width=12 height=15 >';
-									}
-									if( $me_real['clan'] > 0 ) {
-										$mereal .= '<img src=https://img.new-combats.com/i/clan/'.$me_real['clan'].'.gif width=24 height=15 >';
-									}
-									$mereal .= '<b>'.$me_real['login'].'</b>['.$me_real['level'].']<a target=_blank href=https://new-combats.com/info/'.$me_real['id'].' ><img width=12 hiehgt=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-								}else{
-									$mereal = '<i>���������</i>[??]';
-								}
-								$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 = '�������� ... <script>location="main.php?rnd='.$code.'";</script>';
-						}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('<b>'.$u->info['login'].'</b> ���������� ����� � ��������� � ������� &quot;'.$room['name'].'&quot;');
-			    }else{
-				    $this->sys_chat('<b>'.$u->info['login'].'</b> ���������� ������� � ��������� � ������� &quot;'.$room['name'].'&quot;');
-			    }
-			    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('<script>top.frames[\'main\'].location = "main.php";</script>');
-		    }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('<b>'.$u->info['login'].'</b> ���������� ����� ��� ����� �� �����������');
-			    }else{
-				    $this->sys_chat('<b>'.$u->info['login'].'</b> ���������� ������� ��� ����� �� �����������');
-			    }
-			    $_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<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 .= '������� &quot;<b>'.$uitm['name'].'</b>&quot; (x'.$itm[1].') ��� �������...<br>';
-							$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 .= '��������� ������� &quot;<b>'.$uitm['name'].'</b>&quot; (x'.$itm[1].')<br>';
-							}
-							$j++;
-						}
-						if(rand(0,10000)>$itm[2]*100) {
-							$tr_gd = 0;
-							$r .= '�������, �� ������ �� ���������...<br>';
-						}
-						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 .= '<div>�� ��� �������� �������� &quot;'.$eff_d['mname'].'&quot;.</div>';
-										}else{
-											$r .= '<div>���-�� ����� �� ���... ��������� ���-�� �����������...</div>';
-										}
-									}else{
-										$r .= '<div>���-�� ����� �� ���... ������ ���-�� ���...</div>';
-									}
-									unset($eff_d,$us);
-								}else{
-									//�� ������
-									$r .= '<div>�� �������...</div>';
-								}
-								$u->addAction(time(),'add_eff_'.$this->info['id'].'_'.$obj['id'],$u->info['city']);
-							}else{
-								//��� ������ �����
-								$r .= '<div>���-�� ����� �� ���...</div>';
-							}
-							
-							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 .= '<div>�� ������ � �������... ��������: <b>'.$itm[1].' HP</b></div>';
-										}elseif($itm[1]>0){
-											$r .= '<div>�� ������������ � �����... ��������: <b>+'.$itm[1].' HP</b></div>';
-										}
-										$u->info['hpNow'] += $itm[1];
-										if($u->info['hpNow']<1) {
-											$r .= '<div>�� ���������� � ����� �����������...</div>';
-											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 .= '�� ����-�� �������������... �� ���� ��� ������...<br>';
-						}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 .= '�� ����-�� �������������... �� ���� ��� ������...<br>';
-						}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 = '������ �� ���������...<br>';
-							}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 .= '�� ���������� ������� &quot;<b>'.$it['name'].'</b>&quot;.<br>';
-										$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 .= '�� ������ �� ����� ...<br>';
-								}
-								$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 .= '�������, �� ������ �� ���������... <br>';
-								}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 .= '�� ���������� ������� &quot;<b>'.$it['name'].'</b>&quot;.<br>';
-											$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 .= '�� ������ �� ����� ... <br>';
-									}
-								}
-							}
-					}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 .= '������ �� ���������... <br>';
-								}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 .= '�� ���������� ������� &quot;<b>'.$it['name'].'</b>&quot;.<br>';
-											$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 .= '�� ������ �� ����� ... <br>';
-									}
-								}
-							}
-					}elseif($s[0]=='fileact') {
-						require('dnaction/'.$s[1].'.php');
-					}
-					$i++;
-				}	
-				$r = rtrim($r,'\<br\>');	
-				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 = '������� ������������ ��� &quot;'.$uo['login'].'&quot;. �� ������� ������� ���� �������, ���� ';
-						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 = '<b>'.$u->info['login'].'</b> ������ ������� &quot;'.$it['name'].'&quot;';
-									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 = '�� ������� &quot;'.$it['name'].'&quot;';
-							}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 .= '<div>�������� ��������!</div>';
-			}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'] = '<b>'.$fxv['user_win']['login'].'</b> ���������� � ����� �� ������� &quot;'.$fxv['itm']['name'].'&quot;';
-				$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 .= '<div>�������� ��������! ���������� <b>'.$fxv['user_win']['login'].'</b>!</div>';
-			}
-		}else{
-			$this->error .= '<div>� ��������� ���������� �������� '.$u->timeOut($fxv['itm']['time']+300-time()).' ���. �� ����� ���������</div>';
-		}
-		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 .= '<div>������� �� ������</div>';
-		}elseif( $fxv['luck2'][0] > 0 ) {
-			$this->error .= '<div>�� ��� ����������� � ��������� &quot;'.$fxv['itm']['name'].'&quot;, ������� ������ ���������� ��� '.$u->timeOut($fxv['itm']['time']-time()+300).'</div>';
-		}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'] = '<b>'.$u->info['login'].'</b> �������� *'.$rndl.'* � ����� �� ������� &quot;'.$fxv['itm']['name'].'&quot;';
-			}else{
-				$fxv['text'] = '<b>'.$u->info['login'].'</b> ��������� *'.$rndl.'* � ����� �� ������� &quot;'.$fxv['itm']['name'].'&quot;';
-			}
-			$this->sys_chat($fxv['text']);
-			$this->error .= '<div>�� ��������� <b>'.$rndl.'</b> � ����� �� &quot;'.$fxv['itm']['name'].'&quot;</div>';
-		}
-		$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 .= '<div>������� �� ������</div>';
-		}elseif( isset($fxv['luck']['id']) ) {
-			if( $fxv['luck']['vals'] == 0 ) {
-				$this->error .= '<div>�� ��� ���������� �� ������� � ��������� &quot;'.$fxv['itm']['name'].'&quot;</div>';
-			}else{
-				$this->error .= '<div>�� ��� ����������� � ��������� &quot;'.$fxv['itm']['name'].'&quot;, ������� ������ ���������� ��� '.$u->timeOut($fxv['itm']['time']-time()+300).'</div>';
-			}
-		}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'] = '<b>'.$u->info['login'].'</b> ��������� �� ����� �� ������� &quot;'.$fxv['itm']['name'].'&quot;';
-			}else{
-				$fxv['text'] = '<b>'.$u->info['login'].'</b> ���������� �� ����� �� ������� &quot;'.$fxv['itm']['name'].'&quot;';
-			}
-			$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 .= '<div>�� ���������� �� ������� � ��������� &quot;'.$fxv['itm']['name'].'&quot;</div>';
-		}
-		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 .= '<a onclick="takeItem('.$pl['id'].')"><img style="padding: 5px; cursor: pointer;" title="����� &quot;'.$pl['name'].'&quot;" src="https://img.new-combats.com/i/items/'.$pl['img'].'" /></a>';
-			} elseif($tk == 1) {
-			  $r .= '<a href="'.$action.'"><img style="padding: 5px; cursor: pointer;" title="����� &quot;'.$pl['name'].'&quot;" src="https://img.new-combats.com/i/items/'.$pl['img'].'" /></a>';
-			}
-		}
-		if($r!='')
-		{
-			$r = '<H4>� ������� ���������� ����:</H4>'.$r; //<br> <a onclick="takeItemAll">��������� ���</a><br>
-		}
-		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[] = ' <strong>'.$k['login'].'</strong>'; 
-					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($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')
-						{
-							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 .= '&quot;'.$trm['name'].'&quot;, ';	
-							}
-						}
-					}
-				}
-				$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($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')
-						{
-							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/__filter_class.php b/_incl_data/class/__filter_class.php
deleted file mode 100644
index 8dfeeb81..00000000
--- a/_incl_data/class/__filter_class.php
+++ /dev/null
@@ -1,168 +0,0 @@
-<?php
-if (!defined('GAME')) {
-    die();
-}
-
-class Filter
-{
-    public function str_count($str, $col)
-    {
-        if (strlen($str) > $col) {
-            $str = substr($str, 0, $col);
-        }
-        return ($str);
-    }
-    //
-    //��������
-    public $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') . ': <b>' . mysql_real_escape_string($t) . '</b>","capitalcity","�������","6","1","-1")');
-    }
-
-    public function setOnline($online, $uid, $afk)
-    {
-        $add = 0;
-
-        if (time() - $online >= 1) {
-            if (time() - $online < 60) {
-                $add += time() - $online;
-            } else {
-                $add += 60;
-            }
-        }
-
-        if ($add > 0) {
-            $on = mysql_fetch_array(mysql_query('SELECT * FROM `online` WHERE `uid` = "' . $uid . '" LIMIT 1'));
-            if (isset($on['id'])) {
-                $mt = 0;
-                $lst = time();
-                if (date('d', $on['lastUp']) != date('d', $lst)) {
-                    $on['time_today'] = $add;
-                } else {
-                    $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');
-            }
-        }
-    }
-
-    public function mystr($string)
-    {
-        $str = strtolower($string);
-        if (strtolower('S') != 's') {
-            $ru = '�����Ũ��������������������������';
-            $ru2 = '��������������������������������';
-            $en = 'QWERTYUIOPASDFGHJKLZXCVBNM';
-            $en2 = 'qwertyuiopasdfghjklzxcvbnm';
-            $i = 0;
-            while ($i < 33) {
-                if (isset($ru[$i])) {
-                    $str = strtr($str, $ru[$i], $ru2[$i]);
-                }
-                if (isset($en[$i])) {
-                    $str = strtr($str, $en[$i], $en2[$i]);
-                }
-                $i++;
-            }
-        }
-        return $str;
-    }
-
-    public function spamFiltr($txt)
-    {
-
-        $txt = str_replace('�', '�', $txt);
-
-        $nospam = 0;
-        $txt = str_replace('&gt;', '', $txt);
-        $txt = str_replace('&lt;', '', $txt);
-        $txt = str_replace('&quot;', '', $txt);
-        $txt = $this->mystr($txt);
-        $i = 0;
-        while ($i <= count($this->sm)) {
-            if (isset($this->sm[$i])) {
-                $txt = preg_replace('/:' . $this->sm[$i] . ':/', "", $txt);
-            }
-            $i++;
-        }
-        /* ������ */
-        $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);
-        $testEN2 = $txt;
-
-        $testEN2 = str_replace('&quot;', '', $testEN2);
-        $testEN2 = str_replace('&nbsp;', '', $testEN2);
-        $testEN2 = str_replace('�', 'a', $testEN2);
-        $testEN2 = str_replace('�', 'b', $testEN2);
-        $testEN2 = str_replace('�', 'c', $testEN2);
-        $testEN2 = str_replace('�', 'b', $testEN2);
-        $testEN2 = str_replace('�', 'e', $testEN2);
-        $testEN2 = str_replace('�', 't', $testEN2);
-        $testEN2 = str_replace('�', 'o', $testEN2);
-        $testEN2 = str_replace('�', 'p', $testEN2);
-        $testEN2 = str_replace('�', 'm', $testEN2);
-        $testEN2 = str_replace('�', 'h', $testEN2);
-        $testEN2 = str_replace('�', 'y', $testEN2);
-        $testEN2 = str_replace('�', 'k', $testEN2);
-        $testEN2 = str_replace('�', 'u', $testEN2);
-        $testEN2 = str_replace('�', 'x', $testEN2);
-        $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);
-
-        $testRU2 = $txt;
-        $testRU2 = str_replace('a', '�', $testRU2);
-        $testRU2 = str_replace('b', '�', $testRU2);
-        $testRU2 = str_replace('c', '�', $testRU2);
-        $testRU2 = str_replace('b', '�', $testRU2);
-        $testRU2 = str_replace('e', '�', $testRU2);
-        $testRU2 = str_replace('t', '�', $testRU2);
-        $testRU2 = str_replace('o', '�', $testRU2);
-        $testRU2 = str_replace('p', '�', $testRU2);
-        $testRU2 = str_replace('m', '�', $testRU2);
-        $testRU2 = str_replace('h', '�', $testRU2);
-        $testRU2 = str_replace('y', '�', $testRU2);
-        $testRU2 = str_replace('k', '�', $testRU2);
-        $testRU2 = str_replace('x', '�', $testRU2);
-        $testRU2 = str_replace('u', '�', $testRU2);
-        $testRU2 = str_replace('()', '�', $testRU2);
-        $testRU2 = str_replace('0', '�', $testRU2);
-        $testRU2 = preg_replace('/[^�-�]*/i', ' ', $testRU2);
-        $testRU2 = preg_replace('/[^�-�]*/i', ' ', $testRU2);
-        $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])
-                )
-            ) {
-                $nospam .= '%' . $spe[$i];
-            }
-            $i++;
-        }
-        return $nospam;
-    }
-
-    public function __clone()
-    {
-        trigger_error('������������ �� �����������.', E_USER_ERROR);
-    }
-}
-
-$filter = new Filter();
\ No newline at end of file
diff --git a/_incl_data/class/__magic.php b/_incl_data/class/__magic.php
deleted file mode 100644
index a4c869fd..00000000
--- a/_incl_data/class/__magic.php
+++ /dev/null
@@ -1,1999 +0,0 @@
-<?php
-if (!defined('GAME')) {
-    die();
-}
-ignore_user_abort(true);
-if (isset($_POST['useitemon'])) {
-    $_GET['login'] = $_POST['useitemon'];
-}
-
-class Magic
-{
-
-    public $youuse = 0;
-    public $c_magic = [4174, 4175, 4176, 4177, 4178, 4179, 4180];
-    public $e_magic = [4185, 4186, 4187];
-
-    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);
-                }
-            }
-
-            $st = $u->lookStats($itm['data']);
-
-            if (isset($st['tr_lvl']) && $st['tr_lvl'] > $u->info['level']) {
-                $u->error = 'Вы слишком малы чтобы использовать данный предмет ';
-                $err = 'Вы слишком малы чтобы использовать данный предмет';
-                return $err;
-            }
-
-            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 = 'Каст &quot;' . $itm['name'] . '&quot; сгорел';
-                $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'], '&quot;<font color="maroon">System.inventory</font>&quot;:<B>(КАСТ СГОРЕЛ)</b> Персонаж использовал &quot;' . $itm['name'] . '&quot; (' . $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 = [];
-                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.<br>';
-                        } else {
-                            $u->error = 'Ваше здоровье и так полностью восстановлено<br>';
-                            $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.<br />';
-                        } 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'], '&quot;<font color="maroon">System.inventory</font>&quot;: Персонаж использовал эликсир &quot;' . $itm['name'] . '&quot; (+' . $use['moment_hp'] . ' HP) [itm:' . $itm['id'] . '].', time(), $u->info['city'], 'System.inventory', 0, 0);
-                            $this->youuse++;
-                            $u->error = 'Вы успешно использовали эликсир &quot;' . $itm['name'] . '&quot;<br>' . $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'], '&quot;<font color="maroon">System.inventory</font>&quot;: Персонаж использовал эликсир &quot;' . $itm['name'] . '&quot; (' . $us[1] . ') [itm:' . $itm['id'] . '].', time(), $u->info['city'], 'System.inventory', 0, 0);
-                                $this->youuse++;
-                                $u->error = 'Вы успешно использовали эликсир &quot;' . $itm['name'] . '&quot;<br>' . $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 = '<font color=#006699>' . $txt . '</font>';
-                                        if ($u->info['sex'] == 1) {
-                                            $txt = 'Хитрая {u1} бросила кусок снега в {u2}. <b>' . $txt . '</b> [' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['hpAll'] . ']';
-                                        } else {
-                                            $txt = 'Хитрый {u1} бросил кусок снега в {u2}. <b>' . $txt . '</b> [' . $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'] < time() - 520 && $usr['battle'] == 0 && $usr['bot'] == 0) {
-                                $u->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 . ' &quot;' . $u->info['login'] . '&quot; бросил' . $sx2 . ' кусок снега в &quot;' . $usr['login'] . '&quot;. <font color=red><b>-1000</b></font> [' . 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'] < time() - 120) {
-                                $u->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]] &quot;' . $u->info['login'] . '&quot; использовал' . $sx . ' магию нападения на персонажа &quot;' . $usr['login'] . '&quot;.';
-                                    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('<script>top.frames[\'main\'].location = "main.php";</script>');
-                                } 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 = '<font color=#006699>' . $txt . '</font>';
-                                            if ($u->info['id'] == $usr['id']) {
-                                                if ($u->info['sex'] == 1) {
-                                                    $txt = '{u1} использовала &quot;<b>' . $itm['name'] . '</b>&quot; на себя. <b>' . $txt . '</b> [' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['hpAll'] . ']';
-                                                } else {
-                                                    $txt = '{u1} использовал &quot;<b>' . $itm['name'] . '</b>&quot; на себя. <b>' . $txt . '</b> [' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['hpAll'] . ']';
-                                                }
-                                            } else {
-                                                if ($u->info['sex'] == 1) {
-                                                    $txt = '{u1} использовала &quot;<b>' . $itm['name'] . '</b>&quot; на {u2}. <b>' . $txt . '</b> [' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['hpAll'] . ']';
-                                                } else {
-                                                    $txt = '{u1} использовал &quot;<b>' . $itm['name'] . '</b>&quot; на {u2}. <b>' . $txt . '</b> [' . $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 = 'Свиток &quot;' . $itm['name'] . '&quot; был успешно использован.';
-                                } else {
-                                    $u->error = 'Нельзя использовать на данного персонажа';
-                                }
-                            } elseif ($u->info['dnow'] != $usr['dnow']) {
-                                $u->error = 'Персонаж находится в другой комнате [пещера]';
-                            } elseif ($usr['online'] < time() - 120 && $usr['bot'] == 0) {
-                                $u->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 = 'Свиток &quot;' . $itm['name'] . '&quot; был успешно использован.';
-                                $rtxt = '[img[items/' . $itm['img'] . ']] Персонаж &quot;' . $u->info['login'] . '&quot; использовал' . $sx2 . ' &quot;' . $itm['name'] . '&quot; на &quot;' . $usr['login'] . '&quot;.';
-                                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 = '<font color=#006699>' . $txt . '</font>';
-                                            if ($u->info['id'] == $usr['id']) {
-                                                if ($u->info['sex'] == 1) {
-                                                    $txt = '{u1} использовала &quot;<b>' . $itm['name'] . '</b>&quot; на себя. <b>' . $txt . '</b> [' . $btl->stats[$btl->uids[$usr['id']]]['mpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['mpAll'] . '] (Мана)';
-                                                } else {
-                                                    $txt = '{u1} использовал &quot;<b>' . $itm['name'] . '</b>&quot; на себя. <b>' . $txt . '</b> [' . $btl->stats[$btl->uids[$usr['id']]]['mpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['mpAll'] . '] (Мана)';
-                                                }
-                                            } else {
-                                                if ($u->info['sex'] == 1) {
-                                                    $txt = '{u1} использовала &quot;<b>' . $itm['name'] . '</b>&quot; на {u2}. <b>' . $txt . '</b> [' . $btl->stats[$btl->uids[$usr['id']]]['mpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['mpAll'] . '] (Мана)';
-                                                } else {
-                                                    $txt = '{u1} использовал &quot;<b>' . $itm['name'] . '</b>&quot; на {u2}. <b>' . $txt . '</b> [' . $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 = 'Свиток &quot;' . $itm['name'] . '&quot; был успешно использован.';
-                                } else {
-                                    $u->error = 'Нельзя использовать на данного персонажа';
-                                }
-                            } elseif ($u->info['dnow'] != $usr['dnow']) {
-                                $u->error = 'Персонаж находится в другой комнате [пещера]';
-                            } elseif ($usr['online'] < time() - 120 && $usr['bot'] == 0) {
-                                $u->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 = 'Свиток &quot;' . $itm['name'] . '&quot; был успешно использован.';
-                                $rtxt = '[img[items/' . $itm['img'] . ']] Персонаж &quot;' . $u->info['login'] . '&quot; использовал' . $sx2 . ' &quot;' . $itm['name'] . '&quot; на &quot;' . $usr['login'] . '&quot;.';
-                                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'] < time() - 120 && $usr['bot'] == 0) {
-                                $u->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 = '&quot;Легкой травмы&quot;';
-                                    $text_msg2 = 'легких';
-                                } elseif ($itm['magic_inci'] == 'lech_2') {
-                                    $type_lechenie = 2; // тип травмы котору лечим
-                                    $text_msg = '&quot;Средней травмы&quot;';
-                                    $text_msg2 = 'средних';
-                                } elseif ($itm['magic_inci'] == 'lech_3') {
-                                    $type_lechenie = 3; // тип травмы котору лечим
-                                    $text_msg = '&quot;Тяжелой травмы&quot;';
-                                    $text_msg2 = 'тяжелых';
-                                }
-                                if ($travm) {
-                                    $lech_aa = [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]] Лекарь &quot;' . $u->info['login'] . '&quot; кинул цепь исцеления на игрока &quot;' . $usr['login'] . '&quot;.';
-                                        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]] Лекари &quot;' . $u->info['login'] . $it_users . '&quot; вылечили от ' . $text_msg . ' игрока &quot;' . $usr['login'] . '&quot;.';
-                                        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 = 'Вы присоединились к цепи исцеления для &quot;' . $text_msg . '&quot; (исцеление ' . $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 = 'Вы создали цепь исцеления для &quot;' . $text_msg . '&quot; (исцеление ' . $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]] Лекарь &quot;' . $u->info['login'] . '&quot; кинул цепь исцеления на игрока &quot;' . $usr['login'] . '&quot;.';
-                                        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'] < time() - 120 && $usr['bot'] == 0) {
-                                $u->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 = '&quot;Легкой травмы&quot;';
-                                    $text_msg2 = 'легких';
-                                } elseif ($itm['magic_inci'] == 'lech_free_2') {
-                                    $type_lechenie = 2; // тип травмы котору лечим
-                                    $text_msg = '&quot;Средней травмы&quot;';
-                                    $text_msg2 = 'средних';
-                                } elseif ($itm['magic_inci'] == 'lech_free_3') {
-                                    $type_lechenie = 3; // тип травмы котору лечим
-                                    $text_msg = '&quot;Тяжелой травмы&quot;';
-                                    $text_msg2 = 'тяжелых';
-                                }
-                                if ($travm['v1'] != $type_lechenie) {
-                                    $u->error = 'Неподходящий свиток для данной травмы.';
-                                } elseif ($travm['id']) {
-                                    $lech_aa = [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');
-                                        }
-
-                                        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]] Лекари &quot;' . $u->info['login'] . $it_users . '&quot; вылечили от ' . $text_msg . ' игрока &quot;' . $usr['login'] . '&quot;.';
-                                        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 = 'Вы присоединились к цепи исцеления для &quot;' . $text_msg . '&quot; (исцеление ' . $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 = 'Вы создали цепь исцеления для &quot;' . $text_msg . '&quot; (исцеление ' . $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"
-												)');
-                                        }
-                                        $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]] Лекарь &quot;' . $u->info['login'] . '&quot; кинул цепь исцеления на игрока &quot;' . $usr['login'] . '&quot;.';
-                                        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'] < time() - 120 && $usr['bot'] == 0) {
-                                $u->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} <b>переманил клона</b> {u2} на свою сторону.';
-                                        } else {
-                                            $txt_m = '{u1} <b>переманила</b> клона {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 = 'Вы успешно использовали заклинание &quot;' . $itm['name'] . '&quot; на &quot;' . $usr['login'] . '&quot;';
-                                    } 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'], '&quot;<font color="maroon">System.inventory</font>&quot;: Персонаж использовал заклинание &quot;' . $itm['name'] . '&quot; (' . $us[1] . ') на персонажа &quot;' . $usr['login'] . '&quot; (id' . $usr['id'] . ') [itm:' . $itm['id'] . '].', time(), $u->info['city'], 'System.inventory', 0, 0);
-                                            $u->addDelo(1, $usr['id'], '&quot;<font color="maroon">System.inventory</font>&quot;: Персонаж &quot;' . $u->info['login'] . '&quot; (id' . $u->info['id'] . ') использовал заклинание &quot;' . $itm['name'] . '&quot; (' . $us[1] . ') на персонажа [itm:' . $itm['id'] . '].', time(), $usr['city'], 'System.inventory', 0, 0);
-                                            $u->error = 'Вы успешно использовали заклинание &quot;' . $itm['name'] . '&quot; на персонажа &quot;' . $usr['login'] . '&quot;<br>' . $us[1] . '';
-                                        } else {
-                                            $u->addDelo(1, $u->info['id'], '&quot;<font color="maroon">System.inventory</font>&quot;: Персонаж использовал заклинание &quot;' . $itm['name'] . '&quot; (' . $us[1] . ') на персонажа самого себя [itm:' . $itm['id'] . '].', time(), $u->info['city'], 'System.inventory', 0, 0);
-                                            $u->error = 'Вы успешно использовали заклинание &quot;' . $itm['name'] . '&quot; на самого себя<br>' . $us[1] . '';
-
-                                        }
-                                        //
-                                        if ($usr['battle'] > 0) {
-                                            //Заносим в лог
-                                            $txt_m = '';
-                                            if ($u->info['sex'] == 0) {
-                                                if ($u->info['id'] != $usr['id']) {
-                                                    $txt_m .= '{u1} воспользовался магией &quot;<b>' . $itm['name'] . '</b>&quot; на {u2}.';
-                                                } else {
-                                                    $txt_m .= '{u1} воспользовался магией &quot;<b>' . $itm['name'] . '</b>&quot; на себя.';
-                                                }
-                                            } else {
-                                                if ($u->info['id'] != $usr['id']) {
-                                                    $txt_m .= '{u1} воспользовалась магией &quot;<b>' . $itm['name'] . '</b>&quot; на {u2}.';
-                                                } else {
-                                                    $txt_m .= '{u1} воспользовалась магией &quot;<b>' . $itm['name'] . '</b>&quot; на себя.';
-                                                }
-                                            }
-                                            $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'] . ']] &quot;' . $u->info['login'] . '&quot; использовала &quot;' . $itm['name'] . ' Саныча&quot; и получила эффект ' . $echotext . ' травмы.';
-                                } else {
-                                    $rtxt = '[img[items/' . $itm['img'] . ']] &quot;' . $u->info['login'] . '&quot; использовал &quot;' . $itm['name'] . ' Саныча&quot; и получил эффект ' . $echotext . ' травмы.';
-                                }
-
-                            } 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 = 'Вы успешно использовали &quot;' . $itm['name'] . '&quot;';
-                            $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} использовала &quot;<b>' . $itm['name'] . ' Саныча</b>&quot;.');
-                            } else {
-                                $this->inBattleLog('{u1} использовал &quot;<b>' . $itm['name'] . ' Саныча</b>&quot;.');
-                            }
-                            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 = 'Вы успешно использовали &quot;' . $itm['name'] . '&quot; на ' . $usr['login'] . '';
-
-                                if ($u->info['sex'] == 1) {
-                                    $this->inBattleLog('{u1} использовала &quot;<b>' . $itm['name'] . ' Саныча</b>&quot; на {u2}.', $usr);
-                                } else {
-                                    $this->inBattleLog('{u1} использовал &quot;<b>' . $itm['name'] . ' Саныча</b>&quot; на {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 && $travm['v1'] == 4)
-                                $u->error = 'У вас неизлечимая травма, вам помогут только боги или время.';
-                            elseif ($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 = [
-                                    '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} использовал &quot;' . $itm['name'] . '&quot; и <b>породил клона</b>.';
-                                    } else {
-                                        $txt_m = '{u1} использовала &quot;' . $itm['name'] . '&quot; и <b>породила клона</b>.';
-                                    }
-                                    $this->inBattleLog($txt_m, null);
-                                    if ($u->info['sex'] == 0) {
-                                        $txt_m = '<b>' . $u->info['login'] . ' (клон ' . $bot_cou . ')</b>[' . $u->info['level'] . '] вмешался в поединок!';
-                                    } else {
-                                        $txt_m = '<b>' . $u->info['login'] . ' (клон ' . $bot_cou . ')</b>[' . $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 = 'Заклятие &quot;' . $itm['name'] . '&quot; было успешно использовано';
-                                } 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} применил заклинание &quot;<b>' . $itm['name'] . '</b>&quot;.';
-                                    } else {
-                                        $txt_m = '{u1} применила заклинание &quot;<b>' . $itm['name'] . '</b>&quot;.';
-                                    }
-                                    $this->inBattleLog($txt_m, null);
-                                    mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . ($itm['iznosNOW'] + 1) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
-                                    $u->error = 'Заклятие &quot;' . $itm['name'] . '&quot; было успешно использовано';
-                                }
-                            } else {
-                                $u->error = 'Вы погибли...';
-                            }
-                        } elseif ($itm['magic_inci'] == 'add_animal') {
-                            if ($u->info['animal'] > 0) {
-                                $u->error = 'Не удалось использовать "' . $itm['name'] . '", у Вас уже есть зверь.';
-                            } else {
-                                $anm = ['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'] = [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'] = [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'] = [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'] = [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'] = [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'] = [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'] = [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'] . '" и помните - &quot;Мы в ответе за тех, кого приручили&quot;.';
-                                    $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'], '&quot;<font color="maroon">System.inventory</font>&quot;: Персонаж использовал заклинание &quot;' . $itm['name'] . '&quot; (' . $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'], '&quot;<font color="maroon">System.inventory</font>&quot;: Персонаж использовал заклинание &quot;' . $itm['name'] . '&quot; (' . $us[1] . ') [itm:' . $itm['id'] . '].', time(), $u->info['city'], 'System.inventory', 0, 0);
-                                $this->youuse++;
-                                $u->error = 'Вы успешно использовали заклинание &quot;' . $itm['name'] . '&quot;<br>' . $us[1] . '';
-                            } else {
-                                if ($u->error != '') {
-                                    $u->error = 'Не удалось использовать "' . $itm['name'] . '"...<br>' . $u->error;
-                                } else {
-                                    $u->error = 'Не удалось использовать "' . $itm['name'] . '"...';
-                                }
-                            }
-                        } else {
-                            if ($u->error != '') {
-                                $u->error = 'Не удалось использовать "' . $itm['name'] . '"<br>' . $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 = [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 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;
-    }
-
-    private static function getDressedEkrTotalPrice($uid)
-    {
-        return \Insallah\Db::getValue('select sum(2price) from items_users where inOdet > 0 and uid = ?', [$uid]);
-    }
-
-    private static function canAttack8Level($attacker, $target)
-    {
-        $aSum = self::getDressedEkrTotalPrice($attacker);
-        $tRange = \Insallah\Math::get20PercentRange(self::getDressedEkrTotalPrice($target));
-
-        return $aSum >= $tRange['min'] && $aSum <= $tRange['max'];
-    }
-
-    //создаем нападение на персонажа
-    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'));
-        $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 `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;'));
-
-        $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 ($usr['level'] == 8 && $usr['no_ip'] != 'trupojor' && self::canAttack8Level($u->info['id'], $usr['id'])) {
-            $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)) {
-            $u->error = 'Противник тяжело травмирован, нельзя напасть!';
-        } elseif ($this->testTravma($uid1, 2)) {
-            $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 = ['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']);
-                    }
-
-
-                    $s02 = ['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 = '<img src="https://img.new-combats.com/i/items/atackk.gif" /> {u1} напал на {u2} завязался бой <a target=_blank href=/logs.php?log=' . $btl_id . ' >»»</a>';
-                        } else {
-                            $text = '<img src="https://img.new-combats.com/i/items/atackk.gif" /> {u1} напала на {u2} завязался бой <a target=_blank href=/logs.php?log=' . $btl_id . ' >»»</a>';
-                        }
-                        $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 .= '<img src=https://img.new-combats.com/i/align/align' . $usr_real['align'] . '.gif width=12 height=15 >';
-                            }
-                            if ($usr_real['clan'] > 0) {
-                                $usrreal .= '<img src=https://img.new-combats.com/i/clan/' . $usr_real['clan'] . '.gif width=24 height=15 >';
-                            }
-                            $usrreal .= '<b>' . $usr_real['login'] . '</b>[' . $usr_real['level'] . ']<a target=_blank href=https://new-combats.com/info/' . $usr_real['id'] . ' ><img width=12 hiehgt=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-                        } else {
-                            $usrreal = '<i>Невидимка</i>[??]';
-                        }
-                        $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 .= '<img src=https://img.new-combats.com/i/align/align' . $me_real['align'] . '.gif width=12 height=15 >';
-                            }
-                            if ($me_real['clan'] > 0) {
-                                $mereal .= '<img src=https://img.new-combats.com/i/clan/' . $me_real['clan'] . '.gif width=24 height=15 >';
-                            }
-                            $mereal .= '<b>' . $me_real['login'] . '</b>[' . $me_real['level'] . ']<a target=_blank href=https://new-combats.com/info/' . $me_real['id'] . ' ><img width=12 hiehgt=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-                        } else {
-                            $mereal = '<i>Невидимка</i>[??]';
-                        }
-                        $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 . '<img width=12 height=15 src=https://img.new-combats.com/i/align/align' . $uid1u['align'] . '.gif >';
-                }
-                if ($uid1u['align2'] > 0) {
-                    $btxt = $btxt . '<img width=12 height=15 src=https://img.new-combats.com/i/align/align' . $uid1u['align2'] . '.gif >';
-                }
-                if ($uid1u['clan'] > 0) {
-                    $btxt = $btxt . '<img width=24 height=15 src=https://img.new-combats.com/i/clan/' . $uid1u['clan'] . '.gif >';
-                }
-                $btxt = $btxt . '<b>{u1}</b>[' . $uid1u['level'] . ']<a href=info/' . $uid1u['id'] . ' target=_blank ><img width=12 height=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-                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 = [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` = "' . $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');
-                            }
-
-                        } else {
-                            $u->send('', $u->info['room'], $u->info['city'], '', $u->info['login'], '<b>' . $a['name'] . '</b> нуждается в еде...', time(), 6, 0, 0, 0, 1);
-                        }
-                    }
-                }
-                // Бафф Зверя animal_bonus ---------------------------------
-                $ltm = [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'));
-                    if ($u->info['sex'] == 0) {
-                        $text = '<img src="https://img.new-combats.com/i/items/atackk.gif" /> {u1} вмешался в поединок против {u2} <a target=_blank href=/logs.php?log=' . $btl_id . ' >»»</a>';
-                    } else {
-                        $text = '<img src="https://img.new-combats.com/i/items/atackk.gif" /> {u1} вмешалась в поединок против {u2} <a target=_blank href=/logs.php?log=' . $btl_id . ' >»»</a>';
-                    }
-                    $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 .= '<img src=https://img.new-combats.com/i/align/align' . $usr_real['align'] . '.gif width=12 height=15 >';
-                        }
-                        if ($usr_real['clan'] > 0) {
-                            $usrreal .= '<img src=https://img.new-combats.com/i/clan/' . $usr_real['clan'] . '.gif width=24 height=15 >';
-                        }
-                        $usrreal .= '<b>' . $usr_real['login'] . '</b>[' . $usr_real['level'] . ']<a target=_blank href=https://new-combats.com/info/' . $usr_real['id'] . ' ><img width=12 hiehgt=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-                    } else {
-                        $mereal = '<i>Невидимка</i>[??]';
-                    }
-                    $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 .= '<img src=https://img.new-combats.com/i/align/align' . $me_real['align'] . '.gif width=12 height=15 >';
-                        }
-                        if ($me_real['clan'] > 0) {
-                            $mereal .= '<img src=https://img.new-combats.com/i/clan/' . $me_real['clan'] . '.gif width=24 height=15 >';
-                        }
-                        $mereal .= '<b>' . $me_real['login'] . '</b>[' . $me_real['level'] . ']<a target=_blank href=https://new-combats.com/info/' . $me_real['id'] . ' ><img width=12 hiehgt=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-                    } else {
-                        $mereal = '<i>Невидимка</i>[??]';
-                    }
-                    $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;
-    }
-}
-
-$magic = new Magic;
-
-?>
\ No newline at end of file
diff --git a/_incl_data/class/__quest.php b/_incl_data/class/__quest.php
deleted file mode 100644
index 62c1a56e..00000000
--- a/_incl_data/class/__quest.php
+++ /dev/null
@@ -1,1019 +0,0 @@
-<?
-if (!defined('GAME')) {
-    die();
-}
-
-class quests
-{
-    public $free_x = 28, $data = [];
-
-    /* �������� ����������� ������ */
-    public function testGood($pl)
-    {
-        global $u;
-
-        if (!is_array($pl)) {
-            $pl = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "' . $pl . '" LIMIT 1'));
-        }
-
-        $r = 1;
-        $d1 = 0;
-        $sp1 = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `actions` WHERE `vars` LIKE "%start_quest%" AND `vals` = "go" AND `uid` = "' . $u->info['id'] . '" LIMIT 100'));
-        $pl1 = $pl1[0];
-        //���� ��� ����� 5 ������� �����
-        if ($d1 >= $this->free_x) {
-            $r = 0;
-        }
-        unset($d1, $pl1, $sp1);
-        //���� ����� ��� �����
-        $qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" ORDER BY `id` DESC LIMIT 1'));
-        if (isset($qlst['id']) && $qlst['vals'] != 'win' && $qlst['vals'] != 'end' && $qlst['vals'] != 'bad') {
-            $r = 0;
-        }
-        unset($qlst, $qlst2);
-
-        $d = $this->expl($pl['tr_date']);
-        //��������� ������ [ 1,2,3,4,5 ...
-        if (isset($d['tr_endq'])) {
-            $i = 0;
-            $e = explode(',', $d['tr_endq']);
-            while ($i < count($e)) {
-                $qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $e[$i] . '" AND `vals` = "win" ORDER BY `id` DESC LIMIT 1'));
-                if (!isset($qlst['id'])) {
-                    $r = 0;
-                }
-                $i++;
-            }
-            unset($qn, $qlst, $qlst2);
-        }
-        //�������� ����� ����������� ������
-        if (isset($d['tr_zdr'])) {
-            $qlst = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" AND `vals` != "go" ORDER BY `time` DESC LIMIT 1'));
-            if ($qlst['time'] + ($d['tr_zdr'] * 60 * 60) - time() > 0) {
-                $r = 0;
-            }
-            unset($qlst);
-        }
-        //������������� ������
-        if (isset($d['tr_tm1'])) {
-            $d['tr_tm1'] = str_replace('d', date('d'), $d['tr_tm1']);
-            $d['tr_tm1'] = str_replace('m', date('m'), $d['tr_tm1']);
-            $d['tr_tm1'] = str_replace('y', date('y'), $d['tr_tm1']);
-            $d['tr_tm2'] = str_replace('d', date('d'), $d['tr_tm2']);
-            $d['tr_tm2'] = str_replace('m', date('m'), $d['tr_tm2']);
-            $d['tr_tm2'] = str_replace('y', date('y'), $d['tr_tm2']);
-            //�������� ����������
-        }
-        //������� ��� ����� ������ �����
-        if (isset($d['tr_raz'])) {
-            $qlst = $u->testAction('SELECT `id` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" LIMIT ' . $d['tr_raz'], 2);
-            if ($d['tr_raz'] > 0 && $d['tr_raz'] - $qlst[0] <= 0) {
-                $r = 0;
-            }
-            unset($qlst);
-        }
-        //������� ������ �����
-        if (isset($d['tr_raz2'])) {
-            $qlst = $u->testAction('SELECT `id` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" AND `vals` != "go" AND `vals` != "win"  LIMIT ' . $d['tr_raz2'], 2);
-            if ($d['tr_raz2'] - $qlst[0] <= 0) {
-                $r = 0;
-            }
-            unset($qlst);
-        }
-        return $r;
-    }
-
-    public function onlyOnceQuest($quests, $uid)
-    { // ��������� ����������� ������
-        $result = [];
-        $rep = mysql_fetch_array(mysql_query('SELECT * FROM `rep` WHERE `id` = "' . $uid));
-        foreach ($quests as $quest) {
-            $ok = true;
-            $t = $this->expl($quest['tr_date']);
-            if (isset($t['only_once']) && $t['only_once'] == "1") {
-                $ins = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) as sum FROM `actions` WHERE `uid` = "' . $uid . '" AND `vars` = "start_quest' . $quest['id'] . '" AND (`vals` = "go" OR `vals` = "end")'));
-            } else {
-                $ins = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) as sum FROM `actions` WHERE `uid` = "' . $uid . '" AND `vars` = "start_quest' . $quest['id'] . '" AND `vals` = "go" '));
-                if ($ins['sum'] > 0) {
-                    $ins['sum'] = 'delete';
-                }
-            }
-            if ($ins['sum'] == 'delete') {
-                $ok = false;
-            } elseif (
-                isset($ins) &&
-                $ins['sum'] >= 1 &&
-                $rep['rep' . $quest['city']] < 10000
-            ) {
-                $ok = false;
-            } elseif (
-                isset($ins) &&
-                $ins['sum'] >= 2 &&
-                $rep['rep' . $quest['city']] <= 24999 &&
-                $rep['rep' . $quest['city']] >= 10000) {
-                $ok = false;
-            } else {
-                $result[] = $quest;
-            }
-            unset($ins, $t, $ok);
-        }
-        return $result;
-    }
-
-    /* ����� ����� */
-    public function startq($id, $val = null)
-    {
-        global $c, $u;
-        $pl = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE (`city` = "" OR `city` = "' . $u->info['city'] . '") AND `delete` = "0" AND `min_lvl` <= ' . $u->info['level'] . ' AND `max_lvl` >= ' . $u->info['level'] . ' AND (`align` = "0" OR `align` = "' . floor($u->info['align']) . '") AND `id` = "' . mysql_real_escape_string($id) . '" LIMIT 1'));
-        if (isset($pl['id'])) {
-            $u->addAction(time(), 'start_quest' . $pl['id'], 'go', null, $val);
-            $u->error = '�� ������� �������� ������� &quot;' . $pl['name'] . '&quot;';
-        } else {
-            $u->error = '�� ������� �������� ������ �������';
-        }
-    }
-
-    /* ����� ����� � ������ */
-    public function startq_dn($id, $val = null)
-    {
-        global $c, $u;
-        $pl = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `delete` = "0" AND `min_lvl` <= ' . $u->info['level'] . ' AND `max_lvl` >= ' . $u->info['level'] . ' AND (`align` = "0" OR `align` = "' . floor($u->info['align']) . '") AND `id` = "' . mysql_real_escape_string($id) . '" LIMIT 1'));
-        if (isset($pl['id'])) {
-            if ($val == null)
-                $u->addAction(time(), 'start_quest' . $pl['id'], 'go');
-            else
-                $u->addAction(time(), 'start_quest' . $pl['id'], 'go', $u->info['id'], $val);
-            $u->error = '�� ������� �������� ������� &quot;' . $pl['name'] . '&quot;';
-        } else {
-            $u->error = '�� ������� �������� ������ �������';
-        }
-    }
-
-    /* ���������� �� ������ */
-    public function endq($id, $tp)
-    {
-        global $u;
-        $pl = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `delete` = "0" AND `min_lvl` <= ' . $u->info['level'] . ' AND `max_lvl` >= ' . $u->info['level'] . ' AND (`align` = "0" OR `align` = "' . floor($u->info['align']) . '") AND `id` = "' . mysql_real_escape_string($id) . '" LIMIT 1'));
-        $qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" AND `vals` = "go" ORDER BY `id` DESC LIMIT 1'));
-        if (isset($qlst['id'])) {
-            if ($tp == 'end') {
-                mysql_query('UPDATE `actions` SET `vals` = "end" WHERE `id` = "' . $qlst['id'] . '" LIMIT 1');
-                $u->error = '�� ������� ���������� �� ������� &quot;' . $pl['name'] . '&quot;';
-            } elseif ($tp == 'win') {
-                mysql_query('UPDATE `actions` SET `vals` = "win" ,`time` = "' . time() . '" WHERE `id` = "' . $qlst['id'] . '" LIMIT 1');
-            }
-        } else {
-            $u->error = '�� ������� ���������� �� ������� ';
-        }
-    }
-
-    /* ���� � ������ � ������� */
-    public function infoDng($pl)
-    {
-        global $u;
-        $r = 0;
-        $xrz = 0;
-        $qst = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" AND `vals` = "go" LIMIT 1'));
-        //������� ������� ������� ������ ������������� ������� ���������������
-        //$d = $this->expl($pl['tr_date']);
-        //�������� ������
-        $d = $this->expl($pl['act_date']);
-
-        //���������� � NPS
-        if (isset($d['dlg_nps'])) {
-            $i7 = 0;
-            $x3 = explode(',', $d['dlg_nps']);
-            while ($i7 < count($x3)) {
-                $x4 = explode('=', $x3[$i7]);
-                if ($x4[0] > 0) {
-                    $r++;
-                }
-                $i7++;
-            }
-            unset($x1, $x3, $x4, $i7);
-        }
-
-        //����� �������
-        if (isset($d['kill_user'])) {
-            $r += $d['kill_user'];
-        }
-
-        //����� �����
-        if (isset($d['kill_bot'])) {
-            $x = '';
-            $ex = explode(',', $d['kill_bot']);
-            $i = 0;
-            while ($i < count($ex)) {
-                $x2 = 0;
-                $ex2 = explode('=', $ex[$i]);
-                $bot2 = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . $ex2[0] . '" LIMIT 1'));
-                if (isset($bot2['id'])) {
-                    if (isset($qst['id'])) {
-                        $x2 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time` > ' . $qst['time'] . ' AND `vars` = "win_bot_' . $ex2[0] . '" LIMIT ' . $ex2[1], 2);
-                        $x2 = 0 + $x2[0];
-                    }
-                    if (isset($d['all_kill']) && $d['all_kill'] > 0) {
-                        $r = $d['all_kill'];
-                    } else {
-                        $r += $ex2[1];
-                    }
-                    $xrz += $x2;
-                }
-                $i++;
-            }
-            unset($x, $ex, $x2, $bot2, $ex2);
-        }
-
-        //������� �������
-        if (isset($d['tk_itm'])) {
-            $ex = explode(',', $d['tk_itm']);
-            $i = 0;
-            while ($i < count($ex)) {
-                $ex2 = explode('=', $ex[$i]);
-                $x2 = mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM `items_users` WHERE `item_id` = "' . mysql_real_escape_string($ex2[0]) . '" AND `uid` = "' . $u->info['id'] . '" AND (`delete` = 1000 OR `delete` = 0) AND `inTransfer` = 0 AND `inShop` = 0 LIMIT 1'));
-                if ($x2[0] >= $ex2[1]) {
-                    $x2[0] = ($ex2[1] + round($ex2[1] * 0.15));
-                }
-                $r += $ex2[1];
-                $xrz += $x2[0];
-                $i++;
-            }
-        }
-
-        //������� ������
-        if (isset($d['tkill_itm'])) {
-            $ex = explode(',', $d['tkill_itm']);
-            $i = 0;
-            while ($i < count($ex)) {
-                $ex2 = explode('=', $ex[$i]);
-                $x2 = mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM `items_users` WHERE `maidin` = "' . $pl['city'] . '" AND `item_id` = "' . mysql_real_escape_string($ex2[0]) . '" AND `uid` = "' . $u->info['id'] . '" AND (`delete` = 1000 OR `delete` = 0) AND `inTransfer` = 0 AND `inShop` = 0 LIMIT 1'));
-                if ($x2[0] >= $ex2[1]) {
-                    $x2[0] = ($ex2[1] + round($ex2[1] * 0.15));
-                }
-                $r += $ex2[1];
-                $xrz += $x2[0];
-                $i++;
-            }
-        }
-
-        if ($r < 1) {
-            $r = '[0/1]';
-        } else {
-            if ($xrz < 0) {
-                $xrz = 0;
-            }
-            if ($xrz > $r) {
-                $xrz = $r;
-            }
-            $r = '<table style="display:inline-block;" border="0" cellspacing="0" cellpadding="0" height="10"><tr><td valign="middle" width="120" style="padding-top:12px">
-  <div style="position:relative;"><div id="vhp-1234500000' . $pl['id'] . '" title="���������� �������" align="left" class="seehp" style="position:absolute; top:-10px; width:120px; height:10px; z-index:12;"> ' . $xrz . '/' . $r . '</div>
-  <div title="���������� �������" class="hpborder" style="position:absolute; top:-10px; width:120px; height:9px; z-index:13;"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
-  <div class="hp_3 senohp" style="height:9px; width:120px; position:absolute; top:-10px; z-index:11;" id="lhp-1234500000' . $pl['id'] . '"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
-  <div title="���������� �������" class="hp_none" style="position:absolute; top:-10px; width:120px; height:10px; z-index:10;"><img src="https://img.new-combats.com/1x1.gif" height="10"></div>
-</div></td></tr></table><br><script>top.startHpRegen("main",-1234500000' . $pl['id'] . ',' . $xrz . ',' . $r . ',0,0,0,0,0,0,1);</script>';
-        }
-        return $r;
-    }
-
-    /* ���������� � ������ */
-    public function info($pl)
-    {
-        global $u;
-        $r = '';
-        $t = '';
-        $qst = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" AND `vals` = "go" LIMIT 1'));
-        //������� ������� ������� ������ ������������� ������� ���������������
-        $d = $this->expl($pl['tr_date']);
-        //��������� ������ [ 1,2,3,4,5 ...
-        if (isset($d['tr_endq'])) {
-            $t .= '��������� ������: ';
-            $i = 0;
-            $e = explode(',', $d['tr_endq']);
-            while ($i <= count($e)) {
-                if ($e[$i] > 0) {
-                    $qn = mysql_fetch_array(mysql_query('SELECT `name` FROM `quests` WHERE `id` = "' . $e[$i] . '" LIMIT 1'));
-                    if (isset($qn['name'])) {
-                        $t .= '&quot;' . $qn['name'] . '&quot;, ';
-                    }
-                }
-                $i++;
-            }
-            $t = trim($t, ', ');
-            $t .= '<br>';
-            unset($qn);
-        }
-        //�� ����� ������ �������� [ idbot-itm1=%,itm2=%|
-        if (isset($d['tr_botitm'])) {
-            $t .= '�� ����� �������� ��������:<ul>';
-            $e = explode('|', $d['tr_botitm']);
-            $i = 0;
-            while ($i < count($e)) {
-                $j = 0;
-                $e2 = explode('-', $e[$i]);
-                //$e2[0] - id ����
-                if ($e2[0] > 0) {
-                    $qn = mysql_fetch_array(mysql_query('SELECT `login` FROM `test_bot` WHERE `id` = "' . $e2[0] . '" LIMIT 1'));
-                    $t .= '&nbsp; &nbsp; &bull; �� &quot;' . $qn['login'] . '&quot; ��������: ';
-                } else {
-                    $t .= '&nbsp; &nbsp; &bull; �� ����� ����� ��������: ';
-                }
-                //$e2[1] - ��������
-                $e3 = explode(',', $e2[1]);
-                while ($j < count($e3)) {
-                    $e4 = explode('=', $e3[$j]);
-                    //$e4[0] - ������� , $e4[1] - ����
-                    $qi = mysql_fetch_array(mysql_query('SELECT `id`,`name`,`img` FROM `items_main` WHERE `id` = "' . $e4[0] . '" LIMIT 1'));
-                    $t .= '<img src="https://img.new-combats.com/i/items/' . $qi['img'] . '" style="max-height:12px"> <a href="items_info.php?id=' . $qi['id'] . '" target="_blank">' . $qi['name'] . '</a>, ';
-                    $j++;
-                }
-                $t = trim($t, ', ');
-                $i++;
-            }
-            $t .= '<br>';
-            unset($qn, $qi, $e2, $e3, $e4);
-        }
-        //��� �������� ������ �������� [ type-itm1=%,itm2=%|
-        if (isset($d['tr_winitm'])) {
-            $t .= '����� ������ �������� ��������:<br>';
-            $e = explode('|', $d['tr_winitm']);
-            $i = 0;
-            while ($i < count($e)) {
-                $e2 = explode('-', $e[$i]);
-                $t .= '&nbsp; &nbsp; &bull; ';
-                //$e2[0] - id ����
-                if ($e2[0] > 0) {
-                    $t .= '�� ����� ��������: ';
-                } else {
-                    $t .= '�� ����� ��������: ';
-                }
-                //$e2[1] - ��������
-                $j = 0;
-                $e3 = explode(',', $e2[1]);
-                while ($j < count($e3)) {
-                    $e4 = explode('=', $e3[$j]);
-                    //$e4[0] - ������� , $e4[1] - ����
-                    $qi = mysql_fetch_array(mysql_query('SELECT `id`,`name`,`img` FROM `items_main` WHERE `id` = "' . $e4[0] . '" LIMIT 1'));
-                    $t .= '<img src="https://img.new-combats.com/i/items/' . $qi['img'] . '" style="max-height:12px"> <a href="items_info.php?id=' . $qi['id'] . '" target="_blank">' . $qi['name'] . '</a>, ';
-                    $j++;
-                }
-                $t = trim($t, ', ');
-                $t .= '<br>';
-                $i++;
-            }
-            unset($qn, $qi, $e2, $e3, $e4);
-        }
-        //�������� ����� ����������� ������
-        if (isset($d['tr_zdr'])) {
-            $qlst = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" AND `vals` != "go" LIMIT 1'));
-            $t .= '�������� ����� ����������� �������: ' . $u->timeOut($d['tr_zdr'] * 60 * 60);
-            if ($qlst['time'] + ($d['tr_zdr'] * 60 * 60) - time() > 0) {
-                $t .= '<small>(��������: ' . $u->timeOut($qlst['time'] + ($d['tr_zdr'] * 60 * 60) - time()) . ' �.)</small>';
-            }
-            $t .= '<br>';
-            unset($qlst);
-        }
-        //������������� ������
-        if (isset($d['tr_tm1'])) {
-            $d['tr_tm1'] = str_replace('d', date('d'), $d['tr_tm1']);
-            $d['tr_tm1'] = str_replace('m', date('m'), $d['tr_tm1']);
-            $d['tr_tm1'] = str_replace('y', date('y'), $d['tr_tm1']);
-
-            $d['tr_tm2'] = str_replace('d', date('d'), $d['tr_tm2']);
-            $d['tr_tm2'] = str_replace('m', date('m'), $d['tr_tm2']);
-            $d['tr_tm2'] = str_replace('y', date('y'), $d['tr_tm2']);
-
-            $t .= '������ ������: ' . $d['tr_tm1'] . ' - ' . $d['tr_tm2'] . '<br>';
-        }
-        //������� ��� ����� ������ �����
-        if (isset($d['tr_raz'])) {
-            if ($d['tr_raz'] == -1) {
-                $t .= '������� ��� ��� ����� ��������� �������: <b><small>����������</small></b><br>';
-            } else {
-                $qlst = $u->testAction('SELECT `id` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" LIMIT ' . $d['tr_raz'], 2);
-                $t .= '������� ��� ����� ��������� �������: ' . ($d['tr_raz'] - $qlst[0]) . '<br>';
-            }
-            unset($qlst);
-        }
-        //������� ������ �����
-        if (isset($d['tr_raz2'])) {
-            $qlst = $u->testAction('SELECT `id` FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" AND `vals` != "go" AND `vals` != "win"  LIMIT ' . $d['tr_raz2'], 2);
-            $t .= '�������� ������� ��������� �������: ' . ($d['tr_raz2'] - $qlst[0]) . '<br>';
-            unset($qlst);
-        }
-
-        if ($t != '') {
-            $r .= '<b>������� �������:</b><br>' . $t . '<br>';
-            $t = '';
-        }
-
-        //������� �� �����
-        $d = $this->expl($pl['win_date']);
-
-        if (isset($d['add_eff'])) {
-            $x5 = '';
-            $x3 = explode(',', $d['add_eff']);
-            $x4 = 0;
-            while ($x4 < count($x3)) {
-                $x7 = explode('=', $x3[$x4]);
-                $x6 = mysql_fetch_array(mysql_query('SELECT `id2`,`mname`,`img` FROM `eff_main` WHERE `id2` = "' . $x7[0] . '" LIMIT 1'));
-                if (isset($x6['id2'])) {
-                    $x5 .= '<img width="40" height="25" src="https://img.new-combats.com/i/eff/' . $x6['img'] . '" title="' . $x6['mname'] . '
-����� ��������: ' . $u->timeOut($x7[1]) . '"> ';
-                }
-                $x4++;
-            }
-            if ($x5 != '') {
-                $t .= $x5 . '<br>';
-            }
-            unset($x3, $x4, $x5, $x6, $x7);
-        }
-
-        if (isset($d['add_rep'])) {
-            $t .= '��������� ' . $u->city_name[$pl['city']] . ': ' . $d['add_rep'] . '<br>';
-        }
-
-        if (isset($d['add_repizlom'])) {
-            $t .= '��������� ����� �����: ' . $d['add_repizlom'] . '<br>';
-        }
-
-        if (isset($d['add_cr'])) {
-            $t .= '������: ' . $d['add_cr'] . ' ��.<br>';
-        }
-
-        if ($t != '') {
-            $r = '<b>�������:</b><br>' . $t . '<br>' . $r;
-            $t = '';
-        }
-
-        //�������� ������
-        $d = $this->expl($pl['act_date']);
-        //���������� � NPS
-        if (isset($d['dlg_nps'])) {
-            $i7 = 0;
-            $x3 = explode(',', $d['dlg_nps']);
-            while ($i7 < count($x3)) {
-                $x4 = explode('=', $x3[$i7]);
-                if ($x4[0] > 0) {
-                    $x1 = mysql_fetch_array(mysql_query('SELECT `text` FROM `dungeon_dialog` WHERE `id` = "' . $x4[0] . '" LIMIT 1'));
-                    if (!isset($x1['text'])) {
-                        $x1 = '<i>����������</i>';
-                    } else {
-                        $x1 = $x1['text'];
-                    }
-                    $x = 0;
-                    $t .= '���������� � <b>' . $x1 . '</b>: ' . $x . '/1<br>';
-                }
-                $i7++;
-            }
-            unset($x1, $x3, $x4, $i7);
-        }
-
-        //����� �������
-        if (isset($d['kill_user'])) {
-            $t .= '����� �������: 0/' . $d['kill_user'] . '<br>';
-        }
-
-        //����� �����
-        if (isset($d['kill_bot'])) {
-
-            if (isset($d['all_kill']) && (int)$d['all_kill'] > 0) {
-                $x = '';
-                $ex = explode(',', $d['kill_bot']);
-                $i = 0; # ���������� ������ ��� ������� ���� ����.
-                $q = '';
-                while ($i < count($ex)) {
-                    $ex2 = explode('=', $ex[$i]);
-                    if ($q != '') {
-                        $q .= ' OR ';
-                    }
-                    $q .= ' (`uid` = "' . $u->info['id'] . '" AND `time` > ' . $qst['time'] . ' AND `vars` = "win_bot_' . $ex2[0] . '" )';
-                    $i++;
-                }
-                $x2 = $u->testAction($q, 2);
-                $x2 = $x2[0];
-                if ($d['all_kill'] < $x2) {
-                    $x2 = $d['all_kill'];
-                }
-                $bot2 = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . $ex2[0] . '" LIMIT 1'));
-                if (isset($bot2['id'])) {
-                    $x .= '&nbsp; &nbsp; &bull; <b>' . $bot2['login'] . '</b> [' . $x2 . '/' . $d['all_kill'] . ']<br>';
-                } else {
-                    $x .= '&nbsp; &nbsp; &bull; <b>' . $pl['name'] . '</b> [' . $x2 . '/' . $d['all_kill'] . ']<br>';
-                }
-            } else {
-                $i = 0;
-                while ($i < count($ex)) {
-                    $x2 = 0;
-                    $ex2 = explode('=', $ex[$i]);
-                    $bot2 = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . $ex2[0] . '" LIMIT 1'));
-                    if (isset($bot2['id'])) {
-                        if (isset($qst['id'])) {
-                            $x2 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time` > ' . $qst['time'] . ' AND `vars` = "win_bot_' . $ex2[0] . '" LIMIT ' . $ex2[1], 2);
-                            $x2 = 0 + $x2[0];
-                        }
-                        $x .= '&nbsp; &nbsp; &bull; <b>' . $bot2['login'] . '</b> [' . $x2 . '/' . $ex2[1] . ']<br>';
-                    }
-                    $i++;
-                }
-            }
-
-            if ($x != '') {
-                $x = trim($x, ', ');
-                $t .= '����� �����: <br>' . $x;
-            }
-            unset($x, $ex, $x2, $bot2, $ex2);
-        }
-
-        //������� �������
-        if (isset($d['tk_itm'])) {
-            $ex = explode(',', $d['tk_itm']);
-            $i = 0;
-            $x = '';
-            while ($i < count($ex)) {
-                $ex2 = explode('=', $ex[$i]);
-                $x2 = mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM `items_users` WHERE `item_id` = "' . mysql_real_escape_string($ex2[0]) . '" AND `uid` = "' . $u->info['id'] . '" AND (`delete` = 1000 OR `delete` = 0) AND `inTransfer` = 0 AND `inShop` = 0 LIMIT 1'));
-                if ($x2[0] >= $ex2[1]) {
-                    $x2[0] = ($ex2[1] + round($ex2[1] * 0.15));
-                }
-                $bot2 = mysql_fetch_array(mysql_query('SELECT `id`,`name`,`img` FROM `items_main` WHERE `id` = "' . mysql_real_escape_string($ex2[0]) . '" LIMIT 1'));
-                $x .= '&nbsp; &nbsp; &bull; <a target=_blank href=https://new-combats.com/item/' . $bot2['id'] . ' >' . $bot2['name'] . '</a> [' . $x2[0] . '/' . $ex2[1] . ']<br>';
-                $i++;
-            }
-            if ($x != '') {
-                $x = trim($x, ', ');
-                $t .= '������� �������: <br>' . $x;
-            }
-        }
-
-        //��������� �������
-        if (isset($d['tkill_itm'])) {
-            $ex = explode(',', $d['tkill_itm']);
-            $i = 0;
-            $x = '';
-            while ($i < count($ex)) {
-                $ex2 = explode('=', $ex[$i]);
-                $x2 = mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM `items_users` WHERE `maidin` = "' . $pl['city'] . '" AND `item_id` = "' . mysql_real_escape_string($ex2[0]) . '" AND `uid` = "' . $u->info['id'] . '" AND (`delete` = 1000 OR `delete` = 0) AND `inTransfer` = 0 AND `inShop` = 0 LIMIT 1'));
-                if ($x2[0] >= $ex2[1]) {
-                    $x2[0] = ($ex2[1] + round($ex2[1] * 0.15));
-                }
-                $bot2 = mysql_fetch_array(mysql_query('SELECT `id`,`name`,`img` FROM `items_main` WHERE `id` = "' . mysql_real_escape_string($ex2[0]) . '" LIMIT 1'));
-                $x .= '&nbsp; &nbsp; &bull; <a target=_blank href=https://new-combats.com/item/' . $bot2['id'] . ' >' . $bot2['name'] . '</a> [' . $x2[0] . '/' . $ex2[1] . ']<br>';
-                $i++;
-            }
-            if ($x != '') {
-                $x = trim($x, ', ');
-                $t .= '������� ������: <br>' . $x;
-            }
-        }
-
-        if ($t != '') {
-            $r = '<br><b>�������� �������:</b><br>' . $t . '<br>' . $r;
-            $t = '';
-        }
-
-        if ($r == '') {
-            $r = '�������������� ���������� �� ������� �����������';
-        }
-        return $r;
-    }
-
-    /** ���������� ������ ������ ������ ���.
-     * PHP Fatal error:  Call to a member function testquest() on a non-object
-     * @return void
-     */
-    public function testquest()
-    {
-        global $u;
-        if ($u->info['battle'] == 0 && $u->room['name'] != '����� ������') {
-            $sp = mysql_query('SELECT * FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` LIKE "%start_quest%" AND `vals` = "go" LIMIT 100');
-
-            while ($pl2 = mysql_fetch_array($sp)) {
-                $pl = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "' . (str_replace('start_quest', '', $pl2['vars'])) . '" LIMIT 1'));
-
-                $g = 1;
-                //�������� ������
-                $d = $this->expl($pl['act_date']);
-
-                //���������� � NPS
-                if (isset($d['dlg_nps'])) {
-                    $g = 0;
-                    unset($x);
-                }
-
-                //����� �������
-                if (isset($d['kill_user'])) {
-                    $x = 0;
-                    if ($x < $d['kill_user']) {
-                        $g = 0;
-                    }
-                    //$d['kill_user'] - �������� ����� �����
-                    unset($x);
-                }
-                //����� �����
-                if (isset($d['kill_bot'])) {
-                    $ex = explode(',', $d['kill_bot']);
-                    $ii = 0; // ���������� ������ ��� ������� ���� ����.
-                    $q = '';
-                    while ($ii < count($ex)) {
-                        $ex2 = explode('=', $ex[$ii]);
-                        if ($q != '') {
-                            $q .= ' OR ';
-                        }
-                        $q .= ' (`uid` = "' . $u->info['id'] . '" AND `time` > ' . $pl2['time'] . ' AND `vars` = "win_bot_' . $ex2[0] . '" )';
-                        $ii++;
-                    }
-                    if (isset($d['all_kill']) && $d['all_kill'] > 0) {
-                        $x2 = $u->testAction($q . ' LIMIT ' . $d['all_kill'], 2);
-                        if ($x2[0] < $d['all_kill']) {
-                            $g = 0;
-                        }
-                    } else {
-                        $x2 = $u->testAction($q . ' LIMIT ' . $ex2[1], 2);
-                        if (!isset($d['all_kill']) && $x2[0] < $ex2[1]) {
-                            $g = 0;
-                        }
-                    }
-                    unset($x, $ex, $x2, $x3, $bot2, $ex2);
-                }
-
-                //������� �������
-                if (isset($d['tk_itm'])) {
-                    $g = $this->collect_01(explode(',', $d['tk_itm']), $u);
-                }
-                //��������� �������
-                if (isset($d['tkill_itm'])) {
-                    $g = $this->collect_01(explode(',', $d['tkill_itm']), $u);
-                }
-                if ($g == 1) {
-                    $pl['time'] = $pl2['time'];
-                    $this->endq($pl['id'], 'win');
-                    $this->winQuest($pl);
-                    echo $pl['name'];
-                }
-            }
-        }
-    }
-
-    private function collect_01($arr, $u){ // ������ ������������. ��� ����� ��� ���������, �� ��� �������.
-        $i = 0;
-        while ($i < count($arr)) {
-            $ex2 = explode('=', $arr[$i]);
-            $x2 = mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM `items_users` WHERE `item_id` = ' . (int)$arr[0] . ' AND `uid` = ' . $u->info['id'] . ' AND (`delete` = 1000 OR `delete` = 0) AND `inTransfer` = 0 AND `inShop` = 0 LIMIT 1'));
-            if ($x2[0] < $ex2[1]) {
-                return 0;
-            }
-            $i++;
-        }
-        return 1;
-    }
-
-    private function collect_02($ex, $u, $pl) { // ������ ������������. ��� ����� ��� ���������, �� ��� �������.
-        $i = 0;
-        while ($i < count($ex)) {
-            $ex2 = explode('=', $ex[$i]);
-            $x2 = mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM `items_users` WHERE `maidin` = "' . $pl['city'] . '" AND `item_id` = "' . mysql_real_escape_string($ex2[0]) . '" AND `uid` = "' . $u->info['id'] . '" AND (`delete` = 1000 OR `delete` = 0) AND `inTransfer` = 0 AND `inShop` = 0 LIMIT 1'));
-            if ($x2[0] >= $ex2[1]) {
-                if ($x2[0] <= ($ex2[1] + round($ex2[1] * 0.15))) {
-                    $ex2[1] = $x2[0];
-                } else {
-                    $ex2[1] = ($ex2[1] + round($ex2[1] * 0.15));
-                }
-            }
-            if ($x2[0] < $ex2[1]) {
-                return 0;
-            }
-            $i++;
-        }
-        return 1;
-    }
-
-    # ������� �������� �� �������� �� ���������� ������� ��� ��������
-    public function questCheckEnd($pl)
-    {
-        global $u;
-        $quest = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "start_quest' . $pl['id'] . '" ORDER BY `time` DESC LIMIT 1'));
-        #��������� �����, �������� = 0 ���, 1 ��.
-        $r = 0;
-        if ($u->info['battle'] == 0 && $u->room['name'] != '����� ������') {
-            $g = 1;
-            # �������� ������
-            $d = $this->expl($pl['act_date']);
-
-            # ���������� � NPS
-            if (isset($d['dlg_nps'])) {
-                $g = 0;
-                unset($x);
-            }
-
-            # ����� �������
-            if (isset($d['kill_user'])) {
-                $x = 0;
-                if ($x < $d['kill_user']) {
-                    $g = 0;
-                }
-                unset($x);
-            }
-
-            # ����� �����
-            if (isset($d['kill_bot'])) {
-                $ex = explode(',', $d['kill_bot']);
-                $i = 0; # ���������� ������ ��� ������� ���� ����.
-                $q = '';
-                while ($i < count($ex)) {
-                    $ex2 = explode('=', $ex[$i]);
-                    if ($q != '') {
-                        $q .= ' OR ';
-                    }
-                    $q .= ' (`uid` = "' . $u->info['id'] . '" AND `time` > ' . $quest['time'] . ' AND `vars` = "win_bot_' . $ex2[0] . '" )';
-                    $i++;
-                }
-                if (isset($d['all_kill']) && (int)$d['all_kill'] > 0) {
-                    $x2 = $u->testAction($q, 2);
-                    if ((int)$d['all_kill'] <= $x2[0]) {
-                        $x2 = (int)$d['all_kill'];
-                    } else {
-                        $x2 = $x2[0];
-                    }
-                    if ($x2 < (int)$d['all_kill']) {
-                        $g = 0;
-                    }
-                } else {
-                    $x2 = $u->testAction($q . ' LIMIT ' . $ex2[1], 2);
-                    $x2 = min($ex2[1], $x2[0]);
-                    if ($x2 < $ex2[1]) {
-                        $g = 0;
-                    }
-                }
-                unset($x, $ex, $x2, $x3, $bot2, $ex2);
-            }
-
-            # ������� �������
-            if (isset($d['tk_itm'])) {
-                $g = $this->collect_02(explode(',', $d['tk_itm']), $u, $pl);
-            }
-            # ��������� �������
-            if (isset($d['tkill_itm'])) {
-                $g = $this->collect_02(explode(',', $d['tkill_itm']), $u, $pl);
-            }
-            $r = $g == 1 ? 1 : 0;
-        }
-        return $r;
-    }
-
-    /** ������ ������ �� ������ */
-    public function questSuccesEnd($quest, $action)
-    {
-        global $u, $c, $magic;
-        $r = '';
-
-        if (!isset($quest['id'])) {
-            return '';
-        }
-        $d = $this->expl($quest['act_date']);
-        $d = array_merge($d, $this->expl($quest['win_date']));
-
-        // �������� ������� ��� ������
-        if (isset($d['tk_itm']) || isset($d['tkill_itm'])) {
-            $ex = [];
-            if (isset($d['tk_itm'])) {
-                $ex[0] = explode(',', $d['tk_itm']);
-            }
-            if (isset($d['tkill_itm'])) {
-                $ex[1] = explode(',', $d['tkill_itm']);
-            }
-
-            $i = 0;
-            while ($i < count($ex)) {
-                $ex2 = explode('=', $ex[$i]);
-                $x2 = mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM `items_users` WHERE `maidin` = "' . $quest['city'] . '" AND `item_id` = "' . mysql_real_escape_string($ex2[0]) . '" AND `uid` = "' . $u->info['id'] . '" AND (`delete` = 1000 OR `delete` = 0) AND `inTransfer` = 0 AND `inShop` = 0 LIMIT 1'));
-                if ($x2[0] >= $ex2[1]) {
-                    if ($x2[0] <= ($ex2[1] + round($ex2[1] * 0.15))) {
-                        $ex2[1] = $x2[0];
-                    } else {
-                        $ex2[1] = ($ex2[1] + round($ex2[1] * 0.15));
-                    }
-                }
-                $d['add_rep'] = (int)$d['add_rep'] * (int)$ex2[1];
-                $u->deleteItemID($ex2[0], $u->info['id'], $ex2[1]);
-                $i++;
-            }
-        }
-        $t = '';
-
-        # �������� ��������� �� �����,
-        if (isset($d['add_rep'])) {
-            # ���� ��� �������� �����.
-            if (isset($d['kill_bot']) && isset($d['all_kill']) && $d['add_rep'] > 0) {
-                $ex = explode(',', $d['kill_bot']);
-                $ii = 0;
-                if ($quest['kin'] == 0) {
-                    $d['add_rep'] = 0;
-                    while ($ii < count($ex)) {
-                        $i = 0;
-                        $ex2 = explode('=', $ex[$i]);
-                        while ($i < $d['all_kill']) {
-                            $x2 = 0;
-                            $d['add_rep'] = $d['add_rep'] + $ex2[1];
-                            $x2 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time` > ' . $action['time'] . ' AND `vars` = "win_bot_' . $ex2[0] . '" LIMIT ' . $d['all_kill'], 2);
-                            $i++;
-                        }
-                        $ii++;
-                    }
-                } else {
-                    $d['add_rep'] = 1;
-                }
-            }
-
-            unset($x, $i, $ii, $ex, $x2, $bot2, $ex2);
-
-            $rep = mysql_fetch_array(mysql_query('SELECT * FROM `rep` WHERE `id` = ' . $u->info['id']));
-
-            if ($quest['city'] != '') {
-                if ($this->stats['more_awards'] >= 0) {
-                    $d['add_rep'] += $d['add_rep'] / 100 * 50;
-                }
-                $t .= '' . $d['add_rep'] . ' ��. ��������� ' . $u->city_name[$quest['city']] . ', ';
-                if (
-                    $rep['rep' . $quest['city']] < 24999 &&
-                    $rep['rep' . $quest['city']] + $d['add_rep'] >= 24999 &&
-                    $quest['kin'] != 2
-                ) {
-                    $rep['rep' . $quest['city']] = 24999;
-                } else {
-                    $rep['rep' . $quest['city']] += $d['add_rep'];
-                }
-
-                mysql_query('UPDATE `rep` SET `rep' . $quest['city'] . '` = "' . $rep['rep' . $quest['city']] . '" WHERE `id` = "' . $rep['id'] . '" LIMIT 1');
-            }
-        }
-        if (isset($d['add_repizlom'])) {
-            $t .= '' . $d['add_repizlom'] . ' ��. ��������� ������ �����, ';
-            $rep = mysql_fetch_array(mysql_query('SELECT * FROM `rep` WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'));
-            $rep['repizlom'] += $d['add_repizlom'];
-            if ($rep['repizlom'] > 24999) {
-                $rep['repizlom'] = 24999;
-            }
-            mysql_query('UPDATE `rep` SET `repizlom` = "' . $rep['repizlom'] . '" WHERE `id` = "' . $rep['id'] . '" LIMIT 1');
-        }
-        if (isset($d['add_eff'])) {
-            $i = 0;
-            $j = explode('=', $d['add_eff']);
-            while ($i < count($j)) {
-                if ($j[$i] > 0) {
-                    $magic->add_eff($u->info['id'], $j[$i], 1);
-                }
-                $i++;
-            }
-        }
-        if (isset($d['add_cr'])) {
-            $t .= '' . $d['add_cr'] . ' ��., ';
-            mysql_query('UPDATE `users` SET `money` = `money`+' . $d['add_cr'] . ' WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
-        }
-        if ($t != '') {
-            $t = rtrim($t, ', ');
-            $r = '������� <b>' . $quest['name'] . '</b> ���� ������� ���������! �� �������� �������: ' . $t . '.';
-            unset($t);
-        } else {
-            $r = '������� <b>' . $quest['name'] . '</b> ���� ������� ���������!';
-        }
-        $r = '<small>' . $r . '</small>';
-        //���������� ��������� � ���
-        mysql_query('UPDATE `actions` SET `vals` = "win" , `time` = "' . time() . '"  WHERE `id` = "' . $action['id'] . '" AND `vals` = "go" LIMIT 1');
-
-        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'] . "','" . $r . "','-1','5','0')");
-
-        return $r;
-    }
-
-    public function winQuest($pl)
-    {
-        global $u, $c, $magic;
-
-        if (isset($pl['id'])) {
-            $d = $this->expl($pl['act_date']);
-
-            $d = array_merge($d, $this->expl($pl['win_date']));
-
-            if ($_COOKIE['login'] == 'R' || $_COOKIE['login'] == 'r') {
-                echo '<script>alert("';
-                print_r(str_replace("\n", ' ', $d));
-                echo '");</script>';
-                die();
-            }
-
-            // �������� �������
-            if (isset($d['tk_itm'])) {
-                $ex = explode(',', $d['tk_itm']);
-                $i = 0;
-                while ($i < count($ex)) {
-                    $ex2 = explode('=', $ex[$i]);
-                    $ex2 = explode('=', $ex[$i]);
-                    $x2 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time` > ' . $pl2['time'] . ' AND `vars` = "win_bot_' . $ex2[0] . '" LIMIT ' . $ex2[1], 2);
-                    $u->deleteItemID($ex2[0], $u->info['id'], $ex2[1]);
-                    $i++;
-                }
-            }
-            // �������� ������
-            if (isset($d['tkill_itm'])) {
-                $ex = explode(',', $d['tkill_itm']);
-                $i = 0;
-                while ($i < count($ex)) {
-                    $ex2 = explode('=', $ex[$i]);
-                    $ex2 = explode('=', $ex[$i]);
-                    $x2 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time` > ' . $pl2['time'] . ' AND `vars` = "win_bot_' . $ex2[0] . '" LIMIT ' . $ex2[1], 2);
-                    $u->deleteItemID($ex2[0], $u->info['id'], $ex2[1]);
-                    $i++;
-                }
-            }
-
-            $t = '';
-            if (isset($d['add_rep'])) { // �������� ��������� �� �����, ���� ��� �������� �����.
-                if (isset($d['kill_bot']) && isset($d['all_kill']) && $d['add_rep'] > 0) {
-                    $ex = explode(',', $d['kill_bot']);
-                    $ii = 0;
-                    $d['add_rep'] = 0;
-                    while ($ii < count($ex)) {
-                        $i = 0;
-                        $ex2 = explode('=', $ex[$i]);
-                        while ($i < $d['all_kill']) {
-                            $x2 = 0;
-                            $d['add_rep'] = $d['add_rep'] + $ex2[1];
-                            $x2 = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time` > ' . $pl2['time'] . ' AND `vars` = "win_bot_' . $ex2[0] . '" LIMIT ' . $d['all_kill'], 2);
-                            $i++;
-                        }
-                        $ii++;
-                    }
-                }
-                unset($x, $i, $ii, $ex, $x2, $bot2, $ex2);
-                if ($pl['city'] != '') {
-                    $t .= '' . $d['add_rep'] . ' ��. ��������� ' . $u->city_name[$pl['city']] . ', ';
-                    $rep = mysql_fetch_array(mysql_query('SELECT * FROM `rep` WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'));
-                    // �������
-                    /*if($rep['rep'.$pl['city']] < 10000 && $rep['rep'.$pl['city']] + $d['add_rep'] >= 10000 && $pl['kin'] != 1) {
-                        $rep['rep'.$pl['city']] = 9999;
-                    } else*/
-                    if ($rep['rep' . $pl['city']] < 24999 && $rep['rep' . $pl['city']] + $d['add_rep'] >= 24999 && $pl['kin'] != 2) {
-                        $rep['rep' . $pl['city']] = 24999;
-                    } else {
-                        $rep['rep' . $pl['city']] += $d['add_rep'];
-                    }
-                    mysql_query('UPDATE `rep` SET `rep' . $pl['city'] . '` = "' . $rep['rep' . $pl['city']] . '" WHERE `id` = "' . $rep['id'] . '" LIMIT 1');
-                }
-            }
-
-            if (isset($d['add_repizlom'])) {
-                $t .= '' . $d['add_repizlom'] . ' ��. ��������� ������ �����, ';
-                $rep = mysql_fetch_array(mysql_query('SELECT * FROM `rep` WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'));
-                $rep['repizlom'] += $d['add_repizlom'];
-                if ($rep['repizlom'] > 24999) {
-                    $rep['repizlom'] = 24999;
-                }
-                mysql_query('UPDATE `rep` SET `repizlom` = "' . $rep['repizlom'] . '" WHERE `id` = "' . $rep['id'] . '" LIMIT 1');
-            }
-
-            if (isset($d['add_eff'])) {
-                $i = 0;
-                $j = explode('=', $d['add_eff']);
-                while ($i < count($j)) {
-                    if ($j[$i] > 0) {
-                        $magic->add_eff($u->info['id'], $j[$i], 1);
-                    }
-                    $i++;
-                }
-            }
-
-            if (isset($d['add_cr'])) {
-                $t .= '' . $d['add_cr'] . ' ��., ';
-                mysql_query('UPDATE `users` SET `money` = `money`+' . $d['add_cr'] . ' WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
-            }
-
-            if ($t != '') {
-                $t = rtrim($t, ', ');
-                $r = '������� <b>' . $pl['name'] . '</b> ���� ������� ���������! �� �������� �������: ' . $t . '.';
-                unset($t);
-            } else {
-                $r = '������� <b>' . $pl['name'] . '</b> ���� ������� ���������!';
-            }
-            $r = '<small>' . $r . '</small>';
-            //���������� ��������� � ���
-            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'] . "','" . $r . "','-1','5','0')");
-        }
-    }
-
-    private function expl($d)
-    {
-        $i = 0;
-        $dr = [];
-        $e = explode(':|:', $d);
-        while ($i < count($e)) {
-            $t = explode(':=:', $e[$i]);
-            if (isset($t[0])) {
-                $dr[$t[0]] = $t[1];
-            }
-            $i++;
-        }
-        return $dr;
-    }
-}
-
-$q = new quests;
\ 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 @@
-<?
-if(!defined('GAME'))
-{
-	die('/index.php');
-}
-
-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());
-
-if($_SERVER['HTTP_REFERER'] == 'https://new-combats.com/' && $_COOKIE['acomb1'] != '2') {
-	setcookie('acomb1','1',time()+60*60*24*3);
-}
-
-
-/*
-if(IP != '') {
-	die('����������� �������� ���������. ���� �������������� ����������.');
-}
-*/
-
-class register
-{
-	public function testLogin($v)
-	{
-		
-	}
-	
-	public 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;
-	}
-	public function testStep()
-	{
-		global $c,$reg,$error,$filter,$chat,$reg_d,$noup,$youip;
-		$stp = 1;
-		if(isset($_POST['step']) && isset($reg['id']))
-		{
-			$upd = '';
-			
-			$lr = mysql_fetch_array(mysql_query('SELECT `id`,`ipreg` 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['id']))
-			{
-				$error .= '������� � ������ IP ��� ��������������� ��������. � ������ IP ������ ��������� ����������� ���������� �� ����, ��� ��� � ���. ���������� �����.<br>'; $_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'] = '<i>���������</i>';
-							}
-							$error .= '�� ������� ������������ ����������� �� '.$uz['login'].'. ������ �� ������ ������������������. ��� ��������� ������ �� ��� �����������.<br>';
-							mysql_query("UPDATE `items_users` SET `data`='info=��� �����������: <b>".$cd['code']."</b><br>��� ����� ����������� ����������� �� ������� ���� ����� ���������.<br><div style=\"color:brown;\">���-�� �������������� �� ������ �����������. ����: ".date('d.n.Y H:i',time())."</div>' WHERE `secret_id` = '".$cd['code']."' LIMIT 1");
-							$cd['use'] = $reg['id'];
-							
-							if($cd['time_create']<time()-60*60)
-							{
-								$error .= '��������������� ��� ���������.<br>';
-								$reg_bonus = false;
-							}
-						}else{
-							$error .= '������ �������������. ���������� �����...';
-						}					
-					}else{
-						$error .= '��������������� ��� ��� ����������� �����, ���� �� ����������.<br>';
-					}
-				}	
-				
-				$cd = mysql_fetch_array(mysql_query('SELECT * FROM `register_code` WHERE `use` = "'.$reg['id'].'" AND `time_finish` = "0" LIMIT 1'));
-				if(!isset($cd['id']))
-				{
-					$reg_bonus = false;
-					$error .= '������� �� ������. (����������� � ��������� ������������)<br>';
-				}else{
-					$reg_bonus = true;
-					$cdi = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `secret_id` = "'.$cd['code'].'" AND `delete` = "0" AND `inShop` = "0" LIMIT 1'));
-					if(!isset($cdi['id']))
-					{
-						$reg_bonus = false;
-						$error .= '������� �� ������.';
-					}
-				}	
-				
-				
-				//$reg_bonus = true;
-				
-				//����������� ������� �����������
-				if($reg_bonus==false)
-				{
-					$error .= '<form action="register.php" method="post">����������� ������ �� �����������. ������� ��� �����������:<br><input name="register_code" type="text" style="width:200px;"> <input type="submit" value="������ ���"></form>'; $_POST['step'] = 1;
-				}
-				*/
-			}
-			
-			$reg_bonus = true;
-			
-			if($_POST['step']>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($i<count($nologin))
-				{
-					if(preg_match("/".$nologin[$i]."/i",$filter->mystr($reg_d[0])))
-					{
-						$error .= '��������, ����������, ������ ���.<br>'; $_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 ��������.<br>'; $_POST['step'] = 1;
-				}
-				if(strlen($reg_d[0])<4) 
-				{ 
-					$error .= '����� ������ ��������� �� ����� 4 ��������.<br>'; $_POST['step'] = 1;
-				}
-				//���� �������
-				$er = $this->en_ru($reg_d[0]);
-				if($er==true)
-				{
-					$error .= '� ������ ��������� ������������ ������ ����� ������ �������� �������� ��� �����������. ������ ���������.<br>'; $_POST['step'] = 1;
-				}
-				//����������� �������
-				if(strpos($sr,$reg_d[0]))
-				{
-					$error .= '����� �������� ����������� �������.<br>'; $_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].' ��� �����, �������� ������.<br>'; $_POST['step'] = 1;
-				}
-				//�����������
-				if(substr_count($reg_d[0],' ')+substr_count($reg_d[0],'-')+substr_count($reg_d[0],'_')>2)
-				{
-					$error .= '�� ����� ���� ������������ ������������ (������, ����, ������ �������������).<br>'; $_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 ��������.<br>'; $_POST['step'] = 2;
-				}
-				if($reg_d[1]!=$reg_d[2])
-				{
-					$error .= '� ������ ������ ����� ������ ������, ��� ��������. �� ������ ��� �� ��� ����� �������, ������ ������������.<br>'; $_POST['step'] = 2;
-				}
-				if(preg_match('/'.$reg_d[0].'/i',$reg_d[1]))
-				{
-					$error .= '������ �������� �������� ������.<br>'; $_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-��.<br>'; $_POST['step'] = 3;
-				}
-				
-				if(!preg_match('#^[a-z0-9.!\#$%&\'*+-/=?^_`{|}~]+@([0-9.]+|([^\s]+\.+[a-z]{2,6}))$#si', $reg_d[3]))
-				{
-					$error .= '�� ������� ���� ��������� E-mail.<br>'; $_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 .= '������� ���� �������� ���!<br>'; $_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 .= '������ � ��������� ��� ��������.<br>'; $_POST['step'] = 4;
-				}
-				
-				if($reg_d[15]!=0 && $reg_d[15]!=1)
-				{
-					$error .= '�� ������� �� ������ ���.<br>'; $_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 .= '�� ������� �� ������ ���� ��������� � ����.<br>'; $_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 .= '��������, ��� �������� ������ ������ �����, �� �� ������ ���������������� ���� ��������.<br>'; $_POST['step'] = 5;
-				}
-				
-				if(!isset($_POST['law2_'.$reg['id']]) || $_POST['law2_'.$reg['id']]!='on')
-				{
-					$error .= '��������, ��� �������� <u>���������� � �������������� ������� ���� '.$c['title'].'</u>, �� �� ������ ���������������� ��������.<br>'; $_POST['step'] = 5;
-				}
-				
-				if($_POST['code']!=$_SESSION['code'] || $_SESSION['code']<100 || $_POST['code']=='')
-				{
-					$error .= '������ �������� ����.<br>'; $_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 = '<font color=red>�� ����� ������������� ������ &quot;'.$refer['login'].'&quot;! � ��������� (������ -������-) �� ������� ��������������� ��������.</font>';
-							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] &quot;����� �����&quot;, �� ��������� � ���������, � ������� &quot;��������&quot;';
-						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] &quot;���������&quot;, �� ��������� � ���������, � ������� &quot;��������&quot;';
-						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] &quot;������ ��������&quot;, �� ��������� � ���������, � ������� &quot;��������&quot;. <b><font color=red>����������� ������ ������ �� �������� +300.000 ��. �����</font></b>';
-						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 .= '������ �����������. ���������� �����...<br>';
-					}
-				}			
-			}
-		}
-		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 2e582ec1..00000000
--- a/_incl_data/class/__seasons.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-use Insallah\Db;
-
-if (!defined('GAME')) {
-    die();
-}
-
-class season
-{
-
-    public static $yy = [
-        1 => [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 = [], $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
deleted file mode 100644
index d40c5202..00000000
--- a/_incl_data/class/__telegram.php
+++ /dev/null
@@ -1,197 +0,0 @@
-<?
-if(!defined('GAME'))
-{
-	die();
-}
-
-class telegram
-{
-	private static $flag_one;
-	
-	public static function start()
-	{
-		if (!isset(self::$flag_one))
-		{
-			$c = __CLASS__;
-			self::$flag_one = new $c($server);
-		}
-		return self::$flag_one;
-	}
-	
-	public function send($to,$from,$text,$time,$fromType)
-	{
-		mysql_query('START TRANSACTION');
-		$ins = mysql_query("INSERT INTO `telegram` (`uid`,`from`,`fromType`,`text`,`time`) VALUES ('".$to."','".$from."','".$fromType."','".mysql_real_escape_string(AddSlashes(HtmlSpecialChars($text,NULL,'cp1251')))."','".time()."')");
-		mysql_query('COMMIT');
-		if($ins)
-		{
-			return mysql_insert_id();
-		}
-	}
-		
-	public function readMsg($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']))
-		{
-			mysql_query('START TRANSACTION');
-			$upd = mysql_query('UPDATE `telegram` SET `read`="1" WHERE `id` = "'.$id.'" AND `uid`="'.$uid.'" LIMIT 1');
-			mysql_query('COMMIT');
-			if($upd && $msg['lock']==0)
-			{
-				echo '<script>readGood('.$id.',"https://img.new-combats.com/i/misc/read.gif"); nobtext('.$id.');</script>';
-			}
-		}
-	}
-	
-	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 '<script>readGood('.$id.',"https://img.new-combats.com/i/lock_message.gif"); nobtext('.$id.');</script>';
-				}else{
-					echo '<script>readGood('.$id.',"https://img.new-combats.com/i/misc/read.gif");</script>';
-				}
-			}
-		}
-	}
-	
-	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 '<script> getPage('.$pg.');</script>';
-		}
-	}
-	
-	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 '<script> getPage('.$pg.');</script>';
-			}
-		}
-	}
-		
-	private function addMsgTable($id,$from,$fromType,$ttl,$time,$lock,$read,$pg)
-	{
-		$i1 = '<img id="msgImg'.$id.'" src="https://img.new-combats.com/i/misc/unread.gif">';
-		if($read==1)
-		{
-			$i1 = '<img id="msgImg'.$id.'" src="https://img.new-combats.com/i/misc/read.gif">';
-		}
-		
-		if($lock==1)
-		{
-			$i1 = '<img id="msgImg'.$id.'" src="https://img.new-combats.com/i/lock_message.gif">';
-		}
-		
-		if($fromType==1)
-		{
-			$from = '<a href="info/login='.$from.'" target="_blank" title="���. � '.$from.'">'.$from.'</a>';
-		}elseif($read==0)
-		{
-			$from = '<b id="tablePostTxtB'.$id.'">'.$from.'</b>';
-		}
-						
-		echo '<table id="tablePost'.$id.'" width="100%" border="0" cellspacing="0" cellpadding="0">
-			  <tr>
-				<td width="30" class="underLine2"><div align="center">'.$i1.'</div></td>
-				<td width="200" id="tablePostTxt'.$id.'" class="underLine2">'.$from.'</td>
-				<td width="290" class="underLine2"><a onClick="openPost('.$id.'); return false;" href="#read'.$id.'" title="��������� ���������">'.substr($ttl,0,30).'...</a></td>
-				<td width="120" class="underLine2">'.date('d.m.y H:i',$time).'</td>
-				<td width="30" class="underLine2"><div align="center"><IMG style="cursor:pointer;" onClick="lockPost('.$id.');" title="���������� ���������" src="https://img.new-combats.com/i/locked.gif"></div></td>
-				<td width="30" class="underLine2"><div align="center"><IMG style="cursor:pointer;" onClick="deletePost('.$id.','.$pg.');" title="������� ���������" src="https://img.new-combats.com/i/clear.gif" width="11" height="11"></div></td>
-			  </tr>
-			  </table>
-			  <div id="readMSG'.$id.'" style="display:none;" class="unreadMSG">'.$ttl.'</div>';
-	}
-	
-	public function seeMsg($uid,$page,$maxPages)
-	{
-		$page = ceil($page);
-		echo '<div id="jx" style="display:none;"></div>
-			  <table width="100%" border="0" cellspacing="0" cellpadding="0">
-			  <tr>
-				<td width="30" class="underLine"><div align="center"></div></td>
-				<td width="200" class="underLine"><b>�� ����</b></td>
-				<td width="290" class="underLine"><b>��������� ���������</b></td>
-				<td width="120" class="underLine"><b>�����</b></td>
-				<td width="30" class="underLine"><div align="center"><IMG alt="���������� ���������" src="https://img.new-combats.com/i/lock_message.gif"></div></td>
-				<td width="30" class="underLine"><div align="center"><IMG style="cursor:pointer;" onClick="deletePostAll('.$page.');" alt="������� ��� ����������� ���������" src="https://img.new-combats.com/i/clear.gif" width="11" height="11"></div></td>
-			  </tr> 
-			  </table>';
-		
-		$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 '<div class="noMsg" align="center">��������� ���</div>';
-		}elseif($i[0]>$maxPages){				
-			$pages = '';
-			$i = 1;
-			while($i<=$pg)
-			{
-				$cls = '';
-				if($page==$i)
-				{
-					$cls = 'style="color:#6f0000; font-size:14px;"';
-				}
-				$pages .= '&nbsp;<a '.$cls.' onClick="getPage('.$i.'); return false;" href="#page'.$i.'">'.$i.'</a>';
-				$i++;
-			}
-			echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">
-				  <tr>
-					<td width="30"><div align="center"></div></td>
-					<td width="200">��������: '.$pages.'</td>
-					<td width="240"></td>
-					<td width="170"></td>
-					<td width="30"></td>
-					<td width="30"></td>
-				  </tr>
-				  </table>';
-		}
-	}
-	
-	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 @@
-<?
-if(!defined('GAME'))
-{
-	die();
-}
-
-class turnir {
-	
-	public $info,$user,$name = array(
-						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 .= '<b>'.$inf['login'].'</b>, ';
-					
-					$r = '������ ��������. �� ��������� ����������� �������, �������� �����: <b>'.$inf['add_expn'].'</b>.';
-					
-					/*if( $this->info['users_in'] >= 10 ) {
-						$r .= ' � ������� ��������� 10 ��� ����� �������: <b>��� �� 1 ���.</b> �������� � ��� � ���������.';
-						$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 .= '<b>'.$inf['login'].'</b>, ';
-					
-				}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 = '<font color=black><b>������ ��������.</b></font> '.$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']} .= '<b>'.$bot['login'].'</b> ['.$bot['level'].']<br>';
-				${'tm'.$bot['team']} .= $u->microLogin($bot,2).'<br>';
-			}
-		}
-		$r .= '<style>/* ����� ������ */
-.CSSteam0	{ font-weight: bold; cursor:pointer; }
-.CSSteam1	{ font-weight: bold; color: #6666CC; cursor:pointer; }
-.CSSteam2	{ font-weight: bold; color: #B06A00; cursor:pointer; }
-.CSSteam3 	{ font-weight: bold; color: #269088; cursor:pointer; }
-.CSSteam4 	{ font-weight: bold; color: #A0AF20; cursor:pointer; }
-.CSSteam5 	{ font-weight: bold; color: #0F79D3; cursor:pointer; }
-.CSSteam6 	{ font-weight: bold; color: #D85E23; cursor:pointer; }
-.CSSteam7 	{ font-weight: bold; color: #5C832F; cursor:pointer; }
-.CSSteam8 	{ font-weight: bold; color: #842B61; cursor:pointer; }
-.CSSteam9 	{ font-weight: bold; color: navy; cursor:pointer; }
-.CSSvs 		{ font-weight: bold; }</style>';
-		$r 	.= '<h3>&laquo;'.$this->name[$this->info['type']].'&raquo;</h3><br>������ ������� ����� '.$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 .= '<INPUT class=\'btn_grey\' onClick="selectItmSave()" TYPE=button name=tmp value="�������� ��������������">';
-			}else{
-				$r .= ' <INPUT class=\'btn_grey\' onClick="location=\'main.php\';" TYPE=button name=tmp value="� �����';
-				if($u->info['sex'] == 1) {
-					$r .= '�';
-				}
-				$r .= '!">';
-			}
-		}else{
-			$r .= '<small><b>�� ���������� � �������!</b></small>';
-			$r .= ' &nbsp; <INPUT class=\'btn_grey\' onClick="location.href=\'main.php?hpregenNowTurnir=1\'" TYPE=button name=tmp value="������������ HP � MP">';
-		}
-		
-		$r	.= '<div style="float:right"><INPUT onClick="location=\'main.php\';" TYPE=button name=tmp value="��������"></div>';
-		if($this->user['points'] < 3) {
-			if($this->user['items'] != '0') {
-				$r .= '<div align="left" style="height:1px; width:100%; margin:10px 0 10px 0; border-top:1px solid #999999;"></div>';
-				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 .= '<b>�������� �������� ��� �������:</b><br>';
-				?>
-				<style>
-				.its0 {
-					margin:2px;
-					cursor:pointer;
-					filter:DXImageTransform.Microsoft.BasicImage(grayscale=1);
-					-ms-filter:DXImageTransform.Microsoft.BasicImage(grayscale=1);
-					-webkit-filter: grayscale(100%);
-				}
-				.its1 {
-					background-color:#ee9898;
-					margin:1px;
-					border:1px solid #b16060;
-				}
-				</style>
-				<script>
-				var set = [
-									
-				];
-				set[3] = [0,0,0];
-				set[10] = [0,0,0,0];
-				function selectItmAdd(x,y,id,s) {
-					if(s != 10 && s != 3) {
-						if(set[s] != undefined && set[s] != 0) {
-							$('#it_'+set[s][1]+'_'+set[s][2]).attr('class','its0');
-							set[s] = 0;
-						}
-						set[s] = [id,x,y];				
-						$('#it_'+x+'_'+y).attr('class','its1');
-					}else if(s == 10) {
-						if(set[s][0] > 2) {
-							$('#it_'+set[s][1][1]+'_'+set[s][1][2]).attr('class','its0');
-							$('#it_'+set[s][2][1]+'_'+set[s][2][2]).attr('class','its0');
-							$('#it_'+set[s][3][1]+'_'+set[s][3][2]).attr('class','its0');
-							set[s] = [0,0,0,0];
-						}
-						
-						if(set[s][1] == 0) {
-							set[s][1] = [id,x,y];	
-						}else if(set[s][2] == 0) {
-							set[s][2] = [id,x,y];	
-						}else if(set[s][3] == 0) {
-							set[s][3] = [id,x,y];	
-						}
-						set[s][0]++;
-						$('#it_'+x+'_'+y).attr('class','its1');
-					}else if(s == 3) {
-						if(set[s][0] > 1) {
-							$('#it_'+set[s][1][1]+'_'+set[s][1][2]).attr('class','its0');
-							$('#it_'+set[s][2][1]+'_'+set[s][2][2]).attr('class','its0');
-							set[s] = [0,0,0];
-						}
-						
-						if(set[s][1] == 0) {
-							set[s][1] = [id,x,y];	
-						}else if(set[s][2] == 0) {
-							set[s][2] = [id,x,y];	
-						}
-						set[s][0]++;
-						$('#it_'+x+'_'+y).attr('class','its1');
-					}
-				}
-				function selectItmSave() {
-					var i = 0;
-					var r = '';
-					while(i <= 17) {
-						if(set[i] != undefined) {
-							if(i == 10) {
-								if(set[i][1][0] != undefined) {
-									r += set[i][1][0]+'-';
-								}
-								if(set[i][2][0] != undefined) {
-									r += set[i][2][0]+'-';
-								}
-								if(set[i][3][0] != undefined) {
-									r += set[i][3][0]+'-';
-								}
-							}else if(i == 3) {
-								if(set[i][1][0] != undefined) {
-									r += set[i][1][0]+'-';
-								}
-								if(set[i][2][0] != undefined) {
-									r += set[i][2][0]+'-';
-								}
-							}else{
-								if(set[i][0] != undefined) {
-									r += set[i][0]+'-';
-								}
-							}
-						}
-						i++;
-					}
-					location = "main.php?gocomplect="+r;
-				}
-				</script>
-				<?
-				$i = 0;
-				while($i <= 17) {
-					if(count($ia[$i]) > 0) {
-						$j = 0;
-						while($j < count($ia[$i])) {
-							$r .= '<img id="it_'.$i.'_'.$j.'" onclick="selectItmAdd('.$i.','.$j.','.$ia[$i][$j]['id'].','.$ia[$i][$j]['inSlot'].');" class="its0" title="'.$ia[$i][$j]['name'].'" src="https://img.new-combats.com/i/items/'.$ia[$i][$j]['img'].'">';
-							$j++;
-						}
-						$r .= '<br>';
-					}
-					$i++;
-				}
-				
-			}
-			
-		}
-		$r .= '<div align="left" style="height:1px; width:100%; margin:10px 0 10px 0; border-top:1px solid #999999;"></div>';
-		//$r .= '<b class="CSSteam1">������� �1</b>: '.rtrim($tm1,', ');		
-		//$r .= '<br><b class="CSSteam2">������� �2</b>: '.rtrim($tm2,', ');
-		
-		$r .= '<table style="border:1px solid #99cccc" width="700" bgcolor="#bbdddd" border="0" align="center" cellpadding="5" cellspacing="0">
-  <tr>
-    <td width="350" align="center" bgcolor="#99cccc"><b class="CSSteam1">������� 1</b></td>
-    <td align="center" bgcolor="#99cccc"><b class="CSSteam2">������� 2</b></td>
-  </tr>
-  <tr>
-    <td align="center" style="border-right:1px solid #99cccc">'.rtrim($tm1,', ').'</td>
-    <td align="center">'.rtrim($tm2,', ').'</td>
-  </tr>
-  </table>';
-		
-		
-		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/__user.php b/_incl_data/class/__user.php
deleted file mode 100644
index a990e51c..00000000
--- a/_incl_data/class/__user.php
+++ /dev/null
@@ -1,10772 +0,0 @@
-<?php
-
-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
-{
-    private static $flag_one;
-    public $pokol = 2; //����������� ��������� ���������
-    public $ekrcast = [
-        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 => '�����������'
-    ], $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' => '������ ��������']
-    ];
-    public $btl_txt = '', $rgd = [0 => 0, 1 => 0], $error = '',
-
-        $city_unid = [0, 'capitalcity', 'angelscity', 'abandonedplain', 'newcapitalcity', 'demonscity', 'fallenearth', 'emeraldscity', 'dreamscity', 'suncity', 'devilscity'],
-        $city_id = ['capitalcity' => 1, 'angelscity' => 2, 'abandonedplain' => 3, 'newcapitalcity' => 4, 'demonscity' => 5, 'fallenearth' => 6, 'emeraldscity' => 6, 'suncity' => 7, 'dreamscity' => 8, 'devilscity' => 10],
-        $city_name = ['emeraldscity' => 'Emeralds city', 'abandonedplain' => 'Abandoned Plain', 'capitalcity' => 'Capital city', 'angelscity' => 'Angels city', 'newcapitalcity' => 'New Capital city', 'demonscity' => 'Demons city', 'fallenearth' => 'Fallen Earth', 'dreamscity' => 'Dreams City', 'suncity' => 'Sun City', 'devilscity' => 'Devils City'],
-        $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' => '<font color=darkgreen><strong>������� ����� (HP)</font></strong>',
-        'mpAll' => '<font color=blue><strong>������� ���� (�P)</font></strong>',
-        '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'],
-        'add' => [
-            'no_vor', 'antm3', 'acestar', 'spasenie', 'exp', 'enemy_am1', 'hod_minmana', 'yhod', 'noshock_voda', 'bronze', 'silvers', 'gold', 'repair_discount',
-            'yza', 'yzm', 'yzma', 'yza1', 'yza2', 'yza3', 'yza4', 'yzm1', 'yzm2', 'yzm3', 'yzm4', 'yzm5', 'yzm6', 'yzm7', 'repair_z', 'repair_r',
-            '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', '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', 'hpVinos', 'mpVinos', 'mpAll', 'enAll', 'hpProc', 'mpProc', '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', 'm11a', 'zona', 'zonb', 'maxves', 'minAtack', 'maxAtack', 'bonusexp', 'speeden'],
-        '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']
-    ];
-
-    public function sys_add($uid, $time, $type, $text, $data, $time_see)
-    {
-    }
-
-    public function repexp_add($id, $val)
-    {
-        mysql_query('UPDATE `stats` SET `repexp` = `repexp` + "' . $val . '" WHERE `id` = "' . $id . '" LIMIT 1');
-    }
-
-    public function dayquest($id)
-    {
-
-        $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' => '������������� � ����� ������'
-        ];
-
-        if (!isset($test['id'])) {
-            $n = "<a href='main.php?getq=1'><b style='color:green'>�������� �������</b></a>";
-        } else {
-            $n = "<a href='main.php?putq=1'><b style='color:green'>����� �������</b></a>";
-            $n = $n . "<br><b style='color:green'>" . $q[$test['vals']] . "</b>";
-        }
-
-        return $n;
-    }
-
-    public function pensia($type)
-    {
-        if ($type == false) {
-            if (($this->info['align'] > 0 || $this->info['clan'] > 0 || $this->info['level'] > 12) && $this->info['align'] != 2) {
-                $r = ($this->info['level'] - 6) * 0.04;
-                if (date('m') >= 6 || date('m') <= 8) {
-                    $r = round($r * 2, 2);
-                } elseif (date('w') == 0 || date('w') == 6) {
-                    $r = round($r * 2, 2);
-                }
-                $r = $r . ' ���.';
-            } else {
-                $r = $this->info['level'];
-                if (date('m') >= 6 || date('m') <= 8) {
-                    $r = round($r * 2, 2);
-                } elseif (date('w') == 0 || date('w') == 6) {
-                    $r = round($r * 2, 2);
-                }
-                $r = $r . ' ��.';
-            }
-        } else {
-            if (($this->info['align'] > 0 || $this->info['clan'] > 0 || $this->info['level'] > 12) && $this->info['align'] != 2) {
-                $r = ($this->info['level'] - 6) * 0.04;
-                if (date('m') >= 6 || date('m') <= 8) {
-                    $r = round($r * 2, 2);
-                } elseif (date('w') == 0 || date('w') == 6) {
-                    $r = round($r * 2, 2);
-                }
-                $r = [2, $r];
-            } else {
-                $r = $this->info['level'];
-                if (date('m') >= 6 || date('m') <= 8) {
-                    $r = round($r * 2, 2);
-                } elseif (date('w') == 0 || date('w') == 6) {
-                    $r = round($r * 2, 2);
-                }
-                $r = [1, $r];
-            }
-        }
-        return $r;
-    }
-
-    public function testAlign($an, $uid)
-    {
-        $r = 1;
-        if (floor($an) > 0) {
-            $a = mysql_fetch_array(mysql_query('SELECT * FROM `users_align` WHERE `uid` = "' . $uid . '" AND (`delete` = "0" OR `delete` > "' . time() . '") LIMIT 1'));
-            if (isset($a['id']) && floor($a['align']) > 0 && floor($a['align']) != $an) {
-                $r = 0;
-            }
-        }
-        return $r;
-    }
-
-    public function abilsRoom($type)
-    {
-        $r = '';
-        //
-        if ($this->info['clan'] > 0) {
-            //������ ������������ ���������� � �����
-        } elseif ($type == 'test') {
-            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());
-                    } else {
-                        if ($this->stats['hpNow'] < 1) {
-                            $this->stats['hpNow'] = 0;
-                        }
-                        $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"
-						)');
-                        $this->stats['hpNow'] = $this->stats['hpAll'];
-                        mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->stats['hpNow'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-                    }
-                } 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());
-                    } else {
-                        if ($this->stats['mpNow'] < 1) {
-                            $this->stats['mpNow'] = 0;
-                        }
-                        $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"
-						)');
-                        $this->stats['hpNow'] = $this->stats['hpAll'];
-                        mysql_query('UPDATE `stats` SET `mpNow` = "' . $this->stats['mpNow'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-                    }
-                }
-            }
-        } elseif ($type == 'look') {
-            //
-            if ($this->room['name'] == '��� �����' || $this->room['name'] == '��� ����' || $this->room['name'] == '��� ���������') {
-                $vid = 0;
-                //
-                if ($this->room['name'] == '��� �����') {
-                    $vid = 6;
-                } elseif ($this->room['name'] == '��� ����') {
-                    $vid = 7;
-                } 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 .= '<img style="cursor:pointer;filter:alpha(opacity=47);opacity:0.47;-moz-opacity:0.47;-khtml-opacity:0.47;" onClick="alert(\'�������� ��������������� ����� ' . $this->timeOut($v['time'] + 60 * 60 - time()) . '\');" src="https://img.new-combats.com/i/items/healvortex_' . $vid . '.png" width="40" height="25" title="������ HP (��������)"> ';
-                } else {
-                    $r .= '<a href="main.php?vhp"><img src="https://img.new-combats.com/i/items/healvortex_' . $vid . '.png" width="40" height="25" title="������ HP"></a> ';
-                }
-                $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 .= '<img style="cursor:pointer;filter:alpha(opacity=47);opacity:0.47;-moz-opacity:0.47;-khtml-opacity:0.47;" onClick="alert(\'�������� ��������������� ����� ' . $this->timeOut($v['time'] + 60 * 60 - time()) . '\');" src="https://img.new-combats.com/i/items/manavortex_' . $vid . '.png" width="40" height="25" title="������ MP (��������)"> ';
-                } else {
-                    $r .= '<a href="main.php?vmp""><img src="https://img.new-combats.com/i/items/manavortex_' . $vid . '.png" width="40" height="25" title="������ MP"></a> ';
-                }
-            }
-            //
-        }
-        return $r;
-    }
-
-    public function insertAlign($an, $uid)
-    {
-        if ($an > 0) {
-            mysql_query('UPDATE `users_align` SET `delete` = "' . (time() + 1) . '" WHERE `uid` = "' . mysql_real_escape_string($uid) . '" AND `align` = "' . mysql_real_escape_string(floor($an)) . '"');
-            mysql_query('INSERT INTO `users_align` (`uid`,`time`,`delete`,`align`) VALUES (
-				"' . mysql_real_escape_string($uid) . '","' . time() . '","0","' . mysql_real_escape_string(floor($an)) . '"
-			) ');
-        }
-    }
-
-    public function deleteAlign($an, $uid)
-    {
-        if ($an > 0) {
-            mysql_query('UPDATE `users_align` SET `delete` = "' . (time() + 86400 * 60) . '" WHERE `uid` = "' . mysql_real_escape_string($uid) . '" AND `align` = "' . mysql_real_escape_string(floor($an)) . '"');
-        }
-    }
-
-    public function shopSaleM($val, $itm)
-    {
-        global $c;
-        /*$proc = array(
-			0,0,0,0,0,0,0,0,
-			5,30,30,30,30,30,30,30,30,30,30,30,30,30
-		);
-		$po = $this->lookStats($itm['data']);
-		$proc = $proc[$po['tr_lvl']];*/
-        $proc = 0;
-        //
-        $proc = [
-            0,    //0
-            0,    //1
-            0,    //2
-            0,    //3
-            0,    //4
-            0,    //5
-            0,    //6
-            0,    //7
-            5, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30
-        ];
-        $po = $this->lookStats($itm['data']);
-        $proc = $proc[$po['tr_lvl']];
-        //
-        if ($itm['type'] >= 28) {
-            $proc = 50;
-        }
-        if ($itm['type'] == 46) {
-            $proc = 0;
-        }
-        if ($c['shop_all'] > 0) {
-            $proc = 100 - $c['shop_all'];
-        } elseif ($c['shop_all_type1'] > 0 && !isset($this->info['inBerezka'])) {
-            $proc = 100 - $c['shop_all_type1'];
-        } elseif ($c['shop_all_type2'] > 0 && isset($this->info['inBerezka'])) {
-            $proc = 100 - $c['shop_all_type2'];
-        }
-        $val = round(($val / 100 * (100 - $proc)), 2);
-        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);
-        $delitm = [];
-        while ($pl = mysql_fetch_array($sp)) {
-            if (count($delitm) < $coldel) {
-                $delitm[] = $pl['id'];
-            }
-        }
-        $i = 0;
-        while ($i < count($delitm)) {
-            mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $delitm[$i] . '" LIMIT 1');
-            $i++;
-        }
-    }
-
-    public function count_items($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);
-        $delitm = [];
-        while ($pl = mysql_fetch_array($sp)) {
-            if (count($delitm) < $coldel) {
-                $delitm[] = $pl['id'];
-            }
-        }
-        $i = 0;
-        while ($i < count($delitm)) {
-            $i++;
-        }
-        return $i;
-    }
-
-    public function repobmen($id, $type)
-    {
-        //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 = '�� ������� �������� ������� �� ���������.';
-        } else {
-            $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;
-    }
-
-    public function add_buf($id, $tp, $uid = null, $mod = null)
-    {
-    }
-
-    public function del_buf($id, $uid = null, $mod = null)
-    {
-    }
-
-    public function see_buf($id, $uid = null, $mod = null)
-    {
-    }
-
-    public function sys_see($type)
-    {
-    }
-
-    public static function start()
-    {
-        if (!isset(self::$flag_one)) {
-            $c = __CLASS__;
-            self::$flag_one = new $c();
-        }
-        return self::$flag_one;
-    }
-
-    public function lookKeys($m, $i)
-    {
-        $e = explode('|', $m);
-        $r = [];
-        while ($i < count($e)) {
-            $j = explode('=', $e[$i]);
-            $r[$i] = $j[0];
-            $i++;
-        }
-        return $r;
-    }
-
-    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)) {
-                                $ins .= '("' . $di['dn_id'] . '","' . $pli['item_id'] . '","' . time() . '","' . $di['x'] . '","' . $di['y'] . '"),';
-                            }
-
-                            $ins = rtrim($ins, ',');
-                            mysql_query('INSERT INTO `dungeon_items` (`dn`,`item_id`,`time`,`x`,`y`) VALUES ' . $ins . '');
-                            mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $pls1['inBot'] . '" LIMIT 1');
-                            mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $pls1['inBot'] . '" LIMIT 1');
-                            mysql_query('UPDATE `bs_zv` SET `finish` = "' . time() . '" WHERE `id` = "' . $pls1['id'] . '" LIMIT 1');
-                            mysql_query('UPDATE `users` SET `inUser` = 0 WHERE `id` = "' . $pls1['uid'] . '" LIMIT 1');
-                        }
-                    }
-                    $id['users_finish']++;
-                }
-                $i++;
-            }
-        }
-        if ($id['users'] - $id['users_finish'] < 2) {
-            $win = [];
-            $sp = 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'] . '" ORDER BY `money` DESC LIMIT 100');
-            while ($pl = mysql_fetch_array($sp)) {
-                $ur = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`room`,`name`,`sex`,`inUser`,`twink`,`lose`,`nich`,`win` FROM `users` WHERE `id` = "' . $pl['uid'] . '" LIMIT 1'));
-                $ub = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`room`,`name`,`sex`,`inUser`,`twink`,`lose`,`nich`,`win` FROM `users` WHERE `id` = "' . $ur['inUser'] . '" LIMIT 1'));
-                if (isset($ur['id']) && isset($ub['id']) && $ub['lose'] <= 0 && $ub['nich'] <= 0) {
-                    $win = $ub;
-                    $winr = $ur;
-                }
-            }
-
-            /* ��������� �� */
-            if (isset($win['id']) && $win['lose'] == 0 && $win['nich'] == 0 && $win['id'] > 0) {
-                //���� ����������
-                $bsep = 0;
-                if ($winr['level'] < 6) {
-                    $bsep = 2500;
-                } elseif ($winr['level'] < 7) {
-                    $bsep = 5000;
-                } elseif ($winr['level'] < 8) {
-                    $bsep = 15000;
-                } elseif ($winr['level'] < 9) {
-                    $bsep = 25000;
-                } 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'] . "','�����������! �� �������� � ������� &quot;����� ������&quot;! �������� �����: " . $bsep . ", ������: " . $mn . " ��.','-1','6','0')");
-                mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','0','','','<font color=red>��������!</font> ���������� ������ &quot;����� ������&quot;, ���������� �������: <strong>" . $winr['login'] . "</strong>! �����������!','-1','5','0')");
-                $this->addDelo(1, $uid, '&quot;<font color=#C65F00>WinTournament.' . $this->info['city'] . '</font>&quot; (����� ������): �������� &quot;<strong>' . $mn . '</strong> ��.&quot;', 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','','','<font color=red>��������!</font> ���������� ������ &quot;����� ������&quot;, ���������� �������: �����������.','-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');
-            while ($pl = mysql_fetch_array($sp)) {
-                $ur = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`room`,`name`,`sex`,`inUser`,`lose`,`nich`,`win` FROM `users` WHERE `id` = "' . $pl['uid'] . '" LIMIT 1'));
-                $ub = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`room`,`name`,`sex`,`inUser`,`lose`,`nich`,`win` FROM `users` WHERE `id` = "' . $ur['inUser'] . '" LIMIT 1'));
-                if (isset($ub['id'])) {
-                    //del
-                    mysql_query('DELETE FROM `users` WHERE `id` = "' . $ub['id'] . '" LIMIT 1');
-                    mysql_query('DELETE FROM `stats` WHERE `id` = "' . $ub['id'] . '" LIMIT 1');
-                    mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $ub['id'] . '" LIMIT 500');
-                    mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $ub['id'] . '" LIMIT 500');
-                    //upd
-                    mysql_query('UPDATE `bs_zv` SET `finish` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
-                    mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `id` = "' . $pl['uid'] . '" LIMIT 1');
-                }
-            }
-        }
-    }
-
-    //��� ��������� � �����
-    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;
-            $r['items'] = mysql_fetch_array(mysql_query('SELECT COUNT(`im`.`id`) 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" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0"'));
-            $r['items'] = $r['items'][0];
-        }
-        return $r;
-    }
-
-    //���������� ����� \ ���
-    public function plavka($id, $type)
-    {
-        $e = '';
-        $rn = 1;
-        $pl = 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;'));
-        $d = mysql_fetch_array(mysql_query('SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $pl['item_id'] . '" LIMIT 1'));
-        $po = $this->lookStats($d['data']);
-        if ($pl['level'] == 0) {
-            $pl['level'] = 0 + $po['tr_lvl'];
-        }
-
-
-        if ($po['tr_lvl'] < 4 && $pl['item_id'] != 1035) {
-            $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 = '���� ���, � �� ����! ���� ������� �������? �� �������� ��! ������� ��� ����� ���-�� �������!';
-        } elseif ($po['tr_lvl'] >= 7 && $this->rep['rep1'] < 0)//100
-        {
-            $e = '��� ����������� ��������� 7-�� � ������ ������ ��������� ���� ����� ������ ������� �����';
-        } elseif ($po['tr_lvl'] >= 9 && $this->rep['rep1'] < 1000) {
-            $e = '��� ����������� ��������� 9-�� � ������ ������ ��������� ���� ����� ������ ������� �����';
-        } elseif ($po['tr_lvl'] >= 10 && $this->rep['rep1'] < 10000) {
-            $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'] . ' ��.';
-                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'] . '...';
-            }
-        } else {
-            $e = '�� ������� �����������, ������� ��� ���� �������� ...';
-        }
-        return $e;
-    }
-
-    //������� ���� ������� ����� ���������������
-    public function info_remont()
-    {
-        $r = '';
-        $sp = 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` = "' . ((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 .= '<strong>' . $pl['name'] . '</strong> [<font color="brown">' . floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']) . '</font>] ��������� ������<br>';
-            }
-        }
-        $r = '<div align="left"><small>' . $r . '</small></div>';
-        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;
-            }
-            if (!isset($st['maxAtack'])) {
-                $st['maxAtack'] = 0;
-            }
-            if (!isset($st['yron_min'])) {
-                $st['yron_min'] = 0;
-            }
-            if (!isset($st['yron_max'])) {
-                $st['yron_max'] = 0;
-            }
-            if (!isset($itm['yron_min'])) {
-                $itm['yron_min'] = 0;
-            }
-            if (!isset($itm['yron_max'])) {
-                $itm['yron_max'] = 0;
-            }
-            if (!isset($itm['sv_yron_min'])) {
-                $itm['sv_yron_min'] = 0;
-            }
-            if (!isset($itm['sv_yron_max'])) {
-                $itm['sv_yron_max'] = 0;
-            }
-
-            $min = $itm['sv_yron_min'] + $st['minAtack'] + $itm['yron_min'] + $st['yron_min'];
-            $max = $itm['sv_yron_max'] + $st['maxAtack'] + $itm['yron_max'] + $st['yron_max'];
-
-            //if($x!=0)
-            //{
-            //��� �����: 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);
-            } else {
-                //��� ����������� �����
-                $sss = ceil($st['s1'] * 0.1);
-            }
-
-
-            //������� ����
-            //$p['B'][0] = 5;
-            //$p['B'][1] = 9;
-
-            $p['B'][0] = ceil($st['s1'] * 1);
-            $p['B'][1] = ceil(0.4 + $p['B'][0] / 0.9);
-
-            $p['B'][0] = 2 + $st['level'] + $st['s1'] - round($st['s1'] / 5);
-            $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];
-            } 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);
-            //
-            $kmin = ceil((2 * (1 + $st['m3'] / 100)) * $min);
-            $kmax = ceil((2 * (1 + $st['m3'] / 100)) * $max);
-
-            $tp = [0 => ceil($min), 1 => ceil($max), 2 => ceil($kmin), 3 => ceil($kmax)];
-        }
-        return $tp;
-    }
-
-    //������ ������
-    public function zago($v)
-    {
-        if ($v > 1700) {
-            $v = 1700;
-        }
-        return round((1 - (pow(0.5, ($v / 399.51)))) * 100, 2);
-    }
-
-    //������ ������ (�����)
-    public function zmgo($v)
-    {
-        if ($v > 1000) {
-            $v = 1000;
-        }
-        $r = (1 - (pow(0.5, ($v / 250)))) * 100;
-        return $r;
-    }
-
-    public function inform($v)
-
-    {
-        //$this->stats['items'][13] , $this->stats['items'][14]
-        $r = '';
-        if ($v == 'yrontest' || $v == 'yrontest-krit') {
-            $y = [];
-            /* ������ ������ ��� ����� */
-            $w1 = 0;
-            $w2 = 0;
-            $i = 0;
-            while ($i < count($this->stats['items'])) {
-                if ($this->stats['items'][$i]['inOdet'] == 3 && $w1 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) {
-                    $w1 = $this->stats['items'][$i];
-                } elseif ($this->stats['items'][$i]['inOdet'] == 14 && $w2 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) {
-                    $w2 = $this->stats['items'][$i];
-                }
-                $i++;
-            }
-            if (isset($w1['id']) && $w1['inOdet'] != 14) {
-                $tp = 0;
-                $t = 0;
-                $i = 1;
-                $d = $this->lookStats($w1['data']);
-                while ($i <= 4) {
-                    if (isset($d['tya' . $i]) && $t < $d['tya' . $i]) {
-                        $t = $d['tya' . $i];
-                        $tp = $i;
-                    }
-                    $i++;
-                }
-                $y = $this->weaponAtc($w1, $this->stats, $tp);
-                if ($v == 'yrontest-krit') {
-                    $y[0] = $y[2];
-                    $y[1] = $y[3];
-                }
-                if ($y[0] < 1) {
-                    $y[0] = 1;
-                }
-                if ($y[1] < 1) {
-                    $y[1] = 1;
-                }
-                $r .= '<span title="' . $w1['name'] . '">' . $y[0] . '-' . $y[1] . '</span>';
-            } 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) {
-                    $y[0] = 1;
-                }
-                if ($y[1] < 1) {
-                    $y[1] = 1;
-                }
-                $r .= $y[0] . '-' . $y[1];
-            }
-            /* ������ ������ */
-            if (isset($w2['id'])) {
-                $tp = 0;
-                $t = 0;
-                $i = 1;
-                $d = $this->lookStats($w2['data']);
-                while ($i <= 4) {
-                    if ($t < $d['tya' . $i]) {
-                        $t = $d['tya' . $i];
-                        $tp = $i;
-                    }
-                    $i++;
-                }
-                $y = $this->weaponAtc($w2, $this->stats, $tp);
-                if ($v == 'yrontest-krit') {
-                    $y[0] = $y[2];
-                    $y[1] = $y[3];
-                }
-                if ($y[0] < 1) {
-                    $y[0] = 1;
-                }
-                if ($y[1] < 1) {
-                    $y[1] = 1;
-                }
-                $r .= ' / <span title="' . $w2['name'] . '">' . $y[0] . '-' . $y[1] . '</span>';
-            }
-            /* --- */
-        } elseif ($v == 'yron') {
-            $y = [];
-            /* ������ ������ ��� ����� */
-            $w1 = 0;
-            $w2 = 0;
-            $i = 0;
-            while ($i < count($this->stats['items'])) {
-                if ($this->stats['items'][$i]['inOdet'] == 3 && $w1 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) {
-                    $w1 = $this->stats['items'][$i];
-                } elseif ($this->stats['items'][$i]['inOdet'] == 14 && $w2 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) {
-                    $w2 = $this->stats['items'][$i];
-                }
-                $i++;
-            }
-            if (isset($w1['id']) && $w1['inOdet'] != 14) {
-                $tp = 0;
-                $t = 0;
-                $i = 1;
-                $d = $this->lookStats($w1['data']);
-                while ($i <= 4) {
-                    if (isset($d['tya' . $i]) && $t < $d['tya' . $i]) {
-                        $t = $d['tya' . $i];
-                        $tp = $i;
-                    }
-                    $i++;
-                }
-                $y = $this->weaponAtc($w1, $this->stats, $tp);
-                if ($y[0] < 1) {
-                    $y[0] = 1;
-                }
-                if ($y[1] < 1) {
-                    $y[1] = 1;
-                }
-                $r .= '<span title="' . $w1['name'] . '">' . $y[0] . '-' . $y[1] . '</span>';
-            } 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) {
-                    $y[0] = 1;
-                }
-                if ($y[1] < 1) {
-                    $y[1] = 1;
-                }
-                $r .= $y[0] . '-' . $y[1];
-            }
-            /* ������ ������ */
-            if (isset($w2['id'])) {
-                $tp = 0;
-                $t = 0;
-                $i = 1;
-                $d = $this->lookStats($w2['data']);
-                while ($i <= 4) {
-                    if ($t < $d['tya' . $i]) {
-                        $t = $d['tya' . $i];
-                        $tp = $i;
-                    }
-                    $i++;
-                }
-                $y = $this->weaponAtc($w2, $this->stats, $tp);
-                if ($y[0] < 1) {
-                    $y[0] = 1;
-                }
-                if ($y[1] < 1) {
-                    $y[1] = 1;
-                }
-                $r .= ' / <span title="' . $w2['name'] . '">' . $y[0] . '-' . $y[1] . '</span>';
-            }
-        } else {
-            //������������
-            $y = [];
-            /* ������ ������ ��� ����� */
-            $w1 = 0;
-            $w2 = 0;
-            $i = 0;
-            $ry = 0;
-            while ($i < count($this->stats['items'])) {
-                if ($this->stats['items'][$i]['inOdet'] == 3 && $w1 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) {
-                    $w1 = $this->stats['items'][$i];
-                } elseif ($this->stats['items'][$i]['inOdet'] == 14 && $w2 == 0 && $this->stats['items'][$i]['type'] >= 18 && $this->stats['items'][$i]['type'] <= 28) {
-                    $w2 = $this->stats['items'][$i];
-                }
-                $i++;
-            }
-            if (isset($w1['id']) && $w1['inOdet'] != 14) {
-                $tp = 0;
-                $t = 0;
-                $i = 1;
-                $d = $this->lookStats($w1['data']);
-                $y = 0;
-                if (isset($d['sv_' . $v])) {
-                    $y += $d['sv_' . $v];
-                }
-                if (isset($this->stats[$v])) {
-                    $y += $this->stats[$v];
-                }
-                $ry = $y;
-                $r .= '<span title="' . $w1['name'] . '">' . $y . '</span>';
-            } else {
-                //�������
-                $r .= $this->stats[$v];
-                $ry = $this->stats[$v];
-            }
-            /* ������ ������ */
-            if (isset($w2['id'])) {
-                $tp = 0;
-                $t = 0;
-                $i = 1;
-                $d = $this->lookStats($w2['data']);
-                $y = @$this->stats[$v] + @$d['sv_' . $v];
-                if ($y != $ry) {
-                    $r .= ' / <span title="' . $w2['name'] . '">' . $y . '</span>';
-                } else {
-                    $r = str_replace('title="' . $w1['name'] . '"', '', $r);
-                }
-            }
-            //������������
-        }
-        return $r;
-    }
-
-    public 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;
-    }
-
-    public function rep_zv($id, $e)
-    {
-        if ($id == 1) {
-            //���� ������
-            if ($e > 9999) {
-                $r = '����������� �������� �����, ' . $e . ' / ??';
-            } elseif ($e > 999) {
-                $r = '����������� ������� �����, ' . $e . ' / 9999';
-            } elseif ($e > 99) {
-                $r = '����������� ������� �����, ' . $e . ' / 999';
-            } else {
-                $r = $e . ' / 99';
-            }
-        } elseif ($id == 2) {
-            //Capital city
-            if ($e > 24999) {
-                $r = '������ ������� �����, ' . $e . ' / ??';
-            } elseif ($e > 9999) {
-                $r = '������ ������� �����, ' . $e . ' / 24999';
-            } else {
-                $r = $e . ' / 10000';
-            }
-        } elseif ($id == 3) {
-            //Angels city
-            if ($e > 24999) {
-                $r = '������ ������� �����, ' . $e . ' / ??';
-            } elseif ($e > 9999) {
-                $r = '������ ������� �����, ' . $e . ' / 24999';
-            } else {
-                $r = $e . ' / 10000';
-            }
-        } elseif ($id == 4) {
-            //Demons city
-            if ($e > 24999) {
-                $r = '������ ������� �����, ' . $e . ' / ??';
-            } elseif ($e > 9999) {
-                $r = '������ ������� �����, ' . $e . ' / 24999';
-            } else {
-                $r = $e . ' / 10000';
-            }
-        } elseif ($id == 5) {
-            //������ �����
-            if ($e > 99) {
-                $r = '����������� ������� ����� ' . $e . ' / 999';
-            } else {
-                $r = $e . ' / 99';
-            }
-        } elseif ($id == 6) {
-            //Sand
-            if ($e > 24999) {
-                $r = '������ ������� �����, ' . $e . ' / ??';
-            } elseif ($e > 9999) {
-                $r = '������ ������� �����, ' . $e . ' / 24999';
-            } else {
-                $r = $e . ' / 10000';
-            }
-        } elseif ($id == 7) {
-            //Sun
-            if ($e > 24999) {
-                $r = '������ ������� �����, ' . $e . ' / ??';
-            } elseif ($e > 9999) {
-                $r = '������ ������� �����, ' . $e . ' / 24999';
-            } else {
-                $r = $e . ' / 10000';
-            }
-        } elseif ($id == 8) {
-            //Moon
-            if ($e > 24999) {
-                $r = '������ ������� �����, ' . $e . ' / ??';
-            } elseif ($e > 9999) {
-                $r = '������ ������� �����, ' . $e . ' / 24999';
-            } else {
-                $r = $e . ' / 10000';
-            }
-        } elseif ($id == 9) {
-            //Dreams city
-            if ($e > 9999) {
-                $r = '����������� �������� �����,  [' . $e . ']';
-            } elseif ($e > 4999) {
-                $r = '����������� ������� �����,' . $e . ' / 9999';
-            } elseif ($e > 999) {
-                $r = '����������� ������� �����,  ' . $e . ' / 4999';
-            } else {
-                $r = $e . ' / 999';
-            }
-        } elseif ($id == 10) {
-            //���� �������
-            if ($e > 9999) {
-                $r = '����������� ������� �����,[' . $e . ']';
-            } elseif ($e > 999) {
-                $r = '����������� ������� �����,  ' . $e . ' / 4999';
-            } else {
-                $r = $e . ' / 999';
-            }
-        } elseif ($id == 11) {
-            //����� �����
-            if ($e > 9999) {
-                $r = '������� ������ �����,  [' . $e . ']';
-            } elseif ($e > 4999) {
-                $r = '������� ������ �����,' . $e . ' / 9999';
-            } elseif ($e > 999) {
-                $r = '������ ������ �����,  ' . $e . ' / 4999';
-            } else {
-                $r = $e . ' / 999';
-            }
-        }
-
-        return $r;
-    }
-
-    public function getInfoById($id)
-    {
-        return mysql_fetch_array(mysql_query("SELECT `users`.*,`stats`.* FROM `users` INNER JOIN `stats` ON (`stats`.`id`=`users`.`id`) WHERE `users`.`id`='" . $id . "' OR
-			`users`.`login`= '" . mysql_real_escape_string($id) . "'"));
-    }
-
-    public function addItem($id, $uid, $md = null, $dn = null, $mxiznos = null, $nosudba = null, $plavka = 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`.`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) {
-                    $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;
-                $data = $this->lookStats($data); // ���� � ������� ������� ��� ���������� ��������� SROK?
-                $data = $this->impStats($data);
-            }
-
-
-            //������� � ����������� �� ����������
-            if ($dn != null && $dn['dn_delete'] > 0) {
-                $i['dn_delete'] = 1;
-            }
-            if ($mxiznos > 0) {
-                $i['iznosMAXi'] = $mxiznos;
-            }
-            if ($this->info['dnow'] > 0) {
-                $room = $this->room['city'];
-            } else {
-                $room = $this->info['city'];
-            }
-            $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'] . '",
-											"' . $room . '",
-											"' . time() . '",
-											"' . time() . '",
-											"' . $i['dn_delete'] . '")');
-            if ($ins) {
-                $rt = mysql_insert_id();
-                mysql_query('UPDATE `items_users` SET `dn_delete` = "1" WHERE `id` = "' . $rt . '" AND `data` LIKE "%dn_delete=%" LIMIT 1');
-                if ($uid == $this->info['id']) {
-                    $this->stack($rt);
-                }
-                $ads = '';
-                if ($plavka != null) {
-                    $ads = '���������� ������� : [' . $plavka . ']';
-                }
-                //���������� � ������ ���� ��� ������� �������
-                $ld = $this->addDelo(1, $uid, '&quot;<font color=#C65F00>AddItems.' . $this->info['city'] . '</font>&quot;: ������� ������� &quot;<strong>' . $i['name'] . '</strong>&quot; (x1) [#' . $i['iid'] . ']. ' . $ads . '', time(), $this->info['city'], 'AddItems.' . $this->info['city'] . '', 0, 0);
-            } else {
-                $rt = 0;
-            }
-        }
-        return $rt;
-    }
-
-    public function getNum($v)
-    {
-        $plid = $v;
-        $pi = iconv_strlen($plid);
-        if ($pi < 5) {
-            $i = 0;
-            while ($i <= 5 - $pi) {
-                $plid = '0' . $plid;
-                $i++;
-            }
-        }
-        return $plid;
-    }
-
-    public function microLogin2($bus)
-    {
-        $bus['login_BIG'] = '<strong>';
-        if ($bus['align'] > 0) {
-            $bus['login_BIG'] .= '<img src=https://img.new-combats.com/i/align/align' . $bus['align'] . '.gif width=12 height=15 >';
-        }
-        if ($bus['align2'] > 0) {
-            $bus['login_BIG'] .= '<img src=https://img.new-combats.com/i/align/align' . $bus['align2'] . '.gif width=12 height=15 >';
-        }
-        if ($bus['clan'] > 0) {
-            $bus['login_BIG'] .= '<img src=https://img.new-combats.com/i/clan/' . $bus['clan'] . '.gif width=24 height=15 >';
-        }
-        $bus['login_BIG'] .= '' . $bus['login'] . '</strong>[' . $bus['level'] . ']<a target=_blank href=https://new-combats.com/info/' . $bus['id'] . ' ><img width=12 hiehgt=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-        return $bus['login_BIG'];
-    }
-
-    public function microLogin($id, $t, $nnz = 1)
-    {
-        global $c;
-        if ($t == 1) {
-            $inf = mysql_fetch_array(mysql_query('SELECT 
-			`u`.`id`,
-			`u`.`align`,`u`.`align2`,
-			`u`.`login`,
-			`u`.`clan`,
-			`u`.`level`,
-			`u`.`city`,
-			`u`.`online`,
-			`u`.`sex`,`u`.`design`,`u`.`autospell`,`u`.`noplaw`,
-			`u`.`cityreg`,
-			`u`.`palpro`,
-			`u`.`invis`,
-			`st`.`hpNow` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id`="' . mysql_real_escape_string($id) . '" OR `u`.`login` = "' . mysql_real_escape_string((int)$id) . '" LIMIT 1'));
-        } else {
-            $inf = $id;
-            $id = $inf['id'];
-        }
-        $r = '';
-        if (isset($inf['id']) && (($inf['invis'] < time() && $inf['invis'] != 1) || ($this->info['id'] == $inf['id'] && $nnz == 1))) {
-            if ($inf['align'] > 0) {
-                $r .= '<img width="12" height="15" src="https://img.new-combats.com/i/align/align' . $inf['align'] . '.gif" />';
-            }
-            if ($inf['align2'] > 0) {
-                $r .= '<img width="12" height="15" src="https://img.new-combats.com/i/align/align' . $inf['align2'] . '.gif" />';
-            }
-            if ($inf['clan'] > 0) {
-                $cln = mysql_fetch_array(mysql_query('SELECT `id`,`name`,`name_mini`,`align`,`type_m`,`money1`,`exp` FROM `clan` WHERE `id` = "' . $inf['clan'] . '" LIMIT 1'));
-                if (isset($cln['id'])) {
-                    $r .= '<img width="24" height="15" src="https://img.new-combats.com/i/clan/' . $cln['name_mini'] . '.gif" />';
-                }
-            }
-            if ($inf['cityreg'] == '') {
-                $inf['cityreg'] = 'capitalcity';
-            }
-            $r .= ' <strong>' . $inf['login'] . '</strong> [' . $inf['level'] . ']<a target="_blank" href="https://new-combats.com/info/' . $inf['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $inf['cityreg'] . '.gif" /></a>';
-        } else {
-            $r = '<strong><i>���������</i></strong> [??]<a target="_blank" href="https://new-combats.com/info/0"><img src="https://img.new-combats.com/i/inf_capitalcity.gif" /></a>';
-        }
-        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;
-        }
-        if (isset($this->info['noreal']) || $this->info['dnow'] > 0) {
-            $hgo['id'] = true;
-        }
-        if (!isset($hgo['id'])) {
-            $ku = mysql_fetch_array(mysql_query('SELECT `id` FROM `katok_zv` WHERE `uid` = "' . $this->info['id'] . '" LIMIT 1'));
-            if (isset($ku['id'])) {
-                $hgo['id'] = true;
-            }
-        }
-        return $hgo;
-    }
-
-    public function telegram($uid, $text, $type = 1, $from = null)
-    {
-        if (!(int)$uid) {
-            $uid = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `login` = "' . mysql_real_escape_string($uid) . '" LIMIT 1'));
-            $uid = $uid['id'];
-        }
-        $r = 0;
-        if ($uid > 0) {
-            if ($from == null) {
-                $from = $this->info['login'];
-            }
-            $ins = mysql_query('INSERT INTO `telegram` (`uid`,`from`,`time`,`fromType`,`text`) VALUES ("' . mysql_real_escape_string($uid) . '","' . mysql_real_escape_string($from) . '","' . time() . '","' . mysql_real_escape_string($type) . '","' . mysql_real_escape_string(htmlspecialchars($text, null, 'cp1251')) . '")');
-            if ($ins) {
-                $r = 1;
-            } else {
-                $r = -2;
-            }
-        } else {
-            $r = -1;
-        }
-        return $r;
-    }
-
-    public function addKr($amount)
-    {
-        Db::sql('update users set money = money + ? where id = ?', [$amount, $this->info['id']]);
-    }
-
-    public function addEkr($amount)
-    {
-        Db::sql('update users set money2 = money2 + ? where id = ?', [$amount, $this->info['id']]);
-    }
-
-    private function __construct()
-    {
-        global $c, $code, $magic;
-
-        $this->info = mysql_fetch_array(mysql_query('SELECT 
-		`u`.`nextBonus`,`u`.`mat`,`u`.`skype`,`u`.`skype_hide`,`u`.`stopexp`,`u`.`twink`,`u`.`swin`,`u`.`slose`,`u`.`send`,`u`.`activ`,`u`.`b1`,`u`.`nadmin`,`u`.`fnq`,`u`.`id`,`u`.`login`,`u`.`login2`,`u`.`pass`,`u`.`pass2`,`u`.`repass`,`u`.`notrhod`,`u`.`emailconfirmation`,`u`.`securetime`,`u`.`sys`,`u`.`palpro`,`u`.`online`,`u`.`ip`,`u`.`ipreg`,`u`.`joinIP`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`banned`,`u`.`auth`,`u`.`align`,`u`.`align2`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`mod_zvanie`,`u`.`clan`,`u`.`nextMsg`,`u`.`molch1`,`u`.`molch2`,`u`.`molch3`,`u`.`level`,`u`.`money`,`u`.`money2`,`u`.`money4`,`u`.`money3`,`u`.`money3`,`u`.`battle`,`u`.`cityreg`,`u`.`invBlock`,`u`.`allLock`,`u`.`invBlockCode`,`u`.`zag`,`u`.`a1`,`u`.`q1`,`u`.`mail`,`u`.`name`,`u`.`bithday`,`u`.`sex`,`u`.`design`,`u`.`autospell`,`u`.`noplaw`,`u`.`city_real`,`u`.`icq`,`u`.`icq_hide`,`u`.`homepage`,`u`.`deviz`,`u`.`hobby`,`u`.`chatColor`,`u`.`timereg`,`u`.`add_smiles`,`u`.`obraz`,`u`.`win`,`u`.`win_bs`,`u`.`lose`,`u`.`nich`,`u`.`cityreg2`,`u`.`host`,`u`.`info_delete`,`u`.`dateEnter`,`u`.`afk`,`u`.`dnd`,`u`.`timeMain`,`u`.`clan_prava`,`u`.`addpr`,`u`.`marry`,`u`.`city2`,`u`.`invis`,`u`.`bot_id`,`u`.`haos`,`u`.`host_reg`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`jail`,`u`.`animal`,`u`.`vip`,`u`.`catch`,`u`.`frg`,`u`.`no_ip`,`u`.`type_pers`,`u`.`bot_room`,`u`.`clan_delay`,`u`.`bukmeker`,`u`.`ang_g`,`u`.`referals`,
-		`st`.`id`,`st`.`lider`,`st`.`btl_cof`,`st`.`last_hp`,`st`.`last_pr`,`st`.`smena`,`st`.`stats`,`st`.`hpAll`,`st`.`mpAll`,`st`.`hpNow`,`st`.`mpNow`,`st`.`enNow`,`st`.`transfers`,`st`.`regHP`,`st`.`regMP`,`st`.`showmenu`,`st`.`prmenu`,`st`.`ability`,`st`.`skills`,`st`.`sskills`,`st`.`nskills`,`st`.`exp`,`st`.`minHP`,`st`.`minMP`,`st`.`zv`,`st`.`dn`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`last_a`,`st`.`last_b`,`st`.`battle_text`,`st`.`upLevel`,`st`.`wipe`,`st`.`bagStats`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`nextAct`,`st`.`active`,`st`.`bot`,`st`.`lastAlign`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`s`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`ref_data`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`bn_capitalcity`,`st`.`bn_demonscity`,`st`.`alog`,`st`.`mlog`,`st`.`seff`,`st`.`expstopu`,`st`.`upexpdate`,`st`.`repexp`,
-		`r`.`noatack` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) LEFT JOIN `room` AS `r` ON (`u`.`room` = `r`.`id`) WHERE `u`.`login`="' . mysql_real_escape_string($_COOKIE['login']) . '" AND `u`.`pass`="' . mysql_real_escape_string($_COOKIE['pass']) . '" LIMIT 1'));
-        $this->info['relik'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) AS relik FROM `items_users` WHERE `item_id` = 4754 AND `uid`="' . $this->info['id'] . '" AND `delete` =0'));
-        $this->info['achiv'] = mysql_fetch_array(mysql_query('SELECT * FROM `users_achiv` WHERE `id`="' . $this->info['id'] . '" LIMIT 1'));
-        if (!isset($this->info['achiv']['id'])) {
-            mysql_query('INSERT INTO `users_achiv`(`id`, `zb`, `zb_n`, `vx`, `vx_n`, `snt`, `snt_n`, `rp`, `rp_n`, `rn`, `rn_n`, `rb`, `rb_n`, `pg`, `pg_n`, `bv`, `bv_n`, `kw`, `kw_n`, `pa`, `pa_n`) VALUES ("' . $this->info['id'] . '",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)');
-            $this->info['achiv'] = mysql_fetch_array(mysql_query('SELECT * FROM `users_achiv` WHERE `id`="' . $this->info['id'] . '" LIMIT 1'));
-        }
-
-        if ($c['securetime'] > 0) {
-            if (!defined('IP')) {
-                $dip = $_SERVER['REMOTE_ADDR'];
-                define('IP', $dip);
-            }
-
-            if (isset($this->info['id']) && ($this->info['ip'] != IP || $this->info['banned'] > 0) && $_SERVER['REQUEST_URI'] != '/') {
-                unset($this->info, $_COOKIE['login'], $_COOKIE['pass']);
-                die('<script>top.location.href="https://new-combats.com/";</script>');
-            }
-        }
-
-        if (isset($this->info['id']) && $this->info['exp'] > 300000 && $this->info['twink'] > 0) {
-            $this->info['exp'] = 300000;
-            mysql_query('UPDATE `users` SET `exp` = ' . $this->info['exp'] . ' WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-        }
-
-        if (isset($this->info['id']) && $this->info['inUser']) {
-            $md = [$this->info['molch1'], $this->info['molch2'], $this->info['molch3'], $this->info['admin'], $this->info['nadmin'], $this->info['banned'], $this->info['activ'], $this->info['align'], $this->info['id'], $this->info['level']];
-            $this->info = mysql_fetch_array(mysql_query('SELECT 
-			`u`.`nextBonus`,`u`.`mat`,`u`.`skype`,`u`.`skype_hide`,`u`.`stopexp`,`u`.`twink`,`u`.`swin`,`u`.`slose`,`u`.`activ`,`u`.`nadmin`,`u`.`b1`,`u`.`fnq`,`u`.`id`,`u`.`login`,`u`.`login2`,`u`.`pass`,`u`.`pass2`,`u`.`repass`,`u`.`notrhod`,`u`.`emailconfirmation`,`u`.`securetime`,`u`.`sys`,`u`.`palpro`,`u`.`online`,`u`.`ip`,`u`.`ipreg`,`u`.`joinIP`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`banned`,`u`.`auth`,`u`.`align`,`u`.`align2`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`mod_zvanie`,`u`.`clan`,`u`.`nextMsg`,`u`.`molch1`,`u`.`molch2`,`u`.`molch3`,`u`.`level`,`u`.`money`,`u`.`money2`,`u`.`money4`,`u`.`money3`,`u`.`battle`,`u`.`cityreg`,`u`.`invBlock`,`u`.`allLock`,`u`.`invBlockCode`,`u`.`zag`,`u`.`a1`,`u`.`q1`,`u`.`mail`,`u`.`name`,`u`.`bithday`,`u`.`sex`,`u`.`design`,`u`.`autospell`,`u`.`noplaw`,`u`.`city_real`,`u`.`icq`,`u`.`icq_hide`,`u`.`homepage`,`u`.`deviz`,`u`.`hobby`,`u`.`chatColor`,`u`.`timereg`,`u`.`add_smiles`,`u`.`obraz`,`u`.`win`,`u`.`win_bs`,`u`.`lose`,`u`.`nich`,`u`.`cityreg2`,`u`.`host`,`u`.`info_delete`,`u`.`dateEnter`,`u`.`afk`,`u`.`dnd`,`u`.`timeMain`,`u`.`clan_prava`,`u`.`addpr`,`u`.`marry`,`u`.`city2`,`u`.`invis`,`u`.`bot_id`,`u`.`haos`,`u`.`host_reg`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`jail`,`u`.`animal`,`u`.`vip`,`u`.`catch`,`u`.`frg`,`u`.`no_ip`,`u`.`type_pers`,`u`.`bot_room`,`u`.`clan_delay`,`u`.`bukmeker`,
-			`st`.`id`,`st`.`lider`,`st`.`btl_cof`,`st`.`last_hp`,`st`.`last_pr`,`st`.`smena`,`st`.`stats`,`st`.`hpAll`,`st`.`mpAll`,`st`.`hpNow`,`st`.`mpNow`,`st`.`enNow`,`st`.`transfers`,`st`.`regHP`,`st`.`regMP`,`st`.`showmenu`,`st`.`prmenu`,`st`.`ability`,`st`.`skills`,`st`.`sskills`,`st`.`nskills`,`st`.`exp`,`st`.`minHP`,`st`.`minMP`,`st`.`zv`,`st`.`dn`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`last_a`,`st`.`last_b`,`st`.`battle_text`,`st`.`upLevel`,`st`.`wipe`,`st`.`bagStats`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`nextAct`,`st`.`active`,`st`.`bot`,`st`.`lastAlign`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`s`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`ref_data`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`bn_capitalcity`,`st`.`bn_demonscity`,`st`.`alog`,`st`.`mlog`,`st`.`seff`,`st`.`expstopu`,`st`.`upexpdate`,`st`.`repexp`
-			 FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id`="' . mysql_real_escape_string($this->info['inUser']) . '" LIMIT 1'));
-            if ($this->info['molch1'] < $md[0]) {
-                $this->info['molch1'] = $md[0];
-            }
-            if ($this->info['molch2'] < $md[1]) {
-                $this->info['molch2'] = $md[1];
-            }
-            if ($this->info['molch3'] < $md[2]) {
-                $this->info['molch3'] = $md[2];
-            }
-            if ($this->info['admin'] < $md[3]) {
-                $this->info['admin'] = $md[3];
-            }
-            if ($this->info['nadmin'] < $md[4]) {
-                $this->info['nadmin'] = $md[4];
-            }
-            if ($this->info['banned'] < $md[5]) {
-                $this->info['banned'] = $md[5];
-            }
-            $this->info['activ'] = $md[6];
-            $this->info['noreal'] = 1;
-            $this->info['align_real'] = $md[7];
-            $this->info['__id'] = $md[8];
-            $this->info['__level'] = $md[9];
-        }
-        if (isset ($_COOKIE['btl'])) {
-            if ($this->info['battle'] != $_COOKIE['btl']) {
-                setcookie('btl', $this->info['battle'], time() + 86400);
-            }
-        } else {
-            setcookie('btl', $this->info['battle'], time() + 86400);
-        }
-
-        if (!isset($this->info['id'])) {
-            $this->info = mysql_fetch_array(mysql_query('SELECT 
-			`u`.`nadmin`,`u`.`id`,`u`.`login`,`u`.`login2`,`u`.`pass`,`u`.`pass2`,`u`.`repass`,`u`.`notrhod`,`u`.`emailconfirmation`,`u`.`securetime`,`u`.`sys`,`u`.`palpro`,`u`.`online`,`u`.`ip`,`u`.`ipreg`,`u`.`joinIP`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`banned`,`u`.`auth`,`u`.`align`,`u`.`align2`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`mod_zvanie`,`u`.`clan`,`u`.`nextMsg`,`u`.`molch1`,`u`.`molch2`,`u`.`molch3`,`u`.`level`,`u`.`money`,`u`.`money2`,`u`.`money4`,`u`.`money3`,`u`.`battle`,`u`.`cityreg`,`u`.`invBlock`,`u`.`allLock`,`u`.`invBlockCode`,`u`.`zag`,`u`.`a1`,`u`.`q1`,`u`.`mail`,`u`.`name`,`u`.`bithday`,`u`.`sex`,`u`.`design`,`u`.`autospell`,`u`.`noplaw`,`u`.`city_real`,`u`.`icq`,`u`.`icq_hide`,`u`.`homepage`,`u`.`deviz`,`u`.`hobby`,`u`.`chatColor`,`u`.`timereg`,`u`.`add_smiles`,`u`.`obraz`,`u`.`win`,`u`.`win_bs`,`u`.`lose`,`u`.`nich`,`u`.`cityreg2`,`u`.`host`,`u`.`info_delete`,`u`.`dateEnter`,`u`.`afk`,`u`.`dnd`,`u`.`timeMain`,`u`.`clan_prava`,`u`.`addpr`,`u`.`marry`,`u`.`city2`,`u`.`invis`,`u`.`bot_id`,`u`.`haos`,`u`.`host_reg`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`jail`,`u`.`animal`,`u`.`vip`,`u`.`catch`,`u`.`frg`,`u`.`no_ip`,`u`.`type_pers`,`u`.`bot_room`,`u`.`clan_delay`,`u`.`bukmeker`
-			FROM `users` AS `u` WHERE `u`.`login`="' . mysql_real_escape_string($_COOKIE['login']) . '" AND `u`.`pass`="' . mysql_real_escape_string($_COOKIE['pass']) . '" LIMIT 1'));
-            if ($this->info['dateEnter'] != $_SERVER['HTTP_USER_AGENT']) {
-                unset($this->info);
-            }
-            $this->btl_txt = $this->info['battle_text'];
-            if (!isset($this->info['id'])) {
-                unset($this->info);
-                setcookie('login', '', time() - 60 * 60 * 24, '', $c['host']);
-                setcookie('pass', '', time() - 60 * 60 * 24, '', $c['host']);
-            } else {
-                echo 'stats is lost.';
-            }
-        }
-
-        if (isset($this->info['id'])) {
-            if ($this->info['invis'] == 1 || $this->info['invis'] > time()) {
-                $this->info['cast_login'] = '<i>���������</i>';
-            } else {
-                $this->info['cast_login'] = $this->info['login'];
-            }
-        }
-
-        if (isset($this->info['id']) && $this->info['battle'] == 0) {
-            $sb = mysql_fetch_array(mysql_query('SELECT SUM(`money2`) FROM `bank` WHERE `uid` = "' . $this->info['id'] . '" LIMIT 100'));
-            $sb = $sb[0];
-
-            if ($sb - 1 > $this->info['catch'] - $this->info['frg']) {
-                if ($this->info['frg'] == -1) {
-                    $sm = $this->testAction('`uid` = "' . $this->info['id'] . '" AND `vars` = "frg" LIMIT 1', 1);
-                }
-                if (!isset($sm['id']) && $this->info['frg'] == -1) {
-                    mysql_query('UPDATE `users` SET `catch` = "' . round($sb) . '",`frg` = "0" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-                    $this->addAction(time(), 'frg', '[ ' . $this->info['login'] . ' ] ' . date('d.m.Y H:i:s') . ' [true] , balance: ' . $sb . ' / ' . $this->info['catch'] . ' / ' . $this->info['frg'] . ' ');
-                } else {
-                    mysql_query('UPDATE `users` SET `catch` = "' . round($sb + $this->info['frg']) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-                    if ($sb - 10 > $this->info['catch'] - $this->info['frg']) {
-                        $this->addAction(time(), 'frgfalse', '[ ' . $this->info['login'] . ' ] ' . date('d.m.Y H:i:s') . ' [false] , [' . ($sb - ($this->info['catch'] - $this->info['frg'])) . '] , balance: ' . $sb . ' | ' . $this->info['catch'] . ' | ' . $this->info['frg'] . ' ');
-                    }
-                }
-            }
-
-            if ($this->info['login2'] != '' && $this->info['battle'] == 0 && $this->info['zv'] == 0) {
-                mysql_query('UPDATE `users` SET `login2` = "" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-                $this->info['login2'] = '';
-            }
-
-            $this->rep = mysql_fetch_array(mysql_query('SELECT 
-			`add_slot`,`nu_sandcity`,`n_sandcity`,
-			`dl1`,`id`,`rep1`,`rep2`,`repcapitalcity`,`repdemonscity`,`repangelscity`,`repabandonedplain`,
-			`repdevilscity`,`repmooncity`,`repsuncity`,`repsandcity`,`repemeraldscity`,`repdreamscity`,`repizlom`,
-			`n_capitalcity`,`n_demonscity`,`n_suncity`,`nu_demonscity`,`nu_angelscity`,`nu_abandonedplain`,`nu_emeraldscity`,
-			`nu_capitalcity`,`nu_suncity`,`nu_devilscity`,`nu_dreamscity`,`add_stats`,`add_money`,`add_skills`,`add_skills2`,
-			`rep3`,`rep3_buy`,`repdragonscity`,`n_dragonscity`,`nu_dragonscity`,
-			(`repcapitalcity`+`repdemonscity`+`repangelscity`+`repsuncity`+`repdreamscity`+`repabandonedplain`+`repsandcity`+`repemeraldscity`+`repdevilscity`) as allrep, 
-			(`nu_capitalcity`+`nu_demonscity`+`nu_angelscity`+`nu_suncity`+`nu_dreamscity`+`nu_abandonedplain`+`nu_sandcity`+`nu_emeraldscity`+`nu_devilscity`) as allnurep
-			FROM `rep` WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'));
-
-
-            if (!isset($this->rep['id'])) {
-                mysql_query('INSERT INTO `rep` (`id`) VALUES (' . $this->info['id'] . ')');
-            }
-            if ($this->info['login2'] != '' && $this->info['zv'] == 0 && $this->info['battle'] == 0) {
-                $this->info['login2'] = '';
-                mysql_query('UPDATE `users` SET `login2` = "" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-            }
-
-            if (isset($_GET['homeworld'])) {
-                if ($this->info['zv'] == 0 && $this->info['battle'] == 0 && $this->info['dnow'] == 0) {
-                    $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'));
-                        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');
-                                }
-                                unset($sp_bs, $pl_bs);
-                                mysql_query('UPDATE `bs_zv` SET `finish` = "' . time() . '" WHERE `uid` = "' . $this->info['id'] . '" AND `inBot` = "0" AND `finish` = "0"');
-                            }
-                            $this->info['room'] = $rmt['id'];
-                            mysql_query('UPDATE `users` SET `room` = "' . $this->info['room'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-
-                        } else {
-                            $this->error = '� ���� ������ ������ ������������ ������� �������';
-                        }
-                        unset($rmt);
-                    } else {
-                        $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`
-				,`m`.`max_text` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON `i`.`item_id` = `m`.`id` WHERE `i`.`id` = "' . mysql_real_escape_string($_GET['itmid']) . '" LIMIT 1'));
-                if (isset($itm['id'])) {
-                    if ($itm['max_text'] > 0 && $itm['max_text'] - $itm['use_text'] > 0) {
-                        $txt = $_GET['addtext'];
-                        $txt = str_replace(' ', '', $txt);
-                        $txt = str_replace('	', '', $txt);
-                        if ($txt != '') {
-                            $txt = substr($_GET['addtext'], 0, $itm['max_text'] - $itm['use_text']);
-                            $sx = iconv_strlen($txt);
-                            $itm['use_text'] += $sx;
-                            if ($itm['use_text'] > $itm['max_text']) {
-                                $itm['use_text'] = $itm['max_text'];
-                            }
-
-                            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 = '������ ������� �����������';
-                        } else {
-                            $this->error = '����� ���-�� ��������...';
-                        }
-                    } else {
-                        $this->error = '������� ��� ������ �� ��������';
-                    }
-                } else {
-                    $this->error = '������� ��� ������ �� ������';
-                }
-            }
-
-            //������ ��������
-            if (isset($_POST['trnLogin'], $_GET['transfer']) && $this->info['battle'] == 0) {
-                if ($this->info['level'] < 4 && $this->info['admin'] == 0) {
-                    $this->error = '���������� �������� ����� ��������� ������ 4-�� ������';
-                } elseif ($this->info['align'] == 2 && $this->info['admin'] == 0) {
-                    $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) . '';
-                        } elseif ($t['battle'] > 0) {
-                            $this->error = '�������� ��������� � ���';
-                        } elseif ($t['level'] < 4 && $this->info['admin'] == 0) {
-                            $this->error = '�� �� ������ ���������� �������� ���������� ���� 4-�� ������';
-                        } elseif ($t['align'] == 2 && $this->info['admin'] == 0) {
-                            $this->error = '�� �� ������ ���������� �������� ���������';
-                        } elseif ($t['room'] != $this->info['room']) {
-                            $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 = '�� ��� ���������� � ��������';
-                            } 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 = '�������� ��� �������� ������';
-                                } 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) {
-                                        $this->addAction(time(), 'trasfer_' . $this->info['city'] . '_' . $this->info['room'] . '_' . $t['id'] . '', $this->info['login']);
-                                    }
-                                }
-                            }
-                        }
-                    } else {
-                        $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;
-            }
-            if (isset($this->tfer['id'])) {
-                if ($this->tfer['cancel1'] == 0 && $this->tfer['cancel2'] == 0) {
-                    if ($this->tfer['uid2'] == $this->info['id'] && $this->tfer['start2'] == 0 && isset($_GET['transfer'])) {
-                        $this->tfer['start2'] = time();
-                        mysql_query('UPDATE `transfers` SET `start2` = "' . $this->tfer['start2'] . '" WHERE `id` = "' . $this->tfer['id'] . '" LIMIT 1');
-                    }
-                    if ($this->tfer['uid2'] == $this->info['id'] && $this->tfer['start2'] == 0) {
-                        $this->tfer = false;
-                    } elseif ($this->tfer['time'] < time() - 1800) {
-                        //���� �������� ������ 30 �����, �� ������
-                        $upd = mysql_query('UPDATE `transfers` SET `cancel1` = "' . time() . '",`cancel2` = "' . time() . '" WHERE `id` = "' . $this->tfer['id'] . '" LIMIT 1');
-                        if ($upd) {
-                            unset($this->tfer, $upd);
-                        }
-                    } elseif ($this->info['room'] != $this->tfer['room'] || $this->info['city'] != $this->tfer['city'] || $this->info['battle'] > 0) {
-                        $upd = mysql_query('UPDATE `transfers` SET `cancel1` = "' . time() . '",`cancel2` = "' . time() . '" WHERE `id` = "' . $this->tfer['id'] . '" LIMIT 1');
-                        if ($upd) {
-
-
-                            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);
-                        }
-                    } elseif (isset($_GET['exit_transfer'])) {
-                        $upd = 1;
-                        if ($this->tfer['uid2'] == $this->info['id']) {
-                            $upd = 2;
-                        }
-                        $upd = mysql_query('UPDATE `transfers` SET `cancel' . $upd . '` = "' . time() . '" WHERE `id` = "' . $this->tfer['id'] . '" LIMIT 1');
-                        if ($upd) {
-
-                            $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);
-                        }
-                    }
-                }
-            }
-
-            /*
-			�������������
-			*/
-
-            //���������� ��������� �� �������
-            $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) {
-                        if (isset($cm[$i])) {
-                            mysql_query('UPDATE `items_users` SET `inOdet` = "0" WHERE `uid` = "' . $this->info['id'] . '" AND `inOdet` = "' . $i . '"');
-                            mysql_query('UPDATE `items_users` SET `inOdet` = "' . $i . '" WHERE `id` = "' . ((int)$cm[$i]) . '" AND `uid` = "' . $this->info['id'] . '" AND `delete` = "0" AND `inShop` = "0"');
-                        }
-                        $i++;
-                    }
-                }
-
-
-                unset($cmp, $cm);
-            }
-
-            $this->room = mysql_fetch_array(mysql_query('SELECT `id`,`extdlg`,`lider`,`name`,`city`,`code`,`timeGO`,`file`,`level`,`align`,`clan`,`items`,`effects`,`destroy`,`close`,`roomGo`,`sex`,`FR`,`noatack`,`botgo`,`block_all`,`zvsee`,`roomAjax` FROM `room` WHERE `id` = "' . $this->info['room'] . '" LIMIT 1'));
-
-            if (isset($_POST['bankpsw'])) {
-                $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 `id` = "' . mysql_real_escape_string((int)$_POST['bank']) . '" AND `pass` = "' . mysql_real_escape_string($_POST['bankpsw']) . '"  LIMIT 1'));
-                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'] = '�������� ������ �� �����';
-                }
-            } 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'));
-            }
-
-            if (isset($_GET['bank_exit'])) {
-                mysql_query('UPDATE `bank` SET `useNow` = "0" WHERE `uid` = "' . $this->info['id'] . '" AND `useNow`!="0" LIMIT 1');
-            }
-
-            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'));
-                $t = $this->items['tr'];
-                $x = 0;
-                $po = $this->lookStats($o['tr']);
-                if ($o['itm'] > 0) {
-                    $o['itm'] = explode(',', $o['itm']);
-                    $j = 0;
-                    while ($j < count($o['itm'])) {
-                        $itm_id = $o['itm'][$j];
-                        if ($itm_id > 0) {
-                            $itm_id = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . $itm_id . '" LIMIT 1'));
-                            $itm_id_true = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `item_id` = "' . $itm_id['id'] . '" AND
-								`delete` = 0 AND `inOdet` > 0 AND `inShop` = 0 AND `uid` = "' . $this->info['id'] . '"
-								LIMIT 1'));
-                            if (!isset($itm_id_true['id'])) {
-                                $tr = false;
-                            }
-                        }
-                        $j++;
-                    }
-                }
-                while ($x < count($t)) {
-                    $n = $t[$x];
-                    if (isset($po['tr_' . $n])) {
-                        if ($po['tr_' . $n] > $this->stats[$n]) {
-                            $tr = false;
-                        }
-                    }
-                    $x++;
-                }
-                if ($this->info['clan'] != $o['clan'] && $o['clan'] != 0) {
-                    $tr = false;
-                }
-                if (!isset($o['id']) || $tr == false) {
-                    if ($this->info['obraz'] == $o['img']) {
-                        $this->info['obraz'] = '0.gif';
-                        mysql_query('UPDATE `users` SET `obraz` = "' . $this->info['obraz'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-                    }
-                }
-
-            }
-
-            if (isset($_GET['obr_sel']) || isset($_GET['obraz'])) {
-                $sm = $this->testAction('`uid` = "' . $this->info['id'] . '" AND `time` > ' . (time() - 86400) . ' AND `vars` = "sel_obraz" LIMIT 1', 1);
-                if (!isset($sm['id'])) {
-                    if (isset($_GET['obr_sel'])) {
-                        $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 `id` = "' . ((int)$_GET['obr_sel']) . '" AND `sex` = "' . $this->info['sex'] . '" AND (`login` = "" OR `login` = "' . $this->info['login'] . '") LIMIT 1'));
-                        $t = $this->items['tr'];
-                        $x = 0;
-                        $po = $this->lookStats($o['tr']);
-                        if ($o['itm'] > 0) {
-                            $o['itm'] = explode(',', $o['itm']);
-                            $j = 0;
-                            $tritm = '';
-                            while ($j < count($o['itm'])) {
-                                $itm_id = $o['itm'][$j];
-                                if ($itm_id > 0) {
-                                    $itm_id = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . $itm_id . '" LIMIT 1'));
-                                    $itm_id_true = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `item_id` = "' . $itm_id['id'] . '" AND
-									`delete` = 0 AND `inOdet` > 0 AND `inShop` = 0 AND `uid` = "' . $this->info['id'] . '"
-									LIMIT 1'));
-                                    if (!isset($itm_id_true['id'])) {
-                                        $tr = false;
-                                    }
-                                    if ($j > 0) {
-                                        $tritm .= ', ';
-                                    }
-                                    $tritm .= '&quot;' . $itm_id['name'] . '&quot;';
-                                }
-                                $j++;
-                            }
-                            if ($tritm != '' && $tr == false) {
-                                $this->error = '���������� ��������: ' . $tritm . '';
-                            }
-                        }
-                        while ($x < count($t)) {
-                            $n = $t[$x];
-                            if (isset($po['tr_' . $n])) {
-                                if ($po['tr_' . $n] > $this->stats[$n]) {
-                                    $tr = false;
-                                    $this->error = '������������ ������������� ��� ���������� ���������';
-                                }
-                            }
-                            $x++;
-                        }
-                        if (isset($o['id']) && $tr == true) {
-                            if ($this->info['obraz'] != $o['img']) {
-                                mysql_query('UPDATE `users` SET `obraz` = "' . $o['img'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-                                $this->addAction(time(), 'sel_obraz', 'id=' . $o['id'] . '');
-                                $this->info['obraz'] = $o['img'];
-                            }
-                        } else {
-                            if ($this->info['obraz'] == $o['img']) {
-                                $this->info['obraz'] = '0.gif';
-                                mysql_query('UPDATE `users` SET `obraz` = "' . $this->info['obraz'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-                            }
-                        }
-                    }
-                } else {
-                    $this->error = '�������� ����� ����� �� ���� ������ ���� � �����, ��������� ����� ' . date('d.m.Y H:i', $sm['time'] + 86400) . '';
-                    unset($_GET['obr_sel']);
-                    $_GET['inv'] = 1;
-                }
-            }
-
-            if ($this->info['zv'] > 0) {
-                $zv = mysql_fetch_array(mysql_query('SELECT `id` FROM `zayvki` WHERE `id` = "' . $this->info['zv'] . '" AND `btl_id` = "0" AND `cancel` = "0" LIMIT 1'));
-                if (!isset($zv['id'])) {
-                    $this->info['zv'] = 0;
-                    mysql_query('UPDATE `stats` SET `zv` = "0" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-                }
-            }
-
-            if ($this->info['wipe'] != 0) {
-                $this->wipe();
-            } else {
-                //��������� �����
-
-            }
-
-            $this->allActionsStart();
-
-        } elseif (isset($this->info['id'])) {
-            $this->room = mysql_fetch_array(mysql_query('SELECT `id`,`extdlg`,`lider`,`name`,`city`,`code`,`timeGO`,`file`,`level`,`align`,`clan`,`items`,`effects`,`destroy`,`close`,`roomGo`,`sex`,`FR`,`noatack`,`botgo`,`block_all`,`zvsee`,`roomAjax` FROM `room` WHERE `id` = "' . $this->info['room'] . '" LIMIT 1'));
-        }
-    }
-
-    public function allActionsStart()
-    {
-        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 = '�������� ���� ����� ������ �� ����������� �������';
-                } 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 = '������ ������ ��������� ������� ������������ ;)';
-                    } 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) . ' ��� �� ������� ...';
-                        } else {
-                            $this->error2 = '�� ��� ������� 10 ������ �� ������� ...';
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    public function round2($v)
-    {
-        $v = explode('.', $v);
-        $v = doubleval($v[0] . '.' . $v[1][0] . '' . $v[1][1]);
-        $f = explode('.', $v);
-        if (!isset($f[1])) {
-            $v = $v . '.00';
-        }
-        return $v;
-    }
-
-    public function zuby($v, $t = 0)
-    {
-        $r = '';
-        if ($v < 0) {
-            $v = 0;
-        }
-        if ($t == 0) {
-            $names[] = ' <img height=7 title=������&nbsp;��� src=https://img.new-combats.com/zub_low1.gif />';
-            $names[] = ' <img height=7 title=����������&nbsp;��� src=https://img.new-combats.com/zub_low2.gif />';
-            $names[] = ' <img height=7 title=�����&nbsp;��� src=https://img.new-combats.com/zub_low3.gif />';
-            $names[] = ' <img height=7 title=�������&nbsp;��� src=https://img.new-combats.com/zub_low4.gif />';
-        } else {
-            $names[] = ' <img style=vertical-align:baseline height=7 title=������&nbsp;��� src=https://img.new-combats.com/zub_low1.gif />';
-            $names[] = ' <img style=vertical-align:baseline height=7 title=����������&nbsp;��� src=https://img.new-combats.com/zub_low2.gif />';
-            $names[] = ' <img style=vertical-align:baseline height=7 title=�����&nbsp;��� src=https://img.new-combats.com/zub_low3.gif />';
-            $names[] = ' <img style=vertical-align:baseline height=7 title=�������&nbsp;��� src=https://img.new-combats.com/zub_low4.gif />';
-        }
-        $int = $v;
-        do {
-            $mod = $int % 10;
-            $int = floor($int / 10);//��� ������� $int = ($int-$mod)/10;
-            $r = array_shift($names) . "" . $mod . "" . $r;
-
-        } while ($int);
-
-        $ost = explode('.', $v);
-        $ost = $ost[1];
-        if ($ost == '' || $ost == 0) {
-            $ost = '00';
-        }
-
-        $r .= '.' . $ost;
-
-        return $r;
-    }
-
-    public function onlineBonus()
-    {
-        return null;
-    }
-
-    public function addAction($time, $vars, $vls, $uid = null)
-    {
-        if ($uid == null) {
-            $uid = $this->info['id'];
-        }
-        $ins = mysql_query('INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES ("' . $uid . '","' . $time . '","' . $this->info['city'] . '","' . $this->info['room'] . '","' . mysql_real_escape_string($vars) . '","' . mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']) . '","' . mysql_real_escape_string($vls) . '")');
-
-        return (bool)$ins;
-    }
-
-    public function testAction($filter, $tp)
-    {
-        //mysql_query('LOCK TABLES actions WRITE');
-        if ($tp == 1) {
-            $ins = mysql_fetch_array(mysql_query('SELECT `id`,`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`,`val` FROM `actions` WHERE ' . $filter . ''));
-        } else if ($tp == 2) {
-            $ins = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `actions` WHERE ' . $filter . ''));
-        }
-        //mysql_query('UNLOCK TABLES');
-        return $ins;
-    }
-
-    public function takePersInfo($whr)
-    {
-        return mysql_fetch_array(mysql_query('SELECT 
-		`u`.`id`,`u`.`login`,`u`.`login2`,`u`.`pass`,`u`.`pass2`,`u`.`repass`,`u`.`notrhod`,`u`.`emailconfirmation`,`u`.`securetime`,`u`.`sys`,`u`.`palpro`,`u`.`online`,`u`.`ip`,`u`.`ipreg`,`u`.`joinIP`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`banned`,`u`.`auth`,`u`.`align`,`u`.`align2`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`mod_zvanie`,`u`.`clan`,`u`.`nextMsg`,`u`.`molch1`,`u`.`molch2`,`u`.`molch3`,`u`.`level`,`u`.`money`,`u`.`money2`,`u`.`money4`,`u`.`money3`,`u`.`battle`,`u`.`cityreg`,`u`.`invBlock`,`u`.`allLock`,`u`.`invBlockCode`,`u`.`zag`,`u`.`a1`,`u`.`q1`,`u`.`mail`,`u`.`name`,`u`.`bithday`,`u`.`sex`,`u`.`design`,`u`.`autospell`,`u`.`noplaw`,`u`.`city_real`,`u`.`icq`,`u`.`icq_hide`,`u`.`homepage`,`u`.`deviz`,`u`.`hobby`,`u`.`chatColor`,`u`.`timereg`,`u`.`add_smiles`,`u`.`obraz`,`u`.`win`,`u`.`win_bs`,`u`.`lose`,`u`.`nich`,`u`.`cityreg2`,`u`.`host`,`u`.`info_delete`,`u`.`dateEnter`,`u`.`afk`,`u`.`dnd`,`u`.`timeMain`,`u`.`clan_prava`,`u`.`addpr`,`u`.`marry`,`u`.`city2`,`u`.`invis`,`u`.`bot_id`,`u`.`haos`,`u`.`host_reg`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`jail`,`u`.`animal`,`u`.`vip`,`u`.`catch`,`u`.`frg`,`u`.`no_ip`,`u`.`type_pers`,`u`.`bot_room`,`u`.`clan_delay`,`u`.`bukmeker`,
-		`st`.`id`,`st`.`lider`,`st`.`btl_cof`,`st`.`last_hp`,`st`.`last_pr`,`st`.`smena`,`st`.`stats`,`st`.`hpAll`,`st`.`mpAll`,`st`.`hpNow`,`st`.`mpNow`,`st`.`enNow`,`st`.`transfers`,`st`.`regHP`,`st`.`regMP`,`st`.`showmenu`,`st`.`prmenu`,`st`.`ability`,`st`.`skills`,`st`.`sskills`,`st`.`nskills`,`st`.`exp`,`st`.`minHP`,`st`.`minMP`,`st`.`zv`,`st`.`dn`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`last_a`,`st`.`last_b`,`st`.`battle_text`,`st`.`upLevel`,`st`.`wipe`,`st`.`bagStats`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`nextAct`,`st`.`active`,`st`.`bot`,`st`.`lastAlign`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`s`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`ref_data`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`bn_capitalcity`,`st`.`bn_demonscity`
-		FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE ' . $whr . ' LIMIT 1'));
-    }
-
-    public function addNewbot($id, $botDate, $clon, $logins_bot = null, $luser = null, $round = null)
-    {
-        global $c, $code;
-        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'] .= ' (����)';
-                }
-                //�������� ������������
-                $ins1 = mysql_query('INSERT INTO `users` (
-				`align`,
-				`login`,
-				`level`,
-				`pass`,
-				`city`,
-				`cityreg`,
-				`name`,
-				`sex`,
-				`deviz`,
-				`hobby`,
-				`timereg`,
-				`obraz`,
-				`bot_id`,
-				`inTurnir`
-				) VALUES (
-				"' . $clon['align'] . '",
-				"' . $clon['login'] . '",
-				"' . $clon['level'] . '",
-				"' . md5('bot_pass_' . $clon['login'] . '_') . '",
-				"' . $this->info['city'] . '",
-				"' . $clon['city_reg'] . '",
-				"' . $clon['login'] . '",
-				"' . $clon['sex'] . '",
-				"",
-				"",
-				"' . $clon['time_reg'] . '",
-				"' . $clon['obraz'] . '",
-				"' . mysql_real_escape_string($id) . '",
-				"' . $clon['inTurnir'] . '"
-				)');
-                if ($ins1) {
-                    if ($round > 0) {
-                        //�������� ��. � ����� � �� 1 ����� = +10%
-                        $statss = $this->lookStats($clon['stats']);
-                        //
-                        $statss['s1'] = ceil($statss['s1'] * (1 + 0.1 * ($round)));
-                        $statss['s2'] = ceil($statss['s2'] * (1 + 0.1 * ($round)));
-                        $statss['s3'] = ceil($statss['s3'] * (1 + 0.1 * ($round)));
-                        $statss['s4'] = ceil($statss['s4'] * (1 + 0.1 * ($round)));
-                        //
-                        $statss['hpAll'] = ceil($statss['hpAll'] * (1 + 0.1 * ($round)));
-                        $statss['mpAll'] = ceil($statss['mpAll'] * (1 + 0.1 * ($round)));
-                        //
-                        $statss['m1'] = ceil($statss['m1'] * (1 + 0.1 * ($round)));
-                        $statss['m2'] = ceil($statss['m2'] * (1 + 0.1 * ($round)));
-                        $statss['m3'] = ceil($statss['m3'] * (1 + 0.1 * ($round)));
-                        $statss['m4'] = ceil($statss['m4'] * (1 + 0.1 * ($round)));
-                        $statss['m5'] = ceil($statss['m5'] * (1 + 0.1 * ($round)));
-                        $statss['za'] = ceil($statss['za'] * (1 + 0.1 * ($round)));
-                        $statss['zm'] = ceil($statss['zm'] * (1 + 0.1 * ($round)));
-                        $clon['stats'] = $this->impStats($statss);
-                        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);
-                        $statss['m3'] = ceil($statss['m3'] * 0.75);
-                        $statss['m4'] = ceil($statss['m4'] * 0.75);
-                        $statss['m5'] = ceil($statss['m5'] * 0.75);
-                        $statss['za'] = ceil($statss['za'] * 0.25);
-
-                        $clon['stats'] = $this->impStats($statss);
-                        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'] . '")');
-                        }
-                        $r = $uid;
-                    }
-                }
-            }
-            return $r;
-        } else {
-            if ($botDate == null) {
-                $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` = "' . $id . '" LIMIT 1'));
-            } else {
-                $bot = $botDate;
-            }
-            if (isset($bot['id'])) {
-                if (isset($logins_bot[$bot['login']])) {
-                    $logins_bot[$bot['login']]++;
-                    $bot['login'] = $bot['login'] . ' (' . $logins_bot[$bot['login']] . ')';
-                } else {
-                    $logins_bot[$bot['login']] = 1;
-                }
-                $ret = true;
-                if ($bot['time_reg'] == 100) {
-                    $bot['time_reg'] = time();
-                }
-                if ($bot['city_reg'] == '{thiscity}') {
-                    $bot['city_reg'] = $this->info['city'];
-                }
-
-                $ins1 = mysql_query('INSERT INTO `users` (
-				`align`,
-				`login`,
-				`level`,
-				`pass`,
-				`city`,
-				`cityreg`,
-				`name`,
-				`sex`,
-				`deviz`,
-				`hobby`,
-				`timereg`,
-				`obraz`,
-				`bot_id`
-				) VALUES (
-				"' . $bot['align'] . '",
-				"' . $bot['login'] . '",
-				"' . $bot['level'] . '",
-				"' . md5('bot_pass_' . $bot['login'] . '_') . '",
-				"' . $this->info['city'] . '",
-				"' . $bot['city_reg'] . '",
-				"' . $bot['name'] . '",
-				"' . $bot['sex'] . '",
-				"' . $bot['deviz'] . '",
-				"' . $bot['hobby'] . '",
-				"' . $bot['time_reg'] . '",
-				"' . $bot['obraz'] . '",
-				"' . mysql_real_escape_string($id) . '"
-				)');
-                if ($ins1) {
-                    $uid = mysql_insert_id();
-                    if ($round > 0) {
-                        //�������� ��. � ����� � �� 1 ����� = +20%
-                        $statss = $this->lookStats($bot['stats']);
-                        //
-                        $statss['s1'] = ceil($statss['s1'] * (1 + 0.20 * ($round)));
-                        $statss['s2'] = ceil($statss['s2'] * (1 + 0.20 * ($round)));
-                        $statss['s3'] = ceil($statss['s3'] * (1 + 0.20 * ($round)));
-                        $statss['s4'] = ceil($statss['s4'] * (1 + 0.20 * ($round)));
-                        //
-                        $statss['hpAll'] = ceil($statss['hpAll'] * (1 + 0.20 * ($round)));
-                        $statss['mpAll'] = ceil($statss['mpAll'] * (1 + 0.20 * ($round)));
-                        //
-                        $statss['m1'] = ceil($statss['m1'] * (1 + 0.20 * ($round)));
-                        $statss['m2'] = ceil($statss['m2'] * (1 + 0.20 * ($round)));
-                        $statss['m3'] = ceil($statss['m3'] * (1 + 0.20 * ($round)));
-                        $statss['m4'] = ceil($statss['m4'] * (1 + 0.20 * ($round)));
-                        $statss['m5'] = ceil($statss['m5'] * (1 + 0.20 * ($round)));
-                        $statss['za'] = ceil($statss['za'] * (1 + 0.20 * ($round)));
-                        $statss['zm'] = ceil($statss['zm'] * (1 + 0.20 * ($round)));
-                        $bot['stats'] = $this->impStats($statss);
-                        unset($statss);
-                    }
-                    $ins2 = mysql_query('INSERT INTO `stats` (`id`,`stats`,`hpNow`,`upLevel`,`bot`) VALUES ("' . $uid . '","' . $bot['stats'] . '","1000000","' . $bot['upLevel'] . '","1")');
-                    if ($ins2) {
-                        $bot['id'] = $uid;
-                        $bot['logins_bot'] = $logins_bot;
-                        $ret = $bot;
-
-                        //������ ��������
-                        //$this->addItem($item_id,$uid);
-                        $iu = explode(',', $bot['itemsUse']);
-                        $i = 0;
-                        $w3b = 0;
-                        while ($i < count($iu)) {
-                            if ($iu[$i] > 0) {
-                                $idiu = $this->addItem($iu[$i], $bot['id']);
-                                $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;
-                                }
-                                mysql_query('UPDATE `items_users` SET `inOdet` = "' . $islot . '" WHERE `id` = "' . $idiu . '" LIMIT 1');
-                            }
-                            $i++;
-                        }
-
-                    } else {
-                        $ret = false;
-                    }
-                } else {
-                    $ret = false;
-                }
-                return $ret;
-            } else {
-                return false;
-            }
-        }
-    }
-
-    /*
-	 	  * $iid ���������� id �������� � ����������� ���� ���
-	 	  * ������� �� �����.
-	 	  */
-    public function buyItem($sid, $itm, $x, $mdata = null, $vip = false)
-    {
-        global $c, $code, $sid;
-        // sid 700 - 730 ����������������� �������� ��� ������ � ������ (�� ����� �� 10���)
-        $x = round((int)$x);
-        if ($x < 1) {
-            $x = 1;
-        }
-        if ($x > 99) {
-            $x = 99;
-        }
-        $i = mysql_fetch_array(mysql_query('SELECT `im`.*,`ish`.* FROM `items_shop` AS `ish` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `ish`.`item_id`) WHERE `ish`.`sid` = "' . mysql_real_escape_string($sid) . '" AND `ish`.`kolvo` > 0 AND `ish`.`item_id` = "' . mysql_real_escape_string($itm) . '" LIMIT 1'));
-
-        $r = '';
-        $vip = false;
-        if ($vip == true) {
-            $test = $this->testVipItems($i['type']);
-        }
-        if ($vip == true && $test == false) {
-            $r = '������ ������� ���������� VIP ���������, ����������� ����� ������� �������';
-        } elseif ($this->info['allLock'] > time()) {
-            $r = '��� ��������� ��������� ������� �� ' . date('d.m.y H:i', $this->info['allLock']) . '';
-        } elseif (isset($i['id'])) {
-            if ($i['price_4'] <= 0) {
-                $i['price_4'] = $i['price3'];
-            }
-            if ($i['price_4'] > 0) {
-                if ($i['kolvo'] < $x) {
-                    $x = $i['kolvo'];
-                }
-                if ($x < 1) {
-                    $x = 1;
-                }
-                $price = $i['price_4'] * $x;
-                $trnt = '';
-                $detrn = [];
-                $trn = 1;
-                if ($i['tr_items'] != '') {
-                    $tims2 = explode(',', $i['tr_items']);
-                    $j = 0;
-                    while ($j < count($tims2)) {
-                        $tims = explode('=', $tims2[$j]);
-                        if ($tims[0] > 0 && $tims[1] > 0) {
-                            $tis = mysql_fetch_array(mysql_query('SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`price4`,`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` = "' . $tims[0] . '" LIMIT 1'));
-                            if (isset($tis['id'])) {
-                                $num_rows = 0;
-                                $s1p = mysql_query('SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`4price`,`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)$tims[0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" LIMIT ' . ((int)$tims[1] * $x) . '');
-                                while ($p1l = mysql_fetch_array($s1p)) {
-                                    $num_rows++;
-                                }
-                                if ($num_rows < (int)$tims[1] * $x) {
-                                    $trn = 0;
-                                } else {
-                                    $detrn[count($detrn)] = [0 => $tims[0], 1 => ((int)$tims[1] * $x)]; //id_item
-                                }
-                                $trnt .= '[' . $tis['name'] . ' (x' . $x . ')]x' . $tims[1] . ', ';
-                            }
-                        }
-                        $j++;
-                    }
-                    $trnt = rtrim($trnt, ', ');
-                }
-
-                if ($c['noitembuy'] == true) {
-                    $trn = 1;
-                }
-
-                if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // ��������� ��������� ��� �������
-                    $need_rep = 0;
-                    $tr_rep = $this->lookStats($i['tr_reputation']);
-                    foreach ($tr_rep as $row) {
-                        if ($this->rep[$row[0]] >= $row[1]) {
-                            $need_rep++;
-                        }
-                    }
-                } else $need_rep = 0;
-
-                $mxby = 0;
-                if ($i['max_buy'] > 0) {
-                    $mxby = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `items_users` WHERE ( `delete` = "0" OR `delete` = "1000" ) AND `item_id` = "' . mysql_real_escape_string($itm) . '" AND `uid` = "' . $this->info['id'] . '" LIMIT ' . $i['max_buy']));
-                    if ($mxby[0] >= $i['max_buy']) {
-                        $mxby = -1;
-                    }
-                }
-
-                if ($i['max_buy'] < $x && $i['max_buy'] > 0) {
-                    $r = '��� ������� �������� ' . $i['max_buy'] . ' ��.';
-                } elseif ($need_rep > 0) {
-                    $r = '�� �� ��������� ������ �������, �� �� �������� ��� ���� �����.';
-                } elseif ($mxby == -1) {
-                    $r = '������������ ���������� ������� ��� ������� �������� ���������';
-                } elseif ($trn == 0 && $this->info['admin'] == 0) {
-                    $r = '� ��� ������������ ��������� ��������� (�� ������� ' . $trnt . ')';
-                } elseif ($i['price_4'] * $x > ($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) {
-                            $data .= '|' . $mdata;
-                        }
-                        $ix = 1;
-                        $gix = 0;
-                        while ($ix <= $x) {
-                            if ($i['type'] != 71) {
-                                if ($i['iznos'] > 0) {
-                                    $i['iznosMAXi'] = $i['iznos'];
-                                }
-                                $ins = mysql_query('INSERT INTO `items_users` (`1price`,`2price`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
-								"1",
-								"1",
-								"' . $i['overType'] . '",
-								"' . $i['item_id'] . '",
-								"' . $this->info['id'] . '",
-								"' . str_replace('sudba=0', '', $data) . '|sudba=' . $this->info['login'] . '|icos=WL|fromshop=' . $sid . '",
-								"' . $i['iznosMAXi'] . '",
-								"' . $i['geniration'] . '",
-								"' . $i['magic_inc'] . '",
-								"' . $this->info['city'] . '",
-								"' . time() . '",
-								"' . time() . '")');
-                            } else {
-                                mysql_query('DELETE FROM `obraz` WHERE `uid` = "' . $this->info['id'] . '" AND `sex` = "' . $i['sex'] . '" AND `img` = "' . str_replace('.png', '.gif', $i['img']) . '" LIMIT 1');
-                                $ins = mysql_query('INSERT INTO `obraz` (`sex`,`img`,`level`,`uid`,`usr_add`) VALUES ("' . $i['sex'] . '","' . str_replace('.png', '.gif', $i['img']) . '","' . $i['level'] . '","' . $this->info['id'] . '","' . time() . '")');
-                            }
-                            if ($ins) {
-                                $gix++;
-                            }
-                            $ix++;
-                        }
-                        if ($ins) {
-                            //���������� � ������ ���� ��� ������� �������
-                            if ($trnt != '' && $i['tr_items'] != '') {
-                                $trnt = ', ' . $trnt;
-                            }
-                            $r = '�� ��������� ������� &quot;' . $i['name'] . '&quot; (x' . $x . ' / ' . $gix . ') �� ' . $price . ' ���������. ' . $trnt . '<br>������� ������� �������� � ���������.';
-
-                            $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','','','<font color=red><strong>����������� �������!</strong></font> �������� <strong>".$this->info['login']."</strong> �������� ������� &quot;<font color=salmon><strong>".$i['name']."</strong></font>&quot; , ����������� � ������� ��������!','-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'], '&quot;<font color=green>Shop.' . $this->info['city'] . '</font>&quot;: �������� ������� &quot;<strong>' . $i['name'] . '</strong>&quot; (x' . $x . ') [#' . $i['iid'] . '] �� <strong>' . $price . '</strong> ���������.', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0);
-                        } else {
-                            //���������� � ������ ���� ��� ������� �� �������
-                            $r = '��� �� ������� ���������� &quot;' . $i['name'] . '&quot;. ������������� �������� � &quot;' . $this->city_name[$this->info['city']] . '&quot; ������ ��� ' . $price . ' ���������. <br>�������� ���� ��������� �� ����������.';
-                            $ld = $this->addDelo(1, $this->info['id'], '&quot;<font color=green>Shop.' . $this->info['city'] . '</font>&quot;: �� ������� ���������� ������� #' . $i['iid'] . '. � �������: <strong>' . $price . '</strong> ���������. ', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0);
-                            if (!$ld) {
-                                echo '<div>������, ���������� �������� ������ � /db/usersDelo/!</div>';
-                            }
-                        }
-                    } else {
-                        $r = '��� �� ������� ���������� �������...';
-                    }
-                }
-            } elseif ($i['price_3'] > 0) {
-                if ($i['kolvo'] < $x) {
-                    $x = $i['kolvo'];
-                }
-                if ($x < 1) {
-                    $x = 1;
-                }
-                $price = $i['price_3'] * $x;
-                $trnt = '';
-                $detrn = [];
-                $trn = 1;
-                if ($i['tr_items'] != '') {
-                    $tims2 = explode(',', $i['tr_items']);
-                    $j = 0;
-                    while ($j < count($tims2)) {
-                        $tims = explode('=', $tims2[$j]);
-                        if ($tims[0] > 0 && $tims[1] > 0) {
-                            $tis = mysql_fetch_array(mysql_query('SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`price4`,`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` = "' . $tims[0] . '" LIMIT 1'));
-                            if (isset($tis['id'])) {
-                                $num_rows = 0;
-                                $s1p = mysql_query('SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`4price`,`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)$tims[0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" LIMIT ' . ((int)$tims[1] * $x) . '');
-                                while ($p1l = mysql_fetch_array($s1p)) {
-                                    $num_rows++;
-                                }
-                                if ($num_rows < (int)$tims[1] * $x) {
-                                    $trn = 0;
-                                } else {
-                                    $detrn[count($detrn)] = [0 => $tims[0], 1 => ((int)$tims[1] * $x)]; //id_item
-                                }
-                                $trnt .= '[' . $tis['name'] . ' (x' . $x . ')]x' . $tims[1] . ', ';
-                            }
-                        }
-                        $j++;
-                    }
-                    $trnt = rtrim($trnt, ', ');
-                }
-                if ($c['noitembuy'] == true) {
-                    $trn = 1;
-                }
-
-                if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // ��������� ��������� ��� �������
-                    $need_rep = 0;
-                    $tr_rep = $this->lookStats($i['tr_reputation']);
-                    foreach ($tr_rep as $row) {
-                        if ($this->rep[$row[0]] >= $row[1]) {
-                            $need_rep++;
-                        }
-                    }
-                } else $need_rep = 0;
-
-                $mxby = 0;
-                if ($i['max_buy'] > 0) {
-                    $mxby = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `items_users` WHERE ( `delete` = "0" OR `delete` = "1000" ) AND `item_id` = "' . mysql_real_escape_string($itm) . '" AND `uid` = "' . $this->info['id'] . '" LIMIT ' . $i['max_buy']));
-                    if ($mxby[0] >= $i['max_buy']) {
-                        $mxby = -1;
-                    }
-                }
-
-                if ($i['max_buy'] < $x && $i['max_buy'] > 0) {
-                    $r = '��� ������� �������� ' . $i['max_buy'] . ' ��.';
-                } elseif ($need_rep > 0) {
-                    $r = '�� �� ��������� ������ �������, �� �� �������� ��� ���� �����.';
-                } elseif ($mxby == -1) {
-                    $r = '������������ ���������� ������� ��� ������� �������� ���������';
-                } elseif ($trn == 0 && $this->info['admin'] == 0) {
-                    $r = '� ��� ������������ ��������� ��������� (�� ������� ' . $trnt . ')';
-                } elseif ($i['price_3'] * $x > $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) {
-                            $data .= '|' . $mdata;
-                        }
-                        $ix = 1;
-                        $gix = 0;
-                        while ($ix <= $x) {
-                            if ($i['type'] != 71) {
-                                if ($i['iznos'] > 0) {
-                                    $i['iznosMAXi'] = $i['iznos'];
-                                }
-                                $ins = mysql_query('INSERT INTO `items_users` (`1price`,`2price`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
-								"1",
-								"1",
-								"' . $i['overType'] . '",
-								"' . $i['item_id'] . '",
-								"' . $this->info['id'] . '",
-								"' . str_replace('sudba=0', '', $data) . '|sudba=' . $this->info['login'] . '|frombax=1|fromshop=' . $sid . '",
-								"' . $i['iznosMAXi'] . '",
-								"' . $i['geniration'] . '",
-								"' . $i['magic_inc'] . '",
-								"' . $this->info['city'] . '",
-								"' . time() . '",
-								"' . time() . '")');
-                            } else {
-                                mysql_query('DELETE FROM `obraz` WHERE `uid` = "' . $this->info['id'] . '" AND `sex` = "' . $i['sex'] . '" AND `img` = "' . str_replace('.png', '.gif', $i['img']) . '" LIMIT 1');
-                                $ins = mysql_query('INSERT INTO `obraz` (`sex`,`img`,`level`,`uid`,`usr_add`) VALUES ("' . $i['sex'] . '","' . str_replace('.png', '.gif', $i['img']) . '","' . $i['level'] . '","' . $this->info['id'] . '","' . time() . '")');
-                            }
-                            if ($ins) {
-                                $gix++;
-                            }
-                            $ix++;
-                        }
-                        if ($ins) {
-                            //���������� � ������ ���� ��� ������� �������
-                            if ($trnt != '' && $i['tr_items'] != '') {
-                                $trnt = ', ' . $trnt;
-                            }
-                            $r = '�� ��������� ������� &quot;' . $i['name'] . '&quot; (x' . $x . ' / ' . $gix . ') �� ' . $price . ' $. ' . $trnt . '<br>������� ������� �������� � ���������.';
-
-                            $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','','','<font color=red><strong>����������� �������!</strong></font> �������� <strong>".$this->info['login']."</strong> �������� ������� &quot;<font color=salmon><strong>".$i['name']."</strong></font>&quot; , ����������� � ������� ��������!','-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'], '&quot;<font color=green>Shop.' . $this->info['city'] . '</font>&quot;: �������� ������� &quot;<strong>' . $i['name'] . '</strong>&quot; (x' . $x . ') [#' . $i['iid'] . '] �� <strong>' . $price . '</strong> $', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0);
-                        } else {
-                            //���������� � ������ ���� ��� ������� �� �������
-                            $r = '��� �� ������� ���������� &quot;' . $i['name'] . '&quot;. ������������� �������� � &quot;' . $this->city_name[$this->info['city']] . '&quot; ������ ��� ' . $price . ' $ <br>�������� ���� ��������� �� ����������.';
-                            $ld = $this->addDelo(1, $this->info['id'], '&quot;<font color=green>Shop.' . $this->info['city'] . '</font>&quot;: �� ������� ���������� ������� #' . $i['iid'] . '. � �������: <strong>' . $price . '</strong> $ ', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0);
-                            if (!$ld) {
-                                echo '<div>������, ���������� �������� ������ � /db/usersDelo/!</div>';
-                            }
-                        }
-                    } else {
-                        $r = '��� �� ������� ���������� �������...';
-                    }
-                }
-            } elseif ($sid == 2 || $sid == 777) {
-                if ($i['kolvo'] < $x) {
-                    $x = $i['kolvo'];
-                }
-                if ($i['price_2'] <= 0) {
-                    $i['price_2'] = $i['price2'];
-                }
-                if ($i['price_1'] <= 0) {
-                    $i['price_1'] = $i['price1'];
-                }
-                if ($vip == true) {
-                    $i['price_2'] = round($i['price_2'] / 20, 2);
-                }
-
-                //������ � ��������������� ������� 5%
-                if ($this->stats['silver'] >= 1) {
-                    if ($sid == 2) {
-                        $i['price_1'] = round($i['price_1'] / 100 * 95, 2);
-                    }
-                }
-
-                //������ � ������� ������� 5%
-                if ($this->stats['silver'] >= 5) {
-                    if ($sid == 2) {
-                        $i['price_2'] = round($i['price_2'] / 100 * 95, 2);
-                    }
-                }
-
-                $price = $i['price_2'] * $x;
-                $mxby = 0;
-                if ($i['max_buy'] > 0) {
-                    $mxby = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `items_users` WHERE ( `delete` = "0" OR `delete` = "1000" ) AND `item_id` = "' . mysql_real_escape_string($itm) . '" AND `uid` = "' . $this->info['id'] . '" LIMIT ' . $i['max_buy']));
-                    if ($mxby[0] >= $i['max_buy']) {
-                        $mxby = -1;
-                    }
-                }
-
-                if ($i['max_buy'] < $x && $i['max_buy'] > 0) {
-                    $r = '��� ������� �������� ' . $i['max_buy'] . ' ��.';
-                } elseif ($mxby == -1) {
-                    $r = '������������ ���������� ������� ��� ������� �������� ���������';
-                } elseif ($i['price_2'] * $x > $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;
-                    $upd = mysql_query('UPDATE `users` SET `money2` = "' . mysql_real_escape_string(round($this->info['money2'], 2)) . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-                    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();
-                        if ($vip == true) {
-                            $i['time_create'] = $this->stats['slvtm'];
-                            $mdata .= '|vip_sale=1|sudba=' . $this->info['login'] . '';
-                            $data = str_replace('sudba=0', '', $data);
-                            $data = str_replace('sudba=1', '', $data);
-                        }
-                        if ($mdata != null) {
-                            $data .= '|' . $mdata;
-                        }
-                        $ix = 1;
-                        $gix = 0;
-                        while ($ix <= $x) {
-                            if ($i['type'] != 71) {
-                                if ($i['iznos'] > 0) {
-                                    $i['iznosMAXi'] = $i['iznos'];
-                                }
-                                $ins = mysql_query('INSERT INTO `items_users` (`1price`,`2price`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
-											"' . ($i['price_1'] / 2) . '",
-											"' . $i['price_2'] . '",
-											"' . $i['overType'] . '",
-											"' . $i['item_id'] . '",
-											"' . $this->info['id'] . '",
-											"' . $data . '|fromshop=' . $sid . '",
-											"' . $i['iznosMAXi'] . '",
-											"' . $i['geniration'] . '",
-											"' . $i['magic_inc'] . '",
-											"' . $this->info['city'] . '",
-											"' . time() . '",
-											"' . $i['time_create'] . '")');
-                            } else {
-                                mysql_query('DELETE FROM `obraz` WHERE `uid` = "' . $this->info['id'] . '" AND `sex` = "' . $i['sex'] . '" AND `img` = "' . str_replace('.png', '.gif', $i['img']) . '" LIMIT 1');
-                                $ins = mysql_query('INSERT INTO `obraz` (`sex`,`img`,`level`,`uid`,`usr_add`) VALUES ("' . $i['sex'] . '","' . str_replace('.png', '.gif', $i['img']) . '","' . $i['level'] . '","' . $this->info['id'] . '","' . time() . '")');
-                            }
-                            if ($ins) {
-                                $gix++;
-                            }
-                            $ix++;
-                        }
-                        if ($ins) {
-                            //���������� � ������ ���� ��� ������� �������
-                            $r = '�� ��������� ������� &quot;' . $i['name'] . '&quot; (x' . $x . ' / ' . $gix . ') �� ' . $price . ' ���.<br>������� ������� �������� � ���������.';
-                            mysql_query('UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1');
-                            $ld = $this->addDelo(1, $this->info['id'], '&quot;<font color=#C65F00>EkrShop.' . $this->info['city'] . '</font>&quot;: �������� ������� &quot;<strong>' . $i['name'] . '</strong>&quot; (x' . $x . ',add items ' . $gix . ') [#' . $i['iid'] . '] �� <strong>' . $price . '</strong> ���.', time(), $this->info['city'], 'EkrShop.' . $this->info['city'] . '', (int)$price, 0);
-                        } else {
-                            //���������� � ������ ���� ��� ������� �� �������
-                            $r = '��� �� ������� ���������� &quot;' . $i['name'] . '&quot;. ������������� �������� � &quot;' . $this->city_name[$this->info['city']] . '&quot; ������ ��� ' . $price . ' ���.<br>�������� ���� ��������� �� ����������.';
-                            $ld = $this->addDelo(1, $this->info['id'], '&quot;<font color=#C65F00>EkrShop.' . $this->info['city'] . '</font>&quot;: �� ������� ���������� ������� #' . $i['iid'] . '. � �������: <strong>' . $price . '</strong> ���.', time(), $this->info['city'], 'EkrShop.' . $this->info['city'] . '', 0, 0);
-                            if (!$ld) {
-                                echo '<div>������, ���������� �������� ������ � /db/usersDelo/!</div>';
-                            }
-                        }
-                    } else {
-                        $r = '��� �� ������� ���������� �������...';
-                    }
-                }
-            } 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'];
-                if ($i['price_2'] <= 0 && $i['tr_items'] == '') $i['price_2'] = $i['price2'];
-
-                $price = $i['price_1'] * $x;
-                $trnt = '';
-                $detrn = [];
-                $trn = 1;
-                if ($i['tr_items'] != '') {
-                    $tims2 = explode(',', $i['tr_items']);
-                    $j = 0;
-                    while ($j < count($tims2)) {
-                        $tims = explode('=', $tims2[$j]);
-                        if ($tims[0] > 0 && $tims[1] > 0) {
-                            $tis = 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` = "' . $tims[0] . '" LIMIT 1'));
-                            if (isset($tis['id'])) {
-                                $num_rows = 0;
-                                $s1p = 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)$tims[0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" LIMIT ' . ((int)$tims[1] * $x) . '');
-                                while ($p1l = mysql_fetch_array($s1p)) {
-                                    $num_rows++;
-                                }
-                                if ($num_rows < (int)$tims[1] * $x) {
-                                    $trn = 0;
-                                } else {
-                                    $detrn[count($detrn)] = [0 => $tims[0], 1 => ((int)$tims[1] * $x)]; //id_item
-                                }
-                                $trnt .= '[' . $tis['name'] . ' (x' . $x . ')]x' . $tims[1] . ', ';
-                            }
-                        }
-                        $j++;
-                    }
-                    $trnt = rtrim($trnt, ', ');
-                }
-                if ($c['noitembuy'] == true) {
-                    $trn = 1;
-                }
-
-                if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // ��������� ��������� ��� �������
-                    $need_rep = 0;
-                    $tr_rep = $this->lookStats($i['tr_reputation']);
-                    foreach ($tr_rep as $row) {
-                        if ($this->rep[$row[0]] >= $row[1]) {
-                            $need_rep++;
-                        }
-                    }
-                } else $need_rep = 0;
-
-                $mxby = 0;
-                if ($i['max_buy'] > 0) {
-                    $mxby = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `items_users` WHERE ( `delete` = "0" OR `delete` = "1000" ) AND `item_id` = "' . mysql_real_escape_string($itm) . '" AND `uid` = "' . $this->info['id'] . '" LIMIT ' . $i['max_buy']));
-                    if ($mxby[0] >= $i['max_buy']) {
-                        $mxby = -1;
-                    }
-                }
-
-                if ($i['max_buy'] < $x && $i['max_buy'] > 0) {
-                    $r = '��� ������� �������� ' . $i['max_buy'] . ' ��.';
-                } elseif ($need_rep > 0) {
-                    $r = '�� �� ��������� ������ �������, �� �� �������� ��� ���� �����.';
-                } elseif ($i['price_1'] * $x > $this->info['money4'] && $zuby == 1) {
-                    $r = '� ��� ������������ �����.';
-                } elseif ($mxby == -1) {
-                    $r = '������������ ���������� ������� ��� ������� �������� ���������<br>�������� ������: ' . $i['max_buy'] . ' ��.';
-                } elseif ($trn == 0 && $this->info['admin'] == 0) {
-                    $r = '� ��� ������������ ��������� ��������� (�� ������� ' . $trnt . ')';
-                } elseif ($i['price_1'] * $x > $this->info['money'] && $zuby == 0) {
-                    $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) {
-                        $this->info['money'] -= $price;
-                    }
-                    $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) {
-                            $data .= '|' . $mdata;
-                        }
-                        $j = 0;
-                        $c_itm = 0;
-                        $c_itm_data_a = [];
-                        while ($j < count($detrn)) {
-                            $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` = "' . ((int)$detrn[$j][0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0") AND `inShop` = "0" ORDER BY `inGroup` DESC LIMIT 1'));
-
-                            if (isset($itm['data']) && $itm['data'] != '' && $c_itm == 0) {
-                                $po = $this->lookStats($itm['data']);
-
-                                if (isset($po['sudba'])) {
-                                    if (isset($po['sudba'])) $c_itm_data_a['sudba'] = $po['sudba'];
-                                }
-                                if (isset($po['gravi']) && $po['gravi'] != '') {
-                                    if (isset($po['gravi'])) $c_itm_data_a['gravi'] = $po['gravi'];
-                                    if (isset($po['gravic'])) $c_itm_data_a['gravic'] = $po['gravic'];
-                                    $c_itm++;
-                                }
-                                if (isset($po['imposed_id']) && $po['imposed_id'] > 0) {
-                                    if (isset($po['imposed'])) $c_itm_data_a['imposed'] = $po['imposed'];
-                                    if (isset($po['imposed_id'])) $c_itm_data_a['imposed_id'] = $po['imposed_id'];
-                                    if (isset($po['imposed_name'])) $c_itm_data_a['imposed_name'] = $po['imposed_name'];
-                                    if (isset($po['imposed_level'])) $c_itm_data_a['imposed_level'] = $po['imposed_level'];
-                                    if (isset($po['bm_a1'])) $c_itm_data_a['bm_a1'] = $po['bm_a1'];
-                                    $c_itm++;
-                                }
-                                if (isset($po['spell_id']) && $po['spell_id'] > 0) {
-                                    if (isset($po['spell'])) $c_itm_data_a['spell'] = $po['spell'];
-                                    if (isset($po['spell_id'])) $c_itm_data_a['spell_id'] = $po['spell_id'];
-                                    if (isset($po['spell_name'])) $c_itm_data_a['spell_name'] = $po['spell_name'];
-                                    if (isset($po['spell_lvl'])) $c_itm_data_a['spell_lvl'] = $po['spell_lvl'];
-                                    if (isset($po['spell_st_name'])) $c_itm_data_a['spell_st_name'] = $po['spell_st_name'];
-                                    if (isset($po['spell_st_val'])) $c_itm_data_a['spell_st_val'] = $po['spell_st_val'];
-                                    $c_itm++;
-                                }
-                                if (isset($po['rune_id']) && $po['rune_id'] > 0) {
-                                    if (isset($po['rune'])) $c_itm_data_a['rune'] = $po['rune'];
-                                    if (isset($po['rune_id'])) $c_itm_data_a['rune_id'] = $po['rune_id'];
-                                    if (isset($po['rune_name'])) $c_itm_data_a['rune_name'] = $po['rune_name'];
-                                    if (isset($po['rune_lvl'])) $c_itm_data_a['rune_lvl'] = $po['rune_lvl'];
-                                    $c_itm++;
-                                }
-                                if (isset($po['upatack_id']) && $po['upatack_id'] > 0) {
-                                    if (isset($po['upatack'])) $c_itm_data_a['upatack'] = $po['upatack'];
-                                    if (isset($po['upatack_id'])) $c_itm_data_a['upatack_id'] = $po['upatack_id'];
-                                    if (isset($po['upatack_name'])) $c_itm_data_a['upatack_name'] = $po['upatack_name'];
-                                    if (isset($po['upatack_lvl'])) $c_itm_data_a['upatack_lvl'] = $po['upatack_lvl'];
-                                    $c_itm++;
-                                }
-                            }
-                            $j++;
-                        }
-                        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'));
-                                $j = 0;
-                                $data_r = $this->lookStats($ritm['data']);
-                                while ($j < count($this->items['add'])) {
-                                    if (isset($data_r['add_' . $this->items['add'][$j]])) {
-                                        $data['add_' . $this->items['add'][$j]] += $data_r['add_' . $this->items['add'][$j]];
-                                    }
-                                    $j++;
-                                }
-
-                            }
-
-                            $data = $this->impStats($data);
-                            $c_itm_data = $this->impStats($c_itm_data_a);
-                            $data .= '|' . $c_itm_data;
-                        }
-
-                        $i['gift'] = '';
-
-                        $ix = 1;
-                        $gix = 0;
-                        while ($ix <= $x) {
-                            if ($i['type'] != 71) {
-                                if ($i['iznos'] > 0) {
-                                    $i['iznosMAXi'] = $i['iznos'];
-                                }
-                                //
-                                $i['price_2'] = 0;
-                                //
-                                $ins = mysql_query('INSERT INTO `items_users` (`1price`,`2price`,`gift`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
-											"' . $i['price_1'] . '",
-											"' . $i['price_2'] . '",
-											"' . $i['gift'] . '",
-											"' . $i['overType'] . '",
-											"' . $i['item_id'] . '",
-											"' . $this->info['id'] . '",
-											"' . $data . '|fromshop=' . $sid . '",
-											"' . $i['iznosMAXi'] . '",
-											"' . $i['geniration'] . '",
-											"' . $i['magic_inc'] . '",
-											"' . $this->info['city'] . '",
-											"' . time() . '",
-											"' . time() . '")');
-                            } else {
-                                mysql_query('DELETE FROM `obraz` WHERE `uid` = "' . $this->info['id'] . '" AND `sex` = "' . $i['sex'] . '" AND `img` = "' . str_replace('.png', '.gif', $i['img']) . '" LIMIT 1');
-                                $ins = mysql_query('INSERT INTO `obraz` (`sex`,`img`,`level`,`uid`,`usr_add`) VALUES ("' . $i['sex'] . '","' . str_replace('.png', '.gif', $i['img']) . '","' . $i['level'] . '","' . $this->info['id'] . '","' . time() . '")');
-                            }
-                            if ($ins) {
-                                $gix++;
-                            }
-                            $ix++;
-                        }
-                        if ($ins) {
-                            //���������� � ������ ���� ��� ������� �������
-                            if ($trnt != '' && $i['tr_items'] != '') {
-                                $trnt = ', ' . $trnt;
-                            }
-
-                            if ($zuby == 0) {
-                                $r = '�� ��������� ������� &quot;' . $i['name'] . '&quot; (x' . $x . ' / ' . $gix . ') �� ' . $price . ' ��. ' . $trnt . '<br>������� ������� �������� � ���������.';
-                            } else {
-                                $r = '�� ��������� ������� &quot;' . $i['name'] . '&quot; (x' . $x . ' / ' . $gix . ') �� ' . $this->zuby($price) . '. ' . $trnt . '<br>������� ������� �������� � ���������.';
-                            }
-
-                            $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('UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1');
-                            $ld = $this->addDelo(1, $this->info['id'], '&quot;<font color=green>Shop.' . $this->info['city'] . '</font>&quot;: �������� ������� &quot;<strong>' . $i['name'] . '</strong>&quot; (x' . $x . ') [#' . $i['iid'] . '] �� <strong>' . $price . '</strong> ��.', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0);
-                        } else {
-                            //���������� � ������ ���� ��� ������� �� �������
-                            $r = '��� �� ������� ���������� &quot;' . $i['name'] . '&quot;. ������������� �������� � &quot;' . $this->city_name[$this->info['city']] . '&quot; ������ ��� ' . $price . ' ��.<br>�������� ���� ��������� �� ����������.';
-                            $ld = $this->addDelo(1, $this->info['id'], '&quot;<font color=green>Shop.' . $this->info['city'] . '</font>&quot;: �� ������� ���������� ������� #' . $i['iid'] . '. � �������: <strong>' . $price . '</strong> ��.', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0);
-                            if (!$ld) {
-                                echo '<div>������, ���������� �������� ������ � /db/usersDelo/!</div>';
-                            }
-                        }
-                    } else {
-                        $r = '��� �� ������� ���������� �������...';
-                    }
-                }
-            } else { // ����������� ������� ��������
-                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'];
-                }
-                if ($i['price_2'] <= 0 && $i['tr_items'] == '') {
-                    $i['price_2'] = $i['price2'];
-                }
-
-                //������ � ��������������� ������� 5%
-                if ($this->stats['silver'] >= 1 && $sid == 1) {
-                    $i['price_1'] = round($i['price_1'] / 100 * 95, 2);
-                }
-
-                //������ � ������� ������� 5%
-                if ($this->stats['silver'] >= 5 && $sid == 2) {
-                    $i['price_2'] = round($i['price_2'] / 100 * 95, 2);
-                }
-
-                $price = $i['price_1'] * $x;
-
-                $trnt = '';
-                $detrn = [];
-                $trn = 1;
-                if ($i['tr_items'] != '') {
-                    $tims2 = explode(',', $i['tr_items']);
-                    $j = 0;
-                    while ($j < count($tims2)) {
-                        $tims = explode('=', $tims2[$j]);
-                        if ($tims[0] > 0 && $tims[1] > 0) {
-                            $tis = 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` = "' . $tims[0] . '" LIMIT 1'));
-                            if (isset($tis['id'])) {
-                                $num_rows = 0;
-                                $s1p = 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)$tims[0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" LIMIT ' . ((int)$tims[1] * $x) . '');
-                                while ($p1l = mysql_fetch_array($s1p)) {
-                                    $num_rows++;
-                                }
-                                if ($num_rows < (int)$tims[1] * $x) {
-                                    $trn = 0;
-                                } else {
-                                    $detrn[count($detrn)] = [0 => $tims[0], 1 => ((int)$tims[1] * $x)]; //id_item
-                                }
-                                $trnt .= '[' . $tis['name'] . ' (x' . $x . ')]x' . $tims[1] . ', ';
-                            }
-                        }
-                        $j++;
-                    }
-                    $trnt = rtrim($trnt, ', ');
-                }
-                if ($c['noitembuy'] == true) {
-                    $trn = 1;
-                }
-
-                if (isset($i['tr_reputation']) && $i['tr_reputation'] != '') { // ��������� ��������� ��� �������
-                    $need_rep = 0;
-                    $tr_rep = $this->lookStats($i['tr_reputation']);
-                    foreach ($tr_rep as $key => $val) {
-                        if ((int)$this->rep[$key] > (int)$val) {
-                            $need_rep++;
-                        }
-                    }
-                } else unset($need_rep);
-
-                $mxby = 0;
-                if ($i['max_buy'] > 0) {
-                    $mxby = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `items_users` WHERE ( `delete` = "0" OR `delete` = "1000" ) AND `item_id` = "' . mysql_real_escape_string($itm) . '" AND `uid` = "' . $this->info['id'] . '" LIMIT ' . $i['max_buy']));
-                    if ($mxby[0] >= $i['max_buy']) {
-                        $mxby = -1;
-                    }
-                }
-
-                $zuby = 0;
-                if (isset($_GET['zuby']) && $i['level'] < 8 && $c['zuby'] == true) {
-                    $zuby = 1;
-                }
-
-                $d = mysql_fetch_array(mysql_query('SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $i['id'] . '" LIMIT 1'));
-                $po = $this->lookStats($d['data']);
-
-                if ($zuby == 1 && $po['tr_lvl'] > 7) {
-                    $r = '������ ������� ������ ���������� �� ����.';
-                } elseif (!isset($this->sid_zuby[$sid]) && $zuby == 1) {
-                    $r = '������ ������� ������ ���������� �� ����.';
-                } elseif ($zuby == 1 && $i['nozuby'] == 1) {
-                    $r = '������ ������� ������ ���������� �� ����.';
-                } elseif ($i['max_buy'] < $x && $i['max_buy'] > 0) {
-                    $r = '��� ������� �������� ' . $i['max_buy'] . ' ��.';
-                } elseif (isset($need_rep) && $need_rep == 0) {
-                    $r = '�� �� ��������� ������ �������, �� �� �������� ��� ���� �����.';
-                } elseif ($zuby == 1 && $this->info['money4'] < $i['price_1']) {
-                    $r = '� ��� ������������ �����.';
-                } elseif ($i['price_1'] * $x > $this->info['money4'] && $zuby == 1) {
-                    $r = '� ��� ������������ �����.';
-                } elseif ($mxby == -1) {
-                    $r = '������������ ���������� ������� ��� ������� �������� ���������<br>�������� ������: ' . $i['max_buy'] . ' ��.';
-                } elseif ($trn == 0 && $this->info['admin'] == 0) {
-                    $r = '� ��� ������������ ��������� ��������� (�� ������� ' . $trnt . ')';
-                } elseif ($i['price_1'] * $x > $this->info['money'] && $zuby == 0) {
-                    $r = '� ��� ������������ ����� (�� ������� ' . ($price - $this->info['money']) . ' ��.)';
-                } else {
-                    if ($zuby == 0) {
-                        $this->info['money'] -= $price;
-                    } else {
-                        $this->info['money4'] -= $price;
-                    }
-                    $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);
-
-                        if ($mdata != null) {
-                            $data .= '|' . $mdata;
-                        }
-
-                        $i['gift'] = '';
-                        if ($zuby == 1) {
-                            $i['gift'] = '1';
-                            $data .= '|nosale=1|zazuby=' . round($price / $x, 2) . '';
-                        }
-
-                        if ($sid == 404) {
-                            $data .= '|nosale=1|notransfer=1|fromshop=404|sudba=1';
-                        }
-
-                        $ix = 1;
-                        $gix = 0;
-                        while ($ix <= $x) {
-                            if ($i['type'] != 71) {
-                                if ($i['iznos'] > 0) {
-                                    $i['iznosMAXi'] = $i['iznos'];
-                                }
-                                //
-                                $i['price_2'] = 0;
-                                //
-                                $ins = mysql_query('INSERT INTO `items_users` (`1price`,`2price`,`gift`,`overType`,`item_id`,`uid`,`data`,`iznosMAX`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`time_create`) VALUES (
-											"' . $i['price_1'] . '",
-											"' . $i['price_2'] . '",
-											"' . $i['gift'] . '",
-											"' . $i['overType'] . '",
-											"' . $i['item_id'] . '",
-											"' . $this->info['id'] . '",
-											"' . $data . '|fromshop=' . $sid . '",
-											"' . $i['iznosMAXi'] . '",
-											"' . $i['geniration'] . '",
-											"' . $i['magic_inc'] . '",
-											"' . $this->info['city'] . '",
-											"' . time() . '",
-											"' . time() . '")');
-                            } else {
-                                mysql_query('DELETE FROM `obraz` WHERE `uid` = "' . $this->info['id'] . '" AND `sex` = "' . $i['sex'] . '" AND `img` = "' . str_replace('.png', '.gif', $i['img']) . '" LIMIT 1');
-                                $ins = mysql_query('INSERT INTO `obraz` (`sex`,`img`,`level`,`uid`,`usr_add`) VALUES ("' . $i['sex'] . '","' . str_replace('.png', '.gif', $i['img']) . '","' . $i['level'] . '","' . $this->info['id'] . '","' . time() . '")');
-                            }
-                            if ($ins) {
-                                $gix++;
-                            }
-                            $ix++;
-                        }
-                        if ($ins) {
-                            //���������� � ������ ���� ��� ������� �������
-                            if ($trnt != '' && $i['tr_items'] != '') {
-                                $trnt = ', ' . $trnt;
-                            }
-
-                            if ($zuby == 0) {
-                                $r = '�� ��������� ������� &quot;' . $i['name'] . '&quot; (x' . $x . ' / ' . $gix . ') �� ' . $price . ' ��. ' . $trnt . '<br>������� ������� �������� � ���������.';
-                            } else {
-                                $r = '�� ��������� ������� &quot;' . $i['name'] . '&quot; (x' . $x . ' / ' . $gix . ') �� ' . $this->zuby($price) . '. ' . $trnt . '<br>������� ������� �������� � ���������.';
-                            }
-
-                            $zx = 0;
-                            $rs = 0;
-                            while ($zx < $x) {
-
-                                if (($sid == 1 || $sid == 5) && $i['level'] >= 4 && round($price / $x) > 25) {
-                                    if ($this->stats['shopSale'] == 0 && $c['nosanich'] == false) {
-                                        //������ ��������� ������ � ��� �������� � ������
-                                        $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);
-                                            }
-                                            if ($gitm == 3193) {
-                                                $gitm = 3194;
-                                            }
-                                            if ($sid == 5) {
-                                                //����������� �������
-                                            }
-                                            $this->addItem($gitm, $this->info['id']);
-                                            $rs++;
-                                        }
-                                    }
-                                }
-                                $zx++;
-                            }
-
-                            if ($rs > 1) {
-                                if (rand(0, 1) == 1) {
-                                    $r .= ' ������� ��� �������� � �����-�� �������. (x' . $rs . ')';
-                                } elseif (rand(0, 1)) {
-                                    $r .= ' ������� ��� �������� � �������� ������. (x' . $rs . ')';
-                                } else {
-                                    $r .= ' � �������� ���� ����������� �����-�� �������. (x' . $rs . ')';
-                                }
-                            } elseif ($rs > 0) {
-                                if (rand(0, 1) == 1) {
-                                    $r .= ' ������� ��� �������� � �����-�� �������.';
-                                } elseif (rand(0, 1)) {
-                                    $r .= ' ������� ��� �������� � �������� ������.';
-                                } else {
-                                    $r .= ' � �������� ���� ����������� �����-�� �������.';
-                                }
-                            }
-
-
-                            $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('UPDATE `items_shop` SET `kolvo` = "' . ($i['kolvo'] - $x) . '" WHERE `iid` = "' . $i['iid'] . '" LIMIT 1');
-                            $zuby_inf = '';
-                            if ($zuby == 1) {
-                                $zuby_inf = ' <font color=red><small>(�� ����)</small></font>';
-                            }
-                            $ld = $this->addDelo(1, $this->info['id'], '&quot;<font color=green>Shop.' . $this->info['city'] . '</font>&quot;: �������� ������� &quot;<strong>' . $i['name'] . '</strong>&quot; (x' . $x . ') [#' . $i['iid'] . '] �� <strong>' . $price . '</strong> ��.' . $zuby_inf . '', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0);
-                        } else {
-                            //���������� � ������ ���� ��� ������� �� �������
-                            $r = '��� �� ������� ���������� &quot;' . $i['name'] . '&quot;. ������������� �������� � &quot;' . $this->city_name[$this->info['city']] . '&quot; ������ ��� ' . $price . ' ��.<br>�������� ���� ��������� �� ����������.';
-                            $ld = $this->addDelo(1, $this->info['id'], '&quot;<font color=green>Shop.' . $this->info['city'] . '</font>&quot;: �� ������� ���������� ������� #' . $i['iid'] . '. � �������: <strong>' . $price . '</strong> ��.', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0);
-                            if (!$ld) {
-                                echo '<div>������, ���������� �������� ������ � /db/usersDelo/!</div>';
-                            }
-                        }
-                    } else {
-                        $r = '��� �� ������� ���������� �������...';
-                    }
-                }
-            }
-        } else {
-            $r = '������� �� ������ �� ��������';
-        }
-        return '<div align="left">' . $r . '</div>';
-    }
-
-    public function takeBonus()
-    {
-        if (isset($_GET['getb1w']) && $_GET['getb1w'] == 3) {
-            $pensia1 = $this->pensia(false);
-            $pensia2 = $this->pensia(true);
-            $afk = $this->info['timeMain'] < time() - 15 * 60 ? 1 : 0;
-            if ($pensia2[0] == 1) {
-                $this->info['money'] += $pensia2[1];
-                mysql_query('UPDATE `users` SET `money` = `money` + "' . $pensia2[1] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-            } else {
-                $this->info['money2'] += $pensia2[1];
-                mysql_query('UPDATE `users` SET `money2` = `money2` + "' . $pensia2[1] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-            }
-            $this->error = '��� �������� ����� � ������� ' . $pensia1 . '! ';
-            mysql_query('INSERT INTO `aaa_bonus` (
-                    `uid`,`time`,`afk`,`type`,`money`
-                ) VALUES (
-                    "' . $this->info['id'] . '","' . (time() + 1 * 3600) . '","' . $afk . '","' . $pensia2[0] . '","' . $pensia2[1] . '"
-                )');
-
-        }
-    }
-
-    public function addDelo($tp, $uid, $txt, $tm, $ct, $frm, $mo, $mi, $vvv = false)
-    {
-        return mysql_query("INSERT INTO `users_delo` (`dop`,`moneyOut`,`moneyIn`,`uid`,`ip`,`city`,`time`,`text`,`login`,`type`) VALUES ('" . mysql_real_escape_string($vvv) . "','" . mysql_real_escape_string($mo) . "','" . mysql_real_escape_string($mi) . "','" . mysql_real_escape_string($uid) . "','" . $_SERVER['HTTP_X_REAL_IP'] . "','" . $ct . "','" . $tm . "','" . mysql_real_escape_string($txt) . "','" . mysql_real_escape_string($frm) . "'," . $tp . ")");
-    }
-
-    public function newAct($test)
-    {
-        $r = true;
-        if ($test != $this->info['nextAct'] && $this->info['nextAct'] != '0') {
-            $r = false;
-        } else {
-            $na = md5(time() . '_nextAct_' . rand(0, 100));
-            $upd = mysql_query('UPDATE `stats` SET `nextAct` = "' . $na . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-            if (!$upd) {
-                $r = false;
-            } else {
-                $this->info['nextAct'] = $na;
-            }
-        }
-        return $r;
-    }
-
-    public function buyItemCommison($sid, $item, $iid = null)
-    {
-        global $sid;
-        $sid = mysql_real_escape_string($sid);
-        $itme = mysql_real_escape_string($item);
-        $iid = mysql_real_escape_string($iid);
-        $i2 = mysql_fetch_array(mysql_query('SELECT `iu`.`uid`, `iu`.`id`, `iu`.`uid`, `iu`.`1price`, `iu`.inGroup, `iu`.`data`, `iu`.`inShop`, `iu`.`item_id`, `u`.`login` as login FROM `items_users` as `iu` LEFT JOIN `users` as `u` ON `u`.id=`iu`.uid WHERE `iu`.`id` = ' . $iid . ' AND `iu`.`inShop` = 30 LIMIT 1'));
-        $i1 = mysql_fetch_array(mysql_query('SELECT `name`,`price1` FROM `items_main` WHERE `id` = ' . $i2['item_id'] . ' LIMIT 1'));
-        $price = $i2['1price'];
-        if (isset($i2['id']) && isset($iid) && $sid == 1 && $i2['inShop'] == 30) {
-            if ($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) {
-                    $this->info['money'] -= $price;
-                    $UpMoney2 = mysql_query('UPDATE `users` SET `money` = `money` + ' . $price . ' WHERE `id` = ' . $i2['uid'] . ' LIMIT 1');
-
-                    $col = $this->itemsX($iid);
-                    if ($col > 1) {
-                        $UpItems = mysql_query('UPDATE `items_users` SET `uid` = ' . $this->info['id'] . ', `inGroup` = `inGroup`+1000, `1price` = "' . $i1['price1'] . '", `lastUPD` = "' . time() . '", `inShop` = 0 WHERE `inShop` = 30 AND `inOdet` = "0"AND `item_id`="' . $i2['item_id'] . '" AND `uid`="' . $i2['uid'] . '" AND `inGroup` = "' . $i2['inGroup'] . '" LIMIT ' . $col . '');
-                    } 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 = '�� ��������� ������� &quot;' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '&quot; �� ' . $price . ' ��.<br>������� ������� �������� � ���������.';
-                        $ld = $this->addDelo(1, $this->info['id'], '&quot;<font color=#C65F00>ComissShop.' . $this->info['city'] . '</font>&quot;: �������� ������� &quot;<strong>' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '</strong>&quot; [item:' . $iid . '] � ������������ �������� �� <strong>' . $price . '</strong> ��. [��������: ' . ($i2['login'] != '' ? '<a href="https://new-combats.com/info/' . $i2['uid'] . '" target="_blank">' . $i2['login'] . '</a>' : '(' . $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'], '&quot;<font color=#C65F00>ComissShop.' . $this->info['city'] . '</font>&quot;: ������ ������� &quot;<strong>' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '</strong>&quot; [item:' . $iid . '] ����� ������������ �������� �� <strong>' . $price . '</strong> ��. [����������: <a href="https://new-combats.com/info/' . $this->info['id'] . '" target="_blank">' . $this->info['login'] . '</a>]', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', 0, $price);
-                    } else {
-                        //���������� � ������ ���� ��� ������� �� �������
-                        $r = '��� �� ������� ���������� &quot;' . $i1['name'] . ($col > 1 ? ' (x' . $col . ')' : '') . '&quot;. ������������� �������� � &quot;' . $this->city_name[$this->info['city']] . '&quot; ������ ��� ' . $price . ' ���.<br>�������� ���� ��������� �� ����������.';
-                        $ld = $this->addDelo(1, $this->info['id'], '&quot;<font color=#C65F00>EkrShop.' . $this->info['city'] . '</font>&quot;: �� ������� ���������� ������� #' . $i1['iid'] . '. � �������: <strong>' . $price . '</strong> ��.', time(), $this->info['city'], 'Shop.' . $this->info['city'] . '', (int)$price, 0);
-                        if (!$ld) echo '<div>������, ���������� �������� ������ � /db/usersDelo/!</div>';
-                    }
-                } else {
-                    $r = '��� �� ������� ���������� �������...';
-                }
-            }
-        } else
-            $r = '������� �� ������ �� ��������';
-        return '<div align="left">' . $r . '</div>';
-    }
-
-    public function commisonRent($action, $iid, $price = null)
-    {
-        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'])) {
-                continue;
-            } else {
-                if (isset($ChImtem['inGroup']) and $ChImtem['inGroup'] > 0) {
-                    $col = $this->itemsX($ChImtem['id']);
-                    if ($col > 1) {
-                        mysql_query('UPDATE `items_users` SET `inShop` = 30, `1price` = ' . $price . ' WHERE `item_id`="' . $ChImtem['item_id'] . '" AND `uid`="' . $ChImtem['uid'] . '" AND `inGroup` = "' . $ChImtem['inGroup'] . '" LIMIT ' . $col . '');
-                    } else {
-                        mysql_query('UPDATE `items_users` SET `inShop` = 30, `1price` = ' . $price . ' WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" ');
-                    }
-                } else {
-                    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)) {
-            $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']);
-                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 . '');
-                } else {
-                    mysql_query('UPDATE `items_users` SET `inShop` = 0, `1price` = ' . $i['price1'] . ' WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $iid . '" AND `inOdet` = "0" AND `delete` = "0" ');
-                }
-            } else {
-                mysql_query('UPDATE `items_users` SET `inShop` = 0, `1price` = "' . $i['price1'] . '" WHERE `id` = "' . $iid . '" and `inShop` = "30" LIMIT 1');
-            }
-        }
-    }
-
-    public function bronFx($br)
-    {
-        $r = '';
-        if ($br[0] > 0) {
-            $r .= $br[0] - 1;
-        } else {
-            $r .= 0;
-        }
-        $r .= 'd';
-        if ($br[0] > 0) {
-            $r .= $br[1] - $br[0];
-        } else {
-            $r .= 0;
-        }
-        return $r;
-    }
-
-    public function commisionShop($sid, $preview = "full")
-    {
-        global $c, $code, $sid;
-        switch ((int)$_GET['otdel']) {
-            case 1:
-                $typeOtdel = 18;
-                break;
-            case 2:
-                $typeOtdel = 19;
-                break;
-            case 3:
-                $typeOtdel = 20;
-                break;
-            case 4:
-                $typeOtdel = 21;
-                break;
-            case 5:
-                $typeOtdel = 22;
-                break;
-            case 6:
-                $typeOtdel = 15;
-                break;
-            case 7:
-                $typeOtdel = 12;
-                break;
-            case 8:
-                $typeOtdel = 4;
-                break;
-            case 9:
-                $typeOtdel = 5;
-                break;
-            case 10:
-                $typeOtdel = 6;
-                break;
-            case 11:
-                $typeOtdel = 1;
-                break;
-            case 12:
-                $typeOtdel = 3;
-                break;
-            case 13:
-                $typeOtdel = 8;
-                break;
-            case 14:
-                $typeOtdel = 14;
-                break;
-            case 15:
-                $typeOtdel = 13;
-                break;
-            case 16:
-                $typeOtdel = 9;
-                break;
-            case 17:
-                $typeOtdel = 10;
-                break;
-            case 18:
-                $typeOtdel = 11;
-                break;
-            case 19:
-                $typeOtdel = 29;
-                break;
-            case 20:
-                $typeOtdel = 30;
-                break;
-            case 1050:
-                $typeOtdel = 1050;
-                break;
-            default :
-                $typeOtdel = 18;
-        }
-        if ($typeOtdel != 1050) {
-            if ($preview == "full") {
-                $cl = mysql_query('SELECT `items_users`.`id`,`items_users`.`item_id`,`items_users`.`1price`,`items_users`.`2price`,`items_users`.`uid`,`items_users`.`use_text`,`items_users`.`data`,`items_users`.`inOdet`,`items_users`.`inShop`,`items_users`.`delete`,`items_users`.`iznosNOW`,`items_users`.`iznosMAX`,`items_users`.`gift`,`items_users`.`gtxt1`,`items_users`.`gtxt2`,`items_users`.`kolvo`,`items_users`.`geniration`,`items_users`.`magic_inc`,`items_users`.`maidin`,`items_users`.`lastUPD`,`items_users`.`timeOver`,`items_users`.`overType`,`items_users`.`secret_id`,`items_users`.`time_create`,`items_users`.`inGroup`,`items_users`.`dn_delete`,`items_users`.`inTransfer`,`items_users`.`post_delivery`,`items_users`.`lbtl_`,`items_users`.`bexp`,`items_users`.`so`,`items_users`.`blvl`,`items_main`.`id`,`items_main`.`name`,`items_main`.`img`,`items_main`.`type`,`items_main`.`inslot`,`items_main`.`2h`,`items_main`.`2too`,`items_main`.`iznosMAXi`,`items_main`.`inRazdel`,`items_main`.`price1`,`items_main`.`price2`,`items_main`.`magic_chance`,`items_main`.`info`,`items_main`.`massa`,`items_main`.`level`,`items_main`.`magic_inci`,`items_main`.`overTypei`,`items_main`.`group`,`items_main`.`group_max`,`items_main`.`geni`,`items_main`.`ts`,`items_main`.`srok`,`items_main`.`class`,`items_main`.`class_point`,`items_main`.`anti_class`,`items_main`.`anti_class_point`,`items_main`.`max_text`,`items_main`.`useInBattle`,`items_main`.`lbtl`,`items_main`.`lvl_itm`,`items_main`.`lvl_exp`,`items_main`.`lvl_aexp`, count(`items_users`.`id`) as inGroupCount
-FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`)
-WHERE (( `items_users`.time_create + `items_main`.srok) > unix_timestamp()  OR `items_main`.srok = "0") AND `items_users`.`delete`="0" AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` = "' . mysql_real_escape_string($typeOtdel) . '" and `items_users`.`item_id` = "' . (int)$_GET['itemid'] . '" GROUP BY `items_users`.`inGroup`, `items_users`.`uid`,`items_users`.`1price` HAVING `items_users`.inGroup > 0
-UNION ALL SELECT `items_users`.`id`,`items_users`.`item_id`,`items_users`.`1price`,`items_users`.`2price`,`items_users`.`uid`,`items_users`.`use_text`,`items_users`.`data`,`items_users`.`inOdet`,`items_users`.`inShop`,`items_users`.`delete`,`items_users`.`iznosNOW`,`items_users`.`iznosMAX`,`items_users`.`gift`,`items_users`.`gtxt1`,`items_users`.`gtxt2`,`items_users`.`kolvo`,`items_users`.`geniration`,`items_users`.`magic_inc`,`items_users`.`maidin`,`items_users`.`lastUPD`,`items_users`.`timeOver`,`items_users`.`overType`,`items_users`.`secret_id`,`items_users`.`time_create`,`items_users`.`inGroup`,`items_users`.`dn_delete`,`items_users`.`inTransfer`,`items_users`.`post_delivery`,`items_users`.`lbtl_`,`items_users`.`bexp`,`items_users`.`so`,`items_users`.`blvl`,`items_main`.`id`,`items_main`.`name`,`items_main`.`img`,`items_main`.`type`,`items_main`.`inslot`,`items_main`.`2h`,`items_main`.`2too`,`items_main`.`iznosMAXi`,`items_main`.`inRazdel`,`items_main`.`price1`,`items_main`.`price2`,`items_main`.`magic_chance`,`items_main`.`info`,`items_main`.`massa`,`items_main`.`level`,`items_main`.`magic_inci`,`items_main`.`overTypei`,`items_main`.`group`,`items_main`.`group_max`,`items_main`.`geni`,`items_main`.`ts`,`items_main`.`srok`,`items_main`.`class`,`items_main`.`class_point`,`items_main`.`anti_class`,`items_main`.`anti_class_point`,`items_main`.`max_text`,`items_main`.`useInBattle`,`items_main`.`lbtl`,`items_main`.`lvl_itm`,`items_main`.`lvl_exp`,`items_main`.`lvl_aexp`, count(`items_users`.`id`) as inGroupCount
-FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`)
-WHERE (( `items_users`.time_create + `items_main`.srok) > unix_timestamp()  OR `items_main`.srok = "0") AND `items_users`.`delete`="0" AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` = "' . mysql_real_escape_string($typeOtdel) . '" and `items_users`.`item_id` = "' . (int)$_GET['itemid'] . '" GROUP BY `items_users`.`uid`, `items_users`.`1price` HAVING `items_users`.inGroup = 0 
-ORDER BY `1price`ASC , inGroupCount DESC');
-            } else {
-                $cl = mysql_query('SELECT `items_users`.`id`,`items_users`.`item_id`,`items_users`.`1price`,`items_users`.`2price`,`items_users`.`uid`,`items_users`.`use_text`,`items_users`.`data`,`items_users`.`inOdet`,`items_users`.`inShop`,`items_users`.`delete`,`items_users`.`iznosNOW`,`items_users`.`iznosMAX`,`items_users`.`gift`,`items_users`.`gtxt1`,`items_users`.`gtxt2`,`items_users`.`kolvo`,`items_users`.`geniration`,`items_users`.`magic_inc`,`items_users`.`maidin`,`items_users`.`lastUPD`,`items_users`.`timeOver`,`items_users`.`overType`,`items_users`.`secret_id`,`items_users`.`time_create`,`items_users`.`inGroup`,`items_users`.`dn_delete`,`items_users`.`inTransfer`,`items_users`.`post_delivery`,`items_users`.`lbtl_`,`items_users`.`bexp`,`items_users`.`so`,`items_users`.`blvl`,`items_main`.`id`,`items_main`.`name`,`items_main`.`img`,`items_main`.`type`,`items_main`.`inslot`,`items_main`.`2h`,`items_main`.`2too`,`items_main`.`iznosMAXi`,`items_main`.`inRazdel`,`items_main`.`price1`,`items_main`.`price2`,`items_main`.`magic_chance`,`items_main`.`info`,`items_main`.`massa`,`items_main`.`level`,`items_main`.`magic_inci`,`items_main`.`overTypei`,`items_main`.`group`,`items_main`.`group_max`,`items_main`.`geni`,`items_main`.`ts`,`items_main`.`srok`,`items_main`.`class`,`items_main`.`class_point`,`items_main`.`anti_class`,`items_main`.`anti_class_point`,`items_main`.`max_text`,`items_main`.`useInBattle`,`items_main`.`lbtl`,`items_main`.`lvl_itm`,`items_main`.`lvl_exp`,`items_main`.`lvl_aexp` FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`) WHERE (( `items_users`.time_create + `items_main`.srok) > unix_timestamp()  OR `items_main`.srok = "0") AND `items_users`.`delete`="0" AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` = "' . mysql_real_escape_string($typeOtdel) . '" GROUP BY `items_users`.`item_id` ORDER BY `items_main`.`id` DESC');
-            }
-        } else {
-            if ($preview == "full") {
-                $cl = mysql_query('SELECT 
-`items_users`.`id` as id, `items_users`.`id` AS `idu`,`items_users`.`item_id` as item_id,`items_users`.`1price`,`items_users`.`2price`,`items_users`.`uid`,`items_users`.`use_text`,
-`items_users`.`data`,`items_users`.`inOdet`,`items_users`.`inShop`,`items_users`.`delete`,`items_users`.`iznosNOW`,`items_users`.`iznosMAX`,
-`items_users`.`gift`,`items_users`.`gtxt1`,`items_users`.`gtxt2`,`items_users`.`kolvo`,`items_users`.`geniration`,`items_users`.`magic_inc`,`items_users`.`maidin`,
-`items_users`.`lastUPD`,`items_users`.`timeOver`,`items_users`.`overType`,`items_users`.`secret_id`,`items_users`.`time_create`,`items_users`.`inGroup`,`items_users`.`dn_delete`,
-`items_users`.`inTransfer`,`items_users`.`post_delivery`,`items_users`.`lbtl_`,`items_users`.`bexp`,`items_users`.`so`,`items_users`.`blvl`,`items_main`.`id` as item_id,`items_main`.`name`,
-`items_main`.`img`,`items_main`.`type`,`items_main`.`inslot`,`items_main`.`2h`,`items_main`.`2too`,`items_main`.`iznosMAXi`,`items_main`.`inRazdel`,`items_main`.`price1`,
-`items_main`.`price2`,`items_main`.`magic_chance`,`items_main`.`info`,`items_main`.`massa`,`items_main`.`level`,`items_main`.`magic_inci`,`items_main`.`overTypei`,
-`items_main`.`group`,`items_main`.`group_max`,`items_main`.`geni`,`items_main`.`ts`,`items_main`.`srok`,`items_main`.`class`,`items_main`.`class_point`,`items_main`.`anti_class`,
-`items_main`.`anti_class_point`,`items_main`.`max_text`,`items_main`.`useInBattle`,`items_main`.`lbtl`,`items_main`.`lvl_itm`,`items_main`.`lvl_exp`,
-`items_main`.`lvl_aexp` , count(`items_users`.`id`) as inGroupCount
-FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`) 
-WHERE (( `items_users`.time_create + `items_main`.srok) > unix_timestamp()  OR `items_main`.srok = "0") AND `items_users`.`delete`="0"  AND `items_users`.`item_id` = "' . (int)$_GET['itemid'] . '"
-AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` != "18" AND `items_main`.`type` != "19" AND `items_main`.`type` != "20" AND `items_main`.`type` != "21" AND `items_main`.`type` != "22" AND `items_main`.`type` != "15" AND `items_main`.`type` != "12" AND `items_main`.`type` != "4" AND `items_main`.`type` != "5" AND `items_main`.`type` != "6" AND `items_main`.`type` != "1" AND `items_main`.`type` != "3" AND `items_main`.`type` != "8" AND `items_main`.`type` != "14" AND `items_main`.`type` != "13" AND `items_main`.`type` != "9" AND `items_main`.`type` != "10" AND `items_main`.`type` != "11" AND `items_main`.`type` != "29" AND `items_main`.`type` != "30" 
-GROUP BY `items_users`.`inGroup`, `items_users`.`uid`,`items_users`.`1price` HAVING `items_users`.inGroup > 0
-UNION ALL 
-SELECT `items_users`.`id` as id, `items_users`.`id` AS `idu`,`items_users`.`item_id` as item_id,`items_users`.`1price`,`items_users`.`2price`,`items_users`.`uid`,`items_users`.`use_text`,
-`items_users`.`data`,`items_users`.`inOdet`,`items_users`.`inShop`,`items_users`.`delete`,`items_users`.`iznosNOW`,`items_users`.`iznosMAX`,
-`items_users`.`gift`,`items_users`.`gtxt1`,`items_users`.`gtxt2`,`items_users`.`kolvo`,`items_users`.`geniration`,`items_users`.`magic_inc`,`items_users`.`maidin`,
-`items_users`.`lastUPD`,`items_users`.`timeOver`,`items_users`.`overType`,`items_users`.`secret_id`,`items_users`.`time_create`,`items_users`.`inGroup`,`items_users`.`dn_delete`,
-`items_users`.`inTransfer`,`items_users`.`post_delivery`,`items_users`.`lbtl_`,`items_users`.`bexp`,`items_users`.`so`,`items_users`.`blvl`,`items_main`.`id` as item_id,`items_main`.`name`,
-`items_main`.`img`,`items_main`.`type`,`items_main`.`inslot`,`items_main`.`2h`,`items_main`.`2too`,`items_main`.`iznosMAXi`,`items_main`.`inRazdel`,`items_main`.`price1`,
-`items_main`.`price2`,`items_main`.`magic_chance`,`items_main`.`info`,`items_main`.`massa`,`items_main`.`level`,`items_main`.`magic_inci`,`items_main`.`overTypei`,
-`items_main`.`group`,`items_main`.`group_max`,`items_main`.`geni`,`items_main`.`ts`,`items_main`.`srok`,`items_main`.`class`,`items_main`.`class_point`,`items_main`.`anti_class`,
-`items_main`.`anti_class_point`,`items_main`.`max_text`,`items_main`.`useInBattle`,`items_main`.`lbtl`,`items_main`.`lvl_itm`,`items_main`.`lvl_exp`,
-`items_main`.`lvl_aexp`, count(`items_users`.`id`) as inGroupCount
-FROM  `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`) 
-WHERE (( `items_users`.time_create + `items_main`.srok) > unix_timestamp()  OR `items_main`.srok = "0") AND `items_users`.`delete`="0"  AND `items_users`.`item_id` = "' . (int)$_GET['itemid'] . '"
-AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` != "18" AND `items_main`.`type` != "19" AND `items_main`.`type` != "20" AND `items_main`.`type` != "21" AND `items_main`.`type` != "22" AND `items_main`.`type` != "15" AND `items_main`.`type` != "12" AND `items_main`.`type` != "4" AND `items_main`.`type` != "5" AND `items_main`.`type` != "6" AND `items_main`.`type` != "1" AND `items_main`.`type` != "3" AND `items_main`.`type` != "8" AND `items_main`.`type` != "14" AND `items_main`.`type` != "13" AND `items_main`.`type` != "9" AND `items_main`.`type` != "10" AND `items_main`.`type` != "11" AND `items_main`.`type` != "29" AND `items_main`.`type` != "30" 
-GROUP BY `items_users`.`uid`,`items_users`.`1price` HAVING `items_users`.inGroup = 0
-ORDER BY `1price`ASC , inGroupCount DESC');
-            } else {
-                $cl = mysql_query('SELECT `items_users`.`id`, `items_users`.`id` AS `idu`,`items_users`.`item_id`,`items_users`.`1price`,`items_users`.`2price`,`items_users`.`uid`,`items_users`.`use_text`,`items_users`.`data`,`items_users`.`inOdet`,`items_users`.`inShop`,`items_users`.`delete`,`items_users`.`iznosNOW`,`items_users`.`iznosMAX`,`items_users`.`gift`,`items_users`.`gtxt1`,`items_users`.`gtxt2`,`items_users`.`kolvo`,`items_users`.`geniration`,`items_users`.`magic_inc`,`items_users`.`maidin`,`items_users`.`lastUPD`,`items_users`.`timeOver`,`items_users`.`overType`,`items_users`.`secret_id`,`items_users`.`time_create`,`items_users`.`inGroup`,`items_users`.`dn_delete`,`items_users`.`inTransfer`,`items_users`.`post_delivery`,`items_users`.`lbtl_`,`items_users`.`bexp`,`items_users`.`so`,`items_users`.`blvl`,`items_main`.`id`,`items_main`.`name`,`items_main`.`img`,`items_main`.`type`,`items_main`.`inslot`,`items_main`.`2h`,`items_main`.`2too`,`items_main`.`iznosMAXi`,`items_main`.`inRazdel`,`items_main`.`price1`,`items_main`.`price2`,`items_main`.`magic_chance`,`items_main`.`info`,`items_main`.`massa`,`items_main`.`level`,`items_main`.`magic_inci`,`items_main`.`overTypei`,`items_main`.`group`,`items_main`.`group_max`,`items_main`.`geni`,`items_main`.`ts`,`items_main`.`srok`,`items_main`.`class`,`items_main`.`class_point`,`items_main`.`anti_class`,`items_main`.`anti_class_point`,`items_main`.`max_text`,`items_main`.`useInBattle`,`items_main`.`lbtl`,`items_main`.`lvl_itm`,`items_main`.`lvl_exp`,`items_main`.`lvl_aexp` FROM `items_users` LEFT JOIN `items_main` ON (`items_main`.`id` = `items_users`.`item_id`) WHERE (( `items_users`.time_create + `items_main`.srok) > unix_timestamp()  OR `items_main`.srok = "0") AND `items_users`.`delete`="0" AND `items_users`.`inOdet`="0" AND `items_users`.`inShop`="30" and `items_main`.`type` != "18" AND `items_main`.`type` != "19" AND `items_main`.`type` != "20" AND `items_main`.`type` != "21" AND `items_main`.`type` != "22" AND `items_main`.`type` != "15" AND `items_main`.`type` != "12" AND `items_main`.`type` != "4" AND `items_main`.`type` != "5" AND `items_main`.`type` != "6" AND `items_main`.`type` != "1" AND `items_main`.`type` != "3" AND `items_main`.`type` != "8" AND `items_main`.`type` != "14" AND `items_main`.`type` != "13" AND `items_main`.`type` != "9" AND `items_main`.`type` != "10" AND `items_main`.`type` != "11" AND `items_main`.`type` != "29" AND `items_main`.`type` != "30" GROUP BY `items_users`.`item_id` ORDER BY `items_main`.`id` DESC');
-            }
-        }
-        $cr = 'c8c8c8';
-        $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 = ['--', '--', '--', '--'];
-            }
-            if ($cr == 'd4d4d4') {
-                $cr = 'c8c8c8';
-            } else {
-                $cr = 'd4d4d4';
-            }
-            if ($preview == "preview" && ($steck[0] > 1 && $steck[0] > $steckCikl)) {
-                ++$steckCikl;
-                continue;
-            } else {
-                $steckCikl = 1;
-                $d = mysql_fetch_array(mysql_query('SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $pl['item_id'] . '" LIMIT 1'));
-                if ($steck[0] > 1 && $preview == "preview") {
-                    $po = $this->lookStats($d['data']);
-                } else {
-                    $po = $this->lookStats($pl['data']);
-                }
-                if (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27) {
-                    //���� ����� +
-                    if ($pl['inOdet'] != 14) {
-                        $po['zonb']++;
-                    }
-                }
-                $is2 = '';
-                $is1 = '<img src="https://img.new-combats.com/i/items/' . $pl['img'] . '"><br>';
-                if ($preview == "full") {
-                    $is1 .= '<a href="?otdel=' . ((int)$_GET['otdel']) . '&toRent=3&itemid=' . (int)$_GET['itemid'] . '&buy=' . $pl[0] . '&sd4=' . $this->info['nextAct'] . '&rnd=' . $code . ' " >������</a> ';
-                } elseif ($preview == "preview") {
-                    $is1 .= '<a href="?otdel=' . ((int)$_GET['otdel']) . '&toRent=3&itemid=' . $pl['item_id'] . ' " >�����������</a> ';
-                }
-                //��������
-
-                $col = $this->itemsX($pl[0]);
-                if ($col > 1 && $pl['inGroup'] != 0 && $pl['inGroupCount'] > 1) {
-                    $pl['kolvo'] = $col;
-                    $pl['name'] .= ' (x' . $col . ')';
-                }
-                $is2 .= '<a href="https://new-combats.com/item/' . $pl['item_id'] . '" target="_blank">' . $pl['name'] . '</a> &nbsp; &nbsp;';
-                if ($pl['massa'] > 0 && $preview == "full") {
-                    $is2 .= '(�����: ' . round($pl['massa'], 2) . ')';
-                    if ($pl['gift'] != '') {
-                        $ttl = '';
-                        if ($pl['gift'] == 1) {
-                            $ttl = '�� �� ������ �������� ���� ������� ����-����';
-                        } else {
-                            $ttl = '���� ������� ������� ' . $pl['gift'] . '. �� �� ������� �������� ���� ������� ����-���� ���';
-                        }
-                        $is2 .= ' <img title="' . $ttl . '" src="https://img.new-combats.com/i/podarok.gif">';
-                    }
-                    if (isset($po['art'])) {
-                        $is2 .= ' <img title="��������" src="https://img.new-combats.com/i/artefact.gif">';
-                    }
-                    if (isset($po['sudba'])) {
-                        if ($po['sudba'] == '0') {
-                            $is2 .= ' <img title="���� ������� ����� ������ ����� ������� � ������, ��� ������� ���. ����� ������ �� ������ ��� ������������." src="https://img.new-combats.com/i/destiny0.gif">';
-                        } elseif ($po['sudba'] == '1') {
-                            $is2 .= ' <img title="���� ������� ����� ������ ����� ������� � ������, ��� ������� �������. ����� ������ �� ������ ��� ������������." src="https://img.new-combats.com/i/destiny0.gif">';
-                        } else {
-                            $is2 .= ' <img title="���� ������� ������ ����� ������� � ' . $po['sudba'] . '. ����� ������ �� ������ ��� ������������." src="https://img.new-combats.com/i/desteny.gif">';
-                        }
-                    }
-                }
-                //����
-                $is2 .= '<br><strong>����: ';
-                if ($steck[0] > 1 && $preview == "preview") {
-                    $is2 .= $steck[3] . '-' . $steck[4] . ' ��.</strong> ';
-                } else {
-                    $is2 .= $pl['1price'] . ' ��.</strong> ';
-                }
-                if ($pl['pricerep'] > 0) {
-                    $is2 .= ' <small><strong>(' . round($pl['pricerep'], 2) . ' ��������������)</strong></small>';
-                }
-
-                //�������������
-                if ($pl['iznosMAX'] > 0) {
-                    $izcol = '';
-                    if (floor($pl['iznosNOW']) >= (floor($pl['iznosMAX']) - ceil($pl['iznosMAX']) / 100 * 20)) {
-                        $izcol = 'brown';
-                    }
-                }
-                if ($preview == "preview") {
-                    $is2 .= '<br>�������������: <font color="' . $izcol . '">' . floor($steck[1]) . '/' . ceil($steck[2]) . '</font>';
-                } else {
-                    if ($pl['iznosMAXi'] == 999999999) {
-                        $is2 .= '<br>�������������: <font color="brown">�����������</font>';
-                    } else {
-                        $is2 .= '<br>�������������: <font color="' . $izcol . '">' . floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']) . '</font>';
-                    }
-                }
-                //���� �������� ��������
-
-                if ($po['srok'] > 0) {
-                    $pl['srok'] = $po['srok'];
-                }
-                if ($pl['srok'] > 0 and $preview != "preview") {
-                    if ($pl['time_create'] + $pl['srok'] < time()) {
-                        $is2 .= '<br>���� ��������: ' . $this->timeOut($pl['srok']) . ' (��������)';
-                    } else {
-                        $is2 .= '<br>���� ��������: ' . $this->timeOut($pl['srok']) . ' (�� ' . date('d.m.Y H:i', $pl['time_create'] + $pl['srok']) . ')';
-                    }
-                } elseif ($pl['srok'] > 0) {
-                    $is2 .= '<br>���� ��������: ' . $this->timeOut($pl['srok']);
-                }
-                if ($pl['magic_chance'] > 0) {
-                    $is2 .= '<br>����������� ������������: ' . 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 .= '<br>����������������� ��������: ' . $this->timeOut($efi['actionTime']);
-                    }
-                }
-                if ($preview == "full" || $preview == "preview") {
-                    //<strong>��������� �����������:</strong>
-                    $tr = '';
-                    $t = $this->items['tr'];
-                    $x = 0;
-                    while ($x < count($t)) {
-                        $n = $t[$x];
-                        if (isset($po['tr_' . $n]) && $po['tr_' . $n] != 0) {
-                            if ($po['tr_' . $n] > $this->stats[$n]) {
-                                if ($n == 'rep') {
-                                    $temp = explode('::', $po['tr_' . $n]);
-                                    if ($this->rep['rep' . $temp[1]] < $temp[0]) {
-                                        $tr .= '<font color="red">';
-                                        $notr++;
-                                    }
-                                    unset($temp);
-                                } elseif ($n != 'align' || floor($this->info['align']) != $po['tr_' . $n]) {
-                                    $tr .= '<font color="red">';
-                                    $notr++;
-                                }
-                            }
-                            $tr .= '<br>� ';
-                            if ($n == 'rep') {
-                                $temp = explode('::', $po['tr_' . $n]);
-                                $tr .= $this->is[$n] . ' ' . ucfirst(str_replace('city', ' city', $temp[1])) . ': ' . $temp[0];
-                                unset($temp);
-                            } elseif ($n != 'align') {
-                                if ($n == 'sex') {
-                                    if ($po['tr_' . $n] == 1) {
-                                        $tr .= $this->is[$n] . ': �������';
-                                    } else {
-                                        $tr .= $this->is[$n] . ': �������';
-                                    }
-                                } else {
-                                    $tr .= $this->is[$n] . ': ' . $po['tr_' . $n];
-                                }
-                            } else {
-                                $tr .= $this->is[$n] . ': ' . $this->align_nm[$po['tr_' . $n]];
-                            }
-                            if ($po['tr_' . $n] > $this->stats[$n]) {
-                                if ($n != 'align' || floor($this->info['align']) != $po['tr_' . $n]) {
-                                    $tr .= '</font>';
-                                }
-                            }
-                        }
-                        $x++;
-                    }
-
-                    if ($tr != '') {
-                        $is2 .= '<br><strong>��������� �����������:</strong>' . $tr;
-                    }
-                    //<strong>��������� ��:</strong>
-                    $tr = '';
-                    $t = $this->items['add'];
-                    $x = 0;
-                    while ($x < count($t)) {
-                        $n = $t[$x];
-                        if (isset($po['add_' . $n], $this->is[$n])) {
-                            $z = '+';
-                            if ($po['add_' . $n] < 0) {
-                                $z = '';
-                            }
-                            $tr .= '<br>� ' . $this->is[$n] . ': ' . $z . '' . $po['add_' . $n];
-                        }
-                        $x++;
-                    }
-                    //��������� �� (�����)
-                    $i = 1;
-                    $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) {
-                                $z = '+';
-                                if ($po['add_mab' . $i] < 0) {
-                                    $z = '';
-                                }
-                                $tr .= '<br>� ����� ' . $bn[$i] . ': ' . $z . '' . $po['add_mab' . $i];
-                            } else {
-                                $tr .= '<br>� ����� ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i] . ' (' . $this->bronFx([$po['add_mib' . $i], $po['add_mab' . $i]]) . ')';
-                            }
-                        }
-                        $i++;
-                    }
-                    if ($tr != '') {
-                        $is2 .= '<br><strong>��������� ��:</strong>' . $tr;
-                    }
-                    //<strong>�������� ��������:</strong>
-                    $tr = '';
-                    $t = $this->items['sv'];
-                    if (isset($po['sv_yron_min'], $po['sv_yron_max'])) {
-                        $tr .= '<br>� ����: ' . $po['sv_yron_min'] . ' - ' . $po['sv_yron_max'];
-                    }
-                    $x = 0;
-                    while ($x < count($t)) {
-                        $n = $t[$x];
-                        if (isset($po['sv_' . $n])) {
-                            $z = '+';
-                            if ($po['sv_' . $n] < 0) {
-                                $z = '';
-                            }
-                            $tr .= '<br>� ' . $this->is[$n] . ': ' . $z . '' . $po['sv_' . $n];
-                        }
-                        $x++;
-                    }
-                    if ($pl['2too'] == 1) {
-                        $tr .= '<br>� ������ ������';
-                    }
-                    if ($pl['2h'] == 1) {
-                        $tr .= '<br>� ��������� ������';
-                    }
-                    if (isset($po['zonb'])) {
-                        $tr .= '<br>� ���� ������������: ';
-                        if ($po['zonb'] > 0) {
-                            $x = 1;
-                            while ($x <= $po['zonb']) {
-                                $tr .= '+';
-                                $x++;
-                            }
-                        } else {
-                            $tr .= '�';
-                        }
-                    }
-
-                    if ($tr != '') {
-                        $is2 .= '<br><strong>�������� ��������:</strong>' . $tr;
-                    }
-
-                    $tr = '';
-
-                    if (isset($po['imposed']) && $po['imposed'] > 0) {
-                        if ($po['imposed_lvl'] == 0) {
-                            $rnc = 'maroon';
-                        } elseif ($po['imposed_lvl'] == 1) {
-                            $rnc = '#624542';
-                        } elseif ($po['imposed_lvl'] == 2) {
-                            $rnc = '#77090b';
-                        } elseif ($po['imposed_lvl'] == 3) {
-                            $rnc = '#d99800';
-                        } else {
-                            $rnc = '#282828';
-                        }
-                        $po['imposed_name'] = str_replace('���� ', '', $po['imposed_name']);
-                        $tr .= '<br>&bull; <font color=' . $rnc . '>�������� ��������:</font> ' . $po['imposed_name'] . ' ';
-                        unset($rnc);
-                    }
-                    if ($tr != '') {
-                        $is2 .= '<br><strong>��������� ��������:</strong>';
-                        $is2 .= $tr;
-                    }
-
-                    if ($notr == 0) {
-                        $d[0] = 1;
-                        if ($pl['magic_inc'] != '') {
-                            $d[2] = 1;
-                        }
-                    }
-                    if (isset($po['free_stats']) && $po['free_stats'] > 0) {
-                        $is2 .= '<br><strong>������������� ������:</strong>';
-                        $is2 .= '&bull; ��������� �������������: ' . $po['free_stats'] . '';
-                    }
-                    if (floor($pl['iznosNOW']) >= ceil($pl['iznosMAX'])) {
-                        $d[0] = 0;
-                        $d[2] = 0;
-                    }
-                    if (isset($po['complect']) || isset($po['complect2'])) {
-                        $is2 .= '<br><i>�������������� ����������:</i>';
-                    }
-                    if (isset($po['complect'])) {
-                        //�� ������������
-                        $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'] .= '&nbsp; &nbsp; &bull; <font color="green">' . $plc['x'] . '</font>: ';
-                            //�������� ���������
-                            $i1c = 0;
-                            $i2c = 0;
-                            $i1e = $this->lookStats($plc['data']);
-                            while ($i1c < count($this->items['add'])) {
-                                if (isset($i1e[$this->items['add'][$i1c]])) {
-                                    $i3c = $i1e[$this->items['add'][$i1c]];
-                                    if ($i3c > 0) {
-                                        $i3c = '+' . $i3c;
-                                    }
-                                    if ($i2c > 0) {
-                                        $com1['text'] .= '&nbsp; &nbsp; ' . $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
-                                    } else {
-                                        $com1['text'] .= $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
-                                    }
-                                    $com1['text'] .= '<br>';
-                                    $i2c++;
-                                }
-                                $i1c++;
-                            }
-                            unset($i1c, $i2c, $i3c);
-                            $com1['x']++;
-                        }
-                        $is2 .= '<br>&bull; ����� ���������: <strong>' . $com1['name'] . '</strong><br><small>';
-                        $is2 .= $com1['text'];
-                        $is2 .= '</small>';
-                    }
-                    if (isset($po['complect2'])) {
-                        //�� ������������
-                        $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'] .= '&nbsp; &nbsp; &bull; <font color="green">' . $plc['x'] . '</font>: ';
-                            //�������� ���������
-                            $i1c = 0;
-                            $i2c = 0;
-                            $i1e = $this->lookStats($plc['data']);
-                            while ($i1c < count($this->items['add'])) {
-                                if (isset($i1e[$this->items['add'][$i1c]])) {
-                                    $i3c = $i1e[$this->items['add'][$i1c]];
-                                    if ($i3c > 0) {
-                                        $i3c = '+' . $i3c;
-                                    }
-                                    if ($i2c > 0) {
-                                        $com1['text'] .= '&nbsp; &nbsp; ' . $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
-                                    } else {
-                                        $com1['text'] .= $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
-                                    }
-                                    $com1['text'] .= '<br>';
-                                    $i2c++;
-                                }
-                                $i1c++;
-                            }
-                            unset($i1c, $i2c, $i3c);
-                            $com1['x']++;
-                        }
-                        $is2 .= '<br>&bull; ����� ��������� (��������): <strong>' . $com1['name'] . '</strong><br><small>';
-                        $is2 .= $com1['text'];
-                        $is2 .= '</small>';
-                    }
-
-                    $is2 .= '<small style="">';
-                    if (isset($po['gravi'])) {
-                        $is2 .= '<br>�� ����������� ������������� �������: <strong>' . $po['gravi'] . '</strong>';
-                    }
-                    if ($pl['info'] != '') {
-                        $is2 .= '<div><strong>������������:</strong></div><div>' . $pl['info'] . '</div>';
-                    }
-                    if ($po['info'] != '') {
-                        $is2 .= '<div>' . $po['info'] . '</div>';
-                    }
-                    if ($pl['max_text'] - $pl['use_text'] > 0) {
-                        $is2 .= '<div>���������� ��������: ' . ($pl['max_text'] - $pl['use_text']) . '</div>';
-                    }
-                    if ($pl['maidin'] != '') {
-                        //	$is2 .= '<div>������� � '.$this->city_name[$pl['maidin']].'</div>';
-                    }
-                    if (isset($po['noremont'])) {
-                        $is2 .= '<div style="color:brown;">������� �� �������� �������</div>';
-                    }
-                    if (isset($po['nosale'])) {
-                        $is2 .= '<div style="color:brown;">������� ������ �������</div>';
-                    }
-                    if (isset($po['nomodif'])) {
-                        $is2 .= '<div style="color:brown;">������� ������ ��������</div>';
-                    }
-                    if (isset($po['nodelete'])) {
-                        $is2 .= '<div style="color:brown;">������� ������ ���������</div>';
-                    }
-                    if (isset($po['frompisher']) && $po['frompisher'] > 0) {
-                        $is2 .= '<div style="color:brown;">������� �� ����������</div>';
-                    }
-                    if (isset($po['sleep_moroz']) && $po['sleep_moroz'] > 0) {
-                        $is2 .= '<div style="color:brown;">������� �� �������� �� ����� ���</div>';
-                    }
-                    if (isset($po['fromlaba']) && $po['fromlaba'] > 0) {
-                        $is2 .= '<div style="color:brown;">������� �� ���������</div>';
-                    }
-                    if (isset($po['vip_sale']) && $po['vip_sale'] > 0) {
-                        $is2 .= '<div style="color:brown;">������� ������ �� 10% �� ���������</div>';
-                    }
-                    if ($pl['dn_delete'] > 0) {
-                        $is2 .= '<div style="color:brown;">������� ����� ������ ��� ������ �� ����������</div>';
-                    }
-                    if ($this->pokol > $pl['geni']) {
-                        $is2 .= '<div style="color:brown">������� �������</div>';
-                    }
-                    if (isset($po['zazuby']) && $po['zazuby'] > 0) {
-                        $is2 .= '<div style="color:brown;">������� ������ �� ����</div>';
-                    }
-                    //$is2 .= '<div>������� � '.$this->city_name[$this->info['city']].'</div>';
-                    $is2 .= '</small>';
-                }
-                if ($preview == "preview") {
-                    $kolvoprint = "<small style=\"float:right; color:grey;\" align=\"right\">����������: <strong>$steck[0]</strong> ��.</small>";
-                }
-                echo '<tr style="background-color:#' . $cr . ';"><td width="100" style="padding:7px;" valign="middle" align="center">' . $is1 . '</td><td style="padding:7px;" valign="top">' . $kolvoprint . $is2 . '</td></tr>';
-                $i++;
-            }
-        }
-        if ($i == 0) echo '<tr style="background-color:#' . $cr . ';"><td style="padding:7px;" align="center" valign="top">�������� �������� ����</td></tr>';
-    }
-
-    public $sid_zuby = [
-        //�������
-        1 => 1, //���
-        9 => 1, //�������
-        8 => 1 //���
-    ];
-
-    public function shopItems($sid, $plu = '')
-    {
-        global $c, $code, $sid;
-
-        $sid_zuby = 0;
-
-        if (isset($this->sid_zuby[$sid])) {
-            $sid_zuby = 1;
-        }
-
-        if ($this->info['admin'] > 0) {
-            $ishp = mysql_fetch_array(mysql_query('SELECT * FROM `items_shop` WHERE `sid` = "' . mysql_real_escape_string($sid) . '" AND `r` = "' . mysql_real_escape_string($_GET['otdel']) . '" AND `item_id` = "' . mysql_real_escape_string($_GET['itmid']) . '" AND `kolvo` > 0 LIMIT 1'));
-            if (isset($_GET['itmup'])) {
-                mysql_query('UPDATE `items_shop` SET `pos` = "' . ($ishp['pos'] - 1) . '" WHERE `sid` = "' . mysql_real_escape_string($sid) . '" AND `r` = "' . mysql_real_escape_string($_GET['otdel']) . '" AND `item_id` = "' . mysql_real_escape_string($_GET['itmid']) . '"  AND `kolvo` > 0 LIMIT 1');
-            } elseif (isset($_GET['itmdown'])) {
-                mysql_query('UPDATE `items_shop` SET `pos` = "' . ($ishp['pos'] + 1) . '" WHERE `sid` = "' . mysql_real_escape_string($sid) . '" AND `r` = "' . mysql_real_escape_string($_GET['otdel']) . '" AND `item_id` = "' . mysql_real_escape_string($_GET['itmid']) . '"  AND `kolvo` > 0 LIMIT 1');
-            }
-        }
-
-
-        $cl = mysql_query('SELECT
-		`ish`.`price_4`,`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`,
-		`ish`.`iid`,`ish`.`item_id`,`ish`.`data2`,`ish`.`iznos`,`ish`.`pos`,`ish`.`cantBuy`,`ish`.`kolvo`,`ish`.`geniration`,`ish`.`magic_inc`,`ish`.`timeOver`,`ish`.`overType`,`ish`.`secret_id`,`ish`.`sid`,`ish`.`r`,`ish`.`price_1`,`ish`.`price_2`,`ish`.`price_3`,`ish`.`level`,`ish`.`tr_items`,`ish`.`max_buy`,`ish`.`real`,`ish`.`nozuby`
-		FROM `items_shop` AS `ish` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `ish`.`item_id`) WHERE `ish`.`sid` = "' . mysql_real_escape_string($sid) . '" AND `ish`.`r` = "' . mysql_real_escape_string($_GET['otdel']) . '" ORDER BY `ish`.`pos` ASC');
-
-        $cr = 'c8c8c8';
-        $i = 0;
-        $jid = 0;
-        while ($pl = mysql_fetch_array($cl)) {
-            if ($pl['kolvo'] > 0) {
-                $jid++;
-                $cr = $cr == 'd4d4d4' ? 'c8c8c8' : 'd4d4d4';
-                if ($pl['price_1'] < 0.01 && $pl['tr_items'] == '') {
-                    $pl['price_1'] = $pl['price1'];
-                }
-                if ($pl['price_2'] < 0.01 && $pl['tr_items'] == '') {
-                    $pl['price_2'] = $pl['price2'];
-                }
-
-                if ($pl['price_1'] < 0) {
-                    $pl['price_1'] = 0;
-                }
-                if ($pl['price_2'] < 0) {
-                    $pl['price_2'] = 0;
-                }
-                $d = mysql_fetch_array(mysql_query('SELECT `id`,`items_id`,`data` FROM `items_main_data` WHERE `items_id` = "' . $pl['id'] . '" LIMIT 1'));
-                $po = $this->lookStats($d['data']);
-
-                if ($sid == 609) {
-                    $po['icos'] = 'WL';
-                }
-
-                if (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27) {
-                    //���� ����� +
-                    $po['zonb']++;
-                }
-
-                $is2 = '';
-                if ($pl['type'] == 71) {
-                    $is1 = '<img width="80" src="https://img.new-combats.com/i/items/' . $pl['img'] . '"><br>';
-                } else {
-                    $is1 = '<img src="https://img.new-combats.com/i/items/' . $pl['img'] . '"><br>';
-                }
-                if ($sid == 609) {
-                    $is1 .= '<span id="shopPlus' . $pl['id'] . '"></span><a href="javascript:void(' . $pl['id'] . ');" onClick="top.buyShopNow(' . $pl['id'] . ',\'?' . $plu . 'otdel=' . ((int)$_GET['otdel']) . '&buy=' . $pl['id'] . '&sd4=' . $this->info['nextAct'] . '&rnd=' . $code . '\',\'' . $pl['name'] . '\',\'??\',\' ??.\');">������</a>';
-                } else {
-                    //if($this->info['money']>$pl['price'])
-                    //{
-                    if ($sid == 2 || $sid == 777) {
-                        $is1 .= '<span id="shopPlus' . $pl['id'] . '"></span><a href="javascript:void(' . $pl['id'] . ');" onClick="top.buyShopNow(' . $pl['id'] . ',\'?' . $plu . 'otdel=' . ((int)$_GET['otdel']) . '&buy=' . $pl['id'] . '&sd4=' . $this->info['nextAct'] . '&rnd=' . $code . '\',\'' . $pl['name'] . '\',\'' . $pl['price_2'] . '\',\' ���.\');">������</a> <a href="javascript:void(0);" onClick="top.payPlus(' . $pl['id'] . ');"><img style="width:11px; height:11px;" src="https://img.new-combats.com/i/up.gif" title="������ ��������� ���������"></a>';
-                    } else {
-                        $is1 .= '<span id="shopPlus' . $pl['id'] . '"></span><a href="javascript:void(' . $pl['id'] . ');" onClick="top.buyShopNow(' . $pl['id'] . ',\'?' . $plu . 'otdel=' . ((int)$_GET['otdel']) . '&buy=' . $pl['id'] . '&sd4=' . $this->info['nextAct'] . '&rnd=' . $code . '\',\'' . $pl['name'] . '\',\'' . $pl['price_1'] . '\',\' ��.\');">������</a> <a href="javascript:void(0);" onClick="top.payPlus(' . $pl['id'] . ');"><img style="width:11px; height:11px;" src="https://img.new-combats.com/i/up.gif" title="������ ��������� ���������"></a>';
-                    }
-                    //}
-
-                    if ($pl['nozuby'] == 0 && $this->info['level'] > 0 && $this->info['level'] < 8 && $pl['level'] < 8 && $sid_zuby == 1 && $c['zuby']) {
-                        $is1 .= '<br><a href="javascript:void(' . $pl['id'] . ');" onClick="top.buyShopNow(' . $pl['id'] . ',\'?' . $plu . 'otdel=' . ((int)$_GET['otdel']) . '&zuby=1&buy=' . $pl['id'] . '&sd4=' . $this->info['nextAct'] . '&rnd=' . $code . '\',\'' . $pl['name'] . '\',\'' . $pl['price_1'] . '\',\' (����)\');">������ �� ����</a>';
-                    }
-                }
-
-                //��������
-
-                if (isset($po['tr_align']) && !isset($po['tr_align_bs'])) {
-                    $pl['name'] .= '<img width=12 height=15 src=https://img.new-combats.com/i/align/align' . $po['tr_align'] . '.gif >';
-                } elseif (isset($po['tr_align_bs'])) {
-                    if ($po['tr_align_bs'] == '1') {
-                        $pl['name'] .= '<img width=12 height=15 src=https://img.new-combats.com/i/align/align1.75.gif >';
-                    } elseif ($po['tr_align_bs'] == '3') {
-                        $pl['name'] .= '<img width=12 height=15 src=https://img.new-combats.com/i/align/align3.01.gif >';
-                    }
-                }
-
-                if (isset($po['renameadd']) && $po['renameadd'] != '') {
-                    $pl['name'] .= ' (�������: ' . $po['renameadd'] . ')';
-                }
-                if (isset($po['icos'])) {
-                    $pl['name'] = '<span class="icos_' . $po['icos'] . '">' . $pl['name'] . ' <span><small>&nbsp;' . $po['icos'] . '&nbsp;</small></span></span>';
-                }
-                $is2 .= '<a name="sit_' . $pl['id'] . '" href="https://new-combats.com/item/' . $pl['item_id'] . '" target="_blank">' . $pl['name'] . '</a> &nbsp; &nbsp;';
-
-
-                if ($pl['massa'] > 0) {
-                    $is2 .= '(�����: ' . round($pl['massa'], 2) . ')';
-                }
-
-                if (isset($po['art'])) {
-                    $is2 .= ' <img title="��������" src="https://img.new-combats.com/i/artefact.gif">';
-                }
-
-                if (isset($po['sudba'])) {
-                    if ($po['sudba'] == '0') {
-                        $is2 .= ' <img title="���� ������� ����� ������ ����� ������� � ������, ��� ������� ���. ����� ������ �� ������ ��� ������������." src="https://img.new-combats.com/i/destiny0.gif">';
-                    } elseif ($po['sudba'] == '1') {
-                        $is2 .= ' <img title="���� ������� ����� ������ ����� ������� � ������, ��� ������� �������. ����� ������ �� ������ ��� ������������." src="https://img.new-combats.com/i/destiny0.gif">';
-                    } else {
-                        $is2 .= ' <img title="���� ������� ������ ����� ������� � ' . $po['sudba'] . '. ����� ������ �� ������ ��� ������������." src="https://img.new-combats.com/i/desteny.gif">';
-                    }
-                }
-
-                //����
-                if ($this->info['admin'] > 0) {
-                    $is2 .= '<div style="float:right"> <a href="?otdel=' . round($_GET['otdel']) . '&itmid=' . $pl['id'] . '&itmup=1&rnd=' . microtime() . '#itmdown' . $pl['id'] . '">&uarr;</a> &nbsp; ' . $pl['pos'] . ' &nbsp; <a name="itmdown' . $pl['id'] . '" id="itmdown' . $pl['id'] . '" href="?rand=' . microtime() . '&otdel=' . round($_GET['otdel']) . '&itmid=' . $pl['id'] . '&itmdown=1#itmdown' . $pl['id'] . '">&darr;</a></div>';
-                }
-                $is2 .= '<br><strong>����: ';
-                if ($this->stats['silver'] >= 1 && $sid == 1) {
-                    $is2 .= '<strike>';
-                } elseif ($this->stats['silver'] >= 5 && ($sid == 2 || $sid == 777)) {
-                    $is2 .= '<strike>';
-                }
-                if ($sid == 609) {
-                    if ($pl['price_4'] > ($this->rep['rep3'] - $this->rep['rep3_buy'])) {
-                        $is2 .= '<font color="red">' . round($pl['price_4']) . '</font>';
-                    } else {
-                        $is2 .= '<font color="green">' . round($pl['price_4']) . '</font>';
-                    }
-
-                    $is2 .= '</strong> <strong></strong> �������������� ';
-                } elseif ($pl['price_3'] > 0) {
-                    if ($pl['price_3'] > $this->info['money3']) {
-                        $is2 .= '<font color="red">' . $pl['price_3'] . '</font>';
-                    } else {
-                        $is2 .= $pl['price_3'];
-                    }
-                    $is2 .= ' $ </strong> ';
-                } elseif ($sid == 2 || $sid == 777) {
-                    $is .= '<span style="color:#f93737">';
-                    if ($pl['price_2'] > $this->info['money2']) {
-                        $is2 .= '<font color="red">' . $pl['price_2'] . '</font>';
-                    } else {
-                        $is2 .= $pl['price_2'];
-                    }
-                    $is2 .= ' ���.</strong></span> ';
-                } else {
-                    if ($pl['price_1'] > $this->info['money']) {
-                        $is2 .= '<font color="red">' . $pl['price_1'] . '</font>';
-                    } else {
-                        $is2 .= $pl['price_1'];
-                    }
-                    $is2 .= ' ��.</strong> ';
-                }
-                if ($this->stats['silver'] >= 1 && $sid == 1) {
-                    $is2 .= '</strike> &nbsp; <strong>';
-                    if ($pl['price_1'] > $this->info['money']) {
-                        $is2 .= '<font color="red">' . round($pl['price_1'] * 0.95, 2) . '</font>';
-                    } else {
-                        $is2 .= round($pl['price_1'] * 0.95, 2);
-                    }
-                    $is2 .= ' ��.</strong> <sup><small style=color:blue; >������ -5%</small></sup>';
-                } elseif ($this->stats['silver'] >= 5 && ($sid == 2 || $sid == 777)) {
-                    $is2 .= '</strike> &nbsp; <strong>';
-                    if ($pl['price_2'] > $this->info['money2']) {
-                        $is2 .= '<font color="red">' . round($pl['price_2'] * 0.95, 2) . '</font>';
-                    } else {
-                        $is2 .= round($pl['price_2'] * 0.95, 2);
-                    }
-                    $is2 .= ' ���.</strong> <sup><small style=color:blue; >������ -5%</small></sup>';
-                }
-
-                if ($pl['pricerep'] > 0) {
-                    $is2 .= ' <small><strong>(' . round($pl['pricerep'], 2) . ' ��������������)</strong></small>';
-                }
-
-                if ($pl['kolvo'] < 100000) {
-                    $is2 .= ' &nbsp; &nbsp; <small>(����������: <strong>' . $pl['kolvo'] . '</strong>)</small>';
-                }
-
-                if ($pl['nozuby'] == 0 && $sid != 609 && $c['zuby'] == true) {
-                    if ($this->info['level'] > 0 && $this->info['level'] < 8) {
-                        if ($pl['level'] < 8 && $sid_zuby == 1) {
-                            if ($this->stats['silver'] > 0 && $sid == 1) {
-                                $is2 .= ' (<small>' . ltrim($this->zuby(round($pl['price_1'] * 0.95, 2)), ' ') . '</small>)';
-                            } else {
-                                $is2 .= ' (<small>' . ltrim($this->zuby($pl['price_1']), ' ') . '</small>)';
-                            }
-                        }
-                    }
-                }
-
-                if ($pl['tr_items'] != '') {
-                    $ttmm = '';
-                    $trn = 1;
-                    $tims2 = explode(',', $pl['tr_items']);
-                    $j = 0;
-                    while ($j < count($tims2)) {
-                        $tims = explode('=', $tims2[$j]);
-                        if ($tims[0] > 0 && $tims[1] > 0) {
-                            $tis = 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` = "' . $tims[0] . '" LIMIT 1'));
-                            if (isset($tis['id'])) {
-                                $num_rows = 0;
-                                $s1p = 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)$tims[0]) . '" AND `uid` = "' . $this->info['id'] . '" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0"');
-                                while ($p1l = mysql_fetch_array($s1p)) {
-                                    $num_rows++;
-                                }
-                                if ($num_rows < (int)$tims[1]) {
-                                    $trn = 0;
-                                }
-                                $ttmm .= '[<strong>' . $tis['name'] . '</strong>] x' . $tims[1] . ', ';
-                            }
-                        }
-                        $j++;
-                    }
-                    if ($c['noitembuy'] == true) {
-                        $trn = 1;
-                        $ttmm = '';
-                    }
-
-                    if ($ttmm != '') {
-                        $ttmm = '<br>������� �������: ' . rtrim($ttmm, ', ') . ' ';
-                        if ($trn == 0) {
-                            $ttmm = '<font color="red">' . $ttmm . '</font>';
-                        }
-                    }
-                }
-
-                $is2 .= $ttmm . ' <br>';
-                unset($ttmm);
-
-
-                //�������������
-                if ($pl['iznos'] > 0) {
-                    $pl['iznosMAXi'] = $pl['iznos'];
-                }
-                if ($pl['iznosMAXi'] > 0) {
-                    if ($pl['iznosMAXi'] == 999999999) {
-                        $is2 .= '�������������: <font color=brown>�����������</font > <br>';
-                    } else {
-                        $is2 .= '�������������: 0/' . $pl['iznosMAXi'] . '<br>';
-                    }
-                }
-
-                if ($po['battleUseZd'] > 0) {
-                    $is2 .= '�������� �������������: ' . $this->timeOut($po['battleUseZd']) . '<br>';
-                }
-
-                $is2 = rtrim($is2, '<br>');
-
-                //���� �������� ��������
-                if ($po['srok'] > 0) {
-                    $pl['srok'] = $po['srok'];
-                }
-                if ($pl['srok'] > 0) {
-                    $is2 .= '<br>���� ��������: ' . $this->timeOut($pl['srok']);
-                }
-                if ($pl['magic_chance'] > 0) {
-                    $is2 .= '<br>����������� ������������: ' . 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 .= '<br>����������������� ��������: ' . $this->timeOut($efi['actionTime']);
-                    }
-                }
-
-                //<strong>��������� �����������:</strong>
-                $tr = '';
-                $t = $this->items['tr'];
-                $x = 0;
-                while ($x < count($t)) {
-                    $n = $t[$x];
-                    if (isset($po['tr_' . $n]) && $po['tr_' . $n] != 0) {
-                        if ($po['tr_' . $n] > $this->stats[$n]) {
-                            if ($n == 'rep') {
-                                $temp = explode('::', $po['tr_' . $n]);
-                                if ($this->rep['rep' . $temp[1]] < $temp[0]) {
-                                    $tr .= '<font color="red">';
-                                    $notr++;
-                                }
-                                unset($temp);
-                            } elseif ($n != 'align' || floor($this->info['align']) != $po['tr_' . $n]) {
-                                $tr .= '<font color="red">';
-                                $notr++;
-                            }
-                        }
-                        $tr .= '<br>� ';
-                        if ($n == 'rep') {
-                            $temp = explode('::', $po['tr_' . $n]);
-                            $tr .= $this->is[$n] . ' ' . ucfirst(str_replace('city', ' city', $temp[1])) . ': ' . $temp[0];
-                            unset($temp);
-                        } elseif ($n != 'align') {
-                            if ($n == 'sex') {
-                                if ($po['tr_' . $n] == 1) {
-                                    $tr .= $this->is[$n] . ': �������';
-                                } else {
-                                    $tr .= $this->is[$n] . ': �������';
-                                }
-                            } else {
-                                $tr .= $this->is[$n] . ': ' . $po['tr_' . $n];
-                            }
-                        } else {
-                            $tr .= $this->is[$n] . ': ' . $this->align_nm[$po['tr_' . $n]];
-                        }
-                        if ($po['tr_' . $n] > $this->stats[$n]) {
-                            if ($n != 'align' || floor($this->info['align']) != $po['tr_' . $n]) {
-                                $tr .= '</font>';
-                            }
-                        }
-                    }
-                    $x++;
-                }
-                if ($tr != '') {
-
-                    $is2 .= '<br><strong>��������� �����������:</strong>' . $tr;
-                }
-                //<strong>��������� ��:</strong>
-                $tr = '';
-                $t = $this->items['add'];
-                $x = 0;
-                while ($x < count($t)) {
-                    $n = $t[$x];
-                    if (isset($po['add_' . $n], $this->is[$n])) {
-                        $z = '+';
-                        if ($po['add_' . $n] < 0) {
-                            $z = '';
-                        }
-                        $tr .= '<br>� ' . $this->is[$n] . ': ' . $z . '' . $po['add_' . $n];
-                    }
-                    $x++;
-                }
-                //��������� �� (�����)
-                $i = 1;
-                $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) {
-                            $z = '+';
-                            if ($po['add_mab' . $i] < 0) {
-                                $z = '';
-                            }
-                            $tr .= '<br>� ����� ' . $bn[$i] . ': ' . $z . '' . $po['add_mab' . $i];
-                        } else {
-                            $tr .= '<br>� ����� ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i];
-                        }
-                    }
-                    $i++;
-                }
-
-                if ($tr != '') {
-                    $is2 .= '<br><strong>��������� ��:</strong>' . $tr;
-                }
-                //<strong>�������� ��������:</strong>
-                $tr = '';
-                $t = $this->items['sv'];
-                if (isset($po['sv_yron_min'], $po['sv_yron_max'])) {
-                    $tr .= '<br>� ����: ' . $po['sv_yron_min'] . ' - ' . $po['sv_yron_max'];
-                }
-                $x = 0;
-                while ($x < count($t)) {
-                    $n = $t[$x];
-                    if (isset($po['sv_' . $n])) {
-                        $z = '+';
-                        if ($po['sv_' . $n] < 0) {
-                            $z = '';
-                        }
-                        $tr .= '<br>� ' . $this->is[$n] . ': ' . $z . '' . $po['sv_' . $n];
-                    }
-                    $x++;
-                }
-                if ($pl['2too'] == 1) {
-                    $tr .= '<br>� ������ ������';
-                }
-                if ($pl['2h'] == 1) {
-                    $tr .= '<br>� ��������� ������';
-                }
-                if (isset($po['zonb'])) {
-                    $tr .= '<br>� ���� ������������: ';
-                    if ($po['zonb'] > 0) {
-                        $x = 1;
-                        while ($x <= $po['zonb']) {
-                            $tr .= '+';
-                            $x++;
-                        }
-                    } else {
-                        $tr .= '�';
-                    }
-                }
-                if ($tr != '') {
-                    $is2 .= '<br><strong>�������� ��������:</strong>' . $tr;
-                }
-
-                //�����������
-
-                $tr = '';
-
-                if (isset($po['imposed']) && $po['imposed'] > 0) {
-                    if ($po['imposed_lvl'] == 0) {
-                        $rnc = 'maroon';
-                    } elseif ($po['imposed_lvl'] == 1) {
-                        $rnc = '#624542';
-                    } elseif ($po['imposed_lvl'] == 2) {
-                        $rnc = '#77090b';
-                    } elseif ($po['imposed_lvl'] == 3) {
-                        $rnc = '#d99800';
-                    } else {
-                        $rnc = '#282828';
-                    }
-                    $po['imposed_name'] = str_replace('���� ', '', $po['imposed_name']);
-                    $tr .= '<br>&bull; <font color=' . $rnc . '>�������� ��������:</font> ' . $po['imposed_name'] . ' ';
-                    unset($rnc);
-                }
-                if ($tr != '') {
-                    $is2 .= '<br><strong>��������� ��������:</strong>';
-                    $is2 .= $tr;
-                }
-
-
-                if ($notr == 0) {
-                    $d[0] = 1;
-                    if ($pl['magic_inc'] != '') {
-                        $d[2] = 1;
-                    }
-                }
-
-                if (isset($po['free_stats']) && $po['free_stats'] > 0) {
-                    $is2 .= '<br><strong>������������� ������:</strong><br>';
-                    $is2 .= '&bull; ��������� �������������: +' . $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 .= '<div> �������� �������� <img height=18 title="' . $mgi['mname'] . '" src="https://img.new-combats.com/i/eff/' . $mgi['img'] . '"> ' . $mgi['minfo'] . '</div>';
-                    }
-                }
-
-                if (floor($pl['iznosNOW']) >= ceil($pl['iznosMAX'])) {
-                    $d[0] = 0;
-                    $d[2] = 0;
-                }
-                if (isset($po['complect'])) {
-                    $is2 .= '<br><i>�������������� ����������:</i>';
-                }
-                if (isset($po['complect'])) {
-                    //�� ������������
-                    $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'] .= '&nbsp; &nbsp; &bull; <font color="green">' . $plc['x'] . '</font>: ';
-                        //�������� ���������
-                        $i1c = 0;
-                        $i2c = 0;
-                        $i1e = $this->lookStats($plc['data']);
-                        while ($i1c < count($this->items['add'])) {
-                            if (isset($i1e[$this->items['add'][$i1c]])) {
-                                $i3c = $i1e[$this->items['add'][$i1c]];
-                                if ($i3c > 0) {
-                                    $i3c = '+' . $i3c;
-                                }
-                                if ($i2c > 0) {
-                                    $com1['text'] .= '&nbsp; &nbsp; ' . $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
-                                } else {
-                                    $com1['text'] .= $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
-                                }
-                                $com1['text'] .= '<br>';
-                                $i2c++;
-                            }
-                            $i1c++;
-                        }
-                        unset($i1c, $i2c, $i3c);
-                        $com1['x']++;
-                    }
-                    $is2 .= '<br>&bull; ����� ���������: <strong>' . $com1['name'] . '</strong><br><small>';
-                    $is2 .= $com1['text'];
-                    $is2 .= '</small>';
-                }
-
-                if ($pl['max_text'] - $pl['use_text'] > 0) {
-                    $is2 .= '<div>���������� ��������: ' . ($pl['max_text'] - $pl['use_text']) . '</div>';
-                }
-
-                $is2 .= '<small style="">';
-
-                if (isset($po['gravi'])) {
-                    $is2 .= '<br>�� ����������� ������������� �������: <strong>' . $po['gravi'] . '</strong>';
-                }
-
-                if ($pl['info'] != '') {
-                    $is2 .= '<div><strong>������������:</strong></div><div>' . $pl['info'] . '</div>';
-                }
-
-                if ($po['info'] != '') {
-                    $is2 .= '<div>' . $po['info'] . '</div>';
-                }
-
-                if (isset($po['noremont'])) {
-                    $is2 .= '<div style="color:brown;">������� �� �������� �������</div>';
-                }
-
-                if (isset($po['nosale'])) {
-                    $is2 .= '<div style="color:brown;">������� ������ �������</div>';
-                }
-
-                if (isset($po['nomodif'])) {
-                    $is2 .= '<div style="color:brown;">������� ������ ��������</div>';
-                }
-
-                if (isset($po['nodelete'])) {
-                    $is2 .= '<div style="color:brown;">������� ������ ���������</div>';
-                }
-
-                if (isset($po['frompisher']) && $po['frompisher'] > 0) {
-                    $is2 .= '<div style="color:brown;">������� �� ����������</div>';
-                }
-
-                if (isset($po['sleep_moroz']) && $po['sleep_moroz'] > 0) {
-                    $is2 .= '<div style="color:brown;">������� �� �������� �� ����� ���</div>';
-                }
-
-                if (isset($po['fromlaba']) && $po['fromlaba'] > 0) {
-                    $is2 .= '<div style="color:brown;">������� �� ���������</div>';
-                }
-
-                if (isset($po['vip_sale']) && $po['vip_sale'] > 0) {
-                    $is2 .= '<div style="color:brown;">������� ������ �� 10% �� ���������</div>';
-                }
-
-                if ($pl['dn_delete'] > 0) {
-                    $is2 .= '<div style="color:brown;">������� ����� ������ ��� ������ �� ����������</div>';
-                }
-
-                if ($this->pokol > $pl['geni']) {
-                    $is2 .= '<div style="color:brown">������� �������</div>';
-                }
-
-                if (isset($po['zazuby']) && $po['zazuby'] > 0) {
-                    $is2 .= '<div style="color:brown;">������� ������ �� ����</div>';
-                }
-
-                $is2 .= '</small>';
-
-                $crd = '';
-
-                if ($this->info['admin'] > 0) {
-                    $crd = '<small><a href="javascript:window.open(\'https://new-combats.com/item_edit_data.php?edit_item_data=' . $pl['id'] . '\',\'winEdi1\',\'width=850,height=400,top=400,left=500,resizable=no,scrollbars=yes,status=no\');" target="_blank">������������� �������</a> &nbsp; <a href="https://new-combats.com/main.php?timeWorld=' . microtime() . '&otdel=' . round((int)$_GET['otdel']) . '#itmShop' . $pl['id'] . '" name="itmShop' . $pl['id'] . '">��������</a></small><br>';
-                }
-
-                echo '<tr style="background-color:#' . $cr . ';"><td width="100" style="padding:7px;" valign="middle" align="center">' . $is1 . '</td><td style="padding:7px;" valign="top"><span style="float:right">&nbsp;' . $crd . '</span>' . $is2 . '</td></tr>';
-                $i++;
-            }
-
-        }
-        if ($i == 0) {
-            echo '<tr style="background-color:#' . $cr . ';"><td style="padding:7px;" align="center" valign="top">�������� �������� ����</td></tr>';
-        }
-    }
-
-    public function price($vl)
-    {
-        if ($vl == round($vl)) {
-            $vl = $vl . '.00';
-        }
-        $vl = explode('.', $vl);
-        $vl = $vl[0] . '.<small>' . $vl[1] . '</small>';
-        return $vl;
-    }
-
-    public function testBagStats()
-    {
-        $st = $this->lookStats($this->info['stats']);
-        $n1 = $this->info['ability'];
-        $i = 1;
-        while ($i <= 10) {
-            $n1 += $st['s' . $i];
-            $i++;
-        }
-        $n2 = $this->info['skills'];
-        $i = 1;
-        while ($i <= 7) {
-            $n2 += $st['a' . $i] + $st['mg' . $i];
-            $i++;
-        }
-
-        $n01 = 12;
-        $n02 = 1;
-        $ll = 0;
-        $lvl = mysql_query('SELECT `bprice`,`upLevel`,`nextLevel`,`exp`,`money`,`money_bonus1`,`money_bonus2`,`ability`,`skills`,`nskills`,`sskills`,`expBtlMax`,`hpRegen`,`mpRegen`,`money2` FROM `levels` WHERE `upLevel` < "' . $this->info['upLevel'] . '"');
-        while ($pl = mysql_fetch_array($lvl)) {
-            $n01 += $pl['ability'];
-            $n02 += $pl['skills'];
-            if ($ll < $pl['nextLevel']) {
-                $n01 += 1; //�����
-                if ($this->info['level'] >= 9) {
-                    $n01 += 1;
-                }
-                if ($this->info['level'] >= 10) {
-                    $n01 += 2;
-                }
-                if ($this->info['level'] >= 11) {
-                    $n01 += 4;
-                }
-                $ll++;
-            }
-        }
-
-        if ($n1 - $n01 != 3 || $n2 != $n02) {
-            if ($this->info['bagStats'] != $bg) {
-                $bg = '[' . $n1 . '|' . $n01 . '|' . $n2 . '|' . $n02 . ']';
-                mysql_query('UPDATE `stats` SET `bagStats` = "' . $bg . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-                $this->info['bagStats'] = $bg;
-            }
-        } else {
-            if ($this->info['bagStats'] != '0') {
-                mysql_query('UPDATE `stats` SET `bagStats` = "0" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-                $this->info['bagStats'] = 0;
-            }
-        }
-    }
-
-    public function wipe()
-    {
-        if ($this->info['wipe'] > 0 && $this->info['battle'] == 0) {
-            //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']; //�����������
-                $n4 = $this->info['nskills']; //???
-                if ($this->info['wipe'] == 1 || $this->info['wipe'] == 2) {
-                    $i = 1;
-                    while ($i <= 11) {
-                        if ($i <= 4) {
-                            $n1 += $st['s' . $i] - 3;
-                            $st['s' . $i] = 3;
-                        } else {
-                            $n1 += $st['s' . $i];
-                            $st['s' . $i] = 0;
-                        }
-                        $i++;
-                    }
-                    $n1 -= $this->info['level'];
-                    $st['s4'] = 3 + $this->info['level'];
-                    if ($this->info['level'] >= 9) {
-                        $st['s4'] += 1;
-                        $n1 -= 1;
-                    }
-                    if ($this->info['level'] >= 10) {
-                        $st['s4'] += 2;
-                        $n1 -= 2;
-                    }
-                    if ($this->info['level'] >= 11) {
-                        $st['s4'] += 4;
-                        $n1 -= 4;
-                    }
-                }
-
-                if ($this->info['wipe'] == 1 || $this->info['wipe'] == 3) {
-                    $i = 1;
-                    while ($i <= 7) {
-                        $n2 += $st['a' . $i];
-                        $n2 += $st['mg' . $i];
-                        $st['a' . $i] = 0;
-                        $st['mg' . $i] = 0;
-                        $i++;
-                    }
-                }
-                if ($this->info['wipe'] == 1 || $this->info['wipe'] == 3.5)#---����� ������������
-                {
-                    $i = 1;
-                    while ($i <= 11) {
-                        $n3 += $st['os' . $i];
-                        $st['os' . $i] = 0;
-                        $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) {
-                    $this->info['stats'] = $st;
-                    $this->info['ability'] = $n1;
-                    $this->info['skills'] = $n2;
-                    $this->info['sskills'] = $n3;
-                    $this->info['nskills'] = $n4;
-                }
-            }
-        }
-    }
-
-    public function __clone()
-    {
-        trigger_error('������������ �� �����������.', E_USER_ERROR);
-    }
-
-    //������� ���������� �������� ��� ��� �������������
-    public function trItem($po)
-    {
-        $tr = '';
-        $t = $this->items['tr'];
-        $x = 0;
-        $notr = 0;
-        while ($x < count($t)) {
-            $n = $t[$x];
-            if (isset($po['tr_' . $n])) {
-                if ($n == 'sex') {
-                    if ($this->info['sex'] != $po['tr_' . $n]) {
-                        $notr++;
-                    }
-                } elseif ($po['tr_' . $n] > $this->stats[$n] && $n != 'align') {
-                    $notr++;
-                }
-            }
-            $x++;
-        }
-        return $notr;
-    }
-
-    public function freeStatsMod($id, $s, $uid)
-    {
-        $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`.`id` = "' . ((int)$id) . '" AND `iu`.`uid` = "' . $uid . '" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0" LIMIT 1'));
-        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'];
-                    $po['mf_stats'] -= 1;
-                    $po['add_' . $_GET['mf']] += 1;
-
-                    $po = $this->impStats($po);
-                    mysql_query('UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
-                }
-            } elseif ($_GET['mf'] == 'm1' || $_GET['mf'] == 'm2' || $_GET['mf'] == 'm4' || $_GET['mf'] == 'm5') {
-                if (isset($po['mf_mod']) && $po['mf_mod'] > 0 && isset($po['add_' . $_GET['mf']])) {
-                    $po['mf_mod'] = (int)$po['mf_mod'];
-                    $po['mf_mod'] -= 1;
-                    $po['add_' . $_GET['mf']] += 1;
-
-                    $po = $this->impStats($po);
-                    mysql_query('UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
-                }
-            } elseif ($_GET['mf'] == 'mib1' || $_GET['mf'] == 'mib2' || $_GET['mf'] == 'mib3' || $_GET['mf'] == 'mib4') {
-                $s = $_GET['mf'];
-                $s = str_replace('mib', '', $s);
-                $s = (int)$s;
-                if (isset($po['mf_mib']) && $po['mf_mib'] > 0 && (isset($po['add_mib' . $s]) || isset($po['add_mab' . $s]))) {
-                    $po['mf_mib'] = (int)$po['mf_mib'];
-                    $po['mf_mib'] -= 1;
-                    if (isset($po['add_mab' . $s])) {
-                        $po['add_mab' . $s] += 1;
-                    }
-                    if (isset($po['add_mib' . $s])) {
-                        $po['add_mib' . $s] += 1;
-                    }
-
-                    $po = $this->impStats($po);
-                    mysql_query('UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
-                }
-            }
-        }
-    }
-
-    public function freeStatsItem($id, $s, $uid)
-    {
-        $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`.`id` = "' . ((int)$id) . '" AND `iu`.`uid` = "' . $uid . '" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0" LIMIT 1'));
-        if (isset($itm['id']) && ($s == 1 || $s == 2 || $s == 3 || $s == 5)) {
-            $po = $this->lookStats($itm['data']);
-            if (isset($po['free_stats']) && $po['free_stats'] > 0) {
-                $s = (int)$s;
-                if ($s >= 1 || $s <= 3 || $s == 5) {
-                    $po['free_stats'] = (int)$po['free_stats'];
-                    $po['free_stats'] -= 1;
-                    $po['add_s' . $s] += 1;
-                }
-            }
-            $po = $this->impStats($po);
-
-            mysql_query('UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
-        }
-    }
-
-    public function freeStats2Item($id, $s, $uid, $tp)
-    {
-
-        $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`.`id` = "' . ((int)$id) . '" AND `iu`.`uid` = "' . $uid . '" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0" LIMIT 1'));
-        if (isset($itm['id'])) {
-            $po = $this->lookStats($itm['data']);
-            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 = '�������������� ��������...';
-                        } else {
-                            $this->error = '�� ������� ����� ��������...';
-                        }
-                    }
-                } elseif ($tp == 2) {
-                    //��
-                    if ($s > 0 && $s < 13) {
-                        $s2 = 0;
-                        if ($s == 9 || $s == 12) {
-                            if ($s == 9) {
-                                $s = 'm10';
-                            } elseif ($s == 12) {
-                                $s = 'zm';
-                            }
-                            $s2 = 4 + 4 * $po['add_' . $s];
-                        } else {
-                            if ($s == 1) {
-                                $s = 'm1';
-                            } elseif ($s == 2) {
-                                $s = 'm2';
-                            } elseif ($s == 3) {
-                                $s = 'm4';
-                            } elseif ($s == 4) {
-                                $s = 'm5';
-                            } elseif ($s == 5) {
-                                $s = 'mab1';
-                            } elseif ($s == 6) {
-                                $s = 'mab2';
-                            } elseif ($s == 7) {
-                                $s = 'mab3';
-                            } elseif ($s == 8) {
-                                $s = 'mab4';
-                            } elseif ($s == 10) {
-                                $s = 'za';
-                            } elseif ($s == 11) {
-                                $s = 'm11a';
-                            }
-                            $s2 = 5 + 5 * $po['add_' . $s];
-                        }
-
-                        if (4 + 4 * $po['add_' . $s] <= $itm['so'] && $itm['so'] > 0) {
-                            $itm['so'] -= $s2;
-                            if ($s == 'mab1') {
-                                $po['add_mib1']++;
-                            } elseif ($s == 'mab2') {
-                                $po['add_mib2']++;
-                            } elseif ($s == 'mab3') {
-                                $po['add_mib3']++;
-                            } elseif ($s == 'mab4') {
-                                $po['add_mib4']++;
-                            }
-                            $po['add_' . $s]++;
-                        } else {
-                            $this->error = '�� ������� ����� ��������...';
-                        }
-                    }
-                }
-            }
-            $po = $this->impStats($po);
-            mysql_query('UPDATE `items_users` SET `data` = "' . $po . '",`so` = "' . $itm['so'] . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
-        }
-    }
-
-    public function obj_addItem($id)
-    {
-        $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 = '�� ������� ����� ������� ��������.';
-        } elseif (isset($itm['id'])) {
-            if (isset($itm['inGroup']) and $itm['inGroup'] > 0) {
-                $col = $this->itemsX($itm['id']);
-                if ($col > 1) {
-                    $upd = mysql_query('UPDATE `items_users` SET `inShop` = 1 WHERE `item_id`="' . $itm['item_id'] . '" AND `inShop` != "30" AND `uid`="' . $itm['uid'] . '" AND `inGroup` = "' . $itm['inGroup'] . '" LIMIT ' . $col . '');
-                } else {
-                    $upd = mysql_query('UPDATE `items_users` SET `inShop` = 1 WHERE `uid` = "' . $this->info['id'] . '" AND `inShop` != "30" AND `id` = "' . $itm['id'] . '" AND `inOdet` = "0" AND `delete` = "0" ');
-                }
-            } else {
-                $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 = '������� �� ������ � �������';
-        }
-    }
-
-    public function obj_takeItem($id)
-    {
-        $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 = '�� ������� ����� ������� ��������.';
-        } elseif (isset($itm['id'])) {
-            if (isset($itm['inGroup']) && $itm['inGroup'] > 0) {
-                $col = $this->itemsX($itm['id']);
-                if ($col > 1) {
-                    $upd = mysql_query('UPDATE `items_users` SET `inShop` = 0 WHERE `uid` = "' . $this->info['id'] . '" AND ( `id` = "' . $itm['id'] . '" OR `inGroup` = "' . $itm['inGroup'] . '") AND `inShop` != "30" AND `inOdet` = "0" AND `delete` = "0" ');
-                } else {
-                    $upd = mysql_query('UPDATE `items_users` SET `inShop` = 0 WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $itm['id'] . '" AND `inShop` != "30" AND `inOdet` = "0" AND `delete` = "0" ');
-                }
-            } else {
-                $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 = '������� �� ������ � �������';
-        }
-    }
-
-    public function itemsSmSave($id, $s, $uid)
-    {
-        $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`.`id` = "' . ((int)$id) . '" AND `iu`.`uid` = "' . $uid . '" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0" LIMIT 1'));
-        if (isset($itm['id'])) {
-            $s = (int)$s;
-            $po = $this->lookStats($itm['data']);
-            if (!isset($po['sudba']) || $po['sudba'] != '0') {
-                if (isset($po['sm_skill']) && $s > 100) {
-                    $mx2 = 1;
-                    $mx1 = 0;
-                    $mx3 = $this->lookStats($this->info['stats']);
-                    while ($mx2 <= 7) {
-                        $mx1 += ($mx3['a' . $mx2] + $mx3['mg' . $mx2]) - ($po['add_a' . $mx2] + $po['add_mg' . $mx2]);
-                        $mx2++;
-                    }
-                    $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]++;
-                        }
-                    }
-                } elseif (isset($po['sm_abil']) && $s < 11 && $s > 0) {
-                    $mx2 = 1;
-                    $mx1 = 0;
-                    $mx3 = $this->lookStats($this->info['stats']);
-                    while ($mx2 <= 7) {
-                        $mx1 += $mx3['s' . $mx2] - $po['add_s' . $mx2];
-                        $mx2++;
-                    }
-                    $mx1 += $this->info['ability'];
-                    if ($mx1 > 0) {
-                        $po['add_s' . $s]++;
-                    }
-                }
-
-                $po = $this->impStats($po);
-                mysql_query('UPDATE `items_users` SET `data` = "' . $po . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
-
-                unset($mx1, $mx2, $mx3, $po);
-            }
-        }
-    }
-
-    public function runeItem($id, $name = 0, $ruid = 0)
-    {
-
-        if ($id == null) {
-
-            if ($ruid < 1 && isset($_GET['use_rune'])) {
-                $ruid = $_GET['use_rune'];
-                echo "
-				<script language='JavaScript'>
-				var elem = document.getElementById('se-pre-con');
-				elem.parentNode.removeChild(elem);
-				</script>
-				";
-            }
-            $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`.`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'));
-
-            $it_type = 0;
-            if (isset($_GET['item_rune'])) {
-                $name = $_GET['item_rune'];
-            }
-            $vi = 0;
-            $vid = '';
-            if (isset($_GET['item_rune_id'])) {
-                $sp = 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`.`type`,`m`.`2h`,`m`.`inslot`,`m`.`name`,`m`.`img` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON (`i`.`item_id` = `m`.`id`)
-					WHERE `i`.`inShop` = "0" AND
-					
-					( (`m`.`inslot` > 0 AND `m`.`inslot` < 18) OR "' . $rune['type'] . '" = "37" OR `m`.`inslot` = "51" )
-					
-				AND `i`.`delete` = "0" AND `i`.`inOdet` = "0" AND `i`.`id` = "' . mysql_real_escape_string($_GET['item_rune_id']) . '" AND `i`.`uid` = "' . mysql_real_escape_string($this->info['id']) . '"');
-                $vi = -1;
-            } else {
-                $sp = 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`.`type`,`m`.`2h`,`m`.`inslot`,`m`.`name`,`m`.`img` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON (`i`.`item_id` = `m`.`id`)
-				
-					WHERE	
-							
-				( (`m`.`inslot` > 0 AND `m`.`inslot` < 18) OR "' . $rune['type'] . '" = "37" OR `m`.`inslot` = "51" ) AND
-				
-				`i`.`inShop` = "0" AND `i`.`delete` = "0" AND `i`.`inOdet` = "0" AND `m`.`name` LIKE "%' . mysql_real_escape_string(str_replace('"', '&quot;', $name)) . '%" AND `i`.`uid` = "' . mysql_real_escape_string($this->info['id']) . '"');
-            }
-            while ($pl = mysql_fetch_array($sp)) {
-                $vibor .= '<img src="https://img.new-combats.com/i/items/' . $pl['img'] . '"><hr>';
-                if (!isset($id['id'])) {
-                    //if($pl['type']!=4 && $pl['type']!=2 && $pl['type']!=7 ) {
-                    $dt = $this->lookStats($pl['data']);
-                    $id = [];
-                    $id = $pl;
-                    $id_type = $pl['type'];
-                    //}
-                }
-                if ($vi != -1) {
-                    $vi++;
-                    $vid .= '`iu`.`id` = "' . $pl[0] . '" OR';
-                }
-            }
-        }
-
-        if ($vi > 0) {
-            $itm_inv = $this->genInv(80, ' ' . rtrim($vid, 'OR') . ' ');
-            echo '<button style="float:right" class="btn" type="button" onclick="top.frames[\'main\'].location=\'main.php?inv=1&otdel=' . floor($_GET['otdel']) . '\'">���������</button><strong>�������� ������� ��� ������������� &quot;' . $rune['name'] . '&quot;:</strong><br><br><table width="100%" border="0" cellspacing="1" align="center" cellpadding="0" bgcolor="#A5A5A5">' . $itm_inv[2] . '</table>';
-            die();
-        } else {
-            unset($rune);
-        }
-
-        if ($id['id'] > 0) {
-
-            if ($ruid < 1 && isset($_GET['use_rune'])) {
-                $ruid = $_GET['use_rune'];
-            }
-
-            $idtrue = false;
-
-            $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`.`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 = '� ��� ������� ��������� ������� ����� ������������ ��� ����';
-            } elseif ($rune['type'] == 31) {
-                //���������� ����
-                if ($idt['type'] == 7) {
-                    $idt['type'] = 6;
-                }
-                if ($idt['type'] == 5) {
-                    $idt['type'] = 6;
-                }
-                if ($idt['type'] == 4) {
-                    $idt['type'] = 6;
-                }
-                $data = $this->lookStats($id['data']);
-                $type_rune = [
-                    '��' => 9, //������
-                    '��' => 10, //��������
-                    '��' => 11, //������
-                    '��' => 12, //��������
-                    '��' => 14, //������
-                    '��' => 15, //�����
-                    '��' => 1, //����
-                    '��' => 3, //������
-                    '��' => 6, //�����
-                    '��' => 8  //����
-                ];
-                if ($rune['type'] == 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 . ')';
-                } elseif (isset($data['nomodif'])) {
-                    $this->error = '�������� ������ ������� ����������';
-                } elseif (isset($data['art']) && $data['tr_lvl'] < 0) {
-                    $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'));
-                        $j = 0;
-                        $data_r = $this->lookStats($ritm['data']);
-                        while ($j < count($this->items['add'])) {
-                            if (isset($data_r['add_' . $this->items['add'][$j]])) {
-                                $data['add_' . $this->items['add'][$j]] -= $data_r['add_' . $this->items['add'][$j]];
-                            }
-                            $j++;
-                        }
-                    }
-                    $data['rune'] = $rune['id'];
-                    $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'])) {
-                        if (isset($add['add_' . $this->items['add'][$i]])) {
-                            $data['add_' . $this->items['add'][$i]] += $add['add_' . $this->items['add'][$i]];
-                        }
-                        $i++;
-                    }
-
-                    $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 `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1');
-
-
-                    $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 = '�������� ������� �� ������������ �� �������';
-                } 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'));
-
-                    $data = $this->lookStats($id['data']);
-                    $add = $this->lookStats($rune['data']);
-                    if (isset($data['nomodif'])) {
-                        $this->error = '�������� ������ ������� ����������';
-                    } elseif (isset($data['art']) && $data['tr_lvl'] < 0) {
-                        $this->error = '����������� �������� � ��������� ���� 10-�� ������ ����������';
-                    } else {
-                        if (isset($data['spell']) && $data['spell'] > 0) {
-
-                            if (isset($data['spell_st_val_hp'])) {
-                                $data['add_hpAll'] -= $data['spell_st_val_hp'];
-                                unset($data['spell_st_val_hp']);
-                            }
-                            if (isset($data['addspell_mpAll'])) {
-                                $data['add_mpAll'] -= $data['addspell_mpAll'];
-                                unset($data['addspell_mpAll']);
-                            }
-
-
-                            unset($data['spell']);
-                            if (isset($data['spell_id'])) {
-                                unset($data['spell_id']);
-                            }
-                            if (isset($data['spell_name'])) {
-                                unset($data['spell_name']);
-                            }
-                            if (isset($data['spell_lvl'])) {
-                                unset($data['spell_lvl']);
-                            }
-                            if (isset($data['spell_st_name'])) {
-                                $data['add_' . $data['spell_st_name']] -= $data['spell_st_val'];
-                                if ($data['add_' . $data['spell_st_name']] == 0) {
-                                    unset($data['add_' . $data['spell_st_name']]);
-                                }
-                                unset($data['spell_st_name']);
-                            }
-                            if (isset($data['spell_st_val'])) {
-                                unset($data['spell_st_val']);
-                            }
-
-                        }
-                        //����� �����
-
-                        $srune = mysql_query('SELECT * FROM `new_charov` WHERE 1');
-                        $irun = 0;
-                        while ($nrune = mysql_fetch_array($srune)) {
-                            $irun++;
-                            $ntrune[$irun] = $nrune;
-                        }
-                        if ($irun > 0) {
-                            $addrune = $ntrune[rand(1, $irun)];
-                            $addrunes = rand($addrune['min'], $addrune['max']);
-                            if (isset($data['add_' . $addrune['gname']])) {
-                                $data['add_' . $addrune['gname']] += $addrunes;
-                            } else {
-                                $data['add_' . $addrune['gname']] = $addrunes;
-                            }
-                        }
-                        $data['spell'] = $rune['id'];
-                        if (!isset($data['sudba'])) {
-                            $data['sudba'] = '0';
-                        }
-                        $data['spell_name'] = '�����������'; //$info
-                        $data['spell_st_name'] = $addrune['gname'];
-                        $data['spell_st_val'] = $addrunes;
-                        $data['spell_id'] = $rune['item_id'];
-                        $data['spell_lvl'] = 8;
-
-
-                        //
-                        $data = $this->impStats($data);
-                        unset($srune, $irun, $nrune, $ntrune, $addrune, $addrunes);
-                        $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 = '��������� ������ �������!';
-                        } else {
-                            $this->error = '��� �� ����� �� ���!';
-                        }
-                        unset($tid);
-                    }
-                    //-----------------------------------------------
-
-                } elseif ($rune['type'] == 62) {
-
-                    $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'));
-                    if ($idt['type'] == 7) {
-                        $idt['type'] = 6;
-                    }
-                    if ($idt['type'] == 5) {
-                        $idt['type'] = 6;
-                    }
-                    if ($idt['type'] == 4) {
-                        $idt['type'] = 6;
-                    }
-                    //$id['type'] = $idt['type'];
-                    //���������� ����
-                    $data = $this->lookStats($id['data']);
-                    $add = $this->lookStats($rune['data']);
-                    if (isset($data['nomodif'])) {
-                        $this->error = '�������� ������ ������� ����������';
-                    } elseif (isset($data['art']) && $data['tr_lvl'] < 0) {
-                        $this->error = '����������� �������� � ��������� ���� 10-�� ������ ����������';
-                        /*}elseif(isset($data['spell_id']) && $data['spell_id'] == 6167) {
-						$this->error = '��� ����� ������������ ������';*/
-                    } elseif (isset($add['onimposed'])) {
-                        //���������� �����
-                        //����� �����
-                        $i = 0;
-                        $j = 0;
-                        $utp = explode(',', $add['onItemType']);
-                        while ($i < count($utp)) {
-                            if ($utp[$i] == $id['type']) {
-                                $j++;
-                            }
-                            $i++;
-                        }
-                        if ($j > 0) {
-
-                            unset($data['imposed'], $data['imposed_name'], $data['bm_a1']);
-
-                            $imposed = [
-                                'imposed' => 1,
-                                'imposed_name' => $add['onSpellName'],
-                                'bm_a1' => $add['onSpellFile']
-                            ];
-
-                            if (!isset($add['onSpellFile'])) {
-                                unset($imposed['bm_a1']);
-                                //
-                                if (isset($add['onSpell_mpAll'])) {
-                                    $imposed['addspell_mpAll'] = $add['onSpell_mpAll'];
-                                    $imposed['add_mpAll'] = $data['add_mpAll'] + $add['onSpell_mpAll'] - $data['addspell_mpAll'];
-                                }
-                                //
-                            }
-
-                            $imposed['sudba'] = 1;
-
-                            $data = array_merge($data, $imposed);
-                            $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 `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1');
-                            $this->error = '�������� ���� "' . $add['onSpellName'] . '" �� ������� &quot;' . $id['name'] . '&quot;';
-                        } else {
-                            $this->error = '������� &quot;' . $id['name'] . '&quot; �� �������� ��� ��������.,.';
-                        }
-                    } 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']);
-                            $pvr = [
-                                'i' => 0,
-                                'spell' => [],
-                                'rune' => [],
-                                'atack' => [],
-                                'podgon' => []
-                            ];
-
-                            if (isset($data['podgon'])) {
-                                if ($data['tr_lvl'] > $id['level']) {
-                                    $id['level'] = $data['tr_lvl'];
-                                }
-                                $pvr['podgon']['hpAll'] = 6 * $id['level'] + 6;
-                            }
-                            if (isset($data['addspell_hpAll'])) {
-                                $pvr['podgon']['hpAll'] += $data['addspell_hpAll'];
-                            }
-                            if (isset($data['rune_id']) && $data['rune_id'] > 0) {
-                                $ritm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "' . $data['rune_id'] . '" LIMIT 1'));
-                                $j = 0;
-                                $data_r = $this->lookStats($ritm['data']);
-                                while ($j < count($this->items['add'])) {
-                                    if (isset($data_r['add_' . $this->items['add'][$j]])) {
-                                        $pvr['rune'][$this->items['add'][$j]] = $data_r['add_' . $this->items['add'][$j]];
-                                    }
-                                    $j++;
-                                }
-                            }
-
-                            if (isset($data['spell_st_val_hp'])) {
-                                $data['add_hpAll'] -= $data['spell_st_val_hp'];
-                            }
-
-                            //$i = 0;
-                            //while( $i < count($data)) {
-                            if (!isset($data['spell_st_name'])) {
-                                $delk = count($this->items['add']);
-                                $this->items['add'][] = 'mib1';
-                                $this->items['add'][] = 'mib2';
-                                $this->items['add'][] = 'mib3';
-                                $this->items['add'][] = 'mib4';
-                                $this->items['add'][] = 'mab1';
-                                $this->items['add'][] = 'mab2';
-                                $this->items['add'][] = 'mab3';
-                                $this->items['add'][] = 'mab4';
-                                $j = 0;
-                                while ($j < count($this->items['add'])) {
-                                    if (isset($data['add_' . $this->items['add'][$j]])) {
-                                        if ($data_l['add_' . $this->items['add'][$j]] != $data['add_' . $this->items['add'][$j]] - $pvr['rune'][$this->items['add'][$j]] - $pvr['podgon'][$this->items['add'][$j]]) {
-                                            //echo ''.$this->items['add'][$j].' -> '.$data_l['add_'.$this->items['add'][$j]].' / '.$data['add_'.$this->items['add'][$j]].'<br>';
-                                            if (!isset($data_l['add_' . $this->items['add'][$j]])) {
-                                                unset($data['add_' . $this->items['add'][$j]]);
-                                            } else {
-                                                $data['add_' . $this->items['add'][$j]] = $data_l['add_' . $this->items['add'][$j]];
-                                            }
-                                        }
-                                    }
-                                    $j++;
-                                }
-                                $i = 0;
-                                while ($i < 8) {
-                                    unset($this->items['add'][$delk + $i]);
-                                    $i++;
-                                }
-
-                            }
-                        }
-                        //����� �����
-                        $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;
-                                while ($j < count($this->items['add'])) {
-                                    if (isset($add[$tw . 'add' . $utp[$i] . '_' . $this->items['add'][$j]])) {
-                                        $rnda[count($rnda)] = $this->items['add'][$j];
-                                    }
-                                    $j++;
-                                }
-
-                                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;
-                                    ];
-                                    if (isset($add['imposed_name'])) $imposed['imposed_name'] = $add['imposed_name'];
-                                    if (isset($add['imposed_level'])) $imposed['imposed_level'] = $add['imposed_level'];
-                                    $rnda[0] = 1;
-                                }
-                                if (count($rnda) >= 0) {
-                                    $rnda = $rnda[rand(0, count($rnda) - 1)];
-                                    if ($rnda == 'mib1' || $rnda == 'mib2' || $rnda == 'mib3' || $rnda == 'mib4') {
-                                        $rnda = str_replace('mib', 'mab', $rnda);
-                                    }
-
-                                    if (!isset($this->is[$rnda]) && isset($imposed)) {
-                                        $data = array_merge($data, $imposed);
-                                        $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 `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1');
-                                        $this->error = '�������� ���� "' . $imposed['imposed_name'] . '" �� ������� &quot;' . $id['name'] . '&quot;';
-
-                                    } elseif (!isset($this->is[$rnda])
-                                        && $rnda != 'mib1' && $rnda != 'mib2' && $rnda != 'mib3' && $rnda != 'mib4'
-                                        && $rnda != 'mab1' && $rnda != 'mab2' && $rnda != 'mab3' && $rnda != 'mab4'
-                                    ) {
-                                        $this->error = '���������� �������� ������� �����. ( ' . $rnda . ' )';
-                                    } else {
-                                        $data['add_' . $rnda] += $add[$tw . 'add' . $utp[$i] . '_' . $rnda];
-                                        if ($rnda == 'mab1' || $rnda == 'mab2' || $rnda == 'mab3' || $rnda == 'mab4') {
-                                            $data['add_' . str_replace('mab', 'mib', $rnda)] += $add[$tw . 'add' . $utp[$i] . '_' . $rnda];
-                                        }
-
-                                        $data['spell'] = $rune['id'];
-                                        if (!isset($data['sudba'])) {
-                                            $data['sudba'] = '0';
-                                        }
-
-                                        if (isset($data['spell_st_name'])) {
-                                            $data['add_' . $data['spell_st_name']] -= $data['spell_st_val'];
-                                            if ($data['spell_st_name'] == 'mab1' || $data['spell_st_name'] == 'mab2' || $data['spell_st_name'] == 'mab3' || $data['spell_st_name'] == 'mab4') {
-                                                $data['add_' . str_replace('mab', 'mib', $data['spell_st_name'])] -= $data['spell_st_val'];
-                                            }
-
-                                            if ($data['add_' . $data['spell_st_name']] == 0) {
-                                                unset($data['add_' . $data['spell_st_name']]);
-                                            }
-                                        }
-
-                                        $data['spell_id'] = $rune['item_id'];
-                                        $data['spell_name'] = $rune['name'];
-                                        $data['spell_lvl'] = $rune['level'];
-                                        $data['spell_st_name'] = $rnda;
-                                        $data['spell_st_val'] = $add[$tw . 'add' . $utp[$i] . '_' . $rnda];
-                                        if (isset($add['addspell_hpAll'])) {
-                                            $data['spell_st_val_hp'] = $add['addspell_hpAll'];
-                                            $data['add_hpAll'] += $add['addspell_hpAll'];
-                                        } else {
-                                            unset($data['spell_st_val_hp']);
-                                        }
-                                        $data = $this->impStats($data);
-
-                                        $this->is['mab1'] = '����� ������';
-                                        $this->is['mab2'] = '����� �������';
-                                        $this->is['mab3'] = '����� �����';
-                                        $this->is['mab4'] = '����� ���';
-                                        $this->error = '��������� �������������� �������� &quot;' . $id['name'] . '&quot;, ' . $this->is[$rnda] . ': +' . $add[$tw . 'add' . $utp[$i] . '_' . $rnda];
-
-
-                                        unset($this->is['mab1'], $this->is['mab2'], $this->is['mab3'], $this->is['mab4']);
-
-                                        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');
-                                    }
-                                } else {
-                                    $this->error = '���-�� �� ���, ���������� ���������� ������ �������';
-                                }
-                                $i = 100499;
-                            }
-                            $i++;
-                        }
-                        if ($i < 100500) {
-                            $this->error = '������ ������� �� �������� ��� �����������...';
-                        }
-                    }
-
-                } elseif ($rune['type'] == 47) {
-                    $add = $this->lookStats($id['data']);
-                    $data = $this->lookStats($rune['data']);
-                    if ($add['art'] == 1) {
-                        if ($id['iznosNOW'] > 0) {
-                            $id['iznosNOW'] -= $data['repairLevel'];
-                            if ($id['iznosNOW'] < 0) {
-                                $id['iznosNOW'] = 0;
-                            }
-                            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'] . ' ������� ��������������.';
-                        } else {
-                            $this->error = '������� �� ���������� � �������...';
-                        }
-                    } else {
-                        $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'));
-                    if ($idt['type'] == 5) {
-                        $idt['type'] = 6;
-                    }
-                    $id['type'] = $idt['type'];
-                    if ($id_type < 18 || $id_type > 24) {
-                        $add = $this->lookStats($rune['data']);
-                        if (isset($add['uptimeitem'])) {
-                            $data = $this->lookStats($id['data']);
-                            if ($data['srok'] > 0 || $id['srok'] > 0) {
-                                if (!isset($data['srok'])) {
-                                    $data['srok'] = $id['srok'];
-                                }
-                                if ($data['srok'] + $id['time_create'] - time() > 86400 + 30) {
-                                    $this->error = '������ ������������ �� �������� � ������ �������� 30 � ����� ����.';
-                                } elseif ($id['inslot'] > 0 && $id['inslot'] < 20) {
-                                    $this->error = '���� �������� �������� &quot;' . $id['name'] . '&quot; ������� �� ' . $this->timeOut($add['uptimeitem']) . '.';
-
-                                    if (isset($data['sleep_moroz'])) {
-                                        unset($data['sleep_moroz']);
-                                    }
-
-                                    $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 `data` = "' . $data . '",`time_create` = `time_create` + ' . floor($add['uptimeitem']) . ' WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1');
-
-                                } else {
-                                    $this->error = '������� ������� ���� ������ ��������...';
-                                }
-                            } else {
-                                $this->error = '��� �������� ������ �� �������� � ������ ��������...';
-                            }
-                        } else {
-                            $this->error = '���������� ����� ������ ������...';
-                        }
-                    } else {
-                        //�������
-                        $data = $this->lookStats($id['data']);
-                        $add = $this->lookStats($rune['data']);
-                        if (isset($data['upatack_id'])) {
-                            $this->error = '������� ��� �������, �������� ������� � ��������� ����������.';
-                        } elseif (isset($data['nomodif'])) {
-                            $this->error = '�������� ������ ������� ����������';
-                        } elseif ($add['uptype'] != $id_type || $add['uptype'] == 0) {
-                            $this->error = '������� �� �������� � ������� ��������...';
-                        } else {
-
-                            if (isset($data['upatack_id']) && $data['upatack_id'] > 0) {
-                                $ritm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = "' . $data['upatack_id'] . '" LIMIT 1'));
-                                $data_r = $this->lookStats($ritm['data']);
-                                if ($id_type == 22) {
-                                    $data['add_m11'] -= $data_r['upatack']; //*2
-                                    $data['sv_yron_min'] -= $data_r['upatack'];
-                                    $data['sv_yron_max'] -= $data_r['upatack'];
-                                } elseif ($id['2h'] == 1) {
-                                    $data['sv_yron_min'] -= $data_r['upatack']; //*2
-                                    $data['sv_yron_max'] -= $data_r['upatack']; //*2
-                                } else {
-                                    $data['sv_yron_min'] -= $data_r['upatack'];
-                                    $data['sv_yron_max'] -= $data_r['upatack'];
-                                }
-                            }
-                            $data['upatack'] = $rune['id'];
-                            $data['upatack_id'] = $rune['item_id'];
-                            $data['upatack_name'] = $rune['name'];
-                            $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]])) {
-                                    $data['add_' . $this->items['add'][$i]] += $add['add_' . $this->items['add'][$i]];
-                                }
-                                $i++;
-                            }
-
-                            $data['sv_yron_min'] += $add['upatack'];
-                            $data['sv_yron_max'] += $add['upatack'];
-
-                            $this->addDelo(2, $this->info['id'], '&quot;<font color="#4863A0">System.remont.upatack</font>&quot;: ������� &quot;' . $data['upatack_name'] . '&quot; ���� ������� <strong>��������</strong> � ������� &quot;' . $id['name'] . '&quot; [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 = '������� &quot;' . $id['name'] . '&quot; ������ �������';
-                        }
-                    }
-                } 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 ������ �������';
-                    } elseif (isset($data['nomodif'])) {
-                        $this->error = '�������� ������ ������� ����������';
-                    } elseif ($add['uptype'] != $id_type || $add['uptype'] == 0) {
-                        $this->error = '������� �� �������� � ������� ��������...';
-                    } else {
-
-                        if ($add['tya1'] == 1) {
-
-                            $data['tya1'] += $add['tya1'];
-                            if ($data['tya3'] > 10) {
-                                $data['tya3'] -= $add['tya1'];
-                            }
-
-                        } elseif ($add['tya2'] == 1) {
-
-                            $data['tya2'] += $add['tya2'];
-                            if ($data['tya4'] > 10) {
-                                $data['tya4'] -= $add['tya2'];
-                            }
-
-                        } elseif ($add['tya3'] == 1) {
-
-                            $data['tya3'] += $add['tya3'];
-                            if ($data['tya1'] > 10) {
-                                $data['tya1'] -= $add['tya3'];
-                            }
-
-                        } elseif ($add['tya4'] == 1) {
-
-                            $data['tya4'] += $add['tya4'];
-                            if ($data['tya2'] > 10) {
-                                $data['tya2'] -= $add['tya4'];
-                            }
-
-                        }
-
-
-                        $this->addDelo(2, $this->info['id'], '&quot;<font color="#4863A0">System.remont.upatack</font>&quot;: ������� &quot;' . $data['upatack_name'] . '&quot; ���� ������� <strong>��������</strong> � ������� &quot;' . $id['name'] . '&quot; [itm:' . $id['id'] . ']', time(), $this->info['city'], 'System.remont.upatack', 0, 0);
-                        $this->error = '������� &quot;' . $id['name'] . '&quot; ������ �������! �����:' . $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 = '�������������� &quot;' . $id['name'] . '&quot; ������ �������! [' . 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 = '������� &quot;' . $id['name'] . '&quot; ����� ������������ �������� ���������! [' . round($id['iznosNOW']) . '/' . round($id['iznosMAX']) . ']';
-                        }
-                    } else {
-                        $this->error = '������ ������� �� �������� ��� ��������������!!';
-                    }
-
-
-                } elseif ($rune['type'] == 68) {
-                    $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'));
-                    if ($idt['type'] == 5) {
-                        $idt['type'] = 6;
-                    }
-                    $id['type'] = $idt['type'];
-
-                    //���������� ����
-                    $data = $this->lookStats($id['data']);
-                    $add = $this->lookStats($rune['data']);
-                    if (isset($data['nomodif'])) {
-                        $this->error = '�������� ������ ������� ����������';
-                    } elseif (!isset($data['close']) && $data['close'] != 0) {
-                        $this->error = '�� �������� � ������� ��������, �� �� ������...';
-                    } else {
-                        $data['unopen'] = $rune['id'];
-                        $data['unopen_id'] = $rune['item_id'];
-                        $data['unopen_name'] = $rune['name'];
-
-                        unset($data['close']);
-
-                        $data['open'] = 1;
-
-                        $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 `data` = "' . $data . '" WHERE `id` = "' . $id['id'] . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1');
-                        $this->error = '�������� &quot;' . $id['name'] . '&quot; ������ �������';
-                    }
-
-                } elseif ($rune['type'] == 37) {
-                    $idt = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $id['item_id'] . '" LIMIT 1'));
-                    if ($idt['type'] != 37) {
-                        //
-                        $data = $this->lookStats($id['data']);
-                        $add = $this->lookStats($rune['data']);
-                        //
-                        if ($id['gift'] == '' || $id['gift'] == '0') {
-                            if (isset($data['notransfer'])) {
-                                $this->error = '������� ������ ����������...';
-                            } elseif (isset($data['sudba']) && $data['sudba'] != 0) {
-                                $this->error = '������� ������ ����� �������...';
-                            } else {
-                                if (isset($add['item_inbox']) && $add['item_inbox'] > 0) {
-                                    $this->error = '� �������� ��� ���-�� ����, �������� ������� �������!';
-                                } elseif ($id['inTransfer'] > 0 || $id['inShop'] > 0 || $id['inGroup'] > 0) {
-                                    $this->error = '������ �������� ���� �������, �� � ��������, �� �������� ��� � ������...';
-                                } else {
-                                    //���������� ������� � ��������
-                                    $add['item_inbox'] = $id['id'];
-                                    $add['open'] = 1;
-                                    $add['nosale'] = 1;
-                                    $add = $this->impStats($add);
-                                    //
-                                    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 = '������� &quot;' . $idt['name'] . '&quot; �������� � �������.';
-                                    //
-                                }
-                            }
-                        } else {
-                            $this->error = '�������� �� �����...';
-                        }
-                        //
-                    } else {
-                        $this->error = '�� �� ������� ��������� ��������...';
-                    }
-                } else {
-                    $this->error = '(' . $rune['type'] . ') �������� ������� �� ������������ �� �������...';
-                }
-            }
-        } else {
-            $this->error = '����������� �������� �� �������...';
-        }
-    }
-
-    public function floordec($zahl, $decimals = 2)
-    {
-        return floor($zahl * pow(10, $decimals)) / pow(10, $decimals);
-    }
-
-    public function testBattle($id)
-    {
-        $r = true;
-        if ($id == 0) {
-            $r = false;
-        } else {
-            $btla = mysql_fetch_array(mysql_query('SELECT `id`,`team_win` FROM `battle` WHERE `id` = "' . mysql_real_escape_string($id) . '" LIMIT 1'));
-            if (isset($btla['id']) && $btla['team_win'] > -1) {
-                $r = false;
-            }
-        }
-        return $r;
-    }
-
-    public function testVipItems($slot_new)
-    {
-        $sp = mysql_query('SELECT `i`.`id`,`m`.`type`,`i`.`2price`,`m`.`price2` FROM `items_users` AS `i` LEFT JOIN `items_main` AS `m` ON `m`.`id` = `i`.`item_id` WHERE `i`.`uid` = "' . $this->info['id'] . '" AND `i`.`delete` = "0" AND `i`.`data` LIKE "%vip_sale%" LIMIT 20');
-        $itm = [];
-        $slot = [];
-        $j = 0;
-        if ($slot_new > 0) {
-            $itm[$j] = ['new'];
-            $slot[$slot_new][] = $j;
-            $j++;
-        }
-        $r = true;
-        while ($pl = mysql_fetch_array($sp)) {
-            $itm[$j] = $pl;
-            $slot[$pl['type']][] = $j;
-            $j++;
-        }
-        $l = count($slot[18]) + count($slot[19]) + count($slot[20]) + count($slot[21]) + count($slot[22]) + count($slot[23]) + count($slot[24]) + count($slot[25]) + count($slot[26]) + count($slot[27]) + count($slot[28]);
-        $v = count($slot[9]) + count($slot[10]) + count($slot[11]);
-        $a = count($itm) - $l - $v;
-        if ($this->stats['silver'] == 2) {
-            // 3 ��������� (1������ � ��� ����� ��������)
-            if ($j > 3 || $l > 1 || $v > 0) {
-                $r = false;
-            }
-        } elseif ($this->stats['silver'] == 3) {
-            // 6 ���������� (1 ������, 1 �������� � 4 ���� �� �����)
-            if ($j > 6 || $l > 1 || $v > 1) {
-                $r = false;
-            }
-        } elseif ($this->stats['silver'] == 4) {
-            // 9 ���������� (2 ������, 2 �������� � 5 ����� �� �����)
-            if ($j > 9 || $l > 2 || $v > 2) {
-                $r = false;
-            }
-        }
-        return $r;
-    }
-
-    public function berezCena()
-    {
-        global $c;
-        $r = 0;
-        if ($this->stats['silver'] > 0) {
-            $r = 50 + (($this->stats['silver'] - 1) * 5);
-            $r = $r / 100;
-        }
-        $r = $c['shop_type2'];
-        //$r = 1; //������ 100%
-        $r = round(($r / 100), 2);
-        return $r;
-    }
-
-    public function genInv($type, $sort)
-    {
-        global $c, $code;
-
-        $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];
-            if ($sort[1] != '') $sort = $sort[1] . ''; else $sort = '';
-        } else {
-            $where = $sort[0];
-            $sort = ' `lastUPD`  DESC';
-        }
-        $cl = mysql_query('SELECT count(`iu`.item_id) as inGroupCount, `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`.`so`,`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  ' . $where . ' GROUP BY `im`.id,`iu`.item_id, `iu`.inGroup HAVING `iu`.inGroup > 0  UNION ALL SELECT count(`iu`.item_id) as inGroupCount, `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`.`so`,`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`.inGroup=0 AND ' . $where . ' GROUP BY `iu`.id, `iu`.item_id ORDER BY ' . $sort . ' 
-');
-
-        if ($type == 15) {
-            $anm = 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 `id` = "' . $this->info['animal'] . '" AND `pet_in_cage` = 0 AND `delete` = "0" LIMIT 1'));
-        }
-        while ($pl = mysql_fetch_array($cl)) {
-            if ($type == 30) {
-                $ChSudba = $this->lookStats($pl['data']);
-                if (isset($ChSudba['sudba']) || $ChSudba['sudba'] != 0 || $ChSudba['nosale'] == 1)
-                    continue;
-            }
-            if ($pl['1price'] > 0) {
-                $pl['price1'] = $pl['1price'];
-            }
-            $is1 = '';
-            $is2 = '';
-            $d = [];
-            //����
-            $d[0] = 0;
-            $d[1] = 1;
-            $d[2] = 0;
-            $po = $this->lookStats($pl['data']);
-
-            $see1 = 1;
-            if ($type == 15) { //�������� �����
-                if ($anm['type'] == 3 && substr_count($pl['img'], 'wisp') == 0) {
-                    $see1 = 0; //�������
-                } elseif ($anm['type'] == 2 && substr_count($pl['img'], 'owl') == 0) {
-                    $see1 = 0; //����
-                } elseif ($anm['type'] == 1 && substr_count($pl['img'], 'cat') == 0) {
-                    $see1 = 0; //���
-                } elseif ($anm['type'] == 4 && substr_count($pl['img'], 'chrt') == 0) {
-                    $see1 = 0; //�������
-                } elseif ($anm['type'] == 5 && substr_count($pl['img'], 'dog') == 0) {
-                    $see1 = 0; //������
-                } elseif ($anm['type'] == 6 && substr_count($pl['img'], 'pig') == 0) {
-                    $see1 = 0; //������
-                } elseif ($anm['type'] == 7 && substr_count($pl['img'], 'dragon') == 0) {
-                    $see1 = 0; //������
-                }
-            } elseif (isset($po['nosale']) && $type == 2) {
-                $see1 = 0;
-
-            } elseif (isset($po['noremont']) && $type == 4) {
-                $see1 = 0;
-            } elseif ($type == 5 && $pl['gift'] != '') {
-                $see1 = 0;
-            } elseif (($type == 9 || $type == 10) && $pl['gift'] == '') {
-                $see1 = 0;
-            } elseif ($type == 5 && isset($po['sudba']) && $po['sudba'] != '0') {
-                $see1 = 0;
-            } elseif ($type == 5 && $pl['inTransfer'] > 0) {
-                $see1 = 0;
-            } elseif ($type == 6 && !isset($po['fshop'])) {
-                $see1 = 0;
-            } elseif ($type == 67 && isset($po['art'])) {
-                $see1 = 0;
-            } elseif ($type == 67 && isset($po['sudba'])) {
-                $see1 = 0;
-            } elseif ($type == 67 && $pl['gift'] != '') {
-                $see1 = 0;
-            } elseif ($type == 11) { // ���� ������ (������ ���������)
-                if (
-                    $pl['inTransfer'] > 0 ||
-                    (!empty($po['sudba']) && $po['sudba'] != $this->info['login']) ||
-                    !in_array($pl['type'], [1, 3, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 18, 19, 20, 21, 22, 72, 1035]) ||
-                    ($po['tr_lvl'] < 4 && $pl['item_id'] != 1035)
-                ) {
-                    $see1 = 0;
-                }
-            } elseif ($type == 14) { // ���� ������ (������ ���)
-                if ($pl['inTransfer'] > 0 || !in_array($pl['type'], [31, 6001, 6002, 6003])) {
-                    $see1 = 0;
-                }
-            } elseif ($type == 12) {
-                if ($pl['inslot'] != 3 && $pl['inslot'] != 14 && $pl['type'] != 31) {
-                    $see1 = 0;
-                }
-                if (!isset($po['frompisher']) && $pl['type'] != 31) {
-                    $see1 = 0;
-                }
-            } elseif ($type == 56 && ($pl['inslot'] != 5 || isset($po['podgon']))) {
-                $see1 = 0;
-            } 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;
-                }
-            } elseif ($type == 65) {
-                if (isset($po['sudba']) && $po['sudba'] != '0') {
-                    $see1 = 0;
-                }
-                if (isset($po['toclan'])) {
-                    $po['toclan1'] = explode('#', $po['toclan']);
-                    $po['toclan1'] = $po['toclan1'][0];
-                    if ($po['toclan1'] != $this->info['clan']) {
-                        $see1 = 0;
-                    }
-                }
-            } elseif ($type == 67) {
-                $po['toclan1'] = explode('#', $po['toclan']);
-                $po['toclan1'] = $po['toclan1'][0];
-                if ($po['toclan1'] > 0) {
-                    $see1 = 0;
-                }
-                if ($po['frompisher'] > 0) {
-                    $see1 = 0;
-                }
-                if ($pl['gift'] > 0) {
-                    $see1 = 0;
-                }
-                if ($po['sudba'] > 0) {
-                    $see1 = 0;
-                }
-            } elseif ($type == 69) {
-                $po['toclan1'] = explode('#', $po['toclan']);
-                $po['toclan1'] = $po['toclan1'][0];
-                if ($po['toclan1'] > 0) {
-                    $see1 = 0;
-                }
-                if ($po['frompisher'] == 0) {
-                    $see1 = 0;
-                }
-                if ($pl['gift'] > 0) {
-                    $see1 = 0;
-                }
-            }
-
-            if ($see1 == 1) {
-                if ($k == 1) {
-                    $k = 0;
-                } else {
-                    $k = 1;
-                }
-                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 .= ' (��)';
-                }
-                $col = $this->itemsX($pl['id']);
-                if ($col > 1 && $pl['inGroup'] != 0) {
-                    $pl['kolvo'] = $col;
-                    $mx .= ' (x' . $col . ')';
-                }
-                if (isset($po['tr_align']) && !isset($po['tr_align_bs'])) {
-                    $pl['name'] .= '<img width=12 height=15 src=https://img.new-combats.com/i/align/align' . $po['tr_align'] . '.gif >';
-                } elseif (isset($po['tr_align_bs'])) {
-                    if ($po['tr_align_bs'] == '1') {
-                        $pl['name'] .= '<img width=12 height=15 src=https://img.new-combats.com/i/align/align1.75.gif >';
-                    } elseif ($po['tr_align_bs'] == '3') {
-                        $pl['name'] .= '<img width=12 height=15 src=https://img.new-combats.com/i/align/align3.01.gif >';
-                    }
-                }
-                if (isset($po['renameadd']) && $po['renameadd'] != '') {
-                    $pl['name'] .= ' (<small>�������: ' . $po['renameadd'] . '</small>)';
-                }
-                if (isset($po['icos'])) {
-                    $pl['name'] = '<span class=icos_' . $po['icos'] . ' >' . $pl['name'] . ' <span><small>&nbsp;' . $po['icos'] . '&nbsp;</small></span></span>';
-                }
-                $is2 = '<a oncontextmenu="top.addTo(\'' . $pl['id'] . '\',\'item\'); return false;" class="inv_name" href="https://new-combats.com/item/' . $pl['item_id'] . '" target="_blank">' . $pl['name'] . '' . $mx . '</a>';
-                $is2 .= '&nbsp;&nbsp;';
-                if ($pl['massa'] > 0) {
-                    $is2 .= ' (�����: ' . ($pl['massa'] * $col) . ')';
-                }
-                if ($pl['gift'] != '') {
-                    $ttl = '';
-                    if ($pl['gift'] == 1) {
-                        $ttl = '�� �� ������ �������� ���� ������� ����-����';
-                    } else {
-                        $ttl = '���� ������� ��� ������� ' . $pl['gift'] . '. �� �� ������� �������� ���� ������� ����-���� ���';
-                    }
-                    $is2 .= ' <img title="' . $ttl . '" src="https://img.new-combats.com/i/podarok.gif">';
-                }
-
-                if (isset($po['art'])) {
-                    $is2 .= ' <img title="��������" src="https://img.new-combats.com/i/artefact.gif">';
-                }
-
-                if (isset($po['sudba'])) {
-                    if ($po['sudba'] == '0') {
-                        $is2 .= ' <img title="���� ������� ����� ������ ����� ������� � ������, ��� ������� ���. ����� ������ �� ������ ��� ������������." src="https://img.new-combats.com/i/destiny0.gif">';
-                    } elseif ($po['sudba'] == '1') {
-                        $is2 .= ' <img title="���� ������� ����� ������ ����� ������� � ������, ��� ������� �������. ����� ������ �� ������ ��� ������������." src="https://img.new-combats.com/i/destiny0.gif">';
-                    } else {
-                        $is2 .= ' <img title="���� ������� ������ ����� ������� � ' . $po['sudba'] . '. ����� ������ �� ������ ��� ������������." src="https://img.new-combats.com/i/desteny.gif">';
-                    }
-                }
-                if ($pl['price1'] > 0) { //����
-                    $pex = explode('.', $pl['price1']);
-                    if ($pex[1] == '00') {
-                        $pl['price1'] = $pex[0];
-                    }
-                    if ($_GET['toRent'] == 2) {
-                        $is2 .= '<br><strong>����: ' . ($pl['price1']) . ' ��.</strong>';
-                    } else {
-                        $is2 .= '<br><strong>����: ' . ($pl['price1'] * $col) . ' ��.</strong>';
-                    }
-                }
-                if ($pl['pricerep'] > 0) {
-                    $is2 .= ' <small><strong>(' . round($pl['pricerep'] * $col, 2) . ' ��������������)</strong></small>';
-                }
-                if ($pl['iznosMAX'] > 0) { //�������������
-                    $izcol = '';
-                    if (floor($pl['iznosNOW']) >= (floor($pl['iznosMAX']) - ceil($pl['iznosMAX']) / 100 * 20)) {
-                        $izcol = 'brown';
-                    }
-                    if ($pl['iznosMAXi'] == 999999999) {
-                        $is2 .= '<br>�������������: <font color="brown">�����������</font >';
-                    } else {
-                        $is2 .= '<br>�������������: <font color="' . $izcol . '">' . floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']) . '</font>';
-                    }
-                }
-                if ($po['battleUseZd'] > 0) {
-                    $is2 .= '<br>�������� �������������: ' . $this->timeOut($po['battleUseZd']) . '';
-                }
-                if (isset($po['srok']) && $po['srok'] > 0) {
-                    $pl['srok'] = $po['srok'];
-                }
-                if ($pl['srok'] > 0) { //���� �������� ��������
-                    $is2 .= '<br>���� ��������: ' . $this->timeOut($pl['srok']) . ' (�� ' . date('d.m.Y H:i', $pl['time_create'] + $pl['srok']) . ')';
-                }
-                if ($pl['magic_chance'] > 0) {
-                    $is2 .= '<br>����������� ������������: ' . 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 .= '<br>����������������� ��������: ' . $this->timeOut($efi['actionTime']);
-                    }
-                }
-
-                $notr = 0;
-                if (isset($po['sudba']) && $po['sudba'] != '0' && $po['sudba'] != $this->info['login']) {
-                    $notr++;
-                }
-                //<strong>��������� �����������:</strong>
-                $tr = '';
-                $t = $this->items['tr'];
-                $x = 0;
-                while ($x < count($t)) {
-                    $n = $t[$x];
-                    if (isset($po['tr_' . $n]) && $po['tr_' . $n] != 0) {
-                        if ($n == 'sex') {
-                            if ($this->info['sex'] != $po['tr_' . $n]) {
-                                $tr .= '<font color="red">';
-                                $notr++;
-                            }
-                        } elseif ($po['tr_' . $n] > $this->stats[$n]) {
-                            if ($n == 'align_bs' && $this->info['inTurnir'] > 0) {
-                                if ($po['tr_align_bs'] == '1') {
-                                    $pal = !($this->info['align_real'] <= 1 || $this->info['align_real'] >= 2);
-                                } elseif ($po['tr_align_bs'] == '3') {
-                                    $tar = !($this->info['align_real'] <= 3 || $this->info['align_real'] >= 4);
-                                }
-                            }
-                            if ($n == 'rep') {
-                                $temp = explode('::', $po['tr_' . $n]);
-                                if ($this->rep['rep' . $temp[1]] < $temp[0]) {
-                                    $tr .= '<font color="red">';
-                                    $notr++;
-                                }
-                                unset($temp);
-                            } elseif ($n == 'align_bs' && $this->info['inTurnir'] > 0 && ($pal = false || $tar = false)) {
-                                $tr .= '<font color="red">';
-                                $notr++;
-                            } elseif ($n != 'align' && $n != 'align_bs' || floor($this->info['align']) != $po['tr_' . $n]) {
-                                $tr .= '<font color="red">';
-                                $notr++;
-                            }
-                        }
-                        $tr .= '<br />� ';
-                        if ($n == 'rep') {
-                            $temp = explode('::', $po['tr_' . $n]);
-                            $tr .= $this->is[$n] . ' ' . ucfirst(str_replace('city', ' city', $temp[1])) . ': ' . $temp[0];
-                            unset($temp);
-                        } elseif ($n != 'align' && $n != 'align_bs') {
-                            if ($n == 'sex') {
-                                if ($po['tr_' . $n] == 1) {
-                                    $tr .= $this->is[$n] . ': �������';
-                                } else {
-                                    $tr .= $this->is[$n] . ': �������';
-                                }
-                            } else {
-                                $tr .= $this->is[$n] . ': ' . $po['tr_' . $n];
-                            }
-                        } else {
-                            $tr .= $this->is[$n] . ': ' . $this->align_nm[$po['tr_' . $n]];
-                        }
-                        if ($n == 'sex') {
-                            if ($this->info['sex'] != $po['tr_' . $n]) {
-                                $tr .= '</font>';
-                            }
-                        } elseif ($po['tr_' . $n] > $this->stats[$n]) {
-                            if ($n == 'align_bs' && $this->info['inTurnir'] > 0 && ($pal = false || $tar = false)) {
-                                $tr .= '</font>';
-                            } elseif ($n != 'align' && $n != 'align_bs' || floor($this->info['align']) != $po['tr_' . $n]) {
-                                $tr .= '</font>';
-                            }
-                        }
-                    }
-                    $x++;
-                }
-                if ($tr != '') {
-                    $is2 .= '<br><strong>��������� �����������:</strong>' . $tr;
-                }
-                //<strong>��������� ��:</strong>
-                $tr = '';
-                $t = $this->items['add'];
-                if (isset($po['mf_stats']) && $po['mf_stats'] > 0) {
-                    $tr .= '<br>��������� ��������������: ' . $po['mf_stats'];
-                }
-                if (isset($po['mf_mod']) && $po['mf_mod'] > 0) {
-                    $tr .= '<br>��������� ������������: ' . $po['mf_mod'];
-                }
-                if (isset($po['mf_mib']) && $po['mf_mib'] > 0) {
-                    $tr .= '<br>��������� ��������� �����: ' . $po['mf_mib'];
-                }
-
-                $x = 0;
-                while ($x < count($t)) {
-                    $n = $t[$x];
-                    if (isset($po['add_' . $n], $this->is[$n])) {
-                        $z = '+';
-                        if ($po['add_' . $n] < 0) {
-                            $z = '';
-                        }
-                        $tr .= '<br>� ' . $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 .= ' <a href="main.php?inv=1&otdel=' . $_GET['otdel'] . '&rstv=' . $pl['id'] . '&mf=' . $n . '"><img src="https://img.new-combats.com/i/up.gif" width="11" height="11"></a>';
-                        }
-                        if (isset($po['mf_mod']) && $po['mf_mod'] > 0 && ($n == 'm1' || $n == 'm2' || $n == 'm4' || $n == 'm5')) {
-                            $tr .= ' <a href="main.php?inv=1&otdel=' . $_GET['otdel'] . '&rstv=' . $pl['id'] . '&mf=' . $n . '"><img src="https://img.new-combats.com/i/up.gif" width="11" height="11"></a>';
-                        }
-                    }
-                    $x++;
-                }
-                //��������� �� (�����)
-                $i = 1;
-                $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) {
-                            $z = '+';
-                            if ($po['add_mab' . $i] < 0) {
-                                $z = '';
-                            }
-                            $tr .= '<br>� ����� ' . $bn[$i] . ': ' . $z . '' . $po['add_mab' . $i];
-                        } else {
-                            $tr .= '<br>� ����� ' . $bn[$i] . ': ' . $po['add_mib' . $i] . '-' . $po['add_mab' . $i];
-                        }
-                        if (isset($po['mf_mib']) && $po['mf_mib'] > 0) {
-                            $tr .= ' <a href="main.php?inv=1&otdel=' . $_GET['otdel'] . '&rstv=' . $pl['id'] . '&mf=mib' . $i . '"><img src="https://img.new-combats.com/i/up.gif" width="11" height="11"></a>';
-                        }
-                    }
-                    $i++;
-                }
-
-                if ($tr != '') {
-                    $is2 .= '<br><strong>��������� ��:</strong>' . $tr;
-                }
-                //<strong>�������� ��������:</strong>
-                $tr = '';
-                $t = $this->items['sv'];
-                if (isset($po['sv_yron_min'], $po['sv_yron_max'])) {
-                    $tr .= '<br>� ����: ' . $po['sv_yron_min'] . ' - ' . $po['sv_yron_max'];
-                }
-                $x = 0;
-                while ($x < count($t)) {
-                    $n = $t[$x];
-                    if (isset($po['sv_' . $n])) {
-                        $z = '+';
-                        if ($po['sv_' . $n] < 0) {
-                            $z = '';
-                        }
-                        $tr .= '<br>� ' . $this->is[$n] . ': ' . $z . '' . $po['sv_' . $n];
-                    }
-                    $x++;
-                }
-                if ($pl['2too'] == 1) {
-                    $tr .= '<br>� ������ ������';
-                }
-                if ($pl['2h'] == 1) {
-                    $tr .= '<br>� ��������� ������';
-                }
-                if (isset($po['zonb'])) {
-                    $tr .= '<br>� ���� ������������: ';
-                    if ($po['zonb'] > 0) {
-                        $x = 1;
-                        while ($x <= $po['zonb']) {
-                            $tr .= '+';
-                            $x++;
-                        }
-                    } else {
-                        $tr .= '�';
-                    }
-                }
-                if ($tr != '') {
-                    $is2 .= '<br><strong>�������� ��������:</strong>' . $tr;
-                }
-
-
-                if ($notr == 0) {
-                    $d[0] = 1;
-                    if ($pl['magic_inci'] != '' || $pl['magic_inc'] != '') {
-                        $d[2] = 1;
-                    }
-                }
-
-                $tr = '';
-
-                if (floor($pl['iznosNOW']) >= ceil($pl['iznosMAX'])) {
-                    $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 .= '<div> �������� �������� <img height=18 title="' . $mgi['mname'] . '" src="https://img.new-combats.com/i/eff/' . $mgi['img'] . '"> ' . $mgi['minfo'] . '</div>';
-                    }
-                }
-
-                if (isset($po['rune']) && $po['rune'] > 0) {
-                    $rnc = explode(' ', $po['rune_name']);
-                    if ($rnc[0] == '�����') {
-                        $rnc = '#9b5d40';
-                    } elseif ($rnc[0] == '����') {
-                        $rnc = '#3a2b64';
-                    } elseif ($rnc[0] == '����') {
-                        $rnc = '#20a3b0';
-                    } elseif ($rnc[0] == '����') {
-                        $rnc = '#4c7718';
-                    } else {
-                        $rnc = '#4c4c4c';
-                    }
-
-                    $tr .= '<br>&bull; ���������� ����: <small><font color=green>&bull; <u><strong>' . $po['rune_name'] . '</strong></u></font></small>';
-                    unset($rnc);
-                }
-
-                if (isset($po['spell']) && $po['spell'] > 0) {
-                    $rnc = explode(' ', $po['spell_name']);
-                    if ($rnc[2] == '[0]') {
-                        $rnc = '#282828';
-                    } elseif ($rnc[2] == '[1]') {
-                        $rnc = '#624542';
-                    } elseif ($rnc[2] == '[2]') {
-                        $rnc = '#77090b';
-                    } elseif ($rnc[2] == '[3]') {
-                        $rnc = '#d99800';
-                    } else {
-                        $rnc = '#d99800';
-                    }
-                    $po['spell_name'] = str_replace('���������� ', '', $po['spell_name']);
-                    $this->is['mab1'] = '����� ������';
-                    $this->is['mab2'] = '����� �������';
-                    $this->is['mab3'] = '����� �����';
-                    $this->is['mab4'] = '����� ���';
-                    $tr .= '<br>&bull; ��������� �����������: <small><font color=' . $rnc . '><u><strong>' . $po['spell_name'] . '</strong></u> (' . $this->is[$po['spell_st_name']] . ': +' . $po['spell_st_val'] . ')</font></small>';
-                    unset($this->is['mab1'], $this->is['mab2'], $this->is['mab3'], $this->is['mab4']);
-                    unset($rnc);
-                }
-
-                if (isset($po['imposed']) && $po['imposed'] > 0) {
-                    if ($po['imposed_lvl'] == 0) {
-                        $rnc = 'maroon';
-                    } elseif ($po['imposed_lvl'] == 1) {
-                        $rnc = '#624542';
-                    } elseif ($po['imposed_lvl'] == 2) {
-                        $rnc = '#77090b';
-                    } elseif ($po['imposed_lvl'] == 3) {
-                        $rnc = '#d99800';
-                    } else {
-                        $rnc = '#282828';
-                    }
-                    $po['imposed_name'] = str_replace('���� ', '', $po['imposed_name']);
-                    $tr .= '<br>&bull; <font color=' . $rnc . '>�������� ��������:</font> ' . $po['imposed_name'] . ' ';
-                    unset($rnc);
-                }
-                if ($tr != '') {
-                    $is2 .= '<br><strong>��������� ��������:</strong>';
-                    $is2 .= $tr;
-                }
-
-                if (isset($po['free_stats']) && $po['free_stats'] > 0) {
-                    $is2 .= '<br><strong>������������� ������:</strong>';
-                    $is2 .= '<div style="margin-left:20px;"><small>����: ' . $po['add_s1'] . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufs=1"><img src="https://img.new-combats.com/i/plus.gif"></a><br>��������: ' . $po['add_s2'] . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufs=2"><img src="https://img.new-combats.com/i/plus.gif"></a><br>��������: ' . $po['add_s3'] . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufs=3"><img src="https://img.new-combats.com/i/plus.gif"></a><br>���������: ' . $po['add_s5'] . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufs=5"><img src="https://img.new-combats.com/i/plus.gif"></a></small></div>';
-                    $is2 .= '&bull; �������� �������������: ' . $po['free_stats'] . '';
-                }
-
-                if (isset($po['sm_abil'])) {
-                    //�������� ��������� � ������������ �����
-                    $mx2 = 1;
-                    $mx1 = 0;
-                    $mx3 = $this->lookStats($this->info['stats']);
-                    while ($mx2 <= 7) {
-                        $mx1 += $mx3['s' . $mx2] - $po['add_s' . $mx2];
-                        $mx2++;
-                    }
-                    $mx1 += $this->info['ability'];
-                    if ($mx1 > 0) {
-                        $is2 .= '<br><strong>������������� �������������:</strong>';
-                        if (isset($po['sudba']) && $po['sudba'] == '0') {
-                            $mx1 = 0;
-                            $is2 .= '<div style="margin-left:20px;"><small>&bull; ������������� ������������� ����� �������� ����� ������� ��������</small></div>';
-                        } else {
-                            $is2 .= '<div style="margin-left:20px;"><small>
-							����: ' . (0 + $po['add_s1']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsmst=1"><img src="https://img.new-combats.com/i/plus.gif"></a><br>
-							��������: ' . (0 + $po['add_s2']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsmst=2"><img src="https://img.new-combats.com/i/plus.gif"></a><br>
-							��������: ' . (0 + $po['add_s3']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsmst=3"><img src="https://img.new-combats.com/i/plus.gif"></a><br>
-							������������: ' . (0 + $po['add_s4']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsmst=4"><img src="https://img.new-combats.com/i/plus.gif"></a><br>
-							���������: ' . (0 + $po['add_s5']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsmst=5"><img src="https://img.new-combats.com/i/plus.gif"></a><br>
-							��������: ' . (0 + $po['add_s6']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsmst=6"><img src="https://img.new-combats.com/i/plus.gif"></a><br>
-							</small></div>';
-                            $is2 .= '�������� �������������: ' . $mx1;
-                        }
-                    }
-                    unset($mx1, $mx2, $mx3);
-                }
-
-                if (isset($po['sm_skill'])) {
-                    //�������� ��������� � ������������ �����
-                    $mx2 = 1;
-                    $mx1 = 0;
-                    $mx3 = $this->lookStats($this->info['stats']);
-                    while ($mx2 <= 7) {
-                        $mx1 += ($mx3['a' . $mx2] + $mx3['mg' . $mx2]) - ($po['add_a' . $mx2] + $po['add_mg' . $mx2]);
-                        $mx2++;
-                    }
-                    $mx1 += $this->info['skills'];
-                    if ($mx1 > 0) {
-                        $is2 .= '<br><strong>������������� �������� ������� � ������:</strong>';
-                        if (isset($po['sudba']) && $po['sudba'] == '0') {
-                            $mx1 = 0;
-                            $is2 .= '<div style="margin-left:20px;"><small>&bull; ������������� �������� ����� �������� ����� ������� ��������</small></div>';
-                        } else {
-                            $is2 .= '<div style="margin-left:20px;"><small>
-							���������� �������� ������: ' . (0 + $po['add_a1']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=1"><img src="https://img.new-combats.com/i/plus.gif"></a><br>
-							���������� �������� ��������, ��������: ' . (0 + $po['add_a2']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=2"><img src="https://img.new-combats.com/i/plus.gif"></a><br>
-							���������� �������� ������, ���������: ' . (0 + $po['add_a3']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=3"><img src="https://img.new-combats.com/i/plus.gif"></a><br>
-							���������� �������� ��������, ��������: ' . (0 + $po['add_a4']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=4"><img src="https://img.new-combats.com/i/plus.gif"></a><br>
-							���������� �������� ����������� ��������: ' . (0 + $po['add_a5']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=5"><img src="https://img.new-combats.com/i/plus.gif"></a><br>
-							���������� �������� ������� ����: ' . (0 + $po['add_mg1']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=6"><img src="https://img.new-combats.com/i/plus.gif"></a><br>
-							���������� �������� ������� �������: ' . (0 + $po['add_mg2']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=7"><img src="https://img.new-combats.com/i/plus.gif"></a><br>
-							���������� �������� ������� ����: ' . (0 + $po['add_mg3']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=8"><img src="https://img.new-combats.com/i/plus.gif"></a><br>
-							���������� �������� ������� �����: ' . (0 + $po['add_mg4']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=9"><img src="https://img.new-combats.com/i/plus.gif"></a><br>
-							���������� �������� ������ �����: ' . (0 + $po['add_mg5']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=10"><img src="https://img.new-combats.com/i/plus.gif"></a><br>
-							���������� �������� ������ ����: ' . (0 + $po['add_mg6']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=11"><img src="https://img.new-combats.com/i/plus.gif"></a><br>
-							���������� �������� ����� ������: ' . (0 + $po['add_mg7']) . ' <a href="?inv=1&itmid=' . $pl['id'] . '&otdel=' . ((int)$_GET['otdel']) . '&ufsms=12"><img src="https://img.new-combats.com/i/plus.gif"></a><br>
-							</small></div>';
-                            $is2 .= '�������� �������������: ' . $mx1;
-                        }
-                    }
-                    unset($mx1, $mx2, $mx3);
-                }
-
-                if (isset($po['complect']) || isset($po['complect2'])) {
-                    $is2 .= '<br><i>�������������� ����������:</i>';
-                }
-                if (isset($po['complect'])) {
-                    //�� ������������
-                    $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'] .= '&nbsp; &nbsp; &bull; <font color="green">' . $plc['x'] . '</font>: ';
-                        //�������� ���������
-                        $i1c = 0;
-                        $i2c = 0;
-                        $i1e = $this->lookStats($plc['data']);
-                        while ($i1c < count($this->items['add'])) {
-                            if (isset($i1e[$this->items['add'][$i1c]])) {
-                                $i3c = $i1e[$this->items['add'][$i1c]];
-                                if ($i3c > 0) {
-                                    $i3c = '+' . $i3c;
-                                }
-                                if ($i2c > 0) {
-                                    $com1['text'] .= '&nbsp; &nbsp; ' . $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
-                                } else {
-                                    $com1['text'] .= $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
-                                }
-                                $com1['text'] .= '<br>';
-                                $i2c++;
-                            }
-                            $i1c++;
-                        }
-                        unset($i1c, $i2c, $i3c);
-                        $com1['x']++;
-                    }
-                    $is2 .= '<br>&bull; ����� ���������: <strong>' . $com1['name'] . '</strong><br><small>';
-                    $is2 .= $com1['text'];
-                    $is2 .= '</small>';
-                }
-                if (isset($po['complect2'])) {
-                    //�� ������������
-                    $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'] .= '&nbsp; &nbsp; &bull; <font color="green">' . $plc['x'] . '</font>: ';
-                        //�������� ���������
-                        $i1c = 0;
-                        $i2c = 0;
-                        $i1e = $this->lookStats($plc['data']);
-                        while ($i1c < count($this->items['add'])) {
-                            if (isset($i1e[$this->items['add'][$i1c]])) {
-                                $i3c = $i1e[$this->items['add'][$i1c]];
-                                if ($i3c > 0) {
-                                    $i3c = '+' . $i3c;
-                                }
-                                if ($i2c > 0) {
-                                    $com1['text'] .= '&nbsp; &nbsp; ' . $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
-                                } else {
-                                    $com1['text'] .= $this->is[$this->items['add'][$i1c]] . ': ' . $i3c;
-                                }
-                                $com1['text'] .= '<br>';
-                                $i2c++;
-                            }
-                            $i1c++;
-                        }
-                        unset($i1c, $i2c, $i3c);
-                        $com1['x']++;
-                    }
-                    $is2 .= '<br>&bull; ����� ��������� (��������): <strong>' . $com1['name'] . '</strong><br><small>';
-                    $is2 .= $com1['text'];
-                    $is2 .= '</small>';
-                }
-
-                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 = '';
-                    $ixi = 0;
-                    while ($sm_pl = mysql_fetch_array($sm_sp)) {
-                        if ($sm_pl['type'] == 0) {
-                            $smt .= '<font class="date">' . date('d.m.Y H:i', $sm_pl['time']) . '</font> <strong>' . $sm_pl['login'] . '</strong>. ' . $sm_pl['text'] . '<br>';
-                        } else {
-                            $smt .= $sm_pl['text'] . '<br>';
-                        }
-                        if ($ixi == 2) {
-                            $smt .= '<div style="display:none" id="close_text_itm' . $pl['id'] . '">';
-                        }
-                        $ixi++;
-                        $sma += $sm_pl['x'];
-                    }
-                    $smt .= '</div>';
-                    if ($pl['max_text'] - $pl['use_text'] > 0) {
-                        $is2 .= '<div>���������� ��������: ' . ($pl['max_text'] - $pl['use_text']) . '</div>';
-                    }
-                    if ($sma > 0) {
-                        $is2 .= '<div>�� �������� ������� �����:<br>
-								<table width="100%" border="0" cellspacing="0" cellpadding="0">
-								  <tr>
-									<td><div style="background-color:#e8e8e8;padding:5px;"><CODE>' . $smt . '</CODE></div></td>
-									<td width="20" align="center" valign="top"><img style="cursor:pointer" onClick="seetext(' . $pl['id'] . ');" src="https://img.new-combats.com/expand.gif" height="35" width="10"></td>
-								  </tr>
-								</table>
-							</div>';
-                    }
-                    unset($sm_sp, $sma, $sm_pl);
-                } elseif (isset($po['onitm_text'])) {
-                    $is2 .= '<div>�� �������� ������� �����:<br>
-						<table width="100%" border="0" cellspacing="0" cellpadding="0">
-							<tr>
-								<td><div style="background-color:#e8e8e8;padding:5px;"><CODE>' . $po['onitm_text'] . '</CODE></div></td>
-							</tr>
-						</table>
-					</div>';
-                }
-
-                if (isset($po['gravi'])) {
-                    $is2 .= '<br>�� ����������� ������������� �������: <strong>' . $po['gravi'] . '</strong>';
-                }
-
-                $is2 .= '<small style="">';
-
-                if ($pl['info'] != '') {
-                    $is2 .= '<div><strong>������������:</strong></div><div>' . $pl['info'] . '</div>';
-                }
-
-                if (isset($po['info']) && $po['info'] != '') {
-                    $is2 .= '<div>' . $po['info'] . '</div>';
-                }
-
-                if (isset($po['toclan'])) {
-                    $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 .= '<div style="color:brown;">������� ����������� ����� <img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $clpo['name_mini'] . '.gif" width="24" height"15"> <strong>' . $clpo['name'] . '</strong>';
-                        $plpo = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`cityreg` FROM `users` WHERE `id` = "' . $po['toclan1'][1] . '" LIMIT 1'));
-                        if (isset($plpo['id'])) {
-                            $is2 .= ' <font color=grey>(��� ������ <strong>' . $plpo['login'] . '</strong><a href="info/' . $plpo['id'] . '" target="_blank"><img src="https://img.new-combats.com/i/inf_' . $plpo['cityreg'] . '.gif" width="9"></a>)</font>';
-                            if ($plpo['login'] == $this->info['login']) {
-                                if (isset($_GET['backmyitm'])) {
-                                    $pl['inOdet'] = 0;
-                                    $pl['uid'] = $plpo['id'];
-                                    unset($po['toclan1'], $po['toclan']);
-                                    $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 .= '<br>(�� �������� ��������: <a href="main.php?clan&deposit&backmyitm=' . $pl['id'] . '">������� ������� ����</a>)';
-                            }
-                        }
-                        $is2 .= '</div>';
-                    }
-                }
-                if (isset($po['noremont'])) {
-                    $is2 .= '<div style="color:brown;">������� �� �������� �������</div>';
-                }
-                if (isset($po['nosale'])) {
-                    $is2 .= '<div style="color:brown;">������� ������ �������</div>';
-                }
-                if (isset($po['nomodif'])) {
-                    $is2 .= '<div style="color:brown;">������� ������ ��������</div>';
-                }
-                if (isset($po['nodelete'])) {
-                    $is2 .= '<div style="color:brown;">������� ������ ���������</div>';
-                }
-                if (isset($po['frompisher'])) {
-                    $is2 .= '<div style="color:brown;">������� �� ����������</div>';
-                }
-                if (isset($po['sleep_moroz']) && $po['sleep_moroz'] > 0) {
-                    $is2 .= '<div style="color:brown;">������� �� �������� �� ����� ���</div>';
-                }
-
-                if (isset($po['fromlaba']) && $po['fromlaba'] > 0) {
-                    $is2 .= '<div style="color:brown;">������� �� ���������</div>';
-                }
-
-                if (isset($po['vip_sale']) && $po['vip_sale'] > 0) {
-                    if ($this->stats['slvtm'] > time() && $this->stats['silver'] > 1) {
-                        if ($pl['time_create'] != $this->stats['slvtm']) {
-                            $pl['time_create'] = $this->stats['slvtm'];
-                            mysql_query('UPDATE `items_users` SET `time_create` = "' . $pl['time_create'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
-                        }
-                        $is2 .= '<div style="color:brown;">������� ����� ���������� ����� ' . $this->timeOut($pl['time_create'] - time()) . '</div>';
-                    } else {
-                        $is2 .= '<div style="color:brown;">������� ����������, ����������� ���������� VIP</div>';
-                        if (($pl['time_create'] - time() + 86400 * 30) < 1) {
-                            $is2 .= '<div style="color:brown;">������� ���������� � ��� �� ������...</div>';
-                        } else {
-                            $is2 .= '<div style="color:brown;">������� �������� ����� ' . $this->timeOut($pl['time_create'] - time() + 86400 * 30) . '</div>';
-                        }
-                    }
-                }
-
-                if ($pl['dn_delete'] > 0) {
-                    $is2 .= '<div style="color:brown;">������� ����� ������ ��� ������ �� ����������</div>';
-                }
-
-                if ($this->pokol > $pl['geni']) {
-                    $is2 .= '<div style="color:brown">������� �������</div>';
-                }
-
-                if (isset($po['zazuby']) && $po['zazuby'] > 0) {
-                    $is2 .= '<div style="color:brown;">������� ������ �� ����</div>';
-                }
-
-                $is2 .= '</small>';
-
-                if ($col > 1000) {
-                    $is1 .= '<table border="0" cellspacing="0" cellpadding="0">
-							  <tr>
-								<td><img src="https://img.new-combats.com/i/items/' . $pl['img'] . '"></td>
-							  </tr>
-							  <tr>
-								<td align="right"><span style="position:relative;margin-bottom:5px;"><small style="position:absolute;background-color:grey;padding:1px;bottom:1px;right:1px;background-color:#E0E0E0;"><strong>x' . $col . '</strong></small></span></td>
-							  </tr>
-							</table>';
-
-                } else {
-                    $is1 .= '<img src="https://img.new-combats.com/i/items/' . $pl['img'] . '" style="margin-bottom:5px;">';
-                }
-
-                $is1 .= '<br>';
-
-                if ($type == 81) {
-
-                    $is1 .= '<small><a href="main.php?inv=1&otdel=' . floor($_GET['otdel']) . '&use_rune=' . floor($_GET['use_rune']) . '&item_rune=0&item_rune_id=' . $pl['id'] . '">������� ������ �������</a></small>';
-
-
-                } 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(�������)
-                    {
-                        $is1 .= '<small><a href="main.php?inv=1&otdel=' . floor($_GET['otdel']) . '&use_rune=' . floor($_GET['use_rune']) . '&item_rune=0&item_rune_id=' . $pl['id'] . '">������� ������ �������</a></small>';
-                    } else {
-                        $is1 .= '<small><strong>������������:<br>' . $it['rune_name'] . '</strong></small>';
-                    }
-                    unset($itemrun, $it);
-                } elseif ($type == 69) {
-                    if (!isset($po['hprs'])) {
-                        $po['hprs'] = 0.001;
-                    }
-                    if (!isset($po['hprp'])) {
-                        $po['hprp'] = 0.0001;
-                    }
-                    $prs1 = $this->floordec($po['hprs'] * $col, 2);
-                    $rps1 = $this->floordec($po['hprp'] * $col);
-                    $is1 .= '<small style="font-size:11px;"><a href="?sale1kr=' . $pl['id'] . '">�������� �� ' . $prs1 . ' ��.</a><br><a href="?sale1rep=' . $pl['id'] . '">�������� �� ' . $rps1 . ' ��. ���������</a>';
-                    $is1 .= '</small>';
-                } elseif ($type == 68) {
-                    $is1 .= '<small style="font-size:11px;"><a href="?r=3&itm_take=' . $pl['id'] . '">�������</a><br><a href="?r=3&itm_cancel=' . $pl['id'] . '">����������</a>';
-                    if ($pl['lastUPD'] > 0) {
-                        $is1 .= '<br><br>(' . $this->timeOut(($pl['lastUPD'] + 7 * 24 * 60 * 60) - time()) . ')';
-                    }
-                    $is1 .= '</small>';
-                } elseif ($type == 67) {
-                    $is1 .= '<small style="font-size:11px;"><a href="javascript:void(0)" onclick="itmToUser(' . $pl['id'] . ')">�������� �� ' . (round(1 + $pl['price1'] / 100 * 7) * $col) . ' ��.</a></small>';
-                } elseif ($type == 66) {
-                    $pos = explode('#', $po['toclan']);
-                    $us_1 = $pos[1];
-                    if ($pl['uid'] < 1) {
-                        $is1 .= '<small style=""><a href="?clan&deposit&take_itm=' . $pl['id'] . '">����� �������</a></small>';
-                    } else {
-                        $yui = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`cityreg` FROM `users` WHERE `id` = "' . mysql_real_escape_string($pl['uid']) . '" LIMIT 1'));
-                        $is1 .= '<small>������� � ������<br><strong>' . $yui['login'] . '</strong><a href="info/' . $yui['id'] . '" target="_blank"><img width="10" src="https://img.new-combats.com/i/inf_' . $yui['cityreg'] . '.gif"></a></small>';
-                        if ($this->info['tt'][14][0] == 1 || ($this->info['id'] == $us_1)) {
-                            $is1 .= '<br><small style=""><a href="?clan&deposit&ungive_itm=' . $pl['id'] . '">������ �������</a></small>';
-                        }
-                    }
-                } elseif ($type == 65) {
-                    if (!isset($po['toclan'])) {
-                        $is1 .= '<small style=""><a href="?clan&deposit&give_itm=' . $pl['id'] . '">������������</a></small>';
-                    } else {
-                        $is1 .= '<small style=""><a href="?clan&deposit&give_itm=' . $pl['id'] . '">�������</a></small>';
-                    }
-                } 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 .= '<small style="">��������� ����������</small>';
-                    } else {
-                        $prcup = '';
-                        if ($upgitm['price1'] > 0) {
-                            $prcup .= $upgitm['price1'] . ' ��.';
-                        }
-                        if ($upgitm['price2'] > 0) {
-                            if ($prcup != '') {
-                                $prcup .= ' � ';
-                            }
-                            $prcup .= $upgitm['price2'] . ' ���.';
-                        }
-                        $is1 .= '<small style=""><a href="?r=8&upgradelvl=' . $pl['id'] . '">�������� �� ' . $prcup . '</a></small>';
-                        unset($prcup);
-                    }
-                } elseif ($type == 63) {
-                    $prcup = '';
-                    $is1 .= '<small style=""><a href="?r=9&upgradelvlcom=' . $pl['id'] . '">��������</a></small>';
-                    unset($prcup);
-                } elseif ($type == 64) {
-                    $prcup = '';
-                    $is1 .= '<small style=""><a href="?r=9">������� ������ �������</a></small>';
-                    unset($prcup);
-                } elseif ($type == 61) { //��������� ��������
-                    if ($pl['price1'] > $pl['1price']) {
-                        $pl['1price'] = $pl['price1'];
-                    }
-                    $prpod = $pl['1price'] / 2.37;
-                    if ($pl['price2'] > $pl['2price']) {
-                        $pl['2price'] = $pl['price2'];
-                    }
-                    $prpod2 = 30 * ($pl['2price'] / 2.37);
-                    if ($prpod2 > $prpod) {
-                        $prpod = $prpod2;
-                    }
-                    if (!isset($po['add_s1']) && !isset($po['add_s2']) && !isset($po['add_s3']) && !isset($po['add_s5'])) {
-                        $prpod = $prpod / 2.37;
-                    }
-                    $prpod = round($prpod + $prpod / 100 * (37.795 * ($po['upgrade'] + 1)));
-                    $is1 .= '<small style=""><a href="?upgrade=' . $pl['id'] . '&r=6&t=2&rnd=' . $code . '">������� �� ' . $prpod . ' ��.</a></small>';
-                } elseif ($type == 60) { //���������������
-                    if ($pl['price1'] > $pl['1price']) {
-                        $pl['1price'] = $pl['price1'];
-                    }
-                    $prpod = $pl['1price'] / 2;
-                    if ($pl['price2'] > $pl['2price']) {
-                        $pl['2price'] = $pl['price2'];
-                    }
-                    $prpod2 = 30 * ($pl['2price'] / 2.37);
-                    if ($prpod2 > $prpod) {
-                        $prpod = $prpod2;
-                    }
-                    if (!isset($po['add_s1']) && !isset($po['add_s2']) && !isset($po['add_s3']) && !isset($po['add_s5'])) {
-                        $prpod = $prpod / 2;
-                    }
-                    $prpod = round($prpod);
-                    $is1 .= '<small style=""><a href="?modif=' . $pl['id'] . '&r=7&t=2&rnd=' . $code . '">�������������� �� ' . $prpod . ' ��.</a></small>';
-
-                } 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 .= '<small style=""><a href="?ubeff='.$pl['id'].'&r=3&t=2&rnd='.$code.'">���������������� �� '.$prpod.' ��.</a></small>';
-
-                    if ($this->stats['repair_z'] >= 1) {
-                        $is1 .= '<small style=""><a href="?ubeff=' . $pl['id'] . '&r=3&t=2&rnd=' . $code . '">���������� �������������</a></small>';
-                    } else {
-                        $is1 .= '<small style=""><a href="?ubeff=' . $pl['id'] . '&r=3&t=2&rnd=' . $code . '">���������������� �� ' . $prpod . ' ��.</a></small>
-						<!--<br><small style=""><a href="?ubeff_ekr=' . $pl['id'] . '&r=3&t=2&rnd=' . $code . '">���������������� �� ' . $prpod_ekr . ' ���.</a></small>-->';
-                    }
-                } elseif ($type == 58) { //������������ ���
-                    if ($po['tr_lvl'] > $pl['level']) {
-                        $pl['level'] = $po['tr_lvl'];
-                    }
-                    //$prpod = 50*$pl['level']+200;
-                    $prpod = 2500;
-                    $prpod_ekr = $pl['level'] * 0.15;
-                    if ($this->stats['repair_r'] >= 1) {
-                        $is1 .= '<small style=""><a href="?unrune=' . $pl['id'] . '&r=4&t=2&rnd=' . $code . '">��������� ������� ����</a></small>';
-                    } else {
-                        $is1 .= '<small style=""><a href="?unrune=' . $pl['id'] . '&r=4&t=2&rnd=' . $code . '">������� ���� �� ' . $prpod . ' ��.</a></small><br>
-						<!--<small style=""><a href="?unrune_ekr=' . $pl['id'] . '&r=4&t=2&rnd=' . $code . '">������� ���� �� ' . $prpod_ekr . ' ���.</a>
-						</small> -->';
-                    }
-                } elseif ($type == 57) {
-                    $prpod = 30;
-                    if ($pl['type'] == 22) {
-                        $prpod = 35;
-                    } elseif ($pl['type'] == 18) {
-                        $prpod = 15;
-                    }
-                    if (isset($po['gravi'])) {
-                        $is1 .= '<small style=""><a onclick="top.un_grava(\'' . $pl['id'] . '\',\'' . $pl['name'] . '\',\'' . $prpod . '.00\',\'data\')" href="javascript:void(0)">�������� ������� �� ' . $prpod . ' ��.</a></small>';
-                    } else {
-                        $is1 .= '<small style=""><a onclick="top.grava(\'' . $pl['id'] . '\',\'' . $pl['name'] . '\',\'' . $prpod . '.00\',\'data\')" href="javascript:void(0)">������������� ������� �� ' . $prpod . ' ��.</a></small>';
-                    }
-                } 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 .= '<small style=""><a href="?podgon=' . $pl['id'] . '&r=5&t=2&rnd=' . $code . '">��������� �� ' . $prpod . ' ��.</a></small>';
-                } elseif ($type == 15) { //�������� �����
-                    $is1 .= '<a href="main.php?pet=1&obj_corm=' . $pl['id'] . '&rnd=' . $code . '">�������</a>';
-                } elseif ($type == 11) {
-                    $pl['rep'] = 0;
-                    if ($this->rep['rep1'] < 100) {
-                        if ($po['tr_lvl'] >= 4 && $po['tr_lvl'] <= 6) {
-                            $pl['rep'] = 1;
-                        }
-                        if ($pl['item_id'] == 1035) {
-                            $pl['rep'] = 2;
-                        }
-                    } elseif ($this->rep['rep1'] > 99 && $this->rep['rep1'] < 1000) {
-                        if ($po['tr_lvl'] >= 7 && $po['tr_lvl'] <= 8) {
-                            $pl['rep'] = 1;
-                        }
-                        if ($pl['item_id'] == 1035) {
-                            $pl['rep'] = 1;
-                        }
-                    } elseif ($this->rep['rep1'] > 999) {
-                        if ($po['tr_lvl'] >= 9 && $po['tr_lvl'] <= 10) {
-                            $pl['rep'] = 1;
-                        }
-                        if ($pl['item_id'] == 1035) {
-                            $pl['rep'] = 1;
-                        }
-                    } else {
-                        if ($pl['item_id'] == 1035) {
-                            $pl['rep'] = 2;
-                        }
-                    }
-                    $is1 .= '<a href="javascript:void(0);" onclick="takeItRun(\'' . $pl['img'] . '\',' . $pl['id'] . ',' . $pl['rep'] . ');">�������</a>';
-                } elseif ($type == 14) {
-                    $is1 .= '<a href="javascript:void(0);" onclick="massTakeItRun(\'' . $pl['img'] . '\',' . $pl['id'] . ',0);">�������</a>';
-                } elseif ($type == 12) {
-                    $is1 .= '<a href="javascript:void(0);" onclick="takeItRun(\'' . $pl['img'] . '\',' . $pl['id'] . ',1);">�������</a>';
-                } elseif ($type == 10) {
-                    //������ (����������� ��������� � ������ (��� �������))
-                    $is1 .= '<a href="javascript:void(0)" class="obj_take" data-code="' . $code . '" data-room="' . ((int)$_GET['room']) . '" rel="' . $pl['id'] . '">� ������</a>';
-                } elseif ($type == 9) {
-                    //������ (����������� ��������� � ��������� (��� �������))
-                    $is1 .= '<a href="javascript:void(0)" class="obj_add" data-code="' . $code . '" data-room="' . ((int)$_GET['room']) . '" rel="' . $pl['id'] . '">��� ������</a>';
-                } elseif ($type == 8) {
-                    //������ (����������� ��������� � ���������)
-                    $is1 .= '<a href="javascript:void(0)" class="obj_add" data-code="' . $code . '" data-room="' . ((int)$_GET['room']) . '" rel="' . $pl['id'] . '">� ������</a>';
-                } elseif ($type == 7) {
-                    //������ (����������� ��������� � ������)
-                    $is1 .= '<a href="javascript:void(0)" class="obj_take" data-code="' . $code . '" data-room="' . ((int)$_GET['room']) . '" rel="' . $pl['id'] . '">� ������</a>';
-                } elseif ($type == 6) {
-                    //��������� �������
-                    $is1 .= '<a href="main.php?otdel=2&add_item_f=' . $pl['id'] . '&rnd=' . $code . '">��������</a>';
-                } elseif ($type == 5) {
-                    //��������
-                    $is1 .= '<a onClick="saleitem(' . $pl['id'] . ',1); return false;" href="javascript:void(0)">��������</a><br><a onClick="saleitem(' . $pl['id'] . ',2); return false;" href="#">��������</a><br><small style="font-size:10px">(�����: 1 ��.)</small>';
-                } elseif ($type == 12) {
-                    //�������� �����
-                    $skcd = round($col * ($pl['price1'] * 0.06 - 0.01 * $this->stats['os1']), 2);
-                    if ($skcd < 0.06) {
-                        $skcd = 0.06;
-                    }
-                    $is1 .= '<a href="main.php?otdel=' . $_GET['otdel'] . '&setlogin=' . $_REQUEST['setlogin'] . '&setobject=' . $pl['id'] . '&room=2&tmp=' . $code . '" onclick="return confirm(\'�������� ������� ' . $pl['name'] . '?\')">��������&nbsp;��&nbsp;' . (1 + $skcd) . '&nbsp;��.</A>';
-                } elseif ($type == 13) {
-                    //�������� ����
-                    if ($pl['1price'] > 0) {
-                        $mess = "���������� �� ��������? ������� ����� ���������!";
-                        $pl['name'] = '������ ' . $pl['1price'] . ' ��.';
-                    } else {
-                        $mess = "���������� �� ��������? ������� ����� ��������� �����������";
-                    }
-                    $date1 = $pl['delete'] - time();
-                    $is1 .= '<BR><NOBR><A href="?room=4&to_box=' . $pl['id'] . '&tmp=' . $code . '">�������</A></NOBR>
-							<BR><NOBR><A onclick="return confirm(\'' . $mess . '\')" href="?room=4&del_box=' . $pl['id'] . '&tmp=' . $code . '">����������</A></NOBR><SMALL><BR><BR>(' . date("j ��. H �.", $date1) . ' )</small></TD>';
-                } 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);
-
-                    if ($this->stats['repair_discount'] >= 1) {
-                        $r1 = round(($r1 / 100 * 25), 2);
-                        $r2 = round(($r2 / 100 * 25), 2);
-                        $r3 = round(($r3 / 100 * 25), 2);
-                    }
-
-                    if ($r1 < 0.01) {
-                        $r1 = 0.01;
-                    }
-                    if ($r2 < 0.01) {
-                        $r2 = 0.01;
-                    }
-                    if ($r3 < 0.01) {
-                        $r3 = 0.01;
-                    }
-                    $is1 .= '<small style=""><a href="?remon=' . $pl['id'] . '&t=1&rnd=' . $code . '">������ 1 ��. �� ' . $r1 . ' ��.</a><br>';
-                    if ($pl['iznosNOW'] >= 10) {
-                        $is1 .= '<a href="?remon=' . $pl['id'] . '&t=2&rnd=' . $code . '">������ 10 ��. �� ' . $r2 . ' ��.</a><br>';
-                    }
-                    $is1 .= '<a href="?remon=' . $pl['id'] . '&t=3&rnd=' . $code . '">������ ������ �� ' . $r3 . ' ��.</a></small>';
-                    if ($c['zuby'] == true) {
-                        if ($this->info['level'] < 8) {
-                            $is1 .= '<hr><small style=""><a onClick="if(!confirm(\'��������������� ������� �� ����?\n(������� ������ ����� �������) \')){ return false; }" href="?remonz=' . $pl['id'] . '&t=1&rnd=' . $code . '">������ 1 ��. �� ' . $this->zuby($r1) . '</a><br>';
-                            if ($pl['iznosNOW'] >= 10) {
-                                $is1 .= '<a onClick="if(!confirm(\'��������������� ������� �� ����?\n(������� ������ ����� �������) \')){ return false; }" href="?remonz=' . $pl['id'] . '&t=2&rnd=' . $code . '">������ 10 ��. �� ' . $this->zuby($r2) . '</a><br>';
-                            }
-                            $is1 .= '<a onClick="if(!confirm(\'��������������� ������� �� ����?\n(������� ������ ����� �������) \')){ return false; }" href="?remonz=' . $pl['id'] . '&t=3&rnd=' . $code . '">������ ������ �� ' . $this->zuby($r3) . '</a></small>';
-                        }
-                    }
-                } elseif ($type == 3) {
-                    $is1 .= '<input type="button" onClick="document.getElementById(\'itemgift\').value=' . $pl['id'] . ';document.F1.submit();" value="��������" />';
-                } elseif ($type == 2) {
-                    global $shopProcent;
-                    $shpCena = $pl['1price'];
-                    if ($pl['1price'] == 0) {
-                        $shpCena = $pl['price1'];
-                    }
-                    $plmx = 0;
-                    if ($pl['iznosMAXi'] != $pl['iznosMAX'] && $pl['iznosMAX'] != 0) {
-                        $plmx = $pl['iznosMAX'];
-                    } else {
-                        $plmx = $pl['iznosMAXi'];
-                    }
-                    if ($pl['iznosNOW'] > 0) {
-                        $prc1 = floor($pl['iznosNOW']) / ceil($plmx) * 100;
-                    } else {
-                        $prc1 = 0;
-                    }
-                    $shpCena = $this->shopSaleM($shpCena, $pl);
-                    $shpCena = $shpCena / 100 * (100 - $prc1);
-                    if ($pl['iznosMAXi'] < 999999999) {
-                        if ($pl['iznosMAX'] > 0 && $pl['iznosMAXi'] > 0 && $pl['iznosMAXi'] > ceil($pl['iznosMAX'])) {
-                            $shpCena = $shpCena / 100 * (ceil($pl['iznosMAX']) / $pl['iznosMAXi'] * 100);
-                        }
-                    }
-                    $shpCena = $this->round2($shpCena / 100 * (100 - $shopProcent));
-                    if ($shpCena < 0) {
-                        $shpCena = 0;
-                    }
-                    if ($pl['kolvo'] > 0) {
-                        $shpCena = $shpCena * $pl['kolvo'];
-                    }
-                    if (isset($po['toclan'])) {
-                        $po['toclan1'] = explode('#', $po['toclan']);
-                        $us_1 = $po['toclan1'][1];
-                        if ($us_1 != $this->info['id']) {
-                            $d_s = false;
-                        } else {
-                            $d_s = true;
-                        }
-                    } else {
-                        $d_s = true;
-                    }
-                    if ($d_s == true) { // ������� �� �� ���
-                        $is1 .= '<a href="javascript:void(0)" onClick="if(confirm(\'������� ������� &quot;' . $pl['name'] . '&quot; �� ' . $shpCena . ' ��.?\')){ location = \'main.php?sale&sd4=' . $this->info['nextAct'] . '&item=' . $pl['id'] . '&rnd=' . $code . '\'; }">������� �� ' . $shpCena . ' ��.</a>';
-                        if ($pl['pricerep'] > 0) {
-                            $is1 .= '<br><a href="javascript:void(0)" onClick="if(confirm(\'�������� ������� &quot;' . $pl['name'] . '&quot; �� ' . floor($pl['pricerep'] * $pl['kolvo'] / 2) . ' ��������������?\')){ location = \'main.php?sale&sd4=' . $this->info['nextAct'] . '&item_rep=' . $pl['id'] . '&rnd=' . $code . '\'; }">�������� �� ' . floor($pl['pricerep'] * $pl['kolvo'] / 2) . ' ����c. </a>';
-                        }
-                    } else {
-                        $is1 .= '��� �� ��� �������.';
-                    }
-                } elseif ($type == 16) {
-                    $shpCena = $pl['price2'];
-                    if ($pl['2price'] > 0) {
-                        $shpCena = $pl['2price'];
-                    }
-                    $shpCena = $this->shopSaleM($shpCena, $pl);
-                    if ($pl['kolvo'] > 0) {
-                        $shpCena = $shpCena * $pl['kolvo'];
-                    }
-                    $plmx = 0;
-                    if ($pl['iznosMAXi'] != $pl['iznosMAX'] && $pl['iznosMAX'] != 0) {
-                        $plmx = $pl['iznosMAX'];
-                    } else {
-                        $plmx = $pl['iznosMAXi'];
-                    }
-                    if ($pl['iznosNOW'] > 0) {
-                        $prc1 = floor($pl['iznosNOW']) / ceil($plmx) * 100;
-                    } else {
-                        $prc1 = 0;
-                    }
-                    $shpCena = $shpCena / 100 * (100 - $prc1);
-                    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); // ���� ���������
-                    if (isset($po['art'])) {
-                        $shpCena = $this->round2($shpCena * $this->berezCena()); // ���� ����
-                    } else {
-                        $shpCena = $this->round2($shpCena * $this->berezCena()); // ����
-                    }
-                    if ($shpCena < 0) {
-                        $shpCena = 0;
-                    }
-                    if (isset($po['toclan'])) {
-                        $po['toclan1'] = explode('#', $po['toclan']);
-                        $us_1 = $po['toclan1'][1];
-                        if ($us_1 != $this->info['id']) {
-                            $d_s = false;
-                        } else {
-                            $d_s = true;
-                        }
-                    } else {
-                        $d_s = true;
-                    }
-                    if ($d_s == true) {
-                        $is1 .= '<a href="javascript:void(0)" onClick="if(confirm(\'������� ������� &quot;' . $pl['name'] . '&quot; �� ' . $shpCena . ' ���.?\')){ location = \'main.php?sale&sd4=' . $this->info['nextAct'] . '&item=' . $pl['id'] . '&rnd=' . $code . '\'; }">������� �� ' . $shpCena . ' ���.</a>';
-                    } else {
-                        $is1 .= '��� �� ��� �������.';
-                    }
-                } elseif ($type == 30) {
-                    if (isset($po['toclan'])) {
-                        $po['toclan1'] = explode('#', $po['toclan']);
-                        $us_1 = $po['toclan1'][1];
-                        if ($us_1 != $this->info['id']) {
-                            $d_s = false;
-                        } else {
-                            $d_s = true;
-                        }
-                    } else {
-                        $d_s = true;
-                    }
-                    if ($d_s == true) {
-                        $is1 .= '<form method="POST"><input type="hidden" value="' . $pl['id'] . '" name="iid"><input type="text" value="" name="summTR"><input type="submit" value="����� � �������" name="PresTR"></form>';
-                    } else {
-                        $is1 .= '��� �� ��� �������.';
-                    }
-                } elseif ($type == 31) {
-                    $is1 .= '<form method="POST"><input type="hidden" value="' . $pl['id'] . '" name="iid"><input type="submit" value="�������" name="PresTR"> </form>';
-                } else {
-                    if ($d[2] == 1) { //����� ������������
-                        $inv1 = '';
-                        if (isset($_GET['inv'])) {
-                            $inv1 = 'inv=1&';
-                        }
-                        if ($pl['item_id'] == 74) {
-                            $is1 .= '<a onclick="top.addNewSmile(' . $pl['id'] . ',0); return false;" href="javascript:void(0)" title="������������">���-��</a>';
-                        } else {
-                            $useUrl = '';
-                            if ($pl['magic_inc'] == '') {
-                                $pl['magic_inc'] = $pl['magic_inci'];
-                            }
-                            if ($pl['magic_inc'] && $pl['type'] == 30) {
-                                //���������� �������
-                                $pldate = '<table border=\\\'0\\\' width=\\\'100%\\\' cellspacing=\\\'0\\\' cellpadding=\\\'5\\\'><tr><td rowspan=2 width=\\\'80\\\' valign=\\\'middle\\\'><div align=\\\'center\\\'><img src=\\\'https://img.new-combats.com/i/items/' . $pl['img'] . '\\\'></div></td><td valign=\\\'middle\\\' align=\\\'left\\\'>&quot;<strong>' . $pl['name'] . '</strong>&quot;<br>������������ ������?</td></tr></table>';
-                                $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'])) { //�� ���������
-                                    $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 = '<table border=\\\'0\\\' width=\\\'100%\\\' cellspacing=\\\'0\\\' cellpadding=\\\'5\\\'><tr><td rowspan=2 width=\\\'80\\\' valign=\\\'middle\\\'><div align=\\\'center\\\'><img src=\\\'https://img.new-combats.com/i/items/' . $pl['img'] . '\\\'></div></td><td valign=\\\'middle\\\' align=\\\'left\\\'>&quot;<strong>' . $pl['name'] . '</strong>&quot;<br>������������ ������?</td></tr></table>';
-                                    $useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\',' . (0 + $_GET['otdel']) . ');';
-                                }
-                                //�� �������
-                            }
-                            if ($useUrl != '') {
-                                $is1 .= '<a href="javascript:void(0)" onClick="' . $useUrl . '" title="������������">���-��</a>';
-                            } else {
-                                $d[2] = 0;
-                            }
-                        }
-                    }
-
-                    if ($pl['max_text'] > 0 && $pl['max_text'] - $pl['use_text'] > 0) {
-                        $is1 .= '<a onclick="top.addNewText(' . $pl['id'] . ',' . ($pl['max_text'] - $pl['use_text']) . ',' . $pl['inRazdel'] . '); return false;" href="javascript:void(0)" title="�������� ����� �� ��������">��������</a><br>';
-                    }
-                    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 .= '<br>';
-                        }
-                        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 .= '<a href="javascript:void(0);" onClick="top.useRune(' . $pl['id'] . ',\'' . $pl['name'] . '\',\'' . $pl['img'] . '\',\'main.php?inv=1&otdel=' . ((int)$_GET['otdel']) . '&use_rune=' . $pl['id'] . '&rnd=' . $code . '\');return false;" title="������������">���-��</a>';
-                        }
-                    }
-
-                    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 .= '<br>';
-                            }
-                            $is1 .= '<a href="main.php?otdel=' . $pl['inRazdel'] . '&inv=1&oid=' . $pl['id'] . '&rnd=' . $code . '" title="������">������</a>';
-                        }
-                    }
-                    if (isset($po['open']) && $d[0] == 1) {
-                        if ($d[2] == 1) {
-                            $is1 .= '<br>';
-                        }
-                        $is1 .= '<a href="main.php?otdel=' . $pl['inRazdel'] . '&inv=1&open=1&oid=' . $pl['id'] . '&rnd=' . $code . '" title="�������">�������</a>';
-                    }
-                    if (isset($po['close'])) {
-                        if ($d[2] == 1) {
-                            $is1 .= '<br>';
-                        }
-                        $is1 .= '<small><strong>������� ������</strong></small>';
-                    }
-                    if ($pl['group'] > 0) {
-                        $is1 .= '<br>';
-                        if ($this->itemsX($pl['id']) < $pl['group_max']) {
-                            $is1 .= '<a href="main.php?inv=1&otdel=' . ((int)$_GET['otdel']) . '&stack=' . $pl['id'] . '&rnd=' . $code . '" title="�������"><img src="https://img.new-combats.com/i/stack.gif" /></a>';
-                        }
-                        if ($this->itemsX($pl['id']) > 1) {
-                            $is1 .= ' <a
-							onClick="top.unstack(' . $pl['id'] . ',\'' . $pl['img'] . '\',\'' . $pl['name'] . '\',1,\'<table border=\\\'0\\\' width=\\\'100%\\\' cellspacing=\\\'0\\\' cellpadding=\\\'5\\\'><tr><td align=\\\'center\\\' rowspan=\\\'2\\\' width=\\\'70px\\\'><img src=\\\'https://img.new-combats.com/i/items/' . $pl['img'] . '\\\'></td><td align=\\\'left\\\'>��������� ������� <strong>' . $pl['name'] . '</strong>?</td></tr></table>\',\'' . intval($_GET['otdel']) . '\'); return false;"
-							href="main.php?inv=1&otdel=' . ((int)$_GET['otdel']) . '&unstack=' . $pl['id'] . '&rnd=' . $code . '" title="���������"><img src="https://img.new-combats.com/i/unstack.gif" /></a>' . $script;
-                        }
-                    }
-                    if (isset($po['toclan'])) {
-                        $po['toclan1'] = explode('#', $po['toclan']);
-                        $us_1 = $po['toclan1'][1];
-                        if ($us_1 != $this->info['id']) {
-                            $d[1] = 0;
-                        }
-                    }
-
-                    $is1 .= ' <a href="javascript:void(0);" onclick="top.addfastpanel(\'' . $pl['id'] . '\',\'' . $pl['name'] . '\',\'' . $pl['type'] . '\',\'' . $pl['1price'] . '\',\'' . $pl['2price'] . '\',\'' . $this->city_name[$pl['maidin']] . '\',\'' . $pl['img'] . '\',\'' . $pl['item_id'] . '\',\'' . $pl['iznosNOW'] . '\',\'' . $pl['iznosMAX'] . '\',\'' . intval($_GET['otdel']) . '\',\'' . $d[0] . '\',\'' . $d[2] . '\',\'0\');" title="�������� � ���������"><img width="16" height="15" src="https://img.new-combats.com/add_itm2.gif"></a> ';
-
-                    if ($d[1] == 1) { //����� ��������
-                        if (!isset($po['nodelete'])) {
-                            $is1 .= ' <a onClick="top.drop(' . $pl['id'] . ',\'' . $pl['img'] . '\',\'' . $pl['name'] . '\',1,\'<table border=\\\'0\\\' width=\\\'100%\\\' cellspacing=\\\'0\\\' cellpadding=\\\'5\\\'><tr><td rowspan=2><img src=\\\'https://img.new-combats.com/i/items/' . $pl['img'] . '\\\'></td><td align=\\\'left\\\'>������� <strong>' . $pl['name'] . '</strong> ����� ������, �� ������� ?</td></tr></table>\',\'' . intval($_GET['otdel']) . '\'); return false;" href="javascript:void(0);" title="�������� �������"><img src="https://img.new-combats.com/i/clear.gif"></a>';
-                        }
-                        //$is1 .= ' <img onclick="if (confirm(\'������� &quot;'.$pl['name'].'&quot; ����� ������, �� �������?\')) window.location=\'main.php?inv=1&delete='.$pl['id'].'&otdel='.((int)$_GET['otdel']).'&sd4='.$this->info['nextAct'].'&rnd='.$code.'\'" title="�������� �������" src="https://img.new-combats.com/i/clear.gif" style="cursor:pointer;">';
-                    }
-                }
-
-                //�������� ��� � ���� (:
-                $rt[2] .= '<tr class="item"><td align="center" bgcolor="#' . $clr[$k] . '"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="100" align="center" style="border-right:#A5A5A5 1px solid; padding:5px;">' . $is1 . '</td><td valign="top" align="left" style="padding-left:3px; padding-bottom:3px; padding-top:7px;"><div align="left">' . $is2 . '</div></td></tr></table></td></tr>';
-                $rt[1] += $pl['massa'];
-                $i++;
-            }
-            $j++;
-        }
-        $rt[0] = $i;
-        $rt['collich'] = $j;
-        return $rt;
-    }
-
-    public function itemsX($id, $uid = null, $item_id = null)
-    {
-        $item = mysql_fetch_array(mysql_query('SELECT `iu`.`id`,`iu`.`item_id`,`iu`.`uid`,`iu`.`inGroup`,`iu`.`inShop` FROM `items_users` AS `iu` WHERE `iu`.`delete` = "0" AND `iu`.`id` = "' . ((int)$id) . '" LIMIT 1 '));
-        if ($item['inGroup'] == 0) {
-            $grp = ' LIMIT 1';
-        } else {
-            $grp = ' LIMIT 1000';
-        }
-        //$grp = ' LIMIT 1';
-        $r = mysql_num_rows(mysql_query('SELECT `iu`.`id` FROM `items_users` AS `iu` WHERE `iu`.`inShop` = "' . $item['inShop'] . '" AND `iu`.`item_id` = "' . $item['item_id'] . '" AND `iu`.`uid` = "' . ($item['uid']) . '" AND `iu`.`delete` = "0" AND `iu`.`inGroup` = "' . ($item['inGroup']) . '" ' . $grp . ' '));
-        unset($item);
-        return $r;
-    }
-
-    private function stackGroupCheck($uid, $group, $item)
-    { // ������� ���������������� ID ������ ���������.
-        $g = 0;
-        $i = 0;
-        do {
-            $i++;
-            $gr = mysql_fetch_array(mysql_query('SELECT `iu`.id, `iu`.inGroup, `iu`.`item_id` FROM `items_users` AS `iu` 
-			WHERE `iu`.`uid`="' . $uid . '" AND `iu`.`delete`="0"AND `iu`.`inGroup`="' . $i . '" AND `iu`.item_id="' . $item . '" 
-			LIMIT 1'));
-            if (empty($gr['inGroup'])) {
-                $g = 1;
-            }
-        } while ($g == 0);
-        return $i;
-    }
-
-    public function stack($id)
-    {
-        global $c, $code;
-        $where = '';
-        $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`, count(`iuu`.id) as inGroupCount
-		FROM `items_users` AS `iu`
-		LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`)
-		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) { // ���� ������� �� � ������, �������� ��� ������� �������� �� �������.
-                $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 � ��������� ���������� ������
-
-                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'));
-                    if (isset($curItem['id'])) {
-                        $where = ' `iu`.`inGroup` = "' . $curItem['inGroup'] . '" AND ';
-                    }
-                    $itm['group_max'] = $needG;
-                } else {
-                    $itm['group_max'] = $needG;
-                }
-                $items = 1;
-            }
-            $s = 0;
-            do {
-                if (!isset($curG) and $curNG == 0) $itm['inGroup'] = $this->stackGroupCheck($this->info['id'], $itm['inGroup'], $itm['item_id']);
-                $sp = 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 ' . $where . ' `iu`.`kolvo` = "1" AND `iu`.`item_id` = "' . $itm['item_id'] . '" AND `iu`.`uid` = "' . $this->info['id'] . '" AND `iu`.`delete` = "0" AND `iu`.`inOdet` = "0" AND `iu`.`inShop` = "0" AND `im`.`group` = "1" ORDER BY `iu`.`inGroup` ASC LIMIT ' . $itm['group_max'] . '');
-                $i = 0;
-                $j = 0;
-                while ($pl = mysql_fetch_array($sp)) {
-                    $pl['data'] = $this->lookStats($pl['data']);
-                    unset($pl['data']['frompisher']);
-                    $pl['data'] = $this->impStats($pl['data']);
-                    $itm['data'] = $this->lookStats($itm['data']);
-                    unset($itm['data']['frompisher']);
-                    $itm['data'] = $this->impStats($itm['data']);
-                    if ($pl['data'] == $itm['data'] && $pl['name'] == $itm['name'] && $itm['iznosMAX'] == $pl['iznosMAX'] && $pl['iznosNOW'] == 0 && ($pl['timeOver'] == 0 || $pl['timeOver'] > time()) && $pl['gift'] == $itm['gift']) {
-                        $upd = mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `inGroup` = "' . $itm['inGroup'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
-                        if ($upd) {
-                            $j++;
-                        }
-                        $i++;
-                    }
-                }
-                mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
-                $s++;
-            } while ($s < $items);
-        }
-    }
-
-    public function unstack($id, $x = null)
-    {
-        $id = (int)$id;
-        $itm = mysql_fetch_array(mysql_query('SELECT `iu`.id, `iu`.inGroup, `im`.`id` as item_id,`im`.`name`, count(`iuu`.id) as inGroupCount
-FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) LEFT JOIN `items_users` as `iuu` ON (`iuu`.inGroup = `iu`.inGroup AND `iuu`.item_id = `im`.id )
-WHERE `iuu`.`uid`="' . $this->info['id'] . '" AND `iu`.`uid`="' . $this->info['id'] . '" AND `iu`.`delete`="0" AND `im`.`group` = "1" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.id=' . mysql_real_escape_string((int)$id) . '
-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']); //���-�� �������
-                $inGroup = 0;
-            } elseif ($x != 0) {
-                $inGroup = $this->stackGroupCheck($this->info['id'], $itm['inGroup'], $itm['item_id']);
-            } else {
-                $inGroup = 0;
-            }
-            $sp = 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`.`inGroup` = "' . $itm['inGroup'] . '" AND `iu`.`item_id` = "' . $itm['item_id'] . '" AND `iu`.`inOdet` = "0" AND `iu`.`inShop` = "0" AND `im`.`group` = "1" LIMIT ' . $x . '');
-            $i = 0;
-            $j = 0;
-            while ($pl = mysql_fetch_array($sp)) {
-                $upd = mysql_query('UPDATE `items_users` SET `inGroup` = "' . $inGroup . '", `lastUPD` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
-                if ($upd) {
-                    $j++;
-                }
-                $i++;
-            }
-            if ($this->itemsX($itm['id']) == 1) {
-                mysql_query('UPDATE `items_users` SET `inGroup` = "0", `lastUPD` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
-            }
-            if ($this->itemsX($pl['id']) == 1) {
-                mysql_query('UPDATE `items_users` SET `inGroup` = "0", `lastUPD` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
-            }
-
-        }
-    }
-
-    public function lookStats($m)
-    {
-        $arr = json_decode(str_replace(['=', '|'], ['":', ',"'], '{"' . $m . '}'), true);
-        return $arr ?: [];
-    }
-
-    public function testItems($uid, $sn, $dt)
-    {
-        global $c, $code;
-        $st = false;
-        $rt = false;
-        if ($uid != $this->info['id']) {
-            $u = mysql_fetch_array(mysql_query('SELECT `u`.`align`,`u`.`align2`,`u`.`battle`,`u`.`clan`,`u`.`animal`,`u`.`id`,`u`.`level`,`u`.`login`,`u`.`sex`,`u`.`design`,`u`.`autospell`,`u`.`noplaw`,`u`.`obraz`,
-			`st`.`id`,`st`.`lider`,`st`.`btl_cof`,`st`.`last_hp`,`st`.`last_pr`,`st`.`smena`,`st`.`stats`,`st`.`hpAll`,`st`.`mpAll`,`st`.`hpNow`,`st`.`mpNow`,`st`.`enNow`,`st`.`transfers`,`st`.`regHP`,`st`.`regMP`,`st`.`showmenu`,`st`.`prmenu`,`st`.`ability`,`st`.`skills`,`st`.`sskills`,`st`.`nskills`,`st`.`exp`,`st`.`minHP`,`st`.`minMP`,`st`.`zv`,`st`.`dn`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`last_a`,`st`.`last_b`,`st`.`battle_text`,`st`.`upLevel`,`st`.`wipe`,`st`.`bagStats`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`nextAct`,`st`.`active`,`st`.`bot`,`st`.`lastAlign`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`s`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`ref_data`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`bn_capitalcity`,`st`.`bn_demonscity`
-			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'));
-            if ($sn == 0) {
-                $sn = $this->getStats($uid, $i1);
-            }
-        } else {
-            $u = $this->info;
-            if (isset($this->stats['hpAll'])) {
-                $sn = $this->stats;
-            } elseif ($sn != 0) {
-
-            } else {
-                $sn = $this->getStats($uid, $i1);
-            }
-        }
-        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`,
-			`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`.`inOdet`!="0" OR `iu`.`data` LIKE "%srok%" OR `iu`.`data` LIKE "%vip_sale%" OR `iu`.`data` LIKE "%sudba=1%" OR ( `iu`.`data` LIKE "%zazuby=%" AND `iu`.`data` NOT LIKE "%srok=%" ) OR `iu`.`iznosNOW` > 0 OR `im`.`srok` > 0 OR (`iu`.`timeOver`<' . time() . ' AND `iu`.`timeOver`!="0")) AND `iu`.`uid`="' . $u['id'] . '" AND (`iu`.`delete`="0" OR `iu`.`delete`="1000")');
-            while ($itm = mysql_fetch_array($cl)) {
-                $po = [];
-                $po = $this->lookStats($itm['data']);
-                $po['lvl'] = $u['level'];
-                //��������� ����������
-                $t = $this->items['tr'];
-                $x = 0;
-                $notr = 0;
-                $j = 1;
-                while ($j <= 4) {
-                    if (!isset($po['tr_s' . $j]) && $itm['type'] != 26) {
-                        $po['tr_s' . $j] = 0;
-                    }
-                    $j++;
-                }
-                while ($x < count($t)) {
-                    $n = $t[$x];
-                    if (isset($po['tr_' . $n]) && $n == 'sex') {
-                        if ($po['tr_' . $n] != $this->info['sex']) {
-                            $notr++;
-                        }
-                    } elseif (isset($po['tr_' . $n])) {
-                        if ($po['tr_' . $n] > $this->stats[$n] && $n != 'align' && $n != 'align_bs') {
-                            $notr++;
-                        }
-                    }
-                    $x++;
-                }
-                if ($this->info['twink'] > 0) {
-                    //�� ������ 100 ���.
-                    if ($itm['price2'] > 1 || $itm['2price'] > 1) {
-                        $notr++;
-                    }
-                    //������ ���� + �����
-                    if (isset($po['rune']) && $po['rune'] > 0) {
-                        $notr++;
-                    }
-                    if (isset($po['spell_id']) && $po['spell_id'] > 0) {
-                        $notr++;
-                    }
-                }
-                if (isset($po['sudba']) && $po['sudba'] == 1) {
-                    $po['sudba'] = $u['login'];
-                    $itm['data'] = $this->impStats($po);
-                    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');
-                }
-                if (isset($po['srok']) && $po['srok'] > 0) {
-                    $itm['srok'] = $po['srok'];
-                }
-                if (isset($po['vip_sale'])) {
-                    if ($sn['silver'] < 2 && ($itm['time_create'] - time()) < 0) {
-                        if ($itm['item_id'] == 4704) {
-                            $po['musor2'] = 4708;
-                        }
-                        $this->isport($itm['id'], $itm['timeOver'], $itm['overType'], $u['id'], (int)$po['musor2'], $itm['type'], $itm['name'], $po['zazuby']);
-                        $notr++;
-                    }
-                }
-                if ($itm['iznosNOW'] >= ceil($itm['iznosMAX']) && $itm['iznosMAXi'] != 999999999) {
-                    $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']);
-                        }
-                    }
-                }
-                if ($itm['time_create'] + $itm['srok'] <= time() && $itm['srok'] > 0 && $itm['time_sleep'] == 0) {
-                    if ($itm['inOdet'] != 0) {
-                        $this->snatItem($itm['id'], $u['id']);
-                        $snIt++;
-                    }
-                    //������� �������
-                    if ($itm['item_id'] == 4704) {
-                        $po['musor2'] = 4708;
-                    }
-                    $this->isport($itm['id'], $itm['timeOver'], $itm['overType'], $u['id'], (int)$po['musor2'], $itm['type'], $itm['name'], $po['zazuby']);
-                } elseif ($itm['time_create'] + $itm['srok'] <= time() && $itm['srok'] > 0) {
-                    echo 'test';
-                }
-            }
-
-            if ($snIt > 0) {
-                $this->testItems($uid, $sn, 1);
-            } elseif ($dt == 0) {
-                return -2;
-            }
-        } else {
-            return 0;
-        }
-    }
-
-    public function recr($id, $tp, $uid, $id2)
-    {
-        if ($id != 0) {
-            if ($uid != 0) {
-                $uid2 = 'AND `uid`="' . $uid . '"';
-            } else {
-                $uid2 = '';
-            }
-            $upd = mysql_query('UPDATE `items_users` SET `delete`="' . time() . '" WHERE `id` = "' . $id . '" ' . $uid2 . ' LIMIT 1');
-            if ($upd) {
-                $this->addDelo(2, $uid, '&quot;<font color="maroon">System.inventory</font>&quot;: ������� [itm:' . $it . '] ��� <strong>������</strong>.', time(), $this->info['city'], 'System.inventory', 0, 0);
-                if ($id2 > 1) {
-                    //��������� ������ �������
-                    $this->addItem($id2, $uid, 'noodet=1|noremont=1');
-                }
-            }
-        }
-    }
-
-    public function isport($it, $t, $tp, $uid, $id2, $type, $name, $zub)
-    {
-        if ($id2 == 4708) {
-            $tp = 1;
-        }
-        if ($it != 0) {
-            if ($uid != 0) {
-                $uid2 = 'AND `uid`="' . $uid . '"';
-            } else {
-                $uid2 = '';
-            }
-            $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, '&quot;<font color="maroon">System.inventory</font>&quot;: ������� <strong>' . $name . '</strong> [itm:' . $it . '] ��� <strong>��������</strong>.', time(), $this->info['city'], 'System.inventory', 0, 0);
-                if ($tp != 0) {
-                    //��������� ���������� ������� � ���������, � ����������� �� ����
-                    $zzba = '';
-                    if ($zub > 0) {
-                        $zzba = '|zazuby=1';
-                    }
-                    $po = $this->lookStats($this->stats['items'][$i]['data']);
-                    if ($id2 > 0) {
-                        if ($id2 == 4708) {
-                            $this->addItem($id2, $uid, '|notransfer=1|nosale=1' . $zzba);
-                        } else {
-                            $this->addItem($id2, $uid, '|noodet=1' . $zzba);
-                        }
-                    } else {
-                        if ($type == 30) {
-                            //����������� �������
-                            $this->addItem(4036, $uid, '|renameadd=' . $name . '|noodet=1' . $zzba);
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    public function btlMagicList()
-    {
-        global $c;
-        $i = 1;
-        $sv = [];
-        while ($i <= 10) {
-            $sv[$i] = '<img class="nopriemuse" title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" />';
-            $i++;
-        }
-        $i = 0;
-        while ($i < count($this->stats['items'])) {
-            if ($this->stats['items'][$i]['inslot'] == 40 || $this->stats['items'][$i]['inslot'] == 51) {
-                if ($this->stats['items'][$i]['useInBattle'] == 0 || $this->stats['items'][$i]['btl_zd'] > 0 || $this->stats['items'][$i]['iznosNOW'] >= $this->stats['items'][$i]['iznosMAX'] || $this->stats['items'][$i]['magic_inci'] == '' || $this->stats['items'][$i]['magic_inci'] == '0') {
-                    $vl = ' class="nopriemuse"';
-                } else {
-                    $po = $this->lookStats($this->stats['items'][$i]['data']);
-                    if ($po['useOnLogin'] == 1) {
-                        $useUrl = 'top.useMagicBattle(\'' . $this->stats['items'][$i]['name'] . '\',' . $this->stats['items'][$i]['id'] . ',\'' . $this->stats['items'][$i]['img'] . '\',1,1,\'\',\'' . $this->stats['items'][$i]['useInBattle'] . '\');';
-                    } else {
-                        $useUrl = 'top.useMagicBattle(\'' . $this->stats['items'][$i]['name'] . '\',' . $this->stats['items'][$i]['id'] . ',\'' . $this->stats['items'][$i]['img'] . '\',1,2);';
-                    }
-                    $vl = 'style="cursor:pointer" onclick="' . $useUrl . '"';
-                }
-                $sv[$this->stats['items'][$i]['inOdet'] - 39] = '<img ' . $vl . ' title="�������������: ' . floor($this->stats['items'][$i]['iznosNOW']) . '/' . floor($this->stats['items'][$i]['iznosMAX']) . '" src="https://img.new-combats.com/i/items/' . $this->stats['items'][$i]['img'] . '" />';
-            }
-            $i++;
-        }
-        $r = '<table border="0" cellspacing="0" cellpadding="0">' .
-            '<tr>' .
-            '<td>' . $sv[1] . '</td>' .
-            '<td>' . $sv[2] . '</td>' .
-            '<td>' . $sv[3] . '</td>' .
-            '<td>' . $sv[4] . '</td>' .
-            '<td>' . $sv[5] . '</td>' .
-            '<td>' . $sv[6] . '</td>' .
-            '<td>' . $sv[7] . '</td>' .
-            '<td>' . $sv[8] . '</td>' .
-            '<td>' . $sv[9] . '</td>' .
-            '<td>' . $sv[10] . '</td>' .
-            '<td>' . $sv[11] . '</td>' .
-            '<td>' . $sv[12] . '</td>' .
-            '</tr>' .
-            '</table>';
-        return str_replace('"', '\"', $r);
-    }
-
-    public function nameItemMf($pl, $po)
-    {
-        $r = $pl['name'];
-        if (isset($po['icos'])) {
-            $r = '<span class=icos_' . $po['icos'] . ' >' . $pl['name'] . ' <span style=font-size:8px>&nbsp;' . $po['icos'] . '&nbsp;</span></span>';
-        }
-        //if( $this->info['admin'] > 0 ) {
-        if (isset($po['rune']) && $po['rune'] > 0) {
-            $rnc = explode(' ', $po['rune_name']);
-            if ($rnc[0] == '�����') {
-                $rnc = '#9b5d40';
-            } elseif ($rnc[0] == '����') {
-                $rnc = '#3a2b64';
-            } elseif ($rnc[0] == '����') {
-                $rnc = '#20a3b0';
-            } elseif ($rnc[0] == '����') {
-                $rnc = '#4c7718';
-            } else {
-                $rnc = '#4c4c4c';
-            }
-            $r .= '<br><font color=green>����: <strong>' . $po['rune_name'] . '</strong></font>';
-            unset($rnc);
-        }
-        if (isset($po['spell'])) {
-            $rnc = explode(' ', $po['spell_name']);
-            if ($rnc[2] == '[0]') {
-                $rnc = '#282828';
-            } elseif ($rnc[2] == '[1]') {
-                $rnc = '#624542';
-            } elseif ($rnc[2] == '[2]') {
-                $rnc = '#77090b';
-            } elseif ($rnc[2] == '[3]') {
-                $rnc = '#d99800';
-            } else {
-                $rnc = '#d99800';
-            }
-            $r .= '<br><font color=' . $rnc . '>' . $po['spell_name'] . '</font>';
-            unset($rnc);
-        }
-        return $r;
-    }
-
-    public function getInfoItemInfo($pl)
-    {
-        $lvar = '';
-        $td = $this->lookStats($pl['data']);
-
-        if (isset($td['sv_yron_max']) && $td['sv_yron_max'] > 0) {
-            $lvar .= '<br>����: ' . $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) {
-                $m1l = '+';
-                if ($td['add_mab1'] < 0) {
-                    $m1l = '';
-                }
-                $lvar .= '<br>����� ������: ' . $m1l . '' . (0 + $td['add_mab1']) . '';
-            } else {
-                $lvar .= '<br>����� ������: ' . (0 + $td['add_mib1']) . '-' . (0 + $td['add_mab1']) . '';
-            }
-        }
-        //
-        $t = $this->items['add'];
-        $x = 0;
-        while ($x < count($t)) {
-            $n = $t[$x];
-            if (isset($td['add_' . $n], $this->is[$n])) {
-                $z = '+';
-                if ($td['add_' . $n] < 0) {
-                    $z = '';
-                }
-                $lvar .= '<br>' . $this->is[$n] . ': ' . $z . '' . $td['add_' . $n];
-            }
-            $x++;
-        }
-        //
-        $x = 0;
-        while ($x < count($t)) {
-            $n = $t[$x];
-            if (isset($td['sv_' . $n])) {
-                $z = '+';
-                if ($td['sv_' . $n] < 0) {
-                    $z = '';
-                }
-                if ($n != 'yron_min' && $n != 'yron_max') {
-                    $lvar .= '<br>' . $this->is[$n] . ': ' . $z . '' . $td['sv_' . $n];
-                }
-            }
-            $x++;
-        }
-        if ($pl['2h'] == 1) {
-            $lvar .= '<br>� ��������� ������';
-        }
-        if (isset($po['zonb'])) {
-            $lvar .= '<br>���� ������������: ';
-            if ($lvar['zonb'] > 0) {
-                $x = 1;
-                while ($x <= $td['zonb']) {
-                    $lvar .= '+';
-                    $x++;
-                }
-            } else {
-                $lvar .= '�';
-            }
-        }
-
-        //
-        if (isset($td['add_mab2']) && $td['add_mab2'] > 0) {
-            if ($td['add_mib2'] == $td['add_mab2'] && $pl['geniration'] == 1) {
-                $m1l = '+';
-                if ($td['add_mab2'] < 0) {
-                    $m1l = '';
-                }
-                $lvar .= '<br>����� �������: ' . $m1l . '' . (0 + $td['add_mab2']) . '';
-            } else {
-                $lvar .= '<br>����� �������: ' . (0 + $td['add_mib2']) . '-' . (0 + $td['add_mab2']) . '';
-            }
-        }
-        if (isset($td['add_mab3']) && $td['add_mab3'] > 0) {
-            if ($td['add_mib3'] == $td['add_mab3'] && $pl['geniration'] == 1) {
-                $m1l = '+';
-                if ($td['add_mab3'] < 0) {
-                    $m1l = '';
-                }
-                $lvar .= '<br>����� �����: ' . $m1l . '' . (0 + $td['add_mab3']) . '';
-            } else {
-                $lvar .= '<br>����� �����: ' . (0 + $td['add_mib3']) . '-' . (0 + $td['add_mab3']) . '';
-            }
-        }
-        if (isset($td['add_mab4']) && $td['add_mab4'] > 0) {
-            if ($td['add_mib4'] == $td['add_mab4'] && $pl['geniration'] == 1) {
-                $m1l = '+';
-                if ($td['add_mab4'] < 0) {
-                    $m1l = '';
-                }
-                $lvar .= '<br>����� ���: ' . $m1l . '' . (0 + $td['add_mab4']) . '';
-            } else {
-                $lvar .= '<br>����� ���: ' . (0 + $td['add_mib4']) . '-' . (0 + $td['add_mab4']) . '';
-            }
-        }
-        if ($pl['iznosMAX'] > 0) {
-            $lvar .= '<br>�������������: ' . floor($pl['iznosNOW']) . '/' . ceil($pl['iznosMAX']);
-        }
-
-        if ($po['battleUseZd'] > 0) {
-            $lvar .= '<br>�������� �������������: ' . $this->timeOut($po['battleUseZd']) . '';
-        }
-
-        if (isset($td['gravi'])) {
-            $lvar .= '<hr><strong>&quot;<i>' . $td['gravi'] . '</i>&quot;</strong>';
-        }
-
-        return $lvar;
-    }
-
-
-    public function getInfoPers($uid, $i1, $sn = 0, $ivv = 0)
-    {
-        global $c, $code;
-
-        $st = false;
-        $rt = false;
-        $type_info = 1;
-        if ($uid != $this->info['id']) {
-            $u = mysql_fetch_array(mysql_query('SELECT `u`.`inTurnir`,`u`.`allLock`,`u`.`battle`,`u`.`zag`,`u`.`banned`,`u`.`align`,`u`.`align2`,`u`.`clan`,`u`.`animal`,`u`.`id`,`u`.`level`,`u`.`login`,`u`.`sex`,`u`.`design`,`u`.`autospell`,`u`.`noplaw`,`u`.`obraz`,`u`.`vip`,
-			`st`.`id`,`st`.`lider`,`st`.`btl_cof`,`st`.`last_hp`,`st`.`last_pr`,`st`.`smena`,`st`.`stats`,`st`.`hpAll`,`st`.`mpAll`,`st`.`hpNow`,`st`.`mpNow`,`st`.`enNow`,`st`.`transfers`,`st`.`regHP`,`st`.`regMP`,`st`.`showmenu`,`st`.`prmenu`,`st`.`ability`,`st`.`skills`,`st`.`sskills`,`st`.`nskills`,`st`.`exp`,`st`.`minHP`,`st`.`minMP`,`st`.`zv`,`st`.`dn`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`last_a`,`st`.`last_b`,`st`.`battle_text`,`st`.`upLevel`,`st`.`wipe`,`st`.`bagStats`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`nextAct`,`st`.`active`,`st`.`bot`,`st`.`lastAlign`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`s`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`ref_data`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`bn_capitalcity`,`st`.`bn_demonscity`
-			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'));
-            if ($sn == 0) {
-                $sn = $this->getStats($uid, $i1);
-            }
-        } else {
-            $u = $this->info;
-            if (isset($this->stats['hpAll'])) {
-                $sn = $this->stats;
-            } elseif ($sn != 0) {
-            } else {
-                $sn = $this->getStats($uid, $i1);
-            }
-        }
-
-        $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
-        ];
-
-        if (isset($u['id'], $u['stats'])) {
-            //if( $u['inTurnir'] > 0 ) {
-            //	$type_info = 2;
-            //}
-            $rt = [0 => '', 1 => []];
-            $st = [];
-            $st['id'] = $u['id'];
-            $st['login'] = $u['login'];
-            $st['lvl'] = $u['level'];
-
-            //�������������� �� ��������� � �� �����������
-            $witm = [];
-            $witm[1] = '<img width="60" height="60" style="display:block;" title="������ ���� ����" src="https://img.new-combats.com/i/items/w/w9.gif">';
-            $witm[2] = '<img width="60" height="40" style="display:block;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/w13.gif">';
-            $witm[3] = '<img width="60" height="60" style="display:block;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/w3.gif">';
-            $witm[4] = '<img width="60" height="80" style="display:block;" title="������ ���� �����" src="https://img.new-combats.com/i/items/w/w4.gif">';
-            $witm[7] = '<img width="60" height="40" style="display:block;" title="������ ���� ����" src="https://img.new-combats.com/i/items/w/w5.gif">';
-            $witm[8] = '<img width="60" height="20" style="display:block;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/w1.gif">';
-            $witm[9] = '<img width="60" height="20" style="display:block;" title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w2.gif">';
-            $witm[10] = '<img width="20" height="20" style="display:block;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/w6.gif">';
-            $witm[11] = '<img width="20" height="20" style="display:block;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/w6.gif">';
-            $witm[12] = '<img width="20" height="20" style="display:block;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/w6.gif">';
-            $witm[13] = '<img width="60" height="40" style="display:block;" title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w11.gif">';
-            $witm[14] = '<img width="60" height="60" style="display:block;" title="������ ���� ���" src="https://img.new-combats.com/i/items/w/w10.gif">';
-            $witm[16] = '<img width="60" height="80" style="display:block;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/w19.gif">';
-            $witm[17] = '<img width="60" height="40" style="display:block;" title="������ ���� �����" src="https://img.new-combats.com/i/items/w/w12.gif">';
-            //40-52 ���� ��� �����
-            $witm[53] = '<img width="40" height="20" style="display:block;" title="������ ���� ������ ������" src="https://img.new-combats.com/i/items/w/w15.gif">';
-            $witm[54] = '<img width="40" height="20" style="display:block;" title="������ ���� ����� ������" src="https://img.new-combats.com/i/items/w/w15.gif">';
-            $witm[55] = '<img width="40" height="20" style="display:block;" title="������ ���� ����������� ������" src="https://img.new-combats.com/i/items/w/w15.gif">';
-            $witm[56] = '<img width="40" height="20" style="display:block;" title="������ ���� �����" src="https://img.new-combats.com/i/items/w/w20.gif">';
-            $witm[57] = '<img width="40" height="20" style="display:block;" title="������ ���� �����" src="https://img.new-combats.com/i/items/w/w20.gif">';
-            $witm[58] = '<img width="40" height="20" style="display:block;" title="������ ���� �����" src="https://img.new-combats.com/i/items/w/w20.gif">';
-            $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`
-			FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`inOdet`!="0" AND `iu`.`uid`="' . $u['id'] . '" AND `iu`.`delete`="0"');
-            $wj = [1 => false, 2 => false, 4 => false, 5 => false, 6 => false];
-            $b1 = '<br>';
-
-            while ($pl = mysql_fetch_array($cl)) {
-                $td = $this->lookStats($pl['data']);
-
-                if (isset($td['modif'])) {
-                    $pl['name'] = $pl['name'] . ' (��)';
-                }
-
-                if (isset($td['upatack_lvl'])) {
-                    $pl['name'] = $pl['name'] . ' +' . $td['upatack_lvl'];
-                }
-
-                if (isset($td['mod_lvl'])) {
-                    $pl['name'] = $pl['name'] . ' ' . $mx . ' [' . $td['mod_lvl'] . ']';
-                }
-
-                if ($pl['inOdet'] == 1 || $pl['inOdet'] == 52 || ($pl['inOdet'] >= 4 && $pl['inOdet'] <= 6)) {
-                    $wj[$pl['inOdet']] = $pl;
-                }
-
-                $pl['name'] = $this->nameItemMf($pl, $td);
-
-                $lvar = $this->getInfoItemInfo($pl);
-
-                if (@isset($sn['items_img'][$tp_img[$pl['inOdet']]])) {
-                    $uimg = 'rimg/r' . $sn['items_img'][$tp_img[$pl['inOdet']]];
-                } else {
-                    $uimg = 'i/items/' . $pl['img'] . '';
-                }
-
-                $witm[$pl['inOdet']] = '<img style="display:block;" src="https://img.new-combats.com/' . $uimg . '" onMouseOver="top.hi(this,\'<center><strong>' . $pl['name'] . '</strong>' . $lvar . '</center>\',event,3,0,1,1,\'max-width:307px\')" onMouseOut="top.hic();" onMouseDown="top.hic();">';
-
-                if ($i1 == 1) {
-                    $witm[$pl['inOdet']] = '<a href="https://new-combats.com/item/' . $pl['item_id'] . '" target="_blank">' . $witm[$pl['inOdet']] . '</a>';
-                } else {
-                    if ($pl['inOdet'] >= 40 && $pl['inOdet'] <= 52 && !isset($_GET['inv'])) {
-                        $useUrl = '';
-                        if ($pl['magic_inc'] == '') {
-                            $pl['magic_inc'] = $pl['magic_inci'];
-                        }
-                        if ($pl['magic_inc'] && $pl['type'] == 30) {
-                            //���������� �������
-                            $pldate = '<table border=\\\'0\\\' width=\\\'100%\\\' cellspacing=\\\'0\\\' cellpadding=\\\'5\\\'><tr><td rowspan=2 width=\\\'80\\\' valign=\\\'middle\\\'><div align=\\\'center\\\'><img src=\\\'https://img.new-combats.com/i/items/' . $pl['img'] . '\\\'></div></td><td valign=\\\'middle\\\' align=\\\'left\\\'>&quot;<strong>' . $pl['name'] . '</strong>&quot;<br>������������ ������?</td></tr></table>';
-                            $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'])) {
-                                    $inv1 = 'inv=1&otdel=' . ((int)$_GET['otdel']) . '&';
-                                }
-                                $useUrl = 'top.useMagic(\'' . $pl['name'] . '\',' . (0 + $pl['id']) . ',\'' . $pl['img'] . '\',1,\'main.php?' . $inv1 . 'use_pid=' . $pl['id'] . '&rnd=' . $code . '\');';
-                            } else {
-                                //������ ������������� (�� ����, ���� ��� �������� ��������\������)
-                                $pldate = '<table border=\\\'0\\\' width=\\\'100%\\\' cellspacing=\\\'0\\\' cellpadding=\\\'5\\\'><tr><td rowspan=2 width=\\\'80\\\' valign=\\\'middle\\\'><div align=\\\'center\\\'><img src=\\\'https://img.new-combats.com/i/items/' . $pl['img'] . '\\\'></div></td><td valign=\\\'middle\\\' align=\\\'left\\\'>&quot;<strong>' . $pl['name'] . '</strong>&quot;<br>������������ ������?</td></tr></table>';
-                                $useUrl = 'top.useiteminv(\'' . (0 + $pl['id']) . '\',\'' . $pl['img'] . '\',\'' . $pl['img'] . '\',1,\'' . $pldate . '\',\'' . (0 + $_GET['otdel']) . '\');';
-                            }
-                        }
-                        $witm[$pl['inOdet']] = '<a href="javascript:void(0);" onClick="' . $useUrl . '">' . $witm[$pl['inOdet']] . '</a>';
-                    } elseif ($pl['item_id'] == 998 && !isset($_GET['inv'])) {
-                        //�������
-                        $witm[$pl['inOdet']] = '<a href="main.php?use_snowball=' . $code . '">' . $witm[$pl['inOdet']] . '</a>';
-                    } else {
-                        $witm[$pl['inOdet']] = '<a href="main.php?otdel=' . $pl['inRazdel'] . '&inv=1&sid=' . $pl['id'] . '&rnd=' . $code . '">' . $witm[$pl['inOdet']] . '</a>';
-                    }
-                }
-            }
-            //����,�����
-            $wj1i = '';
-            $br = '<div align=\\\'center\\\' style=\\\'margin:4px;\\\'><img src=\\\'https://img.new-combats.com/1x1.gif\\\' height=\\\'1\\\' width=\\\'111\\\' style=\\\'background-color:black;\\\'></div>';
-            if ($wj[1] != false) {
-                if ($wj[52] != false) {
-                    $wj1i .= $br;
-                }
-                $td = [];
-                $td = $this->lookStats($wj[1]['data']);
-                $wj[1]['name'] = $this->nameItemMf($wj[1], $td);
-                $wj1i .= '<strong>' . $wj[1]['name'] . '</strong>';
-                $wj1i .= $this->getInfoItemInfo($wj[1]);
-
-            }
-            if (isset($wj[52]) && $wj[52] != false) {
-                $td = $this->lookStats($wj[52]['data']);
-                $wj[52]['name'] = $this->nameItemMf($wj[52], $td);
-
-
-                $wj1i = '<strong>' . $wj[52]['name'] . '</strong>' . $wj1i;
-                $wj1i .= $this->getInfoItemInfo($wj[52]);
-                $wj[1]['img'] = $wj[52]['img'];
-                $wj[1]['id'] = $wj[52]['id'];
-                $wj[1]['inRazdel'] = $wj[52]['inRazdel'];
-            }
-            //������,�����,����
-            $wj4idd = $wj[5]['item_id'];
-            $wj4i = '';
-            if ($wj[6] != false) {
-                $td = [];
-                $td = $this->lookStats($wj[6]['data']);
-                $wj[6]['name'] = $this->nameItemMf($wj[6], $td);
-                $wj4i .= '<strong>' . $wj[6]['name'] . '</strong>';
-
-                $wj4i .= $this->getInfoItemInfo($wj[6]);
-                if ($wj[5] != false || $wj[4] != false) {
-                    $wj4i .= $br;
-                }
-            }
-            if ($wj[5] != false) {
-                $td = [];
-                $td = $this->lookStats($wj[5]['data']);
-                $wj[5]['name'] = $this->nameItemMf($wj[5], $td);
-                $wj4i .= '<strong>' . $wj[5]['name'] . '</strong>';
-
-                $wj4i .= $this->getInfoItemInfo($wj[5]);
-                if ($wj[4] != false) {
-                    $wj4i .= $br;
-                }
-            }
-            if ($wj[4] != false) {
-                $td = [];
-                $td = $this->lookStats($wj[4]['data']);
-                $wj[4]['name'] = $this->nameItemMf($wj[4], $td);
-                $wj4i .= '<strong>' . $wj[4]['name'] . '</strong>';
-
-                $wj4i .= $this->getInfoItemInfo($wj[4]);
-            }
-
-            if ( /*$i1 == 1 &&*/ (($this->info['noplaw'] == 1 && !isset($_GET['hide_plaw'])) || ($this->info['noplaw'] == 0 && isset($_GET['hide_plaw'])))) {
-                if ($wj[5] != false) {
-                    $wj[4]['img'] = $wj[5]['img'];
-                    $wj[4]['id'] = $wj[5]['id'];
-                    $wj[4]['inRazdel'] = $wj[5]['inRazdel'];
-                }
-            } else {
-                if ($wj[6] != false) {
-                    $wj[4]['img'] = $wj[6]['img'];
-                    $wj[4]['id'] = $wj[6]['id'];
-                    $wj[4]['inRazdel'] = $wj[6]['inRazdel'];
-                } elseif ($wj[5] != false) {
-                    $wj[4]['img'] = $wj[5]['img'];
-                    $wj[4]['id'] = $wj[5]['id'];
-                    $wj[4]['inRazdel'] = $wj[5]['inRazdel'];
-                }
-            }
-            if ($wj[1] != false || $wj[2] != false) {
-                if (isset($sn['items_img'][$tp_img[1]])) {
-                    $uimg = 'rimg/r' . $sn['items_img'][$tp_img[1]];
-                } else {
-                    $uimg = 'i/items/' . $wj[1]['img'] . '';
-                }
-                $witm[1] = '<img style="display:block;" src="https://img.new-combats.com/' . $uimg . '" onMouseOver="top.hi(this,\'<center>' . $wj1i . '</center>\',event,3,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();">';
-                if ($i1 == 1) {
-                    $witm[1] = '<a href="https://new-combats.com/item/' . $wj[1]['item_id'] . '" target="_blank">' . $witm[1] . '</a>';
-                } else {
-                    $witm[1] = '<a href="main.php?otdel=' . $wj[1]['inRazdel'] . '&inv=1&sid=' . $wj[1]['id'] . '&rnd=' . $code . '">' . $witm[1] . '</a>';
-                }
-            }
-            if ($wj[4] != false || $wj[5] != false || $wj[6] != false) {
-                if (isset($sn['items_img'][$tp_img[5]])) {
-                    $uimg = 'rimg/r' . $sn['items_img'][$tp_img[5]];
-                } else {
-                    $uimg = 'i/items/' . $wj[4]['img'] . '';
-                }
-                $witm[4] = '<img style="display:block;" src="https://img.new-combats.com/' . $uimg . '" onMouseOver="top.hi(this,\'<center>' . $wj4i . '</center>\',event,3,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();">';
-                if ($i1 == 1) {
-                    if ($wj4idd > 0) {
-                        $wj[4]['item_id'] = $wj4idd;
-                    }
-                    $witm[4] = '<a href="https://new-combats.com/item/' . $wj[4]['item_id'] . '" target="_blank">' . $witm[4] . '</a>';
-                } else {
-                    $witm[4] = '<a href="main.php?otdel=' . $wj[4]['inRazdel'] . '&inv=1&sid=' . $wj[4]['id'] . '&rnd=' . $code . '">' . $witm[4] . '</a>';
-                }
-            }
-            /*------------ ���������� ���. � ��������� ---------------*/
-            $nmmsgl1 = 0;
-            if ($u['align'] >= 1 && $u['align'] < 2) {
-                $nmmsgl1 = 1;
-            } elseif ($u['align'] >= 3 && $u['align'] < 4) {
-                $nmmsgl1 = 3;
-            } elseif ($u['align'] >= 7 && $u['align'] < 8) {
-                $nmmsgl1 = 7;
-            } elseif ($u['align'] >= 50 && $u['align'] < 50) {
-                $nmmsgl1 = 60;
-            }
-            if ($u['admin'] > 0) {
-                $nmmsgl1 = 60;
-            }
-            $anan = [
-                1 => 'cat',
-                2 => 'owl',
-                3 => 'wisp',
-                4 => 'demon',
-                5 => 'dog',
-                6 => 'pig',
-                7 => 'dragon'
-            ];
-            $anan2 = [
-                1 => '���',
-                2 => '����',
-                3 => '�������',
-                4 => '�������',
-                5 => 'ϸ�',
-                6 => '����',
-                7 => '������'
-            ];
-            $anml = '';
-            if ($u['animal'] > 0) {
-                $an = 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 `id` = "' . $u['animal'] . '" AND `pet_in_cage` = 0 AND `delete` = "0" 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 = '<img height="40" width="120" src="https://' . $c['img'] . '/pet/' . $petimg['img'] . '" onMouseOver="top.hi(this,\'<strong>' . $an['name'] . '</strong> <i>(' . $anan2[$an['type']] . ')</i><br>�������: ' . $an['level'] . '\',event,2,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();">';
-                    } else {
-                        $anml = '<img height="40" width="120" src="https://' . $c['img'] . '/pet/' . $anan[$an['type']] . '.png" onMouseOver="top.hi(this,\'<strong>' . $an['name'] . '</strong><i>(' . $anan2[$an['type']] . ')</i><br>�������: ' . $an['level'] . '\',event,2,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();">';
-                    }
-                }
-            }
-            unset($anan);
-
-            if (@isset($sn['items_img'][2])) {
-                $msl = '<img width="120" height="40" style="display:block" src="https://img.new-combats.com/rimg/r' . $sn['items_img'][2] . '">';
-            } else {
-                if ($anml == '') {
-                    $msl = '<img width="120" height="40" style="display:block" src="https://img.new-combats.com/i/slot_bottom' . $nmmsgl1 . '.gif">';
-                } else {
-                    $msl = $anml;
-                }
-            }
-            unset($nmmsgl1);
-            $jf = '';
-            $oi = '';
-            if ($i1 != 1) {
-                $jf = 'main';
-                $oi = 'onMouseOver="top.hi(this,\'' . $u['login'] . ' (������� � &quot;���������&quot;)\',event,3,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"';
-                $msl = '<table width="120" border="0" cellspacing="0" cellpadding="0">
-						<tr>
-						  <td width="40" height="20">' . $witm[53] . '</td>
-						  <td width="40" height="20">' . $witm[55] . '</td>
-						  <td width="40" height="20">' . $witm[54] . '</td>
-						</tr>
-						<tr>
-						  <td width="40" height="20">' . $witm[56] . '</td>
-						  <td width="40" height="20">' . $witm[57] . '</td>
-						  <td width="40" height="20">' . $witm[58] . '</td>
-						</tr>
-					  </table>';
-            }
-            $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`
-			 FROM `eff_users` AS `eu` LEFT JOIN `eff_main` AS `em` ON (`eu`.`id_eff` = `em`.`id2`) WHERE `eu`.`uid`="' . mysql_real_escape_string($u['id']) . '" AND `delete`="0" AND `deactiveTime` < "' . time() . '" ORDER BY `deactiveTime` DESC,`timeUse` ASC');
-            while ($e = mysql_fetch_array($efs)) {
-                $esee = 1;
-                if ($e['see'] == 0 && $i1 == 1) {
-                    $esee = 0;
-                }
-                if ($e['see'] == 2 && ($u['battle'] != $this->info['battle'] || $this->info['battle'] == 0)) {
-                    $esee = 0;
-                }
-                if ($e['see'] == 3 && $i1 == 0) {
-                    $esee = 0;
-                }
-                if ($e['img'] == '') {
-                    $esee = 0;
-                }
-
-                if (($e['timeUse'] + $e['timeAce'] + $e['actionTime'] >= time() || $e['timeUse'] == 77) && $esee == 1) {
-                    $ei = '<strong><u>' . $e['name'] . '</u></strong>';
-                    if ($e['type1'] > 0 && $e['type1'] < 7) {
-                        $ei .= ' (�������)';
-                    } elseif (($e['type1'] > 6 && $e['type1'] < 11) || $e['type1'] == 16) {
-                        $ei .= ' (��������)';
-                    } elseif ($e['type1'] == 14) {
-                        $ei .= ' (�����)';
-                    } elseif ($e['type1'] == 15) {
-                        $ei .= ' (��������)';
-                    } elseif ($e['type1'] == 17) {
-                        $ei .= ' (���������)';
-                    } elseif ($e['type1'] == 18 || $e['type1'] == 19) {
-                        $ei .= ' (������)';
-                    } elseif ($e['type1'] == 20) {
-                        $ei .= ' (�����������)';
-                    } elseif ($e['type1'] == 22) {
-                        $ei .= ' (��������)';
-                    } else {
-                        $ei .= ' (������)';
-                    }
-                    $ei .= '<br>';
-
-                    if ($e['type1'] != 13 && $e['timeUse'] != 77) {
-                        $out = '';
-                        $time_still = ($e['timeUse'] + $e['timeAce'] + $e['actionTime']) - time();
-                        $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 .= '��������: ' . $out . '';
-                    }
-
-                    //�������� �������
-                    $tr = '';
-                    $t = $this->items['add'];
-                    $x = 0;
-                    $ed = $this->lookStats($e['data']);
-                    while ($x < count($t)) {
-                        $n = $t[$x];
-                        if (isset($ed['add_' . $n], $this->is[$n])) {
-                            $z = '';
-                            if ($ed['add_' . $n] > 0) {
-                                $z = '+';
-                            }
-                            $tr .= '<br>' . $this->is[$n] . ': ' . $z . '' . $ed['add_' . $n];
-                        }
-                        $x++;
-                    }
-                    if ($tr != '') {
-                        $ei .= $tr;
-                    }
-                    if ($e['info'] != '') {
-                        $ei .= '<br><i>����������:</i><br>' . $e['info'];
-                    }
-                    if ($e['img2'] != '' && $e['img'] == 'icon_none.gif') {
-                        $e['img'] = $e['img2'];
-                    }
-                    if ($e['type1'] == 18 || $e['type1'] == 19) {
-                        $e['img'] = $e['img2'];
-                    }
-                    $eff .= '<img width="38" height="23" style="margin:1px;display:block;float:left;" src="https://img.new-combats.com/i/eff/' . $e['img'] . '"onMouseOver="top.hi(this,\'' . $ei . '\',event,0,1,1,1,\'\');" onMouseOut="top.hic(event);" onMouseDown="top.hic(event);" >';
-                } 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);
-                    }
-                }
-            }
-
-            //��������
-            if ($type_info == 1) {
-                $hptop = 0;
-                $lh = [0 => 'hp_none', 1 => 1];
-                $lh[1] = floor((0 + $sn['hpNow']) / (0 + $sn['hpAll']) * 120);
-                if ($lh[1] > 0) {
-                    $lh[0] = 'hp_1';
-                }
-                if ($lh[1] > 32) {
-                    $lh[0] = 'hp_2';
-                }
-                if ($lh[1] > 65) {
-                    $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 .= '<div id="vmp' . $u['id'] . '" title="������� ����" align="center" class="seemp" style="position:absolute; top:10px; left:-5px; width:120px; height:10px; z-index:12;">' . floor($sn['mpNow']) . '/' . (0 + $sn['mpAll']) . '</div>
-							 <div title="������� ����" class="hpborder" style="position:absolute; top:10px; width:120px; height:9px; z-index:13;"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
-							 <div class="' . $lm[0] . ' senohp" style="height:9px; position:absolute; top:10px; width:' . $lm[1] . 'px; z-index:11;" id="lmp' . $u['id'] . '"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
-							 <div title="������� ����" class="hp_none" style="position:absolute; top:10px; width:120px; height:10px; z-index:10;"></div>';
-                } else {
-                    $hptop = 5;
-                }
-                $hpmp = '<div id="vhp' . $u['id'] . '" title="������� �����" align="center" class="seehp" style="position:absolute; top:' . $hptop . 'px;  left:-5px; width:120px; height:10px; z-index:12;">' . floor($sn['hpNow']) . '/' . (0 + $sn['hpAll']) . '</div>
-						 <div title="������� �����" class="hpborder" style="position:absolute; top:' . $hptop . 'px; width:120px; height:9px; z-index:13;"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
-						 <div class="' . $lh[0] . ' senohp" style="height:9px; width:' . $lh[1] . 'px; position:absolute; top:' . $hptop . 'px; z-index:11;" id="lhp' . $u['id'] . '"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
-						 <div title="������� �����" class="hp_none" style="position:absolute; top:' . $hptop . 'px; width:120px; height:10px; z-index:10;"><img src="https://img.new-combats.com/1x1.gif" height="10"></div>' . $hpmp;
-                //�������� �� � ��
-                $hpmp = '<div style="position:relative;">' . $hpmp . '</div>';
-            } elseif ($type_info == 2) {
-                $hptop = 0;
-                $lh = [0 => 'hp_none', 1 => 1];
-                $lh[1] = floor((0 + $sn['hpNow']) / (0 + $sn['hpAll']) * 200);
-                if ($lh[1] > 0) {
-                    $lh[0] = 'hp_1';
-                }
-                if ($lh[1] > 32) {
-                    $lh[0] = 'hp_2';
-                }
-                if ($lh[1] > 65) {
-                    $lh[0] = 'hp_3';
-                }
-                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 .= '<div id="vmp' . $u['id'] . '" title="������� ����" align="center" class="seemp" style="position:absolute; top:10px; width:200px; height:10px; z-index:12;"> ' . floor($sn['mpNow']) . '/' . (0 + $sn['mpAll']) . '</div>
-							 <div title="������� ����" class="hpborder" style="position:absolute; top:10px; width:200px; height:9px; z-index:13;"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
-							 <div class="' . $lm[0] . ' senohp" style="height:9px; position:absolute; top:10px; width:' . $lm[1] . 'px; z-index:11;" id="lmp' . $u['id'] . '"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
-							 <div title="������� ����" class="hp_none" style="position:absolute; top:10px; width:200px; height:10px; z-index:10;"></div>';
-                } else {
-                    $hptop = 5;
-                }
-                $hpmp = '<div id="vhp' . $u['id'] . '" title="������� �����" align="center" class="seehp" style="position:absolute; top:' . $hptop . 'px; width:200px; height:10px; z-index:12;"> ' . floor($sn['hpNow']) . '/' . (0 + $sn['hpAll']) . '</div>
-						 <div title="������� �����" class="hpborder" style="position:absolute; top:' . $hptop . 'px; width:200px; height:9px; z-index:13;"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
-						 <div class="' . $lh[0] . ' senohp" style="height:9px; width:' . $lh[1] . 'px; position:absolute; top:' . $hptop . 'px; z-index:11;" id="lhp' . $u['id'] . '"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
-						 <div title="������� �����" class="hp_none" style="position:absolute; top:' . $hptop . 'px; width:200px; height:10px; z-index:10;"><img src="https://img.new-combats.com/1x1.gif" height="10"></div>' . $hpmp;
-                //�������� �� � ��
-                $hpmp = '<div style="position:relative;height:20px;">' . $hpmp . '</div>';
-            }
-
-            $lgn = '<strong>' . $u['login'] . '</strong> [' . $u['level'] . ']<a href="/info/' . $u['id'] . '" target="_blank"><img src="https://img.new-combats.com/i/inf_capitalcity.gif"></a>';
-            if ($u['clan'] != 0) {
-                $pc = mysql_fetch_array(mysql_query('SELECT `id`,`name`,`name_mini`,`align`,`type_m`,`money1`,`exp` FROM `clan` WHERE `id`="' . $u['clan'] . '" LIMIT 1'));
-                $pc['img'] = $pc['name_mini'] . '.gif';
-                $lgn = '<img title="' . $pc['name'] . '" src="https://img.new-combats.com/i/clan/' . $pc['name_mini'] . '.gif">' . $lgn;
-            }
-            if ($u['align2'] > 0) {
-                $lgn = '<img title="' . $this->mod_nm[floor(intval($u['align2']))][$u['align2']] . '" src="https://img.new-combats.com/i/align/align' . $u['align2'] . '.gif">' . $lgn;
-            }
-            if ($u['align'] > 0) {
-                $lgn = '<img title="' . $this->mod_nm[floor(intval($u['align']))][$u['align']] . '" src="https://img.new-combats.com/i/align/align' . $u['align'] . '.gif">' . $lgn;
-            }
-            $pb = '';
-            if ($u['banned'] > 0) {
-                $pb .= '<div style="margin:0 2px 0 2px;"><font color="red" style="background-color:#fae0e0"><strong>�������� ������������</strong></font></div>';
-            }
-            if ($u['allLock'] > time()) {
-                $pb .= '<div style="margin:0 2px 0 2px;"><font color="red" style="background-color:#fae0e0"><strong>��������� ������ �������!</strong></font></div>';
-            }
-
-            $swm = 0; //������ �����
-            $l = 40;
-            while ($l <= 52) {
-                if (isset($witm[$l])) {
-                    $swm++;
-                } else {
-                    $witm[$l] = '<img title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif">';
-                }
-                $l++;
-            }
-
-            $ssm = 0; //����� �����
-            $l = 59;
-            while ($l <= 62) {
-                if (isset($witm[$l])) {
-                    $ssm++;
-                } else {
-                    $witm[$l] = '<img width="60" height="60" title="������ ���� �����" src="https://img.new-combats.com/i/items/w/w83.gif">';
-                }
-                $l++;
-            }
-
-            $witmg = '';
-
-            if ($ssm > 0 && $i1 == 0) {
-                $witmg .= '<table style="padding-top:2px;padding-bottom:2px;" width="240" border="0" cellspacing="0" cellpadding="0">
-  <tr>
-	 <td width="60" height="60">' . $witm[59] . '</td>
-	 <td width="60">' . $witm[60] . '</td>
-	 <td width="60">' . $witm[61] . '</td>
-	 <td width="60">' . $witm[62] . '</td>
-  </tr>
-</table>';
-            }
-
-            if ($swm > 0 && $i1 == 0) {
-                $witmg .= '<table width="240" border="0" cellspacing="0" cellpadding="0">
-  <tr>
-	 <td width="40" height="25">' . $witm[40] . '</td>
-	 <td width="40">' . $witm[41] . '</td>
-	 <td width="40">' . $witm[42] . '</td>
-	 <td width="40">' . $witm[43] . '</td>
-	 <td width="40">' . $witm[44] . '</td>
-	 <td width="40">' . $witm[50] . '</td>
-  </tr>
-  <tr>
-	 <td height="25">' . $witm[45] . '</td>
-	 <td>' . $witm[46] . '</td>
-	 <td>' . $witm[47] . '</td>
-	 <td>' . $witm[48] . '</td>
-	 <td>' . $witm[49] . '</td>
-	 <td>' . $witm[51] . '</td>
-  </tr>
-
-</table>';
-            }
-            $zag = '';
-            if ($u['zag'] != '' && $i1 == 1) {
-                $rt[0] .= '<style> .inf2s { position:relative; filter: alpha(opacity=10); -moz-opacity: 0.10; -khtml-opacity: 0.10; opacity: 0.10; } .inf2s:hover { background-color:#e2e0e0;filter: alpha(opacity=70); -moz-opacity: 0.70; -khtml-opacity: 0.70; opacity: 0.70; } </style>';
-
-                $zag = '<img width="243" height="283" style="position:absolute;top:-1px;left:-1px;" src="https://img.new-combats.com/i/zag/' . $u['zag'] . '">';
-
-                $j2 = 0;
-                while ($j2 <= 17) {
-                    $witm[$j2] = '<div class="inf2s">' . $witm[$j2] . '</div>';
-                    $j2++;
-                }
-
-            }
-            //<div style="width:240px; padding:2px; border-bottom:1px solid #666666; border-right:1px solid #666666; border-left:1px solid #FFFFFF; border-top:1px solid #FFFFFF;">
-            if ($type_info == 1) {
-                if ($pb != '') {
-                    $pb = '<div align="center" style="width:246px;"><!-- blocked -->' . $pb . '</div>';
-                }
-                $rt[0] .= '<div id="lgnthm" style="width:246px; padding:0 3px 0 3px;" align="center">' . $lgn . '</div>' . $pb . '
-				<div class="personag" style="width:240px; background-color:#CCC; padding:3px; margin-right:11px; border-bottom:1px solid #666666; border-right:1px solid #666666; border-left:1px solid #FFFFFF; border-top:1px solid #FFFFFF;">
-				<table width="240" border="0" cellspacing="0" cellpadding="0">
-				  <tr>
-					<td width="60" valign="top">
-					<table bgcolor="#e1e1e1" width="60" height="280" border="0" cellspacing="0" cellpadding="0">
-					  <tr>
-						<td height="60"><div style="position:relative">' . $zag . '' . $witm[1] . '</div></td>
-					  </tr>
-					  <tr>
-						<td height="40">' . $witm[2] . '</td>
-					  </tr>
-					  <tr>
-						<td height="60">' . $witm[3] . '</td>
-					  </tr>
-					  <tr>
-						<td height="80">' . $witm[4] . '</td>
-					  </tr>
-					  <tr>
-						<td height="40">' . $witm[7] . '</td>
-					  </tr>
-					</table>
-					</td>
-					<td height="280" valign="top">
-					<table bgcolor="#e1e1e1" width="120" height="280" border="0" cellspacing="0" cellpadding="0">
-					  <tr>
-						<td height="20" bgcolor="#CCC" valign="top">
-						<!-- HP and MP -->
-						' . $hpmp . '
-						<!-- -->
-						</td>
-					  </tr>
-					  <tr>
-						<td valign="top">';
-                if ($zag == '') {
-                    if ($i1 == 0) {
-                        if (!isset($_GET['inv'])) {
-                            $invg = [0 => 'main.php?inv=1', 1 => '������'];
-                        } else {
-                            $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 => '������� �������'];
-                    }
-                    $uobr = 'i/obraz/' . $u['sex'] . '/' . $u['obraz'] . '';
-                    if (isset($sn['items_img'][1])) {
-                        $uobr = 'rimg/r' . $sn['items_img'][1];
-                    }
-                    $rt[0] .= '<div style="position:relative;height:220px;">
-								<!-- ����� -->
-									<div style="position:absolute; width:120px; height:220px; z-index:1;"><a href="' . $invg[0] . '"><img onMouseOver="top.hi(this,\'������� � &quot;<strong>' . $invg[1] . '</strong>&quot;\',event,2,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();" width="120" height="220" src="https://img.new-combats.com/' . $uobr . '" ' . $oi . '></a></div>
-									<div style="position:absolute; width:120px; height:auto; z-index:3;" align="left">' . $eff . '</div>' . $anml . '
-							</div>';
-                } else {
-                    if ($i1 == 0) {
-                        if (!isset($_GET['inv'])) {
-                            $invg = [0 => 'main.php?inv=1', 1 => '������'];
-                        } else {
-                            $invg = [0 => 'main.php?skills=1', 1 => '������'];
-                        }
-                    } else {
-                        $invg = [0 => 'https://lib.new-combats.com/obraz.php?namez=' . $u['zag'] . '" target="_blank', 1 => '������� �������'];
-                    }
-                    $rt[0] .= '<div class="inf2s" style="position:relative;height:220px;">
-								<!-- ����� -->
-									<div style="position:absolute; width:120px; height:220px; z-index:1;"><a href="' . $invg[0] . '"><img onMouseOver="top.hi(this,\'������� � &quot;<strong>' . $invg[1] . '</strong>&quot;\',event,2,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();" width="120" height="220" src="https://img.new-combats.com/1x1.gif" ' . $oi . '></a></div>
-									<div style="position:absolute; width:120px; height:auto; z-index:3;" align="left">' . $eff . '</div>' . $anml . '
-							</div>';
-                }
-
-                unset($invg);
-
-                $rt[0] .= '</td>
-					  </tr>
-					  <tr>
-						<td height="40"><div align="center">' . $msl . '</div></td>
-					  </tr>
-					</table>
-					</td>
-					<td width="60" valign="top">
-					<table bgcolor="#e1e1e1" width="60" border="0" cellspacing="0" cellpadding="0">
-					  <tr>
-						<td height="20">' . $witm[8] . '</td>
-					  </tr>
-					  <tr>
-						<td height="20">' . $witm[9] . '</td>
-					  </tr>
-					  <tr>
-						<td height="20"><table width="60" border="0" cellspacing="0" cellpadding="0">
-							<tr>
-							  <td width="20" height="20">' . $witm[10] . '</td>
-							  <td width="20">' . $witm[11] . '</td>
-							  <td width="20">' . $witm[12] . '</td>
-							</tr>
-						</table></td>
-					  </tr>
-					  <tr>
-						<td height="40">' . $witm[13] . '</td>
-					  </tr>
-					  <tr>
-						<td height="60">' . $witm[14] . '</td>
-					  </tr>
-					  <tr>
-						<td height="80">' . $witm[16] . '</td>
-					  </tr>
-					  <tr>
-						<td height="40">' . $witm[17] . '</td>
-					  </tr>
-					</table>
-					</td>
-				  </tr>
-				</table>' . $witmg . '</div>';
-            } elseif ($type_info == 2) {
-                $rt[0] .= '<div style="width:209px; padding:2px;" align="center">' . $lgn . '</div>
-				<div style="width:196px; padding:2px;">
-				<div align="center"><!-- blocked -->' . $pb . '</div>
-				<div align="center">
-				<!-- HP and MP -->
-				' . $hpmp . '
-				<!-- -->
-				</div>
-				<table width="196" border="0" cellspacing="0" cellpadding="0">
-				  <tr>
-					<td width="60" valign="top">
-					<table width="60" border="0" cellspacing="0" cellpadding="0">
-					  <tr>
-						<td height="20"><div style="position:relative">' . $zag . '' . $witm[8] . '</div></td>
-					  </tr>
-					  <tr>
-						<td height="20">' . $witm[9] . '</td>
-					  </tr>
-					  <tr>
-						<td height="20">' . $witm[3] . '</td>
-					  </tr>
-					  <tr>
-						<td height="80">' . $witm[4] . '</td>
-					  </tr>
-					  <tr>
-						<td height="20"><table width="60" border="0" cellspacing="0" cellpadding="0">
-							<tr>
-							  <td width="20" height="20">' . $witm[10] . '</td>
-							  <td width="20">' . $witm[11] . '</td>
-							  <td width="20">' . $witm[12] . '</td>
-							</tr>
-						</table></td>
-					  </tr>
-					</table>
-					</td>
-					<td valign="top">
-					<table width="76" border="0" cellspacing="0" cellpadding="0">
-					  <tr>
-						<td valign="top">';
-                if ($zag == '') {
-                    if ($i1 == 0) {
-                        if (!isset($_GET['inv'])) {
-                            $invg = [0 => 'main.php?inv=1', 1 => '������'];
-                        } else {
-                            $invg = [0 => 'main.php?skills=1', 1 => '������'];
-                        }
-                    } else {
-                        $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'] . '';
-                    if (isset($sn['items_img'][1])) {
-                        $uobr = 'rimg/r' . $sn['items_img'][1];
-                    }
-                    $rt[0] .= '<div style="position:relative;height:209px;">
-							<!-- ����� -->
-								<div style="position:absolute; width:76px; height:209px; z-index:1;"><a href="' . $invg[0] . '"><img onMouseOver="top.hi(this,\'������� � &quot;<strong>' . $invg[1] . '</strong>&quot;\',event,2,1,1,1,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();" width="76" height="209" src="https://img.new-combats.com/' . $uobr . '" ' . $oi . '></a></div>
-								<div style="position:absolute; width:76px; height:auto; z-index:3;" align="left">' . $eff . '</div>' . $anml . '
-						</div>';
-                }
-
-                unset($invg);
-
-                $rt[0] .= '</td>
-					  </tr>
-					</table>
-					</td>
-					<td width="60" valign="top">
-					<table width="60" border="0" cellspacing="0" cellpadding="0">
-					  <tr>
-						<td height="60">' . $witm[1] . '</td>
-					  </tr>
-					  <tr>
-						<td height="40">' . $witm[13] . '</td>
-					  </tr>
-					  <tr>
-						<td height="60">' . $witm[14] . '</td>
-					  </tr>
-					  <tr>
-						<td height="40">' . $witm[17] . '</td>
-					  </tr>
-					</table>
-					</td>
-				  </tr>
-				</table>' . $witmg . '</div>';
-            }
-
-            if ($i1 == 0 && $u['battle'] == 0) {
-                $rt[0] .= '<script>top.lafstReg[' . $u['id'] . '] = 0; top.startHpRegen("main",' . $u['id'] . ',' . (0 + $sn['hpNow']) . ',' . (0 + $sn['hpAll']) . ',' . (0 + $sn['mpNow']) . ',' . (0 + $sn['mpAll']) . ',' . (time() - $u['regHP']) . ',' . (time() - $u['regMP']) . ',' . (0 + $this->rgd[0]) . ',' . (0 + $this->rgd[1]) . ',1);</script>';
-            }
-            if ($ivv == 0 && $i1 == 0) {
-                $rt[0] .= $this->info_remont();
-            }
-        }
-        return $rt;
-    }
-
-    public function endEffect($id, $u, $test = null)
-    {
-        if ($test == false) {
-            $test = 0;
-        }
-
-        $e = mysql_fetch_array(mysql_query('SELECT
-		`eu`.`id`,`eu`.`tr_life_user`,`eu`.`id_eff`,`eu`.`uid`,`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`
-		FROM `eff_users` AS `eu` LEFT JOIN `eff_main` AS `em` ON (`eu`.`id_eff` = `em`.`id2`) WHERE `eu`.`id`="' . mysql_real_escape_string($id) . '" AND `delete`="0" AND `deactiveTime` < "' . time() . '"'));
-
-        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'));
-                $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()) {
-                        $et = false;
-                    } else {
-                        $et = true;
-                    }
-                } else {
-                    $et = false;
-                }
-            } else {
-                $et = false;
-            }
-            if ($et == false && $e['sleeptime'] == 0 && $sleep['vars'] != 'sleep') {
-                $upd = mysql_query('UPDATE `eff_users` SET `delete`="' . time() . '" WHERE `id` = "' . $e['id'] . '" LIMIT 1');
-                if ($upd) {
-                    $po = $this->lookStats($e['data']);
-                    if (isset($po['finish_file'])) {
-                        if (file_exists('_incl_data/class/magic/' . $po['finish_file'] . '.php')) {
-                            require('_incl_data/class/magic/' . $po['finish_file'] . '.php');
-
-                        } else {
-                            $this->error2 = '!File not exists &quot;cgi-bin/magic.pl?use_' . $po['finish_file'] . '&quot;.';
-                        }
-                    }
-                    if (isset($u['id']) && ($e['type1'] < 11 || ($e['type1'] > 16 && $e['type1'] < 23)) && $e['noch'] == 0) {
-                        $text = '����������� �������� ������� &quot;<strong>' . $e['name'] . '</strong>&quot;';
-                        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'));
-                            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['battle'] . '","' . ($id_hod) . '","{tm1} ' . $text . ' � ��������� {u1}.","login1=' . $u['login'] . '||t1=' . $u['team'] . '||time1=' . time() . '","","","","","6")');
-                            }
-                        }
-                    }
-                    return 1;
-                } else {
-                    return 0;
-                }
-            } else {
-                return 0;
-            }
-        } else {
-            return 0;
-        }
-    }
-
-    public function snatItem($id, $uid)
-    {
-        if ($uid != 0) {
-            $au = 'AND `iu`.`uid`="' . mysql_real_escape_string($uid) . '"';
-        } else {
-            $au = '';
-        }
-        $itm = mysql_fetch_array($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`
-		FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id`="' . mysql_real_escape_string($id) . '" AND `iu`.`inOdet`!="0" ' . $au . ' AND `iu`.`delete`="0" LIMIT 1 FOR UPDATE'));
-        if (isset($itm['id'])) {
-
-            $upd = mysql_query('UPDATE `items_users` SET `lastUPD`="' . time() . '",`inOdet`="0" WHERE `id`="' . $itm['id'] . '" LIMIT 1');
-            if ($upd) {
-                if (isset($_GET['remitem']) || isset($_GET['sid'])) {
-                    $this->info['autospell'] = 1;
-                    mysql_query('UPDATE `users` SET `autospell` = "1" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-                }
-                return 1;
-            } else {
-                return 0;
-            }
-        } else {
-            return 0;
-        }
-    }
-
-    public function snatItemAll($uid)
-    {
-        $upd = mysql_query('UPDATE `items_users` SET `lastUPD`="' . time() . '",`inOdet`="0" WHERE `uid`="' . $uid . '" AND `inOdet`!="0" AND `delete`="0" LIMIT 100');
-        if ($upd) {
-            return 1;
-        } else {
-            return 0;
-        }
-    }
-
-    public function impStats($m)
-    {
-        $i = 0;
-        if (array_keys($m)) {
-            $k = array_keys($m);
-        } else {
-            $k = 0;
-        }
-        $d = '';
-        while ($i <= count($k)) {
-            if ($k[$i] != '') {
-                $d .= $k[$i] . '=' . $m[$k[$i]] . '|';
-            }
-            $i++;
-        }
-        $d = rtrim($d, '|');
-        return $d;
-    }
-
-    public function odetItem($id, $uid)
-    {
-        if ($uid != 0) {
-            $au = 'AND `iu`.`uid` = "' . mysql_real_escape_string($uid) . '"';
-        } else {
-            $au = '';
-        }
-
-        $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`.`id`="' . mysql_real_escape_string($id) . '" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ' . $au . ' AND `iu`.`delete`="0" LIMIT 1'));
-        if (isset($itm['id'])) {
-            if ($itm['group'] == 1) {
-                if ($this->itemsX($itm['id']) > 1) {
-                    $this->unstack($itm['id'], 1);
-                }
-            }
-
-
-            $tr = $this->lookStats($itm['data']);
-            $notr = $this->trItem($tr);
-            $msb = '';
-            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 = '��������� ������������� �������� ������ ��������!';
-                    $notr++;
-                }
-            }
-            if ($this->info['twink'] > 0) {
-                //�� ������ 100 ���.
-                if ($itm['price2'] > 100 || $itm['2price'] > 100) {
-                    $notr++;
-                }
-                //������ ���� + �����
-                if (isset($tr['rune']) && $tr['rune'] > 0) {
-                    $notr++;
-                }
-                if (isset($tr['spell_id']) && $tr['spell_id'] > 0) {
-                    $notr++;
-                }
-            }
-            if (isset($tr['vip_sale'])) {
-                if ($this->stats['silver'] < 2) {
-                    $notr++;
-                }
-            }
-            if (isset($tr['sudba'])) {
-                if ($tr['sudba'] != '0' && $tr['sudba'] != $this->info['login']) {
-                    $notr++;
-                } elseif ($tr['sudba'] == '0') {
-                    $tr['sudba'] = $this->info['login'];
-                    $itm['data'] = $this->impStats($tr);
-                    $msb = ',`data`="' . $itm['data'] . '"';
-                }
-            }
-            if (isset($tr['tr_align_bs']) && $this->info['inTurnir'] > 0) {
-                if ($tr['tr_align_bs'] == '1') {
-                    if ($this->info['align_real'] <= 1 || $this->info['align_real'] >= 2) {
-                        $notr++;
-                    } else {
-                        $notr = 0;
-                    }
-                } else {
-                    if ($this->info['align_real'] <= 3 || $this->info['align_real'] >= 4) {
-                        $notr++;
-                    } else {
-                        $notr = 0;
-                    }
-                }
-            }
-            if ($notr > 0) {
-                //�� ������� ������������� ��� �� ��������� �������
-                if (isset($tr['open']) && isset($_GET['open'])) {
-                    $this->error = '�� �� ������ ������� ������ �������';
-                } else {
-                    $this->error = '������ ����� ������ ������ �������� ������� ����';
-                }
-                return 0;
-            } elseif (isset($tr['open']) && isset($_GET['open']) && isset($tr['items_in_file'])) {
-                $io = '';
-                if ($itm['inGroup'] > 0) {
-                    mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '",`inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
-                }
-                if (file_exists('_incl_data/class/magic/' . $tr['items_in_file'] . '.php')) {
-                    require('_incl_data/class/magic/' . $tr['items_in_file'] . '.php');
-                    if (!isset($no_open_itm)) {
-                        $this->deleteItem($itm['id'], $this->info['id']);
-                        $this->error = '�� ������� ������� &quot;' . $itm['name'] . '&quot;:<br>' . $io . '...';
-                    } else {
-                        unset($no_open_itm);
-                    }
-                } else {
-                    $this->error = '������� &quot;' . $itm['name'] . '&quot; ���������� �������...';
-                }
-            } 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 = '������� ������ ���� �������, ������ ��� ��� ���������!';
-                    } elseif (!isset($itmin['id'])) {
-                        $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 = '�� ������� ������� �������. ���������� ���������.';
-                        } 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...';
-                        } elseif ($itmin['item_id'] == 4870) {
-                            //������ ��������
-                            if ($this->info['molch1'] > time()) {
-                                $this->info['molch1'] += 3600;
-                            } else {
-                                $this->info['molch1'] = time() + 3600;
-                            }
-                            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 = '�� ��������� ��� �������� �������� ��������...';
-                        } 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 = '��� ����� &quot;' . $a['name'] . '&quot; ������� ���������...';
-                                mysql_query('UPDATE `users_animal` SET `eda` = 0, `yad` = "' . (time() + 86400 * 7) . '" WHERE `id` = "' . $a['id'] . '" LIMIT 1');
-                            } else {
-                                $this->error = '���-�� ������� �������� ������ �����, �������� � ��� ��� :)';
-                            }
-                        } elseif ($itmin['item_id'] == 4869) {
-                            //����������� ������  (������ ������ �� 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'] . '",
-								"4", "bad_present_travma1.gif","0", "1"
-							)');
-                            $this->error = '�� ������������. � ��� ����� � ���������...';
-                        } elseif ($itmin['item_id'] == 4872) {
-                            //��������  (������� ������ �� 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'] . '",
-								"4", "bad_present_travma2.gif","0", "2"
-							)');
-                            $this->error = '�� ������������. � ��� ����� � ���������...';
-                        } elseif ($itmin['item_id'] == 4876) {
-                            //����������  (������� ������ �� 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'] . '",
-								"4", "bad_present_travma3.gif","0", "3"
-							)');
-                            $this->error = '�� ������������. � ��� ����� � ���������...';
-                        } elseif ($itmin['item_id'] == 4878) {
-                            //������������  (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'] . '",
-								"4", "bad_present_chains.gif","0", "3"
-							)');
-                            $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'] . '",
-								"4", "bad_present_dmage.gif","0", "3"
-							)');
-                            $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'] . '",
-								"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->deleteItem($itm['id'], $this->info['id']);
-                            $this->error = '�� ������� ������� &quot;' . $itm['name'] . '&quot;, ������ ���� �������:<br>' . $io . '...';
-                        } else {
-                            $this->error = '��������� ������� �������, ��� �� ���?';
-                        }
-                        //
-                    }
-                    //
-                } else {
-
-                    while ($i < count($itms)) {
-                        if (isset($itms[$i])) {
-                            $x = 0;
-                            $itms[$i] = explode('*', $itms[$i]);
-                            $x += (int)$itms[$i][1];
-                            $itms[$i] = $itms[$i][0];
-                            $s = 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`="' . ((int)$itms[$i]) . '" LIMIT 1'));
-                            if (isset($s['id'])) {
-                                $j = 1;
-                                while ($j <= $x) {
-                                    $pid = $this->addItem($s['id'], $this->info['id']);
-                                    if ($pid > 0) {
-                                        mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '",`gift` = "' . $itm['gift'] . '" WHERE `id` = "' . $pid . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1');
-                                    }
-                                    $j++;
-                                }
-                                $io .= '' . $s['name'] . ' (x' . $x . '), ';
-                            }
-                        }
-                        $i++;
-                    }
-                    if ($itm['inGroup'] > 0) {
-                        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 = '�� ������� ������� &quot;' . $itm['name'] . '&quot;, ������ ���� �������:<br>' . $io . '...';
-                }
-            } else {
-                $inSlot = $itm['inslot'];
-                $s = mysql_query('SELECT `iu`.`id`,`iu`.`inOdet` FROM `items_users` AS `iu` WHERE `iu`.`inOdet`!="0" AND `iu`.`uid`="' . $uid . '" AND `iu`.`delete`="0"');
-                $d = [];
-                while ($p = mysql_fetch_array($s)) {
-                    $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);
-                    }
-                }
-
-                if (isset($d[$inSlot])) {
-                    if ($inSlot == 10) {
-                        if (!isset($d[12])) {
-                            $inSlot = 12;
-                        } elseif (!isset($d[11])) {
-                            $inSlot = 11;
-                        }
-                    } elseif ($inSlot == 40) {
-                        $i = 40;
-                        while ($i <= 51) {
-                            if (!isset($d[$i])) {
-                                $inSlot = $i;
-                                $i = 52;
-                            } elseif ($i == 50) {
-                                $inSlot = 50;
-                            }
-                            $i++;
-                        }
-                    } elseif ($inSlot == 53) {
-                        if (!isset($d[53])) {
-                            $inSlot = 53;
-                        } elseif (!isset($d[54])) {
-                            $inSlot = 54;
-                        }
-                    } elseif ($inSlot == 56) {
-                        if (!isset($d[56])) {
-                            $inSlot = 56;
-                        } elseif (!isset($d[57])) {
-                            $inSlot = 57;
-                        } elseif (!isset($d[58])) {
-                            $inSlot = 58;
-                        } else {
-                            $inSlot = 58;
-                        }
-                    } elseif ($inSlot == 59) {
-                        if (!isset($d[59])) {
-                            $inSlot = 59;
-                        } elseif (!isset($d[60])) {
-                            $inSlot = 60;
-                        } elseif (!isset($d[61])) {
-                            $inSlot = 61;
-                        } elseif (!isset($d[62])) {
-                            $inSlot = 62;
-                        }
-                    }
-                }
-                if (isset($d[$inSlot])) {
-                    $this->snatItem($d[$inSlot], $uid);
-                }
-
-
-                $upd = mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `inOdet` = "' . $inSlot . '"' . $msb . ' WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
-                if ($itm['inGroup'] > 0) {
-                    mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `inGroup` = 0, `delete` = 0 WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
-                }
-                if ($upd) {
-                    //���� ������� ������������� ����� ��������
-                    //if($itm[''])
-                    //{
-                    //
-                    //}
-                    $this->info['autospell'] = 1;
-                    mysql_query('UPDATE `users` SET `autospell` = "1" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-                    return 1;
-                } else {
-                    $this->error = '(!) ������ ���������� ������';
-                    return 0;
-                }
-            }
-        } else {
-            $this->error = '������� �� ������ � ����� �������';
-            return 0;
-        }
-    }
-
-    public function deleteItem($id, $uid = 0, $coldel = 0)
-    {
-        if ($uid != 0) {
-            $au = 'AND `iu`.`uid`="' . mysql_real_escape_string($uid) . '"';
-        } else {
-            $au = '';
-        }
-        $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($id) . '" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ' . $au . ' AND (`iu`.`delete`="0" OR `iu`.`delete`="1000") 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) {
-                        $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 ' . $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);
-                }
-            }
-            if ($upd) {
-                if (isset($_GET['deleteall7'])) {
-                    $st = $this->lookStats($itm['data']);
-                    $whr = '';
-                    if (isset($st['frompisher'])) {
-                        $whr .= 'AND `data` LIKE "%frompisher=' . $st['frompisher'] . '%"';
-                    }
-                    $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, '&quot;<font color="maroon">System.inventory</font>&quot;: �������� &quot;<strong>' . $itm['name'] . ' (x' . $col . ')</strong>&quot; [itm:' . $itm['id'] . '=' . time() . '] ���� <strong>���������</strong>.', time(), $this->info['city'], 'System.inventory', 0, 0);
-                } else {
-                    $this->error = '������� "' . $itm['name'] . '" ��������';
-                    $this->addDelo(1, $uid, '&quot;<font color="maroon">System.inventory</font>&quot;: ������� &quot;<strong>' . $itm['name'] . '</strong>&quot; [itm:' . $itm['id'] . '] ��� <strong>��������</strong>.', time(), $this->info['city'], 'System.inventory', 0, 0);
-                }
-                return 1;
-            } else {
-                return 0;
-            }
-        } else {
-            $this->error = '������� �� ������ � ����� �������';
-        }
-    }
-
-    public function return_btn()
-    {
-        return false;
-    }
-
-    public function get_battle_cache($uid, $battle)
-    {
-        $r = false;
-        if ($uid > 0 && $battle > 0) {
-            $r = mysql_fetch_array(mysql_query('SELECT * FROM `battle_cache` WHERE `battle` = "' . mysql_real_escape_string($battle) . '" AND `uid` = "' . mysql_real_escape_string($uid) . '" ORDER BY `id` DESC LIMIT 1'));
-            if (!isset($r['id'])) {
-                $r = false;
-            } else {
-                $r = json_decode($r['data'], true);
-            }
-        }
-        return $r;
-    }
-
-    public function clear_battle_cache($uid)
-    {
-        mysql_query('DELETE FROM `battle_cache` WHERE `uid` = "' . mysql_real_escape_string($uid) . '"');
-    }
-
-    public function getStats($uid, $i1 = null, $res = 0, $reimg = false, $btl_cache = false, $minimal = false)
-    {
-        global $c;
-        if (count($uid) > 1) {
-            $u = $uid;
-        } elseif ($uid != $this->info['id'] || $res == 1) {
-            if ($minimal == true) {
-                $u = mysql_fetch_array(mysql_query('SELECT `u`.`twink`,`u`.`swin`,`u`.`slose`,`u`.`stopexp`,`u`.`battle`,`u`.`id`,`u`.`no_ip`,`u`.`level`,`u`.`login`,`u`.`clan`,`u`.`vip`,
-				`st`.`id`,`st`.`lider`,`st`.`btl_cof`,`st`.`last_hp`,`st`.`last_pr`,`st`.`smena`,`st`.`stats`,`st`.`hpAll`,`st`.`mpAll`,`st`.`hpNow`,`st`.`mpNow`,`st`.`enNow`,`st`.`transfers`,`st`.`regHP`,`st`.`regMP`,`st`.`showmenu`,`st`.`prmenu`,`st`.`ability`,`st`.`skills`,`st`.`sskills`,`st`.`nskills`,`st`.`exp`,`st`.`minHP`,`st`.`minMP`,`st`.`zv`,`st`.`dn`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`last_a`,`st`.`last_b`,`st`.`battle_text`,`st`.`upLevel`,`st`.`wipe`,`st`.`bagStats`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`nextAct`,`st`.`active`,`st`.`bot`,`st`.`lastAlign`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`s`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`ref_data`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`bn_capitalcity`,`st`.`bn_demonscity`
-				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'));
-            } else {
-                $u = mysql_fetch_array(mysql_query('SELECT `u`.`twink`,`u`.`swin`,`u`.`slose`,`u`.`stopexp`,`u`.`battle`,`u`.`id`,`u`.`no_ip`,`u`.`level`,`u`.`login`,`u`.`clan`,`u`.`vip`,
-				`st`.`id`,`st`.`lider`,`st`.`btl_cof`,`st`.`last_hp`,`st`.`last_pr`,`st`.`smena`,`st`.`stats`,`st`.`hpAll`,`st`.`mpAll`,`st`.`hpNow`,`st`.`mpNow`,`st`.`enNow`,`st`.`transfers`,`st`.`regHP`,`st`.`regMP`,`st`.`showmenu`,`st`.`prmenu`,`st`.`ability`,`st`.`skills`,`st`.`sskills`,`st`.`nskills`,`st`.`exp`,`st`.`minHP`,`st`.`minMP`,`st`.`zv`,`st`.`dn`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`last_a`,`st`.`last_b`,`st`.`battle_text`,`st`.`upLevel`,`st`.`wipe`,`st`.`bagStats`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`nextAct`,`st`.`active`,`st`.`bot`,`st`.`lastAlign`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`s`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`ref_data`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`bn_capitalcity`,`st`.`bn_demonscity`
-				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'));
-            }
-        } else {
-            $u = $this->info;
-        }
-
-        if (isset($u['id'], $u['stats']) && !isset($cache)) {
-            $st = [];
-            $s_vi = [];
-            $s_v = [];
-            $u['clanpos'] = 0;
-            if ($u['clan'] > 0) {
-                $r1 = mysql_fetch_array(mysql_query('SELECT `pos` FROM `aaa_clan_reting_list` WHERE `clan` = "' . $u['clan'] . '" AND `date` = "' . date('dmY') . '" LIMIT 1'));
-                if (isset($r1['pos'])) {
-                    $st['clanpos'] = $r1['pos'];
-                }
-                unset($r1);
-            }
-
-            if (!isset($cache_items)) {
-
-                $lvl = mysql_fetch_array(mysql_query('SELECT `bprice`,`upLevel`,`nextLevel`,`exp`,`money`,`money_bonus1`,`money_bonus2`,`ability`,`skills`,`nskills`,`sskills`,`expBtlMax`,`hpRegen`,`mpRegen`,`money2` FROM `levels` WHERE `upLevel` = "' . $u['upLevel'] . '" LIMIT 1'));
-                if (isset($lvl['upLevel'])) {
-                    $st['levels'] = $lvl;
-                } else {
-                    $st['levels'] = 'undefined';
-                }
-                $st2 = [];
-                $st['id'] = $u['id'];
-                $st['login'] = $u['login'];
-                $st['lvl'] = $u['level'];
-                $st['hpNow'] = $u['hpNow'];
-                $st['hpAll'] = 0;
-                $st['mpNow'] = $u['mpNow'];
-                $st['mpAll'] = 0;
-                $st['zona'] = 1;
-                $st['zonb'] = 2;
-                $st['items'] = [];
-                $st['effects'] = [];
-                $st['reting'] = 0;
-                $st['irka'] = 0;
-                $st['vip'] = $u['vip'];
-                $sts = explode('|', $u['stats']);
-                $i = 0;
-                $ste = '';
-                //������ ��������������
-                while ($i < count($sts)) {
-                    $ste = explode('=', $sts[$i]);
-                    if (isset($ste[1])) {
-                        if (!isset($st[$ste[0]])) {
-                            $st[$ste[0]] = 0;
-                        }
-                        $st[$ste[0]] += intval($ste[1]);
-
-                        if (!isset($st2[$ste[0]])) {
-                            $st2[$ste[0]] = 0;
-                        }
-                        $st2[$ste[0]] += intval($ste[1]);
-                    }
-                    $i++;
-                }
-
-                if ($u['admin'] > 0) {
-                    mysql_query('UPDATE `stats` SET
-						`tactic1` = 25,
-						`tactic2` = 25,
-						`tactic3` = 25,
-						`tactic4` = 25,
-						`tactic5` = 25,
-						`tactic6` = 25,
-						`tactic7` = 25,
-						`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|0|0|0|0|0|0|0|0|0|0|"
-					WHERE `id` = "' . $u['id'] . '" 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)) {
-                        $pl_img_r = mysql_fetch_array(mysql_query('SELECT * FROM `reimage` WHERE ((`uid` = "' . $u['id'] . '" AND `clan` = "0") OR (`clan` = "' . $u['clan'] . '" AND ' . $u['clan'] . ' > 0)) AND `good` > 0 AND `bad` = "0" AND `id` = "' . $pl_img['img_id'] . '" LIMIT 1'));
-                        if (isset($pl_img_r['id'])) {
-                            $st['items_img'][$pl_img['type']] = $pl_img_r['id'] . '.' . $pl_img_r['format'];
-                        } else {
-                            mysql_query('UPDATE `items_img` SET `img_id` = "0" WHERE `id` = "' . $pl_img['id'] . '" LIMIT 1');
-                        }
-                    }
-                }
-
-                //�������������� �� ��������� //��� 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`
-				FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`inOdet`!="0" AND `iu`.`uid`="' . $u['id'] . '" AND `iu`.`delete`="0" LIMIT 250');
-                $ia = $this->items['add'];
-                $h = 0;
-                $hnd1 = 0;
-                $hnd2 = 0;
-                $sht1 = 0;
-                $reitm = [];
-                $coms = []; // ���������
-                $dom = [];
-                $btl_cof = 0;
-                $oza = [
-                    1 => [0, 0],
-                    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;
-                $st['reting'] = 0;
-                while ($pl = mysql_fetch_array($cl)) {
-                    if ($pl['inOdet'] <= 18 && $pl['inOdet'] > 0) {
-                        if ($pl['1price'] > 0) {
-                            $st['irka'] += $pl['1price'];
-                        } else {
-                            $st['irka'] += $pl['price1'];
-                        }
-                    }
-
-
-                    $st['wp' . $pl['inOdet'] . 'id'] = $h;
-
-                    $st['items'][$h] = $pl;
-                    $h++;
-                    if ($pl['inOdet'] == 3 && (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27 || $pl['type'] == 28)) {
-                        $hnd1 = 1;
-                    }
-                    if ($pl['inOdet'] == 14 && (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27 || $pl['type'] == 28)) {
-                        $hnd2 = 1;
-                    } elseif ($pl['inOdet'] == 14 && $pl['type'] == 13) {
-                        $sht1 = 1;
-                    }
-                    $sts = explode('|', $pl['data']);
-                    $i = 0;
-                    $ste = '';
-                    $sti = [];
-                    while ($i < count($sts)) {
-                        $ste = explode('=', $sts[$i]);
-                        if (isset($ste[1])) {
-                            if (!isset($sti[$ste[0]])) {
-                                $sti[$ste[0]] = 0;
-                            }
-                            $sti[$ste[0]] += intval($ste[1]);
-                        }
-                        $i++;
-                    }
-
-                    if (!isset($sti['zazuby']) && !isset($sti['frompisher'])) {
-                        if ($pl['inOdet'] < 18 && $pl['inOdet'] > 0) {
-
-                            if ($pl['2price'] == 0 && $pl['price2'] == 0) {
-                                if ($pl['1price'] > 0) {
-                                    $st['prckr'] += $pl['1price'];
-                                } else {
-                                    $st['prckr'] += $pl['price1'];
-                                }
-                            } else {
-                                if ($pl['2price'] > 0) {
-                                    $st['prckr'] += $pl['2price'] * 200;
-                                    $st['preckr'] += $pl['2price'];
-                                } else {
-                                    $st['prckr'] += $pl['price2'] * 200;
-                                    $st['preckr'] += $pl['price2'];
-                                }
-                            }
-                        }
-                    }
-
-                    if ($pl['inOdet'] <= 18 && $pl['inOdet'] > 0) {
-
-                        $st['reting'] += 1;
-                    }
-
-                    $ko = 1;
-                    while ($ko <= 4) {
-                        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;
-                                }
-                            } else {
-                                $ozm[$ko][0] += 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;
-                                }
-                            } else {
-                                $ozm[$ko][0] += 1;
-                                $ozm[$ko][1] += 9;
-                            }
-
-                        }
-                        $ko++;
-                    }
-
-                    //if( $sti['tr_lvl'] == $u['level'] ) {
-                    if ($pl['inOdet'] <= 18) {
-                        $itmslvl++;
-                    }
-                    if ($pl['inOdet'] <= 14 && isset($pl['tr_lvl'])) {
-                        if ($pl['tr_lvl'] == $u['level']) {
-                            $itmsCfc += 1;
-                        } else {
-                            $itmsCfc += ($sti['tr_lvl'] / $u['level']) / 4;
-                        }
-                    }
-                    //}
-
-                    if (isset($sti['art'])) {
-                        if (!isset($st['art'])) {
-                            $st['art'] = 0;
-                        }
-                        $st['art'] += $sti['art'];
-                    }
-                    if (isset($sti['maks_itm'])) {
-                        if (!isset($st['maks_itm'])) {
-                            $st['maks_itm'] = 0;
-                        }
-                        $st['maks_itm'] += $sti['maks_itm'];
-                    }
-                    if (isset($sti['complect'])) {
-                        $coms[count($coms)]['id'] = $sti['complect'];
-                        if (!isset($coms['com'][$sti['complect']])) {
-                            $coms['com'][$sti['complect']] = 0;
-                            if (!isset($coms['new'])) {
-                                $coms['new'] = [];
-                            }
-                            $coms['new'][count($coms['new'])] = $sti['complect'];
-                        }
-                        $coms['com'][$sti['complect']]++;
-                        if ($pl['2h'] > 0) {
-                            $coms['com'][$sti['complect']]++;
-                        }
-                    }
-                    if (isset($sti['complect2'])) {
-                        $coms[count($coms)]['id'] = $sti['complect2'];
-                        if (!isset($coms['com'][$sti['complect2']])) {
-                            $coms['com'][$sti['complect2']] = 0;
-                            if (!isset($coms['new'])) {
-                                $coms['new'] = [];
-                            }
-                            $coms['new'][count($coms['new'])] = $sti['complect2'];
-                        }
-                        $coms['com'][$sti['complect2']]++;
-                        if ($pl['2h'] > 0) {
-                            $coms['com'][$sti['complect2']]++;
-                        }
-                    }
-
-                    if (isset($sti['zonb']) && $sti['zonb'] != 0) {
-                        if (!isset($st['zonb'])) {
-                            $st['zonb'] = 0;
-                        }
-                        $st['zonb'] += $sti['zonb'];
-                    }
-
-                    if (isset($sti['zona']) && $sti['zona'] != 0) {
-                        if (!isset($st['zona'])) {
-                            $st['zona'] = 0;
-                        }
-                        $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') {
-                                        if (!isset($st[$ia[$i]])) {
-                                            $st[$ia[$i]] = 0;
-                                        }
-                                        $st[$ia[$i]] += intval($sti['add_' . $ia[$i]]);
-                                    } else {
-                                        if (!isset($st[$ia[$i]])) {
-                                            $st[$ia[$i]] = 0;
-                                        }
-                                        $st[$ia[$i]] = 100 - $st[$ia[$i]];
-                                        $st[$ia[$i]] = $st[$ia[$i]] - $st[$ia[$i]] / 100 * intval($sti['add_' . $ia[$i]]);
-                                        $st[$ia[$i]] = 100 - $st[$ia[$i]];
-                                    }
-
-                                }
-                            }
-                            $i++;
-                        }
-                    } else {
-                        $reitm[count($reitm)] = $sti;
-                    }
-                    $i = 0;
-                    while ($i < count($ia)) {
-                        if (isset($ia[$i])) {
-                            if (isset($sti['sv_' . $ia[$i]])) {
-                                if (!isset($s_v[$ia[$i]])) {
-                                    $s_v[$ia[$i]] = 0;
-                                    $s_v['z'][$pl['inOdet']][$ia[$i]] = 0;
-                                }
-                                $s_v[$ia[$i]] += intval($sti['sv_' . $ia[$i]]);
-                                $s_v['z'][$pl['inOdet']][$ia[$i]] += intval($sti['sv_' . $ia[$i]]);
-                            }
-                        }
-                        $i++;
-                    }
-                }
-
-                //����������� ���-�� � ������
-                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) {
-                                $st['a' . $i9] = $st['a' . $i9] - $st2['a' . $i9] + $reitm[$i]['add_a' . $i9];
-                                $st['mg' . $i9] = $st['mg' . $i9] - $st2['mg' . $i9] + $reitm[$i]['add_mg' . $i9];
-                                $i9++;
-                            }
-                        } elseif (isset($reitm[$i]['sm_abil']) && $i39[1] == 0) {
-                            //�����
-                            $i9 = 1;
-                            $i39[1] = 1;
-                            while ($i9 <= 12) {
-                                $st['s' . $i9] = $st['s' . $i9] - $st2['s' . $i9] + $reitm[$i]['add_s' . $i9];
-                                $i9++;
-                            }
-                        } elseif (isset($reitm[$i]['sm_skill2']) && $i39[2] == 0) {
-                            //������
-
-                            $i39[2] = 1;
-                        }
-                        $i++;
-                    }
-                }
-
-                //����� �� ������
-                $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']);
-                    $i = 0;
-                    while ($i < count($ia)) {
-                        if (isset($ia[$i])) {
-                            if (!isset($sti[$ia[$i]])) {
-                                $sti[$ia[$i]] = 0;
-                            }
-                            if (!isset($sts['add_' . $ia[$i]])) {
-                                $sts['add_' . $ia[$i]] = 0;
-                            }
-
-                            $sti[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
-
-                            if (!isset($st[$ia[$i]])) {
-                                $st[$ia[$i]] = 0;
-                            }
-                            //
-                            $st[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
-                        }
-                        $i++;
-                    }
-                }
-            }
-
-            //
-            //if( $this->info['id'] != $u['id'] ) {
-            if ($u['battle'] > 0) {
-                $test_btl_info = mysql_fetch_array(mysql_query('SELECT `id`,`noeff` FROM `battle` WHERE `id` = "' . $u['battle'] . '" 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 = [];
-            if (!isset($test_noef['id'])) {
-                $efs = mysql_query('SELECT 
-				`eu`.`id`,`eu`.`id_eff`,`eu`.`tr_life_user`,`eu`.`uid`,`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` FROM `eff_users` AS `eu` LEFT JOIN `eff_main` AS `em` ON (`eu`.`id_eff` = `em`.`id2`) 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` DESC LIMIT 50');
-                while ($e = mysql_fetch_array($efs)) {
-                    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');
-                                }
-                            }
-                        } else {
-                            if ($e['v1'] != 'priem' && $c['effz'] > 0) {
-                                if ($e['hod'] == -1) {
-                                    $efzz = round(($e['timeUse'] + $e['actionTime'] + $e['timeAce']) - time());
-                                    if ($efzz > 0) {
-                                        mysql_query('UPDATE `eff_users` SET `hod` = "' . ($efzz / $c['effz']) . '" WHERE `id` = "' . $e['id'] . '" LIMIT 1');
-                                    }
-                                }
-                            }
-                        }
-                    }
-                    if (($e['timeUse'] + $e['timeAce'] + $e['actionTime'] > time() || $e['timeUse'] == 77)) {
-                        if ($e['v1'] == 'priem') {
-                            $prsu[$e['v2']] = 0 + $prsu['x'];
-                        }
-                        $st['effects'][$h] = $e;
-                        $h++;
-                        $sts = $this->lookStats($e['data']);
-                        if (isset($sts['itempl']) && $sts['itempl'] > 0) {
-                            $nbs[$sts['itempl']] += 1;
-                        }
-                        if (isset($sts['puti'])) {
-                            $st['puti'] = $sts['puti'];
-                        }
-                        if (isset($sts['add_silver'])) {
-                            $st['slvtm'] = $e['timeUse'] + $e['actionTime'];
-                        }
-                        $i = 0;
-                        while ($i < count($ia)) {
-                            if (isset($ia[$i])) {
-                                if (isset($sts['add_' . $ia[$i]])) {
-                                    if (!isset($sti[$ia[$i]])) {
-                                        $sti[$ia[$i]] = 0;
-                                    }
-                                    $sti[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
-                                }
-                                if (isset($sts['add_' . $ia[$i]])) {
-                                    if ($ia[$i] != 'zaproc' && $ia[$i] != 'zmproc') {
-                                        if (!isset($st[$ia[$i]])) {
-                                            $st[$ia[$i]] = 0;
-                                        }
-                                        $st[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
-                                    } else {
-                                        if (!isset($st[$ia[$i]])) {
-                                            $st[$ia[$i]] = 0;
-                                        }
-                                        $st[$ia[$i]] = 100 - $st[$ia[$i]];
-                                        $st[$ia[$i]] = $st[$ia[$i]] - $st[$ia[$i]] / 100 * intval($sts['add_' . $ia[$i]]);
-                                        $st[$ia[$i]] = 100 - $st[$ia[$i]];
-                                    }
-                                }
-                            }
-                            $i++;
-                        }
-                        $i = 0;
-                        while ($i < count($ia)) {
-                            if (isset($ia[$i])) {
-                                if (isset($sts['sv_' . $ia[$i]])) {
-                                    if (!isset($s_vi[$ia[$i]])) {
-                                        $s_vi[$ia[$i]] = 0;
-                                    }
-                                    $s_vi[$ia[$i]] += intval($sts['sv_' . $ia[$i]]);
-                                }
-                                if (isset($sts['sv_' . $ia[$i]])) {
-                                    if (!isset($s_v[$ia[$i]])) {
-                                        $s_v[$ia[$i]] = 0;
-                                    }
-                                    $s_v[$ia[$i]] += intval($sts['sv_' . $ia[$i]]);
-                                }
-                            }
-                            $i++;
-                        }
-                    } elseif ($e['timeUse'] != 77) {
-                        //������� ������
-                        if ($e['img2'] != 'tz.gif' || $u['id'] == $this->info['id']) {
-                            if ($e['sleeptime'] == 0) {
-                                $this->endEffect($e['id'], $u);
-                            }
-                            $st['act'] = 1;
-                        }
-                    }
-                }
-            } else {
-                $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';
-                $st['items_img'][9] = 'belt_illusion2.gif';
-                $st['items_img'][5] = 'naruchi_illusion2.gif';
-                $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';
-                $st['items_img'][9] = 'belt_illusion1.gif';
-                $st['items_img'][5] = 'naruchi_illusion1.gif';
-                $st['items_img'][4] = 'helmet_illusion1.gif';
-                $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';
-                $st['items_img'][14] = 'amulet_illusion1.gif';
-                $st['items_img'][15] = 'earrings_illusion1.gif';
-            }
-
-            if ($itmslvl < 5) {
-                //������ ����������
-                $st['itmslvl'] = 0;
-            } else {
-                $st['itmslvl'] = 1;
-            }
-            //
-            $st['itmsCfc'] = $itmsCfc;
-
-            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'] = [];
-                while ($e = mysql_fetch_array($efs)) {
-                    $e['type1'] = 14;
-                    $e['img'] = $e['img2'];
-                    if ($e['tr_life_user'] > 0) {
-                        $trlu = mysql_fetch_array(mysql_query('SELECT `hpNow` FROM `stats` WHERE `id` = "' . $e['tr_life_user'] . '" LIMIT 1'));
-                        if (floor($trlu['hpNow']) < 1) {
-                            $this->endEffect($e['id'], $u);
-                            $st['act'] = 1;
-                        }
-                    }
-                    if ($e['timeUse'] + $e['timeAce'] + $e['actionTime'] > time() || $e['timeUse'] == 77) {
-                        if ($e['v1'] == 'priem') {
-                            $prsu[$e['v2']] = 0 + $prsu['x'];
-                        }
-                        $st['effects'][$h] = $e;
-                        $h++;
-                        $sts = $this->lookStats($e['data']);
-                        if ($e['v2'] == 217) {
-                            $st['raztac'] = 1;
-                        }
-                        if (isset($sts['add_pog'])) {
-                            $ctt = count($st['set_pog']);
-                            $st['set_pog'][$ctt]['id'] = $h;
-                            $st['set_pog'][$ctt]['y'] = $sts['add_pog'];
-                            unset($ctt);
-                        }
-                        if (isset($sts['natoe'])) {
-                            $st['set_natoe']['id'] = $h;
-                            $st['set_natoe']['a'] = 0 + $sts['natoe_end'];
-                            $st['set_natoe']['b'] = 0 + $sts['natoe'];
-                            $st['set_natoe']['eff_id'] = $e['id'];
-                            $st['set_natoe']['t'] = 0 + $sts['natoe_type'];
-                            $st['set_natoe']['user_id'] = $e['tr_life_user'];
-                        }
-                        if (isset($sts['add_pog2'])) {
-                            $ctt = count($st['set_pog2']);
-                            $st['set_pog2'][$ctt]['id'] = $h;
-                            $st['set_pog2'][$ctt]['y'] = $sts['add_pog2'];
-                            $st['set_pog2'][$ctt]['p'] = $sts['add_pog2p'];
-                            $st['set_pog2'][$ctt]['m'] = $sts['add_pog2mp'];
-                            unset($ctt);
-                        }
-                        $i = 0;
-                        while ($i < count($ia)) {
-                            if (isset($ia[$i])) {
-                                if (isset($sts['add_' . $ia[$i]])) {
-                                    if ($ia[$i] != 'zaproc' && $ia[$i] != 'zmproc') {
-                                        if (!isset($sti[$ia[$i]])) {
-                                            $sti[$ia[$i]] = 0;
-                                        }
-                                        $sti[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
-                                        if (!isset($st[$ia[$i]])) {
-                                            $st[$ia[$i]] = 0;
-                                        }
-                                        $st[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
-                                    } else {
-                                        $sti[$ia[$i]] = 100 - $sti[$ia[$i]];
-                                        $sti[$ia[$i]] = $sti[$ia[$i]] - $sti[$ia[$i]] / 100 * intval($sts['add_' . $ia[$i]]);
-                                        $sti[$ia[$i]] = 100 - $sti[$ia[$i]];
-
-                                        $st[$ia[$i]] = 100 - $st[$ia[$i]];
-                                        $st[$ia[$i]] = $st[$ia[$i]] - $st[$ia[$i]] / 100 * intval($sts['add_' . $ia[$i]]);
-                                        $st[$ia[$i]] = 100 - $st[$ia[$i]];
-                                    }
-                                }
-                            }
-                            $i++;
-                        }
-                        $i = 0;
-                        while ($i < count($ia)) {
-                            if (isset($ia[$i])) {
-                                if (isset($sts['add_' . $ia[$i]])) {
-                                    if (!isset($s_vi[$ia[$i]])) {
-                                        $s_vi[$ia[$i]] = 0;
-                                    }
-                                    $s_vi[$ia[$i]] += intval($sts['sv_' . $ia[$i]]);
-                                    if (!isset($s_v[$ia[$i]])) {
-                                        $s_v[$ia[$i]] = 0;
-                                    }
-                                    $s_v[$ia[$i]] += intval($sts['sv_' . $ia[$i]]);
-                                }
-                            }
-                            $i++;
-                        }
-                    } elseif ($e['timeUse'] != 77) {
-                        //������� ������
-                        $this->endEffect($e['id'], $u);
-                        $st['act'] = 1;
-                    }
-                }
-            }
-
-            //�������������� �� ������
-
-            if (!isset($st['hpAll'])) {
-                $st['hpAll'] = 0;
-            }
-            $st['hpAll'] += $st['s4'] * 5;
-
-            if (!isset($st['mpAll'])) {
-                $st['mpAll'] = 0;
-            }
-            @$st['mpAll'] += @$st['s6'] * 10;
-
-            //������
-            if (!isset($st['m1'])) {
-                $st['m1'] = 0;
-            }
-            $st['m1'] += $st['s3'] * 5;
-
-
-            // ��.����-���� = 2.5
-            if (!isset($st['m2'])) {
-                $st['m2'] = 0;
-            }
-            $st['m2'] += $st['s3'] * 5;
-
-            // ��.������ = 2.5
-            if (!isset($st['m4'])) {
-                $st['m4'] = 0;
-            }
-            $st['m4'] += $st['s2'] * 5;
-
-            // ��.����-������ = 2.5
-            if (!isset($st['m5'])) {
-                $st['m5'] = 0;
-            }
-            $st['m5'] += $st['s2'] * 5;
-
-            if (!isset($st['za'])) {
-                $st['za'] = 0;
-            }
-            $st['za'] += $st['s4'] * 1.0;
-
-            if (!isset($st['zm'])) {
-                $st['zm'] = 0;
-            }
-            $st['zm'] += $st['s4'] * 1.0;
-
-            if (!isset($st['zaproc'])) { //��� �� 'zaproc'=>'������ �� ����� (%)','zmproc'=>'������ �� ����� ������ (%)
-                $st['zaproc'] = 0;
-            }
-            $st['zaproc'] += round($st['s5'] * 0);
-
-            if (!isset($st['m19'])) {
-                $st['m19'] = 0;
-            }
-            $st['m19'] += round($st['s3'] * 0.03);
-
-            //��������
-            //�������� ������ "�������� ����. �����". ����
-            if (!isset($st['antm3'])) {
-                $st['antm3'] = 0;
-            }
-            $st['antm3'] += $st['s2'] * 0.5;
-
-
-            if (!isset($st['m10'])) {
-                $st['m10'] = 0;
-            }
-            $st['m10'] += 0;
-
-            if (!isset($st['m11'])) {
-                $st['m11'] = 0;
-            }
-            $st['m11'] += 0;
-
-            if (!isset($st['m11a'])) {
-                $st['m11a'] = 0;
-            }
-            $st['m11a'] += 0;
-
-
-            if (!isset($st['m8'])) {
-                $st['m8'] = 0;
-            }
-            $st['m8'] += 0;
-
-            //������ ����������
-            $i = 0;
-            while ($i <= count(@$coms['new'])) {
-                if (@isset($coms['new'][$i])) {
-                    //$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)) {
-                            if (isset($ia[$ij]) && isset($sti[$ia[$ij]])) {
-                                $st[$ia[$ij]] += $sti[$ia[$ij]];
-                            }
-                            $ij++;
-                        }
-                    }
-                }
-                $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)) {
-                    $splink .= $pli['item_id'] . '-' . $pli['inOdet'] . ',';
-                }
-                $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']);
-                    $i = 0;
-                    while ($i <= 20) {
-                        //
-                        $spe1a = explode('-', $spe1[$i]);
-                        $spe2a = explode('-', $spe2[$i]);
-                        //
-                        if (isset($spe1a[0])) {
-                            $spe1g[$spe1a[1]] = $spe1a[0];
-                        }
-                        if (isset($spe2a[0])) {
-                            $spe2g[$spe2a[1]] = $spe2a[0];
-                        }
-                        //
-                        $i++;
-                    }
-                    $i = 40;
-                    while ($i <= 50) {
-                        if ($spe1g[$i] != $spe2g[$i] && $spe1g[$i] == 0) {
-                            //echo '['.$spe2g[$i].'->'.$i.']';
-                            $splu = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `item_id` = "' . $spe2g[$i] . '" AND `inOdet` = 0 AND `delete` = 0 AND `inTransfer` = 0 AND `inShop` = 0 AND `uid` = "' . $u['id'] . '" AND `inGroup` = 0 LIMIT 1'));
-                            if (isset($splu['id'])) {
-                                mysql_query('UPDATE `items_users` SET `inOdet` = "' . $i . '" WHERE `id` = "' . $splu['id'] . '" LIMIT 1');
-                            }
-                        }
-                        $i++;
-                    }
-                }
-            }
-
-
-            //������ ������
-            //���
-            //����
-
-            if ($st['s1'] > 24 && $st['s1'] < 50) {
-                $st['m2'] += 15;
-            }
-            if ($st['s1'] > 49 && $st['s1'] < 75) {
-                $st['pa2'] += 2;
-                $st['m2'] += 35;
-            }
-            if ($st['s1'] > 74 && $st['s1'] < 100) {
-                $st['pa2'] += 5;
-                $st['m2'] += 50;
-            }
-            if ($st['s1'] > 99 && $st['s1'] < 125) {
-                $st['pa2'] += 8;
-                $st['m2'] += 80;
-            }
-            if ($st['s1'] > 124 && $st['s1'] < 150) {
-                $st['pa2'] += 12;
-                $st['m2'] += 105;
-            }
-            if ($st['s1'] > 149 && $st['s1'] < 175) {
-                $st['pa2'] += 17;
-                $st['m7'] += 2;
-            }
-            if ($st['s1'] > 174 && $st['s1'] < 200) {
-                $st['pa2'] += 23;
-                $st['m7'] += 5;
-            }
-            if ($st['s1'] > 199) {
-                $st['pa2'] += 30;
-                $st['m7'] += 7;
-            }
-
-            //�������� $st[1]['pa1']  += 2; $st['m7']  += 35;
-
-            if ($st['s2'] > 24 && $st['s2'] < 50) {
-                $st['pa1'] += 2;
-                $st['m4'] += 35;
-            }
-            if ($st['s2'] > 49 && $st['s2'] < 75) {
-                $st['pa1'] += 5;
-                $st['m2'] += 40;
-                $st['m4'] += 75;
-            }
-            if ($st['s2'] > 74 && $st['s2'] < 100) {
-                $st['pa1'] += 8;
-                $st['m2'] += 65;
-                $st['m4'] += 90;
-            }
-            if ($st['s2'] > 99 && $st['s2'] < 125) {
-                $st['pa1'] += 12;
-                $st['m2'] += 75;
-                $st['m4'] += 105;
-            }
-            if ($st['s2'] > 124 && $st['s2'] < 150) {
-                $st['pa1'] += 17;
-                $st['m2'] += 85;
-                $st['m4'] += 105;
-                $st['m15'] += 1;
-            }
-            if ($st['s2'] > 149 && $st['s2'] < 175) {
-                $st['pa1'] += 20;
-                $st['m2'] += 110;
-                $st['m4'] += 115;
-                $st['m15'] += 2;
-            }
-            if ($st['s2'] > 174 && $st['s2'] < 200) {
-                $st['pa1'] += 23;
-                $st['m2'] += 145;
-                $st['m4'] += 145;
-                $st['m15'] += 3;
-            }
-            if ($st['s2'] > 199) {
-                $st['pa1'] += 30;
-                $st['m2'] += 165;
-                $st['m4'] += 165;
-                $st['m15'] += 5;
-            }
-
-            //��������
-
-            if ($st['s3'] > 24 && $st['s3'] < 50) {
-                $st['pa4'] += 2;
-                $st['m3'] += 2;
-                $st['m1'] += 25;
-            }
-            if ($st['s3'] > 49 && $st['s3'] < 75) {
-                $st['pa4'] += 5;
-                $st['m3'] += 5;
-                $st['m1'] += 55;
-            }
-            if ($st['s3'] > 74 && $st['s3'] < 100) {
-                $st['pa4'] += 8;
-                $st['m3'] += 10;
-                $st['m1'] += 75;
-                $st['m5'] += 25;
-            }
-            if ($st['s3'] > 99 && $st['s3'] < 125) {
-                $st['pa4'] += 12;
-                $st['m3'] += 15;
-                $st['m1'] += 105;
-                $st['m5'] += 35;
-            }
-            if ($st['s3'] > 124 && $st['s3'] < 150) {
-                $st['pa4'] += 17;
-                $st['m3'] += 20;
-                $st['m1'] += 125;
-                $st['m5'] += 45;
-                $st['m14'] += 1;
-            }
-            if ($st['s3'] > 149 && $st['s3'] < 175) {
-                $st['pa4'] += 20;
-                $st['m3'] += 30;
-                $st['m1'] += 145;
-                $st['m5'] += 50;
-                $st['m14'] += 2;
-            }
-            if ($st['s3'] > 174 && $st['s3'] < 200) {
-                $st['pa4'] += 23;
-                $st['m3'] += 35;
-                $st['m1'] += 165;
-                $st['m5'] += 55;
-                $st['m14'] += 3;
-            }
-            if ($st['s3'] > 199) {
-                $st['pa4'] += 30;
-                $st['m3'] += 40;
-                $st['m1'] += 185;
-                $st['m5'] += 65;
-                $st['m14'] += 5;
-            }
-
-            //������������
-
-            if ($st['s4'] > 0) {
-                $st['hpAll'] += 30;
-            }
-            if ($st['s4'] > 24 && $st['s4'] < 50) {
-                $st['hpAll'] += 50;
-            }
-            if ($st['s4'] > 49 && $st['s4'] < 75) {
-                $st['hpAll'] += 100;
-            }
-            if ($st['s4'] > 74 && $st['s4'] < 100) {
-                $st['hpAll'] += 175;
-                $st['m19'] += 2;
-            }
-            if ($st['s4'] > 99 && $st['s4'] < 125) {
-                $st['hpAll'] += 250;
-                $st['m19'] += 4;
-            }
-            if ($st['s4'] > 124 && $st['s4'] < 150) {
-                $st['hpAll'] += 400;
-                $st['za'] += 25;
-                $st['zm'] += 25;
-            }
-            if ($st['s4'] > 149 && $st['s4'] < 175) {
-                $st['hpAll'] += 450;
-                $st['za'] += 50;
-                $st['zm'] += 50;
-            }
-            if ($st['s4'] > 174 && $st['s4'] < 200) {
-                $st['hpAll'] += 600;
-                $st['za'] += 100;
-                $st['zm'] += 100;
-            }
-            if ($st['s4'] > 199) {
-                $st['hpAll'] += 850;
-                $st['za'] += 125;
-                $st['zm'] += 125;
-            }
-            //��������
-
-            if ($st['s5'] > 24 && $st['s5'] < 50) {
-                $st['m11'] += 10;
-            }
-            if ($st['s5'] > 49 && $st['s5'] < 75) {
-                $st['m11'] += 15;
-            }
-            if ($st['s5'] > 74 && $st['s5'] < 100) {
-                $st['m11'] += 20;
-            }
-            if ($st['s5'] > 99 && $st['s5'] < 125) {
-                $st['m11'] += 25;
-            }
-            if ($st['s5'] > 124 && $st['s5'] < 150) {
-                $st['m11'] += 35;
-            }
-            if ($st['s5'] > 149 && $st['s5'] < 175) {
-                $st['m11'] += 50;
-            }
-            if ($st['s5'] > 174) {
-                $st['m11'] += 65;
-                $st['pzm'] += 2;
-            }
-            if ($st['s5'] > 199) {
-                $st['pzm'] += 5;
-            }
-            //��������
-
-            if ($st['s6'] > 24 && $st['s6'] < 50) {
-                $st['mpAll'] += 150;
-                $st['speedmp'] += 100;
-            }
-            if ($st['s6'] > 49 && $st['s6'] < 75) {
-                $st['mpAll'] += 200;
-                $st['speedmp'] += 200;
-            }
-            if ($st['s6'] > 74 && $st['s6'] < 100) {
-                $st['mpAll'] += 250;
-                $st['speedmp'] += 350;
-            }
-            if ($st['s6'] > 99 && $st['s6'] < 125) {
-                $st['mpAll'] += 350;
-                $st['speedmp'] += 500;
-            }
-            if ($st['s6'] > 124 && $st['s6'] < 150) {
-                $st['mpAll'] += 500;
-                $st['speedmp'] += 500;
-                $st['pzm'] += 2;
-            }
-            if ($st['s6'] > 149 && $st['s6'] < 175) {
-                $st['mpAll'] += 700;
-                $st['speedmp'] += 600;
-                $st['pzm'] += 3;
-            }
-            if ($st['s6'] > 174 && $st['s6'] < 200) {
-                $st['mpAll'] += 900;
-                $st['speedmp'] += 700;
-                $st['pzm'] += 5;
-            }
-            if ($st['s6'] > 199) {
-                $st['mpAll'] += 900;
-                $st['speedmp'] += 700;
-                $st['pzm'] += 7;
-            }
-
-            //���� ������ ������ �����
-            if ($hnd2 == 1 && $hnd1 == 1) {
-                $st['zona']++;
-            }
-
-            if ($sht1 == 1) {
-                $st['zonb']++;
-            }
-
-            /* �������� */
-            $i = 1;
-            while ($i <= 7) {
-                if (!isset($st['pm' . $i])) {
-                    $st['pm' . $i] = 0;
-                }
-                if (!isset($st['a' . $i])) {
-                    $st['a' . $i] = 0;
-                }
-                if (!isset($st['mg' . $i])) {
-                    $st['mg' . $i] = 0;
-                }
-                if (!isset($st['zm' . $i])) {
-                    $st['zm' . $i] = 0;
-                }
-                if (isset($st['s5'])) {
-                    $st['pm' . $i] += $st['s5'] * 0.5;
-                }
-                if (isset($st['m11a'])) {
-                    $st['pm' . $i] += $st['m11a'];
-                }
-                if (isset($st['aall'])) {
-                    $st['a' . $i] += $st['aall'];
-                }
-                if (isset($st['m2all'])) {
-                    $st['mg' . $i] += $st['m2all'];
-                }
-                if (isset($st['zm'])) {
-                    $st['zm' . $i] += $st['zm'];
-                }
-                if (isset($st['zma'])) {
-                    $st['zm' . $i] += $st['zma'];
-                }
-                if ($i <= 4) {
-                    if (!isset($st['mib' . $i])) {
-                        $st['mib' . $i] = 0;
-                    }
-                    if (!isset($st['mab' . $i])) {
-                        $st['mab' . $i] = 0;
-                    }
-                    if (!isset($st['mg' . $i])) {
-                        $st['mg' . $i] = 0;
-                    }
-                    if (!isset($st['pm' . $i])) {
-                        $st['pm' . $i] = 0;
-                    }
-                    if (!isset($st['pa' . $i])) {
-                        $st['pa' . $i] = 0;
-                    }
-                    if (!isset($st['za' . $i])) {
-                        $st['za' . $i] = 0;
-                    }
-                    $st['mib' . $i] += 0;
-                    $st['mab' . $i] += 0;
-                    if (isset($st['mall'])) {
-                        $st['mg' . $i] += $st['mall'];
-                    }
-                    if (isset($st['m11'])) {
-                        $st['pm' . $i] += $st['m11'];
-                    }
-                    if (isset($st['m10'])) {
-                        $st['pa' . $i] += $st['m10'];
-                    }
-                    if (isset($st['za'])) {
-                        $st['za' . $i] += $st['za'];
-                    }
-                }
-                $i++;
-            }
-
-            //���������� ������ � ������
-
-            $i = 1;
-            while ($i <= 7) {
-                @$st['yzm' . $i] += @$st['yzma'];
-                if ($i <= 4) {
-                    @$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) {
-                        $st['zm' . $i] = 0;
-                    }
-                }
-                $i++;
-            }
-
-
-            if (isset($st['hpVinos']) && $st['hpVinos'] != 0) {
-                $st['hpAll'] += round($st['hpVinos'] * $st['s4']);
-            }
-
-            if (isset($st['mpVinos']) && $st['mpVinos'] != 0) {
-                $st['mpAll'] += round($st['mpVinos'] * $st['s6']);
-            }
-
-            if (isset($st['hpProc']) && $st['hpProc'] != 0) {
-                $st['hpAll'] += round($st['hpAll'] / 100 * $st['hpProc']);
-            }
-
-            if (isset($st['mpProc']) && $st['mpProc'] != 0) {
-                $st['mpAll'] += round($st['mpAll'] / 100 * $st['mpProc']);
-            }
-
-            //�����. - 250 ��.
-
-
-            //����� �������
-            if ($st['hpNow'] < 0) {
-                $st['hpNow'] = 0;
-            } elseif ($st['hpNow'] > $st['hpAll']) {
-                $st['hpNow'] = $st['hpAll'];
-            }
-            if ($st['mpNow'] < 0) {
-                $st['mpNow'] = 0;
-            } elseif ($st['mpNow'] > $st['mpAll']) {
-                $st['mpNow'] = $st['mpAll'];
-            }
-
-            //���� ����� � �����
-            if ($st['zona'] < 1) {
-                $st['zona'] = 1;
-            }
-            if ($st['zona'] > 5) {
-                $st['zona'] = 5;
-            }
-            if ($st['zonb'] < 1) {
-                $st['zonb'] = 1;
-            }
-            if ($st['zonb'] > 3) {
-                $st['zonb'] = 3;
-            }
-
-            $st['ozash'] = $oza;
-            $st['ozmsh'] = $ozm;
-            $st['weapon1'] = $hnd1;
-            $st['weapon2'] = $hnd2;
-            $st['sheld1'] = $sht1;
-            $st['sv_'] = $s_v;
-            $st['sv_i'] = $s_vi;
-            $st['dom'] = $dom;
-            $st['prsu'] = $prsu;
-
-            $st['x'] = $u['x'];
-            $st['y'] = $u['y'];
-            $st['s'] = $u['s'];
-
-            $st['reting'] = 1 + ceil($st['reting']);
-            $st['reting'] = 1 + $st['irka'];
-
-            if ($st['vip'] > 0) { //$u
-                $st['antm3'] += 20;
-                $st['zaproc'] += 5;
-                $st['zmproc'] += 5;
-                $st['m10'] += 20;
-                $st['pzm'] += 5;
-            }
-
-            //����� �� �������
-            $rep1 = mysql_fetch_array(mysql_query('SELECT 
-			`add_slot`,`nu_sandcity`,`n_sandcity`,
-			`dl1`,`id`,`rep1`,`rep2`,`repcapitalcity`,`repdemonscity`,`repangelscity`,`repabandonedplain`,
-			`repdevilscity`,`repmooncity`,`repsuncity`,`repsandcity`,`repemeraldscity`,`repdreamscity`,`repizlom`,
-			`n_capitalcity`,`n_demonscity`,`n_suncity`,`nu_demonscity`,`nu_angelscity`,`nu_abandonedplain`,`nu_emeraldscity`,
-			`nu_capitalcity`,`nu_suncity`,`nu_devilscity`,`nu_dreamscity`,`add_stats`,`add_money`,`add_skills`,`add_skills2`,
-			`rep3`,`rep3_buy`,`repdragonscity`,`n_dragonscity`,`nu_dragonscity`,
-			(`repcapitalcity`+`repdemonscity`+`repangelscity`+`repsuncity`+`repdreamscity`+`repabandonedplain`+`repsandcity`+`repemeraldscity`+`repdevilscity`) as allrep, 
-			(`nu_capitalcity`+`nu_demonscity`+`nu_angelscity`+`nu_suncity`+`nu_dreamscity`+`nu_abandonedplain`+`nu_sandcity`+`nu_emeraldscity`+`nu_devilscity`) as allnurep FROM `rep` WHERE `id` = "' . $u['id'] . '" LIMIT 1'));
-
-            if ($u['referals'] >= 3000) {
-                $st['speedhp'] += 50;
-                $st['speedmp'] += 50;
-                $st['antm3'] += 25;
-                $st['m10'] += 15;
-                $st['m11'] += 15;
-                $st['speed_dungeon'] += 25;
-                $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) {
-                $st['speed_dungeon'] += 25;
-            }
-
-            if ($u['admin'] > 0) {
-                $st['speed_dungeon'] += 1000;
-                $st['speedhp'] += 1000000000000000;
-            }
-
-            if (date('H') >= 22 && date('H') <= 10) {
-                $st['exp'] += 25;
-            }
-
-            //��������� ������� ������
-            $st['reting'] = floor($st['reting']);
-
-            if (@$st['btl_cof'] != @$st['prckr']) {
-                $st['btl_cof'] = $st['prckr'];
-                mysql_query('UPDATE `stats` SET `btl_cof` = "' . $st['prckr'] . '" WHERE `id` = "' . $st['id'] . '" LIMIT 1');
-            }
-
-            if ($st['hpAll'] < 1) {
-                $st['hpAll'] = 1;
-            }
-
-            if ($st['mpAll'] < 0) {
-                $st['mpAll'] = 0;
-            }
-
-            if ($u['room'] == 411) {
-                //������, ������ �� ����� -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')) {
-                $st['this_animal'] = 1;
-            } else {
-                $st['this_animal'] = 0;
-            }
-
-            $rt = [];
-            if ($i1 == 1) {
-                $rt[0] = $st;
-                $rt[1] = $st2; //������ �����
-            } else {
-                $rt = $st;
-            }
-
-            if ($u['hpAll'] != $st['hpAll'] || $u['mpAll'] != $st['mpAll']) {
-                mysql_query('UPDATE `stats` SET `hpAll` = "' . $st['hpAll'] . '",`mpAll` = "' . $st['mpAll'] . '" WHERE `id` = "' . $u['id'] . '" LIMIT 1');
-            }
-
-            if ($btl_cache == true && $cache == false) {
-                $dataca = [
-                    'st' => $st,
-                    'st2' => $st2
-                ];
-                $dataca = json_encode($dataca);
-                mysql_query('INSERT INTO `battle_cache` (`uid`,`battle`,`data`,`time`) VALUES ("' . $u['id'] . '","' . $u['battle'] . '","' . mysql_real_escape_string($dataca) . '","' . time() . '")');
-            }
-        }
-
-        if (isset($cache)) {
-            if ($i1 == 1) {
-                $rt = [$cache['st'], $cache['st2']];
-            } else {
-                $rt = $cache['st'];
-            }
-        }
-
-        return $rt;
-    }
-
-    public function send($color, $room, $city, $from, $to, $text, $time, $type, $toChat, $spam, $sound, $new = 1, $typeTime = 0, $global = 0)
-    {
-        mysql_query("INSERT INTO `chat` (`global`,`typeTime`,`new`,`sound`,`color`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`spam`) VALUES
-		('" . $global . "','" . $typeTime . "','" . $new . "','" . $sound . "','" . $color . "','" . $city . "','" . $room . "','" . $from . "','" . $to . "','" . $text . "','" . $time . "','" . $type . "','" . $toChat . "','" . $spam . "')");
-        $msg_id = mysql_insert_id();
-        return $msg_id;
-    }
-
-    //�������� �������
-    public function testLevel()
-    {
-        global $c;
-        $rt = 0;
-        if ($this->info['expstopu'] > 2 && $this->info['exp'] > $c['expstopu']) {
-            $this->info['exp'] = $c['expstopu'];
-            mysql_query('UPDATE `stats` SET `exp` = "' . $c['expstopu'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-        } elseif ($this->info['exp'] > $c['expstop'] && $this->info['expstopu'] < 3) {
-            //upexpdate
-            if ($this->info['upexpdate'] == 0) {
-                $this->info['upexpdate'] = time();
-                mysql_query('UPDATE `stats` SET `upexpdate` = "' . time() . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-            } elseif (time() >= ($this->info['upexpdate'] + 400 * 60 * 60 * 24)) //4*60*60*24
-            {
-                $this->info['upexpdate'] = time();
-                $this->info['expstopu'] = $this->info['expstopu'] + 1;
-                mysql_query('UPDATE `stats` SET `upexpdate` = "' . time() . '",`expstopu` = `expstopu`+1 WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-            }
-            if ($this->info['expstopu'] < 3) {
-                $this->info['exp'] = $c['expstop'];
-                mysql_query('UPDATE `stats` SET `exp` = "' . $c['expstop'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-            }
-        }
-        if (isset($this->stats['levels']['upLevel'])) {
-            $telvl = [];
-            $sp = mysql_query('SELECT `upLevel`,`exp` FROM `levels`');
-            while ($pl = mysql_fetch_array($sp)) {
-                $telvl[$pl['upLevel']] = $pl['exp'];
-            }
-            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 '<script>chat.sendMsg(["new","' . time() . '","6","","' . $this->info['login'] . '","��� �������� �� 6-�� ������� ��������� &quot;<strong>�������� �������� [6]</strong>&quot;.","Black","1","1","0"]);</script>';
-                    } else {
-
-                        mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
-                        $text = '������� &quot;<strong>�������� �������� [6]</strong>&quot; ��� ������� �����������.';
-                        echo '<script>chat.sendMsg(["new","' . time() . '","6","","' . $this->info['login'] . '","' . $text . '","Black","1","1","0"]);</script>';
-                        //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')");
-                    }
-
-                }
-                //****************
-                $i = 0;
-                $ult = 0;
-                //mysql_query('LOCK TABLES users,stats,mults,bank,referal_bous,levels,chat WRITE');
-                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
-                        if ($tlus[0] < $this->info['level'] * 5) {
-                            //������ �������� ���/���� ���� �� ����� 100 ���������� �������� ������
-                            $this->info['exp'] = $lvl['exp'] - 1;
-                            mysql_query('UPDATE `stats` SET `exp` = "' . $this->info['exp'] . '" WHERE `id` = "' . $this->info['id'] . '" 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;
-                            } elseif ($lvl['nextLevel'] == 10) {
-                                $a4 = 3;
-                            } elseif ($lvl['nextLevel'] == 11) {
-                                $a4 = 5;
-                            } elseif ($lvl['nextLevel'] == 12) {
-                                $a4 = 30;
-                            }
-
-                            $this->stats['s4'] += $a4;
-                            $sex1 = '';
-                            if ($this->info['sex'] == 1) {
-                                $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'));
-                                $rlogs = mysql_fetch_array(mysql_query('SELECT `id`,`ref_data` FROM `stats` WHERE `id` = "' . ((int)$this->info['host_reg']) . '" LIMIT 1'));
-
-                                if (!isset($mtest['id']) && isset($rlog['id'])) {
-                                    $rtg = true;
-                                } else {
-                                    $rtg = mysql_fetch_array(mysql_query('SELECT * FROM `ref_mult` WHERE `uid1` = "' . $rlog['id'] . '" LIMIT 1'));
-                                    if (isset($rtg['id'])) {
-                                        if ($this->info['id'] == $rtg['uid2']) {
-                                            $rtg = true;
-                                        } else {
-                                            $rtg = false;
-                                        }
-                                    } else {
-                                        mysql_query('INSERT INTO `ref_mult` (`uid1`,`uid2`,`time`) VALUES (
-											"' . $rlog['id'] . '" , "' . $this->info['id'] . '","' . time() . '"
-										)');
-                                        $rtg = true;
-                                    }
-                                }
-
-                                if (($rtg == true || !isset($mtest['id'])) && isset($rlog['id']) && $this->info['activ'] == 0) {
-                                    $rfs['data'] = explode('|', $rlogs['ref_data']);
-                                    $ekr = '0.00';
-                                    $bn = mysql_fetch_array(mysql_query('SELECT `id`,`type`,`level`,`add_bank`,`add_money`,`finish_battle`,`online`,`onlyOne`,`add_crystals` FROM `referal_bous` WHERE `type` = 1 AND `level` = "' . $lvl['nextLevel'] . '" LIMIT 1'));
-                                    if (isset($bn['id']) && ($bn['add_bank'] > 0 || $bn['add_money'] > 0)) {
-                                        $ekr = $bn['add_bank'];
-                                        $kr = $bn['add_money'];
-                                        $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-�� ������
-                                            $krtxt = '';
-                                            if ($kr > 0) {
-                                                $krtxt .= '' . $kr . ' ��';
-                                                if ($ekr > 0) {
-                                                    $krtxt .= ', ';
-                                                }
-                                            }
-                                            if ($ekr > 0) {
-                                                $krtxt .= '' . $ekr . ' ���';
-                                            }
-                                            $this->send('', $this->info['room'], $this->info['city'], '', $rlog['login'], '��� ������� <strong>' . $this->info['login'] . '</strong> ������' . $sex1 . ' ������ ' . $lvl['nextLevel'] . '! ��� ���������� ' . $krtxt, -1, 6, 0, 0, 0, 1);
-                                            $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-�� ������
-                                                $llogin = $rlog['login'];
-                                                $ekr = round($bn['add_bank'] * 0.4, 2);
-                                                $kr = round($bn['add_money'] * 0.4, 2);
-                                                $rlog = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`catch`,`host_reg` FROM `users` WHERE `id` = "' . ((int)$rlog['host_reg']) . '" LIMIT 1'));
-                                                if (isset($rlog['id'])) {
-                                                    $krtxt = '';
-                                                    if ($kr > 0) {
-                                                        $krtxt .= '' . $kr . ' ��';
-                                                        if ($ekr > 0) {
-                                                            $krtxt .= ', ';
-                                                        }
-                                                    }
-                                                    if ($ekr > 0) {
-                                                        $krtxt .= '' . $ekr . ' ���';
-                                                    }
-                                                    $this->send('', $this->info['room'], $this->info['city'], '', $rlog['login'], '��� ������� <strong>' . $this->info['login'] . '</strong> (2-�� ������ �� &quot;' . $llogin . '&quot; ) ������' . $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-�� ������
-                                                        $llogin2 = $rlog['login'];
-                                                        $ekr = round($bn['add_bank'] * 0.2, 2);
-                                                        $kr = round($bn['add_money'] * 0.2, 2);
-                                                        $rlog = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`catch`,`host_reg` FROM `users` WHERE `id` = "' . ((int)$rlog['host_reg']) . '" LIMIT 1'));
-                                                        if (isset($rlog['id'])) {
-                                                            $krtxt = '';
-                                                            if ($kr > 0) {
-                                                                $krtxt .= '' . $kr . ' ��';
-                                                                if ($ekr > 0) {
-                                                                    $krtxt .= ', ';
-                                                                }
-                                                            }
-                                                            if ($ekr > 0) {
-                                                                $krtxt .= '' . $ekr . ' ���';
-                                                            }
-                                                            $this->send('', $this->info['room'], $this->info['city'], '', $rlog['login'], '��� ������� <strong>' . $this->info['login'] . '</strong> (3-�� ������ �� &quot;' . $llogin2 . '&quot; (������� ' . $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');
-                                                            //
-                                                        }
-                                                    }
-                                                    //
-                                                }
-                                            }
-
-                                        } else {
-                                            $this->send('', $this->info['room'], $this->info['city'], '', $rlog['login'], '��� ������� <strong>' . $this->info['login'] . '</strong> ������' . $sex1 . ' ������ ' . $lvl['nextLevel'] . '! (������ ����������, ���������� � ������������� �������) �� ��� ���������� ���� �' . $bnk . ' ���������� ' . $ekr . ' ��.', -1, 6, 0, 0, 0, 1);
-                                        }
-                                    }
-                                    //
-                                    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'], '��� ������� <strong>' . $this->info['login'] . '</strong> ������' . $sex1 . ' ������ ' . $lvl['nextLevel'] . '! <small><font color=red>(�������� �� �����������, ���� � ��� ��������� IP! ��������� �� ����� 1 ������ ��������!)</font></small>', -1, 6, 0, 0, 0, 1);
-                                }
-                            }
-                        }
-
-                        $tst = $this->lookStats($this->info['stats']);
-                        $tst['s4'] += $lvl['vinos'];
-                        $tst['s7'] += $lvl['duh'];
-                        $this->info['stats'] = $this->impStats($tst);
-
-                        $this->info['level'] = $lvl['nextLevel'];
-                        $this->stats['levels'] = $lvln;
-                        $this->info['ability'] += $lvl['ability'];
-                        $this->info['skills'] += $lvl['skills'];
-                        $this->info['sskills'] += $lvl['sskills'];
-                        $this->info['nskills'] += $lvl['nskills'];
-                        if ($this->info['twink'] == 0) {
-                            $this->info['money'] = $lvl['money'] + $this->info['money'];
-                            $this->info['money2'] = $lvl['money2'] + $this->info['money2'];
-                            //}
-                        }
-                        $lvl = $lvln;
-                        $lvln = mysql_fetch_array(mysql_query('SELECT `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'));
-                        $this->info['upLevel'] += 1;
-                        $rt++;
-                    } else {
-                        $i = 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'], '', '', '<strong>' . $this->info['login'] . '</strong> ������' . $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'] = 0;
-                    } else {
-                        $this->info['stopexp'] = 0;
-                    }
-                    $upd = mysql_query('UPDATE `users_twink` SET `stopexp` = "' . $this->info['stopexp'] . '" WHERE `uid` = "' . $this->info['id'] . '" LIMIT 1');
-                    if ($upd) {
-                        mysql_query('UPDATE `stats` SET `ability` = "' . $this->info['ability'] . '",`skills` = "' . $this->info['skills'] . '",`nskills` = "' . $this->info['nskills'] . '",`sskills` = "' . $this->info['sskills'] . '",`stats` = "' . $this->info['stats'] . '",`upLevel` = "' . $this->info['upLevel'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-                        $this->info['money'] = $this->r2($this->info['money']);
-                    }
-                    return 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 = [
-                    0 => 0,
-                    1 => 110,
-                    2 => 410,
-                    3 => 1300,
-                    4 => 2500,
-                    5 => 5000,
-                    6 => 12500,
-                    7 => 30000,
-                    8 => 100000,
-                    9 => 3000000,
-                    10 => 10000000,
-                    11 => 50000000,
-                    12 => 150000000
-                ];
-                $mx = [
-                    0 => 140,
-                    1 => 400,
-                    2 => 500,
-                    3 => 650,
-                    4 => 700,
-                    5 => 1400,
-                    6 => 3000,
-                    7 => 6000,
-                    8 => 10000,
-                    9 => 16000,
-                    10 => 24000,
-                    11 => 40000,
-                    12 => 60000
-                ];
-                $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'], '<strong>' . $a['name'] . '</strong> ������ ' . $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;
-                    }
-                    if ($iz > 1000) {
-                        $iz = -2;
-                    }
-                    $iz++;
-                }
-            }
-        }
-        /*------------*/
-    }
-
-    public function r2($v)
-    {
-        $v = number_format($v, 2, '.', ' ');
-        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']) {
-            $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;
-            $st = isset($this->stats['hpAll']) ? $this->stats : $this->getStats($uid, $i1);
-        }
-
-        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)
-    {
-        $item_ = mysql_fetch_array(mysql_query('SELECT `iu`.*, `im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` = "' . $user['id'] . '" AND `iu`.`delete` = 0 AND `iu`.`inOdet` = 0 AND `iu`.`inShop` = 0 AND `im`.`inslot` > 0 AND `iu`.`gift` = "" AND `iu`.`data` NOT LIKE "%frompisher=%" AND `iu`.`id` = "' . $id . '" LIMIT 1'));
-        $res = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $cl . '" LIMIT 1'));
-        if (isset($item_['id'])) {
-            $po = $this->lookStats($item_['data']);
-            if (isset($po['toclan'])) {
-                $po['toclan1'] = explode('#', $po['toclan']);
-                $po['toclan1'] = $po['toclan1'][0];
-            }
-            if (isset($po['sudba']) && $po['sudba'] != '0') {
-                $r = '<font color="#FF0000"><strong>������� ������ � ���� �������</strong></font><br>';
-            } elseif (isset($po['toclan']) && $po['toclan1'] != $user['clan']) {
-                $r = '<font color="#FF0000"><strong>������� � ��� ����������� �����...</strong></font><br>';
-            } elseif ($user['inTurnir'] > 0 || $user['inTurnirnew'] > 0) {
-                $r = '<font color="#FF0000"><strong>�� ����� ������� � ������� ��������� ������������ �������� ���������.</strong></font><br>';
-            } else {
-                if ((isset($po['sudba']) && $po['sudba'] != '0') || isset($po['icos']) || isset($po['frompisher']) || isset($po['fromlaba']) || ($item_['gift'] != '' && $item_['gift'] != 0)) {
-                    $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 = '<font color="#FF0000"><strong>�� ������� ������������ ������� &quot;' . $item_['name'] . '&quot; �����</strong></font><br />';
-                        $col = $this->itemsX(((int)$id));
-                        $this->addDelo(2, $user['id'], '&quot;<font color="green">System.transfer.MONEY</font>&quot;: ������� &quot;' . $item_['name'] . '&quot; (#id : "' . $id . '") (x' . $col . ') ��� ����������� ����� &quot;' . $res['name'] . '&quot; (' . $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 = '<font color="#FF0000"><strong>�� �������...</strong></font><br>';
-                    }
-                } 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 = '<font color="#FF0000"><strong>�� ������� ������� ������� &quot;' . $item_['name'] . '&quot; � ��������� �����</strong></font><br />';
-                    } else {
-                        $r = '<font color="#FF0000"><strong>�� �������...</strong></font><br>';
-                    }
-                }
-            }
-        } else {
-            $r = '<font color="#FF0000"><strong>������� �� ������.</strong></font><br>';
-        }
-        return $r;
-    }
-
-
-    public function ungive_itm_cl($id, $user, $cl)
-    {
-        $itm_ = mysql_fetch_array(mysql_query('SELECT `iu`.*, `im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` >= 0 AND `iu`.`delete` = 0 AND `iu`.`id` = "' . $id . '" 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 = '<font color="#FF0000"><strong>�� �� ������ ������ ������ �������, �� �� ����������� �����</strong></font><br />';
-        } elseif (isset($itm_['id'])) {
-            if ($user['inTurnir'] == 0 && $user['inTurnirnew'] == 0) {
-                if ($itm_['inOdet'] != 0) {
-                    $o = ', `inOdet` = 0';
-                } else {
-                    $o = '';
-                }
-                $r = '<font color="#FF0000"><strong>�� ������� ������ ������� &quot;' . $itm_['name'] . '&quot;</strong></font><br />';
-                $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('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "-21' . $res['id'] . '" ' . $o . ' WHERE `id` = "' . $id . '" LIMIT 1');
-            } else {
-                $r = '<font color="#FF0000"><strong>�� ����� ������� � ������� ��������� ������������ �������� ���������.</strong></font><br />';
-            }
-        } else {
-            $r = '<font color="#FF0000"><strong>������� �� ������.</strong></font><br />';
-        }
-        return $r;
-    }
-
-    public function take_itm_cl($id, $user, $cl)
-    {
-        $itm_ = mysql_fetch_array(mysql_query('SELECT `iu`.*, `im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` = "-21' . $user['clan'] . '" AND `iu`.`delete` = 0 AND `iu`.`id` = "' . $id . '" LIMIT 1'));
-        $res = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $cl . '" LIMIT 1'));
-        if (isset($itm_['id'])) {
-            $po = $this->lookStats($itm_['data']);
-            if (isset($po['toclan'])) {
-                $cls = explode('#', $po['toclan']);
-                $cls = $cls[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('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "' . $user['id'] . '" WHERE `id` = "' . $id . '" LIMIT 1');
-                $r = '<font color="#FF0000"><strong>�� ������� ����� ������� &quot;' . $itm_['name'] . '&quot; �� ���������</strong></font><br />';
-            } else {
-                $r = '<font color="#FF0000"><strong>�� ����� ������� � ������� ��������� ������������ �������� ���������.</strong></font><br />';
-            }
-        } else {
-            $r = '<font color="#FF0000"><strong>������� �� ������.</strong></font><br />' . $id;
-        }
-        return $r;
-    }
-
-    public function rem_itm_cl($user, $cl, $type)
-    {
-        $itms = mysql_query('SELECT * FROM `items_users` WHERE (`uid` = "-21' . $user['clan'] . '" OR `data` LIKE "%toclan=' . $user['clan'] . '#%")');
-        while ($pl = mysql_fetch_array($itms)) {
-            $po = $this->lookStats($pl['data']);
-            if (isset($po['toclan'])) {
-                $cls = explode('#', $po['toclan']);
-                $cls = $cls[1];
-            }
-            if ($cls == $user['id']) {
-                if ($pl['uid'] != $user['id']) {
-                    if ($pl['inOdet'] != 0) {
-                        mysql_query('UPDATE `items_users` SET `inOdet` = 0 WHERE `id` = "' . $pl['id'] . '"');
-                    }
-                }
-                unset($po['toclan']);
-                $pl['data'] = $this->impStats($po);
-                $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'] . '")');
-            } 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'] . '")');
-            }
-        }
-    }
-
-    public function roomInfo($id, $short = false)
-    {
-        $select = $short ? ' `id`, `name`, `code`, `city`, `timeGO`, `level`,`roomGo` ' : ' * ';
-        $roomInfo = mysql_fetch_array(mysql_query('SELECT ' . $select . ' FROM `room` WHERE `id` = "' . $id . '" LIMIT 1'));
-        if ($roomInfo['roomGo']) $roomInfo['roomGo'] = explode(',', $roomInfo['roomGo']);
-        if ($roomInfo['level']) $roomInfo['level'] = explode('-', $roomInfo['level']);
-        return $roomInfo;
-    }
-
-    public function showAbils()
-    {
-        $r = '';
-        $sp = mysql_fetch_array(mysql_query('SELECT * FROM `abils_user` WHERE `uid` = "' . $this->info['id'] . '" LIMIT 1'));
-        if (isset($sp['id'])) {
-            $r .= '';
-        } else {
-            mysql_query('INSERT INTO `abils_user` (`uid`) VALUES ("' . $this->info['id'] . '")');
-        }
-        return $r;
-    }
-
-}
-
-$u = user::start();
diff --git a/_incl_data/class/__zv.php b/_incl_data/class/__zv.php
deleted file mode 100644
index ca34e581..00000000
--- a/_incl_data/class/__zv.php
+++ /dev/null
@@ -1,3274 +0,0 @@
-<?
-if (!defined('GAME')) {
-    die();
-}
-
-class Balancer
-{
-    public static function balance($items, $key)
-    {
-        $result = [];
-
-        $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);
-            }
-        }
-
-        $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;
-        }
-
-        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 = '���-�� ����� ��� ��� ��������� � ������ ������.';
-            }
-        } else {
-            $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;
-    }
-
-    public function test()
-    {
-        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');
-            }
-        }
-
-        //��������� ������� � ���� ������
-        $sp = mysql_query('SELECT * FROM `turnirs` WHERE `status` != "-1"');
-        while ($pl = mysql_fetch_array($sp)) {
-
-            //������ �������
-            if ($pl['status'] == 0 && $pl['time'] > time()) {
-                if (floor(($pl['time'] - time()) / 60) <= 2 && $pl['chat'] > 0) {
-                    mysql_query('UPDATE `turnirs` SET `chat` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
-                } elseif (floor(($pl['time'] - time()) / 60) <= 5 && $pl['chat'] > 1) {
-                    //�������� 5 ���.
-                    $r = '<font color=red><b>�������:</b> �� ������ ������� �������� 5 �����.</font> ';
-                    mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','','','','" . $r . "','" . time() . "','6','0')");
-                    mysql_query('UPDATE `turnirs` SET `chat` = "1" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
-                } elseif (floor(($pl['time'] - time()) / 60) <= 10 && $pl['chat'] > 2) {
-                    //�������� 10 ���.
-                    $r = '<font color=red><b>�������:</b> �� ������ ������� �������� 10 �����.</font> ';
-                    mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','','','','" . $r . "','" . time() . "','6','0')");
-                    mysql_query('UPDATE `turnirs` SET `chat` = "2" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
-                } elseif (floor(($pl['time'] - time()) / 60) <= 15 && $pl['chat'] > 3) {
-                    //�������� 15 ���.
-                    $r = '<font color=red><b>�������:</b> �� ������ ������� �������� 15 �����.</font> ';
-                    mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','','','','" . $r . "','" . time() . "','6','0')");
-                    mysql_query('UPDATE `turnirs` SET `chat` = "3" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
-                }
-            }
-            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'] . '"');
-                }
-            }
-        }
-
-        //��������� ��������� � ��������� ��� � ���� ������
-        $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');
-        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 = [];
-            $tm2 = [];
-            $i = [];
-            $toChat = '';
-            $toChat2 = '';
-            $toWhere = '';
-            while ($t = mysql_fetch_array($uz)) {
-                if (!isset(${'tm' . $t['team']})) {
-                    ${'tm' . $t['team']} = [];
-                }
-                if (!isset($i[$t['team']])) {
-                    $i[$t['team']] = 0;
-                }
-                ${'tm' . $t['team']}[$i[$t['team']]] = $t;
-                $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) . ', ';
-                }
-                $i[$t['team']]++;
-            }
-
-            if ($pl['razdel'] == 5) {
-                $col_p = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $pl['id'] . '"'));
-                $cols = $col_p[0];
-                if ($cols >= $pl['maxplayers']) {
-                    $pl['time_start'] = time() - $pl['time'] - 1;
-                }
-            }
-
-            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]) || (!isset($i[3]) && $pl['teams'] == 3)) {
-                        //������ �� �������
-                        $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 && ($i[0] < 2 || $pl['fastfight'] == 0)) {
-                        //������ �� �������
-                        $this->cancelGroup($pl, $toChat);
-                    } else {
-                        //�������� ��������
-                        $this->startBattle($pl['id'], $toChat . '|-|' . $toWhere);
-                    }
-                }
-            }
-        }
-    }
-
-    public function testCronZv()
-    {
-        global $code, $c, $u;
-
-        $back_test = false;
-
-        //��������� ������� � ���� ������
-        $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'] . '"');
-                }
-            }
-
-        }
-
-        //��������� ��������� � ��������� ��� � ���� ������
-        $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)) {
-            $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 = [];
-            $tm2 = [];
-            $i = [];
-            $toChat = '';
-            $toWhere = '';
-            while ($t = mysql_fetch_array($uz)) {
-                if (!isset(${'tm' . $t['team']})) {
-                    ${'tm' . $t['team']} = [];
-                }
-                if (!isset($i[$t['team']])) {
-                    $i[$t['team']] = 0;
-                }
-                ${'tm' . $t['team']}[$i[$t['team']]] = $t;
-                $toChat .= '' . $t['login'] . ',';
-                $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);
-                    }
-                } 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;
-                        }
-
-                        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;
-                            }
-                        }
-                    } else {
-                        //�������� ��������
-                        $this->startBattle($pl['id'], $toChat . '|-|' . $toWhere);
-                    }
-                }
-            }
-        }
-
-        if ($back_test) {
-            $this->testCronZv();
-        }
-
-    }
-
-    public function userInfo()
-    {
-        global $u, $c;
-        $r = '';
-        if ($u->stats['mpAll'] > 0) {
-            $pm = $u->stats['mpNow'] / $u->stats['mpAll'] * 100;
-        }
-        $ph = $u->stats['hpNow'] / $u->stats['hpAll'] * 100;
-        $dp = '';
-        if ($u->stats['mpAll'] <= 0) {
-            $dp = 'margin-top:13px;';
-        }
-        $r .= '<table border="0" cellspacing="0" cellpadding="0" height="20">
-<tr><td valign="middle"> &nbsp; <font>' . $u->microLogin($u->info['id'], 1) . '</font> &nbsp; </td>
-<td valign="middle" width="120">
-<div style="position:relative;' . $dp . '"><div id="vhp' . ($u->info['id']) . '" title="������� �����" align="left" class="seehp" style="position:absolute; top:-10px; width:120px; height:10px; z-index:12;"> ' . floor($u->stats['hpNow']) . '/' . $u->stats['hpAll'] . '</div>
-<div title="������� �����" class="hpborder" style="position:absolute; top:-10px; width:120px; height:9px; z-index:13;"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
-<div class="hp_3 senohp" style="height:9px; width:' . floor(120 / 100 * $ph) . 'px; position:absolute; top:-10px; z-index:11;" id="lhp' . ($u->info['id']) . '"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
-<div title="������� �����" class="hp_none" style="position:absolute; top:-10px; width:120px; height:10px; z-index:10;"><img src="https://img.new-combats.com/1x1.gif" height="10"></div>
-';
-
-        if ($u->stats['mpAll'] > 0) {
-            $r .= '<div id="vmp' . ($u->info['id']) . '" title="������� ����" align="left" class="seemp" style="position:absolute; top:0px; width:120px; height:10px; z-index:12;"> ' . floor($u->stats['mpNow']) . '/' . $u->stats['mpAll'] . '</div>
-<div title="������� ����" class="hpborder" style="position:absolute; top:0px; width:120px; height:9px; z-index:13;"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
-<div class="hp_mp senohp" style="height:9px; position:absolute; top:0px; width:' . floor(120 / 100 * $pm) . 'px; z-index:11;" id="lmp' . ($u->info['id']) . '"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
-<div title="������� ����" class="hp_none" style="position:absolute; top:0px; width:120px; height:10px; z-index:10;"></div>';
-        }
-        $r .= '</div></td></tr></table>';
-        unset($stt, $ph, $pm);
-        return $r;
-    }
-
-    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')");
-            }
-        }
-    }
-
-    public function add()
-    {
-        global $u, $c, $code;
-        if (isset($_GET['r']) && $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) {
-                    $az = 0;
-                    $this->error = '�� ��� ������� �� ��������� ;)';
-                }
-                if (($r == 4 || $r == 5) && $u->info['level'] < 2) {
-                    $az = 0;
-                    $this->error = '� ' . $this->z1n[$r] . ' ��� ������ �� ������� ������.';
-                }
-
-                if ($this->testTravm() == 1 && $_POST['k'] != 1) {
-                    $this->error = '�� ������������. � ������ �������� �������� �������� ���.';
-                    $az = 0;
-                } elseif ($this->testTravm() == 2) {
-                    $this->error = '�� ������������. � ������ �������� ���������� ���������.';
-                    $az = 0;
-                } elseif ($u->info['hpNow'] < $u->stats['hpAll'] / 100 * 30 && ($r >= 1 || $r <= 3)) {
-                    $this->error = '�� ��� ������� ��������� ����� ������ ����� ���';
-                    $az = 0;
-                }
-                if ($u->info['zv'] > 0) {
-                    $az = 0;
-                    $this->error = '�� ��� �������� � ������.';
-                }
-                if ($az == 1) {
-                    $nz = [];
-                    $nz['city'] = $u->info['city'];
-                    $nz['creator'] = $u->info['id'];
-                    $nz['type'] = 0;
-                    if ($_POST['k'] == 1) {
-                        $nz['type'] = 1;
-                    }
-                    if ($_POST['k'] == 2) {
-                        $nz['type'] = 6;
-                        $nz['travmaChance'] = 100;
-                    }
-                    $_POST['timeout'] = round(intval(mysql_real_escape_string($_POST['timeout'])));
-                    if ($_POST['timeout'] == 1 || $_POST['timeout'] == 2 || $_POST['timeout'] == 3 || $_POST['timeout'] == 4 || $_POST['timeout'] == 5) {
-                        $nz['timeout'] = $_POST['timeout'] * 60;
-                    } else {
-                        $nz['timeout'] = 3 * 60;
-                    }
-
-                    $nz['razdel'] = $r;
-                    $nz['time_start'] = 0;
-                    $nz['min_lvl_1'] = 0;
-                    $nz['min_lvl_2'] = 0;
-                    $nz['max_lvl_1'] = 21;
-                    $nz['max_lvl_2'] = 21;
-                    $nz['tm1max'] = 0;
-                    $nz['tm2max'] = 0;
-                    $nz['invise'] = 0;
-                    $nz['money'] = 0;
-                    $nz['comment'] = '';
-                    $nz['tm1'] = 0;
-                    $nz['tm2'] = 0;
-                    $nz['otmorozok'] = 0;
-                    $gad = 1;
-
-                    if ($r == 5 && $u->info['level'] > 1) {
-                        //��������� ���
-                        if ($_POST['startime2']) {
-                            $nz['time_start'] = (int)$_POST['startime2'];
-                            $nz['comment'] = substr($_POST['cmt'], 0, 40);
-                            $nz['comment'] = str_replace('"', '&quot;', $nz['comment']);
-                            $nz['comment'] = htmlspecialchars($nz['comment'], null, 'cp1251');
-                            if ($nz['time_start'] != 180 && $nz['time_start'] != 300 && $nz['time_start'] != 600 && $nz['time_start'] != 900 && $nz['time_start'] != 1200 && $nz['time_start'] != 1800) {
-                                $nz['time_start'] = 600;
-                            }
-
-                            if (isset($_POST['mut_hidden'])) {
-                                $nz['invise'] = 1;
-                            }
-                            if (isset($_POST['noinc'])) {
-                                $nz['noinc'] = 1;
-                            }
-                            if (isset($_POST['fastfight'])) {
-                                $nz['fastfight'] = 1;
-                            }
-                            if (isset($_POST['otmorozok'])) {
-                                $nz['otmorozok'] = 1;
-                            }
-                            if (isset($_POST['nobot'])) {
-                                $nz['nobot'] = 1;
-                            }
-                            if (isset($_POST['kingfight'])) {
-                                $nz['kingfight'] = 1;
-                            }
-                            if (isset($_POST['arand'])) {
-                                $nz['arand'] = 1;
-                            }
-                            if (isset($_POST['travma'])) {
-                                $nz['travmaChance'] = 100;
-                            }
-                            if (isset($_POST['noatack'])) {
-                                $nz['noatack'] = 1;
-                            }
-                            if (isset($_POST['noeff'])) {
-                                $nz['noeff'] = 1;
-                            }
-                            if (isset($_POST['smert'])) {
-                                $nz['smert'] = 1;
-                            }
-                            if (isset($_POST['noart'])) {
-                                $nz['noart'] = 1;
-                            }
-                            if ($nz['kingfight'] == 1 && $nz['fastfight'] == 1) {
-                                $nz['kingfight'] = 0;
-                            }
-
-                            $nz['timeout'] = (int)$_POST['timeout'];
-                            if ($nz['timeout'] != 1 && $nz['timeout'] != 2 && $nz['timeout'] != 3 && $nz['timeout'] != 4 && $nz['timeout'] != 5) {
-                                $nz['timeout'] = 3;
-                            }
-
-                            //���������� ������ ��������
-                            $lvl = (int)$_POST['levellogin1'];
-                            if ($lvl == 0) {
-                                $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_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;
-                            } else {
-                                $nz['min_lvl_1'] = 2;
-                                $nz['max_lvl_1'] = 2;
-                            }
-
-                            if ((int)$_POST['k'] == 1) {
-                                //�������� ���
-                                $nz['type'] = 1;
-                            }
-                            if ((int)$_POST['k'] == 2) {
-                                //�������� ���
-                                $nz['type'] = 6;
-                                $nz['travmaChance'] = 1;
-                            }
-                            $nz['timeout'] = $nz['timeout'] * 60;
-                            $nz['tm1'] = $u->stats['reting'];
-
-                            if (!$u->info['no_zv_key'] && ($_POST['code21'] == 0 || $_POST['code21'] != $_SESSION['code2'] || $_SESSION['code2'] == 0 || !isset($_SESSION['code2']))) {
-                                $this->error = '������������ ��� �������������';
-                                $gad = 0;
-                            }
-                        } else {
-                            $gad = 0;
-                            $this->error = '���-�� �� ���...<br>';
-                        }
-                    } elseif ($r == 4 && $u->info['level'] > 1) {
-                        //��������� ���
-                        //����� ������� � ��������� ������ �� ��������� ���
-                        if ($_POST['startime']) {
-                            $nz['time_start'] = (int)$_POST['startime'];
-                            $nz['comment'] = substr($_POST['cmt'], 0, 40);
-                            $nz['comment'] = str_replace('"', '&quot;', $nz['comment']);
-                            if ($nz['time_start'] != 300 && $nz['time_start'] != 600 && $nz['time_start'] != 900 && $nz['time_start'] != 1200 && $nz['time_start'] != 1800) {
-                                $nz['time_start'] = 600;
-                            }
-
-                            $nz['timeout'] = (int)$_POST['timeout'];
-                            if ($nz['timeout'] != 1 && $nz['timeout'] != 2 && $nz['timeout'] != 3 && $nz['timeout'] != 4 && $nz['timeout'] != 5) {
-                                $nz['timeout'] = 3;
-                            }
-
-                            $nz['timeout'] = $nz['timeout'] * 60;
-
-                            $nz['tm1max'] = (int)$_POST['nlogin1'];
-                            if ($nz['tm1max'] < 1 || $nz['tm1max'] > 99) {
-                                $this->error .= '�������� ���-�� ���������<br>';
-                                $gad = 0;
-                            }
-
-                            $nz['tm2max'] = (int)$_POST['nlogin2'];
-                            if ($nz['tm2max'] < 1 || $nz['tm2max'] > 99) {
-                                $this->error .= '�������� ���-�� �����������<br>';
-                                $gad = 0;
-                            }
-
-                            if ($this->testTravm() == 1 && $_POST['k'] != 1) {
-                                $this->error = '�� ������������. � ������ �������� �������� �������� ���.';
-                                $gad = 0;
-                            } elseif ($this->testTravm() == 2) {
-                                $this->error = '�� ������������. � ������ �������� ���������� ���������.';
-                                $gad = 0;
-                            } elseif ($nz['tm1max'] + $nz['tm2max'] < 3) {
-                                $this->error .= '������ 1 �� 1 �������� � ������� ���������� ��� ���������� ���<br>';
-                                $gad = 0;
-                            }
-
-                            //���������� ������ ��������
-                            $lvl = (int)$_POST['levellogin1'];
-                            if ($lvl == 0) {
-                                $nz['min_lvl_1'] = 2;
-                                $nz['max_lvl_1'] = 21;
-                            } elseif ($lvl == 1) {
-                                $nz['min_lvl_1'] = 2;
-                                $nz['max_lvl_1'] = $u->info['level'];
-                            } elseif ($lvl == 2) {
-                                $nz['min_lvl_1'] = 2;
-                                $nz['max_lvl_1'] = $u->info['level'] - 1;
-                            } elseif ($lvl == 3) {
-                                $nz['min_lvl_1'] = $u->info['level'];
-                                $nz['max_lvl_1'] = $u->info['level'];
-                            } elseif ($lvl == 4) {
-                                $nz['min_lvl_1'] = $u->info['level'];
-                                $nz['max_lvl_1'] = $u->info['level'] + 1;
-                            } elseif ($lvl == 5) {
-                                $nz['min_lvl_1'] = $u->info['level'] - 1;
-                                $nz['max_lvl_1'] = $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'] = 99;
-                            } else {
-                                $this->error = '���-�� �� ���...<br>';
-                                $gad = 0;
-                            }
-
-                            //���������� ������ ����������
-                            $lvl = (int)$_POST['levellogin2'];
-                            if ($lvl == 0) {
-                                $nz['min_lvl_2'] = 2;
-                                $nz['max_lvl_2'] = 21;
-                            } elseif ($lvl == 1) {
-                                $nz['min_lvl_2'] = 2;
-                                $nz['max_lvl_2'] = $u->info['level'];
-                            } elseif ($lvl == 2) {
-                                $nz['min_lvl_2'] = 2;
-                                $nz['max_lvl_2'] = $u->info['level'] - 1;
-                            } elseif ($lvl == 3) {
-                                $nz['min_lvl_2'] = $u->info['level'];
-                                $nz['max_lvl_2'] = $u->info['level'];
-                            } elseif ($lvl == 4) {
-                                $nz['min_lvl_2'] = $u->info['level'];
-                                $nz['max_lvl_2'] = $u->info['level'] + 1;
-                            } elseif ($lvl == 5) {
-                                $nz['min_lvl_2'] = $u->info['level'] - 1;
-                                $nz['max_lvl_2'] = $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'] = 99;
-                            } else {
-                                $this->error = '���-�� �� ���...<br>';
-                                $gad = 0;
-                            }
-
-                            if ($nz['min_lvl_1'] < 2) {
-                                $nz['min_lvl_1'] = 2;
-                            }
-                            if ($nz['max_lvl_1'] > 21) {
-                                $nz['max_lvl_1'] = 21;
-                            }
-                            if ($nz['min_lvl_2'] < 2) {
-                                $nz['min_lvl_2'] = 2;
-                            }
-                            if ($nz['max_lvl_2'] > 21) {
-                                $nz['max_lvl_2'] = 21;
-                            }
-
-                            if ((int)$_POST['k'] == 1) {
-                                //�������� ���
-                                $nz['type'] = 1;
-                            }
-                            if ((int)$_POST['k'] == 2) {
-                                //�������� ���
-                                $nz['type'] = 6;
-                                $nz['travmaChance'] = 100;
-                            }
-
-                        } else {
-                            $gad = 0;
-                            $this->error = '���-�� �� ���...<br>';
-                        }
-                    }
-
-                    $bt2 = (int)$_POST['bots2'];
-                    if ($bt2 != 0 && $r == 4 && $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'];
-                    } else {
-                        $bt2 = 0;
-                    }
-
-                    if ($gad == 1) {
-                        if (!isset($nz['withUser'])) {
-                            $nz['withUser'] = '';
-                        }
-                        $nz['time_create_zv'] = time();
-                        if ($nz['razdel'] == 4 || $nz['razdel'] == 5) {
-                            //��������� ����� ��� �����
-                            $nz['time_create_zv'] = strtotime(date('d.m.Y H:i', $nz['time_create_zv']) . ':00', $nz['time_create_zv']);
-                        } elseif ($nz['razdel'] == 3) {
-                            $nz['noinc'] = 1;
-                        }
-                        $nz['teams'] = 2;
-                        $nz['align1'] = 0;
-                        $nz['align2'] = 0;
-                        $nz['align3'] = 0;
-                        if (isset($_POST['3align'])) {
-                            $nz['teams'] = 3;
-                            $nz['min_lvl_1'] = 2;
-                            $nz['min_lvl_2'] = 2;
-                            $nz['max_lvl_1'] = 21;
-                            $nz['max_lvl_2'] = 21;
-                            //
-                            if (floor($u->info['align']) == 3) {
-                                $nz['align1'] = 3;
-                                $nz['align2'] = 1;
-                                $nz['align3'] = 7;
-                            } elseif (floor($u->info['align']) == 7) {
-                                $nz['align1'] = 7;
-                                $nz['align2'] = 1;
-                                $nz['align3'] = 3;
-                            } else {
-                                $nz['align1'] = 1;
-                                $nz['align2'] = 3;
-                                $nz['align3'] = 7;
-                            }
-                            //
-                        }
-                        //
-                        if ($nz['razdel'] == 2 && isset($_POST['commentfiz'])) {
-                            $nz['comment'] = htmlspecialchars($_POST['commentfiz'], null, 'cp1251');
-                        }
-                        //
-                        if ($nz['razdel'] == 5) {
-                            $nz['maxplayers'] = [
-                                6 => 6,
-                                8 => 8,
-                                10 => 10,
-                                12 => 12,
-                                14 => 14,
-                                16 => 16,
-                                18 => 18,
-                                20 => 20,
-                                40 => 40
-                            ];
-                            if (isset($nz['players'][$_POST['players']])) {
-                                $nz['maxplayers'];
-                            } else {
-                                $nz['maxplayers'] = $nz['maxplayers'][$_POST['players']];
-                            }
-                        }
-                        //
-                        $ins = mysql_query('INSERT INTO `zayvki` (`maxplayers`,`otmorozok`,`align1`,`align2`,`align3`,`teams`,`smert`,`noart`,`noeff`,`noatack`,`arand`,`kingfight`,`nobot`,`fastfight`,`noinc`,`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 (
-																"' . $nz['maxplayers'] . '",
-																"' . $nz['otmorozok'] . '",
-																"' . $nz['align1'] . '",
-																"' . $nz['align2'] . '",
-																"' . $nz['align3'] . '",																
-																"' . $nz['teams'] . '",
-																"' . $nz['smert'] . '",
-																"' . $nz['noart'] . '",
-																"' . $nz['noeff'] . '",
-																"' . $nz['noatack'] . '",
-																"' . $nz['arand'] . '",
-																"' . $nz['kingfight'] . '",
-																"' . $nz['nobot'] . '",
-																"' . $nz['fastfight'] . '",
-																"' . $nz['noinc'] . '",
-																"0",
-																"' . ((int)$bt2) . '",
-																"' . $nz['time_create_zv'] . '",
-																"' . $nz['city'] . '",
-																"' . $nz['creator'] . '",
-																"' . $nz['type'] . '",
-																"' . $nz['time_start'] . '",
-																"' . mysql_real_escape_string($nz['timeout']) . '",
-																"' . mysql_real_escape_string($nz['min_lvl_1']) . '",
-																"' . mysql_real_escape_string($nz['min_lvl_2']) . '",															
-																"' . mysql_real_escape_string($nz['max_lvl_1']) . '",
-																"' . mysql_real_escape_string($nz['max_lvl_2']) . '",
-																"' . mysql_real_escape_string($nz['tm1max']) . '",
-																"' . mysql_real_escape_string($nz['tm2max']) . '",
-																"' . $nz['travmaChance'] . '",
-																"' . $nz['invise'] . '",
-																"' . $nz['razdel'] . '",
-																"' . mysql_real_escape_string($nz['comment']) . '",
-																"' . mysql_real_escape_string($nz['money']) . '",
-																"' . $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;
-                            $this->error = '������ �� ��� ������';
-                        } else {
-                            $this->error = '�� �� ������ ������ ������...' . $ins;
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    //������������� ���
-    public function addBot()
-    {
-        global $u, $c, $code;
-
-        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);
-        } else {
-            $bot = false;
-        }
-        if (!$bot) {
-            $this->error = '��� � ���������, �������, ������� � ������� ����������� ���������� ������ ��� ���������� ������ 8 ������...<br>�� ������� ������������ ����� ����, ��� ���� ���-�� �� �����������...<br>';
-        } elseif ($u->info['hpNow'] < $u->stats['hpAll'] / 100 * 30 && ($r == 1)) {
-            $this->error = '�� ��� ������� ��������� ����� ������ ����� ���';
-            $az = 0;
-        } elseif ($u->info['align'] == 2) {
-            $this->error = '�������� �� ����� ��������� �����';
-            $az = 0;
-        } elseif (!$bot) {
-            echo '<br><font color=red>Cannot start battle (no prototype "ND0Clone")</font><br>';
-        } else {
-            //������� �������� � �����
-            $expB = 0;
-            $btl = ['smert' => 0, 'noart' => 0, 'noeff' => 0, 'otmorozok' => 0, 'noatack' => 0, 'priz' => 0, 'arand' => 0, 'kingfight' => 0, 'nobot' => 0, 'fastfight' => 0, 'players' => '', 'timeout' => 60, 'type' => 0, 'invis' => 0, 'noinc' => 0, 'travmChance' => 0, 'typeBattle' => 0, 'addExp' => $expB, 'money' => 0, 'money3' => 0];
-            $ins = mysql_query('INSERT INTO `battle` (`otmorozok`,`smert`,`noart`,`noeff`,`noatack`,`arand`,`kingfight`,`nobot`,`fastfight`,`clone`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`,`priz`) VALUES (
-												"' . $btl['otmorozok'] . '",
-												"' . $btl['smert'] . '",
-												"' . $btl['noart'] . '",
-												"' . $btl['noeff'] . '",
-												"' . $btl['noatack'] . '",
-												"' . $btl['arand'] . '",
-												"' . $btl['kingfight'] . '",
-												"' . $btl['nobot'] . '",
-												"' . $btl['fastfight'] . '",												
-												"1",
-												"' . $u->info['city'] . '",
-												"' . time() . '",
-												"' . $btl['players'] . '",
-												"' . $btl['timeout'] . '",
-												"' . $btl['type'] . '",
-												"' . $btl['invis'] . '",
-												"' . $btl['noinc'] . '",
-												"' . $btl['travmChance'] . '",
-												"' . $btl['typeBattle'] . '",
-												"' . $btl['addExp'] . '",
-												"' . $btl['money'] . '",
-												"' . $btl['priz'] . '")');
-            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');
-                //��������� ������, ��� ��� �������
-                $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')");
-                die('<script>location="main.php?battle_id=' . $btl_id . '";</script>');
-            } else {
-                $this->error = 'Cannot start battle (no prototype "ABD0Clone")';
-            }
-        }
-    }
-
-    //������������� ���
-    public function addBotClone($uid)
-    {
-        global $u, $c, $code;
-
-        if ($u->info['online'] > 0) {
-            $bot = $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)) {
-            $this->error = '�� ��� ������� ��������� ����� ������ ����� ���';
-            $az = 0;
-        } elseif ($u->info['align'] == 2) {
-            $this->error = '�������� �� ����� ��������� �����';
-            $az = 0;
-        } elseif (!$bot) {
-            echo '<br><font color=red>Cannot start battle (no prototype "ND0Clone")</font><br>';
-        } else {
-            //������� �������� � �����
-            $expB = 0;
-            $btl = ['priz' => 0, 'smert' => 0, 'noart' => 0, 'noeff' => 0, 'noatack' => 0, 'arand' => 0, 'kingfight' => 0, 'nobot' => 0, 'fastfight' => 0, 'players' => '', 'timeout' => 60, 'type' => 0, 'invis' => 0, 'noinc' => 0, 'travmChance' => 0, 'typeBattle' => 0, 'addExp' => $expB, 'money' => 0, 'money3' => 0];
-            $ins = mysql_query('INSERT INTO `battle` (`otmorozok`,`priz`,`smert`,`noart`,`noeff`,`noatack`,`arand`,`kingfight`,`nobot`,`fastfight`,`clone`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES (
-												"' . $btl['otmorozok'] . '",
-												"' . $btl['priz'] . '",
-												"' . $btl['smert'] . '",
-												"' . $btl['noart'] . '",
-												"' . $btl['noeff'] . '",
-												"' . $btl['noatack'] . '",
-												"' . $btl['arand'] . '",
-												"' . $btl['kingfight'] . '",
-												"' . $btl['nobot'] . '",
-												"' . $btl['fastfight'] . '",												
-												"1",
-												"' . $u->info['city'] . '",
-												"' . time() . '",
-												"' . $btl['players'] . '",
-												"' . $btl['timeout'] . '",
-												"564",
-												"' . $btl['invis'] . '",
-												"' . $btl['noinc'] . '",
-												"' . $btl['travmChance'] . '",
-												"' . $btl['typeBattle'] . '",
-												"' . $btl['addExp'] . '",
-												"' . $btl['money'] . '")');
-            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 `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` = "' . $bot . '" AND `inOdet`!=0');
-                }
-
-                //��������� ������, ��� ��� �������
-                $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')");
-                die('<script>location="main.php?battle_id=' . $btl_id . '";</script>');
-            } else {
-                $this->error = 'Cannot start battle (no prototype "ABD0Clone")';
-            }
-        }
-    }
-
-    //������
-    public function startIzlom($id2, $lvl)
-    {
-        global $u, $c, $code;
-        $lvl = (int)$lvl;
-
-        if ($lvl == 8) {
-            /*
-				�������� �������
-				��������� �����������
-				����
-				�������� �������
-				*/
-            $bots = ['��������', '��������� ������', '��������� ������', '��������� ������', '������� ����', '���������� ����', '������ ����'];
-        }
-
-        $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'));
-        $logins_bot = [];
-        $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null);
-
-        if (isset($id['id']) && $bot) {
-            $logins_bot = $bot['logins_bot'];
-            //������� �������� � �����
-            $expB = -$bot['expB'];
-            $btl = ['priz' => '', 'players' => '', 'otmorozok' => 0, 'timeout' => 60, 'type' => 9, 'invis' => 0, 'noinc' => 0, 'travmChance' => 0, 'typeBattle' => 0, 'addExp' => $expB, 'money' => 0, 'izlom' => (int)$id2, 'izlomLvl' => (int)$lvl];
-            $ins = mysql_query('INSERT INTO `battle` (`otmorozok`,`priz`,`smert`,`noart`,`noeff`,`noatack`,`arand`,`kingfight`,`nobot`,`fastfight`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`,`izlom`,`izlomLvl`) VALUES (
-													"' . $btl['otmorozok'] . '",
-													"' . $btl['priz'] . '",
-													"' . $btl['smert'] . '",
-													"' . $btl['noart'] . '",
-													"' . $btl['noeff'] . '",
-													"' . $btl['noatack'] . '",
-													"' . $btl['arand'] . '",
-													"' . $btl['kingfight'] . '",
-													"' . $btl['nobot'] . '",
-													"' . $btl['fastfight'] . '",
-													"' . $u->info['city'] . '",
-													"' . time() . '",
-													"' . $btl['players'] . '",
-													"' . $btl['timeout'] . '",
-													"' . $btl['type'] . '",
-													"' . $btl['invis'] . '",
-													"' . $btl['noinc'] . '",
-													"' . $btl['travmChance'] . '",
-													"' . $btl['typeBattle'] . '",
-													"' . $btl['addExp'] . '",
-													"' . $btl['money'] . '","' . $btl['izlom'] . '","' . $btl['izlomLvl'] . '")');
-            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');
-                mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
-
-                //��������� ������, ��� ��� �������
-                $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);
-                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);
-                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');
-                }
-
-                //���������� ��������� � ��� ���� ������
-                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')");
-                die('<script>location="main.php?battle_id=' . $btl_id . '";</script>');
-            } else {
-                $this->error = 'Cannot start battle (no prototype "ABD0' . $id['id'] . '")';
-            }
-        } else {
-            echo '<br><font color=red>Cannot start battle (no prototype "ND0IZ' . $lvl . '")</font><br>';
-        }
-    }
-
-    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);
-        }
-        mysql_query('START TRANSACTION');
-        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;");
-        $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 (isset($z['id'])) {
-            $vars = explode('|-|', $vars);
-            if ($z['razdel'] >= 4 && $z['razdel'] <= 5) {
-                //������ ���������� ��� ���������� ���
-                $btl_id = 0;
-                //$txtz = '';
-                if ($z['razdel'] == 5) {
-                    $sp = mysql_query('SELECT `s`.`id`,`s`.`team`,`s`.`upLevel`,`s`.`btl_cof`,`s`.`exp` FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `s`.`zv` = "' . $z['id'] . '" ORDER BY `s`.`btl_cof` DESC LIMIT 200');
-                    $tsr = rand(0, 100);
-                    if ($tsr >= 70 && $z['type'] != 33) {
-                        $ii = -1;
-                        while ($pl = mysql_fetch_array($sp)) {
-                            $ii++;
-                            $pld[$ii] = $pl;
-                        }
-                        $yy = $ii;
-                        $jj = $ii;//������� c �����
-                        $ii = 0;
-                        $teamA = 0;
-                        $teamAbtlconf = 0;
-                        $teamB = 0;
-                        $teamBbtlconf = 0;
-                        while ($yy > -1) {
-                            if ($ii == 0 || $teamAbtlconf <= $teamBbtlconf) {
-                                if (isset ($pld[$ii])) {
-                                    $teamnew = 1;
-                                    $teamAbtlconf = $teamAbtlconf + $pld[$ii]['btl_cof'];
-                                    $teamA++;
-                                    $idi = $ii;
-                                    mysql_query('UPDATE `stats` SET `team` = "' . $teamnew . '" WHERE `id` = "' . $pld[$idi]['id'] . '" LIMIT 1');
-                                }
-                                $ii++;
-                            } elseif (($teamB - $teamA) <= 0) {
-                                if (isset ($pld[$ii])) {
-                                    $teamnew = 2;
-                                    $teamBbtlconf = $teamBbtlconf + $pld[$ii]['btl_cof'];
-                                    $teamB++;
-                                    $idi = $ii;
-                                    mysql_query('UPDATE `stats` SET `team` = "' . $teamnew . '" WHERE `id` = "' . $pld[$idi]['id'] . '" LIMIT 1');
-                                }
-                                $ii++;
-                            } else {
-                                if (isset ($pld[$ii])) {
-                                    $teamnew = 1;
-                                    $teamAbtlconf = $teamAbtlconf + $pld[$jj]['btl_cof'];
-                                    $teamA++;
-                                    $idi = $jj;
-                                    mysql_query('UPDATE `stats` SET `team` = "' . $teamnew . '" WHERE `id` = "' . $pld[$idi]['id'] . '" LIMIT 1');
-                                }
-                                $jj--;
-                            }
-                            $yy--;
-                        }
-                    } else {
-                        $balansteamA = 0;
-                        $balansteamB = 0;
-                        while ($pl = mysql_fetch_array($sp)) {
-                            $teamnew = rand(1, 2);
-                            if ($balansteamA != $balansteamB) {
-                                if ($balansteamA > $balansteamB) {
-                                    $teamnew = 2;
-                                } else {
-                                    $teamnew = 1;
-                                }
-                            }
-                            mysql_query('UPDATE `stats` SET `team` = "' . $teamnew . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
-                            if ($teamnew == 1) {
-                                $balansteamA += 1;
-                            } else {
-                                $balansteamB += 1;
-                            }
-                        }
-                    }
-                    unset($sp, $pl);
-                }
-                $btl = [
-                    'otmorozok' => $z['otmorozok'],
-                    'priz' => $z['priz'], 'smert' => $z['smert'], 'noart' => $z['noart'], 'noeff' => $z['noeff'], 'noatack' => $z['noatack'], 'arand' => $z['arand'], 'kingfight' => $z['kingfight'],
-                    'players' => '', 'timeout' => $z['timeout'], 'type' => $z['type'], 'travmChance' => $z['travmChance'], 'invis' => $z['invise'], 'noinc' => 0, 'typeBattle' => 0, 'addExp' => $z['exp'], 'money' => 0, 'money3' => 0];
-                //��� ����� ���
-                $ins = mysql_query('INSERT INTO `battle` (`otmorozok`,`priz`,`smert`,`noart`,`noeff`,`noatack`,`arand`,`kingfight`,`nobot`,`fastfight`,`razdel`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES (
-													"' . $z['otmorozok'] . '",
-													"' . $z['priz'] . '",
-													"' . $z['smert'] . '",
-													"' . $z['noart'] . '",
-													"' . $z['noeff'] . '",
-													"' . $z['noatack'] . '",
-													"' . $z['arand'] . '",
-													"' . $z['kingfight'] . '",
-													"' . $z['nobot'] . '",
-													"' . $z['fastfight'] . '",												
-													"' . $z['razdel'] . '",
-													"' . $z['city'] . '",
-													"' . time() . '",
-													"' . mysql_real_escape_string($btl['players']) . '",
-													"' . mysql_real_escape_string($btl['timeout']) . '",
-													"' . mysql_real_escape_string($btl['type']) . '",
-													"' . mysql_real_escape_string($btl['invis']) . '",
-													"' . mysql_real_escape_string($btl['noinc']) . '",
-													"' . mysql_real_escape_string($z['travmChance']) . '",
-													"' . mysql_real_escape_string($btl['typeBattle']) . '",
-													"' . mysql_real_escape_string($btl['addExp']) . '",
-													"' . mysql_real_escape_string($btl['money']) . '")');
-                $btl_id = mysql_insert_id();
-                if ($btl_id > 0) {
-
-                    //���� ��� ��������, �� ������� ����
-                    if ($z['type'] == 1) {
-                        $sp = mysql_query('SELECT `id` FROM `stats` WHERE `zv` = "' . $z['id'] . '"');
-                        while ($pl = mysql_fetch_array($sp)) {
-                            mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $pl['id'] . '" AND `inOdet`!=0');
-                        }
-                    } elseif ($z['type'] == 51) { //�������� ��� ��� �����
-                        $sp = mysql_query('SELECT `id` FROM `stats` WHERE `zv` = "' . $z['id'] . '"');
-                        while ($pl = mysql_fetch_array($sp)) {
-                            mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $pl['id'] . '" AND `2price` > 0');
-                        }
-                    }
-
-                    //��������� ������ � ��������
-                    $upd1 = mysql_query('UPDATE `stats` SET `zv`="0" WHERE `zv` = "' . $z['id'] . '"');
-                    $upd2 = mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE ' . $vars[1] . '');
-
-                    //��������� ������, ��� ��� �������
-                    $upd = mysql_query('UPDATE `zayvki` SET `start` = "' . time() . '",`btl_id` = "' . $btl_id . '" WHERE `id` = "' . $z['id'] . '" LIMIT 1');
-                    $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')");
-
-                }
-            } elseif ($z['razdel'] >= 1 && $z['razdel'] <= 3) {
-                //������ PvP
-                if ($u->info['team'] == 1 && $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);
-                            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');
-                                mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $zu['id'] . '" LIMIT 100');
-                                mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $zu['id'] . '" LIMIT 100');
-
-                                mysql_query('UPDATE `stats` SET `zv` = "' . $z['id'] . '",`team` = 2 WHERE `id` = "' . $bot . '" LIMIT 1');
-
-                                $zu = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `zv`="' . $z['id'] . '" AND `team` = "2" LIMIT 1'));
-                                $uz = mysql_fetch_array(mysql_query('SELECT `login`,`money` FROM `users` WHERE `id`="' . $zu['id'] . '" LIMIT 1'));
-                            }
-                        }
-
-                        //������� ��������
-                        $btl_id = 0;
-                        if ($uz['money'] < $z['money'] || $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];
-                        $ins = mysql_query('INSERT INTO `battle` (`otmorozok`,`smert`,`noart`,`noeff`,`noatack`,`arand`,`kingfight`,`nobot`,`fastfight`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES (
-															"' . mysql_real_escape_string($btl['otmorozok']) . '",
-															"' . mysql_real_escape_string($btl['smert']) . '",
-															"' . mysql_real_escape_string($btl['noart']) . '",
-															"' . mysql_real_escape_string($btl['noeff']) . '",
-															"' . mysql_real_escape_string($btl['noatack']) . '",
-															"' . mysql_real_escape_string($btl['arand']) . '",
-															"' . mysql_real_escape_string($btl['kingfight']) . '",
-															"' . mysql_real_escape_string($btl['nobot']) . '",
-															"' . mysql_real_escape_string($btl['fastfight']) . '",	
-															"' . $u->info['city'] . '",
-															"' . time() . '",
-															"' . mysql_real_escape_string($btl['players']) . '",
-															"' . mysql_real_escape_string($btl['timeout']) . '",
-															"' . mysql_real_escape_string($btl['type']) . '",
-															"' . mysql_real_escape_string($btl['invis']) . '",
-															"' . mysql_real_escape_string($btl['noinc']) . '",
-															"' . mysql_real_escape_string($btl['travmChance']) . '",
-															"' . mysql_real_escape_string($btl['typeBattle']) . '",
-															"' . mysql_real_escape_string($btl['addExp']) . '",
-															"' . mysql_real_escape_string($btl['money']) . '")');
-                        $btl_id = mysql_insert_id();
-                        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');
-
-                            //���� ��� ��������, �� ������� ����
-                            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` = "' . $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;
-
-                            //���������� ��������� � ��� ���� ������
-                            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')");
-                            die('<script>location="main.php?battle_id=' . $btl_id . '";</script>');
-                        } else {
-                            $this->error = '������ �������� �����.';
-                        }
-                    } else {
-                        $this->error = '�� �� ������ ������ ��������, ���� ������ ����� �� ������.';
-                    }
-                } else {
-                    $this->error = '�� �� ������ ������ ��������.';
-                }
-            }
-        }
-        mysql_query('UNLOCK TABLES');
-        mysql_query('COMMIT');
-    }
-
-    public function cancelzv()
-    {
-        global $u, $c, $code, $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) {
-                    //���������� �� ������ + ����� ��������� � ���
-                    $upd = mysql_query('UPDATE `stats` SET `zv` = "0",`team`="0" WHERE `id` = "' . $enemy['id'] . '" LIMIT 1');
-                    if ($upd) {
-                        mysql_query('UPDATE `users` SET `otk` = (`otk` + 1) WHERE `id` = "' . $zi['id'] . '" LIMIT 1');
-                        $this->error = '�� �������� ' . $enemy['login'] . ' � ��������';
-                        //���������� ��������� � ���
-                        $sa = '';
-                        if ($u->info['sex'] == 2) {
-                            $sa = '�';
-                        }
-                        $text = ' [login:' . $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) {
-                    //���������� �� ������ + ����� ��������� � ���
-                    $upd = mysql_query('UPDATE `stats` SET `zv` = "0",`team`="0" WHERE `id` = "' . $enemy['id'] . '" LIMIT 1');
-                    if ($upd) {
-                        $uz = mysql_fetch_array(mysql_query('SELECT `u`.`sex`,`u`.`login`,`u`.`city`,`u`.`room`,`u`.`id`,`st`.`zv`,`st`.`team` 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'])) {
-                            $this->error = '�� �������� ���� ������ �� ���.';
-                            //���������� ��������� � ���
-                            $sa = '';
-                            if ($u->info['sex'] == 2) {
-                                $sa = '�';
-                            }
-                            $text = ' [login:' . $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;
-                    }
-                }
-                if ($enemy['bot'] == 1) {
-                    //������� ���� , �������� � �������
-                    mysql_query('DELETE FROM `users` WHERE `id` = "' . $enemy['id'] . '" LIMIT 1');
-                    mysql_query('DELETE FROM `stats` WHERE `id` = "' . $enemy['id'] . '" LIMIT 1');
-                    mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $enemy['id'] . '" LIMIT 100');
-                    mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $enemy['id'] . '" LIMIT 100');
-                }
-            } else {
-                if ($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');
-                        $this->error = '�� �������� ���� ������';
-                        $zi = false;
-                        $u->info['zv'] = 0;
-                    }
-                }
-            }
-        }
-    }
-
-    public function see()
-    {
-        global $u, $c, $code, $zi, $cron;
-        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) {
-                    echo '<br><br><br><b><font color="black"><center>������ ������ ����� ������ � �������� ����������� �����</center></font></b>';
-                    $this->zv_see = 0;
-                } elseif ($r == 1 && $u->info['level'] > 0) {
-                    echo '<br><br><br><b><font color="black"><center>�� ��� ������� �� ��������� ;)</center></font></b>';
-                    $this->zv_see = 0;
-                } elseif ($r > 1 && $r < 6 && $u->info['level'] < 1) {
-                    echo '<br><br><br><b><font color="black"><center>�� ��� �� ������� �� ��������� ;)</center></font></b>';
-                    $this->zv_see = 0;
-                } elseif ($r > 3 && $r < 6 && $u->info['level'] < 2) {
-                    echo '<br><br><br><b><font color="black"><center>� ' . $this->z1n[$r] . ' ��� ������ �� ������� ������.</center></font></b>';
-                    $this->zv_see = 0;
-                } elseif ($r == 1 && $u->info['level'] > 0) {
-                    echo '<br><br><br><b><font color="black"><center>�� ��� ������� �� ��������� ;)</center></font></b>';
-                    $this->zv_see = 0;
-                } elseif ($r == 8 && $u->info['level'] < 1) {
-                    echo '<br><br><br><b><font color="black"><center>��������� ������� � ������� ������ � ������� ������.</center></font></b>';
-                    $this->zv_see = 0;
-                } elseif ($r == 10) {
-                    if (\Insallah\Tournament::IS_ENABLED) {
-                    /** ������� by Insallah*/
-                    # ������ �� F5
-                    if (!isset($_SESSION['bypass'])) {
-                        $_SESSION['bypass'] = mt_rand();
-                    }
-                    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']);
-                        }
-                    }
-                    ##
-                    # ��������� ������ ������ ��������.
-                    $db = new \Insallah\Db();
-                    $tournamentsList = $db::getRows('select * from tournaments');
-                    $tournaments = '<ul>';
-                    foreach ($tournamentsList as $tournament) {
-                        $time = $tournament['start_time'] === -1 ? '������ ��� �������!' : date('G:i', $tournament['start_time']);
-                        $tournament_members_id = \Insallah\TournamentModel::getFreeFighters($tournament['tid']);
-                        $members = [];
-                        foreach ($tournament_members_id as $member) {
-                            $members[] = \Insallah\TournamentModel::uidToLogin($member);
-                        }
-                        $tournaments .= sprintf("<li>������ ��� %d �������.<br>����� ������ ������: %s<br>���������: %s</li>",
-                            $tournament['tid'], $time, implode(', ', $members));
-                    }
-                    $tournaments .= '</ul>';
-                    ?>
-                    <div>
-                        <strong style="color: red;">��������!</strong>
-                        <ul>
-                            <li style="color: blue;">� ������ �������� ���� ������������� � �������, �������� ��� - <u>����������</u>!</li>
-                            <?php if(\Insallah\TournamentModel::isEkrOverpriced($u->info['id'])): ?>
-                            <li>��������� ���������, ������ �� ��� �� ������ ��������� <?= \Insallah\Tournament::ekrOverpriceFormula($u->info['level']) ?> ������������.</li>
-                            <?php endif; ?>
-                            <?php if($u->info['exp'] < \Insallah\Tournament::MIN_EXP): ?>
-                            <li>� ��� ������ ���� �� ����� <?= \Insallah\Tournament::MIN_EXP ?> �����.</li>
-                            <?php endif; ?>
-                            <li style="color: blue;">������ ��������, ����� � ������ �������� <?= \Insallah\Tournament::START_TOURNAMENT ?> �������.</li>
-							<li style="color: blue;">������ �������� 1, 2 � 3 ����� ������� 25, 15, 5 �������� ������, � ��� �� �������� �� ������� � ������� 12 �����, 6 � 3 ���� ��������������!</li>
-                        </ul>
-                    </div>
-                    <?php if(!empty($tournamentsList)): ?>
-                    <div>
-                        <strong>�������� �������.</strong><br>
-                        <?= $tournaments ?>
-                    </div>
-                    <?php endif; ?>
-                    <?php if (!\Insallah\TournamentModel::getTournamentIdByUserId($u->info['id']) || !\Insallah\TournamentModel::isStarted($u->info['level'])): ?>
-                        <form method="post">
-                            <input type="submit" name="tournament_start" value="������� ������� � �������">
-                            <input type="hidden" name="key" value="<?= $_SESSION['bypass'] ?>">
-                        </form>
-                    <?php else: ?>
-                        �� �����������.
-                    <?php endif; ?>
-                    <?php
-                    } else {
-                        ?>
-                        <div>
-                            <strong style="color: crimson;">� ������ ������ ������� �� ����������!</strong>
-                        </div>
-                        <?php
-                    }
-                    /** ����� �������� �� Insallah. */
-                } elseif ($u->info['zv'] > 0 && $u->info['battle'] == 0 && $r != 8) {
-                    if ($zi['razdel'] == 1 || $zi['razdel'] == 2 || $zi['razdel'] == 3) {
-                        echo '
-						<table width="100%" border="0" cellspacing="0" cellpadding="0">
-						  <tr>
-							<td valign="top">';
-
-                        if ($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'])) {
-                                //���� ����� �� ������
-                                echo '<div style="float:left;"><div style="float:left;">�� ��� ������ ������ �� ���  <INPUT class="btn btn-danger" onClick="location=\'main.php?zayvka=1&r=' . $_GET['r'] . '&rnd=' . $code . '&cancelzv\';" TYPE=submit name=close value="�������� ������"></div>';
-                            } else {
-                                //���� ���-�� ������
-                                $sa = '';
-                                if ($uz['sex'] == 2) {
-                                    $sa = '�';
-                                }
-                                echo '<script> zv_Priem = ' . (0 + $uz['id']) . ';</script><font color="red"><b>���� ������ ������' . $sa . ' ' . $ca . '</font></b> ' . $u->microLogin($uz['id'], 1) . '</a><font color="red"><b> ������ ����������� ���? </b></font><INPUT class="btn btn-success" onClick="location=\'main.php?zayvka=1&r=' . $_GET['r'] . '&rnd=' . $code . '&startBattle\';" TYPE=submit name=close value="�����������"> <INPUT class="btn btn-danger" onClick="location=\'main.php?zayvka=1&r=' . $_GET['r'] . '&rnd=' . $code . '&cancelzv\';" TYPE=submit name=close value="��������">';
-                            }
-                        } 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) . ' <INPUT class="btn" onClick="location=\'main.php?zayvka=1&r=' . $_GET['r'] . '&rnd=' . $code . '&cancelzv\';" TYPE=submit name=close value="�������� ������">';
-                            }
-                        }
-                        echo '</td><td align="right" valign="top"></td></tr></table></div>';
-                    } else {
-                        $tm_start = floor(($zi['time'] + $zi['time_start'] - time()) / 6) / 10;
-                        $tm_start = $this->rzv($tm_start);
-                        echo '<b>������� ������ ' . $this->z2n[$zi['razdel']] . ' ���</b>';
-                        echo '<br>��� ��� �������� ����� ' . $tm_start . ' ���.';
-                    }
-                } elseif ($r == 8) {
-                    //�������
-
-                    $ttur = [
-                        0 => '������ ����� �����!',
-                        1 => '������ ��� �� ����!',
-                        2 => '������ �����!'
-                    ];
-
-                    if (isset($_POST['trn1']) && $u->room['zvsee'] == 0) {
-                        if ($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 `turnirs` SET `users_in` = `users_in` + 1 WHERE `id` = "' . $totr['id'] . '" LIMIT 1');
-                                $u->info['inTurnirnew'] = $totr['id'];
-                                $this->error = '�� ���������� �� ������� � �������.';
-                            } else {
-                                $this->error = '������ �� ������ �� �������.';
-                            }
-                        } 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'));
-                            if (isset($totr['id'])) {
-                                mysql_query('UPDATE `users` SET `inTurnirnew` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
-                                mysql_query('UPDATE `turnirs` SET `users_in` = `users_in` - 1 LIMIT 1');
-                                $u->info['inTurnirnew'] = 0;
-                                $this->error = '�� ���������� �� ������ �� ������.';
-                            } else {
-                                $this->error = '������ ���������� �� ������ �������� � �������.';
-                            }
-                        } else {
-                            $this->error = '�� �� ���������� ������� �� � ����� �� ��������.';
-                        }
-                    }
-
-                    $dv = '';
-                    $trse = '';
-
-                    if ($u->info['inTurnirnew'] > 0) {
-                        $pl = mysql_fetch_array(mysql_query('SELECT * FROM `turnirs` WHERE `id` = "' . $u->info['inTurnirnew'] . '" LIMIT 1'));
-                        if (!isset($pl['id'])) {
-                            mysql_query('UPDATE `users` SET `inTurnirnew` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
-                            echo '���-�� �� ���... �������� ��������.';
-                        } else {
-                            $dv = '<b><u>��������� ������� [' . $pl['users_in'] . ']</u></b>:<br>';
-                            $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 .= '<div style="padding:3px;">' . $i . '. ' . $u->microLogin($plu, 2) . '</div>';
-                                $i++;
-                            }
-                            echo '
-							<script type="text/javascript">
-							function MM_jumpMenu(targ,selObj,restore){ //v3.0
-							  eval("location=\'"+selObj.options[selObj.selectedIndex].value+"\'");
-							  if (restore) selObj.selectedIndex=0;
-							}
-							</script>
-							<FORM style="margin:0px; padding:0px; border:0px;" METHOD=\'POST\' ACTION=\'main.php?zayvka=1&r=' . $r . '&rnd=' . $code . '\'>
-							<input type="hidden" name="add_new_zv" id="add_new_zv" value="' . floor(time() / 3) . '" />
-							<TABLE width=100% cellspacing=0 cellpadding=0>
-								  <TR>
-									<TD valign=top>
-										<font color="red"><b>' . $this->error . '</b></font>
-										<div style="border-bottom:#b2b2b2 solid 1px;padding:5px;">
-										������ ������� ����� ' . $u->timeOut($pl['time'] - time()) . ' <INPUT class="btn" onClick="location=\'main.php?zayvka&r=8&cancel13&tlvl=' . $pl['level'] . '&rnd=' . $code . '\';" TYPE=button name=tmp value="����������">
-										</div>
-										<div style="border-bottom:#b2b2b2 solid 1px;padding:5px;margin-bottom:5px;">
-										' . $dv . '
-										</div>
-										</TD>
-									<TD align=right valign=top>&nbsp;</TD>
-								  </TR>
-								</TABLE>
-								</FORM>';
-                        }
-                    } else {
-                        $tlvl = 4;
-                        $i = 4;
-                        $trnmz = [4 => '����������', 5 => '����������', 6 => '���.\���.'];
-                        while ($i <= 6) {
-                            if ($_GET['tlvl'] == $i) {
-                                $trse .= '<option value="https://new-combats.com/main.php?zayvka&r=8&tlvl=' . $i . '" selected="selected">' . $trnmz[$i] . '</option>';
-                                $tlvl = $i;
-                            } else {
-                                $trse .= '<option value="https://new-combats.com/main.php?zayvka&r=8&tlvl=' . $i . '">' . $trnmz[$i] . '</option>';
-                            }
-                            $i++;
-                        }
-                        $prb = '<INPUT class="btn" TYPE="submit" name=open value="������� �������">';
-                        echo '<style>.zvnkj { padding:5px; }</style>';
-                        $sp = mysql_query('SELECT * FROM `turnirs` WHERE `status` = "0" AND `level` = "' . $tlvl . '"');
-                        $j = 0;
-                        while ($pl = mysql_fetch_array($sp)) {
-                            $j++;
-                            $dinf = '������ ����� ' . $u->timeOut($pl['time'] - time()) . '';
-                            $dv .= '<label><div class="zvnkj">';
-                            if ($u->room['zvsee'] == 0) {
-                                $dv .= '<input type="radio" name="trn1" id="trn1_' . $j . '" value="' . $pl['id'] . '">';
-                            }
-                            $dv .= ' ���������� ������. ���������� �������: ' . $pl['users_in'] . ' ���. | ' . $dinf . '</div></label>';
-                        }
-                        if ($dv == '') {
-                            $dv = '������ �������� ��� ������� ���� ����...';
-                        }
-                        echo '
-						<script type="text/javascript">
-						function MM_jumpMenu(targ,selObj,restore){ //v3.0
-						  eval("location=\'"+selObj.options[selObj.selectedIndex].value+"\'");
-						  if (restore) selObj.selectedIndex=0;
-						}
-						</script>
-						<FORM style="margin:0px; padding:0px; border:0px;" METHOD=\'POST\' ACTION=\'main.php?zayvka=1&r=' . $r . '&rnd=' . $code . '\'>
-						<input type="hidden" name="add_new_zv" id="add_new_zv" value="' . floor(time() / 3) . '" />
-						<TABLE width=100% cellspacing=0 cellpadding=0>
-							  <TR>
-								<TD valign=top>
-									<font color="red"><b>' . $this->error . '</b></font>
-									<div style="border-bottom:#b2b2b2 solid 1px;padding:5px;">
-									��� �������:
-										  <SELECT NAME=turlevel onChange="MM_jumpMenu(null,this,0)">
-											' . $trse . '
-										 </SELECT>
-										 ' . $prb . '
-									</div>
-									<div style="border-bottom:#b2b2b2 solid 1px;padding:5px;margin-bottom:5px;">
-									' . $dv . '
-									</div>
-									' . $prb . '
-									</TD>
-								<TD align=right valign=top></TD>
-							  </TR>
-							</TABLE>
-							</FORM>';
-                    }
-                } elseif ($r == 1) {
-                    //�������, ���������� � ���������� ���������. ���. 29.05.22
-                    $zi = [
-                        1 => '���� �� �� �������� ������� ������, �� ��� ��� ��� ������������ ������ ��� ���������� ����.',
-                    ];
-                    $dv = '';
-                    if ($u->room['zvsee'] == 0) {
-                        if ($u->info['level'] <= $c['bot_level'] || $u->info['admin'] > 0) {
-                            $dv = '<b><font color="green">������������� ��� �������� �� ' . ($c['bot_level'] + 1) . '-�� ������.</font></b> <INPUT class="btn btn-inverse" onClick="location=\'main.php?zayvka=1&r=' . $_GET['r'] . '&bot=' . $u->info['nextAct'] . '\';" TYPE=button name=clone value="������ ��� � ������">';
-                        } else {
-                            if ($u->info['level'] < 9) {
-                                $tstw = ' ��� <b>8</b> ������� ����������';
-                            } else {
-                                $tstw = '<input type="text" value="" name="commentfiz" id="commentfiz" style="width:244px; padding:3px;">';
-                            }
-                            $dv .= '<br>
-							<div>
-							<div style="padding-top:5px;">
-							����������� � ��� ' . $tstw . '
-							
-							</div>
-							</div>
-							<div style="padding-top:5px;"><INPUT class="btn" TYPE=submit name=open value="������ ������"></div>';
-                        }
-                        if ($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);
-                                    if (isset($k['id'])) {
-                                        $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 (
-														"0",
-														"0",
-														"0",
-														"0",
-														"' . $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 `users` SET `battle` = "' . $btl_id . '" WHERE `id` = "' . $k['id'] . '" OR `id` = "' . $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');
-                                        die('<script>top.frames[\'main\'].location = "main.php";</script>');
-                                    }
-                                }
-                            }
-
-                            $dv .= '<script type="text/javascript">
-function MM_jumpMenu(targ,selObj,restore){ //v3.0
-  eval("location=\'main.php?zayvka=1&r=2&rnd=1&adminbotatack="+selObj.options[selObj.selectedIndex].value+"\'");
-  if (restore) selObj.selectedIndex=0;
-}
-</script><form name="form55" id="form55">';
-
-                            $dv .= '<hr>��� � ��������: <select style="font-size:12px;" onChange="MM_jumpMenu(\'parent\',this,0)" name="botadminatack"><option value="0">------ �������� ������� �� ������ ------</option>';
-
-                            $sp_m = mysql_query('SELECT * FROM `test_bot` WHERE `pishera` != 0 ORDER BY `id` ASC');
-                            while ($pl_m = mysql_fetch_array($sp_m)) {
-                                $dv .= '<option value="' . $pl_m['id'] . '">' . $pl_m['id'] . ' [ ' . $pl_m['align'] . ' ] - ' . $pl_m['login'] . ' [' . $pl_m['level'] . '] ' . $pl_m['pishera'] . '</option>';
-                            }
-                            $dv .= '</select></form>';
-                        }
-
-                        echo '
-					<FORM style="margin:0px; padding:0px; border:0px;" METHOD=\'POST\' ACTION=\'main.php?zayvka=1&r=' . $r . '&rnd=' . $code . '\'>
-					<input type="hidden" name="add_new_zv" id="add_new_zv" value="' . floor(time() / 3) . '" />
-					<TABLE width=100% cellspacing=0 cellpadding=0>
-						  <TR>
-							<TD valign=top><!--' . $zi[$r] . '<BR>-->
-								<table cellspacing=0 cellpadding=0>
-								  <tr>
-									<td>
-									  ' . $dv . '
-									</td>
-								  </tr>
-								</table></TD>
-							<TD align=right valign=top></TD>
-						  </TR>
-						</TABLE>
-						</FORM>';
-                    }
-                } elseif ($r == 4) {
-                    if ($u->room['zvsee'] == 0) { //��������� ?>
-                        <span id="hidezv1_btn"><INPUT class="btn" onClick="openfizrmk();" TYPE=button name=tmp
-                                                      value="������ ������ �� ��������� ���" style="margin:3px;"></span>
-                        <FIELDSET id="hidezv1" style="display:none; border-color:#FFF; width:500px;">
-                            <LEGEND><B style="color:#8f0000">������ ������ �� ��������� ���</B></LEGEND>
-                            <form method="post"
-                                  action="main.php?zayvka&r=<?= $_GET['r'] ?>&add_group&rnd=<?= $code ?>">
-                                <table>
-                                    <tr>
-                                        <td>
-                                            ������ ��� �����
-                                            <select style="padding:2px;" name="startime">
-                                                <option value="300">5 �����</option>
-                                                <option value="600">10 �����</option>
-                                            </select>
-                                            &nbsp;&nbsp;&nbsp;&nbsp;�������
-                                            <select style="padding:2px;" name="timeout">
-                                                <option value="1">1 ���.</option>
-                                                <option value="2">2 ���.</option>
-                                                <option value="3">3 ���.</option>
-                                            </select>
-                                            <br/>
-                                            ���� �������
-                                            <input style="padding:2px;" type="text" name="nlogin1" size="3"
-                                                   maxlength="2"/> �������
-                                            <select style="padding:2px;" name="levellogin1">
-                                                <option value="0">�����</option>
-                                                <option value="1">������ ����� � ����</option>
-                                                <option value="2">������ ���� ����� ������</option>
-                                                <option value="3">������ ����� ������</option>
-                                                <option value="4">�� ������ ���� ����� ��� �� �������</option>
-                                                <option value="5">�� ������ ���� ����� ��� �� �������</option>
-                                                <option value="6">��� ������� +/- 1</option>
-                                                <option value="99">��� ����</option>
-                                                <option value="98">��� ����������</option>
-                                            </select>
-                                            <br/>
-                                            ���������� &nbsp;
-                                            <input style="padding:2px;" type="text" name="nlogin2" size="3"
-                                                   maxlength="2"/>
-                                            �������
-                                            <select style="padding:2px;" name="levellogin2">
-                                                <option value="0">�����</option>
-                                                <option value="1">������ ����� � ����</option>
-                                                <option value="2">������ ���� ����� ������</option>
-                                                <option value="3">������ ����� ������</option>
-                                                <option value="4">�� ������ ���� ����� ��� �� �������</option>
-                                                <option value="5">�� ������ ���� ����� ��� �� �������</option>
-                                                <option value="6">��� ������� +/- 1</option>
-                                                <option value="99">������ ����</option>
-                                                <option value="98">������ ����������</option>
-                                            </select>
-                                            <br/>
-                                            <input type="checkbox" name="travma"/>
-                                            <label for="travma">��� ��� ������ <font class="dsc">(����������� �������
-                                                    �������� ������������)</font></label><br/>
-                                            ����������� � ���
-                                            <? if ($u->info['level'] < 9) {
-                                                ?> ��� <b>8</b> ������� ����������
-                                            <? } else { ?>
-                                                <input type="text" style="padding:2px;" name="cmt" maxlength="40"
-                                                       size="40">
-                                            <? } ?>
-                                        </td>
-                                    </tr>
-                                    <tr>
-                                        <td align="left">
-                                            <input class="btn" type="submit" value="������ ������" name="open">
-                                        </td>
-                                    </tr>
-                                </table>
-                            </form>
-                        </FIELDSET>
-                        <?
-                    }
-                } elseif ($r == 5) {
-                    if ($u->room['zvsee'] == 0) {
-                        echo '<div id="hidezv1_btn"><INPUT class="btn" onClick="openfizrmk();" TYPE=button name=tmp value="������ ������ �� ��������� ���"  style="margin:3px;"></div>
-						  <form action="main.php?zayvka=1&r=' . $_GET['r'] . '&start_haot&rnd=' . $code . '" method="post" style="margin:0px; padding:0px;">
-						  <input type="hidden" name="timeout" value="1">
-						  <div style="display:none; width:600px;" id="hidezv1">
-										  <br>
-										  <FIELDSET style="border-color:#FFF;">
-											<LEGEND><strong style="color:#8f0000">������ ������ �� ��������� ���</strong> </LEGEND>
-											������ ���   �����
-											<SELECT name="startime2">
-											<OPTION selected value="180">3 ������
-											  <OPTION value="300">5 �����
-											</SELECT>
-											�������
-											<SELECT name="players">
-											  <OPTION selected value="6">6</OPTION>
-											  <OPTION value="8">8</OPTION>
-											  <OPTION value="10">10</OPTION>
-											  <OPTION value="12">12</OPTION>
-											</SELECT>
-											<BR>
-											������ ������   ��
-											<SELECT name="levellogin1">
-											  <OPTION value="0">�����
-											  <OPTION selected value="3">������ �����   ������
-											  <OPTION value="6">��� ������� +/- 1</OPTION>
-											</SELECT>
-											<BR>
-											<BR>
-											<INPUT type="checkbox" name="travma">
-											��� ���   ������ <font color="#777">(����������� ������� ��������   ������������)</font><BR>
-											<INPUT  type="checkbox" name="noatack"> �������� �������� <font color="#777">(��� ����� ���������� �� ���������)</font><BR>
-											<INPUT  type="checkbox" name="noeff">
-											������ �� ������������� ������� �������������� �� � ����<BR>
-											';
-                        if (!$u->info['no_zv_key']) {
-                            echo '<img src="https://new-combats.com/show_reg_img/security2.php?id=' . time() . '" width="70" height="20"> ��� �������������: <input style="width:40px;" type="text" value="" name="code21">';
-                        }
-                        $tstw = $u->info['level'] < 9 ? ' ��� <b>8</b> ������� ����������' : '<INPUT maxLength="40" size="40" name="cmt">';
-                        echo '����������� � ��� ' . $tstw . '
-											<BR><INPUT class="btn" value="������ ������" type="submit" name="open">
-										  </FIELDSET>
-										</DIV>
-						  </div></form>';
-                    }
-                }
-            } elseif ($r == 6) {
-                //�������
-                $x = 1;
-                $html = '';
-                $p = 0;
-                $_GET['from'] = round((int)$_GET['from']);
-                if ($_GET['from'] > 1 && $_GET['from'] < 50) {
-                    $p = $_GET['from'] - 1;
-                }
-                $xx = mysql_num_rows(mysql_query('SELECT `id` FROM `battle` WHERE `type` != 329 AND `team_win` = "-1" AND `time_over` = "0" AND `start1` > 0'));
-                $px = $p * 15;
-                if ($p > ceil($xx / 15)) {
-                    $p = ceil($xx / 15);
-                }
-                $sp = mysql_query('SELECT * FROM `battle` WHERE `type` != 329 AND `team_win` = "-1" AND `time_over` = "0" AND `start1` > 0 ORDER BY  `time_start` DESC  LIMIT ' . ((int)$px) . ',15');
-                while ($pl = mysql_fetch_array($sp)) {
-                    $tm = '';
-                    $tmu = [];
-                    $tms = [];
-                    $spi = mysql_query('SELECT `u`.`login`,`st`.`id`,`st`.`team`,`u`.`id` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $pl['id'] . '"');
-                    while ($pli = mysql_fetch_array($spi)) {
-                        if (!isset($tmu[$pli['team']])) {
-                            $tms[count($tms)] = $pli['team'];
-                        }
-                        $tmu[$pli['team']][count($tmu[$pli['team']])] = $pli['id'];
-                    }
-                    $i = 0;
-                    while ($i < count($tms)) {
-                        $tmsu = '';
-                        $j = 0;
-                        while ($j < count($tmu[$tms[$j]])) {
-                            if ($tmu[$tms[$i]][$j] > 0) {
-                                $tmsu .= $u->microLogin($tmu[$tms[$i]][$j], 1) . ', ';
-                            }
-                            $j++;
-                        }
-                        $tmsu = rtrim($tmsu, ', ');
-                        $tm .= $tmsu;
-                        if ($i + 1 != count($tms)) {
-                            $tm .= ' <SPAN style=\'color: red; font-weight: bold;\'>������</SPAN> ';
-                        }
-                        $i++;
-                    }
-                    if ($tm != '') {
-                        $html .= ($p + $x) . '. <font class=date>' . date('d.m.y H:i', $pl['time_start']) . '</font> ' . $tm . ' <IMG SRC="https://img.new-combats.com/i/fighttype' . $pl['typeBattle'] . '.gif" WIDTH=20 HEIGHT=20 ALT="���������� ���"> <A HREF="logs.php?log=' . $pl['id'] . '&rnd=' . $code . '" target=_blank>��</A><BR>';
-                    }
-                    $x++;
-                }
-                ?>
-                <table width="100%" cellspacing="0" cellpadding="0">
-                    <tr>
-                        <td valign="top" align="center"><h3>������ ������� ���� �� <?= date('d.m.Y'); ?>
-                                (����� <?= $xx; ?>)</h3></td>
-                        <td valign="top" align="right"></td>
-                    </tr>
-                </table>
-                <? if ($html == '') {
-                    echo '<div align="center">� ��������� ������ ���� ���...</div>';
-                } else {
-                    echo '<div>' . $html . '</div>';
-                } ?>
-                <TABLE width=100% cellspacing=0 cellpadding=0>
-                    <TR>
-                        <TD align=left><? if ($p > 0 && $xx > 15) { ?><A HREF="?zayvka=1&r=6&from=<?= ($p - 1); ?>">��
-                                ���������� ��������</A><? } ?>&nbsp;
-                        </TD>
-                        <TD align=right><? if ($p * 15 - $xx > 0) { ?><A HREF="?zayvka=1&r=6&from=<?= ($p + 1); ?>">
-                                    ��������� �������� ��</A><? } ?>&nbsp;
-                        </TD>
-                    </TR>
-                </TABLE>
-                <?
-            } elseif ($r == 7) {
-                //�����������
-                $btl = '';
-                $dt = time();
-                if (isset($_GET['logs2'])) {
-                    $dt = round((int)$_GET['logs2']);
-                }
-                $dt = strtotime(date('d F Y', $dt) . ' 00:00:00');
-                $slogin = $u->info['login'];
-                if (isset($_GET['filter'])) {
-                    $slogin = $_GET['filter'];
-                }
-                if (isset($_POST['filter'])) {
-                    $slogin = $_POST['filter'];
-                }
-                $slogin = str_replace('"', '', $slogin);
-                $slogin = str_replace("'", '', $slogin);
-                $slogin = str_replace('\\', '', $slogin);
-                $see = '<TABLE width=100% cellspacing=0 cellpadding=0><TR>
-<TD valign=top>&nbsp;<A HREF="?filter=' . $slogin . '&zayvka=1&r=7&logs2=' . ($dt - 86400) . '">� ���������� ����</A></TD>
-<TD valign=top align=center><H3>������ � ����������� ���� �� ' . date('d.m.Y', $dt) . '</H3></TD>
-<TD  valign=top align=right><A HREF="?filter=' . $slogin . '&zayvka=1&r=7&logs2=' . ($dt + 86400) . '">��������� ���� �</A>&nbsp;</TD>
-</TR><TR><TD colspan=3 align=center>
-<form method="POST" action="main.php?zayvka=1&r=7&rnd=' . $code . '">
-�������� ������ ��� ���������: <INPUT TYPE=text NAME=filter value="' . $slogin . '"> �� <INPUT TYPE=text NAME=logs size=12 value="' . date('d.m.Y', $dt) . '"> <INPUT class="btn" TYPE=submit value="������!">
-</form>
-</TD>
-</TR></TABLE>';
-                $usr = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`level`,`city` FROM `users` WHERE `login` = "' . mysql_real_escape_string($slogin) . '" LIMIT 1'));
-                if (isset($usr['id'])) {
-                    $tms = $dt;
-                    $tmf = $dt + 86400;
-                    $sp = mysql_query('SELECT * FROM `battle_last` WHERE `time` >= ' . $tms . ' AND `time` < ' . $tmf . ' AND `uid` = "' . $usr['id'] . '" ORDER BY `id` DESC');
-                    $j = 1;
-                    $jk = 0;
-                    $btl_lst = [];
-                    while ($pl = mysql_fetch_array($sp)) {
-                        $b = mysql_fetch_array(mysql_query('SELECT * FROM `battle_end` WHERE `battle_id` = "' . $pl['battle_id'] . '" LIMIT 1'));
-                        $tm = '';
-                        if (isset($b['id'])) {
-                            $tms = [];
-                            $ts = [];
-                            $spi = mysql_query('SELECT * FROM `battle_last` WHERE `battle_id` = "' . $pl['battle_id'] . '"');
-                            while ($pli = mysql_fetch_array($spi)) {
-                                if (!isset($tms[$pli['team']])) {
-                                    $ts[count($ts)] = $pli['team'];
-                                }
-                                $tms[$pli['team']][count($tms[$pli['team']])] = $pli;
-                            }
-                            $k = 0;
-                            while ($k < count($ts)) {
-                                $g = $ts[$k];
-                                $h = 0;
-                                $tm2 = '';
-                                while ($h < count($tms[$g])) {
-                                    if ($tms[$g][$h]['uid'] > 0) {
-                                        if ($tms[$g][$h]['align'] > 0) {
-                                            $tm2 .= '<img src="https://img.new-combats.com/i/align/align' . $tms[$g][$h]['align'] . '.gif">';
-                                        }
-                                        $tm2 .= '<b>' . $tms[$g][$h]['login'] . '</b> [' . $tms[$g][$h]['lvl'] . ']<a href="info/' . $tms[$g][$h]['uid'] . '" target="_blank"><img src="https://img.new-combats.com/i/inf_capitalcity.gif"></a>, ';
-                                    }
-                                    $h++;
-                                }
-                                $tm2 = rtrim($tm2, ', ');
-                                $btlg = mysql_fetch_array(mysql_query('SELECT `id`,`team_win` FROM `battle` WHERE `id` = "' . $pl['battle_id'] . '" LIMIT 1'));
-                                if (isset($btlg['id']) && $g == $btlg['team_win']) {
-                                    $tm2 .= ' <img width="20" height="20" src="https://img.new-combats.com/i/flag.gif" title="������"> ';
-                                }
-                                $tm .= $tm2;
-                                if ($k + 1 < count($ts) && $tm2 != '' && $ts[$k + 1] > 0) {
-                                    $tm .= ' <font color=red><b>������</b></font> ';
-                                }
-                                $k++;
-                            }
-                        }
-                        if (!isset($btl_lst[$b['id']])) {
-                            $btl_lst[$b['id']] = true;
-                            if ($tm == '') {
-                                $tm = '������ �������� ��������';
-                            }
-                            $jk++;
-                            $btl .= $jk . '. <font class=date>' . date('d.m.y H:i', $pl['time']) . '</font> ' . $tm . ' <A HREF="logs.php?log=' . $pl['battle_id'] . '&rnd=' . $code . '" target=_blank>��</A><br>';
-                        }
-                        $j++;
-                    }
-                }
-                if ($btl == '') {
-                    $see .= '<CENTER><BR><BR><B>� ���� ���� �� ���� ����, ��� ��, ��������� ����� ������� ������...</B><BR><BR><BR></CENTER><HR><BR>';
-                } else {
-                    $see .= $btl;
-                }
-                echo $see;
-            } else {
-                if ((!isset($_GET['new_group']) && !isset($_POST['groupClick'])) || isset($zi['id'])) {
-                    echo '<BR><BR><CENTER><B>�������� ������</B></CENTER>';
-                }
-            }
-        } else {
-            if ((!isset($_GET['new_group']) && !isset($_POST['groupClick'])) || isset($zi['id'])) {
-                echo '<BR><BR><CENTER><B>�������� ������</B></CENTER>';
-            }
-        }
-    }
-
-    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 `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 = ' <small><font color="grey">(' . $w . ')</font></small>';
-        }
-        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 = '';
-
-                while ($pl = mysql_fetch_array($cl)) {
-                    if ($pl['razdel'] == 5) {
-                        if ($pl['min_lvl_1'] < 2) {
-                            $pl['min_lvl_1'] = 2;
-                        }
-                        if ($pl['max_lvl_1'] > 21) {
-                            $pl['max_lvl_1'] = 21;
-                        }
-                        $tm = '';
-                        $tmStart = floor(($pl['time'] + $pl['time_start'] - time()) / 6) / 10;
-                        if ((($pl['time'] + $pl['time_start']) / 10) != (int)(($pl['time'] + $pl['time_start']) / 10)) {
-                            $pl['time'] = ceil($pl['time'] / 60) * 60;
-                            mysql_query('UPDATE `zayvki` SET `time` = "' . $pl['time'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
-                        }
-                        $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'] . '"');
-                        $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) . ', ';
-                        }
-                        $rad = '';
-                        $tm = rtrim($tm, ', ');
-                        if (!isset($zi['id']) && $u->room['zvsee'] == 0 && $u->info['inTurnirnew'] == 0) {
-                            $rad = '<input type="radio" name="btl_go" id="btl_go' . $pl['id'] . '" value="' . $pl['id'] . '"> ';
-                        }
-                        $n1tv = '';
-                        $unvs = '';
-                        if ($pl['invise'] == 1) {
-                            //��������� ���
-                            $tm = '<i>���������</i>';
-                            $unvs = 0;
-
-                            $usrszv = '';
-                            //if( $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) . '';
-                                }
-                                $unvs++;
-                            }
-                            //}
-                            $tm = '<font color=grey><span style="color:maroon">' . $u->microLogin($pl['creator'], 1) . '</span>' . $usrszv . '</font> - ' . $tm;
-
-                            $unvs = ' ����������: ' . (1 + $unvs) . ' ���. ';
-                            $n1tv = ' <img src="https://img.new-combats.com/i/fighttypehidden0.gif" title="���������">';
-                        }
-                        if ($pl['kingfight'] == 1) {
-                            $n1tv .= ' <img src="https://img.new-combats.com/king.gif" title="�������� ��������">';
-                        }
-                        if ($pl['travmaChance'] == 100) {
-                            $n1tv .= '<img src="https://img.new-combats.com/fighttype6.gif" title="�������� ��������">';
-                        }
-                        if ($pl['noatack'] == 1) {
-                            $n1tv .= ' <img src="https://img.new-combats.com/i/fighttypehidden0.gif" title="�������� ���">';
-                        }
-                        if ($pl['nobot'] == 1) {
-                            $n1tv .= ' <img src="https://img.new-combats.com/nobot.gif" title="� ��� �� �������� ����">';
-                        }
-                        if ($pl['fastfight'] == 1) {
-                            $n1tv .= ' <img src="https://img.new-combats.com/fastfight.gif" title="��� ������ ��� ���������� ������� 2 ������">';
-                        }
-                        if ($pl['noeff'] == 1) {
-                            $n1tv .= ' <img src="https://img.new-combats.com/svitok4.png" width="20" height="20" title="������ �� ������������� ������� �������������� �� � ����">';
-                        }
-                        if ($pl['arand'] == 1) {
-                            $n1tv .= ' <img src="https://img.new-combats.com/random.png" width="20" height="20" title="������������� ������ ��������� �������">';
-                        }
-                        if ($pl['noart'] == 1) {
-                            $n1tv .= ' <img src="https://img.new-combats.com/noart.png" width="20" height="20" title="��� ��� ����������">';
-                        }
-                        if ($pl['otmorozok'] == 1) {
-                            $n1tv .= ' <img src="https://img.new-combats.com/snow.gif" width="20" height="20" title="� ��� ����� ��������� ���������">';
-                        }
-                        if ($pl['comment'] != '') {
-                            $dl = '';
-                            if (($moder['boi'] == 1 || $u->info['admin'] > 0) && $pl['dcom'] == 0) {
-                                $dl .= ' (<a href="main.php?zayvka=1&r=5&delcom=' . $pl['id'] . '&key=' . $u->info['nextAct'] . '&rnd=' . $code . '">������� �����������</a>)';
-                                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 ($pl['dcom'] > 0) {
-                                $dl = '<font color="grey"><i>����������� ������ �����������</i></font>';
-                            }
-                            if ($pl['dcom'] > 0) {
-                                if ($moder['boi'] == 1 || $u->info['admin'] > 0) {
-                                    $pl['comment'] = '[ ����� ����������� : <font color="red">' . $pl['comment'] . '</font>]&nbsp;';
-                                } else {
-                                    $pl['comment'] = '';
-                                }
-                            }
-                            $zv_comm = ' ' . $pl['comment'] . '' . $dl . ' ';
-                        } else {
-                            $zv_comm = '';
-                        }
-                        if ($pl['priz'] == 1) {
-                            $imn = '';
-                            if ($pl['min_lvl_1'] == 10) {
-                                $imn .= ' ��. Jora Kardan';
-                            }
-                            $zv_comm = ' <a href="https://new-combats.com/n/567/" target="_blank"><span style="color:#e65700;" title="��������� �������� ������, ��� ������ �������� ������ �� �����, ��� ������ ������ ������� �� ������ "><b>(����������� ��������' . $imn . ')</b></span></a>';
-                        }
-                        if ($r == 5 && ($pl['creator'] == $u->info['id']) && $cols < 2 && $pl['priz'] == 0) {
-                            $del_q = '&nbsp;&nbsp;<a href="main.php?zayvka=1&r=5&del_z_time=' . $pl['id'] . '&rnd=' . $code . '"><img src="https://img.new-combats.com/i/clear.gif" title="������� ������" /></a>';
-                        } else {
-                            $del_q = '';
-                        }
-                        $lvldt = '';
-                        if ($pl['min_lvl_1'] != $pl['max_lvl_2']) {
-                            $lvldt .= '' . $pl['min_lvl_1'] . '-' . $pl['max_lvl_2'] . ' ��. ';
-                        } else {
-                            $lvldt .= '' . $pl['min_lvl_1'] . ' ��. ';
-                        }
-                        $lvldt .= (0 + $cols) . '/' . $pl['maxplayers'] . '';
-                        $zvb .= $rad . '<font class="date">' . date('H:i', $pl['time']) . '</font> <font color="green"><b><i>(' . $lvldt . ')</i></b></font> ��� ���: <IMG SRC="https://img.new-combats.com/i/fighttype' . $pl['type'] . '.gif" WIDTH="20" HEIGHT="20" title="��������� ���">' . $n1tv . ' (������� <b>' . ($pl['timeout'] / 60) . ' ���.</b>) <b>' . $zv_comm . '</b> <font class="dsc"><i><font color="green">(' . $unvs . '��� �������� ����� <B>' . $tmStart . '</B> ���.)</font> </font></i> ' . $mon . ' <i>���������:</i> ' . $tm . ' ' . $del_q . '<br />';
-                    } elseif ($pl['razdel'] == 4) {
-                        if ($pl['min_lvl_1'] < 2) {
-                            $pl['min_lvl_1'] = 2;
-                        }
-                        if ($pl['max_lvl_1'] > 21) {
-                            $pl['max_lvl_1'] = 21;
-                        }
-                        if ($pl['min_lvl_2'] < 2) {
-                            $pl['min_lvl_2'] = 2;
-                        }
-                        if ($pl['max_lvl_2'] > 21) {
-                            $pl['max_lvl_2'] = 21;
-                        }
-                        //������ ���������� ���
-                        $tm1 = '';
-                        $tm2 = '';
-                        $tmStart = floor(($pl['time'] + $pl['time_start'] - time()) / 6) / 10;
-                        $tmStart = $this->rzv($tmStart);
-
-                        //�������� � ������, ���������� ��� ����������
-                        //���� �������� ��� ���������
-                        $xx2 = $this->testzvu($pl['id'], 2, 0);
-                        if ($pl['bot2'] > 0 && $xx2 < $pl['tm2max']) {
-                            //��������� ����� �� ������ �������
-                            $spb = mysql_query('SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON `u`.`id` = `st`.`id` WHERE `st`.`bot` = 3 AND `u`.`level` = "' . $pl['min_lvl_2'] . '" AND `u`.`battle` = 0 AND `st`.`zv` = 0 LIMIT 100');
-                            $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']);
-                                    $logins_bot = $bt['logins_bot'];
-                                    if ($bt > 0) {
-                                        mysql_query('UPDATE `stats` SET `zv` = "' . $pl['id'] . '",`team` = "2" WHERE `id` = "' . $bt . '" LIMIT 1');
-                                        $xx2++;
-                                    }
-                                }
-                            }
-                            unset($plb, $spb, $logins_bot, $bt);
-                        }
-                        unset($xx2);
-
-                        //���������� �������
-                        $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) . ', ';
-                            $tmc[$s['team']]++;
-                        }
-
-                        if ($tm1 == '') {
-                            $tm2 = '<font color="#777"><i>������ ���� �� �������</i></font>';
-                        } else {
-                            $tm1 = rtrim($tm1, ', ');
-                        }
-
-                        if ($tm2 == '') {
-                            $tm2 = '<font color="#777"><i>������ ���� �� �������</i></font>';
-                        } else {
-                            $tm2 = rtrim($tm2, ', ');
-                        }
-                        //
-                        if ($pl['teams'] == 3) {
-                            if ($tm3 == '') {
-                                $tm2 = '<font color="#777"><i>������ ���� �� �������</i></font>';
-                            } else {
-                                $tm3 = rtrim($tm3, ', ');
-                            }
-
-                            $ttl1 = '';
-                            $ttl2 = '';
-                            $ttl3 = '';
-
-                            if ($pl['align1'] == 3) {
-                                $ttl1 = '����';
-                            } elseif ($pl['align1'] == 7) {
-                                $ttl1 = '��������';
-                            } else {
-                                $ttl1 = '����';
-                            }
-                            if ($pl['align2'] == 3) {
-                                $ttl2 = '����';
-                            } elseif ($pl['align2'] == 7) {
-                                $ttl2 = '��������';
-                            } else {
-                                $ttl2 = '����';
-                            }
-                            if ($pl['align3'] == 3) {
-                                $ttl3 = '����';
-                            } elseif ($pl['align3'] == 7) {
-                                $ttl3 = '��������';
-                            } else {
-                                $ttl3 = '����';
-                            }
-
-                            $tm1 = '<img src="https://img.new-combats.com/i/align/align' . $pl['align1'] . '.gif"> ' . $ttl1 . ': ' . $tm1;
-                            $tm2 = '<img src="https://img.new-combats.com/i/align/align' . $pl['align2'] . '.gif"> ' . $ttl2 . ': ' . $tm2;
-                            $tm3 = '<img src="https://img.new-combats.com/i/align/align' . $pl['align3'] . '.gif"> ' . $ttl3 . ': ' . $tm3;
-
-                        }
-                        //
-                        $rad = '';
-                        if (!isset($zi['id']) && $u->room['zvsee'] == 0) {
-                            $rad = '<input type="radio" name="groupClick" id="groupClick" value="' . $pl['id'] . '"> ';
-                        }
-                        if ($pl['comment'] != '') {
-                            $dl = '';
-                            if (($moder['boi'] == 1 || $u->info['admin'] > 0) && $pl['dcom'] == 0) {
-                                $dl .= ' (<a href="main.php?zayvka=1&r=4&delcom=' . $pl['id'] . '&key=' . $u->info['nextAct'] . '&rnd=' . $code . '">������� �����������</a>)';
-                                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 ($pl['dcom'] > 0) {
-                                $dl = '<font color="grey"><i>����������� ������ �����������</i></font>';
-                            }
-                            if ($pl['dcom'] > 0) {
-                                if ($moder['boi'] == 1 || $u->info['admin'] > 0) {
-                                    $pl['comment'] = '[ ����� ����������� : <font color="red">' . $pl['comment'] . '</font>]&nbsp;';
-                                } else {
-                                    $pl['comment'] = '';
-                                }
-                            }
-                            $zv_comm = '' . $pl['comment'] . '' . $dl . '';
-                        } else {
-                            $zv_comm = '';
-                        }
-                        if ($pl['teams'] == 3) {
-                            $zv_comm .= ' <a href="https://new-combats.com/lib/turnir-sklonnostei/" target="_blank"><span style="color:#543666;" title="� ������� ��������� ��� ����������: ����, ����, ��������. ���������� ���������� �������� ��������� ������������� �� ���������� ���."><b>(������ ���� �����������)</b></span></a>';
-                        }
-
-                        $zvb .= $rad . '<font class="date">' . date('H:i', $pl['time']) . '</font> ';
-                        $zvb .= '(<font color=green>' . (0 + $tmc[1]) . '/<b>' . $pl['tm1max'] . '</b></font>)';
-                        $zvb .= ' ' . $tm1;
-                        $zvb .= ' <font color="green"><b><i>(';
-                        if ($pl['min_lvl_1'] == $pl['max_lvl_1']) {
-                            $zvb .= $pl['min_lvl_1'];
-                        } else {
-                            $zvb .= $pl['min_lvl_1'] . '-' . $pl['max_lvl_1'];
-                        }
-                        $zvb .= ' ��.)</i></b></font>';
-                        $zvb .= ' <i>������</i> ';
-                        $zvb .= '(<font color=green>' . (0 + $tmc[2]) . '/<b>' . $pl['tm2max'] . '</b></font>)';
-                        $zvb .= ' ' . $tm2;
-                        $zvb .= ' <font color="green"><b><i>(';
-                        if ($pl['min_lvl_2'] == $pl['max_lvl_2']) {
-                            $zvb .= $pl['min_lvl_2'];
-                        } else {
-                            $zvb .= $pl['min_lvl_2'] . '-' . $pl['max_lvl_2'];
-                        }
-                        $zvb .= ' ��.)</i></b></font>';
-                        $zvb .= ' ��� ���: <IMG SRC="https://img.new-combats.com/i/fighttype' . $pl['type'] . '.gif" WIDTH="20" HEIGHT="20" title="��������� ���"> (�������: <b>' . ($pl['timeout'] / 60) . ' ���.</b>) ';
-                        $zvb .= ' <b>' . $zv_comm . '</b> ';
-                        $zvb .= ' <font color="green"><i>(��� �������� ����� <b>' . $tmStart . '</b>)</i></font> ' . $mon . '<BR>';
-                    } 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'] || $u->info['level'] <= $c['bot_level']) {
-                                $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 .= '<span style="text-decoration:line-through;">';
-                                }
-                                $dp1 = '';
-                                if ($pl['money'] > 0) {
-                                    $dp1 = ' ��� �� ������, ������: <b>' . $u->round2($pl['money']) . ' ��.</b>';
-                                }
-                                if ($u->room['zvsee'] == 0) {
-                                    $zvb .= '<input name="btl_go" ' . $d1 . ' type="radio" value="' . $pl['id'] . '" />';
-                                }
-                                $mbcom = '';
-                                if ($pl['comment'] != '') {
-                                    $mbcom = ' <b>' . $pl['comment'] . '</b>';
-                                }
-                                $zvb .= '<font class="date">' . date('H:i', $pl['time']) . '</font> ' . $u->microLogin($uz['id'], 1) . ' ' . $enm . '  ��� ���: <img src="https://img.new-combats.com/i/fighttype' . ($pl['type']) . '.gif"> ( ������� <b>' . round($pl['timeout'] / 60) . ' ���.</b>' . $dp1 . ' ' . $mon . ')' . $mbcom . '<br>';
-                                if ($uz['banned'] > 0) {
-                                    $zvb .= '</span>';
-                                }
-                            }
-                        }
-                    }
-                    $i++;
-                }
-                if ($i == 0) {
-                    //������ ���
-                    if ($u->room['zvsee'] > 0) {
-                        echo '<br><br><br><div align="center"><b>� ������ ������� ��� �� ����� ������</b></div>';
-                    }
-                } else {
-                    if (!isset($zi['id']) && $u->room['zvsee'] == 0) {
-                        if ($_GET['r'] == 5) {
-                            if (!$u->info['no_zv_key']) {
-                                echo '<div style="float:left;"><form method="post" style="margin:0px;padding:0px;" action="main.php?zayvka=1&r=' . $r . '&rnd=' . $code . '"><br>
-								<img src="https://new-combats.com/show_reg_img/security2.php?id=' . time() . '" width="70" height="20"> ��� �������������: <input style="width:40px;" type="text" value="" name="code21"> 
-								<input class="btn" name="" type="submit" value="������� ������� � ���������" /><br>' . $zvb . ' <img src="https://new-combats.com/show_reg_img/security2.php?id=' . time() . '" width="70" height="20"> ��� �������������: <input style="width:40px;" type="text" value="" name="code22"> 
-								<input class="btn" style="margin-top:1px;" type="submit" value="������� ������� � ���������" />
-								</form></div>';
-                            } else {
-                                echo '<div style="float:left;"><form method="post" style="margin:0px;padding:0px;" action="main.php?zayvka=1&r=' . $r . '&rnd=' . $code . '"><br> 
-								<input class="btn" name="" type="submit" value="������� ������� � ���������" /><br>' . $zvb . ' 
-								<input class="btn" style="margin-top:1px;" type="submit" value="������� ������� � ���������" /></form></div>';
-                            }
-                        } else {
-                            if ($zvb != '' && $u->info['level'] > $c['bot_level']) {
-                                echo '<div style="float:left;"><form method="post" style="margin:0px;padding:0px;" action="main.php?zayvka=1&r=' . $r . '&rnd=' . $code . '"><br><input class="btn" name="" type="submit" value="������� �����" /><br>' . $zvb . '<input class="btn" style="margin-top:1px;" type="submit" value="������� �����" /></form></div>';
-                            } else {
-                                echo '<div style="float:left;">' . $zvb . '</div>';
-                            }
-                        }
-                    } else {
-                        echo $zvb;
-                    }
-                }
-            }
-        }
-    }
-
-    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'));
-                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 ($this->testTravm() == 1 && $z['type'] != 1) {
-                                $this->error = '�� ������������. � ������ �������� �������� �������� ���.';
-                                $az = 0;
-                            } elseif ($this->testTravm() == 2) {
-                                $this->error = '�� ������������. � ������ �������� ���������� ���������.';
-                                $az = 0;
-                            } elseif ($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 && $u->info['admin'] == 0 && true == false) {
-                                $this->error = '�� �� ������ ��������� ������ ��������';
-                            } 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'] < ceil($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');
-                                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 = '<img title="' . $pc['name'] . '" src="https://img.new-combats.com/i/clan/' . $pc['name_mini'] . '.gif">';
-                                        }
-                                    }
-                                    if ($uz1['align'] != 0) {
-                                        $ca = '<img src="https://img.new-combats.com/i/align/align' . $uz1['align'] . '.gif">' . $ca;
-                                    }
-                                    $this->error = '������� ������������� ��� �� ' . $ca . ' ' . $uz1['login'] . ' [' . $uz1['level'] . ']<a href="info/' . $uz1['id'] . '" target="_blank"><img src="https://img.new-combats.com/i/inf_capitalcity.gif"></a>';
-                                    $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` (`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;
-                                } 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['bot2'] == 1 && $t1 == 2) {
-                                $this->error = '�� �� ������ ��������� �� ������� �����';
-                            } elseif ($z['money3'] > 0 && $z['money3'] > $u->info['money3']) {
-                                $this->error = '� ��� ������������ �����, ����� ������� ��� ������';
-                            } elseif (($z['money'] > 0 || $z['money3'] > 0) && $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']) {
-                                    $this->error = '�� �� ��������� �� ������, �� ��� ������� ����� ����� ��������� ' . $z['min_lvl_' . $t1] . ' - ' . $z['max_lvl_' . $t1] . ' ������';
-                                } elseif ($u->stats['hpNow'] < ceil($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');
-                                    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) {
-                        //���������
-                        $col_p = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $z['id'] . '"'));
-                        $cols = $col_p[0];
-                        if ($cols >= $z['maxplayers']) {
-                            $this->error = '��������� ������������ ������ ���������� � ���� ������!';
-                        } elseif ($this->testTravm() == 1 && $z['k'] != 1) {
-                            $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']))) {
-                            $this->error = '������������ ��� �������������';
-                        } elseif ($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'] < ceil($u->stats['hpMax'] / 100 * 30)) {
-                            $this->error = '�� ������� ���������, ��������������';
-                        } elseif ($z['money'] > 0 && $u->info['level'] < 4) {
-                            $this->error = '��� �� ������ ���������� � 4-�� ������';
-                        } else {
-                            $t1 = 0;
-
-                            if ($z['type'] == 33) {
-
-                                //============================================================================================= ��������
-                                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'] . '",
-			"1",
-			"' . $u->info['login'] . '",
-			"0",
-			"' . $u->info['pass'] . '",
-			"' . mysql_real_escape_string(IP) . '",
-			"' . mysql_real_escape_string(IP) . '",
-			"capitalcity",
-			"capitalcity",
-			"422",
-			"' . time() . '",			
-			"0",
-			"haot@new-combats.com",
-			"01.01.1980",
-			"' . $u->info['sex'] . '",
-			"0",
-			"0",
-			"1",
-			"' . mysql_real_escape_string(time() + 86400) . '",
-			"8"
-		)');
-
-                                $uidb = mysql_insert_id();
-                                mysql_query('UPDATE `users` SET `inUser` = "' . $uidb . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
-                                //��� ������
-                                $sellclass = rand(1, 6);
-                                if ($sellclass == 1) {
-                                    //������ ����� 1
-                                    $us = add_effn($uidb, 8); // �����
-                                    $us = 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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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');
-                                    mysql_query('UPDATE `stats` SET `priems`="193|8|217|221|6|213|14|220|141|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" WHERE `id`="' . $uidb . '" LIMIT 1');
-                                    //������ ����� ��������
-                                } elseif ($sellclass == 2) {
-                                    //���� ����� 2
-                                    $us = add_effn($uidb, 7); // ����
-                                    $us = 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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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');
-                                    mysql_query('UPDATE `stats` SET `priems`="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" WHERE `id`="' . $uidb . '" LIMIT 1');
-                                    //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); // ����������
-
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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');
-                                    mysql_query('UPDATE `stats` SET `priems`="11|204|233|226|45|14|139|221|6|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" WHERE `id`="' . $uidb . '" LIMIT 1');
-
-                                } elseif ($sellclass == 4) {
-                                    //����� ����� 4
-                                    $us = add_effn($uidb, 1); // ����
-                                    $us = 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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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');
-
-                                    mysql_query('UPDATE `stats` SET `priems`="193|139|49|14|6|217|221|204|147|45|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" WHERE `id`="' . $uidb . '" LIMIT 1');
-                                    //193|139|49|14|6|217|221|204|147|45|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 == 5) {
-                                    //� ����� ����� 5
-                                    //������ ������
-                                    $us = add_effn($uidb, 9); // ��������
-                                    $us = add_effn($uidb, 32); // �������� �����
-                                    $us = add_effn($uidb, 54); // ��� ������ �����
-                                    $us = 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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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 `stats` SET `priems`="208|117|170|44|113|128|122|249|246|147|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" WHERE `id`="' . $uidb . '" LIMIT 1');
-                                    //208|117|170|44|113|253|122|249|246|147|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 == 6) {
-                                    //� ������ 6
-                                    //������ ������
-                                    $us = add_effn($uidb, 9); // ��������
-                                    $us = add_effn($uidb, 32); // �������� �����
-                                    $us = add_effn($uidb, 53); // ��� ������ ������
-                                    $us = 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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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);
-                                    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 `stats` SET `priems`="208|93|98|260|39|263|257|104|30|147|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" WHERE `id`="' . $uidb . '" LIMIT 1');
-                                    //208|93|98|260|39|287|257|104|261|147|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
-                                }
-                                // ������ ���������
-                                //������ ������
-
-                                $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
-
-                                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->error = '�� ������� � ����� 8�� ������'; //��� ������� � ����� �������� �����
-                                echo '<script>location="main.php?battle_id=' . $btl_id . '";</script>';
-                            }
-
-                            if ($z['invise'] == 1) {
-                                $nxtID = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $z['id'] . '"'));
-                                $nxtID = $nxtID[0];
-                            }
-                            $u->info['login2'] = '';
-
-                            $blnc = $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/_incl_data/class/_cron_.php b/_incl_data/class/_cron_.php
deleted file mode 100644
index f8915537..00000000
--- a/_incl_data/class/_cron_.php
+++ /dev/null
@@ -1,2536 +0,0 @@
-<?php
-
-use Insallah\Db;
-use Insallah\Math;
-
-if (!defined('GAME')) {
-    die();
-}
-error_reporting(E_ALL ^ E_NOTICE);
-ini_set('display_errors', 'Off');
-
-/*
-- �������� ���������� ������ � $btl->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();
-    }
-
-    /** ����� �������
-     * @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} � ������������ � �������� ������.
-     * <br>������: <br>lvl1 = $uid[level] <br>ts5 = $uid[s5] <br>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] = 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'],
-                ]);
-                if ($f[0] != '' && $f[1] != '') {
-                    $e[$i] = implode('=', $f);
-                }
-                $i++;
-            }
-            $pl = implode('|', $e);
-        }
-        return $pl;
-    }
-
-    private function cancelEffects($effects_ids, $uid, battleClass $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 = 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} ���������� &quot;<b><font color=#' . $tcl . '>' . $pl['name'] . '</font></b>&quot; ������������ �������� ��������� {u2}. <b><font title=���&nbsp;�����������:&nbsp;' . $nmz[1] . ' color=#' . $tco . '>' . $hpmin . '</font></b> [' . ceil($hp2) . '/' . $btl->stats[$btl->uids[$uen]]['hpAll'] . ']';
-        } else {
-            $mas1['text'] = '{tm1} {u1} {1x16x0} ���������� &quot;<b><font color=#' . $tcl . '>' . $pl['name'] . '</font></b>&quot; � ����������� �������� ��������� {u2} ������ ' . $nmz[0] . '. <b><font title=���&nbsp;�����������:&nbsp;' . $nmz[1] . ' color=#' . $tco . '>' . $hpmin . '</font></b> [' . 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(battleClass $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, 
-            <br> �������� ����� �� ������ � ������: damage x ($skills - $requiredSkills)<br> $damageType 
-            ��� ������: ($defence -$suppression%) = $supressedDefence | 
-            ��� ����: ($damage +$power) = $poweredDamage<br> 
-            ��� ����: ($poweredDamage -$supressedDefence) = $finalDamage";
-            $s .= $isCritical ? ' (���� *2)' : '';
-            echo "<div style='background-color: #C5C5C5; border: 1px solid coral; margin-top: 15px;'>$s</div>";
-        }
-
-
-        // !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 = 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']='������� <font color=red><b>������� ������</b></font>.';
-            $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 => '�����&nbsp;�����', 1 => '�����&nbsp;�����'],
-        ];
-        $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']] . ' �������� �� &quot;<b><font color=#' . $tcl . '>' . $pl['name'] . '</font></b>&quot;. <b><font title=���&nbsp;�����:&nbsp;' . $nmz[1] . ' color=#' . $tco . '>' . $hpmin . '</font></b> [' . ceil($hp2) . '/' . $btl->stats[$btl->uids[$uen]]['hpAll'] . ']';
-        } else {
-            if ($fiz == 1) {
-                $mas1['text'] = '{tm1} {u1} {1x16x0} ����� &quot;<b><font color=#' . $tcl . '>' . $pl['name'] . '</font></b>&quot; � ������� {u2}. <b><font title=���&nbsp;�����:&nbsp;' . $nmz[1] . ' color=#' . $tco . '>' . $hpmin . '</font></b> [' . ceil($hp2) . '/' . $btl->stats[$btl->uids[$uen]]['hpAll'] . ']';
-            } else {
-                $mas1['text'] = '{tm1} {u1} {1x16x0} ���������� &quot;<b><font color=#' . $tcl . '>' . $pl['name'] . '</font></b>&quot; � ������� ������ ' . $nmz[0] . ' {u2}. <b><font title=���&nbsp;�����:&nbsp;' . $nmz[1] . ' color=#' . $tco . '>' . $hpmin . '</font></b> [' . 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 '<div style="color: red; font-weight: bold; text-align: center;">������ ��������� ����� ������� ���������� � ��������</div>';
-            } elseif ($btl->users[$btl->uids[$u1]]['bot'] > 0 && $btl->users[$btl->uids[$u2]]['bot'] == 0) {
-                echo '<div style="color: red; font-weight: bold; text-align: center;">������ ��������� ����� �������� ��� �����</div>';
-                $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 ����� &quot;<b>" . $a['name'] . '&quot;</b>';
-                            $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 '<br>�� ������� ��������� ����� - �� ������...';
-                    }
-                } 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="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 ($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']) {
-                    //$cl2 = 'filter: alpha(opacity=15); -moz-opacity: 0.15; -khtml-opacity: 0.15; opacity: 0.15;';
-                    $cli2 = ' class="nopriemuse" ';
-                }
-
-                $pr .= '<a onMouseOver="top.hi(this,\'<b>' . $pl['name'] . '</b><Br>' . $lvar . '\',event,3,0,1,1,\'width:240px\');" onMouseOut="top.hic();" onMouseDown="top.hic();" ' . $cl . '><img ' . $cli2 . ' style="margin-top:3px; ' . $cl2 . ' margin-left:4px;" src="https://img.new-combats.com/i/eff/' . $pl['img'] . '.gif" width="40" height="25" /></a>';
-            } else {
-                //if($t==1)
-                //{
-                if (isset($_GET['inv'])) {
-                    $pr .= '<a title="������� � ���������� �������" href="javascript:void(0)" onclick="location.href=\'main.php?all=' . ((int)$_GET['all']) . '&skills=1&rz=4&p_raz=all\'"><img style="margin-top:4px; margin-left:4px;" src="https://img.new-combats.com/i/items/w/clearPriem.gif" width="40" height="25" /></a>';
-                } else {
-                    $pr .= '<img style="margin-top:4px; margin-left:4px;" src="https://img.new-combats.com/i/items/w/clearPriem.gif" width="40" height="25" />';
-                }
-                //}
-            }
-            $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 .= '<a onMouseOver="top.hi(this,\'<b>��������� �����</b><Br>��� ����� ����������� � ��������. ����� ��������� ���� ��� �� ���.\',event,3,0,1,1,\'width:240px\');" onMouseOut="top.hic();" onMouseDown="top.hic();" href="javascript:void(0);" onClick="usepriem(100500,1,\'\');"><img style="margin-top:1px; ' . $cl2 . ' margin-left:3px;" src="https://img.new-combats.com/i/eff/pet_unleash.gif" width="40" height="25" /></a>';
-            } else {
-                $cl2 = '" class="nopriemuse';
-                $pr .= '<img onMouseOver="top.hi(this,\'<b>��������� �����</b><Br>��� ����� ����������� � ��������. ����� ��������� ���� ��� �� ���.\',event,3,0,1,1,\'width:240px\');" onMouseOut="top.hic();" onMouseDown="top.hic();" style="margin-top:1px; margin-left:2px;' . $cl2 . '" src="https://img.new-combats.com/i/eff/pet_unleash.gif" width="40" height="25" />';
-            }
-        }
-        if ($t == 1) {
-            echo '<div style="width:230px;">' . $pr . '</div>';
-        } 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 .= '<font color=red>';
-                    $notr++;
-                }
-                $trs .= '<br>� ';
-                $trs .= $this->u->is[$n] . ': ' . $tr['tr_' . $n];
-                if ($tr['tr_' . $n] > $this->u->stats[$n]) {
-                    $trs .= '</font>';
-                }
-            }
-            $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 .= '<img src=https://img.new-combats.com/i/micro/' . $nm[$j] . '.gif width=8 height=8 /> ' . round($pl['tt' . $j],
-                        2) . ' &nbsp; ';
-            }
-            $j++;
-        }
-        if ($pl['tt7'] > 0) {
-            if ($lvar != '') {
-                $lvar .= '<br>';
-            }
-            $lvar .= '���� ����: ' . round($pl['tt' . $j], 2) . '<br>';
-        }
-        $lvar .= '<br>';
-        if ($pl['zad'] > 0) {
-            $lvar .= '��������: ' . $pl['zad'];
-            if ($pz[$id] > 0) {
-                $lvar .= ' (��� ' . $pz[$id] . ')';
-            }
-            $lvar .= '<br>';
-        }
-        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 .= '<font color=red>� ������ ����: ' . $tr['tr_mpNow'] . '</font><br>';
-            } else {
-                $lvar .= '� ������ ����: ' . $tr['tr_mpNow'] . '<br>';
-            }
-        }
-        if ($pl['tr_hod'] > 0) {
-            $lvar .= '� ����� ������ ���<br>';
-        }
-        if ($trs != '') {
-            $lvar .= '<b>����������:</b>' . $trs . '<br><br>';
-        } else {
-            $lvar .= '<br>';
-        }
-        $pl['info'] = preg_replace("!(\#)(.*?)(\#)!ise",
-            "getdr('\\2',array(0=>'lvl1',1=>'ts5',2=>'mpAll'),array(0=>'" . $this->u->info['level'] . "',1=>'" . $this->u->stats['s5'] . "',2=>'" . $this->u->stats['mpAll'] . "'))",
-            $pl['info']);
-        $lvar .= $pl['info'];
-        $lvar = [0 => $lvar, 1 => $pz];
-        return $lvar;
-    }
-
-    //�������� / ���������� / ������������� � �.�.
-    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 = '<a href="main.php?skills=1&all=' . ((int)$_GET['all']) . '&rz=4&use_priem=' . $pl['id'] . '&rnd=' . $code . '">';
-                $a2 = '</a>';
-
-                //$cl = 'href="javascript:void(0)" onclick="location.href=\'main.php?skills=1&unuse_priem='.$i.'&rz=4&p_raz=\' + p_raz"';
-                $a1 = '<a href="javascript:void(0)" onclick="location.href=\'main.php?skills=1&all=' . ((int)$_GET['all']) . '&rz=4&use_priem=' . $pl['id'] . '&rnd=' . $code . '&p_raz=\' + p_raz;">';
-                $a2 = '</a>';
-
-                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 . '<img class="pwq' . $mtnu . ' pwqall" onMouseOver="top.hi(this,\'(#' . $pl['id'] . ') <b>' . $pl['name'] . '</b><Br>' . $lvar . '\',event,3,0,1,1,\'width:240px\');" onMouseOut="top.hic();" onMouseDown="top.hic();" style="margin-top:2px; ' . $cl . ' margin-left:1px;" src="https://img.new-combats.com/i/eff/' . $pl['img'] . '.gif" width="40" height="25" />' . $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 battleClass $btl
-     * @param $id
-     * ��������� ����� pruse() � �������� ���� � ���������� ������.
-     * @return void
-     */
-    private function fireFlash($level, battleClass $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'],
-            "<span style^^^^'color: $color'>������� [$level]</span>",
-            '{tm1}' . sprintf(" %s <b style='color: %s'>%s</b> [%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 battleClass $btl
-     * @return bool (bool) ��������� �� ����� �� ����� ����������.
-     */
-    private function magicTarget($element, $pl, $id, battleClass $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 "<b style='color: {$this->logColor['crit']};'>�� ��������� ���������� ����������� ���������� �����</b>";
-            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'],
-            "<span style^^^^'color: $color'>$name</span>",
-            '{tm1}' . sprintf(" %s. <i>(%s)</i>",
-                $btl->addlt(1, 19, $this->u->info['sex'], null), $effect),
-            $btl->hodID);
-
-        return false;
-    }
-
-    public function devouringFlame($id, $uid, $j_id, battleClass $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);
-
-        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);
-        Db::sql('update stats set hpNow = ? where id = ?', [$btl->stats[$btl->uids[$u1]]['hpNow'], $this->ue['id']]);
-
-        $color = $this->logColor[self::FIRE];
-        $prv['text'] = '{u2} ������� �������� �� &quot;{pr}&quot; ';
-        if ($pvr['promah_type'] == 2) {
-            $pvr['hp'] = '-';
-        }
-        $prv['text'] .= sprintf("<b style='color: %s'>%s</b> [%d/%d]", $color, -$pvr['hp'], $pvr['hpNow'], $pvr['hpAll']);
-
-        $btl->priemAddLog($id, 1, 2, $u2, $u1, "<span style='color: $color'>$pName</span>", $prv['text'], ($btl->hodID));
-    }
-
-    /** ���������� �����. ��������� ���� �� ����������, �� ������� ��� �������.
-     * ��������� �� 5 �����. ������� ������� ����� ����� ���������� ��������� 5 �����.
-     * �������� damage ����� ���������� ������� �� 5 � ������� � �� (atgm=).
-     * �����: 33, 56, 57, 58, 59, 60.
-     * @param $id
-     * @param array $pl ������ �������� �� �� priems.
-
-     * @param battleClass $btl
-     * @return void
-     */
-    private function devouringFlameInit($id, array $pl, battleClass $btl)
-    {
-        echo $pl['level'];
-        $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'], "<span style^^^^'color: $color'>{$pl['name']}</span>", $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);
-    }
-}
-
-$priem = new priems();
-
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 @@
-<?php
-if( !defined('GAME') ) {
-	die();
-}
-
-class botLogic {	
-	
-	static $bot = array(),
-		   $st	= array(),
-		   $btl = array(),
-		   $enemy = array(),
-		   $pr	= false;
-	
-	static function inuser_go_btl( $id , $txt = '' ) {
-		if(isset($id['id'])) {
-			$ctx = stream_context_create(array('https'=>
-				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.']<hr>';
-			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').' (����������� ������): <b>'.mysql_real_escape_string($t).'</b>","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 @@
-<?php
-
-if( !defined('GAME') ) {
-	die();
-}
-
-class botPriemLogic {	
-	
-	static $p = array();
-
-	static function start( $i, $id ) {
-		
-		self::$p = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "'.$id.'" LIMIT 1'));
-		
-		$test = self::testpriem( self::$p );
-		
-		if( isset(self::$p['id']) && $test == 0 ) {			
-			//���������� ����� ��� ������� $id
-				if( $id == 1	) {	self::priem1( $i );		} //���������� 1|2|3|4|5|6|7|8|9|10|11|13|14|45|47|48|49|188|204|211|217|220|223|232|235|240|0|0|0|0|0|0|0|0|0|0|0|0|0|0
-			elseif( $id == 2	) {	self::priem2( $i );		} //�������
-			elseif( $id == 3	) {	self::priem3( $i );		} //������� ����
-			elseif( $id == 4	) {	self::priem4( $i );		} //������� ����
-			elseif( $id == 5	) {	self::priem5( $i );		} //������� ���
-			elseif( $id == 6	) {	self::priem6( $i );		} //���� � ������
-			elseif( $id == 7	) {	self::priem7( $i );		} //�������� ������
-			elseif( $id == 8	) {	self::priem8( $i );		} //����� �����
-			elseif( $id == 9	) {	self::priem9( $i );		} //����� �����
-			elseif( $id == 10	) {	self::priem10( $i );	} //�����������
-			elseif( $id == 11	) {	self::priem11( $i );	} //������� ����
-			elseif( $id == 13	) {	self::priem13( $i );	} //���������
-			elseif( $id == 14	) {	self::priem14( $i );	} //������
-			elseif( $id == 45	) {	self::priem45( $i );	} //������ ������ 
-			elseif( $id == 47	) {	self::priem47( $i );	} //������ �����
-			elseif( $id == 48	) {	self::priem48( $i );	} //����� ������
-			elseif( $id == 49	) {	self::priem49( $i );	} //������ �������
-			elseif( $id == 188	) {	self::priem188( $i );	} //����� �����
-            elseif( $id == 204	) {	self::priem204( $i );	} //������������		
-			elseif( $id == 211	) {	self::priem211( $i );	} //����������� ������
-			elseif( $id == 217	) {	self::priem217( $i );	} //��������� �������
-			elseif( $id == 220	) {	self::priem220( $i );	} //������ �� ����������
-			elseif( $id == 223	) {	self::priem223( $i );	} //�����
-			elseif( $id == 232	) {	self::priem232( $i );	} //������
-			elseif( $id == 235	) {	self::priem235( $i );	} //���������� ����
-			elseif( $id == 240	) {	self::priem240( $i );	} //�������� �����
-			
-			elseif( $id >= 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'].', ��������� ����� &quot;'.self::$p['name'].'&quot; , battle: <a target=_blank href=https://new-combats.com/logs.php?log='.botLogic::$bot['battle'].'>Link</a>');
-		//}
-		
-		$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/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 @@
-<?
-if(!defined('GAME'))
-{
-	die();
-}
-
-class dialog
-{
-	public $info,$dText = '',$aText = '',$youInfo = '',$botInfo = '',$title = '',$p = 1,$pg = 1;
-	
-	public function trnObj($x,$j)
-	{
-		$r = array(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 .= '<br><b><font color=red>���-�� �� ���, �� ��� ����� ������ �������...</font>';
-									$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 .= '<br><b><font color=red>���-�� �� ���, �� ��� ��������� ������ �������...</font>';
-									$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 .= '<br><b><font color=red>���-�� �� ���, ��������� ����� �������...</font>';
-									$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 .= '<br><b><font color=red>��������� ������� &quot;'.$itmqs['name'].'&quot; (x'.$k[2].').</font>';
-									}
-									$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 .= '<br><b><font color=red>��������� ������� &quot;'.$itmqs['name'].'&quot;.</font>';
-									}
-									$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 .= '<br><b><font color=red>� ��� ��� ���� ��������� ������� &quot;'.$itmqs['name'].'&quot;.</font>';
-									}
-									$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 .= '<br><b><font color=red>� ��� ��� ���� ��������� ������� &quot;'.$itmqs['name'].'&quot;.</font>';
-									}
-									$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 .= '<br><b><font color=red>�� ������ &quot;'.$itmqs['name'].'&quot;</font>';
-										}
-									}
-									$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 = '<font color=red>� ���� ������ ����� �� �����, ����� ����� ��������!</font>';
-										$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 .= '<br><b><font color=red>����� �� ������ � ������� NPS...</b></font>';
-							}
-							$pg = $act[1];
-						}elseif( $act[0]=='dialog_act_update') {
-							$act33 = $this->dialog_act_update($act[2]);
-							if( $act33[0] == false ) {
-								if( $act33[1] == '' ) {
-									$txt .= '<br><b><font color=red>���-�� ����� �� ���...</b></font>';
-								}else{
-									$txt .= '<br><b><font color=red>'.$act33[1].'</font></b>';
-								}
-							}else{
-								$txt .= '<br><b><font color=red>'.$act33[1].'</font></b>';
-							}
-							$pg = $act[1];
-						}elseif( $act[0]=='quest_act' ) {
-							$txt .= '<br><b><font color=red>�� �������� ����� �������.</b></font>';
-							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 .= '<br><b><font color=red>�� �������� ������� &quot;'.$itmb['name'].'&quot;</font></b>';
-								}
-							}
-						}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 .= '<br><b><font color=red>��� �� ������� ����� ��� ������� &quot;'.$itmb['name'].'&quot;, ��������� '.$act1[1].' ��.';
-								}else{
-									$act1dt = '';
-									$txt .= '<br><b><font color=red>�� ������� ��������� &quot;'.$itmb['name'].'&quot;';
-									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 .= '</font></b>';
-									
-									$u->addItem($itmb['id'],$u->info['id'],$act1dt);
-									$pg = $act1[4];
-								}
-							}else{
-								$txt .= '<br><b><font color=red>��������� ���������� �������...</font></b>';
-								$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 .= '<br><b><font color=red>�� �������� ������� &quot;'.$itmqs['name'].'&quot; (x'.$act3[2].' ��.).</font></b>';
-											}else{
-												//����
-												$txt .= '<br><b><font color=red>�� �������� ��������� ������� &quot;'.$itmqs['name'].'&quot;.</font></b>';
-											}
-											$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 .= '<br><b><font color=red>'.$u->error.'.</font></b>';
-								$u->error = '';
-							} else {
-								$txt .= '<br><b><font color=red>�� ������� �������� �������, �� ������������� ������� ���������...</font></b>';	
-							}
-						} 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 '<b><font title="'.$act[1].'" color=red>�������� ������-�� �� �������...</font></b>';
-							}
-							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 = '�� �������� ������� &quot;'.$itm_nm['name'].'&quot;';
-										}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 = '�� �������� �������� ��� ����� &quot;'.$itm_nm['name'].'&quot; �� ���� 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 = '�� �������� �������� ��� ���� &quot;'.$itm_nm['name'].'&quot; �� ���� 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().'",
-													"<b>��������</b>`'.date('Y').'<br>������������ ���������� ����!",
-													"helloween_2014m1.gif",
-													"'.(time()+86400*365).'",
-													"add_m10=15|add_m11=15",
-													"1",
-													"1"
-												)');
-												$txt = '�� �������� ������ &quot;��������`'.date('Y').' ������������&quot;';
-											}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().'",
-													"<b>��������</b>`'.date('Y').'<br>������ ���������� ����!",
-													"helloween_2014m2.gif",
-													"'.(time()+86400*365).'",
-													"add_m10=15|add_m11=15",
-													"1",
-													"1"
-												)');
-												$txt = '�� �������� ������ &quot;��������`'.date('Y').' ������&quot;';
-											}
-										}
-									}
-								}else{
-									$txt = '��������� ��������� �����...';
-								}
-							}else{
-								$txt = '������������ ���� ��� ������...';
-							}
-							
-							if($txt!=''){
-								$txt = '<br><font color="red">'.$txt.'</font>';	
-							}
-							$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($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].'<br>';
-										}else{
-											$txt .= '�� ������� �������� ������� &quot;'.$cn[$i][$j]['n'].'&quot;, ���-�� �� ��� ...<br>';	
-										}
-									}
-									$j++;	
-								}
-								$i++;
-							}
-
-							if($txt!='') {
-								$txt = '<br><font color="red">'.$txt.'</font>';	
-							}
-						} 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($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].'<br>';
-										}else{
-											$txt .= '�� ������� �������� ������� &quot;'.$cn[$i][$j]['n'].'&quot;, ���-�� �� ��� ...<br>';	
-										}
-									}
-									$j++;	
-								}
-								$i++;
-							}
-
-							if($txt!='') {
-								$txt = '<br><font color="red">'.$txt.'</font>';	
-							}
-						} 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($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].'<br>';
-										}else{
-											$txt .= '�� ������� �������� ������� &quot;'.$cn[$i][$j]['n'].'&quot;, ���-�� �� ��� ...<br>';	
-										}
-									}
-									$j++;	
-								}
-								$i++;
-							}
-							
-							if( $txt == '' ) {
-								$txt = '���������� ������� 20 ������� ��� ������.';
-							}
-							
-							if($txt!='') {
-								$txt = '<br><font color="red">'.$txt.'</font>';	
-							}
-						}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 = '�� ������� �������� &quot;������������� ����&quot;';
-							}
-							
-							if( $txt == '' ) {
-								$txt = '���������� �������� ��� ������ �������...';
-							}
-
-							if($txt!='') {
-								$txt = '<br><font color="red">'.$txt.'</font>';	
-							}
-							
-						}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 = '��������� &quot;������������� ����&quot;, � ��� ��� ���...';
-							}
-							
-							//��������
-							$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].'<br>';
-										}else{
-											$txt .= '�� ������� �������� ������� &quot;'.$cn[$i][$j]['n'].'&quot;, ���-�� �� ��� ...<br>';	
-										}
-										$i = $cn[0];
-										$j = count($cn[$i][$j]);
-									}
-									$j++;	
-								}
-								$i++;
-							}
-
-							if( $txt == '' ) {
-								$txt = '� ��� �� ������� ����������� ���������...';
-							}
-
-							if($txt!='') {
-								$txt = '<br><font color="red">'.$txt.'</font>';	
-							}
-							
-						}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 = '��������� &quot;������������� ����&quot;, � ��� ��� ���...';
-							}
-							
-							//��������
-							$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].'<br>';
-										}else{
-											$txt .= '�� ������� �������� ������� &quot;'.$cn[$i][$j]['n'].'&quot;, ���-�� �� ��� ...<br>';	
-										}
-										$i = $cn[0];
-										$j = count($cn[$i][$j]);
-									}
-									$j++;	
-								}
-								$i++;
-							}
-
-							if( $txt == '' ) {
-								$txt = '� ��� �� ������� ����������� ���������...';
-							}
-
-							if($txt!='') {
-								$txt = '<br><font color="red">'.$txt.'</font>';	
-							}
-							
-						}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 = '��������� &quot;������������� ����&quot;, � ��� ��� ���...';
-							}
-							
-							//��������
-							$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].'<br>';
-											mysql_query('DELETE FROM `items_users` WHERE `id` = "'.$keypr['id'].'" LIMIT 1');
-										}else{
-											$txt .= '�� ������� �������� ������� &quot;'.$cn[$i][$j]['n'].'&quot;, ���-�� �� ��� ...<br>';	
-										}
-										$i = $cn[0];
-										$j = count($cn[$i][$j]);
-									}
-									$j++;	
-								}
-								$i++;
-							}
-
-							if( $txt == '' ) {
-								$txt = '� ��� �� ������� ����������� ���������...';
-							}
-
-							if($txt!='') {
-								$txt = '<br><font color="red">'.$txt.'</font>';	
-							}
-							
-							}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'].')<br/>';
-											$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 .= '.<br/>';
-								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 .= '.<br/>';
-								if( $qsw > 0 ) $txt .= $mess;
-							}
-							
-							if( isset($swapAct['add']) AND $swapActStatus == 2 ) { # ������ ��������. 
-								foreach($swapAct['add'] as $item) {
-									$qsw = 0;
-									while($qsw < $item['colvo']) {
-										$txt .= '<br/>�� �������� �������';
-										$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 = '<br><font color="red">'.$txt.'</font>';	
-							}
-						}
-					}
-				}
-			}
-						
-			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 .= '<br><font color="red"><b>������� ����������</b></font>';
-					}
-				}
-				
-				//����� (��� ��������)
-				$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 .= '<br><font color="red"><b>������� ����������</b></font>';
-					}
-				}
-				
-				$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.' (<a href="main.php?rnd='.$code.'">����</a>)';
-						$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'].'","<i>����� ������� ������</i>")');
-					}
-				}
-				
-				//�������� ������
-				$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 .= '<small>(<a href="javascript:window.open(\'https://new-combats.com/quest_dlg_edit.php?pid='.$pl['id'].'\',\'winEdi1\',\'width=850,height=400,top=400,left=500,resizable=no,scrollbars=yes,status=no\');" title="������������� ������� ������">���.</a>)</small> &nbsp; ';
-					}
-					if($go1 == '') {
-						$a .= '&bull; <a href="'.$pl['action'].'">'.$pl['text'].'</a><br>';
-					}elseif($go1 == 'delete') {
-						if( $u->info['admin'] > 0 ) {
-							$a .= '&bull; <a style="color:#aeaeae" href="'.$pl['action'].'">'.$pl['text'].'</a><br>';
-						}
-					}else{
-						$a .= '<font color="#9A9A9A">&bull; <b>'.$pl['text'].'</b></font> <small title="'.$go1.'"> <b style="cursor:help"><font color=red>[?]</font></b></small><br>';
-					}
-				}
-				
-				
-				if($u->info['admin'] > 0) {
-					$a .= '<small style="border-top:1px solid #BABABA;padding-top:5px;display:block;margin-top:5px;"><a href="main.php?talk='.((int)$_GET['talk']).'&act='.((int)$_GET['act']).'&add_new_qid=1">�������� ������� ������</a></small>';
-				}
-				
-				$this->dText = $qpl['text'].'<br>'.$txt;
-				$this->aText = $a;				
-			}else{
-				$this->aText = '<center>������ �� ��������, ��������� <a href="main.php?rnd='.$code.'">�����</a><br></center>';		
-			}
-		}else{
-			$this->aText = '<center>������ �� ������, ��������� <a href="main.php?rnd='.$code.'">�����</a><br><font color="white">'.((int)$id).'</font></center>';	
-		}
-	}
-	
-	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] = '� ��� ��� ������� ��������! ��������� &quot;'.$itm['name'].'&quot;';
-					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] = '<img width="60" height="60" style="display:block;" title="������ ���� ����" src="https://img.new-combats.com/i/items/w/w9.gif">';
-			$witm[2] = '<img width="60" height="40" style="display:block;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/w13.gif">';
-			$witm[3] = '<img width="60" height="60" style="display:block;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/w3.gif">';
-			$witm[4] = '<img width="60" height="80" style="display:block;" title="������ ���� �����" src="https://img.new-combats.com/i/items/w/w4.gif">';
-			$witm[7] = '<img width="60" height="40" style="display:block;" title="������ ���� ����" src="https://img.new-combats.com/i/items/w/w5.gif">';
-			$witm[8] = '<img width="60" height="20" style="display:block;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/w1.gif">';
-			$witm[9] = '<img width="60" height="20" style="display:block;" title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w2.gif">';
-			$witm[10] = '<img width="20" height="20" style="display:block;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/w6.gif">';
-			$witm[11] = '<img width="20" height="20" style="display:block;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/w6.gif">';
-			$witm[12] = '<img width="20" height="20" style="display:block;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/w6.gif">';
-			$witm[13] = '<img width="60" height="40" style="display:block;" title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w11.gif">';
-			$witm[14] = '<img width="60" height="60" style="display:block;" title="������ ���� ���" src="https://img.new-combats.com/i/items/w/w10.gif">';
-			$witm[16] = '<img width="60" height="80" style="display:block;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/w19.gif">';
-			$witm[17] = '<img width="60" height="40" style="display:block;" title="������ ���� �����" src="https://img.new-combats.com/i/items/w/w12.gif">';
-			//40-52 ���� ��� �����		
-			$witm[53] = '<img style="display:block;" title="������ ���� ������ ������" src="https://img.new-combats.com/i/items/w/w15.gif">';
-			$witm[54] = '<img style="display:block;" title="������ ���� ����� ������" src="https://img.new-combats.com/i/items/w/w15.gif">';
-			$witm[55] = '<img style="display:block;" title="������ ���� ����������� ������" src="https://img.new-combats.com/i/items/w/w15.gif">';
-			$witm[56] = '<img style="display:block;" title="������ ���� �����" src="https://img.new-combats.com/i/items/w/w20.gif">';
-			$witm[57] = '<img style="display:block;" title="������ ���� �����" src="https://img.new-combats.com/i/items/w/w20.gif">';
-			$witm[58] = '<img style="display:block;" title="������ ���� �����" src="https://img.new-combats.com/i/items/w/w20.gif">';
-			
-			$pb = '';
-			$hpmp = '??&nbsp;';
-			$eff = '';
-			$anml = '';
-			$oi = '';
-			$msl = '<img width="120" height="40" style="display:block" src="https://img.new-combats.com/i/slot_bottom.gif">';
-			$witmg = '';
-			
-			if( $bot['level'] < 0 ) {
-				$bot['level'] = '??';
-			}
-			
-			$r = '<div style="width:246px; padding:2px;" align="center"><b>'.$bot['login'].'</b> ['.$bot['level'].']<img src="https://img.new-combats.com/i/inf_.gif"></div>
-			<div style="width:240px; padding:2px; border-bottom:1px solid #666666; border-right:1px solid #666666; border-left:1px solid #FFFFFF; border-top:1px solid #FFFFFF;">
-			<div align="center"><!-- blocked -->'.$pb.'</div>
-			<table width="240" border="0" cellspacing="0" cellpadding="0">
-			  <tr>
-				<td width="60" valign="top">
-				<table width="60" height="280" border="0" cellspacing="0" cellpadding="0">
-				  <tr>
-					<td height="60">'.$witm[1].'</td>
-				  </tr>
-				  <tr>
-					<td height="40">'.$witm[2].'</td>
-				  </tr>
-				  <tr>
-					<td height="60">'.$witm[3].'</td>
-				  </tr>
-				  <tr>
-					<td height="80">'.$witm[4].'</td>
-				  </tr>
-				  <tr>
-					<td height="40">'.$witm[7].'</td>
-				  </tr>
-				</table>
-				</td>
-				<td height="280" valign="top">
-				<table width="120" height="280" border="0" cellspacing="0" cellpadding="0">
-				  <tr>
-					<td height="20" valign="top">
-					<!-- HP and MP -->
-					'.$hpmp.'
-					<!-- -->
-					</td>
-				  </tr>
-				  <tr>
-					<td valign="top">
-					<div style="position:relative;height:220px;">
-						<!-- ����� -->
-							<div style="position:absolute; width:120px; height:220px; z-index:1;"><a href="#obraz_pers"><img width="120" height="220" src="https://img.new-combats.com/i/obraz/'.$bot['sex'].'/'.$bot['obraz'].'" '.$oi.'></a></div>
-							<div style="position:absolute; width:120px; height:220px; z-index:3;" align="left">'.$eff.'</div>'.$anml.'
-					</div>
-					</td>
-				  </tr>
-				  <tr>
-					<td height="40"><div align="center">'.$msl.'</div></td>
-				  </tr>
-				</table>
-				</td>
-				<td width="60" valign="top">
-				<table width="60" border="0" cellspacing="0" cellpadding="0">
-				  <tr>
-					<td height="20">'.$witm[8].'</td>
-				  </tr>
-				  <tr>
-					<td height="20">'.$witm[9].'</td>
-				  </tr>
-				  <tr>
-					<td height="20"><table width="60" border="0" cellspacing="0" cellpadding="0">
-						<tr>
-						  <td width="20" height="20">'.$witm[10].'</td>
-						  <td width="20">'.$witm[11].'</td>
-						  <td width="20">'.$witm[12].'</td>
-						</tr>
-					</table></td>
-				  </tr>
-				  <tr>
-					<td height="40">'.$witm[13].'</td>
-				  </tr>
-				  <tr>
-					<td height="60">'.$witm[14].'</td>
-				  </tr>
-				  <tr>
-					<td height="80">'.$witm[16].'</td>
-				  </tr>
-				  <tr>
-					<td height="40">'.$witm[17].'</td>
-				  </tr>
-				</table>
-				</td>
-			  </tr>
-			</table>'.$witmg.'
-			</div>';
-		}else{
-			$r = 'No information';	
-		}
-		return $r;
-	}
-}
-
-$dialog = new dialog;
-?>
\ No newline at end of file
diff --git a/_incl_data/class/dnaction/_dungeon_replace.php.bac b/_incl_data/class/dnaction/_dungeon_replace.php.bac
deleted file mode 100644
index d9453e6a..00000000
--- a/_incl_data/class/dnaction/_dungeon_replace.php.bac
+++ /dev/null
@@ -1,504 +0,0 @@
-<?php
-if(!defined('GAME')) { die(); }
-
-if($_GET['go_away']) { header('location: main.php'); die(); }
-if($u->info['battle'] != 0) { header('location: main.php'); die(); }
-
-if(isset($_POST['clip76_'])) {
-  $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4677" LIMIT 1'));
-  if($u->count_items(877, $u->info['id'], 1) > 0) {
-    if($u->count_items(882, $u->info['id'], 1) > 0) {
-      if($u->count_items(902, $u->info['id'], 1) > 0) {
-        if($u->count_items(903, $u->info['id'], 1) > 0) {
-          if($u->count_items(881, $u->info['id'], 1) > 0) {
-            if($u->count_items(878, $u->info['id'], 1) > 0) {
-                $data = '|frompisher=12';
-                $u->addItem(4677, $u->info['id'], $data, $obj);
-                $u->deleteItemID(877, $u->info['id'], 1);
-                $u->deleteItemID(882, $u->info['id'], 1);
-                $u->deleteItemID(902, $u->info['id'], 1);
-                $u->deleteItemID(903, $u->info['id'], 1);
-                $u->deleteItemID(881, $u->info['id'], 1);
-                $u->deleteItemID(878, $u->info['id'], 1);
-                $err = '�� �������� ������ �����';
-            } else {
-              $err = "�� ������� �������� &quot;�������� �����&quot;"; 
-            }
-          } else {
-            $err = "�� ������� �������� &quot;�������� �����&quot;"; 
-          }
-        } else {
-          $err = "�� ������� �������� &quot;������������ ������&quot;"; 
-        }
-      } else {
-        $err = "�� ������� �������� &quot;���� �������� ������&quot;"; 
-      }
-    } else {
-      $err = "�� ������� �������� &quot;��������� ������&quot;"; 
-    }
-  } else {
-    $err = "�� ������� �������� &quot;�����&quot;";
-  }
-} elseif(isset($_POST['clip80_'])) {
-  $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4758" LIMIT 1'));
-  if($u->count_items(950, $u->info['id'], 1) > 0) {
-    if($u->count_items(907, $u->info['id'], 1) > 0) {
-      if($u->count_items(902, $u->info['id'], 1) > 0) {
-        if($u->count_items(878, $u->info['id'], 1) > 0) {
-          if($u->count_items(905, $u->info['id'], 1) > 0) {
-            if($u->count_items(903, $u->info['id'], 1) > 0) {
-                $data = '|frompisher=12';
-                $u->addItem(4758, $u->info['id'], $data, $obj);
-                $u->deleteItemID(950, $u->info['id'], 1);
-                $u->deleteItemID(907, $u->info['id'], 1);
-                $u->deleteItemID(902, $u->info['id'], 1);
-                $u->deleteItemID(878, $u->info['id'], 1);
-                $u->deleteItemID(905, $u->info['id'], 1);
-                $u->deleteItemID(903, $u->info['id'], 1);
-                $u->deleteItemID(905, $u->info['id'], 1);
-                $err = '�� �������� �������������';
-            } else {
-              $err = "�� ������� �������� &quot;�������� ���������� �����&quot;"; 
-            }
-          } else {
-            $err = "�� ������� �������� &quot;����� ���&quot;"; 
-          }
-        } else {
-          $err = "�� ������� �������� &quot;������ ���������� ������&quot;"; 
-        }
-      } else {
-        $err = "�� ������� �������� &quot;�������� ������ �������&quot;"; 
-      }
-    } else {
-      $err = "�� ������� �������� &quot;������� �����&quot;"; 
-    }
-  } else {
-    $err = "�� ������� �������� &quot;�������� �������&quot;";
-  }
-} elseif(isset($_POST['clip81_'])) {
-  $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4679" LIMIT 1'));
-  if($u->count_items(906, $u->info['id'], 1) > 0) {
-    if($u->count_items(907, $u->info['id'], 1) > 0) {
-      $data = '|frompisher=12';
-      $u->addItem(4679, $u->info['id'], $data, $obj);
-      $u->deleteItemID(906, $u->info['id'], 1);
-      $u->deleteItemID(907, $u->info['id'], 1);
-      $err = '�� �������� ��������� ��������� �����';
-    } else {
-      $err = "�� ������� �������� &quot;�������� ������������&quot;";
-    }
-  } else {
-    $err = "�� ������� �������� &quot;�������� ������ �������&quot;";
-  }
-} elseif(isset($_POST['clip82_'])) {
-  $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4680" LIMIT 1'));
-  if($u->count_items(877, $u->info['id'], 1) > 0) {
-    if($u->count_items(890, $u->info['id'], 1) > 0) {
-      if($u->count_items(902, $u->info['id'], 1) > 0) {
-        if($u->count_items(903, $u->info['id'], 1) > 0) {
-          if($u->count_items(888, $u->info['id'], 1) > 0) {
-            $data = '|frompisher=12';
-            $u->addItem(4680, $u->info['id'], $data, $obj);
-            $u->deleteItemID(877, $u->info['id'], 1);
-            $u->deleteItemID(890, $u->info['id'], 1);
-            $u->deleteItemID(902, $u->info['id'], 1);
-            $u->deleteItemID(903, $u->info['id'], 1);
-            $u->deleteItemID(888, $u->info['id'], 1);
-            $err = '�� �������� ��������� ���������� �����';
-          } else {
-            $err = "�� ������� �������� &quot;����� ���&quot;"; 
-          }
-        } else {
-          $err = "�� ������� �������� &quot;������������ ������&quot;"; 
-        }
-      } else {
-        $err = "�� ������� �������� &quot;���� �������� ������&quot;"; 
-      }
-    } else {
-      $err = "�� ������� �������� &quot;������� �������&quot;"; 
-    }
-  } else {
-    $err = "�� ������� �������� &quot;�����&quot;";
-  }
-} elseif(isset($_POST['clip89_'])) {
-  $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4681" LIMIT 1'));
-  if($u->count_items(900, $u->info['id'], 1) > 0) {
-    if($u->count_items(882, $u->info['id'], 1) > 0) {
-      if($u->count_items(903, $u->info['id'], 1) > 0) {
-        if($u->count_items(904, $u->info['id'], 1) > 0) {
-          if($u->count_items(908, $u->info['id'], 1) > 0) {
-            $data = '|frompisher=12';
-            $u->addItem(4681, $u->info['id'], $data, $obj);
-            $u->deleteItemID(900, $u->info['id'], 1);
-            $u->deleteItemID(882, $u->info['id'], 1);
-            $u->deleteItemID(903, $u->info['id'], 1);
-            $u->deleteItemID(904, $u->info['id'], 1);
-            $u->deleteItemID(908, $u->info['id'], 1);
-            $err = '�� �������� ��������� ����������� ����';
-          } else {
-            $err = "�� ������� �������� &quot;������ ���������� ������&quot;"; 
-          }
-        } else {
-          $err = "�� ������� �������� &quot;�������� ������&quot;"; 
-        }
-      } else {
-        $err = "�� ������� �������� &quot;������������ ������&quot;"; 
-      }
-    } else {
-      $err = "�� ������� �������� &quot;��������� ������&quot;"; 
-    }
-  } else {
-    $err = "�� ������� �������� &quot;���� �������� ������&quot;";
-  }
-} elseif(isset($_POST['clip90_'])) {
-  $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4682" LIMIT 1'));
-  if($u->count_items(950, $u->info['id'], 1) > 0) {
-    if($u->count_items(889, $u->info['id'], 1) > 0) {
-      if($u->count_items(902, $u->info['id'], 1) > 0) {
-        if($u->count_items(903, $u->info['id'], 1) > 0) {
-          if($u->count_items(878, $u->info['id'], 1) > 0) {
-            $data = '|frompisher=12';
-            $u->addItem(4682, $u->info['id'], $data, $obj);
-            $u->deleteItemID(950, $u->info['id'], 1);
-            $u->deleteItemID(889, $u->info['id'], 1);
-            $u->deleteItemID(902, $u->info['id'], 1);
-            $u->deleteItemID(906, $u->info['id'], 1);
-            $u->deleteItemID(878, $u->info['id'], 1);
-            $err = '�� �������� ��������� ���������� ����';
-          } else {
-            $err = "�� ������� �������� &quot;�������� �����&quot;"; 
-          }
-        } else {
-          $err = "�� ������� �������� &quot;������������ ������&quot;"; 
-        }
-      } else {
-        $err = "�� ������� �������� &quot;���� �������� ������&quot;"; 
-      }
-    } else {
-      $err = "�� ������� �������� &quot;������� �����&quot;"; 
-    }
-  } else {
-    $err = "�� ������� �������� &quot;���� ������ �����&quot;";
-  }
-} elseif(isset($_POST['clip91_'])) {
-  $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4683" LIMIT 1'));
-  if($u->count_items(907, $u->info['id'], 1) > 0) {
-    if($u->count_items(881, $u->info['id'], 1) > 0) {
-      if($u->count_items(905, $u->info['id'], 1) > 0) {
-        $data = '|frompisher=12';
-        $u->addItem(4683, $u->info['id'], $data, $obj);
-        $u->deleteItemID(907, $u->info['id'], 1);
-        $u->deleteItemID(881, $u->info['id'], 1);
-        $u->deleteItemID(905, $u->info['id'], 1);
-        $err = '�� �������� ��������� ������� ���������';
-      } else {
-        $err = "�� ������� �������� &quot;���������&quot;";
-      }
-    } else {
-      $err = "�� ������� �������� &quot;�������� �����&quot;";
-    }
-  } else {
-    $err = "�� ������� �������� &quot;�������� ������������&quot;";
-  }
-} elseif(isset($_POST['clip92_'])) {
-  $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4684" LIMIT 1'));
-  if($u->count_items(907, $u->info['id'], 1) > 0) {
-    if($u->count_items(881, $u->info['id'], 1) > 0) {
-      if($u->count_items(905, $u->info['id'], 1) > 0) {
-        $data = '|frompisher=12';
-        $u->addItem(4684, $u->info['id'], $data, $obj);
-        $u->deleteItemID(907, $u->info['id'], 1);
-        $u->deleteItemID(881, $u->info['id'], 1);
-        $u->deleteItemID(905, $u->info['id'], 1);
-        $err = '�� �������� ��������� ����������';
-      } else {
-        $err = "�� ������� �������� &quot;���������&quot;";
-      }
-    } else {
-      $err = "�� ������� �������� &quot;�������� �����&quot;";
-    }
-  } else {
-    $err = "�� ������� �������� &quot;�������� ������������&quot;";
-  }
-} elseif(isset($_POST['clip93_'])) {
-  $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4685" LIMIT 1'));
-  if($u->count_items(901, $u->info['id'], 1) > 0) {
-    if($u->count_items(889, $u->info['id'], 1) > 0) {
-      if($u->count_items(890, $u->info['id'], 1) > 0) {
-        $data = '|frompisher=12';
-        $u->addItem(4685, $u->info['id'], $data, $obj);
-        $u->deleteItemID(901, $u->info['id'], 1);
-        $u->deleteItemID(889, $u->info['id'], 1);
-        $u->deleteItemID(890, $u->info['id'], 1);
-        $err = '�� �������� ���������� ������: ����������� ���� [1]';
-      } else {
-        $err = "�� ������� �������� &quot;������� �������&quot;";
-      }
-    } else {
-      $err = "�� ������� �������� &quot;������� �����&quot;";
-    }
-  } else {
-    $err = "�� ������� �������� &quot;�������� ������ �������&quot;";
-  }
-} elseif(isset($_POST['clip94_'])) {
-  $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4686" LIMIT 1'));
-  if($u->count_items(4685, $u->info['id'], 1) > 0) {
-    if($u->count_items(4688, $u->info['id'], 1) > 0) {
-      if($u->count_items(4689, $u->info['id'], 1) > 0) {
-        if($u->count_items(4690, $u->info['id'], 1) > 0) {
-          $data = '|frompisher=12';
-          $u->addItem(4686, $u->info['id'], $data, $obj);
-          $u->deleteItemID(4685, $u->info['id'], 1);
-          $u->deleteItemID(4688, $u->info['id'], 1);
-          $u->deleteItemID(4689, $u->info['id'], 1);
-          $u->deleteItemID(4690, $u->info['id'], 1);
-          $err = '�� �������� ���������� ������: ����������� ���� [2]';
-        } else {
-          $err = "�� ������� �������� &quot;���������� ��� �������&quot;";
-        }
-      } else {
-        $err = "�� ������� �������� &quot;������ ��� �������&quot;";
-      }
-    } else {
-      $err = "�� ������� �������� &quot;������� ��� �������&quot;";
-    }
-  } else {
-    $err = "�� ������� �������� &quot;���������� ������: ����������� ���� [1]&quot;";
-  }
-}
-
-
-function getColor($id, $num) {
-  global $u;
-  $color = 'green';
-  $ch = mysql_query("SELECT `id` FROM `items_users` WHERE `uid` = ".$u->info['id']." AND `delete` = 0 AND `item_id` = ".(int)$id." AND inShop = 0 AND inOdet = 0");
-  if(mysql_num_rows($ch) < $num) { $color = 'red'; }
-  return $color;
-}
-
-function getImg($id, $num) {
-  global $u;
-  $img = 'good.png';
-  $ch = mysql_query("SELECT `id` FROM `items_users` WHERE `uid` = ".$u->info['id']." AND `delete` = 0 AND `item_id` = ".(int)$id." AND inShop = 0 AND inOdet = 0");
-  if(mysql_num_rows($ch) < $num) { $img = 'i/clear.gif'; }
-  return $img;
-}
-
-?>
-<html>
-<head>
-<link rel="stylesheet" type="text/css" href="https://img.new-combats.com/css/main.css" />
-<meta content="text/html; charset=windows-1251" http-equiv="Content-type" />
-<meta http-equiv="Cache-Control" content="no-cache, max-age=0, must-revalidate, no-store" />
-<meta http-equiv="PRAGMA" content="NO-CACHE" />
-<meta http-equiv="Expires" content="0" />
-<style>
-.row { cursor:pointer; }      
-#answer1 {color: #003388; font-weight: bold; text-decoration: none; }
-</style>
-<script type="text/javascript">
-function show(ele) {
-  var srcElement = document.getElementById(ele);
-  if(srcElement != null) {
-    if(srcElement.style.display == "block") {
-      srcElement.style.display= 'none';
-    } else {
-      srcElement.style.display='block';
-    }
-  }
-}
-
-function OpenDiv(vr) {
-  var dg01 = document.getElementById(vr);
-  if(dg01.style.display == '') {
-    dg01.style.display = 'none'
-  } else {
-    dg01.style.display = ''
-  }
-}
-</script>
-<script type="text/javascript" src="https://img.new-combats.com/js/inf.0.104.js?<?=mt_rand(1436,1293286936)/10000000000?>" charset="utf-8"></script>
-</head>
-<body leftmargin=5 topmargin=5 marginwidth=5 marginheight=5  bgcolor="#d7d7d7" onLoad="">
-<div id=hint4 class=ahint></div>
-<TABLE cellspacing=0 cellpadding=2 width=100%>
-<TD style="width: 40%; vertical-align: top; ">
-<TABLE cellspacing=0 cellpadding=2 style="width: 100%; ">
-<tr><TD align=center><h4>���������� ������� ��������</h4></TD></tr>
-<TR>
-</TABLE>
-</TD>
-<TD style="width: 5%; vertical-align: top; ">&nbsp;</TD>
-</TR>
-</TABLE>
-</html>
-<? if($err != '') { echo "<center><b style='color: Red;'>".$err."</b></center>"; } ?>
-<table width="100%">
-<tr>
-<td width="255" valign="top"><div align="left"><? $st = array(); $st2 = array(); $st = $u->getStats($u->info['id'],1); $st2 = $st[1]; $st = $st[0]; $rgd = $u->regen($u->info['id'],$st,1); $us = $u->getInfoPers($u->info['id'],1,$st); if($us!=false){ echo $us[0]; }else{ echo 'information is lost.'; } ?></div>
-<div align="left"></div><div align="left"></div>
-<div style="float: left">
-<td valign="top"><br />
-<div id="step1" style="margin-left: 20px;"></div>
-<br /><br />
-<table>
-<tr>
-<td>
-<div id="answer1">
-� <a href="#" onclick="OpenDiv('clip76')">������ ����� <img src="https://img.new-combats.com/i/items/spell_curse.gif"></a><br />
-<div id="clip76" style="display: none; color: black;">
- <p style="color:<?=getColor(877, 1)?>"> C���� <img src="https://img.new-combats.com/<?=getImg(877, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(882, 1)?>"> ��������� ������ <img src="https://img.new-combats.com/<?=getImg(882, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(902, 1)?>"> ���� �������� ������ <img src="https://img.new-combats.com/<?=getImg(902, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(903, 1)?>"> ������������ ������ <img src="https://img.new-combats.com/<?=getImg(903, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(881, 1)?>"> �������� ����� <img src="https://img.new-combats.com/<?=getImg(881, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(878, 1)?>"> �������� ����� <img src="https://img.new-combats.com/<?=getImg(878, 1)?>" width="13" height="13" /></p>
-<form action="" method="POST">
-<input type="submit" name="clip76_" value="�������" />
-</form>
-</div>
-    
-� <a href="#" onclick="OpenDiv('clip80')">������������� <img src="https://img.new-combats.com/i/items/d_blat24.gif"></a><br />
-<div id="clip80" style="display: none; color: black;">
- <p style="color:<?=getColor(950, 1)?>"> ���� ������ ����� <img src="https://img.new-combats.com/<?=getImg(950, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(907, 1)?>"> �������� ������������ <img src="https://img.new-combats.com/<?=getImg(907, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(902, 1)?>"> ���� �������� ������ <img src="https://img.new-combats.com/<?=getImg(902, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(878, 1)?>"> �������� ����� <img src="https://img.new-combats.com/<?=getImg(878, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(905, 1)?>"> ��������� <img src="https://img.new-combats.com/<?=getImg(905, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(903, 1)?>"> ������������ ������ <img src="https://img.new-combats.com/<?=getImg(903, 1)?>" width="13" height="13" /></p>
-<form action="" method="POST">
-<input type="submit" name="clip80_" value="�������" />
-</form>
-</div>
-
-� <a href="#" onclick="OpenDiv('clip81')">��������� ��������� ����� <img src="https://img.new-combats.com/i/items/m_ptp_1.gif"></a><br />
-<div id="clip81"  style="display: none; color: black;">
- <p style="color:<?=getColor(906, 1)?>"> �������� ������ ������� <img src="https://img.new-combats.com/<?=getImg(906, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(907, 1)?>"> �������� ������������ <img src="https://img.new-combats.com/<?=getImg(907, 1)?>" width="13" height="13" /></p>
-<form action="" method="POST">
-<input type="submit" name="clip81_" value="�������" />
-</form>
-</div>
-
-� <a href="#" onclick="OpenDiv('clip82')">��������� ���������� ����� <img src="https://img.new-combats.com/i/items/m_ptp_2.gif"></a><br />
-<div id="clip82" style="display: none; color: black;">
- <p style="color:<?=getColor(877, 1)?>"> ����� <img src="https://img.new-combats.com/<?=getImg(877, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(890, 1)?>"> ������� ������� <img src="https://img.new-combats.com/<?=getImg(890, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(902, 1)?>"> ���� �������� ������ <img src="https://img.new-combats.com/<?=getImg(902, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(903, 1)?>"> ������������ ������ <img src="https://img.new-combats.com/<?=getImg(903, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(888, 1)?>"> ����� ��� <img src="https://img.new-combats.com/<?=getImg(888, 1)?>" width="13" height="13" /></p>
-<form action="" method="POST">
-<input type="submit" name="clip82_" value="�������" />
-</form>
-</div>
-
-� <a href="#" onclick="OpenDiv('clip89')">��������� ����������� ���� <img src="https://img.new-combats.com/i/items/m_ptp_3.gif"></a><br />
-<div id="clip89" style="display: none; color: black;">
- <p style="color:<?=getColor(900, 1)?>"> ���� �������� ������ <img src="https://img.new-combats.com/<?=getImg(900, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(882, 1)?>"> ��������� ������ <img src="https://img.new-combats.com/<?=getImg(882, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(903, 1)?>"> ������������ ������ <img src="https://img.new-combats.com/<?=getImg(903, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(904, 1)?>"> �������� ������ <img src="https://img.new-combats.com/<?=getImg(904, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(908, 1)?>"> ������ ���������� ������ <img src="https://img.new-combats.com/<?=getImg(908, 1)?>" width="13" height="13" /></p>
-<form action="" method="POST">
- <input type="submit" name="clip89_" value="�������" />
-</form>
-</div>
-
-� <a href="#" onclick="OpenDiv('clip90')">��������� ���������� ���� <img src="https://img.new-combats.com/i/items/m_ptp_4.gif"></a><br />
-<div id="clip90" style="display: none; color: black;">
- <p style="color:<?=getColor(950, 1)?>"> ���� ������ ����� <img src="https://img.new-combats.com/<?=getImg(950, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(889, 1)?>"> ������� ����� <img src="https://img.new-combats.com/<?=getImg(889, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(902, 1)?>"> ���� �������� ������ <img src="https://img.new-combats.com/<?=getImg(902, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(903, 1)?>"> ������������ ������ <img src="https://img.new-combats.com/<?=getImg(903, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(878, 1)?>"> �������� ����� <img src="https://img.new-combats.com/<?=getImg(878, 1)?>" width="13" height="13" /></p>
-<form action="" method="POST">
-<input type="submit" name="clip90_" value="�������" />
-</form>
-</div>
-
-� <a href="#" onclick="OpenDiv('clip91')">��������� ������� ��������� <img src="https://img.new-combats.com/i/items/m_ptp_5.gif"></a><br />
-<div id="clip91" style="display: none; color: black;">
- <p style="color:<?=getColor(907, 1)?>"> �������� ������������ <img src="https://img.new-combats.com/<?=getImg(907, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(881, 1)?>"> �������� ����� <img src="https://img.new-combats.com/<?=getImg(881, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(905, 1)?>"> ��������� <img src="https://img.new-combats.com/<?=getImg(905, 1)?>" width="13" height="13" /></p>
-<form action="" method="POST">
-<input type="submit" name="clip91_" value="�������" />
-</form>
-</div>
-
-
-� <a href="#" onclick="OpenDiv('clip92')">��������� ���������� <img src="https://img.new-combats.com/i/items/m_ptp_6.gif"></a><br />
-<div id="clip92" style="display: none; color: black;">
- <p style="color:<?=getColor(907, 1)?>"> �������� ������������ <img src="https://img.new-combats.com/<?=getImg(907, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(881, 1)?>"> �������� ����� <img src="https://img.new-combats.com/<?=getImg(881, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(905, 1)?>"> ��������� <img src="https://img.new-combats.com/<?=getImg(905, 1)?>" width="13" height="13" /></p>
-<form action="" method="POST">
-<input type="submit" name="clip92_" value="�������" />
-</form>
-</div>
-
-
-� <a href="#" onclick="OpenDiv('clip93')">���������� ������: ����������� ���� [1] <img src="https://img.new-combats.com/i/items/enhp_6_revamp10.gif"></a><br />
-<div id="clip93" style="display: none; color: black;">
- <p style="color:<?=getColor(901, 1)?>"> �������� ������ ������� <img src="https://img.new-combats.com/<?=getImg(901, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(889, 1)?>"> ������� ����� <img src="https://img.new-combats.com/<?=getImg(889, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(890, 1)?>"> ������� ������� <img src="https://img.new-combats.com/<?=getImg(890, 1)?>" width="13" height="13" /></p>
-<form action="" method="POST">
-<input type="submit" name="clip93_" value="�������" />
-</form>
-</div>
-
-
-� <a href="#" onclick="OpenDiv('clip94')">���������� ������: ����������� ���� [2] <img src="https://img.new-combats.com/i/items/enhp_6_revamp10_2.gif"></a><br />
-<div id="clip94" style="display: none; color: black;">
- <p style="color:<?=getColor(4685, 1)?>"> ���������� ������: ����������� ���� [1] <img src="https://img.new-combats.com/<?=getImg(4685, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(4688, 1)?>"> ������� ��� ������� <img src="https://img.new-combats.com/<?=getImg(4688, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(4689, 1)?>"> ������ ��� ������� <img src="https://img.new-combats.com/<?=getImg(4689, 1)?>" width="13" height="13" /></p>
- <p style="color:<?=getColor(4690, 1)?>"> ���������� ��� ������� <img src="https://img.new-combats.com/<?=getImg(4690, 1)?>" width="13" height="13" /></p>
-<form action="" method="POST">
-<input type="submit" name="clip94_" value="�������" />
-</form>
-</div>
-  <br> 
-� <a href="?go_away=1">����. (�����)</a>
-
-</div>
-                            </td>
-                        </tr>
-                    </table>
-                </td>
-            </div>
-            <div style="float:left">
-
-                <td  width="120">
-                    <table width="100" border="0" cellspacing="0" cellpadding="0">
-                        <tr>
-                            <td>
-                                <TABLE  border=0 cellSpacing=1 cellPadding=0 width="100%">
-                                    <TBODY>
-                                    <TR vAlign=top>
-                                        <TD>
-                                            <TABLE border=0 cellSpacing=0 cellPadding=0 width="100%">
-                                                <TBODY>
-                                                </TBODY></TABLE></TD>
-                                        <TD><TABLE border=0 cellSpacing=0 cellPadding=0 width="100%"><TBODY>
-
-                                        </TBODY></TABLE></TD></TR></TBODY></TABLE></TD>
-                            </td>
-                        </tr>
-                    </table>
-                </td>
-
-</tr>
-</table>
-</div>
-<TABLE width=100% align="right">
-    <tr><td>
-        <br />
-        <br />
-        <br />
-
-    </TD></tr>
-</TABLE>
-</body>
-</html>
\ No newline at end of file
diff --git a/_incl_data/class/magic/Elemental/Fire.php b/_incl_data/class/magic/Elemental/Fire.php
index 8483dd29..179e79b0 100644
--- a/_incl_data/class/magic/Elemental/Fire.php
+++ b/_incl_data/class/magic/Elemental/Fire.php
@@ -2,7 +2,7 @@
 
 namespace Magic\Elemental;
 
-use battleClass;
+use Battle;
 use Insallah\Math;
 
 class Fire
@@ -11,7 +11,7 @@ class Fire
     private $color = '#a00';
     private $colorCrit = '#f00';
     private $colorMiss = '#909090';
-    public function __construct(battleClass $btl)
+    public function __construct(Battle $btl)
     {
         $this->btl = $btl;
     }
diff --git a/_incl_data/class/magic/addrep.php b/_incl_data/class/magic/addrep.php
index a1539f13..6fe78e90 100644
--- a/_incl_data/class/magic/addrep.php
+++ b/_incl_data/class/magic/addrep.php
@@ -1,180 +1,180 @@
-<?

-if(!defined('GAME'))

-{

-	die();

-}

-if( $u->info['twink'] != 0 ) 

-	{

-		$u->error = '���������� ������������ &quot;'.$itm['name'].'&quot;. ������� �� ��������� ���������!';

-	}

-elseif( $u->info['activ'] != 0 ) 

-	{

-		$u->error = '���������� ������������ &quot;'.$itm['name'].'&quot;. ����������� ��������� ����� E-mail!';

-	}

-elseif( $itm['id'] > 0 && $itm['item_id']==10006 ) 

-	{

-	    $repc='repcapitalcity';

-		if ($u->rep[$repc]<25000)

-			{

-				$st['expUpg'] += 0;

-				$u->rep[$repc] += $st['expUpg'];

-				if ($u->rep[$repc]>25000)

-					{

-						$u->rep[$repc]=25000;

-					}

-				$u->error = '�� ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ���������� �� '.$st['expUpg'].' ��.!';

-				//mysql_query('UPDATE `stats` SET `exp` = "'.$u->info['exp'].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');

-				mysql_query('UPDATE `rep` SET `'.$repc.'` = "'.$u->rep[$repc].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');

-				

-				mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');

-			}

-		else

-			{

-				$u->error = '�� �� ������ ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ������ ������� 25000 ��.!';

-			}

-	}
-	
-	
-elseif( $itm['id'] > 0 && $itm['item_id']==10007 ) 
-	{
-	    $repc='repsandcity';
-		if ($u->rep[$repc]<25000)
-			{
-				$st['expUpg'] += 0;
-				$u->rep[$repc] += $st['expUpg'];
-				if ($u->rep[$repc]>25000)
-					{
-						$u->rep[$repc]=25000;
-					}
-				$u->error = '�� ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ���������� �� '.$st['expUpg'].' ��.!';
-				//mysql_query('UPDATE `stats` SET `exp` = "'.$u->info['exp'].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');
-				mysql_query('UPDATE `rep` SET `'.$repc.'` = "'.$u->rep[$repc].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');
-				
-				mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
-			}
-		else
-			{
-				$u->error = '�� �� ������ ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ������ ������� 25000 ��.!';
-			}
-	}

-
-elseif( $itm['id'] > 0 && $itm['item_id']==10008 ) 
-	{
-	    $repc='repemeraldscity';
-		if ($u->rep[$repc]<25000)
-			{
-				$st['expUpg'] += 0;
-				$u->rep[$repc] += $st['expUpg'];
-				if ($u->rep[$repc]>25000)
-					{
-						$u->rep[$repc]=25000;
-					}
-				$u->error = '�� ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ���������� �� '.$st['expUpg'].' ��.!';
-				//mysql_query('UPDATE `stats` SET `exp` = "'.$u->info['exp'].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');
-				mysql_query('UPDATE `rep` SET `'.$repc.'` = "'.$u->rep[$repc].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');
-				
-				mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
-			}
-		else
-			{
-				$u->error = '�� �� ������ ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ������ ������� 25000 ��.!';
-			}
-	}

-	

-elseif( $itm['id'] > 0 && $itm['item_id']==10009 ) 

-	{

-	    $repc='repabandonedplain';

-		if ($u->rep[$repc]<25000)

-			{

-				$st['expUpg'] += 0;

-				$u->rep[$repc] += $st['expUpg'];

-				if ($u->rep[$repc]>25000)

-					{

-						$u->rep[$repc]=25000;

-					}

-				$u->error = '�� ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ���������� �� '.$st['expUpg'].' ��.!';

-				//mysql_query('UPDATE `stats` SET `exp` = "'.$u->info['exp'].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');

-				mysql_query('UPDATE `rep` SET `'.$repc.'` = "'.$u->rep[$repc].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');

-				

-				mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');

-			}

-		else

-			{

-				$u->error = '�� �� ������ ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ������ ������� 25000 ��.!';

-			}

-	}

-

-elseif( $itm['id'] > 0 && $itm['item_id']==10010 ) 

-	{

-	    $repc='repangelscity';

-		if ($u->rep[$repc]<25000)

-			{

-				$st['expUpg'] += 0;

-				$u->rep[$repc] += $st['expUpg'];

-				if ($u->rep[$repc]>25000)

-					{

-						$u->rep[$repc]=25000;

-					}

-				$u->error = '�� ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ���������� �� '.$st['expUpg'].' ��.!';

-				//mysql_query('UPDATE `stats` SET `exp` = "'.$u->info['exp'].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');

-				mysql_query('UPDATE `rep` SET `'.$repc.'` = "'.$u->rep[$repc].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');

-				

-				mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');

-			}

-		else

-			{

-				$u->error = '�� �� ������ ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ������ ������� 25000 ��.!';

-			}

-	}

-

-elseif( $itm['id'] > 0 && $itm['item_id']==10011 ) 

-	{

-	    $repc='repdemonscity';

-		if ($u->rep[$repc]<25000)

-			{

-				$st['expUpg'] += 0;

-				$u->rep[$repc] += $st['expUpg'];

-				if ($u->rep[$repc]>25000)

-					{

-						$u->rep[$repc]=25000;

-					}

-				$u->error = '�� ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ���������� �� '.$st['expUpg'].' ��.!';

-				//mysql_query('UPDATE `stats` SET `exp` = "'.$u->info['exp'].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');

-				mysql_query('UPDATE `rep` SET `'.$repc.'` = "'.$u->rep[$repc].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');

-				

-				mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');

-			}

-		else

-			{

-				$u->error = '�� �� ������ ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ������ ������� 25000 ��.!';

-			}

-	}

-	

-	

-elseif( $itm['id'] > 0 && $itm['item_id']==10012 ) 

-	{

-	    $repc='repsuncity';

-		if ($u->rep[$repc]<25000)

-			{

-				$st['expUpg'] += 0;

-				$u->rep[$repc] += $st['expUpg'];

-				if ($u->rep[$repc]>25000)

-					{

-						$u->rep[$repc]=25000;

-					}

-				$u->error = '�� ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ���������� �� '.$st['expUpg'].' ��.!';

-				//mysql_query('UPDATE `stats` SET `exp` = "'.$u->info['exp'].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');

-				mysql_query('UPDATE `rep` SET `'.$repc.'` = "'.$u->rep[$repc].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');

-				

-				mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');

-			}

-		else

-			{

-				$u->error = '�� �� ������ ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ������ ������� 25000 ��.!';

-			}

-	}

-

-	

-

-
+<?
+if(!defined('GAME'))
+{
+	die();
+}
+if( $u->info['twink'] != 0 ) 
+	{
+		$u->error = '���������� ������������ &quot;'.$itm['name'].'&quot;. ������� �� ��������� ���������!';
+	}
+elseif( $u->info['activ'] != 0 ) 
+	{
+		$u->error = '���������� ������������ &quot;'.$itm['name'].'&quot;. ����������� ��������� ����� E-mail!';
+	}
+elseif( $itm['id'] > 0 && $itm['item_id']==10006 ) 
+	{
+	    $repc='repcapitalcity';
+		if ($u->rep[$repc]<25000)
+			{
+				$st['expUpg'] += 0;
+				$u->rep[$repc] += $st['expUpg'];
+				if ($u->rep[$repc]>25000)
+					{
+						$u->rep[$repc]=25000;
+					}
+				$u->error = '�� ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ���������� �� '.$st['expUpg'].' ��.!';
+				//mysql_query('UPDATE `stats` SET `exp` = "'.$u->info['exp'].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');
+				mysql_query('UPDATE `rep` SET `'.$repc.'` = "'.$u->rep[$repc].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');
+				
+				mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
+			}
+		else
+			{
+				$u->error = '�� �� ������ ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ������ ������� 25000 ��.!';
+			}
+	}
+	
+	
+elseif( $itm['id'] > 0 && $itm['item_id']==10007 ) 
+	{
+	    $repc='repsandcity';
+		if ($u->rep[$repc]<25000)
+			{
+				$st['expUpg'] += 0;
+				$u->rep[$repc] += $st['expUpg'];
+				if ($u->rep[$repc]>25000)
+					{
+						$u->rep[$repc]=25000;
+					}
+				$u->error = '�� ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ���������� �� '.$st['expUpg'].' ��.!';
+				//mysql_query('UPDATE `stats` SET `exp` = "'.$u->info['exp'].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');
+				mysql_query('UPDATE `rep` SET `'.$repc.'` = "'.$u->rep[$repc].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');
+				
+				mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
+			}
+		else
+			{
+				$u->error = '�� �� ������ ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ������ ������� 25000 ��.!';
+			}
+	}
+
+elseif( $itm['id'] > 0 && $itm['item_id']==10008 ) 
+	{
+	    $repc='repemeraldscity';
+		if ($u->rep[$repc]<25000)
+			{
+				$st['expUpg'] += 0;
+				$u->rep[$repc] += $st['expUpg'];
+				if ($u->rep[$repc]>25000)
+					{
+						$u->rep[$repc]=25000;
+					}
+				$u->error = '�� ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ���������� �� '.$st['expUpg'].' ��.!';
+				//mysql_query('UPDATE `stats` SET `exp` = "'.$u->info['exp'].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');
+				mysql_query('UPDATE `rep` SET `'.$repc.'` = "'.$u->rep[$repc].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');
+				
+				mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
+			}
+		else
+			{
+				$u->error = '�� �� ������ ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ������ ������� 25000 ��.!';
+			}
+	}
+	
+elseif( $itm['id'] > 0 && $itm['item_id']==10009 ) 
+	{
+	    $repc='repabandonedplain';
+		if ($u->rep[$repc]<25000)
+			{
+				$st['expUpg'] += 0;
+				$u->rep[$repc] += $st['expUpg'];
+				if ($u->rep[$repc]>25000)
+					{
+						$u->rep[$repc]=25000;
+					}
+				$u->error = '�� ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ���������� �� '.$st['expUpg'].' ��.!';
+				//mysql_query('UPDATE `stats` SET `exp` = "'.$u->info['exp'].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');
+				mysql_query('UPDATE `rep` SET `'.$repc.'` = "'.$u->rep[$repc].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');
+				
+				mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
+			}
+		else
+			{
+				$u->error = '�� �� ������ ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ������ ������� 25000 ��.!';
+			}
+	}
+
+elseif( $itm['id'] > 0 && $itm['item_id']==10010 ) 
+	{
+	    $repc='repangelscity';
+		if ($u->rep[$repc]<25000)
+			{
+				$st['expUpg'] += 0;
+				$u->rep[$repc] += $st['expUpg'];
+				if ($u->rep[$repc]>25000)
+					{
+						$u->rep[$repc]=25000;
+					}
+				$u->error = '�� ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ���������� �� '.$st['expUpg'].' ��.!';
+				//mysql_query('UPDATE `stats` SET `exp` = "'.$u->info['exp'].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');
+				mysql_query('UPDATE `rep` SET `'.$repc.'` = "'.$u->rep[$repc].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');
+				
+				mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
+			}
+		else
+			{
+				$u->error = '�� �� ������ ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ������ ������� 25000 ��.!';
+			}
+	}
+
+elseif( $itm['id'] > 0 && $itm['item_id']==10011 ) 
+	{
+	    $repc='repdemonscity';
+		if ($u->rep[$repc]<25000)
+			{
+				$st['expUpg'] += 0;
+				$u->rep[$repc] += $st['expUpg'];
+				if ($u->rep[$repc]>25000)
+					{
+						$u->rep[$repc]=25000;
+					}
+				$u->error = '�� ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ���������� �� '.$st['expUpg'].' ��.!';
+				//mysql_query('UPDATE `stats` SET `exp` = "'.$u->info['exp'].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');
+				mysql_query('UPDATE `rep` SET `'.$repc.'` = "'.$u->rep[$repc].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');
+				
+				mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
+			}
+		else
+			{
+				$u->error = '�� �� ������ ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ������ ������� 25000 ��.!';
+			}
+	}
+	
+	
+elseif( $itm['id'] > 0 && $itm['item_id']==10012 ) 
+	{
+	    $repc='repsuncity';
+		if ($u->rep[$repc]<25000)
+			{
+				$st['expUpg'] += 0;
+				$u->rep[$repc] += $st['expUpg'];
+				if ($u->rep[$repc]>25000)
+					{
+						$u->rep[$repc]=25000;
+					}
+				$u->error = '�� ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ���������� �� '.$st['expUpg'].' ��.!';
+				//mysql_query('UPDATE `stats` SET `exp` = "'.$u->info['exp'].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');
+				mysql_query('UPDATE `rep` SET `'.$repc.'` = "'.$u->rep[$repc].'" WHERE `id` = '.$u->info['id'].' LIMIT 1');
+				
+				mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
+			}
+		else
+			{
+				$u->error = '�� �� ������ ������������ &quot;'.$itm['name'].'&quot;. ������� ����� ��������� ������ ������� 25000 ��.!';
+			}
+	}
+
+	
+
+
 ?>
\ No newline at end of file
diff --git a/_incl_data/class/magic/hny2014.php b/_incl_data/class/magic/hny2014.php
index 36862336..6b518f24 100644
--- a/_incl_data/class/magic/hny2014.php
+++ b/_incl_data/class/magic/hny2014.php
@@ -5,7 +5,7 @@ if(!defined('GAME'))
 }
 
 //������ ��������, �� �� ������ 00:00:00 01-01-2013
-if(date('Y')==2021) {
+if(date('Y')==2023) {
 	/*
 
 2. ���������� ������� (������ ����. ��) 
@@ -33,7 +33,7 @@ if(date('Y')==2021) {
 				
 		//�������� (x1)
 		$idit = $u->addItem(996,$u->info['id']);
-		mysql_query('UPDATE `items_users` SET `gift` = "����� ���" , `gtxt1` = "������������� ������� ����������� ��� � �����, 2021, �����!" WHERE `id` = "'.$idit.'" LIMIT 1');	
+		mysql_query('UPDATE `items_users` SET `gift` = "����� ���" , `gtxt1` = "������������� ������� ����������� ��� � �����, 2023, �����!" WHERE `id` = "'.$idit.'" LIMIT 1');	
 		
 		
 		//�������
@@ -50,11 +50,11 @@ if(date('Y')==2021) {
 		mysql_query('UPDATE `items_users` SET `gift` = "������ ���",`iznosMAX` = "100" WHERE `id` = "'.$idit.'" LIMIT 1');
 		
 		
-		$u->error = '�� ������� ������������ &quot;'.$itm['name'].'&quot;. � ��������� ��������� �������. � �����, 2021, �����!';
+		$u->error = '�� ������� ������������ &quot;'.$itm['name'].'&quot;. � ��������� ��������� �������. � �����, 2023, �����!';
 		mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE (`item_id` = "4009" OR `id` = "'.$itm['id'].'") AND `uid` = "'.$u->info['id'].'" LIMIT 10'); //2763
 	}
 }else{
-	$u->error = '������� �������� ������������ �� ������ 01.01.2021';
+	$u->error = '������� �������� ������������ �� ������ 01.01.2023';
 }
 
 ?>
\ No newline at end of file
diff --git a/_incl_data/class/magic/propuskpsh.php.bac b/_incl_data/class/magic/propuskpsh.php.bac
deleted file mode 100644
index 49dfc826..00000000
--- a/_incl_data/class/magic/propuskpsh.php.bac
+++ /dev/null
@@ -1,29 +0,0 @@
-<?
-if(!defined('GAME'))
-{
-	die();
-}
-
-if( $itm['magic_inci'] == 'propuskpsh' ) {
-	$test = mysql_fetch_array(mysql_query('SELECT `id`,`time` FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars` = "propuskpsh" AND `time` > "'.(time()-300).'" LIMIT 1'));
-	if( $u->info['align'] != 2 ) {
-		if( isset($test['id']) ) {
-			$u->error = '�������� �� ������, ��� '.$u->timeOut($test['time']-time()+300);
-		}else{
-			$u->addAction(time(),'propuskpsh','');
-			$u->error = '��� ������ �������, �������� � ������ �����.';
-			if($itm['id'] == 4802) {
-				mysql_query('UPDATE `actions` SET `time` = "'.(time()-43200).'" WHERE `uid` = '.$u->info['id'].' AND `time` > "'.(time()-43200).'" AND `vars` LIKE "psh%" AND `vars` != "psh102" AND `vars` NOT LIKE "psh\_%"');
-			}else{
-				mysql_query('UPDATE `actions` SET `time` = "'.(time()-21600).'" WHERE `uid` = '.$u->info['id'].' AND `time` > "'.(time()-43200).'" AND `vars` LIKE "psh%" AND `vars` != "psh102" AND `vars` NOT LIKE "psh\_%"');
-			}
-			// ��������� ������ ��:
-			// 1) ��� ������ ������ 12 �����. (����� ����� ������ ������ �� ������ ����� ������ 4 ������, � ����� �����, ������� ������� ������������).
-			// 2) �� ��������� �� ������ ��������. 
-			mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
-		}
-	}else{
-		$u->error = '�������� �� ����� ������������ ���������!';
-	}
-}
-?>
\ No newline at end of file
diff --git a/_incl_data/class/magic/sun_per_kr.php b/_incl_data/class/magic/sun_per_kr.php
index 1ea9dccd..2b8afb00 100644
--- a/_incl_data/class/magic/sun_per_kr.php
+++ b/_incl_data/class/magic/sun_per_kr.php
@@ -5,71 +5,42 @@ if(!defined('GAME'))
 }	
 	
 		$io .= '<i>���������� �������� ���������</i>, ';
-		$this->addItem(6361,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(6361,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(6364,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(5237,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5237,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5237,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4401,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5229,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5219,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);	
-		$this->addItem(5211,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);	
-		$this->addItem(5199,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5192,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5186,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5178,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5168,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5161,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5150,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5150,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2472,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
+		$this->addItem(842,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(842,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(749,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(666,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2469,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(580,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(594,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(642,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);	
+		$this->addItem(814,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);	
+		$this->addItem(777,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(787,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(803,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(803,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(803,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4401,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
 		
-		$io .= '<i>������, ������� � ������ ���������....</i>, ';
-		$this->addItem(4935,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4944,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2712,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2634,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2634,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
+		$io .= '<i>������ � ������ ���������....</i>, ';
+		$this->addItem(2712,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2621,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2621,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(871,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2139,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2140,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5046,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4941,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(994,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(1001,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(3102,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
 		
 ?>
\ No newline at end of file
diff --git a/_incl_data/class/magic/sun_per_ogn.php b/_incl_data/class/magic/sun_per_ogn.php
index c81ec1cd..e26257de 100644
--- a/_incl_data/class/magic/sun_per_ogn.php
+++ b/_incl_data/class/magic/sun_per_ogn.php
@@ -3,70 +3,43 @@ if(!defined('GAME'))
 {
 	die();
 }	
-	
-		$io .= '<i>���������� �������� ����</i>, ';
-		$this->addItem(6406,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(6409,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(5153,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5157,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5165,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5173,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);	
-		$this->addItem(2475,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);	
-		$this->addItem(5181,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5189,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5195,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5205,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5216,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5224,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5232,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5232,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5232,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4401,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
+		$io .= '<i>���������� �������� ���� ����</i>, ';
+		$this->addItem(850,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(751,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(669,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(1176,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(822,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(583,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(597,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(644,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(810,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);	
+		$this->addItem(4983,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);	
+		$this->addItem(4543,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5003,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5003,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5003,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4401,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
 		
-		$io .= '<i>������, ������� � ������ ���������....</i>, ';
-		$this->addItem(4935,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4944,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2712,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2702,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
+		$io .= '<i>������ � ������ ���������....</i>, ';
+		$this->addItem(2712,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2687,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(873,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']); // ����
+		$this->addItem(2139,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2140,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5046,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4941,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4942,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(1460,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2146,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']); //������
+		$this->addItem(1001,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(3102,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
 		
 ?>
\ No newline at end of file
diff --git a/_incl_data/class/magic/sun_per_tk.php b/_incl_data/class/magic/sun_per_tk.php
index 257b4e10..3b906f4e 100644
--- a/_incl_data/class/magic/sun_per_tk.php
+++ b/_incl_data/class/magic/sun_per_tk.php
@@ -3,72 +3,42 @@ if(!defined('GAME'))
 {
 	die();
 }	
-	
 		$io .= '<i>���������� �������� �����</i>, ';
-		$this->addItem(6394,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(6405,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(6397,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(6143,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(6151,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(6144,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(6145,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);	
-		$this->addItem(2472,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);	
-		$this->addItem(6146,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(6147,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(6148,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(6149,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(6150,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(6152,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(6153,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(6154,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(6154,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(6154,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4401,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
+		$this->addItem(4648,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4654,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4647,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4651,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2469,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4962,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4968,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4650,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4653,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);	
+		$this->addItem(4652,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);	
+		$this->addItem(4987,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4646,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4649,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4649,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4649,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4401,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
 		
-		$io .= '<i>������, ������� � ������ ���������....</i>, ';
-		$this->addItem(4935,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4944,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2712,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2612,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
+		$io .= '<i>������ � ������ ���������....</i>, ';
+		$this->addItem(2712,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2430,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(870,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2139,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2140,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5046,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4941,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(994,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(1001,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(3102,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
 		
 ?>
\ No newline at end of file
diff --git a/_incl_data/class/magic/sun_per_tp.php b/_incl_data/class/magic/sun_per_tp.php
index 73f791da..83e721ab 100644
--- a/_incl_data/class/magic/sun_per_tp.php
+++ b/_incl_data/class/magic/sun_per_tp.php
@@ -4,72 +4,43 @@ if(!defined('GAME'))
 	die();
 }	
 	
-		$io .= '<i>���������� �������� ������</i>, ';
-		$this->addItem(6383,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(6383,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(6386,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(6142,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(6142,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5163,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5171,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);	
-		$this->addItem(2472,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);	
-		$this->addItem(5177,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5184,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5194,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5201,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5209,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5221,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5228,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5236,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5236,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5236,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4401,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
+		$io .= '<i>���������� �������� ������ ( ������ )</i>, ';
+		$this->addItem(6483,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(6483,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(6484,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(6485,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2469,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(6486,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(6487,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(6488,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(6489,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);	
+		$this->addItem(6490,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);	
+		$this->addItem(6491,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(6492,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(6493,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(6493,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(6493,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4401,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
 		
-		$io .= '<i>������, ������� � ������ ���������....</i>, ';
-		$this->addItem(4935,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4944,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2712,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2678,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2678,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
+		$io .= '<i>������ � ������ ���������....</i>, ';
+		$this->addItem(2712,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2665,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2665,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(870,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2139,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2140,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5046,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4941,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(994,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(1001,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(3102,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
 		
 ?>
\ No newline at end of file
diff --git a/_incl_data/class/magic/sun_per_uv.php b/_incl_data/class/magic/sun_per_uv.php
index 693debd7..ade922cd 100644
--- a/_incl_data/class/magic/sun_per_uv.php
+++ b/_incl_data/class/magic/sun_per_uv.php
@@ -4,72 +4,43 @@ if(!defined('GAME'))
 	die();
 }	
 	
-		$io .= '<i>���������� �������� ����������</i>, ';
-		$this->addItem(6372,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(6372,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(6375,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(5146,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5146,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5162,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5170,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);	
-		$this->addItem(2472,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);	
-		$this->addItem(5179,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5187,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5193,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5200,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5210,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5220,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5230,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5238,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5238,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5238,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4401,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
+		$io .= '<i>���������� �������� �������</i>, ';
+		$this->addItem(605,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(605,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(748,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(667,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2469,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(735,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(579,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(593,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(641,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);	
+		$this->addItem(813,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);	
+		$this->addItem(775,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(786,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(802,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(802,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(802,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4401,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
 		
-		$io .= '<i>������, ������� � ������ ���������....</i>, ';
-		$this->addItem(4935,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4944,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2712,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2656,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2656,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
+		$io .= '<i>������ � ������ ���������....</i>, ';
+		$this->addItem(2712,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2643,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2643,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(872,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2139,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2140,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5046,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4941,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(994,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(1001,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(3102,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
 		
 ?>
\ No newline at end of file
diff --git a/_incl_data/class/magic/sun_per_vod.php b/_incl_data/class/magic/sun_per_vod.php
index 0e17c331..54eee7c1 100644
--- a/_incl_data/class/magic/sun_per_vod.php
+++ b/_incl_data/class/magic/sun_per_vod.php
@@ -3,70 +3,43 @@ if(!defined('GAME'))
 {
 	die();
 }	
-	
-		$io .= '<i>���������� �������� ����</i>, ';
-		$this->addItem(6406,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(6409,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(5155,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5158,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5166,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5175,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);	
-		$this->addItem(2475,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);	
-		$this->addItem(5182,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5191,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5196,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5206,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5217,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5225,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5233,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5233,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5233,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4401,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
+		$io .= '<i>���������� �������� ���� ����</i>, ';
+		$this->addItem(851,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(753,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(670,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(1176,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(823,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(584,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(598,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(645,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(812,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);	
+		$this->addItem(4984,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);	
+		$this->addItem(4544,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5004,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5004,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5004,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4401,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
 		
-		$io .= '<i>������, ������� � ������ ���������....</i>, ';
-		$this->addItem(4935,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4944,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2712,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2702,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
+		$io .= '<i>������ � ������ ���������....</i>, ';
+		$this->addItem(2712,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2687,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(873,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']); // ����
+		$this->addItem(2139,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2140,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5046,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4941,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4942,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(1460,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2147,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']); //������
+		$this->addItem(1001,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(3102,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
 		
 ?>
\ No newline at end of file
diff --git a/_incl_data/class/magic/sun_per_voz.php b/_incl_data/class/magic/sun_per_voz.php
index 73137744..d950467a 100644
--- a/_incl_data/class/magic/sun_per_voz.php
+++ b/_incl_data/class/magic/sun_per_voz.php
@@ -3,70 +3,43 @@ if(!defined('GAME'))
 {
 	die();
 }	
-	
-		$io .= '<i>���������� �������� ����</i>, ';
-		$this->addItem(6406,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(6409,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(5152,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5156,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5164,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5172,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);	
-		$this->addItem(2475,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);	
-		$this->addItem(5180,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5188,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5197,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5204,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5215,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5223,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5231,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5231,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5231,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4401,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
+		$io .= '<i>���������� �������� ���� �������</i>, ';
+		$this->addItem(848,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(752,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(671,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(1176,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(820,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(581,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(595,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(646,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(811,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);	
+		$this->addItem(4982,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);	
+		$this->addItem(4545,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5002,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5002,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5002,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4401,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
 		
-		$io .= '<i>������, ������� � ������ ���������....</i>, ';
-		$this->addItem(4935,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4944,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2712,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2702,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
+		$io .= '<i>������ � ������ ���������....</i>, ';
+		$this->addItem(2712,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2687,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(873,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']); // ����
+		$this->addItem(2139,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2140,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5046,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4941,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4942,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(1460,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2148,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']); //������
+		$this->addItem(1001,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(3102,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
 		
 ?>
\ No newline at end of file
diff --git a/_incl_data/class/magic/sun_per_zem.php b/_incl_data/class/magic/sun_per_zem.php
index d399b0ee..fd36b3e0 100644
--- a/_incl_data/class/magic/sun_per_zem.php
+++ b/_incl_data/class/magic/sun_per_zem.php
@@ -3,70 +3,43 @@ if(!defined('GAME'))
 {
 	die();
 }	
-	
-		$io .= '<i>���������� �������� ����</i>, ';
-		$this->addItem(6406,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(6409,$this->info['id'],'|nosale=1|srok=604800|sudba='.$this->info['login']);
-		$this->addItem(5154,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5159,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5167,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5174,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);	
-		$this->addItem(2475,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);	
-		$this->addItem(5183,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5190,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5198,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5207,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5218,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5226,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5234,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5234,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(5234,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4401,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
+		$io .= '<i>���������� �������� ���� �����</i>, ';
+		$this->addItem(849,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(750,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(668,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(1176,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(821,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(582,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(596,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(643,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(809,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);	
+		$this->addItem(4985,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);	
+		$this->addItem(4546,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5005,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5005,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5005,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4401,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
 		
-		$io .= '<i>������, ������� � ������ ���������....</i>, ';
-		$this->addItem(4935,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4944,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2712,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(10038,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(4691,$this->info['id'],'|tr_lvl=10|nosale=1|sudba='.$this->info['login']);
-		$this->addItem(2702,$this->info['id'],'|nosale=1|sudba='.$this->info['login']);
+		$io .= '<i>������ � ������ ���������....</i>, ';
+		$this->addItem(2712,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2687,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4736,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(873,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']); // ����
+		$this->addItem(2139,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2140,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(5046,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2390,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4941,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(4942,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(1460,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(2149,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']); //������
+		$this->addItem(1001,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
+		$this->addItem(3102,$this->info['id'],'|nosale=1|srok=864000|sudba='.$this->info['login']);
 		
 ?>
\ No newline at end of file
diff --git a/_incl_data/class/magic/sunduk_78.php b/_incl_data/class/magic/sunduk_78.php
index 31f92f21..878aa9c3 100644
--- a/_incl_data/class/magic/sunduk_78.php
+++ b/_incl_data/class/magic/sunduk_78.php
@@ -42,7 +42,7 @@ if(!defined('GAME'))
 				}
 				$arts_1 = $arts_1[rand(0,count($arts_1)-1)];
 				if( $arts_1 > 0 ) {
-					$this->addItem($arts_1,$this->info['id'],'|nosale=1|srok='.(1*1209600).'',NULL,50);
+					$this->addItem($arts_1,$this->info['id'],'|nosale=1|srok='.(1*259200).'',NULL,50);
 				}
 				//echo '['.$arts_1[rand(0,count($arts_1)-1)].'!'.count($arts_1).'!'.$arts_lvl.']';
 			}
diff --git a/_incl_data/class/magic/sunduk_78.php.bac b/_incl_data/class/magic/sunduk_78.php.bac
deleted file mode 100644
index a225180d..00000000
--- a/_incl_data/class/magic/sunduk_78.php.bac
+++ /dev/null
@@ -1,121 +0,0 @@
-<?
-if(!defined('GAME'))
-{
-	die();
-}	
-	if($tr['var_id'] != '') {
-		 
-		$io = '';
-		
-		/*
-			1. �������� �������� ������ ��������� - 1% , ��������� , �� ��������� , ������ , 3 ��. ���� ��������
-			2. �������� ���� 5 ���. ������, ���� ������ +200% ����� �� 3 ���� (��� ���������)
-			3. 1 �� 4 ���������� +15 (���.)
-			4. ��� 20 ��.
-		*/
-		$trgos = false;
-		
-		$key1 = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `item_id` = 4460 AND `uid` = '.$this->info['id'].' AND `delete` = 0 AND `inShop` = 0 AND `inTransfer` = 0 LIMIT 1'));
-		$key2 = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `item_id` = 4461 AND `uid` = '.$this->info['id'].' AND `delete` = 0 AND `inShop` = 0 AND `inTransfer` = 0 LIMIT 1'));
-		$key3 = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `item_id` = 4462 AND `uid` = '.$this->info['id'].' AND `delete` = 0 AND `inShop` = 0 AND `inTransfer` = 0 LIMIT 1'));
-		$key4 = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `item_id` = 4463 AND `uid` = '.$this->info['id'].' AND `delete` = 0 AND `inShop` = 0 AND `inTransfer` = 0 LIMIT 1'));
-		
-		if( isset($key1['id']) && isset($key2['id']) && isset($key3['id']) && isset($key4['id']) ) {
-			mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `id` = '.$key1['id'].' OR `id` = '.$key2['id'].' OR `id` = '.$key3['id'].' OR `id` = '.$key4['id'].' LIMIT 4');
-			$trgos = true;
-		}
-		
-		if( $trgos == true ) {
-			if( rand(0,100) == 57 || $this->info['admin'] > 0 ) {
-				//������ ��������
-				$io .= '<i>��������� ��������</i>, ';
-				$arts_1 = array();
-				$arts_lvl = $this->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.'%"');
-				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 ) {
-					$this->addItem($arts_1,$this->info['id'],'|nosale=1|srok='.(1*86400).'',NULL,50);
-				}
-				//echo '['.$arts_1[rand(0,count($arts_1)-1)].'!'.count($arts_1).'!'.$arts_lvl.']';
-			}
-			
-			$recr=rand(0,99); // 1% 4510 - 40 ��� /3% 5021 - 20 ��� /10% 5020 -10 ���/ 20% 4465 -5 ���/ 100% 5017 - 1���
-			$rcr=rand(0,99); // 5%4274 - 400 �� / 15% 4392/4392 - 100 �� / 30% 4392 -50 ��/ 100% 4464 - 20��
-			
-			if( $recr > 98 ) {
-				//������ ��� +40 ���.
-				$io .= '<i>��� �� 40 ���.</i>, ';
-				$this->addItem(4510,$this->info['id'],'|sudba='.$this->info['login']);
-			}elseif( $recr > 96 ){
-				//������ ��� +20 ���.
-				$io .= '<i>��� �� 20 ���.</i>, ';
-				$this->addItem(5021,$this->info['id'],'|sudba='.$this->info['login']);
-			}elseif( $recr > 89 ){
-				//������ ��� +10 ���.
-				$io .= '<i>��� �� 10 ���.</i>, ';
-				$this->addItem(5020,$this->info['id'],'|sudba='.$this->info['login']);
-			}elseif( $recr > 79 ){
-				//������ ��� +5 ���.
-				$io .= '<i>��� �� 5 ���.</i>, ';
-				$this->addItem(4465,$this->info['id'],'|sudba='.$this->info['login']);
-			}else{
-				//������ ��� +1 ���.
-				$io .= '<i>��� �� 1 ���.</i>, ';
-				$this->addItem(5017,$this->info['id'],'|sudba='.$this->info['login']);
-			}
-			
-			if( $rcr > 94 ) {
-				//������ ��� �� 400 ��.	
-				$io .= '<i>��� �� 400 ��.</i> ';
-				$this->addItem(4274,$this->info['id'],'|sudba='.$this->info['login']);
-			}elseif( $rcr > 84 ){
-				//������ ��� �� 100 ��.	
-				$io .= '<i>���� �� ����� 100 ��.</i> ';
-				$this->addItem(4392,$this->info['id'],'|sudba='.$this->info['login']);
-				$this->addItem(4392,$this->info['id'],'|sudba='.$this->info['login']);
-			}elseif( $rcr > 69 ){
-				//������ ��� �� 50 ��.	
-				$io .= '<i>��� �� 50 ��.</i> ';
-				$this->addItem(4392,$this->info['id'],'|sudba='.$this->info['login']);
-			}else{
-				//������ ��� �� 20 ��.	
-				$io .= '<i>��� �� 20 ��.</i> ';
-				$this->addItem(4464,$this->info['id'],'|sudba='.$this->info['login']);
-			}
-		
-
-			
-			
-			$elik_1 = array(
-				4037,4038,4039,4040
-			);
-			$elik_1 = $elik_1[rand(0,3)];
-			if( $elik_1 > 0 ) {
-				//������ 1 �� 4 ������
-				$io .= '<i>������� +22 ������</i>, ';
-				$this->addItem($elik_1,$this->info['id'],'|nosale=1|sudba='.$this->info['login'],NULL,1);
-			}
-			
-
-		
-		//������ ������ +200%
-		$io .= '<i>������ +100% �����</i>, ';
-		$this->addItem(4466,$this->info['id'],'');
-		
-		}else{
-			$no_open_itm = true;		
-			$this->error = '��������� 4 ��������� ����� � ���� �����.';
-		}
-
-		
-	}
-	unset($i5,$i3,$i4);
-?>
\ No newline at end of file
diff --git a/_incl_data/class/magic/yarostzvezd.php b/_incl_data/class/magic/yarostzvezd.php
index aabe48b3..6f5b7226 100644
--- a/_incl_data/class/magic/yarostzvezd.php
+++ b/_incl_data/class/magic/yarostzvezd.php
@@ -1,69 +1,50 @@
 <?
-
-if (!defined('GAME')) {
-    die();
+if(!defined('GAME'))
+{
+	die();
 }
 
-if ($itm['magic_inci'] == 'yarostzvezd') {
-    $pvr = [];
-
-    //�������� ��� �����
-    $pvr['trs7'] = 5;
-    if ($u->stats['hpNow'] < 1) {
-        $u->error = '<font color=red><b>�� �������� � �� ������ ��������������� �������...</b></font>';
-    } elseif ($u->info['tactic7'] < $pvr['trs7']) {
-        $u->error = '<font color=red><b>������������ ����, ���������� ' . $pvr['trs7'] . '...</b></font>';
-    } elseif (isset($btl->info['id'])) {
-        /*
-        $btl->priemAddLog( $id, 1, 2, $u->info['id'], $u->info['enemy'],
-            '',
-            '{tm1} {u1} ����������� �������� &quot;<b>'.$itm['name'].'</b>&quot;.',
-            ($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 = array();
+	
+	//�������� ��� �����
+	$pvr['trs7'] = 5;
+	if( $u->stats['hpNow'] < 1 ) {
+		$u->error = '<font color=red><b>�� �������� � �� ������ ��������������� �������...</b></font>';
+	}elseif( $u->info['tactic7'] < $pvr['trs7'] ) {
+		$u->error = '<font color=red><b>������������ ����, ���������� '.$pvr['trs7'].'...</b></font>';
+	}elseif( isset($btl->info['id']) ) {
+		/*
+		$btl->priemAddLog( $id, 1, 2, $u->info['id'], $u->info['enemy'],
+			'',
+			'{tm1} {u1} ����������� �������� &quot;<b>'.$itm['name'].'</b>&quot;.',
+			($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 = '<font color=red><b>�� ������������� ����... </b></font>';
-        mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = ' . $itm['id'] . ' LIMIT 1');
-    } else {
-        $u->error = '<font color=red><b>������ �������� ������������ ������ � ���</b></font>';
-    }
-
-    //�������� �������
-    //$this->mintr($pl);
-
-    unset($pvr);
+		
+		$u->error = '<font color=red><b>�� ������������� ����... </b></font>';		
+		mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1');
+		
+	}else{
+		$u->error = '<font color=red><b>������ �������� ������������ ������ � ���</b></font>';
+	}
+	
+	//�������� �������
+	//$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 @@
-<?php
-/**
- * Mobile Detect Library
- * =====================
- *
- * Motto: "Every business should have a mobile detection script to detect mobile readers"
- *
- * Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets).
- * It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.
- *
- * @author      Current authors: Serban Ghita <serbanghita@gmail.com>, Nick Ilyin <nick.ilyin@gmail.com>
- *              Original author: Victor Stanciu <vic.stanciu@gmail.com>
- *
- * @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&currentPage=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/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 @@
-<?php
-class GameDealerClass {
-	//������������
-	public $c = array(
-		/* MySQL ���� ������ */
-			'db_name'		=>	'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.'</'.$a[$i][0].'>';
-			$i++;
-		}
-		return $r;
-	}
-	
-	//���������� XML-����
-	public function backInformation() {
-		header('Content-Type: text/html/force-download');
-		echo '<?xml version="1.0" encoding="UTF-8"?>';
-		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') {
-			//<sign>MD5(method+MD5(gdKey))</sign>
-			
-			$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 - ����� ���������	<sign>MD5(nick+method+MD5(gdKey))</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','���������� ���� ������'))));
-					$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 = '<span class=date>'.date('d.m.Y H:i').'</span> ������� <img src=https://img.new-combats.com/i/align/align50.gif width=12 height=15 /><u><b>Enchanter</b> / �������������� ������</u> ��������: ';
-						
-						if($user['sex'] == 1) {
-							$r .= '���������';
-						}else{
-							$r .= '���������';
-						}
-						
-						$r .= ' <b>'.$user['login'].'</b>, �� ��� ���������� ���� �'.$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/104.php b/_incl_data/class/priem/104.php
index 98b44c7b..690f4da7 100644
--- a/_incl_data/class/priem/104.php
+++ b/_incl_data/class/priem/104.php
@@ -24,8 +24,8 @@ if( isset($pr_momental_this)) {
 	unset( $pr_used_this );
 }else{
 	
-				$pvr['hp_0'] = 1;
-				$pvr['hp_1'] = 95;
+				$pvr['hp_0'] = 50;
+				$pvr['hp_1'] = 65;
 	
 				//
 				$pvr['hp'] = floor(rand($pvr['hp_0'],$pvr['hp_1']));
diff --git a/_incl_data/class/priem/113.php b/_incl_data/class/priem/113.php
index dca15d45..6b1a3318 100644
--- a/_incl_data/class/priem/113.php
+++ b/_incl_data/class/priem/113.php
@@ -7,7 +7,7 @@ if(!defined('GAME')) {
 */
 $pvr = array();
 	//�������� ��� �����
-	$pvr['hp'] = rand(34,41);
+	$pvr['hp'] = rand(46,54);
 	$pvr['hp'] = $this->magatack( $u->info['id'], $this->ue['id'], $pvr['hp'], '�����', 1 );
 	$pvr['promah_type'] = $pvr['hp'][3];
 	$pvr['promah'] = $pvr['hp'][2];
diff --git a/_incl_data/class/priem/122.php b/_incl_data/class/priem/122.php
index 8d31cdd8..47b1c4b5 100644
--- a/_incl_data/class/priem/122.php
+++ b/_incl_data/class/priem/122.php
@@ -126,7 +126,7 @@ if( isset($pr_used_this) && isset($pr_moment) ) {
 	};
 	unset( $pr_used_this );
 }else{
-	$pvr['hp'] = floor(rand(66,71));
+	$pvr['hp'] = floor(rand(70,81));
 	$pvr['hp'] = $this->magatack( $u->info['id'], $this->ue['id'], $pvr['hp'], '�����', 0 );
 	$pvr['promah_type'] = $pvr['hp'][3];
 	$pvr['promah'] = $pvr['hp'][2];
diff --git a/_incl_data/class/priem/128.php b/_incl_data/class/priem/128.php
index c11ee20e..ed8b525a 100644
--- a/_incl_data/class/priem/128.php
+++ b/_incl_data/class/priem/128.php
@@ -6,7 +6,7 @@ if(!defined('GAME')) {
 	�����: �������� ����� [8]
 */
 $pvr = array();
-	$pvr['hp_0'] = 13;
+	$pvr['hp_0'] = 30;
 	//�������� ��� �����
 	$pvr['hp'] = $pvr['hp_0'];
 	$pvr['hp'] = $this->magatack( $u->info['id'], $this->ue['id'], $pvr['hp'], '�����', 1 );
diff --git a/_incl_data/class/priem/134.php b/_incl_data/class/priem/134.php
index 5df483bb..da36ceab 100644
--- a/_incl_data/class/priem/134.php
+++ b/_incl_data/class/priem/134.php
@@ -24,8 +24,8 @@ if( isset($pr_momental_this)) {
 	unset( $pr_used_this );
 }else{
 	
-				$pvr['hp_0'] = 25;
-				$pvr['hp_1'] = 51;
+				$pvr['hp_0'] = 30;
+				$pvr['hp_1'] = 50;
 	
 				//
 				$pvr['hp'] = floor($pvr['hp_1']);
diff --git a/_incl_data/class/priem/141.php.bac.php b/_incl_data/class/priem/141.php.bac.php
deleted file mode 100644
index 41ef7b63..00000000
--- a/_incl_data/class/priem/141.php.bac.php
+++ /dev/null
@@ -1,127 +0,0 @@
-<?
-if(!defined('GAME')) {
-	die();
-}
-/*
-	�����: ���������� ������
-	��������� ���� ���������� �� ��� ������� �� 75% ������ �����
-*/
-$pvr = array();
-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;
-			$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).' );';
-						}
-						//
-						$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);
-}
-unset($pvr);
-?>
\ No newline at end of file
diff --git a/_incl_data/class/priem/141.php.bac1 b/_incl_data/class/priem/141.php.bac1
deleted file mode 100644
index 7aca8200..00000000
--- a/_incl_data/class/priem/141.php.bac1
+++ /dev/null
@@ -1,140 +0,0 @@
-<?
-if(!defined('GAME')) {
-	die();
-}
-/*
-	�����: ���������� ������
-	��������� ���� ���������� �� ��� ������� �� 75% ������ �����
-*/
-$pvr = array();
-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( $btl->stats[$btl->uids[$u2]]['effects'][$btl->stats[$btl->uids[$uid]]['u_priem'][$j_id][0]]['name'] == '����������������' ) {
-				//$yron = $yron/10;
-			}else{
-				//$yron = $yron/4;
-			}
-			$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( $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;
-			/*$at['p'][$a]['atack'][$j]['yron']['plog'][] = '$this->deleffm(141,'.(0+$uid).','.$btl->stats[$btl->uids[$uid]]['u_priem'][$j_id][3].');
-								$this->priemAddLog( '.$id.', '.$b.', '.$a.', '.$u2.', '.$u1.',
-								"'.$btl->stats[$btl->uids[$u2]]['effects'][$btl->stats[$btl->uids[$uid]]['u_priem'][$j_id][0]]['name'].'",
-								"{tm1} '.$btl->addlt($b , 17 , $btl->users[$btl->uids[$u2]]['sex'] , NULL).'",
-							'.($btl->hodID + 1).' );';*/
-			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( $btl->stats[$btl->uids[$u2]]['effects'][$btl->stats[$btl->uids[$uid]]['u_priem'][$j_id][0]]['name'] == '����������������' ) {
-							$at['p'][$a]['atack'][$j]['yron']['y'] = round($at['p'][$a]['atack'][$j]['yron']['y']/10);
-							$at['p'][$a]['atack'][$j]['yron']['r'] = round($at['p'][$a]['atack'][$j]['yron']['r']/10);
-							$at['p'][$a]['atack'][$j]['yron']['k'] = round($at['p'][$a]['atack'][$j]['yron']['k']/10);
-							$at['p'][$a]['atack'][$j]['yron']['m_k'] = round($at['p'][$a]['atack'][$j]['yron']['m_k']/10);
-							$at['p'][$a]['atack'][$j]['yron']['m_y'] = round($at['p'][$a]['atack'][$j]['yron']['m_y']/10);
-						}else{
-							$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->deleffm(141,'.(0+$uid).','.$btl->stats[$btl->uids[$uid]]['u_priem'][$j_id][3].');
-								$this->priemAddLog( '.$id.', '.$b.', '.$a.', '.$u2.', '.$u1.',
-								"'.$btl->stats[$btl->uids[$u2]]['effects'][$btl->stats[$btl->uids[$uid]]['u_priem'][$j_id][0]]['name'].'",
-								"{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);
-}
-unset($pvr);
-?>
\ No newline at end of file
diff --git a/_incl_data/class/priem/161.php b/_incl_data/class/priem/161.php
index b3e2c835..266553f1 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']) {
+				if( $pvr['krit'] == false ) {
 					if( $pvr['hp'] > $pvr['lim'] ) {
 						$pvr['hp'] = $pvr['lim'];
 					}
@@ -48,6 +48,7 @@ $pvr = array();
 				$pvr['hpSee'] = '-'.$pvr['hp'];
 				$pvr['hpNow'] -= $pvr['hp'];
 				$btl->priemYronSave($u->info['id'],$pvr['uid'],$pvr['hp'],0);
+				
 
 					
 				if( $pvr['hpNow'] > $pvr['hpAll'] ) {
@@ -61,8 +62,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']) {
-					if(!$pvr['krit']) {
+				if( $pvr['promah'] == false ) {
+					if( $pvr['krit'] == false ) {
 						$prv['color2'] = '006699';
 						if(isset($btl->mcolor[$btl->mname['�����']])) {
 							$prv['color2'] = $btl->mcolor[$btl->mname['�����']];
@@ -95,7 +96,12 @@ $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']++;
 			}
@@ -104,6 +110,12 @@ $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/170.php b/_incl_data/class/priem/170.php
index 31c32841..c4a97970 100644
--- a/_incl_data/class/priem/170.php
+++ b/_incl_data/class/priem/170.php
@@ -7,7 +7,7 @@ if(!defined('GAME')) {
 */
 $pvr = array();
 	//�������� ��� �����
-	$pvr['hp'] = rand(40,80);
+	$pvr['hp'] = rand(50,90);
 	//$pvr['hp'] = floor($pvr['hp']*0.95);
 	//$pvr['hp'] = $this->magatackfiz( $u->info['id'], $this->ue['id'], $pvr['hp'], '����' /* �������� ���� - 3 */, 1 , '�����' );
 	$pvr['hp'] = $this->magatack( $u->info['id'], $this->ue['id'], $pvr['hp'], '�����', 1 ); //
diff --git a/_incl_data/class/priem/180.php b/_incl_data/class/priem/180.php
index 163e5c97..5853af34 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/193.php.bac b/_incl_data/class/priem/193.php.bac
deleted file mode 100644
index eca72ee9..00000000
--- a/_incl_data/class/priem/193.php.bac
+++ /dev/null
@@ -1,116 +0,0 @@
-<?
-if(!defined('GAME')) {
-	die();
-}
-/*
-	�����: ��������� �����
-	��������� ����� �� ���������� ������� �� 5*(���) ��. ������
-*/
-$pvr = array();
-if( 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 == $uid1 ) {
-			$a = 1;
-			$b = 2;
-			$u1 = ${'uid1'};
-			$u2 = ${'uid2'};
-		}elseif( $uid == $uid2 ) {
-			$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 == $uid1 ) {
-			$a = 1;
-			$b = 2;
-			$u1 = ${'uid1'};
-			$u2 = ${'uid2'};
-		}elseif( $uid == $uid2 ) {
-			$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( $pvr['used'] == 0 && !isset($at['p'][$a]['priems']['kill'][$uid][$j_id]) ) {
-						//
-						$pvr['hp'] = 6 * $btl->users[$btl->uids[$u1]]['level'];
-						$pvr['hp'] = $btl->testYronPriem( $u1, $u2, 12, $pvr['hp'], -1, true, false, 0 );
-						if( $pvr['hp'] <= 1 ) {
-							$pvr['hp'] = 0;
-						$at['p'][$a]['atack'][$j]['yron']['y'] = 1;
-						$at['p'][$a]['atack'][$j]['yron']['r'] = -1;
-						$at['p'][$a]['atack'][$j]['yron']['k'] = 1;
-						$at['p'][$a]['atack'][$j]['yron']['m_k'] = 1;
-						$at['p'][$a]['atack'][$j]['yron']['m_y'] = 1;
-						}
-						else
-						{
-						$at['p'][$a]['atack'][$j]['yron']['y'] += $pvr['hp'];
-						$at['p'][$a]['atack'][$j]['yron']['r'] -= $pvr['hp'];
-						$at['p'][$a]['atack'][$j]['yron']['k'] += $pvr['hp'];
-						$at['p'][$a]['atack'][$j]['yron']['m_y'] += $pvr['hp'];
-						$at['p'][$a]['atack'][$j]['yron']['m_k'] += $pvr['hp'];
-						}
-						//$at['p'][$a]['atack'][$j]['yron'] = $btl->testYronPriemAttack( 193 , $u1 , $u2 , $at['p'][$a]['atack'][$j]['yron'] );
-						//
-						if( $pvr['used'] == 0 && !isset($at['p'][$a]['priems']['kill'][$uid][$j_id]) ) {
-							$at['p'][$a]['atack'][$j]['yron']['plog'][] = '$this->priemAddLog( '.$id.', '.$a.', '.$b.', '.$u1.', '.$u2.',
-								"��������� �����",
-								"{tm1} '.$btl->addlt($a , 17 , $btl->users[$btl->uids[$u1]]['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);
-}
-unset($pvr);
-?>
\ No newline at end of file
diff --git a/_incl_data/class/priem/232.php.bac b/_incl_data/class/priem/232.php.bac
deleted file mode 100644
index 64f0b365..00000000
--- a/_incl_data/class/priem/232.php.bac
+++ /dev/null
@@ -1,72 +0,0 @@
-<?
-if(!defined('GAME')) {
-	die();
-}
-/*
-	�����: ������, ������� ��� �������, �� ������ 0.5 ��. �� ��������� 1 ��. ��
-*/
-$pvr = array();
-//�������� ��� �����
-
-$pvr['hp'] = round( 1+$btl->users[$btl->uids[$u->info['id']]]['tactic1']+$btl->users[$btl->uids[$u->info['id']]]['tactic2']+$btl->users[$btl->uids[$u->info['id']]]['tactic3']+$btl->users[$btl->uids[$u->info['id']]]['tactic4']+$btl->users[$btl->uids[$u->info['id']]]['tactic5']+$btl->users[$btl->uids[$u->info['id']]]['tactic6']*0.5 );
-if( $pvr['hp'] > 25 ) {
-	$pvr['hp'] = 25;
-}
-$pvr['hp'] = round($btl->stats[$btl->uids[$u->info['id']]]['hpAll']/100*$pvr['hp']);
-$pvr['hpSee'] = '--';
-$pvr['hpNow'] = floor($btl->stats[$btl->uids[$this->ue['id']]]['hpNow']);
-$pvr['hpAll'] = $btl->stats[$btl->uids[$u->info['id']]]['hpAll'];
-$pvr['hp'] = $btl->hphe( $u->info['id'] , $pvr['hp'] , true );
-$pvr['hpTr'] = $pvr['hpAll'] - $pvr['hpNow'];
-if( $pvr['hpTr'] > 0 ) {
-	//��������� ����
-	if( $pvr['hpTr'] < $pvr['hp'] ) {
-		$pvr['hp'] = $pvr['hpTr'];
-	}
-	$pvr['hpSee'] = '+'.$pvr['hp'];
-	$pvr['hpNow'] += $pvr['hp'];
-}
-	
-if( $pvr['hpNow'] > $pvr['hpAll'] ) {
-	$pvr['hpNow'] = $pvr['hpAll'];
-}elseif( $pvr['hpNow'] < 0 ) {
-	$pvr['hpNow'] = 0;
-}
-
-$btl->users[$btl->uids[$u->info['id']]]['last_hp'] = $pvr['hp'];
-	
-$u->info['hpNow'] = $pvr['hpNow'];
-$u->stats['hpNow'] = $pvr['hpNow'];
-$btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] = $pvr['hpNow'];
-
-$pvr['i']=1;	
-while($pvr['i'] <= 6) {
-	$btl->users[$btl->uids[$u->info['id']]]['tactic'.$pvr['i']] = 0;
-	$btl->stats[$btl->uids[$u->info['id']]]['tactic'.$pvr['i']] = 0;
-	$u->info['tactic'.$pvr['i']] = 0;
-	$u->stats['tactic'.$pvr['i']] = 0;
-	$pvr['i']++;
-}
-	
-mysql_query('UPDATE `stats` SET 
-`last_hp` = "'.$btl->users[$btl->uids[$u->info['id']]]['last_hp'].'",
-`hpNow` = "'.$pvr['hpNow'].'",
-`tactic1` = "0",
-`tactic2` = "0",
-`tactic3` = "0",
-`tactic4` = "0",
-`tactic5` = "0",
-`tactic6` = "0"
-WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
-	
-$btl->priemAddLog( $id, 1, 2, $u->info['id'], $u->info['enemy'],
-	'������',
-	'{tm1} '.$btl->addlt(1 , 17 , $btl->users[$btl->uids[$u->info['id']]]['sex'] , NULL).' <font Color=#006699><b>'.$pvr['hpSee'].'</b></font> ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']',
-	($btl->hodID)
-);
-
-//�������� �������
-$this->mintr($pl);
-
-unset($pvr);
-?>
\ No newline at end of file
diff --git a/_incl_data/class/priem/244.php b/_incl_data/class/priem/244.php
index 30adf7f4..2991e7d4 100644
--- a/_incl_data/class/priem/244.php
+++ b/_incl_data/class/priem/244.php
@@ -1,13 +1,7 @@
-<?php
+<?
 
-/**
- * @var $this priems
- * @var $btl battleClass
- * @var $id int
- * @var $pl array
- */
-if (!$id) {
-    exit();
+if (!defined('GAME')) {
+    die();
 }
 /*
 	�����: �������� ������
@@ -17,10 +11,10 @@ $pvr['mg'] = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid
 if (
     $btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] > round($btl->stats[$btl->uids[$this->ue['id']]]['hpAll'] / 100 * 33)
 ) {
-    echo '<b style="color: red">������� �������� ���� ������ ���� ���� 33%</b>';
+    echo '<font color=red><b>������� �������� ���� ������ ���� ���� 33%</b></font>';
     $cup = true;
 } elseif (!isset($pvr['mg']['id'])) {
-    echo '<b style="color: red">�� ��������� ��� ����������� ������� (������ ��������)</b>';
+    echo '<font color=red><b>�� ��������� ��� ����������� ������� (������ ��������)</b></font>';
     $cup = true;
 } else {
     //�������� ��� �����
@@ -30,6 +24,25 @@ if (
     // ���� = 150% ����������� ����� (���� �� ��� * ���������� ����� * 150/100).
     $pvr['hp'] = floor($pvr['data']['atgm'] * $pvr['mg']['hod'] * 1.5);
 
+//    $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'] = 450;
+//    $pvr['hp24'] = $pvr['hp'];
+
     // �� ������ ����� ���������, �� �� �� ������ ��� ��� �������������� ����!
     $pvr['hp_test'] = $this->magatack($u->info['id'], $this->ue['id'], $pvr['hp'], '�����', 1);
 
@@ -64,13 +77,25 @@ if (
 
     $prv['text'] = $btl->addlt(1, 19, $btl->users[$btl->uids[$u->info['id']]]['sex'], null);
 
-
-    $prv['color'] = $pvr['krit'] ? "f00" : "a00";
+    //���� ������
+    if (!$pvr['krit']) {
+        $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';
+    }
 
     $prv['text2'] = '{tm1} ' . $prv['text'] . '. <font Color=' . $prv['color'] . '><b>' . $pvr['hpSee'] . '</b></font> [' . $pvr['hpNow'] . '/' . $pvr['hpAll'] . ']';
 
     $btl->priemAddLog($id, 1, 2, $u->info['id'], $this->ue['id'],
-        '<font color^^^^#' . $prv['color'] . '>�������� ������</font>',
+        '<font color^^^^#' . $prv['color2'] . '>�������� ������</font>',
         $prv['text2'],
         ($btl->hodID + 1)
     );
@@ -83,3 +108,4 @@ if (
     $this->mintr($pl);
 }
 unset($pvr);
+?>
\ No newline at end of file
diff --git a/_incl_data/class/priem/246.php b/_incl_data/class/priem/246.php
index cc3c953c..03cf441f 100644
--- a/_incl_data/class/priem/246.php
+++ b/_incl_data/class/priem/246.php
@@ -32,7 +32,7 @@ if( isset($pr_momental_this)) {
 	);
 	*/
 				//
-				$pvr['mp'] = round($u->stats['mpAll']*0.05);
+				$pvr['mp'] = round($u->stats['mpAll']*0.15);
 				$pvr['mpSee'] = 0;
 				$pvr['mpNow'] = floor($u->stats['mpNow']);
 				$pvr['mpAll'] = $u->stats['mpAll'];
@@ -66,7 +66,7 @@ if( isset($pr_momental_this)) {
 				$btl->stats[$btl->uids[$u->info['id']]]['mpNow'] = $pvr['mpNow'];
 				$btl->users[$btl->uids[$u->info['id']]]['mpNow'] = $pvr['mpNow'];
 				//
-				$pvr['hp'] = round($u->stats['hpAll']*0.05);
+				$pvr['hp'] = round($u->stats['hpAll']*0.15);
 				$pvr['hpSee'] = 0;
 				$pvr['hpNow'] = floor($u->stats['hpNow']);
 				$pvr['hpAll'] = $u->stats['hpAll'];
diff --git a/_incl_data/class/priem/250.php b/_incl_data/class/priem/250.php
index 2f05b58f..1bfd9060 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']));
+		$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'];
@@ -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']<count($prv['v'])) {
-
+			//$prv['j'][$prv['v'][$prv['i']]] += $prv['j'][$prv['v'][$prv['i']]];
 			$prv['vi'] = str_replace('add_','',$prv['v'][$prv['i']]);
 			if($u->is[$prv['vi']]!='') {
 				if($prv['j'][$prv['v'][$prv['i']]]>0) {
diff --git a/_incl_data/class/priem/255.php b/_incl_data/class/priem/255.php
index 563d5683..5c811279 100644
--- a/_incl_data/class/priem/255.php
+++ b/_incl_data/class/priem/255.php
@@ -99,8 +99,7 @@ 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->addAirStaticPoints($u1);
-
+						$priem->mg2static_points( $u1 , $btl->stats[$btl->uids[$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/263.php b/_incl_data/class/priem/263.php
index 151c5b8b..5c526eed 100644
--- a/_incl_data/class/priem/263.php
+++ b/_incl_data/class/priem/263.php
@@ -1,113 +1,74 @@
-<?
-if(!defined('GAME')) {
-	die();
+<?php /**@var $this priems*/
+if (!defined('GAME')) {
+    die();
 }
 /*
 	�����: �����: �������
 */
 $pvr = array();
-//$pvr['mg'] = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$btl->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 '<font color=red><b>������� �� ������� ������������ ���������� �������</b></font>';
-		$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}. <font Color='.$prv['color'].'><b>'.$pvr['mpSee'].'</b></font> ['.$pvr['mpNow'].'/'.$pvr['mpAll'].'] (����)';
-		
-		$btl->priemAddLog( $id, 1, 2, $u->info['id'], $this->ue['id'],
-			'<font color^^^^#'.$prv['color2'].'>�����: �������</font>',
-			$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 '<font color=red><b>�� ��������� ��� ������� (������ ��������)</b></font>';
-	$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 '<b style="color: red">�� ��������� ��� �������</b>';
+    $cup = true;
+} else {
+    $pvr['data'] = $this->lookStatsArray($pvr['mg']['data']);
+    //
+    /**/
+    if ($pvr['data']['add_mg2static_points'] < 1) {
+        echo '<b style="color: red">������� �� ������� ������������ ���������� �������</b>';
+        $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}. <font Color=' . $prv['color'] . '><b>' . $pvr['mpSee'] . '</b></font> [' . $pvr['mpNow'] . '/' . $pvr['mpAll'] . '] (����)';
+
+        $btl->priemAddLog($id, 1, 2, $this->u->info['id'], $this->ue['id'], '<font color^^^^#' . $prv['color'] . '>�����: �������</font>', $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..f68ce7b8 100644
--- a/_incl_data/class/priem/265.php
+++ b/_incl_data/class/priem/265.php
@@ -1,114 +1,79 @@
-<?
-if(!defined('GAME')) {
-	die();
+<?php
+/** �����: ����������: �������! @var $this priems */
+if (!$id) {
+    exit();
 }
-/*
-	�����: ����������: �������!
-*/
+//$cup = $this->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'].'. <font Color='.$prv['color'].'><b '.$btl->maginfoattack($u->info['id'],$this->ue['id'],3).'>'.$pvr['hpSee'].'</b></font> ['.$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'].'. <font Color='.$prv['color'].'><b '.$btl->maginfoattack($u->info['id'],$this->ue['id'],3).'>--</b></font> ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']';
-	}
-	$btl->priemAddLog( $id, 1, 2, $u->info['id'], $u->info['enemy'],
-		'<font color^^^^#'.$prv['color2'].'>����������: �������!</font>',
-		$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 '<font color=red><b>�� ��������� ��� ���������� (������ ��������)</b></font>';
-	$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 '<b style="color: red;">�� ��������� ��� ���������� (������ ��������)</b>';
+    $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['color2'] = '909090';
+        $prv['color'] = '909090';
+    } elseif ($pvr['krit']) {
+        $prv['color2'] = 'FF0000';
+        $prv['color'] = 'FF0000';
+    } else {
+        $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['����']];
+        }
+    }
+
+    $prv['text2'] = '{tm1} ' . $prv['text'] . '. <font Color=' . $prv['color'] . '><b ' . $btl->maginfoattack($this->u->info['id'], $this->ue['id'], 3) . '>' . $pvr['hpSee'] . '</b></font> [' . $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'] . '. <font Color=' . $prv['color'] . '><b ' . $btl->maginfoattack($this->u->info['id'], $this->ue['id'], 3) . '>--</b></font> [' . $pvr['hpNow'] . '/' . $pvr['hpAll'] . ']';
+    }
+    $btl->priemAddLog($id, 1, 2, $this->u->info['id'], $this->u->info['enemy'], '<font color^^^^#' . $prv['color2'] . '>����������: �������!</font>', $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 1455446c..af4e960e 100644
--- a/_incl_data/class/priem/267.php
+++ b/_incl_data/class/priem/267.php
@@ -1,11 +1,10 @@
-<?
+<?php
+/** @var $this priems*/
 if(!defined('GAME')) {
 	die();
 }
-/*
-	�����: ��������������
-*/
-$pvr = array();
+/*	�����: �������������� */
+
 if( isset($pr_used_this) && isset($pr_moment) ) {
 	//������ ���
 	$fx_priem = function(  $id , $at , $uid, $j_id ) {
@@ -13,76 +12,5 @@ if( isset($pr_used_this) && isset($pr_moment) ) {
 	};
 	unset( $pr_used_this );
 }else{
-	//�������� ��� �����
-
-	$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'].'. <font Color='.$prv['color'].'><b '.$btl->maginfoattack($u->info['id'],$this->ue['id'],3).'>'.$pvr['hpSee'].'</b></font> ['.$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'].'. <font Color='.$prv['color'].'><b '.$btl->maginfoattack($u->info['id'],$this->ue['id'],3).'>--</b></font> ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']';
-	}
-	$btl->priemAddLog( $id, 1, 2, $u->info['id'], $this->ue['id'],
-		'<font color^^^^#'.$prv['color2'].'>��������������</font>',
-		$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/44.php b/_incl_data/class/priem/44.php
index 4b5ead0b..3dd5d50c 100644
--- a/_incl_data/class/priem/44.php
+++ b/_incl_data/class/priem/44.php
@@ -6,8 +6,8 @@ if(!defined('GAME')) {
 	�����: �������� ������ [8]
 */
 $pvr = array();
-	$pvr['hp_0'] = 40;
-	$pvr['hp_1'] = 14;
+	$pvr['hp_0'] = 51;
+	$pvr['hp_1'] = 45;
 	//�������� ��� �����
 	$pvr['hp'] = $pvr['hp_0'];
 	$pvr['hp'] = $this->magatack( $u->info['id'], $this->ue['id'], $pvr['hp'], '�����', 1 );
diff --git a/_incl_data/class/priem/93.php b/_incl_data/class/priem/93.php
index b92bc8d3..8c114d84 100644
--- a/_incl_data/class/priem/93.php
+++ b/_incl_data/class/priem/93.php
@@ -7,7 +7,7 @@ if(!defined('GAME')) {
 */
 $pvr = array();
 	//�������� ��� �����
-	$pvr['hp'] = rand(1,87);
+	$pvr['hp'] = rand(40,50);
 	$pvr['hp'] = $this->magatack( $u->info['id'], $this->ue['id'], $pvr['hp'], '������', 1 );
 	$pvr['promah_type'] = $pvr['hp'][3];
 	$pvr['promah'] = $pvr['hp'][2];
diff --git a/_incl_data/class/priem/95.php b/_incl_data/class/priem/95.php
index 7d312b87..2554388e 100644
--- a/_incl_data/class/priem/95.php
+++ b/_incl_data/class/priem/95.php
@@ -59,8 +59,8 @@ $pvr = array();
 		$prv['color'] = '909090';
 	}
 	
-
-    $this->addAirStaticPoints(); /* ���� � �������*/
+	//$this->mg2static_points( $this->ue['id'] , $btl->stats[$btl->uids[$u->info['id']]] );
+$this->addAirStaticPoints(); /* ���� � �������*/
 	
 	$prv['text2'] = '{tm1} '.$prv['text'].'. <font Color='.$prv['color'].'><b '.$btl->maginfoattack($u->info['id'],$this->ue['id'],2).'>'.$pvr['hpSee'].'</b></font> ['.$pvr['hpNow'].'/'.$pvr['hpAll'].']';
 	if( $pvr['promah_type'] == 2 ) {
diff --git a/_incl_data/class/priems/air.php b/_incl_data/class/priems/air.php
index 83a29a64..c5c60624 100644
--- a/_incl_data/class/priems/air.php
+++ b/_incl_data/class/priems/air.php
@@ -149,7 +149,7 @@ if(isset($hod))
 	}elseif($pl['id']==93)
 	{
 		//������ [8]
-		$hpmin = rand(1,87);
+		$hpmin = rand(40,50);
 	}elseif($pl['id']==94)
 	{
 		//������ [9]
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 @@
-<?
+<?php
 if(!defined('GAME'))
 {
 	die();
 }
 
+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);
+}
+
 if($pl['id'] == 189) {
 	$imun = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$u->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} ����� &quot;<b>'.$pl['name'].'</b>&quot; � ��������'.$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/1september_obmen.php b/_incl_data/class/quest/1september_obmen.php
index f56a7e55..e3e30f57 100644
--- a/_incl_data/class/quest/1september_obmen.php
+++ b/_incl_data/class/quest/1september_obmen.php
@@ -1,3 +1 @@
-<?
-$txt .= '<br><b><font color=red>� ��� ��� ���������� ��������� ��� ������...</b></font>';
-?>
\ No newline at end of file
+<?php $txt.= '<br><strong style="color: red;">� ��� ��� ���������� ��������� ��� ������...</strong>';
diff --git a/active.php b/active.php
index 3f258298..b159f3ec 100644
--- a/active.php
+++ b/active.php
@@ -9,8 +9,8 @@ die();
 
 define('GAME',true);
 setlocale(LC_CTYPE ,"ru_RU.CP1251");
-include('_incl_data/__config.php');
-include('_incl_data/class/__db_connect.php');
+require_once('_incl_data/__config.php');
+require_once('_incl_data/class/__db_connect.php');
 
 function error($e)
 {
diff --git a/admin.php b/admin.php
deleted file mode 100644
index cf14996a..00000000
--- a/admin.php
+++ /dev/null
@@ -1,578 +0,0 @@
-<?php
-/*
-
-	���� ��� ��������� ������.
-	��������� ���������, ��������� ������, ��������� �����, ��������� �����, ��������� ��������, ��������� ��������� ���������
-
-*/
-
-define('GAME',true);
-
-include('_incl_data/__config.php');
-include('_incl_data/class/__db_connect.php');
-include('_incl_data/class/__user.php');
-
-if(isset($_GET['bonus'])) {
-	$sp = mysql_query('SELECT * FROM `users` WHERE `real` = 1 AND `banned` = 0 AND `id` = 75301');
-	while( $pl = mysql_fetch_array($sp) ) {
-		//
-		//$u->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 = '�������� ��� ������� ��������!<br><br>����� ���������: '.$_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,',');
-	
-	
-?>
-<!DOCTYPE html>
-<html xmlns="https://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
-<script type="text/javascript" src="js/jquery.js"></script>
-<title>�������� �������������� ����������</title>
-
-<script>
-var admin = {
-	com:{},
-	start:function() {
-		var i = 0;
-		while( i <= 17 ) {	
-			$('#w'+i).attr('IDreal',i);		
-			$('#w'+i).bind('click', function(){ admin.select($(this).attr('IDreal')); } );			
-			i++;
-		}
-		
-		var i = 0;
-		while( i <= 12 ) {	
-			$('#e'+i).attr('IDreal',i);		
-			$('#e'+i).bind('click', function(){ admin.select_eff($(this).attr('IDreal')); } );			
-			i++;
-		}
-		
-		var i = 0;
-		while( i <= 18 ) {	
-			$('#p'+i).attr('IDreal',i);		
-			$('#p'+i).bind('click', function(){ admin.select_pr($(this).attr('IDreal')); } );			
-			i++;
-		}
-	},
-	save:function() {
-		var r = this.finish_line();
-		$('#save').html( '<b>���������� � ����� ������:</b><br><br><form name="f1" id="f1" action="admin.php" target="_blank" method="post"><textarea name="complect_saver" style="width:600px;" rows="5">'+r+'</textarea><br><button type="sumbit"></button></form>' );
-		$('#f1').submit();
-	},
-	finish_line:function() {
-		
-		this.com['lvl'] = $('#lvl').val();
-		this.com['up'] = $('#up').val();
-		this.com['class'] = $('#pclss').val();
-		
-		var i = 1;
-		while( i <= 6 ) {
-			this.com['s'+i] = $('#s'+i).val();
-			i++;
-		}
-		
-		var r = JSON.stringify( this.com );		
-		return r;
-	
-	},
-	take:function( id, i ) {
-		if( top.items[id][i] != undefined ) {
-			this.com['w'+id] = top.items[id][i][0];
-			$('#w'+id).attr({
-					'src':'https://img.new-combats.com/i/items/'+top.items[id][i][2],
-					'title':top.items[id][i][1]
-				});
-		}
-	},
-	take_eff:function( id, i ) {
-		if( top.items['eff'][i] != undefined ) {
-			this.com['e'+id] = top.items['eff'][i][0];
-			$('#e'+id).attr({
-					'src':'https://img.new-combats.com/i/eff/'+top.items['eff'][i][2],
-					'title':top.items['eff'][i][1]
-				});
-		}
-	},
-	take_pr:function( id, i ) {
-		if( top.items['pr'][i] != undefined ) {
-			this.com['p'+id] = top.items['pr'][i][0];
-			$('#p'+id).attr({
-					'src':'https://img.new-combats.com/i/eff/'+top.items['pr'][i][2],
-					'title':top.items['pr'][i][1]
-				});
-		}
-	},
-	select_pr:function (id) {
-		var html = '';
-		
-		if( top.items['pr'] != undefined ) {
-		
-			var i = 0;
-			
-			while( i != -1 ) {
-				
-				if( top.items['pr'][i] == undefined ) {
-					
-					i = -2;
-					
-				}else{
-					
-					html += '<img width="40" height="25" onclick="admin.take_pr('+id+','+i+');" style="cursor:pointer;padding:2px;" title="'+top.items['pr'][i][1]+'" src="https://img.new-combats.com/i/eff/'+top.items['pr'][i][2]+'">';
-				
-				}
-				
-				i++;
-			}
-		
-		}
-		
-		if( html == '' ) {
-			html = '��� ���������� �������';
-		}
-		
-		$('#items_add').html( html );
-	},
-	select_eff:function (id) {
-		var html = '';
-		
-		if( top.items['eff'] != undefined ) {
-		
-			var i = 0;
-			
-			while( i != -1 ) {
-				
-				if( top.items['eff'][i] == undefined ) {
-					
-					i = -2;
-					
-				}else{
-					
-					html += '<img width="40" height="25" onclick="admin.take_eff('+id+','+i+');" style="cursor:pointer;padding:2px;" title="'+top.items['eff'][i][1]+'" src="https://img.new-combats.com/i/eff/'+top.items['eff'][i][2]+'">';
-				
-				}
-				
-				i++;
-			}
-		
-		}
-		
-		if( html == '' ) {
-			html = '��� ���������� ��������';
-		}
-		
-		$('#items_add').html( html );
-	},
-	select:function( id ) {
-		var html = '';
-		
-		if( top.items[id] != undefined ) {
-		
-			var i = 0;
-			
-			while( i != -1 ) {
-				
-				if( top.items[id][i] == undefined ) {
-					
-					i = -2;
-					
-				}else{
-					
-					html += '<img onclick="admin.take('+id+','+i+');" style="cursor:pointer;padding:2px;" title="'+top.items[id][i][1]+'" src="https://img.new-combats.com/i/items/'+top.items[id][i][2]+'">';
-				
-				}
-				
-				i++;
-			}
-		
-		}
-		
-		if( html == '' ) {
-			html = '��� ���������� ���������';
-		}
-		
-		$('#items_add').html( html );
-	}
-};
-
-var items = {
-	<?
-	$i = 1;
-	while( $i <= 17 ) {
-		echo $i.':['.$w[$i].'],';
-		$i++;
-	}
-	echo '"eff":['.$eff.'],"pr":['.$pr.']';
-	?>
-};
-function MM_jumpMenu(targ,selObj,restore){ //v3.0
-  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
-  if (restore) selObj.selectedIndex=0;
-}
-</script> 
-
-</head>
-
-<body onLoad="admin.start();">
-<table width="100%" border="0" cellpadding="25" cellspacing="0">
-  <tr>
-    <td width="250" valign="top"><div style="width:240px; padding:2px; border-bottom:1px solid #666666; border-right:1px solid #666666; border-left:1px solid #FFFFFF; border-top:1px solid #FFFFFF;">
-      <div align="center">
-        <!-- blocked -->
-      </div>
-      <table width="240" border="0" cellspacing="0" cellpadding="0">
-        <tr>
-          <td width="60" valign="top"><table width="60" height="280" border="0" cellspacing="0" cellpadding="0">
-            <tr>
-              <td height="60"><div style="position:relative"><img id="w1" style="display:block;" title="������ ���� ����" src="https://img.new-combats.com/i/items/w/w9.gif"></div></td>
-            </tr>
-            <tr>
-              <td height="40"><img id="w2" style="display:block;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/w13.gif"></td>
-            </tr>
-            <tr>
-              <td height="60"><img id="w3" style="display:block;" title="������ ���� ���" src="https://img.new-combats.com/i/items/w/w3.gif"></td>
-            </tr>
-            <tr>
-              <td height="80"><img id="w5" style="display:block;" title="������ ���� ���" src="https://img.new-combats.com/i/items/w/w4.gif"></td>
-            </tr>
-            <tr>
-              <td height="40"><img id="w7" style="display:block;" title="������ ���� ����" src="https://img.new-combats.com/i/items/w/w5.gif"></td>
-            </tr>
-          </table></td>
-          <td height="280" valign="top"><table width="120" height="280" border="0" cellspacing="0" cellpadding="0">
-            <tr>
-              <td height="20" valign="top" bgcolor="#EDEDED"><!-- HP and MP -->
-                <!-- --></td>
-            </tr>
-            <tr>
-              <td valign="top" bgcolor="#333333">&nbsp;</td>
-            </tr>
-            <tr>
-              <td height="40"><div align="center">
-                <table width="120" border="0" cellspacing="0" cellpadding="0">
-                  <tr>
-                    <td width="40" height="20"><img style="display:block;" title="������ ���� ������ ������" src="https://img.new-combats.com/i/items/w/w15.gif"></td>
-                    <td width="40" height="20"><img style="display:block;" title="������ ���� ����������� ������" src="https://img.new-combats.com/i/items/w/w15.gif"></td>
-                    <td width="40" height="20"><img style="display:block;" title="������ ���� ����� ������" src="https://img.new-combats.com/i/items/w/w15.gif"></td>
-                  </tr>
-                  <tr>
-                    <td width="40" height="20"><img style="display:block;" title="������ ���� �����" src="https://img.new-combats.com/i/items/w/w20.gif"></td>
-                    <td width="40" height="20"><img style="display:block;" title="������ ���� �����" src="https://img.new-combats.com/i/items/w/w20.gif"></td>
-                    <td width="40" height="20"><img style="display:block;" title="������ ���� �����" src="https://img.new-combats.com/i/items/w/w20.gif"></td>
-                  </tr>
-                </table>
-              </div></td>
-            </tr>
-          </table></td>
-          <td width="60" valign="top"><table width="60" border="0" cellspacing="0" cellpadding="0">
-            <tr>
-              <td height="20"><img id="w8" style="display:block;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/w1.gif"></td>
-            </tr>
-            <tr>
-              <td height="20"><img id="w9" style="display:block;" title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w2.gif"></td>
-            </tr>
-            <tr>
-              <td height="20"><table width="60" border="0" cellspacing="0" cellpadding="0">
-                <tr>
-                  <td width="20" height="20"><img id="w10" style="display:block;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/w6.gif"></td>
-                  <td width="20"><img id="w11" style="display:block;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/w6.gif"></td>
-                  <td width="20"><img id="w12" style="display:block;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/w6.gif"></td>
-                </tr>
-              </table></td>
-            </tr>
-            <tr>
-              <td height="40"><img id="w13" style="display:block;" title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w11.gif"></td>
-            </tr>
-            <tr>
-              <td height="60"><img id="w14" style="display:block;" title="������ ���� ���" src="https://img.new-combats.com/i/items/w/w10.gif"></td>
-            </tr>
-            <tr>
-              <td height="80"><img id="w16" style="display:block;" title="������ ���� ���" src="https://img.new-combats.com/i/items/w/w19.gif"></td>
-            </tr>
-            <tr>
-              <td height="40"><img id="w17" style="display:block;" title="������ ���� �����" src="https://img.new-combats.com/i/items/w/w12.gif"></td>
-            </tr>
-          </table></td>
-        </tr>
-      </table>
-      <p><strong>�������:</strong></p>
-      <table width="240" border="0" cellspacing="0" cellpadding="0">
-        <tr>
-          <td width="40" height="25"><img id="e1" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td width="40"><img id="e2" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td width="40"><img id="e3" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td width="40"><img id="e4" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td width="40"><img id="e5" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td width="40"><img id="e6" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-        </tr>
-        <tr>
-          <td height="25"><img id="e7" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td><img id="e8" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td><img id="e9" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td><img id="e10" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td><img id="e11" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td><img id="e12" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-        </tr>
-      </table>
-      <p><strong>������:</strong></p>
-      <table width="240" border="0" cellspacing="0" cellpadding="0">
-        <tr>
-          <td width="40" height="25"><img id="p1" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td width="40"><img id="p2" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td width="40"><img id="p3" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td width="40"><img id="p4" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td width="40"><img id="p5" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td width="40"><img id="p6" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-        </tr>
-        <tr>
-          <td height="25"><img id="p7" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td><img id="p8" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td><img id="p9" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td><img id="p10" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td><img id="p11" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td><img id="p12" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-        </tr>
-        <tr>
-          <td height="25"><img id="p13" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td><img id="p14" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td><img id="p15" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td><img id="p16" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td><img id="p17" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-          <td><img id="p18" title="������ ���� ����������" src="https://img.new-combats.com/i/items/w/w101.gif"></td>
-        </tr>
-      </table>
-    </div>
-    <p><a href="javascript:admin.save(1);">��������� �������� � ����</a></p></td>
-    
-        <td width="150" align="right" valign="top"><p><strong>����� ��������� (������):</strong></p>
-        <p>
-        ����: 
-          <input id="s1" style="width:35px" value="3">   <br>     
-        ��������: 
-        <input id="s2" style="width:35px" value="3">   <br> 
-        ��������: 
-        <input id="s3" style="width:35px" value="3">   <br> 
-        ������������: 
-        <input id="s4" style="width:35px" value="3">   <br> 
-        ��������: 
-        <input id="s5" style="width:35px" value="0">   <br> 
-        ��������: 
-        <input id="s6" style="width:35px" value="0">
-        </p>
-        <p><strong>�������� ����� ��������� � ���: </strong></p>
-        <p>
-          �����: 
-          <select id="pclss">
-            <option selected value="1">����</option>
-            <option value="2">����</option>
-            <option value="3">������</option>
-            <option value="4">���������</option>
-            <option value="5">��� ����</option>
-            <option value="6">��� ����</option>
-            <option value="7">��� �����</option>
-            <option value="8">��� �������</option>
-          </select>
-<br>
-        �������:
-          <input id="lvl" style="width:35px" value="0">
-          <br>
-          ���:
-          <input id="up" style="width:35px" value="0">
-<br> 
-        </p>
-        
-        <hr>
-        </td>
-    
-    <td valign="top">
-    <div id="save" style="border:1px solid red; padding:10px;margin:5px; background-color:#FCC; color:#333"></div>
-    <br>
-    <b>�������� ��� �����:</b>
-    <br>
-    <div id="items_add">
-    	
-    </div>
-    </td>
-  </tr>
-</table>
-<script>
-<?
-	
-	if(isset($error)) {
-		echo 'alert("'.$error.'");';
-	}
-	
-?>
-</script>
-</body>
-</html>
-<?
-}else{
-	echo '��� �������� ������� � ������� ������� - ���������� � ������������� �������, �������� ������ ����� ������ �����, �� ������������� ������� ������� ������������� �� ������������� �������.';
-}
-?>
\ No newline at end of file
diff --git a/audio.php b/audio.php
index 57844219..5748cb34 100644
--- a/audio.php
+++ b/audio.php
@@ -1,22 +1,22 @@
-<?php

-ini_set("display_errors","1");

-ini_set("display_startup_errors","1");

-ini_set('error_reporting', E_ALL);

-ini_set("log_errors","1");

-ini_set("error_log","php-errors.log");

-//header("Content-Type: audio/mp3; codecs=opus;",true); //charset=us-ascii

-//header("Accept-Ranges: bytes");

-//charset=us-ascii

-$ttime=time();

-$body = file_get_contents('php://input');

-$loc = "audio/audio_".$ttime.".mp3";

-file_put_contents($loc, $body, FILE_APPEND);

-//die ('{["'.$ttime.'"]}');

-//die ($ttime);

-echo $ttime;

-//die (file_get_contents('php://input'));

-//die ('{["'.file_get_contents('php://input').'"]}');

-//$homepage = ('{["'.file_get_contents('./'.$loc).'"]}');

-//echo $homepage;

-

-?>

+<?php
+ini_set("display_errors","1");
+ini_set("display_startup_errors","1");
+ini_set('error_reporting', E_ALL);
+ini_set("log_errors","1");
+ini_set("error_log","php-errors.log");
+//header("Content-Type: audio/mp3; codecs=opus;",true); //charset=us-ascii
+//header("Accept-Ranges: bytes");
+//charset=us-ascii
+$ttime=time();
+$body = file_get_contents('php://input');
+$loc = "audio/audio_".$ttime.".mp3";
+file_put_contents($loc, $body, FILE_APPEND);
+//die ('{["'.$ttime.'"]}');
+//die ($ttime);
+echo $ttime;
+//die (file_get_contents('php://input'));
+//die ('{["'.file_get_contents('php://input').'"]}');
+//$homepage = ('{["'.file_get_contents('./'.$loc).'"]}');
+//echo $homepage;
+
+?>
diff --git a/balance.php b/balance.php
index c1f56317..1e1db0ed 100644
--- a/balance.php
+++ b/balance.php
@@ -1,319 +1,415 @@
 <?php
-define('GAME',true);	
+# Admin Only Area
+const GAME = true;
 include('_incl_data/__config.php');
 include('_incl_data/class/__db_connect.php');
-include('_incl_data/class/__user.php');
-if(isset($_GET['connect'])) {
-	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');
+$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 '<style>
+    ]; //�� ���� � ������ ������
+    $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 '<style>
 	.boxpro0 { width:30px; background-color:green; }
 	.boxproms { width:2px; background-color:blue; margin:0 5px 0 5px; }
 	.boxpro1 { width:30px; max-height:3px; background-color:grey; }
 	.boxpro0:hover { background-color:red; }
 	</style>';
-	echo '<table border="0" cellspacing="0" cellpadding="0"><tr>
+    echo '<table border="0" cellspacing="0" cellpadding="0"><tr>
 	<td valign="bottom"><div class="boxpro1"></div></td><td valign="bottom"><div class="boxpro1"></div></td><td valign="bottom"><div class="boxpro1"></div></td><td valign="bottom"><div class="boxpro1"></div></td><td valign="bottom"><div class="boxpro1"></div></td><td valign="bottom"><div class="boxpro1"></div></td>
 	';
-	$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 '<td valign="bottom"><div class="boxproms" style="height:100px;"></div></td><td>'.$summ.' RUB</td></tr></table><br><br><table border="0" cellspacing="0" cellpadding="0"><tr>';
-			}
-			$summ = 0;
-			$mn = date('m',$i);
-		}
-		echo '<td valign="bottom"><div title="������ '.round(($data[date('d.m.Y',$i)]),2).' RUB'."\n".'����: '.date('d.m.Y',$i).'" class="boxpro'.$nl.'" style="height:'.round(10+$data[date('d.m.Y',$i)]/$max*100).'px;"></div></td>';
-		//
-		$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++;
-	}
-	//
-	//<td valign="bottom">&nbsp;</td>
-	//
-	echo '</tr></table><hr>����: '.$j.' , �����: '.$sum.' RUB<br>������� � ����: '.round($sum/$j,2).' RUB<br>������� � �����: '.round($sum/$j*30,2).' RUB<br>�� �������: '.$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 '<td valign="bottom"><div class="boxproms" style="height:100px;"></div></td><td>' . $summ . ' RUB</td></tr></table><br><br><table border="0" cellspacing="0" cellpadding="0"><tr>';
+            }
+            $summ = 0;
+            $mn = date('m', $i);
+        }
+        echo '<td valign="bottom"><div title="������ ' . round(
+                ($data[date('d.m.Y', $i)]), 2
+            ) . ' RUB' . "\n" . '����: ' . date('d.m.Y', $i) . '" class="boxpro' . $nl . '" style="height:' . round(
+                10 + $data[date('d.m.Y', $i)] / $max * 100
+            ) . 'px;"></div></td>';
+        //
+        $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++;
+    }
+    //
+    //<td valign="bottom">&nbsp;</td>
+    //
+    echo '</tr></table><hr>����: ' . $j . ' , �����: ' . $sum . ' RUB<br>������� � ����: ' . round(
+            $sum / $j, 2
+        ) . ' RUB<br>������� � �����: ' . round($sum / $j * 30, 2) . ' RUB<br>�� �������: ' . $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];
 ?>
 <!DOCTYPE html>
 <html xmlns="https://www.w3.org/1999/xhtml">
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
-<title>���������� �������</title>
-<style type="text/css">
-body {
-	margin-left: 0px;
-	margin-top: 0px;
-	margin-right: 0px;
-	margin-bottom: 0px;
-	font-family: tahoma, arial, verdana, sans-serif, Lucida Sans;
-	font-size: 11px;
-}
-.txt1 {
-	color: #707a88;
-}
-</style>
-<script type="text/javascript">
-function MM_jumpMenu(targ,selObj,restore){ //v3.0
-  eval(targ+".location='?mm="+selObj.options[selObj.selectedIndex].value+"'");
-  if (restore) selObj.selectedIndex=0;
-}
-</script>
+    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"/>
+    <title>���������� �������</title>
+    <style type="text/css">
+        body {
+            margin-left: 0px;
+            margin-top: 0px;
+            margin-right: 0px;
+            margin-bottom: 0px;
+            font-family: tahoma, arial, verdana, sans-serif, Lucida Sans;
+            font-size: 11px;
+        }
+
+        .txt1 {
+            color: #707a88;
+        }
+    </style>
+    <script type="text/javascript">
+        function MM_jumpMenu(targ, selObj, restore) { //v3.0
+            eval(targ + ".location='?mm=" + selObj.options[selObj.selectedIndex].value + "'");
+            if (restore) selObj.selectedIndex = 0;
+        }
+    </script>
 </head>
 <body>
 <table width="1000" bgcolor="#fefefe" border="0" align="center" cellpadding="0" cellspacing="0">
-  <tr>
-    <td height="30" align="center"><form name="form1" method="post" action="">
-      ������ ����������: 
-        <select name="mm" id="mm" onChange="MM_jumpMenu('parent',this,0)">
-            <option <? if($mm=='01'){ echo 'selected'; } ?> value="01">������</option>
-            <option <? if($mm=='02'){ echo 'selected'; } ?> value="02">�������</option>
-            <option <? if($mm=='03'){ echo 'selected'; } ?> value="03">����</option>
-            <option <? if($mm=='04'){ echo 'selected'; } ?> value="04">������</option>
-            <option <? if($mm=='05'){ echo 'selected'; } ?> value="05">���</option>
-            <option <? if($mm=='06'){ echo 'selected'; } ?> value="06">����</option>
-            <option <? if($mm=='07'){ echo 'selected'; } ?> value="07">����</option>
-            <option <? if($mm=='08'){ echo 'selected'; } ?> value="08">������</option>
-            <option <? if($mm=='09'){ echo 'selected'; } ?> value="09">��������</option>
-            <option <? if($mm=='10'){ echo 'selected'; } ?> value="10">�������</option>
-            <option <? if($mm=='11'){ echo 'selected'; } ?> value="11">������</option>
-            <option <? if($mm=='12'){ echo 'selected'; } ?> value="12">�������</option>
-          </select>
-    , <?=$yy;?>
-     ����.
-    ��������� ��������:
-     <span style="font-weight: bold"><?=number_format($balance, 0, ",", " ");?></span> RUB | ������� �� ���� �����: <span style="font-weight: bold"><?=number_format($plus, 0, ",", " ");?></span> RUB | ���� ��������� ������:
-<?=date('d.m.Y H:i:s');?>
-    </form></td>
-  </tr>
-  <!--<tr>
-    <td>     
-    <table width="1000" border="0" align="center" cellpadding="5" cellspacing="0">
-      <tr>
-        <td width="500" align="center" bgcolor="#CEE4C5" class="txt1" style="color: #265214; font-family: tahoma, arial, verdana, sans-serif, 'Lucida Sans';">�����������</td>
-        <td width="500" align="center" bgcolor="#E1C8C9" class="txt1" style="color: #A3585C">��������</td>
-      </tr>
-    </table>    
-    </td>
-  </tr>-->
-  <tr>
-    <td>
-    <? 
-	$i = 1;
-	$days = ($time_finish-$time_start)/86400;
-	while($i<=$days)
-	{
-	$dt = $time_start+(86400*($i-1));
-	if($dt<time())
-	{
-		$lim = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `balance_money` WHERE `time` >= '.$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'];
-	?>
-    <!-- day -->
-	<div style="background-color:#cad3e0;color:#8591a2;border:1px solid #cdd5e2;">
-	  <div style="padding:10px;">����: <b><?=date('d.m.Y',$dt);?></b>, �������� �� ���� ����: <?=$lim;?>, ������� � ������ ���: <b><?=number_format($mst, 0, ",", " ");?></b> RUB, ������� � ����� ���: <b><?=number_format($mft, 0, ",", " ");?></b> RUB</div>
- 		<!-- -->
-        <? 
-		$sp = mysql_query('SELECT * FROM `balance_money` WHERE `time` >= '.$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)
-			{
-		?>
-        <table width="998" border="0" align="center" cellpadding="0" cellspacing="0">
-          <tr>
-            <td width="499" align="center" valign="top" bgcolor="#f5f7fa" class="txt1">
-            <table bgcolor="#e6f8ea" width="100%" border="0" cellspacing="0" cellpadding="5">
-              <tr>
-                <td width="100" align="center"><?=date('d.m.Y H:i:s',$pl['time']);?></td>
-                <td width="75" align="center"><?=number_format($pl['money'], 0, ",", " ");?> RUB</td>
-                <td>�������: <span style="font-weight: bold"><?=number_format($pl['balance'], 0, ",", " ");?></span> RUB</td>
-                <td width="100" align="center"><? if($pl['cancel']==0){ echo '<a href="?mm='.$mm.'&cancel='.$pl['id'].'">���������</a>'; }else{ echo '<a href="?mm='.$mm.'&recancel='.$pl['id'].'">����������</a>'; } ?></td>
-                </tr>
-            </table>
-            </td>
-            <td width="499" align="left" valign="top" bgcolor="#f5f7fa" class="txt1">
-              <table width="100%" border="0" cellspacing="0" cellpadding="5">
-                <tr>
-                  <td width="30" align="left" valign="top">&larr;</td>
-                  <td valign="top">&nbsp;<?=$pl['comment2'];?></td>
-                </tr>
-              </table>
-            </td>
-          </tr>
-        </table>
-        <? }else{ ?>
-        <table width="998" border="0" align="center" cellpadding="0" cellspacing="0">
-          <tr>
-            <td width="499" align="right" valign="top" bgcolor="#f5f7fa" class="txt1">
-            <table width="100%" border="0" cellspacing="0" cellpadding="5">
-              <tr>            
-                <td valign="top" bgcolor="#F5F7FA">&nbsp;<?=$pl['comment2'];?></td>
-                <td width="30" align="right" valign="top">&rarr;</td>
-              </tr>
-            </table>
-            </td>
-            <td width="499" align="center" valign="top" bgcolor="<? if($pl['money']<0){ echo '#f8e6ef'; }else{ echo '#F5F7FA'; } ?>" class="txt1">
-            <table bgcolor="<? if($pl['money']<0 && $pl['cancel']==0){ echo '#f8e6ef'; }else{ echo '#F5F7FA'; } ?>" width="100%" border="0" cellspacing="0" cellpadding="5">
-              <tr>
-                <td width="100" align="center"><?=date('d.m.Y H:i:s',$pl['time']);?></td>
-                <td width="75" align="center"><?=number_format($pl['money'], 0, ",", " ");?> RUB</td>
-                <td>�������: <span style="font-weight: bold"><?=number_format($pl['balance'], 0, ",", " ");?></span> RUB</td>
-                <td width="100" align="center"><? if($pl['cancel']==0){ echo '<a href="?mm='.$mm.'&cancel='.$pl['id'].'">���������</a>'; }else{ echo '<a href="?mm='.$mm.'&recancel='.$pl['id'].'">����������</a>'; } ?></td>
-                </tr>
-            </table>
-            </td>
-          </tr>
-        </table>
-        <? } } ?>
-        <!-- -->
-      </div>
-    <? } $i++; } ?>
-    <? if($mm==date('m')){ ?>
-    <br><br><br>
-    <div style="background-color:#F5F7FA;">
-    <form name="form1" method="post" action="?mm=<?=$mm;?>#addline">
-      <table width="100%" border="0" align="center" cellpadding="5" style="border:1px solid #8591a2;" cellspacing="0">
-        <tr>
-          <td bgcolor="#CAD3E0">�����: <input name="money" type="text" size="21" maxlength="7" /> 
-            RUB</td>
-        </tr>
-        <tr>
-          <td bgcolor="#CAD3E0"><p class="txt1">����������� (500 �������� ��������):</p>
-            <p>
-              <textarea style="width:980px;" name="text" id="text" cols="45" rows="5"></textarea>
-            </p></td>
-        </tr>
-        <tr>
-          <td align="right" bgcolor="#CAD3E0"><input type="submit" name="button" id="button" value="���������� � ������ �� <?=date('d.m.Y');?>"></td>
-        </tr>
-      </table>
-     </form>
-    </div>
-    <? } ?>
-    <!-- day -->
-    <br><br><br>time :: <?=time();?>
-    </td>
-  </tr>
+    <tr>
+        <td height="30" align="center">
+            <form name="form1" method="post" action="">
+                ������ ����������:
+                <select name="mm" id="mm" onChange="MM_jumpMenu('parent',this,0)">
+                    <option <? if ($mm == '01') {
+                        echo 'selected';
+                    } ?> value="01">������
+                    </option>
+                    <option <? if ($mm == '02') {
+                        echo 'selected';
+                    } ?> value="02">�������
+                    </option>
+                    <option <? if ($mm == '03') {
+                        echo 'selected';
+                    } ?> value="03">����
+                    </option>
+                    <option <? if ($mm == '04') {
+                        echo 'selected';
+                    } ?> value="04">������
+                    </option>
+                    <option <? if ($mm == '05') {
+                        echo 'selected';
+                    } ?> value="05">���
+                    </option>
+                    <option <? if ($mm == '06') {
+                        echo 'selected';
+                    } ?> value="06">����
+                    </option>
+                    <option <? if ($mm == '07') {
+                        echo 'selected';
+                    } ?> value="07">����
+                    </option>
+                    <option <? if ($mm == '08') {
+                        echo 'selected';
+                    } ?> value="08">������
+                    </option>
+                    <option <? if ($mm == '09') {
+                        echo 'selected';
+                    } ?> value="09">��������
+                    </option>
+                    <option <? if ($mm == '10') {
+                        echo 'selected';
+                    } ?> value="10">�������
+                    </option>
+                    <option <? if ($mm == '11') {
+                        echo 'selected';
+                    } ?> value="11">������
+                    </option>
+                    <option <? if ($mm == '12') {
+                        echo 'selected';
+                    } ?> value="12">�������
+                    </option>
+                </select>
+                , <?= $yy; ?>
+                ����.
+                ��������� ��������:
+                <span style="font-weight: bold"><?= number_format($balance, 0, ",", " "); ?></span> RUB | ������� ��
+                ���� �����: <span style="font-weight: bold"><?= number_format($plus, 0, ",", " "); ?></span> RUB | ����
+                ��������� ������:
+                <?= date('d.m.Y H:i:s'); ?>
+            </form>
+        </td>
+    </tr>
+
+    <tr>
+        <td>
+            <?
+            $i = 1;
+            $days = ($time_finish - $time_start) / 86400;
+            while ($i <= $days) {
+                $dt = $time_start + (86400 * ($i - 1));
+                if ($dt < time()) {
+                    $lim = mysql_fetch_array(
+                        mysql_query(
+                            'SELECT COUNT(*) FROM `balance_money` WHERE `time` >= ' . $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'];
+                    ?>
+                    <!-- day -->
+                    <div style="background-color:#cad3e0;color:#8591a2;border:1px solid #cdd5e2;">
+                        <div style="padding:10px;">����: <b><?= date('d.m.Y', $dt); ?></b>, �������� �� ����
+                            ����: <?= $lim; ?>, ������� � ������ ���: <b><?= number_format($mst, 0, ",", " "); ?></b>
+                            RUB, ������� � ����� ���: <b><?= number_format($mft, 0, ",", " "); ?></b> RUB
+                        </div>
+                        <!-- -->
+                        <?
+                        $sp = mysql_query(
+                            'SELECT * FROM `balance_money` WHERE `time` >= ' . $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) {
+                                ?>
+                                <table width="998" border="0" align="center" cellpadding="0" cellspacing="0">
+                                    <tr>
+                                        <td width="499" align="center" valign="top" bgcolor="#f5f7fa" class="txt1">
+                                            <table bgcolor="#e6f8ea" width="100%" border="0" cellspacing="0"
+                                                   cellpadding="5">
+                                                <tr>
+                                                    <td width="100" align="center"><?= date(
+                                                            'd.m.Y H:i:s', $pl['time']
+                                                        ); ?></td>
+                                                    <td width="75" align="center"><?= number_format(
+                                                            $pl['money'], 0, ",", " "
+                                                        ); ?> RUB
+                                                    </td>
+                                                    <td>�������: <span style="font-weight: bold"><?= number_format(
+                                                                $pl['balance'], 0, ",", " "
+                                                            ); ?></span> RUB
+                                                    </td>
+                                                    <td width="100" align="center"><? if ($pl['cancel'] == 0) {
+                                                            echo '<a href="?mm=' . $mm . '&cancel=' . $pl['id'] . '">���������</a>';
+                                                        } else {
+                                                            echo '<a href="?mm=' . $mm . '&recancel=' . $pl['id'] . '">����������</a>';
+                                                        } ?></td>
+                                                </tr>
+                                            </table>
+                                        </td>
+                                        <td width="499" align="left" valign="top" bgcolor="#f5f7fa" class="txt1">
+                                            <table width="100%" border="0" cellspacing="0" cellpadding="5">
+                                                <tr>
+                                                    <td width="30" align="left" valign="top">&larr;</td>
+                                                    <td valign="top">&nbsp;<?= $pl['comment2']; ?></td>
+                                                </tr>
+                                            </table>
+                                        </td>
+                                    </tr>
+                                </table>
+                            <? } else { ?>
+                                <table width="998" border="0" align="center" cellpadding="0" cellspacing="0">
+                                    <tr>
+                                        <td width="499" align="right" valign="top" bgcolor="#f5f7fa" class="txt1">
+                                            <table width="100%" border="0" cellspacing="0" cellpadding="5">
+                                                <tr>
+                                                    <td valign="top" bgcolor="#F5F7FA">
+                                                        &nbsp;<?= $pl['comment2']; ?></td>
+                                                    <td width="30" align="right" valign="top">&rarr;</td>
+                                                </tr>
+                                            </table>
+                                        </td>
+                                        <td width="499" align="center" valign="top" bgcolor="<? if ($pl['money'] < 0) {
+                                            echo '#f8e6ef';
+                                        } else {
+                                            echo '#F5F7FA';
+                                        } ?>" class="txt1">
+                                            <table bgcolor="<? if ($pl['money'] < 0 && $pl['cancel'] == 0) {
+                                                echo '#f8e6ef';
+                                            } else {
+                                                echo '#F5F7FA';
+                                            } ?>" width="100%" border="0" cellspacing="0" cellpadding="5">
+                                                <tr>
+                                                    <td width="100" align="center"><?= date(
+                                                            'd.m.Y H:i:s', $pl['time']
+                                                        ); ?></td>
+                                                    <td width="75" align="center"><?= number_format(
+                                                            $pl['money'], 0, ",", " "
+                                                        ); ?> RUB
+                                                    </td>
+                                                    <td>�������: <span style="font-weight: bold"><?= number_format(
+                                                                $pl['balance'], 0, ",", " "
+                                                            ); ?></span> RUB
+                                                    </td>
+                                                    <td width="100" align="center"><? if ($pl['cancel'] == 0) {
+                                                            echo '<a href="?mm=' . $mm . '&cancel=' . $pl['id'] . '">���������</a>';
+                                                        } else {
+                                                            echo '<a href="?mm=' . $mm . '&recancel=' . $pl['id'] . '">����������</a>';
+                                                        } ?></td>
+                                                </tr>
+                                            </table>
+                                        </td>
+                                    </tr>
+                                </table>
+                            <? }
+                        } ?>
+                        <!-- -->
+                    </div>
+                <? }
+                $i++;
+            } ?>
+            <? if ($mm == date('m')) { ?>
+                <br><br><br>
+                <div style="background-color:#F5F7FA;">
+                    <form name="form1" method="post" action="?mm=<?= $mm; ?>#addline">
+                        <table width="100%" border="0" align="center" cellpadding="5" style="border:1px solid #8591a2;"
+                               cellspacing="0">
+                            <tr>
+                                <td bgcolor="#CAD3E0">�����: <input name="money" type="text" size="21" maxlength="7"/>
+                                    RUB
+                                </td>
+                            </tr>
+                            <tr>
+                                <td bgcolor="#CAD3E0"><p class="txt1">����������� (500 �������� ��������):</p>
+                                    <p>
+                                        <textarea style="width:980px;" name="text" id="text" cols="45"
+                                                  rows="5"></textarea>
+                                    </p></td>
+                            </tr>
+                            <tr>
+                                <td align="right" bgcolor="#CAD3E0"><input type="submit" name="button" id="button"
+                                                                           value="���������� � ������ �� <?= date(
+                                                                               'd.m.Y'
+                                                                           ); ?>"></td>
+                            </tr>
+                        </table>
+                    </form>
+                </div>
+            <? } ?>
+            <!-- day -->
+            <br><br><br>time :: <?= time(); ?>
+        </td>
+    </tr>
 </table>
 </body>
 </html>
diff --git a/bandit.php b/bandit.php
index 785c15a1..858ce200 100644
--- a/bandit.php
+++ b/bandit.php
@@ -1,150 +1,159 @@
 <?php
 
-define('GAME',true);
+const 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($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 = '';
-		
-	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','','','<small>[<b><font color=0066ff>������</font></b>] ����� <b>".mysql_real_escape_string($u->info['login'])."</b> ������� <b>".($s*$win).".00</b> ���., ������: ".$s.".00 ���., ���� �".$gid."</small>','".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','','','<small>[<b><font color=0066ff>������</font></b>] ����� <b>" . mysql_real_escape_string(
+                    $u->info['login']
+                ) . "</b> ������� <b>" . ($s * $win) . ".00</b> ���., ������: " . $s . ".00 ���., ���� �" . $gid . "</small>','" . 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/bankCronRestart.php b/bankCronRestart.php
index 78efa68a..9dc21d14 100644
--- a/bankCronRestart.php
+++ b/bankCronRestart.php
@@ -69,8 +69,8 @@ define('GAME',true);
 
 setlocale(LC_CTYPE ,"ru_RU.CP1251");
 
-include('_incl_data/__config.php');
-include('_incl_data/class/__db_connect.php');
+require_once('_incl_data/__config.php');
+require_once('_incl_data/class/__db_connect.php');
 
 //��������� ������� ��� � �����
 mysql_query('UPDATE `stats` SET `transfers` = 100 WHERE `transfers` < 200');
diff --git a/batl_1.js1 b/batl_1.js1
deleted file mode 100644
index f4b5bf04..00000000
--- a/batl_1.js1
+++ /dev/null
@@ -1,479 +0,0 @@
-var loadingLogNow = true;
-var vlogid = 0;
-var battleClass = {
-	battle:0,
-	hod:0,
-	conf:{
-		timeout:'-- ���.',
-		damage:'0',
-		tactic:[ 0 , 0 , 0 , 0 , 0 , 0 , 0 ],
-		priems:[],		
-		pr:"",
-		pr_z:"",
-		pr_s:0
-	},
-	me:0,
-	enemy:0,
-	users:{ },
-	uids:[0],
-	priems:{ },
-	prms:[0],
-	eff:[],
-	act:[],
-	log:function(txt) {
-		console.log(txt);
-	},
-	start:function() {
-		this.reflesh(1);
-	},
-	reflesh:function( type ) {
-		$.getJSON( 'https://new-combats.com/getbattle.php',{ 'global':true,'type':type },function(data) {
-			//
-			if( data.e != undefined && data.e != "" ) {
-				alert( '������: ' + data.e );
-			}
-			//
-			battleClass.me = data.you;
-			battleClass.enemy = data.enemy;
-			battleClass.battle = data.btl;
-			battleClass.hod = data.hod;
-			battleClass.conf.timeout = data.to;
-			battleClass.conf.damage = data.dm;
-			battleClass.conf.pr = data.pr[0];
-			battleClass.conf.pr_z = data.pr[1];
-			battleClass.conf.pr_s = data.pr[2];
-			battleClass.conf.tactic = [ 0 , data.t1 , data.t2 , data.t3 , data.t4 , data.t5 , data.t6 , data.t7 ];
-			//
-			battleClass.eff = data.r.eff_me;
-			battleClass.act = data.r.act;
-			//
-			//������������
-			if( data.r.u != undefined ) {
-				var i = 0;
-				while( i != -1 ) {
-					if( data.r.u[i] != undefined ) {
-						if( data.r.u[i][0] > 0 ) {
-							//
-							if( battleClass.users[data.r.u[i][0]] == undefined ) {
-								battleClass.users[data.r.u[i][0]] = { 'complete':false };
-								battleClass.uids[0]++;
-								battleClass.uids[battleClass.uids[0]] = data.r.u[i][0];
-							}
-							battleClass.users[data.r.u[i][0]].id = data.r.u[i][0];
-							//
-							battleClass.users[data.r.u[i][0]].hp = data.r.u[i][1];
-							battleClass.users[data.r.u[i][0]].mp = data.r.u[i][2];
-							battleClass.users[data.r.u[i][0]].hpAll = data.r.u[i][3];
-							battleClass.users[data.r.u[i][0]].mpAll = data.r.u[i][4];
-							//
-							if( battleClass.users[data.r.u[i][0]].hp > battleClass.users[data.r.u[i][0]].hpAll ) {
-								battleClass.users[data.r.u[i][0]].hp = battleClass.users[data.r.u[i][0]].hpAll;
-							}
-							if( battleClass.users[data.r.u[i][0]].mp > battleClass.users[data.r.u[i][0]].mpAll ) {
-								battleClass.users[data.r.u[i][0]].mp = battleClass.users[data.r.u[i][0]].mpAll;
-							}
-							//
-						}else{
-							battleClass.log( '������, ����� �� ������...' );
-						}
-					}else{
-						i = -2;
-					}
-					i++;
-				}
-				battleClass.loadingGlobaldata();
-			}
-			//
-		});
-	},
-	loadingGlobaldata:function() {
-		var r = {
-			'load':0,
-			'users':"0",
-			'priems':"0"
-		};
-		//��������� ������������� ������� �� ����������
-		/*
-			����������, ����, �������, �����, �������
-		*/
-		var i = 1;
-		while( i <= battleClass.uids[0] ) {
-			if( battleClass.users[ battleClass.uids[i] ].complete == false ) {
-				//���������� ������ ������
-				r.load++;
-				r.users = r.users + "," + battleClass.users[ battleClass.uids[i] ].id;
-			}else{
-				//��� ����
-				
-			}
-			i++;
-		}
-		
-		//������
-		var pr = battleClass.conf.pr.split('|');
-		var prz = battleClass.conf.pr_z.split('|');
-		var i = 0;
-		while( i < battleClass.conf.pr_s ) {
-			if( pr[i] != undefined && pr[i] > 0 ) {
-				if( battleClass.priems[pr[i]] == undefined ) {
-					//���������� ������ �� �������
-					r.load++;
-					r.priems += ',' + pr[i];
-				}else{
-					//��� ����
-				}
-			}
-			i++;
-		}
-		
-		//
-		
-		if( r.load > 0 ) {
-			
-			$.getJSON( 'https://new-combats.com/getbattle.php',{ 'loading':true , 'uload':r.users , 'pload':r.priems },function(data) {
-				//
-				if( data.e != undefined && data.e != "" ) {
-					alert( '������: ' + data.e );
-				}
-				//
-				if( data.r != undefined ) {
-					//+++++++++++++++++++++++++++++
-					
-					battleClass.log(data);
-					
-					
-					//�������� �������������
-					if( data.r.ul != undefined ) {
-						//
-						var i = 0;
-						while( i != -1 ) {
-							if( data.r.ul[i] != undefined ) {
-								if( data.r.ul[i].id > 0 ) {
-									//
-									if( battleClass.users[data.r.ul[i].id] == undefined ) {
-										battleClass.users[data.r.ul[i].id] = { };
-										battleClass.uids[0]++;
-										battleClass.uids[battleClass.uids[0]] = data.r.ul[i].id;
-									}
-									battleClass.users[data.r.ul[i].id] = data.r.ul[i];
-									//
-									battleClass.users[data.r.ul[i].id].complete = true;
-									//
-								}else{
-									battleClass.log( '������, ����� �� ������...' );
-								}
-							}else{
-								i = -2;
-							}
-							i++;
-						}
-						//
-					}
-					
-					//�������� �������
-					if( data.r.pl != undefined ) {
-						//
-						var i = 0;
-						while( i != -1 ) {
-							if( data.r.pl[i] != undefined ) {
-								if( data.r.pl[i].id > 0 ) {
-									//
-									if( battleClass.priems[data.r.pl[i].id] == undefined ) {
-										battleClass.priems[data.r.pl[i].id] = { };
-										battleClass.prms[0]++;
-										battleClass.prms[battleClass.prms[0]] = data.r.pl[i].id;
-									}
-									battleClass.priems[data.r.pl[i].id] = data.r.pl[i];
-									//
-									battleClass.priems[data.r.pl[i].id].complete = true;
-									//
-								}else{
-									battleClass.log( '������, ����� �� ������...' );
-								}
-							}else{
-								i = -2;
-							}
-							i++;
-						}
-						//
-					}
-					
-					battleClass.generate();
-					
-					//+++++++++++++++++++++++++++++
-				}
-				//
-			});
-		}else{
-			battleClass.generate();
-		}
-		//
-		
-	},
-	loadLog:function(url) {
-		var loadingLogNow = false;
-		$('#battle_log').remove();
-		var e = document.createElement("script");
-		e.src = url;
-		e.id  = 'battle_log';
-		e.type="text/javascript";
-		document.getElementsByTagName("head")[0].appendChild(e); 
-	},
-	testAct:function(uid1,uid2) {
-		var r = false;
-		var i = 0;
-		while( i != -1 ) {
-			if( this.act[i] != undefined ) {
-				if( this.act[i][1] == uid1 && this.act[i][2] == uid2 ) {
-					r = true;
-				}
-			}else{
-				i = -2;
-			}
-			i++;
-		}
-		return r;
-	},
-	userInfoItems:function(id,t) {
-		var i = 0;
-		while( i != - 1 ) {
-			if( this.users[id].itm[i] != undefined ) {
-				//
-				title  = '<center><b>'+this.users[id].itm[i][3]+'</b>';
-				title += '<br><i>(�������������� ������)</i>';
-				title += '</center>';
-				//
-				var cvs = '';
-				if( id == this.me ) {
-					cvs = this.users[id].itm[i][5];
-				}
-				//
-				abitms(t,id,this.users[id].itm[i][0],this.users[id].itm[i][2],this.users[id].itm[i][3],title,this.users[id].itm[i][4],cvs);
-			}else{
-				i = -2;
-			}
-			i++;
-		}
-	},
-	userInfoEffects:function(id,t) {
-		var i = 0;
-		var html = '';
-		if( this.eff != undefined ) {
-			while( i != - 1 ) {
-				if( this.eff[i] != undefined ) {
-					if( this.eff[i][0] == id ) {
-						var title_eff = '<b><u>'+this.eff[i][3]+'</u></b>';
-						var eff_types = '(������)';
-						if( this.eff[i][5] > 0 && this.eff[i][5] < 7 ) {
-							var eff_types = '(�������)';
-						}else if( (this.eff[i][5] > 6 && this.eff[i][5] < 11) || this.eff[i][5] == 16 ) {
-							var eff_types = '(��������)';
-						}else if( this.eff[i][5] == 14 ) {
-							var eff_types = '(�����)';
-						}else if( this.eff[i][5] == 15 ) {
-							var eff_types = '(��������)';
-						}else if( this.eff[i][5] == 17 ) {
-							var eff_types = '(���������)';
-						}else if( this.eff[i][5] == 18 || this.eff[i][5] == 17 ) {
-							var eff_types = '(������)';
-						}else if( this.eff[i][5] == 20 ) {
-							var eff_types = '(�����������)';
-						}else if( this.eff[i][5] == 22 ) {
-							var eff_types = '(��������)';
-						}
-						title_eff += ' ' + eff_types;
-						html = '<div class="pimg" pog="0" col="0" stl="0" stt="'+title_eff+'"><img src="https://img.new-combats.com/i/eff/'+this.eff[i][4]+'"></div>'+html;
-					}
-				}else{
-					i = -2;
-				}
-				i++;
-			}
-		}
-		return html;
-	},
-	userInfo:function(id,t) {
-		var stats_title = '';
-		stats_title += '<b>'+this.users[id].login+'</b><br>';
-		stats_title += '����: --<br>';
-		stats_title += '��������: --<br>';
-		stats_title += '��������: --<br>';
-		stats_title += '������������: --<br>';
-		
-		var eff_data = this.userInfoEffects(id,t);
-		
-		return info_reflesh(t,id,'',this.users[id].obraz,this.users[id].hp,this.users[id].hpAll,this.users[id].mp,this.users[id].mpAll,0,0,eff_data,stats_title,0,'');
-	},
-	generate:function() {
-		
-		//������
-		$('#nabito').html( this.conf.damage );
-		
-		//�������
-		$('#timer_out').html( this.conf.timeout );
-		
-		//�������
-		var i = 1;
-		while( i <= 7 ) {
-			$('#tac'+i).html( ( 0 + parseInt(this.conf.tactic[i]) ));
-			i++;
-		}
-		$('#tac7t').attr( { 'title':'������� ����: ' + this.conf.tactic[7] } );
-		
-		//�����
-		$('#player1').html( this.userInfo(this.me,1) );
-		$('#player1_login').html( this.microLogin(this.me,0) );
-		this.userInfoItems(this.me,1);
-		
-		//���������
-		if( this.enemy > 0 ) {
-			$('#player2').html( this.userInfo(this.enemy,2) );
-			$('#player2_login').html( this.microLogin(this.enemy,0) + '&nbsp;' );
-			this.userInfoItems(this.enemy,2);
-		}else{
-			$('#player2_login').html('');
-			$('#player2').html('��� ����������...');
-		}
-		
-		//���.�������
-		shpb();
-		
-		//������
-		var pr_see = '';
-		var pr = battleClass.conf.pr.split('|');
-		var prz = battleClass.conf.pr_z.split('|');
-		var i = 0;
-		while( i < battleClass.conf.pr_s ) {
-			if( pr[i] != undefined && pr[i] > 0 ) {
-				if( battleClass.priems[pr[i]] != undefined ) {
-					prm = battleClass.priems[pr[i]];
-					cl = '';
-					if( prm.type == 1 ) {
-						var onuser = '';
-						if( prm.onUser > 0 ) {
-							cl = 'href="javascript:void(0);" onClick="top.priemOnUser('+i+',1,\''+prm.name+'\',\''+onuser+'\',\''+prm.img+'\');"';
-						}else{
-							cl = 'href="javascript:void(0);" onClick="usepriem('+i+',1,\''+prm.img+'\');"';
-						}
-					}else if( prm.type == 2 ) {
-						cl = 'href="javascript:void(0);" onClick="usepriem('+i+',1,\''+prm.img+'\');"';
-					}else if( prm.type == 3 ) {
-						cl = 'href="javascript:void(0);" onClick="alert(\'�������� ����������?\');"';
-					}
-				}else{
-					prm = {
-						'id':pr[i],
-						'name':"*����������� ����� �"+pr[i]+"*",
-						'img':"clearPriem.gif"
-					};
-					cl = 'href="javascript:void(0);" onclick="alert(\'����� �� ������\');"';
-				}
-				pr_see += '<a '+cl+'><img style="margin-top:4px;margin-left:4px;" title="'+prm.name+'" src="https://img.new-combats.com/i/eff/'+prm.img+'.gif" width="40" height="25"></a>';
-			}else{
-				pr_see += '<img style="margin-top:4px;margin-left:4px;" title="������ ���� ������" src="https://img.new-combats.com/i/items/w/clearPriem.gif" width="40" height="25">';
-			}
-			i++;
-		}
-		$('#priems').html( pr_see );
-		delete pr_see;
-		
-		//�������� �������
-		var rd = '';
-		var tms = [];
-		var tmr = [0];
-		var i = 1;
-		while( i <= this.uids[0] ) {
-			if( tms[this.users[ this.uids[i] ].team] == undefined ) {
-				tmr[0]++;
-				tms[this.users[ this.uids[i] ].team] = '';
-				tmr[tmr[0]] = this.users[ this.uids[i] ].team;
-			}
-			if( this.users[ this.uids[i] ].hp > 0 ) {
-				if( tms[this.users[ this.uids[i] ].team] != '' ) {
-					tms[this.users[ this.uids[i] ].team] += ', ';
-				}
-				tms[this.users[ this.uids[i] ].team] += this.teamLogin(this.users[ this.uids[i] ].id,1);
-			}
-			i++;
-		}
-		var i = 1;
-		while( i <= tmr[0] ) {
-			if( tms[tmr[i]] != '' ) {
-				if( rd != '' ) {
-					rd += ' &nbsp;&nbsp;<b>������</b>&nbsp;&nbsp; ';
-				}
-				rd += '<img src="https://img.new-combats.com/i/lock3.gif" style="cursor:pointer"> ' + tms[tmr[i]];
-			}
-			i++;
-		}
-		$('#teams').html( rd );
-		//
-		//��� ���
-		this.loadLog('https://new-combats.com/battle_logs/btl_'+this.battle+'.js?'+this.hod);
-		this.logTimerX = 0;
-		this.logUpdateNow();
-		//
-		//������ ��������
-		if( this.testAct( this.me , this.enemy ) == true ) {
-			mainstatus(2);
-		}else{
-			mainstatus(1);
-		}
-		//
-	},
-	lastvlogid:0,
-	logTimer:null,
-	logTimerX:0,
-	logUpdateNow:function() {
-		clearTimeout(this.logTimer);
-		if( typeof logRefleshedCache == 'function' && loadingLogNow == true && this.lastvlogid < vlogid) {
-			this.lastvlogid = vlogid;
-			this.logTimerX = 0;
-			$('#battle_logg').html('');
-			logRefleshedCache();
-		}else{
-			this.logTimerX++;
-			this.log('logUpdateNow-cycles');
-			if( this.logTimerX < 101 ) {
-				this.logTimer = setTimeout('battleClass.logUpdateNow();',20);
-			}else{
-				this.logTimerX = 0;
-			}
-		}
-	},
-	teamLogin:function(id,type) {
-		var r = '';
-		if( this.users[id].align != undefined && this.users[id].align > 0 ) {
-		//	r += '<img src="https://img.new-combats.com/i/align/align'+this.users[id].align+'.gif">';	
-		}
-		if( this.users[id].clan != undefined && this.users[id].clan > 0 ) {
-		//	r += '<img src="https://img.new-combats.com/i/clan/'+this.users[id].clan+'.gif">';	
-		}
-		var stl = '';
-		if( this.testAct(this.me,id) != false ) {
-			//������� ������� ������
-			stl = '';
-		}
-		if( this.testAct(id,this.me) != false ) {
-			//�������, ����� �������� 
-			stl = 'text-decoration:underline;';
-		}
-		r += '<b style="'+stl+'" onclick="top.chat.addto(\''+this.users[id].login+'\',\'to\');" oncontextmenu="top.infoMenu(\''+this.users[id].login+'\',event,\'main\'); return false;" class="CSSteam'+this.users[id].team+'">'+this.users[id].login+'</b>';
-		//
-		r += '<small> ['+this.users[id].hp+'/'+this.users[id].hpAll+']</small>';
-		//
-		return r;
-	},
-	microLogin:function(id,type) {
-		var r = '';
-		if( this.users[id].align != undefined && this.users[id].align > 0 ) {
-			r += '<img src="https://img.new-combats.com/i/align/align'+this.users[id].align+'.gif">';	
-		}
-		if( this.users[id].clan != undefined && this.users[id].clan > 0 ) {
-			r += '<img src="https://img.new-combats.com/i/clan/'+this.users[id].clan+'.gif">';	
-		}
-		r += '<a href="javascript:void(0)" onclick="top.chat.addto(\''+this.users[id].login+'\',\'to\');" oncontextmenu="top.infoMenu(\''+this.users[id].login+'\',event,\'main\'); return false;">'+this.users[id].login+'</a> ['+this.users[id].level+']';
-		r += '<a href="/info/'+this.users[id].id+'" target="_blank"><img title="���. � '+this.users[id].login+'" src="https://img.new-combats.com/i/inf_capitalcity.gif"></a>';
-		return r;
-	}
-};
\ No newline at end of file
diff --git a/bonuss.php b/bonuss.php
index dba4b2fa..f25ab081 100644
--- a/bonuss.php
+++ b/bonuss.php
@@ -1,46 +1,46 @@
-<?
-/*if(!defined('GAME'))
-{
-	die();
-}*/
-define('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');
+<?php
 
-if ($_POST['code']==$_SESSION['code'] && $_POST['code']!='')
-	{
-		echo "<body onload=\"myWindow1();\">";
-	}
+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 "<body onload=\"myWindow1();\">";
+}
 
 ?>
 <link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
-<link rel="stylesheet" type="text/css" href="css/clu0b.css" />
-<link rel="stylesheet" type="text/css" href="css/windows.css" />
-<link rel="stylesheet" type="text/css" href="css/hack.css" />
+<link rel="stylesheet" type="text/css" href="css/clu0b.css"/>
+<link rel="stylesheet" type="text/css" href="css/windows.css"/>
+<link rel="stylesheet" type="text/css" href="css/hack.css"/>
 <br>
-<img style="width:164px;margin-top:5px;" src="show_reg_img/security2.php?register_id=<?=str_replace(' ','0',microtime())?>" width="107" height="26">
+<img style="width:164px;margin-top:5px;"
+     src="show_reg_img/security2.php?register_id=<?= str_replace(' ', '0', microtime()) ?>" width="107" height="26">
 <br>
 <form action="bonuss.php" method="post">
- <input style="width:164px;margin-top:5px;" type="text" size="30" name="code" value="�����!">
- <br>
- <input type="submit" style="width:164px;margin-top:5px;" class="btn btn-success" value="��������" >
+    <input style="width:164px;margin-top:5px;" type="text" size="30" name="code" value="�����!">
+    <br>
+    <input type="submit" style="width:164px;margin-top:5px;" class="btn btn-success" value="��������">
 </form>
 
 <button style="width:164px;margin-top:10px;" onclick="myWindow2();" class="btn btn-danger">�������</button>
 <script>
-function myWindow1() {
-  window.parent.open('main.php?takebns=<?echo $u->info['nextAct'];?>&getb1w=3&inv=1', '_self');
-}
-function myWindow2() {
-  var raz = window.parent.document.querySelector('iframe[src^="https://new-combats.com/bonuss.php"]'); // ������� ��������� � �������� iframe
-  raz.parentNode.removeChild(raz);
-}
+    function myWindow1() {
+        window.parent.open('main.php?takebns=<?echo $u->info['nextAct'];?>&getb1w=3&inv=1', '_self');
+    }
+
+    function myWindow2() {
+        var raz = window.parent.document.querySelector('iframe[src^="https://new-combats.com/bonuss.php"]'); // ������� ��������� � �������� iframe
+        raz.parentNode.removeChild(raz);
+    }
 
 </script>
 <style>
-html {
-  overflow: hidden; // ������ ������ ��������� ������ iframe, �.�. ������� scrolling="no" ��� iframe � HTML5 �� ��������������
-}
+    html {
+        overflow: hidden;
+    / / ������ ������ ��������� ������ iframe, � . � . ������� scrolling = "no" ��� iframe � HTML5 �� ��������������
+    }
 </style>
\ 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 @@
-<?
-define('GAME',true);
+<?php
+const GAME = true;
 include('_incl_data/__config.php');
 include('_incl_data/class/__db_connect.php');
-include('_incl_data/class/__user.php');
-
-/*
-<tr height="20">
-<td>1</td>
-<td><a target="_blank" href="https://capitalcity.combats.com/encicl/alignment.html" title="���������� ����"><img src="https://img.new-combats.com/i/align20.gif" width="12" height="15" border="0" /></a><a target="_blank" href="https://dungeon.combats.com/clans_inf.pl?Mercenaries" title="���������� � ����� Mercenaries"><img src="https://img.new-combats.com/i/klan/Mercenaries.gif" width="24" height="15" border="0" /></a><strong>SeDuCeR</strong>&nbsp;[12]<a href="https://dungeon.combats.com/inf.pl?1069870465" title="���������� � SeDuCeR" target="_blank"><img src="https://img.new-combats.com/i/inf.gif" width="12" height="11" border="0" /></a></td>
-<td>243</td>
-<td>47748</td>
-<td><a href="https://dungeon.combats.com/logs.pl?log=1425817576.94166">&raquo;&raquo;</a></td>
-</tr>
-*/
+$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 .= '<tr height="20">
+$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 .= '<tr height="20">
 <td>' . $i . '</td>
-<td>' . $u->microLogin($pl['uid'],1) . '</td>
+<td>' . $u->microLogin($pl['uid'], 1) . '</td>
 <td>' . $pl2['voln'] . '</td>
-<td>'.$ret.'</td>
-<td>&raquo;&raquo;</td>
-</tr>';
-	//
-	if( date('d.m.Y') == date('d.m.Y',$pl2['time']) ) { 
-		$r2 .= '<tr height="20">
-<td>' . $j . '</td>
-<td>' . $u->microLogin($pl['uid'],1) . '</td>
-<td>' . $pl2['voln'] . '</td>
-<td>'.$ret.'</td>
-<td>&raquo;&raquo;</td>
-</tr>';
-		$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 .= '<tr height="20">
-<td>' . $i . '</td>
-<td>' . $u->microLogin($pl['uid'],1) . '</td>
-<td>' . $pl['voln'] . '</td>
-<td>'.$ret.'</td>
-<td>&raquo;&raquo;</td>
-</tr>';
-
-if( $pl['uid'] == 1000000 ) {
-	echo date('d.m.Y',$pl['time']).'<br>';
-}
-	if( date('d.m.Y') == date('d.m.Y',$pl['time']) ) { 
-	$r2 .= '<tr height="20">
-<td>' . $j . '</td>
-<td>' . $u->microLogin($pl['uid'],1) . '</td>
-<td>' . $pl['voln'] . '</td>
 <td>' . $ret . '</td>
 <td>&raquo;&raquo;</td>
 </tr>';
-		$j++;
-	}
-	$i++;
-}*/
+    //
+    if (date('d.m.Y') == date('d.m.Y', $pl2['time'])) {
+        $r2 .= '<tr height="20">
+<td>' . $j . '</td>
+<td>' . $u->microLogin($pl['uid'], 1) . '</td>
+<td>' . $pl2['voln'] . '</td>
+<td>' . $ret . '</td>
+<td>&raquo;&raquo;</td>
+</tr>';
+        $j++;
+    }
+    $i++;
+}
+
 
 ?>
 <!DOCTYPE html>
 <html>
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
-<title>�����: ��������</title>
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
+    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"/>
+    <title>�����: ��������</title>
+    <link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
 </head>
 
 <body bgcolor="#E2E0E0">
 <h4>
-  <center>
-    ����� �����
-      <table width="100%">
-        <tbody>
-          <tr>
-            <td valign="top"><fieldset>
-              <legend>
-              <h5><?=$lvl_name?> - ������ �� �����</h5>
-              </legend>
-              <? if( $r1 != '' ) { ?>
-              <table align="center">
-                <tbody>
-                  <tr>
-                    <td><h6>�����</h6></td>
-                    <td><h6>����</h6></td>
-                    <td><h6>��������� �����</h6></td>
-                    <td><h6>�������</h6></td>
-                    <td><h6>��� ���</h6></td>
-                  </tr>
-                  <?=$r1?>
-                </tbody>
-              </table>
-              <? }else{
-				echo '������� �����, ������ ����� �� ������� ����������...';  
-			  } ?>
-            </fieldset></td>
-            <td valign="top"><fieldset>
-              <legend>
-              <h5>������� - ������ �� ����</h5>
-              </legend>
-              <? if( $r2 != '' ) { ?>
-              <table align="center">
-                <tbody>
-                  <tr>
-                    <td><h6>�����</h6></td>
-                    <td><h6>����</h6></td>
-                    <td><h6>��������� �����</h6></td>
-                    <td><h6>�������</h6></td>
-                    <td><h6>��� ���</h6></td>
-                  </tr>
-                  <?=$r2?>
-                </tbody>
-              </table>
-              <? }else{
-				echo '������� �����, ������ ����� �� ������� ����������...';  
-			  } ?>
-            </fieldset></td>
-          </tr>
-        </tbody>
-      </table>
-  </center>
+    <center>
+        ����� �����
+        <table width="100%">
+            <tbody>
+            <tr>
+                <td valign="top">
+                    <fieldset>
+                        <legend>
+                            <h5><?= $lvl_name ?> - ������ �� �����</h5>
+                        </legend>
+                        <?php if ($r1 != '') { ?>
+                            <table align="center">
+                                <tbody>
+                                <tr>
+                                    <td><h6>�����</h6></td>
+                                    <td><h6>����</h6></td>
+                                    <td><h6>��������� �����</h6></td>
+                                    <td><h6>�������</h6></td>
+                                    <td><h6>��� ���</h6></td>
+                                </tr>
+                                <?= $r1 ?>
+                                </tbody>
+                            </table>
+                        <?php } else {
+                            echo '������� �����, ������ ����� �� ������� ����������...';
+                        } ?>
+                    </fieldset>
+                </td>
+                <td valign="top">
+                    <fieldset>
+                        <legend>
+                            <h5>������� - ������ �� ����</h5>
+                        </legend>
+                        <?php if ($r2 != '') { ?>
+                            <table align="center">
+                                <tbody>
+                                <tr>
+                                    <td><h6>�����</h6></td>
+                                    <td><h6>����</h6></td>
+                                    <td><h6>��������� �����</h6></td>
+                                    <td><h6>�������</h6></td>
+                                    <td><h6>��� ���</h6></td>
+                                </tr>
+                                <?= $r2 ?>
+                                </tbody>
+                            </table>
+                        <?php } else {
+                            echo '������� �����, ������ ����� �� ������� ����������...';
+                        } ?>
+                    </fieldset>
+                </td>
+            </tr>
+            </tbody>
+        </table>
+    </center>
 </h4>
 </body>
 </html>
\ No newline at end of file
diff --git a/buttons.php b/buttons.php
index 5d6a6084..167a8f97 100644
--- a/buttons.php
+++ b/buttons.php
@@ -1,30 +1,17 @@
 <?php
-define('GAME', true);
+const GAME = true;
 function er($e)
 {
     global $c;
-    die('<html><head><meta name="msapplication-config" content="browserconfig.xml"><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"><meta http-equiv="Content-Language" content="ru"><TITLE>��������� ������</TITLE></HEAD><BODY text="#FFFFFF"><p><font color=black>��������� ������: <pre>' . $e . '</pre><b><p><a href="https://' . $c[0] . '/">�����</b></a><HR><p align="right">(c) <a href="https://' . $c[0] . '/">' . $c[1] . '</a></p></body></html>');
+    exit('<html><head><meta name="msapplication-config" content="browserconfig.xml"><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"><meta http-equiv="Content-Language" content="ru"><TITLE>��������� ������</TITLE></HEAD><BODY text="#FFFFFF"><p><font color=black>��������� ������: <pre>' . $e . '</pre><b><p><a href="https://' . $c[0] . '/">�����</b></a><HR><p align="right">(c) <a href="https://' . $c[0] . '/">' . $c[1] . '</a></p></body></html>');
 }
 
-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');
+define('IP', UserIp::get());
+$u = User::start();
+$filter = new Filter();
+$chat = new Chat();
 
 ini_set('max_execution_time', '120');
 
@@ -47,8 +34,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 +49,752 @@ if ($u->info['activ'] > 0) {
 }
 
 ?>
-<!DOCTYPE html>
-<html lang="ru-RU">
-<head>
-    <meta charset="windows-1251"/>
-    <title>���������� ���� Acombats</title>
-    <meta name="description"
-          content="����� ���������� ���� combats ������ 2. ����������� ������ � ���������� ���� � ��������. ������� ��� ������� � �������� � �������� ������� ������ ������� ��."/>
-    <meta name="keywords"
-          content="���������� ���� ����, ���������� ���� ������, ���� ���������� ����, ������ ���������� ����, ���������� ���� ������ ����, ���������� ���� ���������� ����, ������ � ���������� ����, ���� ��, �� ����, ������ ��, ������ � ��, �� ������ ����, ����� ��, ����������� ���������� ����, ����������� ��, combats, �������, combats ru, combats com, OldBK, oldbk ru, oldbk com, �����, old bk, ��� ��, mycombats, rebk, recombats, oldcombats, obk2"/>
-    <meta name="msapplication-config" content="browserconfig.xml"/>
-    <link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
-    <link rel="stylesheet" type="text/css" href="css/clu0b.css"/>
-    <link rel="stylesheet" type="text/css" href="css/windows.css"/>
-    <link rel="stylesheet" type="text/css" href="css/hack.css"/>
-    <!--[if IE]>
-    <script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
-    <![endif]-->
-    <script>
-        var des = <?=(0 + $u->info['design'])?>;
-        var c = {
-            noEr: 0,
-            noErTmr: 0,
-            url: '<?=$c['host']?>',
-            img: 'img.new-combats.com',
-            uid: <?=(0 + $u->info['id'])?>,
-            login: '<?=$u->info['login']?>',
-            city: '<?=$u->info['city']?>',
-            lvl: <?=$u->info['level']?>,
-            rnd: '<?=$code?>',
-            filter: 0,
-            time: <?=time()?>,
-            pl: 0,
-            align: <?=$u->info['align']?>,
-            clan: <?=$u->info['clan']?>,
-            admin: <?=$u->info['admin']?>,
-            sound: 0,
-            money: <?=$u->info['money']?>
-        }, sd4key = "<?=$u->info['nextAct']?>", lafstReg = {}, enterUse = 0;
+    <!DOCTYPE html>
+    <html lang="ru-RU">
+    <head>
+        <meta charset="windows-1251"/>
+        <title>���������� ���� Acombats</title>
+        <meta name="description"
+              content="����� ���������� ���� combats ������ 2. ����������� ������ � ���������� ���� � ��������. ������� ��� ������� � �������� � �������� ������� ������ ������� ��."/>
+        <meta name="keywords"
+              content="���������� ���� ����, ���������� ���� ������, ���� ���������� ����, ������ ���������� ����, ���������� ���� ������ ����, ���������� ���� ���������� ����, ������ � ���������� ����, ���� ��, �� ����, ������ ��, ������ � ��, �� ������ ����, ����� ��, ����������� ���������� ����, ����������� ��, combats, �������, combats ru, combats com, OldBK, oldbk ru, oldbk com, �����, old bk, ��� ��, mycombats, rebk, recombats, oldcombats, obk2"/>
+        <meta name="msapplication-config" content="browserconfig.xml"/>
+        <link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
+        <link rel="stylesheet" type="text/css" href="css/clu0b.css"/>
+        <link rel="stylesheet" type="text/css" href="css/windows.css"/>
+        <link rel="stylesheet" type="text/css" href="css/hack.css"/>
+        <!--[if IE]>
+        <script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+        <![endif]-->
+        <script>
+            var des = <?=(0 + $u->info['design'])?>;
+            var c = {
+                noEr: 0,
+                noErTmr: 0,
+                url: '<?=$c['host']?>',
+                img: 'img.new-combats.com',
+                uid: <?=(0 + $u->info['id'])?>,
+                login: '<?=$u->info['login']?>',
+                city: '<?=$u->info['city']?>',
+                lvl: <?=$u->info['level']?>,
+                rnd: '<?=$code?>',
+                filter: 0,
+                time: <?=time()?>,
+                pl: 0,
+                align: <?=$u->info['align']?>,
+                clan: <?=$u->info['clan']?>,
+                admin: <?=$u->info['admin']?>,
+                sound: 0,
+                money: <?=$u->info['money']?>
+            }, sd4key = "<?=$u->info['nextAct']?>", lafstReg = {}, enterUse = 0;
 
-        function ctest(city) {
-            if (city != c['city']) {
-                top.location = '/bk';
-            }
-        }
-
-        function testKey(event) {
-            if (event.keyCode == 10 || event.keyCode == 13) {
-                if (top.enterUse == 0) {
-                    chat.subSend();
-                    top.enterUse = 1;
-                    setTimeout('top.enterUse = 0', 1000);
+            function ctest(city) {
+                if (city != c['city']) {
+                    top.location = '/bk';
                 }
             }
-        }
 
-        setInterval('c.time++', 1000);
-    </script>
-    <script type="text/javascript" src="js/jquery.js"></script>
-    <script>
-        $.ajaxSetup({cache: false});
-        $(window).error(function () {
-            return true;
-        });
-        var iusrno = {};
-
-        function ignoreUser(u) {
-            if (iusrno[u] == undefined || iusrno[u] == 0) {
-                $('#main').attr({'src': 'main.php?friends=1&ignore=' + u + ''});
-            } else {
-                $('#main').attr({'src': 'main.php?friends=1&ignore=' + u + ''});
+            function testKey(event) {
+                if (event.keyCode == 10 || event.keyCode == 13) {
+                    if (top.enterUse == 0) {
+                        chat.subSend();
+                        top.enterUse = 1;
+                        setTimeout('top.enterUse = 0', 1000);
+                    }
+                }
             }
+
+            setInterval('c.time++', 1000);
+        </script>
+        <script type="text/javascript" src="js/jquery.js"></script>
+        <script>
+            $.ajaxSetup({cache: false});
+            $(window).error(function () {
+                return true;
+            });
+            var iusrno = {};
+
+            function ignoreUser(u) {
+                if (iusrno[u] == undefined || iusrno[u] == 0) {
+                    $('#main').attr({'src': 'main.php?friends=1&ignore=' + u + ''});
+                } else {
+                    $('#main').attr({'src': 'main.php?friends=1&ignore=' + u + ''});
+                }
+            }
+        </script>
+        <script type="text/javascript" src="js/jqueryrotate.js"></script>
+        <script type="text/javascript" src="js/jquery.zclip.js"></script>
+        <script type="text/javascript" src="js/jquery.cookie.js"></script>
+        <script type="text/javascript" src="js/title.js"></script>
+
+        <script type="text/javascript" src="js/gameEngine.js?<?= time() ?>"></script>
+        <script type="text/javascript" src="js/interface.js"></script>
+        <script type="text/javascript" src="js/dataCenter.js"></script>
+
+        <script type="text/javascript" src="js/onlineList.js"></script>
+        <script type="text/javascript" src="js/hpregen.js"></script>
+        <script type="text/javascript" src="js/jquery-fireHint.js"></script>
+
+        <script type="text/javascript" src="js/trainingModals/registration/index.js"></script>
+
+
+        <?php
+
+        if (!isset($_COOKIE['d1c'])) {
+            $detect = new MobileDetect;
+            $deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
+            $_COOKIE['d1c'] = $deviceType;
+            setcookie('d1c', $deviceType, (time() + 86400));
+        } else {
+            $deviceType = $_COOKIE['d1c'];
         }
-    </script>
-    <script type="text/javascript" src="js/jqueryrotate.js"></script>
-    <script type="text/javascript" src="js/jquery.zclip.js"></script>
-    <script type="text/javascript" src="js/jquery.cookie.js"></script>
-    <script type="text/javascript" src="js/title.js"></script>
 
-    <script type="text/javascript" src="js/gameEngine.js?<?= time() ?>"></script>
-    <script type="text/javascript" src="js/interface.js"></script>
-    <script type="text/javascript" src="js/dataCenter.js"></script>
+        if ($deviceType == 'tablet' || $deviceType == 'phone') {
+            echo '<script type="text/javascript" src="js/jquery.nicescroll.js"></script>';
+            ?>
+            <style type="text/css">
+                #touchmain {
+                    padding: 0;
+                    border: 0;
+                    overflow: auto;
+                    margin: 0;
+                }
+            </style>
 
-    <script type="text/javascript" src="js/onlineList.js"></script>
-    <script type="text/javascript" src="js/hpregen.js"></script>
-    <script type="text/javascript" src="js/jquery-fireHint.js"></script>
-    <?php
-
-    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 '<script type="text/javascript" src="js/jquery.nicescroll.js"></script>';
+            <script>
+                $(document).ready(function () {
+                    $("#touchmain").niceScroll("#main", {autohidemode: false, boxzoom: false});
+                });
+            </script>
+            <?php
+        }
         ?>
+
+        <link href="./js/trainingModals/registration/trainingModalStyles.css" rel="stylesheet" type="text/css"/>
+
         <style type="text/css">
-            #touchmain {
-                padding: 0;
-                border: 0;
-                overflow: auto;
-                margin: 0;
+            /* Additional classes examples */
+            .woman a {
+                color: #C33;
+            }
+
+            .woman a:hover {
+                color: #ff0000;
+            }
+
+            img {
+                vertical-align: bottom;
+            }
+
+            #tgf_loadingLine {
+                height: 18px;
+                width: 100%;
+                color: #776b4a;
+                background-color: #ddd5bf;
+                position: relative;
+            }
+
+            .tfpgs {
+                padding: 5px;
+                background-color: #d4cbb4;
+                border-bottom: 1px solid #988e73;
+                border-top: 1px solid #eae3d0;
+                cursor: default;
+                text-align: center;
+            }
+
+            .tgf_msg0 {
+                padding: 5px;
+                background-color: #c6b893;
+                border-bottom: 1px solid #988e73;
+                border-top: 1px solid #eae3d0;
+                cursor: default;
+            }
+
+            .tgf_msg1 {
+                padding: 5px;
+                background-color: #d4cbb4;
+                border-bottom: 1px solid #988e73;
+                border-top: 1px solid #eae3d0;
+                cursor: default;
+            }
+
+            .tgf_msgt {
+                color: #988e73;
+                padding-left: 2px;
+                padding-right: 2px;
+                border-right: 1px solid #b1a993;
+            }
+
+            .tf_btn1 {
+                background-color: #ddd5bf;
+                padding: 3px 10px;
+                margin: 1px;
+                color: #988e73;
+                cursor: pointer;
+                -moz-border-radius: 4px;
+                -webkit-border-radius: 4px;
+                border-radius: 4px;
+            }
+
+            .tf_btn1:hover {
+                background-color: #b7ae96;
+                color: #ddd5bf;
+                cursor: pointer;
+            }
+
+            .tf_btn11 {
+                background-color: #988e73;
+                padding: 3px 10px;
+                margin: 1px;
+                color: #ddd5bf;
+                cursor: pointer;
+                -moz-border-radius: 4px;
+                -webkit-border-radius: 4px;
+                border-radius: 4px;
+            }
+
+            .qel0 {
+                dispaly: none;
+                position: absolute;
+                z-index: 100000;
+                border: 4px solid #f5cc50;
+                border-radius: 4px;
             }
         </style>
-
         <script>
-            $(document).ready(function () {
-                $("#touchmain").niceScroll("#main", {autohidemode: false, boxzoom: false});
-            });
+            function chatHello() {
+                chat.sendMsg(["new", "<?=time(
+                )?>", "1", "", "<?=$u->info['login']?>", "global:<b style='background-color:#ffcccc'>&nbsp; ������������ � ����, �� �������� ������������� � �������� ������� �������!  <a href='https://new-combats.com/n' target='_blank'>������ �������</a> &nbsp;</b>", "red", "1", "1", "0"]);
+            }
         </script>
-        <?php
-    }
-    ?>
-    <style type="text/css">
-        /* Additional classes examples */
-        .woman a {
-            color: #C33;
-        }
+    </head>
 
-        .woman a:hover {
-            color: #ff0000;
-        }
-
-        img {
-            vertical-align: bottom;
-        }
-
-        #tgf_loadingLine {
-            height: 18px;
-            width: 100%;
-            color: #776b4a;
-            background-color: #ddd5bf;
-            position: relative;
-        }
-
-        .tfpgs {
-            padding: 5px;
-            background-color: #d4cbb4;
-            border-bottom: 1px solid #988e73;
-            border-top: 1px solid #eae3d0;
-            cursor: default;
-            text-align: center;
-        }
-
-        .tgf_msg0 {
-            padding: 5px;
-            background-color: #c6b893;
-            border-bottom: 1px solid #988e73;
-            border-top: 1px solid #eae3d0;
-            cursor: default;
-        }
-
-        .tgf_msg1 {
-            padding: 5px;
-            background-color: #d4cbb4;
-            border-bottom: 1px solid #988e73;
-            border-top: 1px solid #eae3d0;
-            cursor: default;
-        }
-
-        .tgf_msgt {
-            color: #988e73;
-            padding-left: 2px;
-            padding-right: 2px;
-            border-right: 1px solid #b1a993;
-        }
-
-        .tf_btn1 {
-            background-color: #ddd5bf;
-            padding: 3px 10px;
-            margin: 1px;
-            color: #988e73;
-            cursor: pointer;
-            -moz-border-radius: 4px;
-            -webkit-border-radius: 4px;
-            border-radius: 4px;
-        }
-
-        .tf_btn1:hover {
-            background-color: #b7ae96;
-            color: #ddd5bf;
-            cursor: pointer;
-        }
-
-        .tf_btn11 {
-            background-color: #988e73;
-            padding: 3px 10px;
-            margin: 1px;
-            color: #ddd5bf;
-            cursor: pointer;
-            -moz-border-radius: 4px;
-            -webkit-border-radius: 4px;
-            border-radius: 4px;
-        }
-
-        .qel0 {
-            dispaly: none;
-            position: absolute;
-            z-index: 100000;
-            border: 4px solid #f5cc50;
-            border-radius: 4px;
-        }
-    </style>
-    <script>
-        function chatHello() {
-            chat.sendMsg(["new", "<?=time()?>", "1", "", "<?=$u->info['login']?>", "global:<b style='background-color:#ffcccc'>&nbsp; ������������ � ����, �� �������� ������������� � �������� ������� �������!  <a href='https://new-combats.com/n' target='_blank'>������ �������</a> &nbsp;</b>", "red", "1", "1", "0"]);
-        }
-    </script>
-</head>
-
-<body onLoad="bodyLoaded();chatHello();">
-<div style="display:none" class="qel0" id="qel0"></div>
-<noscript>� ����� �������� ����������� ��������� <strong>javascript<strong></noscript>
-<style>
-    /* ����� ������ */
-    .CSSteam0 {
-        font-weight: bold;
-        cursor: pointer;
-    }
-
-    .CSSteam1 {
-        font-weight: bold;
-        color: #6666CC;
-        cursor: pointer;
-    }
-
-    .CSSteam2 {
-        font-weight: bold;
-        color: #B06A00;
-        cursor: pointer;
-    }
-
-    .CSSteam3 {
-        font-weight: bold;
-        color: #269088;
-        cursor: pointer;
-    }
-
-    .CSSteam4 {
-        font-weight: bold;
-        color: #A0AF20;
-        cursor: pointer;
-    }
-
-    .CSSteam5 {
-        font-weight: bold;
-        color: #0F79D3;
-        cursor: pointer;
-    }
-
-    .CSSteam6 {
-        font-weight: bold;
-        color: #D85E23;
-        cursor: pointer;
-    }
-
-    .CSSteam7 {
-        font-weight: bold;
-        color: #5C832F;
-        cursor: pointer;
-    }
-
-    .CSSteam8 {
-        font-weight: bold;
-        color: #842B61;
-        cursor: pointer;
-    }
-
-    .CSSteam9 {
-        font-weight: bold;
-        color: navy;
-        cursor: pointer;
-    }
-
-    .CSSvs {
-        font-weight: bold;
-    }
-
-    .buttons:hover {
-        background-color: #EFEFEF;
-    }
-
-    .buttons:active {
-        color: #777777;
-    }
-
-    .buttons {
-        background-color: #E9E9E9;
-    }
-
-    .menutop2 {
-        color: #003366;
-    }
-
-    .menutop2:hover {
-        color: #446B93;
-    }
-
-    .klan {
-        font-weight: bold;
-        color: green;
-        background-color: #99FFCC;
-    }
-
-    .redColor {
-        color: #FF0000;
-        font-weight: bold;
-    }
-
-    .borderWhite {
-        border: 1px solid #f2f0f0;
-    }
-
-    .date21 {
-        font-family: Courier, serif;
-        font-size: 8pt;
-        text-decoration: underline;
-        font-weight: normal;
-        color: #007000;
-        background-color: #00FFAA
-    }
-
-
-    .zoneCh_no {
-        float: left;
-        overflow: hidden;
-        height: 18px;
-        width: 18px;
-    }
-
-    .inpBtl {
-        color: #000000;
-        text-decoration: none;
-        background-color: #ECE9D8;
-        border: 1px solid #000000;
-    }
-
-    .zoneCh_yes {
-        float: left;
-        overflow: hidden;
-        height: 18px;
-        width: 18px;
-        background-color: #A9AFB1;
-    }
-
-    body {
-        background-color: #e8e8e8;
-    }
-
-    .st1222 {
-        font-size: 18px;
-        color: #990000;
-        font-weight: bold;
-    }
-
-    .crop {
-        float: left;
-        overflow: hidden;
-        height: 18px;
-        width: 18px;
-    }
-
-    .radio_off {
-        margin-left: 0;
-    }
-
-    .radio_on {
-        margin-left: -18px;
-    }
-
-    .battle_hod_style {
-        border-bottom-width: 1px;
-        border-bottom-style: solid;
-        border-bottom-color: #AEAEAE;
-    }
-
-    .zbtn1l {
-        width: 9px;
-        height: 18px;
-        background: url(https://new-combats.com/tab.png) 0 0 repeat-x;
-    }
-
-    .zbtn1r {
-        width: 9px;
-        height: 18px;
-        background: url(https://new-combats.com/tab.png) -18px 0 repeat-x;
-    }
-
-    .zbtn1r2 {
-        width: 9px;
-        height: 18px;
-        background: url(https://new-combats.com/tab.png) 18px 0 repeat-x;
-    }
-
-    .zbtn2l {
-        width: 9px;
-        height: 18px;
-        background: url(https://new-combats.com/tab.png) -36px 0 repeat-x;
-    }
-
-    .zbtn2r {
-        width: 9px;
-        height: 18px;
-        background: url(https://new-combats.com/tab.png) -54px 0 repeat-x;
-    }
-
-    .zbtn2r2 {
-        width: 9px;
-        height: 18px;
-        background: url(https://new-combats.com/tab.png) -90px 0 repeat-x;
-    }
-
-    .zbtn2r3 {
-        width: 9px;
-        height: 18px;
-        background: url(https://new-combats.com/tab.png) 54px 0 repeat-x;
-    }
-
-    .zbtn1c {
-        background-color: #808080;
-        border-top-width: 1px;
-        border-bottom-width: 1px;
-        border-top-style: solid;
-        border-bottom-style: solid;
-        border-top-color: #000000;
-        border-bottom-color: #000000;
-        color: #FFFFFF;
-        cursor: default;
-        padding-left: 5px;
-        padding-right: 5px;
-        FONT-FAMILY: Verdana, Arial, Helvetica, Tahoma, sans-serif;
-    }
-
-    .zbtn2c {
-        background-color: #D5D2C9;
-        border-bottom-width: 1px;
-        border-bottom-style: solid;
-        border-bottom-color: #000000;
-        color: #000000;
-        cursor: default;
-        padding-left: 5px;
-        padding-right: 5px;
-        FONT-FAMILY: Verdana, Arial, Helvetica, Tahoma, sans-serif;
-        font-weight: bold;
-    }
-</style>
-
-<script>
-    if (window.top !== window.self) {
-        document.write = "";
-        window.top.location = window.self.location;
-        setTimeout(function () {
-            document.body.innerHTML = '������ �������.';
-        }, 500);
-        window.self.onload = function (evt) {
-            document.body.innerHTML = '������ �������.';
-        };
-    }
-
-    function cc(el) {
-        $(window).resize(function () {
-            $(el).css({
-                position: 'absolute',
-                left: ($(document).width() - $(el).outerWidth()) / 2,
-                top: ($(document).height() - $(el).outerHeight()) / 2
-            });
-        });
-        $(window).resize();
-    }
-</script>
-<?php
-if ($u->info['bithday'] == '01.01.1800') {
-    ?>
-    <script>
-        function startRegistration() {
-            //if( goodread >= 9 ) {
-            $.post('reg.php', {
-                'ajax_reg': true,
-                'reg_login': $('#reg_login').val(),
-                'reg_mail': $('#reg_mail').val(),
-                'reg_dd': $('#reg_dd').val(),
-                'reg_mm': $('#reg_mm').val(),
-                'reg_yy': $('#reg_yy').val(),
-                'reg_sex': $('#reg_sex').val(),
-                'reg_pass': $('#reg_pass').val(),
-                'reg_pass2': $('#reg_pass2').val(),
-                'mail_post': $('#mail_post').attr('checked')
-            }, function (data) {
-                $('#errorreg').html(data);
-            });
-        }
-    </script>
+    <body onLoad="bodyLoaded();chatHello();">
+    <div style="display:none" class="qel0" id="qel0"></div>
+    <noscript>� ����� �������� ����������� ��������� <strong>javascript<strong></noscript>
     <style>
-        .proza {
-            filter: progid:DXImageTransform.Microsoft.Alpha(opacity=87); /* IE 5.5+*/
-            -moz-opacity: 0.87; /* Mozilla 1.6 � ���� */
-            -khtml-opacity: 0.87; /* Konqueror 3.1, Safari 1.1 */
-            opacity: 0.87; /* CSS3 - Mozilla 1.7b +, Firefox 0.9 +, Safari 1.2+, Opera 9+ */
+        /* ����� ������ */
+        .CSSteam0 {
+            font-weight: bold;
+            cursor: pointer;
         }
 
-        .nobtn12 {
-            border: 0;
-            bottom: 80px;
-            left: 225px;
-            position: absolute;
+        .CSSteam1 {
+            font-weight: bold;
+            color: #6666CC;
+            cursor: pointer;
         }
 
-        .nobtn12:active {
-            bottom: 79px;
+        .CSSteam2 {
+            font-weight: bold;
+            color: #B06A00;
+            cursor: pointer;
         }
 
-        .inpreg1 {
-            padding: 2px;
-            font-size: 14px;
-            color: #003144;
-            background-color: #f6f4ec;
-            border: 1px solid #d1cdb8;
-            width: 178px;
+        .CSSteam3 {
+            font-weight: bold;
+            color: #269088;
+            cursor: pointer;
         }
 
-        .inpreg2 {
-            font-size: 12px;
-            color: #003144;
-            background-color: #f6f4ec;
-            border: 1px solid #d1cdb8;
+        .CSSteam4 {
+            font-weight: bold;
+            color: #A0AF20;
+            cursor: pointer;
         }
 
-        #errorreg {
-            position: absolute;
-            width: 680px;
-            top: 0;
-            left: 0;
-            text-align: center;
-            color: red;
+        .CSSteam5 {
+            font-weight: bold;
+            color: #0F79D3;
+            cursor: pointer;
+        }
+
+        .CSSteam6 {
+            font-weight: bold;
+            color: #D85E23;
+            cursor: pointer;
+        }
+
+        .CSSteam7 {
+            font-weight: bold;
+            color: #5C832F;
+            cursor: pointer;
+        }
+
+        .CSSteam8 {
+            font-weight: bold;
+            color: #842B61;
+            cursor: pointer;
+        }
+
+        .CSSteam9 {
+            font-weight: bold;
+            color: navy;
+            cursor: pointer;
+        }
+
+        .CSSvs {
+            font-weight: bold;
+        }
+
+        .buttons:hover {
+            background-color: #EFEFEF;
+        }
+
+        .buttons:active {
+            color: #777777;
+        }
+
+        .buttons {
+            background-color: #E9E9E9;
+        }
+
+        .menutop2 {
+            color: #003366;
+        }
+
+        .menutop2:hover {
+            color: #446B93;
+        }
+
+        .klan {
+            font-weight: bold;
+            color: green;
+            background-color: #99FFCC;
+        }
+
+        .redColor {
+            color: #FF0000;
+            font-weight: bold;
+        }
+
+        .borderWhite {
+            border: 1px solid #f2f0f0;
+        }
+
+        .date21 {
+            font-family: Courier, serif;
+            font-size: 8pt;
+            text-decoration: underline;
+            font-weight: normal;
+            color: #007000;
+            background-color: #00FFAA
+        }
+
+
+        .zoneCh_no {
+            float: left;
+            overflow: hidden;
+            height: 18px;
+            width: 18px;
+        }
+
+        .inpBtl {
+            color: #000000;
+            text-decoration: none;
+            background-color: #ECE9D8;
+            border: 1px solid #000000;
+        }
+
+        .zoneCh_yes {
+            float: left;
+            overflow: hidden;
+            height: 18px;
+            width: 18px;
+            background-color: #A9AFB1;
+        }
+
+        body {
+            background-color: #e8e8e8;
+        }
+
+        .st1222 {
+            font-size: 18px;
+            color: #990000;
+            font-weight: bold;
+        }
+
+        .crop {
+            float: left;
+            overflow: hidden;
+            height: 18px;
+            width: 18px;
+        }
+
+        .radio_off {
+            margin-left: 0;
+        }
+
+        .radio_on {
+            margin-left: -18px;
+        }
+
+        .battle_hod_style {
+            border-bottom-width: 1px;
+            border-bottom-style: solid;
+            border-bottom-color: #AEAEAE;
+        }
+
+        .zbtn1l {
+            width: 9px;
+            height: 18px;
+            background: url(https://new-combats.com/tab.png) 0 0 repeat-x;
+        }
+
+        .zbtn1r {
+            width: 9px;
+            height: 18px;
+            background: url(https://new-combats.com/tab.png) -18px 0 repeat-x;
+        }
+
+        .zbtn1r2 {
+            width: 9px;
+            height: 18px;
+            background: url(https://new-combats.com/tab.png) 18px 0 repeat-x;
+        }
+
+        .zbtn2l {
+            width: 9px;
+            height: 18px;
+            background: url(https://new-combats.com/tab.png) -36px 0 repeat-x;
+        }
+
+        .zbtn2r {
+            width: 9px;
+            height: 18px;
+            background: url(https://new-combats.com/tab.png) -54px 0 repeat-x;
+        }
+
+        .zbtn2r2 {
+            width: 9px;
+            height: 18px;
+            background: url(https://new-combats.com/tab.png) -90px 0 repeat-x;
+        }
+
+        .zbtn2r3 {
+            width: 9px;
+            height: 18px;
+            background: url(https://new-combats.com/tab.png) 54px 0 repeat-x;
+        }
+
+        .zbtn1c {
+            background-color: #808080;
+            border-top-width: 1px;
+            border-bottom-width: 1px;
+            border-top-style: solid;
+            border-bottom-style: solid;
+            border-top-color: #000000;
+            border-bottom-color: #000000;
+            color: #FFFFFF;
+            cursor: default;
+            padding-left: 5px;
+            padding-right: 5px;
+            FONT-FAMILY: Verdana, Arial, Helvetica, Tahoma, sans-serif;
+        }
+
+        .zbtn2c {
+            background-color: #D5D2C9;
+            border-bottom-width: 1px;
+            border-bottom-style: solid;
+            border-bottom-color: #000000;
+            color: #000000;
+            cursor: default;
+            padding-left: 5px;
+            padding-right: 5px;
+            FONT-FAMILY: Verdana, Arial, Helvetica, Tahoma, sans-serif;
             font-weight: bold;
         }
     </style>
+
     <script>
-        cc('#regblock');
+        if (window.top !== window.self) {
+            document.write = "";
+            window.top.location = window.self.location;
+            setTimeout(function () {
+                document.body.innerHTML = '������ �������.';
+            }, 500);
+            window.self.onload = function (evt) {
+                document.body.innerHTML = '������ �������.';
+            };
+        }
+
+        function cc(el) {
+            $(window).resize(function () {
+                $(el).css({
+                    position: 'absolute',
+                    left: ($(document).width() - $(el).outerWidth()) / 2,
+                    top: ($(document).height() - $(el).outerHeight()) / 2
+                });
+            });
+            $(window).resize();
+        }
     </script>
     <?php
-} elseif ($u->info['active'] != '' && $u->info['mail'] == 'No E-mail') {
-    if ($error != '') {
-        echo '<script>alert("' . $error . '");</script>';
+    if ($u->info['bithday'] == '01.01.1800') {
+        ?>
+        <script>
+            function startRegistration() {
+                //if( goodread >= 9 ) {
+                $.post('reg.php', {
+                    'ajax_reg': true,
+                    'reg_login': $('#reg_login').val(),
+                    'reg_mail': $('#reg_mail').val(),
+                    'reg_dd': $('#reg_dd').val(),
+                    'reg_mm': $('#reg_mm').val(),
+                    'reg_yy': $('#reg_yy').val(),
+                    'reg_sex': $('#reg_sex').val(),
+                    'reg_pass': $('#reg_pass').val(),
+                    'reg_pass2': $('#reg_pass2').val(),
+                    'mail_post': $('#mail_post').attr('checked')
+                }, function (data) {
+                    $('#errorreg').html(data);
+                });
+            }
+        </script>
+        <style>
+            .proza {
+                filter: progid:DXImageTransform.Microsoft.Alpha(opacity=87); /* IE 5.5+*/
+                -moz-opacity: 0.87; /* Mozilla 1.6 � ���� */
+                -khtml-opacity: 0.87; /* Konqueror 3.1, Safari 1.1 */
+                opacity: 0.87; /* CSS3 - Mozilla 1.7b +, Firefox 0.9 +, Safari 1.2+, Opera 9+ */
+            }
+
+            .nobtn12 {
+                border: 0;
+                bottom: 80px;
+                left: 225px;
+                position: absolute;
+            }
+
+            .nobtn12:active {
+                bottom: 79px;
+            }
+
+            .inpreg1 {
+                padding: 2px;
+                font-size: 14px;
+                color: #003144;
+                background-color: #f6f4ec;
+                border: 1px solid #d1cdb8;
+                width: 178px;
+            }
+
+            .inpreg2 {
+                font-size: 12px;
+                color: #003144;
+                background-color: #f6f4ec;
+                border: 1px solid #d1cdb8;
+            }
+
+            #errorreg {
+                position: absolute;
+                width: 680px;
+                top: 0;
+                left: 0;
+                text-align: center;
+                color: red;
+                font-weight: bold;
+            }
+        </style>
+        <script>
+            cc('#regblock');
+        </script>
+        <?php
+    } elseif ($u->info['active'] != '' && $u->info['mail'] == 'No E-mail') {
+        if ($error != '') {
+            echo '<script>alert("' . $error . '");</script>';
+        }
+        ?>
+        <!-- ACTIVE -->
+        <?php
     }
     ?>
-    <!-- ACTIVE -->
-    <?php
-}
-?>
-<script>
-    var lasts = [-1, -1];
+    <script>
+        var lasts = [-1, -1];
 
-    function myexpLineTop27(e1, e2) {
-        $('#exp23mkrtkm').attr('title', "���� ���������" + "\n" + e1 + " / " + e2);
-        $('#exp23mkrtkm').html(Math.ceil(e1 / e2 * 100) + '%!');
-        if (Math.ceil(e1 / e2 * 100) < 1) {
-            $('#myexplin233').attr('width', '1%');
-        } else {
-            if (lasts[1] < e2) {
-                $('#myexplin233').css('width', '1%');
+        function myexpLineTop27(e1, e2) {
+            $('#exp23mkrtkm').attr('title', "���� ���������" + "\n" + e1 + " / " + e2);
+            $('#exp23mkrtkm').html(Math.ceil(e1 / e2 * 100) + '%!');
+            if (Math.ceil(e1 / e2 * 100) < 1) {
+                $('#myexplin233').attr('width', '1%');
+            } else {
+                if (lasts[1] < e2) {
+                    $('#myexplin233').css('width', '1%');
+                }
+                if (lasts[0] != e1 || lasts[1] != e2) {
+                    $('#myexplin233').animate({'width': Math.ceil(e1 / e2 * 100) + '%'}, 3000);
+                }
             }
-            if (lasts[0] != e1 || lasts[1] != e2) {
-                $('#myexplin233').animate({'width': Math.ceil(e1 / e2 * 100) + '%'}, 3000);
+            lasts[0] = e1;
+            lasts[1] = e2;
+        }
+
+        var smlk1 = 0;
+
+        function smiles1load() {
+            if (smlk1 == 0) {
+                $('#btnsmlrz').html('<small>&nbsp; ����� �������� &nbsp;</small>');
+                smlk1 = 1;
+                $('#smilesDiv').hide();
+                $('#smilesDiv2').show();
+                $('#smilesDiv3').hide();
+            } else {
+                $('#btnsmlrz').html('<small>&nbsp; ������ �������� &nbsp;</small>');
+                smlk1 = 0;
+                $('#smilesDiv').show();
+                $('#smilesDiv2').hide();
+                $('#smilesDiv3').hide();
             }
         }
-        lasts[0] = e1;
-        lasts[1] = e2;
-    }
-
-    var smlk1 = 0;
-
-    function smiles1load() {
-        if (smlk1 == 0) {
-            $('#btnsmlrz').html('<small>&nbsp; ����� �������� &nbsp;</small>');
-            smlk1 = 1;
-            $('#smilesDiv').hide();
-            $('#smilesDiv2').show();
-            $('#smilesDiv3').hide();
-        } else {
-            $('#btnsmlrz').html('<small>&nbsp; ������ �������� &nbsp;</small>');
-            smlk1 = 0;
-            $('#smilesDiv').show();
-            $('#smilesDiv2').hide();
-            $('#smilesDiv3').hide();
+    </script>
+    <style>
+        #qsst {
+            position: absolute;
+            z-index: 10000000;
+            cursor: default;
+            display: none;
         }
-    }
-</script>
-<style>
-    #qsst {
-        position: absolute;
-        z-index: 10000000;
-        cursor: default;
-        display: none;
-    }
 
-    #onbon {
-        position: absolute;
-        z-index: 100;
-        cursor: default;
-        display: none;
-        bottom: 30px;
-        left: 18px;
-    }
+        #onbon {
+            position: absolute;
+            z-index: 100;
+            cursor: default;
+            display: none;
+            bottom: 30px;
+            left: 18px;
+        }
 
-    #mini_qsst {
-        position: absolute;
-        z-index: 100;
-        cursor: default;
-        display: none;
-        bottom: 10px;
-        right: 18px;
-    }
-</style>
-<div id="qsst"></div>
-<div id="ttl" class="ttl_css" style="display:none;z-index:1111;"/>
-</div>
-<div id="nfml" style="display:none;position:absolute;"/>
-</div>
-<div id="persmenu" style="display:none;z-index:1110;"/>
-</div>
-<div id="windows" style="position:absolute;z-index:1101;"></div>
-<div id="wupbox" onmouseup="win.WstopDrag()" onmousemove="win.WmoveDrag(event)" onselectstart="return false"></div>
-<div id="chconfig">
-    <center><b>��������� ����</b></center>
-    <img title="��������� ����� (o_O)" src="https://<?= $c['img']; ?>/1x1.gif" class="eLine"><br>
-    �������� ����������: <SELECT id="chcf0">
-        <OPTION value='-1'>�������</OPTION>
-        <OPTION value='1'>15 ���.</OPTION>
-        <OPTION selected value='2'>30 ���.</OPTION>
-        <OPTION value='3'>1 ���.</OPTION>
-        <OPTION value='4'>5 ���.</OPTION>
-    </SELECT><br>
-    <div>���������� ������ ������: <SELECT id="chcf8">
-            <OPTION value='0' selected>�� ������</OPTION>
-            <OPTION value='1'>�� ������</OPTION>
-            <OPTION value='2'>�� ���������</OPTION>
-            <OPTION value='3'>�� �����</OPTION>
-        </SELECT>
-        <input name="chcf9" type="checkbox" id="chcf9" value="1"><small>�� ��������</small></div>
-    <div><input name="chcf12" type="checkbox" id="chcf12" value="1"> �������� �������</div>
-    <div style="display:<?php if ($u->info['admin'] > 0 || ($u->info['align'] > 1 && $u->info['align'] < 2) || ($u->info['align'] > 3 && $u->info['align'] < 4)) {
-        echo '';
-    } else {
-        echo 'none;';
-    } ?>"><input name="chcf7" type="checkbox" id="chcf7" value="1"> <span
-                title="�������� ��������� �� ���������� �� ������� �������� �������� ��������">��������� � ���������</span>
+        #mini_qsst {
+            position: absolute;
+            z-index: 100;
+            cursor: default;
+            display: none;
+            bottom: 10px;
+            right: 18px;
+        }
+    </style>
+    <div id="qsst"></div>
+    <div id="ttl" class="ttl_css" style="display:none;z-index:1111;"/>
     </div>
-    <img title="��������� ����� (o_O)" src="https://<?= $c['img']; ?>/1x1.gif" class="eLine">
-    <div>&nbsp; &nbsp;&nbsp; <span><a href="javascript:void(0)" onclick="chat.ignorListOpen();chconf();">������ ������������</a></span>
+    <div id="nfml" style="display:none;position:absolute;"/>
     </div>
-</div>
-<!-- ������� -->
-<div id="actionDiv" style="position:absolute;"></div>
+    <div id="persmenu" style="display:none;z-index:1110;"/>
+    </div>
+    <div id="windows" style="position:absolute;z-index:1101;"></div>
+    <div id="wupbox" onmouseup="win.WstopDrag()" onmousemove="win.WmoveDrag(event)" onselectstart="return false"></div>
+    <div id="chconfig">
+        <center><b>��������� ����</b></center>
+        <img title="��������� ����� (o_O)" src="https://<?= $c['img']; ?>/1x1.gif" class="eLine"><br>
+        �������� ����������: <SELECT id="chcf0">
+            <OPTION value='-1'>�������</OPTION>
+            <OPTION value='1'>15 ���.</OPTION>
+            <OPTION selected value='2'>30 ���.</OPTION>
+            <OPTION value='3'>1 ���.</OPTION>
+            <OPTION value='4'>5 ���.</OPTION>
+        </SELECT><br>
+        <div>���������� ������ ������: <SELECT id="chcf8">
+                <OPTION value='0' selected>�� ������</OPTION>
+                <OPTION value='1'>�� ������</OPTION>
+                <OPTION value='2'>�� ���������</OPTION>
+                <OPTION value='3'>�� �����</OPTION>
+            </SELECT>
+            <input name="chcf9" type="checkbox" id="chcf9" value="1"><small>�� ��������</small></div>
+        <div><input name="chcf12" type="checkbox" id="chcf12" value="1"> �������� �������</div>
+        <div style="display:<?php
+        if ($u->info['admin'] > 0 || ($u->info['align'] > 1 && $u->info['align'] < 2) || ($u->info['align'] > 3 && $u->info['align'] < 4)) {
+            echo '';
+        } else {
+            echo 'none;';
+        } ?>"><input name="chcf7" type="checkbox" id="chcf7" value="1"> <span
+                    title="�������� ��������� �� ���������� �� ������� �������� �������� ��������">��������� � ���������</span>
+        </div>
+        <img title="��������� ����� (o_O)" src="https://<?= $c['img']; ?>/1x1.gif" class="eLine">
+        <div>&nbsp; &nbsp;&nbsp; <span><a href="javascript:void(0)" onclick="chat.ignorListOpen();chconf();">������ ������������</a></span>
+        </div>
+    </div>
+    <!-- ������� -->
+    <div id="actionDiv" style="position:absolute;"></div>
 
-<div id="reline1" onselectstart="return false">
+    <div id="reline1" onselectstart="return false">
 
-    <img src="https://img.new-combats.com/1x1.gif" width="9" height="4"
-         style="float:left; display:block; position:absolute; background-image:url(https://img.new-combats.com/i/lite/_top_24.gif);">
-    <img src="https://img.new-combats.com/1x1.gif" width="10" height="4"
-         style="float:right; display:block; background-image:url(https://img.new-combats.com/i/lite/_top_28.gif);">
-</div>
-<div id="reline2" onselectstart="return false"></div>
-<!-- ������� -->
-<div id="upbox" onselectstart="return false"></div>
-<div style="position:absolute; top:0; left:0; height:37px; width:100%;" onselectstart="return false">
-    <div title="����� �����"
-         style="display:none; position:absolute; left: 198px; top: 13px; width:24px; height:15px; background-image:url(https://img.new-combats.com/i/mail2.gif);"
-         class="postdiv" id="postdiv"></div>
-    <div style="background: url(https://img.new-combats.com/i/lite/capitalcity/top_lite_cap_11.gif) repeat-x bottom; ">
-        <table width="100%" border="0" cellspacing="0" cellpadding="0"
-               style="background: url(https://img.new-combats.com/i/lite/top_lite_cap_03.gif) repeat-x top; ">
-            <tr>
-                <td align="left"><img src="https://img.new-combats.com/i/lite/capitalcity/top_lite_cap_01.gif"
-                                      width="64" height="14" class="db" style="padding-left:15px;"/></td>
-                <td align="right" class="main_text" style="position: relative; width:225px">
-                    <table cellspacing="0" cellpadding="0" border="0" width="565">
-                        <tr valign="bottom" align="center">
-                            <td width="31" height="14"><img class="db" height="14"
-                                                            src="https://img.new-combats.com/i/lite/mennu112_06_lite.gif"
-                                                            width="31"/></td>
-                            <td align="center">
-                                <table height="14" cellspacing="0" cellpadding="0" width="100%"
-                                       background="https://img.new-combats.com/i/lite/mennu112_06.gif" border="0">
-                                    <tr align="middle">
-                                        <td id="el1" class="main_text"
-                                            onClick="this.style.backgroundColor='#404040'; this.style.color='#FFFFFF'; showtable('1');"
-                                            align="center">������
-                                        </td>
-                                        <td width="1"><img class="db" height="11"
-                                                           src="https://img.new-combats.com/i/lite/mennu112_09.gif"
-                                                           width="1"/></td>
-                                        <td id="el2" class="main_text"
-                                            onClick="this.style.backgroundColor='#404040'; this.style.color='#FFFFFF'; showtable('2');"
-                                            style="background:#404040; color:#FFFFFF;" align="center">��������
-                                        </td>
-                                        <td width="1"><img class="db" height="11"
-                                                           src="https://img.new-combats.com/i/lite/mennu112_09.gif"
-                                                           width="1"/></td>
-                                        <td id="el3" class="main_text"
-                                            onClick="if(confirm('����� �� ����?')){ top.location = '/bk?exit&rnd=<?= $code ?>'; }"
-                                            align="center">�����
-                                        </td>
-                                    </tr>
-                                </table>
-                            </td>
-                            <td width="38"><img class="db" height="14"
-                                                src="https://img.new-combats.com/i/lite/mennu112_04_lite.gif"
-                                                width="37"/></td>
-                        </tr>
-                    </table>
-                </td>
-            </tr>
-            <tr>
-                <td align="left"><img style="display:block; float:left; margin-left:17px;"
-                                      src="https://img.new-combats.com/i/lite/top_lite_cap_07.gif" width="15"
-                                      height="17"/><img
-                            src="https://img.new-combats.com/i/lite/capitalcity/top_lite_cap_08.gif" width="152"
-                            height="17" class="db"/></td>
-                <td align="right">
-                    <table cellspacing="0" cellpadding="0" width="565"
-                           style="background-image:url(https://img.new-combats.com/i/lite/top_lite_cap_15.gif);"
-                           border="0">
-                        <tr>
-                            <td align="right" class="menutop">
-                                <table width="100%" border="0" cellpadding="0" cellspacing="0">
-                                    <tr>
-                                        <td width="20"><img class="db"
-                                                            src="https://img.new-combats.com/i/lite/top_lite_13.gif"
-                                                            width="20" height="17"/></td>
-                                        <td align="center" valign="top"
-                                            background="https://img.new-combats.com/i/lite/top_lite_low_15.gif"
-                                            style="font-size:10px;">
+        <img src="https://img.new-combats.com/1x1.gif" width="9" height="4"
+             style="float:left; display:block; position:absolute; background-image:url(https://img.new-combats.com/i/lite/_top_24.gif);">
+        <img src="https://img.new-combats.com/1x1.gif" width="10" height="4"
+             style="float:right; display:block; background-image:url(https://img.new-combats.com/i/lite/_top_28.gif);">
+    </div>
+    <div id="reline2" onselectstart="return false"></div>
+    <!-- ������� -->
+    <div id="upbox" onselectstart="return false"></div>
+    <div id="mainHeader" style="position:absolute; top:0; left:0; height:37px; width:100%;"
+         onselectstart="return false">
+        <div title="����� �����"
+             style="display:none; position:absolute; left: 198px; top: 13px; width:24px; height:15px; background-image:url(https://img.new-combats.com/i/mail2.gif);"
+             class="postdiv" id="postdiv"></div>
+        <div style="background: url(https://img.new-combats.com/i/lite/capitalcity/top_lite_cap_11.gif) repeat-x bottom; ">
+            <table width="100%" border="0" cellspacing="0" cellpadding="0"
+                   style="background: url(https://img.new-combats.com/i/lite/top_lite_cap_03.gif) repeat-x top; ">
+                <tr>
+                    <td align="left"><img src="https://img.new-combats.com/i/lite/capitalcity/top_lite_cap_01.gif"
+                                          width="64" height="14" class="db" style="padding-left:15px;"/></td>
+                    <td align="right" class="main_text" style="position: relative; width:225px">
+                        <table cellspacing="0" cellpadding="0" border="0" width="565">
+                            <tr valign="bottom" align="center">
+                                <td width="31" height="14"><img class="db" height="14"
+                                                                src="https://img.new-combats.com/i/lite/mennu112_06_lite.gif"
+                                                                width="31"/></td>
+                                <td align="center">
+                                    <table height="14" cellspacing="0" cellpadding="0" width="100%"
+                                           background="https://img.new-combats.com/i/lite/mennu112_06.gif" border="0">
+                                        <tr align="middle">
+                                            <td id="el1" class="main_text"
+                                                onClick="this.style.backgroundColor='#404040'; this.style.color='#FFFFFF'; showtable('1');"
+                                                align="center">������
+                                            </td>
+                                            <td width="1"><img class="db" height="11"
+                                                               src="https://img.new-combats.com/i/lite/mennu112_09.gif"
+                                                               width="1"/></td>
+                                            <td id="el2" class="main_text"
+                                                onClick="this.style.backgroundColor='#404040'; this.style.color='#FFFFFF'; showtable('2');"
+                                                style="background:#404040; color:#FFFFFF;" align="center">��������
+                                            </td>
+                                            <td width="1"><img class="db" height="11"
+                                                               src="https://img.new-combats.com/i/lite/mennu112_09.gif"
+                                                               width="1"/></td>
+                                            <td id="el3" class="main_text"
+                                                onClick="if(confirm('����� �� ����?')){ top.location = '/bk?exit&rnd=<?= $code ?>'; }"
+                                                align="center">�����
+                                            </td>
+                                        </tr>
+                                    </table>
+                                </td>
+                                <td width="38"><img class="db" height="14"
+                                                    src="https://img.new-combats.com/i/lite/mennu112_04_lite.gif"
+                                                    width="37"/></td>
+                            </tr>
+                        </table>
+                    </td>
+                </tr>
+                <tr>
+                    <td align="left"><img style="display:block; float:left; margin-left:17px;"
+                                          src="https://img.new-combats.com/i/lite/top_lite_cap_07.gif" width="15"
+                                          height="17"/><img
+                                src="https://img.new-combats.com/i/lite/capitalcity/top_lite_cap_08.gif" width="152"
+                                height="17" class="db"/></td>
+                    <td align="right">
+                        <table cellspacing="0" cellpadding="0" width="565"
+                               style="background-image:url(https://img.new-combats.com/i/lite/top_lite_cap_15.gif);"
+                               border="0">
+                            <tr>
+                                <td align="right" class="menutop">
+                                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
+                                        <tr>
+                                            <td width="20"><img class="db"
+                                                                src="https://img.new-combats.com/i/lite/top_lite_13.gif"
+                                                                width="20" height="17"/></td>
+                                            <td align="center" valign="top"
+                                                background="https://img.new-combats.com/i/lite/top_lite_low_15.gif"
+                                                style="font-size:10px;">
                                             <span style="display:none; text-align:center;" id="menu1"> <a
                                                         href="/main.php?referals" target="main" class="menutop"
                                                         style="color:green">�������</a> | <a
@@ -811,467 +810,504 @@ if ($u->info['bithday'] == '01.01.1800') {
                                                                                        style="color:green">������������</a> | <a
                                                         href="https://new-combats.com/news_script/lib/pisheri.html"
                                                         target="_blank" class="menutop"><font color=darkgreen>�� � �������</font></a> </span>
-                                            <span style="display:; text-align:center;" id="menu2"><a
-                                                        href="/main.php?inv=1&rn=<?= $c[9] ?>" target="main"
-                                                        class="menutop">���������</a> |<span
-                                                        style="display:; text-align:center;" id="menu2"><a
-                                                            href="main.php?titul" target="main" class="menutop"
-                                                            style="color:green"> ����������</a> | <a
-                                                            href="/main.php?skills=1&side=5" target="main"
-                                                            class="menutop">������</a> | <a href="/main.php?zayvka=1"
-                                                                                            target="main"
-                                                                                            class="menutop">��������</a> | <a
-                                                            href="/forum/?read=10957&rnd=1" target="_blank"
-                                                            class="menutop" style="color:red">���� �������</a> | <a
-                                                            href="/n" target="_blank" class="menutop"
-                                                            style="color:blue">�������</a> | <a href="settings"
-                                                                                                target="_blank"
-                                                                                                class="menutop">������</a></span>
-                                        </td>
-                                        <td width="22"><img class="db"
-                                                            src="https://img.new-combats.com/i/lite/top_lite_18.gif"
-                                                            width="22" height="17"/></td>
-                                    </tr>
-                                </table>
-                            </td>
-                        </tr>
-                    </table>
-                </td>
-            </tr>
-        </table>
-    </div>
-    <table class="deleteStyles" width="100%" border="0" cellspacing="0" cellpadding="0">
-        <tr>
-            <td width="15" height="6"><img class="db" src="https://img.new-combats.com/i/lite/_lit_20.gif" width="15"
-                                           height="6"/></td>
-            <td background="https://img.new-combats.com/i/lite/_top_20s.gif"></td>
-            <td width="24" height="6"><img class="db" src="https://img.new-combats.com/i/lite/_lit_27.gif" width="24"
-                                           height="6"/></td>
-        </tr>
-    </table>
-    <!-- -->
-</div>
-<table id="globalMain" width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
-    <tr id="headerTd">
-        <td height="31" width="9" bgcolor="#D6D6D6"></td>
-        <td height="31" bgcolor="#D6D6D6">&nbsp;</td>
-        <td height="31" width="12" bgcolor="#D6D6D6"></td>
-    </tr>
-    <tr id="sectionTd">
-        <td class="deleteStyles" bgcolor="#D6D6D6" background="https://img.new-combats.com/i/lite/_top_24.gif"></td>
-        <td valign="top" bgcolor="#e2e0e0" id="main_td">
-            <div id="touchmain" style="margin-top:3px;">
-                <iframe id="main" name="main" src="main.php" frameborder="0"
-                        style="display:block;padding:0;margin:0;width:100%;border:0;"
-                        scrolling="auto"></iframe>
-            </div>
-        </td>
-        <td class="deleteStyles" bgcolor="#D6D6D6" background="https://img.new-combats.com/i/lite/_top_28.gif"></td>
-    </tr>
-    <tr class="allChat">
-        <td class="deleteStyles" bgcolor="#D6D6D6" background="https://img.new-combats.com/i/lite/_top_24.gif"></td>
-        <td id="chat" valign="top" height="40%" bgcolor="#eeeeee">
-            <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0"
-                   style="border-top:1px solid #CCCCCC">
-                <tr>
-                    <td valign="top" id="chat_block" style="position:relative;border-top:1px solid #808080">
-                        <!-- display:block;-->
-                        <div id="mini_qsst" onClick="top.qn_slk()" style="cursor:pointer"></div>
-                        <div id="onbon"></div>
-                        <div id="chat_menus" unselectable="on" onselectstart="return false;"
-                             style="display:block;position:absolute; right:0; top:3px; padding-right:20px; height:18px; text-align:right; white-space:nowrap;">
-                            <!-- -->
-                            <table border="0" style="margin-top:-3px;" align="right" cellpadding="0" cellspacing="0">
-                                <tr>
-                                    <td>
-                                        <div id="chat_menu" style="text-align:right; white-space:nowrap;">
-                                        </div>
-                                    </td>
-                                    <td style="display:none;" id="scroll_none" width="3"></td>
-                                </tr>
-                            </table>
-                            <!-- -->
-                        </div>
-
-                        <div id="ttSmiles" onselectstart="return false" style="display:none;z-index:1100;"/>
-                        <div id="smilesDiv">�������� ���������</div>
-                        <div id="smilesDiv2" style="display:none">
-                            <?php
-                            echo '<center><small>����� �������� �������� ������ � <a href="/ekr.php" target="_blank">������������ ������</a><br>�������� ��������, ���� ��������� ������� �� �����������</small></center><hr>';
-                            //
-                            if ($u->info['add_smiles'] == '') { ?>
-                                <center><br><br><br><br><br><br><br><font color="grey">� ��� ��� ������ ���������</font>
-                                </center>
-                            <?php } else {
-
-                                $ex = explode(',', $u->info['add_smiles']);
-                                $i = 0;
-                                while ($i < count($ex)) {
-                                    echo '<img src="https://img.new-combats.com/i/smile/' . $ex[$i] . '.gif" title=":' . $ex[$i] . ':" style="cursor:pointer" onclick="chat.addSmile(\'' . $ex[$i] . '\');"> ';
-                                    $i++;
-                                }
-
-                            } ?>
-                        </div>
-                        <div id="smilesDiv3" style="display:none">
-
-                        </div>
-                        <div align="center" style="padding-left:5px; padding-right:5px;">
-                            <button class="btn fl"
-                                    style="display:none; padding:0; margin: 5px 2px 0 0;"
-                                    disabled="disabled"><small>&nbsp; ������ &nbsp;</small></button>
-                            <button class="btn fl" style="padding:0; margin: 5px 0 0;" id="btnsmlrz"
-                                    onClick="smiles1load();"><small>&nbsp; ������ �������� &nbsp;</small></button>
-                            <button class="btn fr" style="padding:0; margin: 5px 0 0;"
-                                    onClick="chat.lookSmiles()"><small>&nbsp; ������� &nbsp;</small></button>
-                        </div>
-                        </div>
-
-                        <div id="chat_list" style="cursor:default;">
-                            <div id="canals">
-                                <div id="canal5"></div>
-                                <div id="canal6" style="display:none;"></div>
-                            </div>
-                        </div>
-                    </td>
-                    <td width="350" valign="top" bgcolor="#faf2f2"
-                        style="border-left:2px solid #CCCCCC;border-top:1px solid #808080" id="online">
-                        <div id="online_list" style="cursor:default;">
-                            <div align="center" style="margin-top:5px;">
-                                <button class="btn" id="robtn" onClick="chat.reflesh()">��������</button>
-                                <button TYPE=button class="btn"
-                                        onClick="window.open('https://new-combats.com/monitoring', 'monitoring', 'location=yes,menubar=yes,status=yes,resizable=yes,toolbar=yes,scrollbars=yes,scrollbars=yes')"
-                                        title="������� ������\��������"><img
-                                            src="https://img.new-combats.com/i/fighttype0.gif" width="20" height="20">
-                                </button>
-                            </div>
-                            <font class="db" style="padding:0 0 8px 0;font-size: 10pt; color:#8f0000;"><b
-                                        id="roomName"></b></font>
-                            <div id="onlist"></div>
-                            <div style="padding:5px;margin-top:5px;">
-                                <div><label><input type="checkbox" value="1" checked id="autoRefOnline">���������
-                                        �������.</label></div>
-                                <div><label><input name="chcf10" type="checkbox" id="chcf10" checked value="0">��������
-                                        ���� �������</label></div>
-                            </div>
-                        </div>
+                                                <span style="display:; text-align:center;" id="menu2"><a
+                                                            href="/main.php?inv=1&rn=<?= $c[9] ?>" target="main"
+                                                            class="menutop">���������</a> |<span
+                                                            style="display:; text-align:center;" id="menu2"><a
+                                                                href="main.php?titul" target="main" class="menutop"
+                                                                style="color:green"> ����������</a> | <a
+                                                                href="/main.php?skills=1&side=5" target="main"
+                                                                class="menutop">������</a> | <a
+                                                                href="/main.php?zayvka=1"
+                                                                target="main"
+                                                                class="menutop">��������</a> | <a
+                                                                href="/forum/?read=10957&rnd=1" target="_blank"
+                                                                class="menutop" style="color:red">���� �������</a> | <a
+                                                                href="/n" target="_blank" class="menutop"
+                                                                style="color:blue">�������</a> | <a href="settings"
+                                                                                                    target="_blank"
+                                                                                                    class="menutop">������</a></span>
+                                            </td>
+                                            <td width="22"><img class="db"
+                                                                src="https://img.new-combats.com/i/lite/top_lite_18.gif"
+                                                                width="22" height="17"/></td>
+                                        </tr>
+                                    </table>
+                                </td>
+                            </tr>
+                        </table>
                     </td>
                 </tr>
             </table>
-        </td>
-        <td class="deleteStyles" bgcolor="#D6D6D6" background="https://img.new-combats.com/i/lite/_top_28.gif"></td>
-    </tr>
-    <tr class="allChat">
-        <td class="deleteStyles" height="30" valign="bottom"><img class="db"
-                                                                  src="https://img.new-combats.com/i/lite/bkf_l_r1_02.gif"
-                                                                  width="9" height="30"></td>
-        <td height="30" bgcolor="#E9E9E9" background="https://img.new-combats.com/i/buttons/chat_bg.gif">
-            <table width="100%" height="26" border="0" cellspacing="0" cellpadding="0">
-                <tr>
-                    <td width="30">
-                        <img <?php if ($u->info['admin'] > 0) { ?> onclick="top.frames['main'].location.href='map.php';" <?php } ?>
-                                class="db" src="https://img.new-combats.com/b___.gif" width="30" height="30"
-                                title="���"></td>
-                    <td style="display:none;" width="100" align="center" id="trader1">
-                        <div id="trader" style="border:1px solid #CCCCCC;padding:2px; margin-left:-2px; width:90%;"
-                             class="klan"><small id="moneyGM"><b>�������� ���</b></small></div>
-                    </td>
-                    <td><input type="hidden" name="trader" id="trader_val" value="0"><input
-                                onmouseup="top.chat.inObj=undefined;" type="text" name="textmsg" id="textmsg"
-                                maxlength="240" onKeyPress="top.testKey(event)"
-                                style="width:100%;font-size:11pt;margin-bottom:2px; border-radius: 5px; -webkit-border-radius: 5px;	-moz-border-radius: 5px;"/>
-                    </td>
-                    <td width="6">&nbsp;</td>
-                    <td width="30"><img onClick="chat.subSend();" src="https://img.new-combats.com/1x1.gif"
-                                        class="db cp chatBtn2_1"></td>
-                    <td width="5">
-                        <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
-                                codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
-                                width="1" height="1" id="Sound" align="middle">
-                            <param name="allowScriptAccess" value="always"/>
-                            <param name="movie" value="flash/Sound2.1.swf"/>
-                            <param name="quality" value="high"/>
-                            <param name="scale" value="noscale"/>
-                            <param name="wmode" value="transparent"/>
-                            <embed src="flash/Sound2.1.swf" quality="high" scale="noscale" wmode="transparent" width="1"
-                                   height="1" name="Sound" id="Sound2" align="middle" allowScriptAccess="always"
-                                   type="application/x-shockwave-flash"
-                                   pluginspage="https://www.macromedia.com/go/getflashplayer"/>
-                        </object>
-                    </td>
-                    <?php if ($u->info['level'] > 9) { ?>
+        </div>
+        <table class="deleteStyles" width="100%" border="0" cellspacing="0" cellpadding="0">
+            <tr>
+                <td width="15" height="6"><img class="db" src="https://img.new-combats.com/i/lite/_lit_20.gif"
+                                               width="15"
+                                               height="6"/></td>
+                <td background="https://img.new-combats.com/i/lite/_top_20s.gif"></td>
+                <td width="24" height="6"><img class="db" src="https://img.new-combats.com/i/lite/_lit_27.gif"
+                                               width="24"
+                                               height="6"/></td>
+            </tr>
+        </table>
+        <!-- -->
+    </div>
+    <table id="globalMain" width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
+        <tr id="headerTd">
+            <td height="31" width="9" bgcolor="#D6D6D6"></td>
+            <td height="31" bgcolor="#D6D6D6">&nbsp;</td>
+            <td height="31" width="12" bgcolor="#D6D6D6"></td>
+        </tr>
+        <tr id="sectionTd">
+            <td class="deleteStyles" bgcolor="#D6D6D6" background="https://img.new-combats.com/i/lite/_top_24.gif"></td>
+            <td valign="top" bgcolor="#e2e0e0" id="main_td">
+                <div id="touchmain" style="margin-top:3px;">
+                    <iframe id="main" name="main" src="main.php" frameborder="0"
+                            style="display:block;padding:0;margin:0;width:100%;border:0;"
+                            scrolling="auto"></iframe>
+                </div>
+            </td>
+            <td class="deleteStyles" bgcolor="#D6D6D6" background="https://img.new-combats.com/i/lite/_top_28.gif"></td>
+        </tr>
+        <tr class="allChat">
+            <td class="deleteStyles" bgcolor="#D6D6D6" background="https://img.new-combats.com/i/lite/_top_24.gif"></td>
+            <td id="chat" valign="top" height="40%" bgcolor="#eeeeee">
+                <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0"
+                       style="border-top:1px solid #CCCCCC">
+                    <tr>
+                        <td valign="top" id="chat_block" style="position:relative;border-top:1px solid #808080">
+                            <!-- display:block;-->
+                            <div id="mini_qsst" onClick="top.qn_slk()" style="cursor:pointer"></div>
+                            <div id="onbon"></div>
+                            <div id="chat_menus" unselectable="on" onselectstart="return false;"
+                                 style="display:block;position:absolute; right:0; top:3px; padding-right:20px; height:18px; text-align:right; white-space:nowrap;">
+                                <!-- -->
+                                <table border="0" style="margin-top:-3px;" align="right" cellpadding="0"
+                                       cellspacing="0">
+                                    <tr>
+                                        <td>
+                                            <div id="chat_menu" style="text-align:right; white-space:nowrap;">
+                                            </div>
+                                        </td>
+                                        <td style="display:none;" id="scroll_none" width="3"></td>
+                                    </tr>
+                                </table>
+                                <!-- -->
+                            </div>
+
+                            <div id="ttSmiles" onselectstart="return false" style="display:none;z-index:1100;"/>
+                            <div id="smilesDiv">�������� ���������</div>
+                            <div id="smilesDiv2" style="display:none">
+                                <?php
+                                echo '<center><small>����� �������� �������� ������ � <a href="/ekr.php" target="_blank">������������ ������</a><br>�������� ��������, ���� ��������� ������� �� �����������</small></center><hr>';
+                                //
+                                if ($u->info['add_smiles'] == '') { ?>
+                                    <center><br><br><br><br><br><br><br><font color="grey">� ��� ��� ������
+                                            ���������</font>
+                                    </center>
+                                <?php
+                                } else {
+
+                                    $ex = explode(',', $u->info['add_smiles']);
+                                    $i = 0;
+                                    while ($i < count($ex)) {
+                                        echo '<img src="https://img.new-combats.com/i/smile/' . $ex[$i] . '.gif" title=":' . $ex[$i] . ':" style="cursor:pointer" onclick="chat.addSmile(\'' . $ex[$i] . '\');"> ';
+                                        $i++;
+                                    }
+
+                                } ?>
+                            </div>
+                            <div id="smilesDiv3" style="display:none">
+
+                            </div>
+                            <div align="center" style="padding-left:5px; padding-right:5px;">
+                                <button class="btn fl"
+                                        style="display:none; padding:0; margin: 5px 2px 0 0;"
+                                        disabled="disabled"><small>&nbsp; ������ &nbsp;</small></button>
+                                <button class="btn fl" style="padding:0; margin: 5px 0 0;" id="btnsmlrz"
+                                        onClick="smiles1load();"><small>&nbsp; ������ �������� &nbsp;</small></button>
+                                <button class="btn fr" style="padding:0; margin: 5px 0 0;"
+                                        onClick="chat.lookSmiles()"><small>&nbsp; ������� &nbsp;</small></button>
+                            </div>
+                            </div>
+
+                            <div id="chat_list" style="cursor:default;">
+                                <div id="canals">
+                                    <div id="canal5"></div>
+                                    <div id="canal4"></div>
+                                    <div id="canal2"></div>
+                                    <div id="canal7"></div>
+                                    <div id="canal3"></div>
+                                    <div id="canal6" style="display:none;"></div>
+                                </div>
+                            </div>
+                        </td>
+                        <td width="350" valign="top" bgcolor="#faf2f2"
+                            style="border-left:2px solid #CCCCCC;border-top:1px solid #808080" id="online">
+                            <div id="online_list" style="cursor:default;">
+                                <div align="center" style="margin-top:5px;">
+                                    <button class="btn" id="robtn" onClick="chat.reflesh()">��������</button>
+                                    <button TYPE=button class="btn"
+                                            onClick="window.open('https://new-combats.com/monitoring', 'monitoring', 'location=yes,menubar=yes,status=yes,resizable=yes,toolbar=yes,scrollbars=yes,scrollbars=yes')"
+                                            title="������� ������\��������"><img
+                                                src="https://img.new-combats.com/i/fighttype0.gif" width="20"
+                                                height="20">
+                                    </button>
+                                </div>
+                                <font class="db" style="padding:0 0 8px 0;font-size: 10pt; color:#8f0000;"><b
+                                            id="roomName"></b></font>
+                                <div id="onlist"></div>
+                                <div style="padding:5px;margin-top:5px;">
+                                    <div><label><input type="checkbox" value="1" checked id="autoRefOnline">���������
+                                            �������.</label></div>
+                                    <div><label><input name="chcf10" type="checkbox" id="chcf10" checked value="0">��������
+                                            ���� �������</label></div>
+                                </div>
+                            </div>
+                        </td>
+                    </tr>
+                </table>
+            </td>
+            <td class="deleteStyles" bgcolor="#D6D6D6" background="https://img.new-combats.com/i/lite/_top_28.gif"></td>
+        </tr>
+        <tr class="allChat">
+            <td class="deleteStyles" height="30" valign="bottom"><img class="db"
+                                                                      src="https://img.new-combats.com/i/lite/bkf_l_r1_02.gif"
+                                                                      width="9" height="30"></td>
+            <td height="30" bgcolor="#E9E9E9" background="https://img.new-combats.com/i/buttons/chat_bg.gif">
+                <table width="100%" height="26" border="0" cellspacing="0" cellpadding="0">
+                    <tr>
+                        <td id="chatLeftIcon" width="30">
+                            <img <?php
+                            if ($u->info['admin'] > 0) { ?> onclick="top.frames['main'].location.href='map.php';" <?php
+                            } ?>
+                                    class="db" src="https://img.new-combats.com/b___.gif" width="30" height="30"
+                                    title="���"></td>
+                        <td style="display:none;" width="100" align="center" id="trader1">
+                            <div id="trader" style="border:1px solid #CCCCCC;padding:2px; margin-left:-2px; width:90%;"
+                                 class="klan"><small id="moneyGM"><b>�������� ���</b></small></div>
+                        </td>
+                        <td><input type="hidden" name="trader" id="trader_val" value="0"><input
+                                    onmouseup="top.chat.inObj=undefined;" type="text" name="textmsg" id="textmsg"
+                                    maxlength="240" onKeyPress="top.testKey(event)"
+                                    style="width:100%;font-size:11pt;margin-bottom:2px; border-radius: 5px; -webkit-border-radius: 5px;	-moz-border-radius: 5px;"/>
+                        </td>
+                        <td width="6">&nbsp;</td>
+                        <td id="sendButtonTextMsg" width="30"><img onClick="chat.subSend();"
+                                                                   src="https://img.new-combats.com/1x1.gif"
+                                                                   class="db cp chatBtn2_1"></td>
+                        <td width="5">
+                            <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
+                                    codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
+                                    width="1" height="1" id="Sound" align="middle">
+                                <param name="allowScriptAccess" value="always"/>
+                                <param name="movie" value="flash/Sound2.1.swf"/>
+                                <param name="quality" value="high"/>
+                                <param name="scale" value="noscale"/>
+                                <param name="wmode" value="transparent"/>
+                                <embed src="flash/Sound2.1.swf" quality="high" scale="noscale" wmode="transparent"
+                                       width="1"
+                                       height="1" name="Sound" id="Sound2" align="middle" allowScriptAccess="always"
+                                       type="application/x-shockwave-flash"
+                                       pluginspage="https://www.macromedia.com/go/getflashplayer"/>
+                            </object>
+                        </td>
                         <td width="30">
                             <button onClick="chat.voiceMessage()" title="�������� ��������� ���������" id="record">
                                 ������
                             </button>
                         </td>
-
-                    <?php } ?>
-                    <td width="30"><img onClick="chat.clear();" class="db cp" title="�������� ������ �����"
-                                        src="https://img.new-combats.com/i/buttons/chatBtn3.gif"></td>
-                    <td width="30"><img onClick="chat.filterMsg();" id="chbtn1"
-                                        title="���������� � ���� ������ ��������� ������������ ���"
-                                        src="https://img.new-combats.com/1x1.gif" class="db cp chatBtn1_1"></td>
-                    <td width="30"><img onClick="chat.systemMsg();" id="chbtn4"
-                                        title="���������� � ���� ��������� ���������"
-                                        src="https://img.new-combats.com/1x1.gif"
-                                        class="db cp chatBtn4_<?php if (isset($_COOKIE['citySys']) && $_COOKIE['citySys'] == 1) {
-                                            echo 2;
-                                        } else {
-                                            echo 1;
-                                        } ?>"></td>
-                    <td width="30"><img id="chbtn6" onClick="chat.translitChat()"
-                                        title="��������������� �������� � ������� �����"
-                                        src="https://img.new-combats.com/1x1.gif" class="db cp chatBtn6_1"></td>
-                    <td width="30"><img id="chbtn7" onClick="chat.soundChat()" src="https://img.new-combats.com/1x1.gif"
-                                        title="�����" class="db cp chatBtn7_1"></td>
-                    <td width="10">&nbsp;</td>
-                    <td width="30"><img id="chbtn8" class="db cp chatBtn8_1" onClick="chat.lookSmiles()"
-                                        title="��������" src="https://img.new-combats.com/1x1.gif"></td>
-                    <td width="16" bgcolor="#BAB7B3"><img src="https://img.new-combats.com/i/buttons/chat_explode.gif"
-                                                          width="16" height="30" class="db"/></td>
-                    <td width="30"><img onclick="top.getUrl('main','main.php?inv=1&rnd='+c.rnd);" class="db cp"
-                                        title="���������" src="https://img.new-combats.com/i/buttons/chatBtn13.gif">
-                    </td>
-                    <?php if ($u->info['level'] > 7) { ?>
-                        <td width="30"><img onClick="top.getUrl('main','main.php?transfer=1&rnd='+c.rnd);" class="db cp"
-                                            title="��������" src="https://img.new-combats.com/i/buttons/chatBtn16.gif">
+                        <td width="30"><img onClick="chat.clear();" class="db cp" title="�������� ������ �����"
+                                            src="https://img.new-combats.com/i/buttons/chatBtn3.gif"></td>
+                        <td width="30"><img onClick="chat.filterMsg();" id="chbtn1"
+                                            title="���������� � ���� ������ ��������� ������������ ���"
+                                            src="https://img.new-combats.com/1x1.gif" class="db cp chatBtn1_1"></td>
+                        <td width="30"><img onClick="chat.systemMsg();" id="chbtn4"
+                                            title="���������� � ���� ��������� ���������"
+                                            src="https://img.new-combats.com/1x1.gif"
+                                            class="db cp chatBtn4_<?php
+                                            if (isset($_COOKIE['citySys']) && $_COOKIE['citySys'] == 1) {
+                                                echo 2;
+                                            } else {
+                                                echo 1;
+                                            } ?>"></td>
+                        <td width="30"><img id="chbtn6" onClick="chat.translitChat()"
+                                            title="��������������� �������� � ������� �����"
+                                            src="https://img.new-combats.com/1x1.gif" class="db cp chatBtn6_1"></td>
+                        <td width="30"><img id="chbtn7" onClick="chat.soundChat()"
+                                            src="https://img.new-combats.com/1x1.gif"
+                                            title="�����" class="db cp chatBtn7_1"></td>
+                        <td width="10">&nbsp;</td>
+                        <td width="30"><img id="chbtn8" class="db cp chatBtn8_1" onClick="chat.lookSmiles()"
+                                            title="��������" src="https://img.new-combats.com/1x1.gif"></td>
+                        <td width="16" bgcolor="#BAB7B3"><img
+                                    src="https://img.new-combats.com/i/buttons/chat_explode.gif"
+                                    width="16" height="30" class="db"/></td>
+                        <td width="30"><img onclick="top.getUrl('main','main.php?inv=1&rnd='+c.rnd);" class="db cp"
+                                            title="���������" src="https://img.new-combats.com/i/buttons/chatBtn13.gif">
                         </td>
-                    <?php } ?>
+                        <?php
+                        if ($u->info['level'] > 7) { ?>
+                            <td width="30"><img onClick="top.getUrl('main','main.php?transfer=1&rnd='+c.rnd);"
+                                                class="db cp"
+                                                title="��������"
+                                                src="https://img.new-combats.com/i/buttons/chatBtn16.gif">
+                            </td>
+                        <?php
+                        } ?>
                         <td width="30"><img onClick="top.getUrl('main','main.php?add_eff=1&rnd='+c.rnd);" class="db cp"
                                             title="������" src="https://img.new-combats.com/i/buttons/chatBtn151.gif">
                         </td>
-                    <?php
-                    if ($u->info['align'] == 50 || $u->info['align2'] == 50 || $u->info['admin'] == 1) { ?>
-                        <td width="30"><img onClick="top.getUrl('main','main.php?alhp=1&rnd='+c.rnd);" class="db cp"
-                                            src="https://img.new-combats.com/i/buttons/chatBtn20.gif"></td>
-                    <?php }
-                    if ($u->info['align'] >= 1.1 && $u->info['align'] < 2) { ?>
-                        <td width="30"><img onClick="top.getUrl('main','main.php?light=1&rnd='+c.rnd);" class="db cp"
-                                            title="������ ��������"
-                                            src="https://img.new-combats.com/i/buttons/chatBtn15.gif"></td>
-                    <?php }
-                    if ($u->info['align'] >= 3.01 && $u->info['align'] < 4) { ?>
-                        <td width="30"><img onClick="top.getUrl('main','main.php?dark=1&rnd='+c.rnd);" class="db cp"
-                                            title="������ �������"
-                                            src="https://img.new-combats.com/i/buttons/chatBtn10.gif"></td>
-                    <?php }
-                    if ($u->info['vip'] > time() || $u->stats['silvers'] > 0 || $u->stats['bronze'] > 0 || $u->stats['gold'] > 0) { ?>
-                        <!-- VIP -->
-                        <td width="30"><img onClick="top.getUrl('main','main.php?vip=1&rnd='+c.rnd);" class="db cp"
-                                            src="https://img.new-combats.com/i/buttons/a___ang17.gif"
-                                            onMouseOver="top.hi(this,'<b>������ ��������� ������ <?= $u->info['login'] ?></b>',event,3,0,1,0,'');"
-                                            onMouseOut="top.hic();" onMouseDown="top.hic();"></td></td>
+                        <?php
+                        if ($u->info['align'] == 50 || $u->info['align2'] == 50 || $u->info['admin'] == 1) { ?>
+                            <td width="30"><img onClick="top.getUrl('main','main.php?alhp=1&rnd='+c.rnd);" class="db cp"
+                                                src="https://img.new-combats.com/i/buttons/chatBtn20.gif"></td>
+                        <?php
+                        }
+                        if ($u->info['align'] >= 1.1 && $u->info['align'] < 2) { ?>
+                            <td width="30"><img onClick="top.getUrl('main','main.php?light=1&rnd='+c.rnd);"
+                                                class="db cp"
+                                                title="������ ��������"
+                                                src="https://img.new-combats.com/i/buttons/chatBtn15.gif"></td>
+                        <?php
+                        }
+                        if ($u->info['align'] >= 3.01 && $u->info['align'] < 4) { ?>
+                            <td width="30"><img onClick="top.getUrl('main','main.php?dark=1&rnd='+c.rnd);" class="db cp"
+                                                title="������ �������"
+                                                src="https://img.new-combats.com/i/buttons/chatBtn10.gif"></td>
+                        <?php
+                        }
+                        if ($u->info['vip'] > time(
+                            ) || $u->stats['silvers'] > 0 || $u->stats['bronze'] > 0 || $u->stats['gold'] > 0) { ?>
+                            <!-- VIP -->
+                            <td width="30"><img onClick="top.getUrl('main','main.php?vip=1&rnd='+c.rnd);" class="db cp"
+                                                src="https://img.new-combats.com/i/buttons/a___ang17.gif"
+                                                onMouseOver="top.hi(this,'<b>������ ��������� ������ <?= $u->info['login'] ?></b>',event,3,0,1,0,'');"
+                                                onMouseOut="top.hic();" onMouseDown="top.hic();"></td></td>
 
-                    <?php } ?>
+                        <?php
+                        } ?>
                         <td width="30"><img onClick="top.getUrl('main','main.php?friends=1&rnd='+c.rnd);" class="db cp"
                                             title="������" src="https://img.new-combats.com/i/buttons/chatBtn12.gif">
                         </td>
-                    <?php if ($u->info['align'] >= 1 && $u->info['align'] < 2) { ?>
-                        <td width="30"><img onClick="top.getUrl('main','main.php?1_panel=1&rnd='+c.rnd);" class="db cp"
-                                            title="������ �����"
-                                            src="https://img.new-combats.com/i/buttons/chatBtn15.gif"></td>
-                    <?php }
-                    if ($u->info['align'] >= 3 && $u->info['align'] < 4) { ?>
-                        <td width="30"><img onClick="top.getUrl('main','main.php?3_panel=1&rnd='+c.rnd);" class="db cp"
-                                            title="������ ����"
-                                            src="https://img.new-combats.com/i/buttons/chatBtn10.gif"></td>
-                    <?php }
-                    if ($u->info['align'] == 7) { ?>
-                        <td width="30"><img onClick="top.getUrl('main','main.php?7_panel=1&rnd='+c.rnd);" class="db cp"
-                                            title="������ ������������"
-                                            src="https://img.new-combats.com/i/buttons/a___neutral.gif"></td>
-                    <?php }
-                    if ($u->info['bukmeker'] == 1 || $u->info['admin'] == 1) { ?>
-                        <td width="30"><img onClick="top.getUrl('main','main.php?bukmeker=1&rnd='+c.rnd);" class="db cp"
-                                            title="������ ��������� "
-                                            src="https://img.new-combats.com/i/buttons/bukmek.gif"></td>
-                    <?php }
+                        <?php
+                        if ($u->info['align'] >= 1 && $u->info['align'] < 2) { ?>
+                            <td width="30"><img onClick="top.getUrl('main','main.php?1_panel=1&rnd='+c.rnd);"
+                                                class="db cp"
+                                                title="������ �����"
+                                                src="https://img.new-combats.com/i/buttons/chatBtn15.gif"></td>
+                        <?php
+                        }
+                        if ($u->info['align'] >= 3 && $u->info['align'] < 4) { ?>
+                            <td width="30"><img onClick="top.getUrl('main','main.php?3_panel=1&rnd='+c.rnd);"
+                                                class="db cp"
+                                                title="������ ����"
+                                                src="https://img.new-combats.com/i/buttons/chatBtn10.gif"></td>
+                        <?php
+                        }
+                        if ($u->info['align'] == 7) { ?>
+                            <td width="30"><img onClick="top.getUrl('main','main.php?7_panel=1&rnd='+c.rnd);"
+                                                class="db cp"
+                                                title="������ ������������"
+                                                src="https://img.new-combats.com/i/buttons/a___neutral.gif"></td>
+                        <?php
+                        }
+                        if ($u->info['bukmeker'] == 1 || $u->info['admin'] == 1) { ?>
+                            <td width="30"><img onClick="top.getUrl('main','main.php?bukmeker=1&rnd='+c.rnd);"
+                                                class="db cp"
+                                                title="������ ��������� "
+                                                src="https://img.new-combats.com/i/buttons/bukmek.gif"></td>
+                        <?php
+                        }
 
-                    if ($u->info['clan'] > 0) { ?>
-                        <td width="30"><img onClick="top.getUrl('main','main.php?clan=1&rnd='+c.rnd);" class="db cp"
-                                            title="����" src="https://img.new-combats.com/i/buttons/chatBtn14.gif"></td>
-                    <?php }
-                    if ($u->info['admin'] > 0) { ?>
-                        <td width="30"><img onClick="top.getUrl('main','main.php?admin=1&rnd='+c.rnd);" class="db cp"
-                                            src="https://img.new-combats.com/i/buttons/chatBtn19.gif"></td>
-                    <?php } ?>
-                    <td width="30"><img onclick="window.open('ekr.php')" class="db cp" title="������� ������������"
-                                        src="https://img.new-combats.com/i/buttons/a___nak.gif"></td>
+                        if ($u->info['clan'] > 0) { ?>
+                            <td width="30"><img onClick="top.getUrl('main','main.php?clan=1&rnd='+c.rnd);" class="db cp"
+                                                title="����" src="https://img.new-combats.com/i/buttons/chatBtn14.gif">
+                            </td>
+                        <?php
+                        }
+                        if ($u->info['admin'] > 0) { ?>
+                            <td width="30"><img onClick="top.getUrl('main','main.php?admin=1&rnd='+c.rnd);"
+                                                class="db cp"
+                                                src="https://img.new-combats.com/i/buttons/chatBtn19.gif"></td>
+                        <?php
+                        } ?>
+                        <td width="30"><img onclick="window.open('ekr.php')" class="db cp" title="������� ������������"
+                                            src="https://img.new-combats.com/i/buttons/a___nak.gif"></td>
 
 
-                    <!-- ����� -->
-                    <td width="71" id="tdDate">
-                        <button id="contentDate"></button>
-                    </td>
-                    <!-- ����� -->
+                        <!-- ����� -->
+                        <td width="71" id="tdDate">
+                            <button id="contentDate"></button>
+                        </td>
+                        <!-- ����� -->
 
-                </tr>
-            </table>
-        </td>
-        <td class="deleteStyles" height="30" align="right" bgcolor="#D6D6D6"><img class="db"
-                                                                                  src="https://img.new-combats.com/i/lite/bkf_l_r1_06.gif"
-                                                                                  width="9" height="30"></td>
-    </tr>
-    <tr id="deleteFooter">
-        <td height="5" bgcolor="#D6D6D6" style="background:url(https://img.new-combats.com/sand_mid_31.png);"></td>
-        <td height="5" bgcolor="#D6D6D6" style="background:url(https://img.new-combats.com/sand_mid_31.png);">
-            <!-- iFrames zone --></td>
-        <td height="5" bgcolor="#D6D6D6" style="background:url(https://img.new-combats.com/sand_mid_31.png);"></td>
-    </tr>
-</table>
-<p id="timerVoiceMess" hidden></p>
+                    </tr>
+                </table>
+            </td>
+            <td class="deleteStyles" height="30" align="right" bgcolor="#D6D6D6"><img class="db"
+                                                                                      src="https://img.new-combats.com/i/lite/bkf_l_r1_06.gif"
+                                                                                      width="9" height="30"></td>
+        </tr>
+        <tr id="deleteFooter">
+            <td height="5" bgcolor="#D6D6D6" style="background:url(https://img.new-combats.com/sand_mid_31.png);"></td>
+            <td height="5" bgcolor="#D6D6D6" style="background:url(https://img.new-combats.com/sand_mid_31.png);">
+                <!-- iFrames zone --></td>
+            <td height="5" bgcolor="#D6D6D6" style="background:url(https://img.new-combats.com/sand_mid_31.png);"></td>
+        </tr>
+    </table>
+    <p id="timerVoiceMess" hidden></p>
 
-<!-- ������ -->
-<script>
-    // ����
-    var intervalClear
-    var timeoutClear
-    var $button = document.getElementById("contentDate")
-    var $div = document.createElement("div")
-    $div.id = "divFullDate"
-    document.body.append($div)
-    $div.hidden = true
+    <!-- ������ -->
+    <script>
+        // ����
+        var intervalClear
+        var timeoutClear
+        var $button = document.getElementById("contentDate")
+        var $div = document.createElement("div")
+        $div.id = "divFullDate"
+        document.body.append($div)
+        $div.hidden = true
 
 
-    var date = new Date()
-    var currentSec = (60 - date.getUTCSeconds()) * 1000
+        var date = new Date()
+        var currentSec = (60 - date.getUTCSeconds()) * 1000
 
-    asyncInterval()
+        asyncInterval()
 
-    async function asyncInterval() {
+        async function asyncInterval() {
 
-        timeMSK()
+            timeMSK()
 
-        var promise = await new Promise((resolve, reject) => {
-            setTimeout(() => {
-                timeMSK()
-                resolve("��� ������")
-            }, currentSec)
-        })
+            var promise = await new Promise((resolve, reject) => {
+                setTimeout(() => {
+                    timeMSK()
+                    resolve("��� ������")
+                }, currentSec)
+            })
 
-        setInterval(() => timeMSK(), 60000)
-    }
+            setInterval(() => timeMSK(), 60000)
+        }
 
-    function timeMSK(hover = false) {
+        function timeMSK(hover = false) {
 
-        var mskTime = (new Date).toLocaleTimeString('ru-RU', {timeZone: 'Europe/Moscow'})
-        $button.textContent = mskTime.match(/\d{2}:\d{2}/i)[0]
+            var mskTime = (new Date).toLocaleTimeString('ru-RU', {timeZone: 'Europe/Moscow'})
+            $button.textContent = mskTime.match(/\d{2}:\d{2}/i)[0]
 
-        if (hover) {
-            var fullDate = (new Date).toLocaleDateString('ru-RU', {timeZone: 'Europe/Moscow'})
-            var [day, month, year] = fullDate.match(/\b\d{2,4}\b/gi)
+            if (hover) {
+                var fullDate = (new Date).toLocaleDateString('ru-RU', {timeZone: 'Europe/Moscow'})
+                var [day, month, year] = fullDate.match(/\b\d{2,4}\b/gi)
 
-            var objDate = {year: +year, month: +month - 1, day: +day}
-            var todayDay = new Date(objDate.year, objDate.month, objDate.day).getUTCDay()
-            // In objDate.day make ++
+                var objDate = {year: +year, month: +month - 1, day: +day}
+                var todayDay = new Date(objDate.year, objDate.month, objDate.day).getUTCDay()
+                // In objDate.day make ++
 
-            return {
-                date: divFullDateTime(objDate),
-                time: mskTime,
-                redDay: todayDay === 5 || todayDay === 6 || todayDay === 0
+                return {
+                    date: divFullDateTime(objDate),
+                    time: mskTime,
+                    redDay: todayDay === 5 || todayDay === 6 || todayDay === 0
+                }
             }
         }
-    }
 
-    function divFullDateTime({year, month, day}) {
-        var strMonth = ""
+        function divFullDateTime({year, month, day}) {
+            var strMonth = ""
 
-        switch (month) {
-            case 0:
-                strMonth = "������";
-                break
-            case 1:
-                strMonth = "�������";
-                break
-            case 2:
-                strMonth = "�����";
-                break
-            case 3:
-                strMonth = "������";
-                break
-            case 4:
-                strMonth = "���";
-                break
-            case 5:
-                strMonth = "����";
-                break
-            case 6:
-                strMonth = "����";
-                break
-            case 7:
-                strMonth = "�������";
-                break
-            case 8:
-                strMonth = "��������";
-                break
-            case 9:
-                strMonth = "�������";
-                break
-            case 10:
-                strMonth = "������";
-                break
-            case 11:
-                strMonth = "�������";
-                break
-            default:
-                break
+            switch (month) {
+                case 0:
+                    strMonth = "������";
+                    break
+                case 1:
+                    strMonth = "�������";
+                    break
+                case 2:
+                    strMonth = "�����";
+                    break
+                case 3:
+                    strMonth = "������";
+                    break
+                case 4:
+                    strMonth = "���";
+                    break
+                case 5:
+                    strMonth = "����";
+                    break
+                case 6:
+                    strMonth = "����";
+                    break
+                case 7:
+                    strMonth = "�������";
+                    break
+                case 8:
+                    strMonth = "��������";
+                    break
+                case 9:
+                    strMonth = "�������";
+                    break
+                case 10:
+                    strMonth = "������";
+                    break
+                case 11:
+                    strMonth = "�������";
+                    break
+                default:
+                    break
+            }
+            return `${day} ${strMonth} ${year}`
         }
-        return `${day} ${strMonth} ${year}`
-    }
 
-    function everySecondsUpdate() {
-        var {date, time, redDay} = timeMSK(true)
+        function everySecondsUpdate() {
+            var {date, time, redDay} = timeMSK(true)
 
-        $div.innerHTML = `<p>${time}</p>
+            $div.innerHTML = `<p>${time}</p>
 		<p id="dateRed">${date}</p>`
 
-        document.getElementById("dateRed").style.color = redDay ? "red" : ""
+            document.getElementById("dateRed").style.color = redDay ? "red" : ""
+        }
+
+        $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)
+        })
+    </script>
+
+    <?php
+    if ($u->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');
+        }
     }
+    ?>
+    <script>
+        startEngine();
+        chat.testTimer(false);
+        setTimeout('chat.nozpros=0;', 20);
+    </script>
 
-    $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)
-    })
-</script>
+    <script type="text/javascript" src="css/stylesMobile.js"></script>
 
+    </body>
+    </html>
 <?php
-if ($u->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');
-    }
-}
-?>
-<script>
-    startEngine();
-    chat.testTimer(false);
-    setTimeout('chat.nozpros=0;', 20);
-</script>
-
-<script type="text/javascript" src="css/stylesMobile.js"></script>
-
-</body>
-</html>
-<?php
-unset($db);
-?>
+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 @@
-<?php
-define('GAME',true);
-function er($e)
-{
-	 global $c;
-	 die('<html><head><meta name="msapplication-config" content="browserconfig.xml"><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"><meta http-equiv="Content-Language" content="ru"><TITLE>��������� ������</TITLE></HEAD><BODY text="#FFFFFF"><p><font color=black>��������� ������: <pre>'.$e.'</pre><b><p><a href="https://'.$c[0].'/">�����</b></a><HR><p align="right">(c) <a href="https://'.$c[0].'/">'.$c[1].'</a></p></body></html>');
-}
-
-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('<script>top.location = "https://'.$c['host'].'/";</script>');
-}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 ���������<br>��������������� � ������� ��������.');
-}
-
-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();
-}
-
-?>
-<!DOCTYPE html>
-<html lang="ru-RU">
-<head>
-<meta charset="windows-1251" />
-<title>����� ���������� ����</title>
-<meta name="description" content="����� ���������� ���� combats ������ 2. ����������� ������ � ���������� ���� � ��������. ������� ��� ������� � �������� � �������� ������� ������ ������� ��." />
-<meta name="keywords" content="���������� ���� ����, ���������� ���� ������, ���� ���������� ����, ������ ���������� ����, ���������� ���� ������ ����, ���������� ���� ���������� ����, ������ � ���������� ����, ���� ��, �� ����, ������ ��, ������ � ��, �� ������ ����, ����� ��, ����������� ���������� ����, ����������� ��, combats, �������, combats ru, combats com, OldBK, oldbk ru, oldbk com, �����, old bk, ��� ��, mycombats, rebk, recombats, oldcombats, obk2"/>
-<meta name="msapplication-config" content="browserconfig.xml" />
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
-<link rel="stylesheet" type="text/css" href="css/clu0b.css" />
-<link rel="stylesheet" type="text/css" href="css/windows.css" />
-<link rel="stylesheet" type="text/css" href="css/hack.css" />
-<!--[if IE]>
-<script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
-<![endif]-->
-<script>
-var des = <?=(0+$u->info['design'])?>;
-var c = { 
-	noEr:0,
-	noErTmr:0,
-	url:'<?=$c['host']?>',
-	img:'img.new-combats.com',
-	uid:<?=(0+$u->info['id'])?>,
-	login:'<?=$u->info['login']?>',
-	city:'<?=$u->info['city']?>',
-	lvl:<?=$u->info['level']?>,
-	rnd:'<?=$code?>',
-	filter:0,
-	time:<?=time()?>,
-	pl:0,
-	align:<?=$u->info['align']?>,
-	clan:<?=$u->info['clan']?>,
-	admin:<?=$u->info['admin']?>,
-	sound:0,
-	money:<?=$u->info['money']?>
-}, sd4key = "<?=$u->info['nextAct']?>", lafstReg = {},enterUse = 0;
-
-function ctest(city) {
-	if(city != c['city']) {
-		top.location = '/bk';
-	}
-}
-
-function testKey(event)
-{
-	if(event.keyCode==10 || event.keyCode==13)
-	{
-		if(top.enterUse == 0)
-		{
-			chat.subSend();
-			top.enterUse = 1;
-			setTimeout('top.enterUse = 0',1000);
-		}
-	}
-}
-setInterval('c.time++',1000);
-</script>
-<script type="text/javascript" src="js/jquery.js"></script>
-<script>
-$.ajaxSetup({cache: false});
-$(window).error(function(){
-  return true;
-});
-var iusrno = {};
-function ignoreUser(u) {
-	if( iusrno[u] == undefined || iusrno[u] == 0 ) {
-		//top.iusrno[u] = 1;
-		$('#main').attr({'src':'main.php?friends=1&ignore=' + u + ''});
-	}else{
-		//top.iusrno[u] = 0;
-		$('#main').attr({'src':'main.php?friends=1&ignore=' + u + ''});
-	}
-}
-</script>
-<script type="text/javascript" src="js/jqueryrotate.js"></script>
-<script type="text/javascript" src="js/jquery.zclip.js"></script>
-<script type="text/javascript" src="js/jquery.cookie.js"></script>
-<script type="text/javascript" src="js/title.js"></script>
-
-<script type="text/javascript" src="js/gameEngine.js?<?=time()?>"></script>
-<!-- <script type="text/javascript" src="js/chat-engine.js"></script> -->
-<script type="text/javascript" src="js/interface.js"></script>
-<script type="text/javascript" src="js/dataCenter.js"></script>
-
-<script type="text/javascript" src="js/onlineList.js"></script>
-<script type="text/javascript" src="js/hpregen.js"></script>
-<script type="text/javascript" src="js/jquery-fireHint.js"></script>
-<?
-//
-/*
-$fpi = mysql_fetch_array(mysql_query('SELECT * FROM `fastpanel` WHERE `uid` = "'.$u->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 '<script>'.$fph.'</script>';
-}*/
-//
-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 '<script type="text/javascript" src="js/jquery.nicescroll.js"></script>';
-?>
-<style type="text/css">
-#touchmain {
-	padding: 0px;
-	border: 0;
-	overflow: auto;
-	margin: 0px;
-}
-</style>
-
-<script>
-  $(document).ready(function() { 
-    $("#touchmain").niceScroll("#main",{autohidemode:false,boxzoom:false});	
-  });
-</script>
-<?
-}
-?>
-	<style type="text/css">
-		/* Additional classes examples */
-		.woman a {
-			color:#C33;
-		}
-		.woman a:hover {
-			color:#ff0000;
-		}
-		img { vertical-align:bottom; }
-		#tgf_loadingLine {
-			height:18px;
-			width:100%;
-			color:#776b4a;
-			background-color:#ddd5bf;
-			position:relative;
-		}
-		.tfpgs {
-			padding:5px;
-			background-color:#d4cbb4;
-			border-bottom:1px solid #988e73;
-			border-top:1px solid #eae3d0;
-			cursor:default;
-			text-align:center;
-		}
-		.tgf_msg0 { 
-			padding:5px;
-			background-color:#c6b893;
-			border-bottom:1px solid #988e73;
-			border-top:1px solid #eae3d0;
-			cursor:default;
-		}
-		.tgf_msg1 { 
-			padding:5px;
-			background-color:#d4cbb4;
-			border-bottom:1px solid #988e73;
-			border-top:1px solid #eae3d0;
-			cursor:default;
-		}
-		.tgf_msgt {
-			color:#988e73;
-			padding-left:2px;
-			padding-right:2px;
-			border-right:1px solid #b1a993;
-		}
-		.tf_btn1 {
-			background-color:#ddd5bf;
-			padding-left:10px;
-			padding-right:10px;
-			padding-bottom:3px;
-			padding-top:3px;
-			margin:1px;
-			color:#988e73;
-			cursor:pointer;
-		    -moz-border-radius: 4px;
-		    -webkit-border-radius: 4px;
-		    border-radius: 4px;
-		}
-		
-		.tf_btn1:hover {
-			background-color:#b7ae96;
-			color:#ddd5bf;
-			cursor:pointer;
-		}
-		
-		.tf_btn11 {
-			background-color:#988e73;
-			padding-left:10px;
-			padding-right:10px;
-			padding-bottom:3px;
-			padding-top:3px;
-			margin:1px;
-			color:#ddd5bf;
-			cursor:pointer;
-		    -moz-border-radius: 4px;
-		    -webkit-border-radius: 4px;
-		    border-radius: 4px;
-		}
-		.qel0 {
-			dispaly:none;
-			position:absolute;
-			z-index:100000;
-			border:4px solid #f5cc50;
-			border-top-left-radius: 4px;
-			border-top-right-radius: 4px;
-			border-bottom-right-radius: 4px;
-			border-bottom-left-radius: 4px;
-		}
-	</style>
-	<script>
-	function chatHello() {
-		<? if( $u->info['level'] <= 10) { ?>
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ��������� ������(<a href='https://new-combats.com/n/87/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; �������� ������(<a href='https://new-combats.com/n/262/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ��������� �����(<a href='https://new-combats.com/n/248/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ����� ������ ������ (<a href='https://new-combats.com/stats_bonus.php' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ��������� ������� � ������� �� �� ��������(<a href='https://new-combats.com/n/136/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ����� ����� �������� (<a href='https://new-combats.com/n/276/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ���� ������/�������� ����/���� (<a href='https://new-combats.com/n/606/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ����������� �������� (<a href='https://new-combats.com/n/567/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ���������� ������� � ������� �� �� ���������� (<a href='https://new-combats.com/n/389/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ���������� ���������� (<a href='https://new-combats.com/n/749/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ������ ��������� ����� (<a href='https://new-combats.com/n/792/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ����� ���������� - ����� ���������� (<a href='https://new-combats.com/n/986/' target='_blank'>������</a>). &nbsp;</b>","red","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ����� ������� - ������ (<a href='https://new-combats.com/n/1032/' target='_blank'>������</a>). &nbsp;</b>","red","1","1","0"]);
-		<? }?>
-	}
-    </script>
-</head>
-
-<body onLoad="bodyLoaded();chatHello();">
-<div style="display:none" class="qel0" id="qel0"></div>
-<noscript>� ����� �������� ����������� ��������� <strong>javascript<strong></noscript>
-<style>
-/* ����� ������ */
-.CSSteam0	{ font-weight: bold; cursor:pointer; }
-.CSSteam1	{ font-weight: bold; color: #6666CC; cursor:pointer; }
-.CSSteam2	{ font-weight: bold; color: #B06A00; cursor:pointer; }
-.CSSteam3 	{ font-weight: bold; color: #269088; cursor:pointer; }
-.CSSteam4 	{ font-weight: bold; color: #A0AF20; cursor:pointer; }
-.CSSteam5 	{ font-weight: bold; color: #0F79D3; cursor:pointer; }
-.CSSteam6 	{ font-weight: bold; color: #D85E23; cursor:pointer; }
-.CSSteam7 	{ font-weight: bold; color: #5C832F; cursor:pointer; }
-.CSSteam8 	{ font-weight: bold; color: #842B61; cursor:pointer; }
-.CSSteam9 	{ font-weight: bold; color: navy; cursor:pointer; }
-.CSSvs 		{ font-weight: bold; }
-.buttons:hover { background-color:#EFEFEF; }
-.buttons:active { color:#777777; }
-.buttons { background-color:#E9E9E9; }
-.menutop2{color:#003366;} .menutop2:hover{
-	color:#446B93;
-}
-.klan { font-weight:bold; color: green; background-color: #99FFCC;}
-.redColor {
-	color: #FF0000;
-	font-weight: bold;
-}
-.borderWhite {
-	border: 1px solid #f2f0f0;
-}
-.date21	{
-	font-family: Courier;
-	font-size: 8pt;
-	text-decoration:underline;
-	font-weight:normal;
-	color: #007000;
-	background-color: #00FFAA
-}
-
-
-.zoneCh_no {
-	float:left;
-	overflow:hidden;
-	height: 18px;
-	width: 18px;
-}
-
-.inpBtl {
-	color: #000000;
-	text-decoration: none;
-	background-color: #ECE9D8;
-	border: 1px solid #000000;    
-}
-
-.zoneCh_yes {
-	float:left;
-	overflow:hidden;
-	height: 18px;
-	width: 18px;
-	background-color: #A9AFB1;
-}
-	
-body {
-	background-color: #e8e8e8;
-}
-.st1222 {
-	font-size: 18px;
-	color: #990000;
-	font-weight: bold;
-}
-.crop {
-	float:left;
-	overflow:hidden;
-	height: 18px;
-	width: 18px;
-}
-
-.radio_off {
-    margin-left:0px;
-}
-
-.radio_on {
-    margin-left:-18px;
-}
-
-.battle_hod_style {
-    border-bottom-width: 1px;
-    border-bottom-style: solid;
-    border-bottom-color: #AEAEAE;
-}
-.zbtn1l{	width:9px;	height:18px;	background: url(https://new-combats.com/tab.png) 0px 0px repeat-x;}
-.zbtn1r {	width:9px;	height:18px;	background: url(https://new-combats.com/tab.png) -18px 0px repeat-x;}
-.zbtn1r2 {	width:9px;	height:18px;	background: url(https://new-combats.com/tab.png) 18px 0px repeat-x;}
-.zbtn2l{	width:9px;	height:18px;	background: url(https://new-combats.com/tab.png) -36px 0px repeat-x;}
-.zbtn2r {	width:9px;	height:18px;	background: url(https://new-combats.com/tab.png) -54px 0px repeat-x;}
-.zbtn2r2 {	width:9px;	height:18px;	background: url(https://new-combats.com/tab.png) -90px 0px repeat-x;}
-.zbtn2r3 {	width:9px;	height:18px;	background: url(https://new-combats.com/tab.png) 54px 0px repeat-x;}
-.zbtn1c{	background-color: #808080;	border-top-width: 1px;	border-bottom-width: 1px;	border-top-style: solid;	border-bottom-style: solid;	border-top-color: #000000;	border-bottom-color: #000000;	color: #FFFFFF;	cursor:default;	padding-left:5px;	padding-right:5px;	FONT-FAMILY: Verdana, Arial, Helvetica, Tahoma, sans-serif;}
-.zbtn2c{
-	background-color: #D5D2C9;
-	border-bottom-width: 1px;
-	border-bottom-style: solid;
-	border-bottom-color: #000000;
-	color: #000000;
-	cursor:default;
-	padding-left:5px;
-	padding-right:5px;
-	FONT-FAMILY: Verdana, Arial, Helvetica, Tahoma, sans-serif;
-	font-weight: bold;
-}
-</style>
-<?
-/*$yes = $u->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 '<table width="100%" height="100%" style="position:absolute;z-index:100000;background-color:#d6d6d6;color:#333333" border="0" cellspacing="0" cellpadding="0"><tr><td align="center" valign="middle"><table width="700" border="0" cellspacing="0" cellpadding="0"><tr><td>
-<div align="left">
-<b>�������� �� �������� ��� ��� �� �����?<br>���������� ������� ���� ������ ������ ������������ ������� � ���������� ���:</b><br><br>
-&nbsp; ������ ����, ����� ��� ���� ����! �� �������� ������ � ���������� ����? ��, ����� ������, �� ������� ���� � ������� �������
-���� �������� "������ ���� ��" � �.�., � �� �����, ��������, ��� ����� �� ��� ����. ������ ����� ��������
-������� ��������� ����������, ������� ���������� �������� ��������. ������� � ���������� ����� ����
-����� ����� ��������, ���� ������������! ��� ������ �� �����! ���������� ��������, ���������, �����,
-�� � � ����-�� ������������ ������ ������ �� ������ �������� �� ���� �������. �������� ��� ��� ����������
-��� ������ � �� ������ ������ ����� �� ���������� ��� �������!<br>
-&nbsp; ���������� � ���� ������� �� ������������ �� ����� ����� ������ � ��������� � ��������� � ���� ����� �������
-�� �������� � ���������� �����������! ��� ���� ��������� ������������ �����, � �� ����� ��� ������ �������� ��������������� ��������.
-<br><br><center><a href="club.php?yes='.$code.'">� ��������� �������� � ���������� ���� �������</a></center><br><br>���� �� �����-���� �������� �� �� ��������, �� ���������� �������� ��� ���� � ����� �� ����������! �������! ;-)
-</div></td></tr></table></td></tr></table>';*/
-//}
-?>
-<script>
-if(window.top !== window.self)
-{
-	document.write = "";
-	window.top.location = window.self.location;
-	setTimeout(function(){ document.body.innerHTML='������ �������.'; },500);
-	window.self.onload=function(evt){
-	document.body.innerHTML='������ �������.';};
-}
-function cc(el) {
-	$(window).resize(function(){
-		$(el).css({
-				position:'absolute',
-				left: ($(document).width() - $(el).outerWidth())/2,
-				top: ($(document).height() - $(el).outerHeight())/2
-		});
-	});		
-	$(window).resize();
-}
-</script>
-<? 
-	if($u->info['bithday'] == '01.01.1800') {
-?>
-<script>
-function startRegistration() {
-	//if( goodread >= 9 ) {
-		$.post( 'reg.php' , {
-			'ajax_reg':true,
-			'reg_login':$('#reg_login').val(),
-			'reg_mail':$('#reg_mail').val(),
-			'reg_dd':$('#reg_dd').val(),
-			'reg_mm':$('#reg_mm').val(),
-			'reg_yy':$('#reg_yy').val(),
-			'reg_sex':$('#reg_sex').val(),
-			'reg_pass':$('#reg_pass').val(),
-			'reg_pass2':$('#reg_pass2').val(),
-			'mail_post':$('#mail_post').attr('checked')
-		} , function(data) { 
-			$('#errorreg').html( data );
-		});
-	/*}else{
-		alert('������������ � "������� ������ �������" ������! \n ��� ���������� ����� ������� ���! \n �� ��������� '+goodread+' �� 9 �������!');
-	}*/
-}
-</script>
-<style>
-.proza {
-	filter:progid:DXImageTransform.Microsoft.Alpha(opacity=87); /* IE 5.5+*/
-	-moz-opacity: 0.87; /* Mozilla 1.6 � ���� */
-	-khtml-opacity: 0.87; /* Konqueror 3.1, Safari 1.1 */
-	opacity: 0.87; /* CSS3 - Mozilla 1.7b +, Firefox 0.9 +, Safari 1.2+, Opera 9+ */
-}
-.nobtn12 {
-	border:0;
-	bottom:80px;
-	left:225px;
-	position:absolute;
-}
-.nobtn12:active {
-	bottom:79px;
-}
-.inpreg1 {
-	padding:2px;
-	font-size:14px;
-	color:#003144;
-	background-color:#f6f4ec;
-	border:1px solid #d1cdb8;
-	width:178px;
-}
-.inpreg2 {
-	font-size:12px;
-	color:#003144;
-	background-color:#f6f4ec;
-	border:1px solid #d1cdb8;
-}
-#errorreg {
-	position:absolute;
-	width:680px;
-	top:0;
-	left:0;
-	text-align:center;
-	color:red;
-	font-weight:bold;
-}
-</style>
-<script>
-	cc('#regblock');
-</script>
-<?
-	}elseif($u->info['active']!='' && $u->info['mail']=='No E-mail') {
-		if($error!='') {
-			echo '<script>alert("'.$error.'");</script>';
-		}	
-?>
-<!-- ACTIVE -->
-<?
-}
-?>
-<script>
-var lasts = [-1,-1];
-function myexpLineTop27(e1,e2) {
-		$('#exp23mkrtkm').attr('title',"���� ���������"+"\n"+e1+" / "+e2);
-		$('#exp23mkrtkm').html(Math.ceil(e1/e2*100)+'%!');		
-		if( Math.ceil(e1/e2*100) < 1 ) {
-			$('#myexplin233').attr('width','1%');
-		}else{
-			if( lasts[1] < e2 ) {
-				$('#myexplin233').css('width','1%');
-			}
-			if( lasts[0] != e1 || lasts[1] != e2 ) {
-				$('#myexplin233').animate({'width':Math.ceil(e1/e2*100)+'%'},3000);
-			}
-		}
-		lasts[0] = e1;
-		lasts[1] = e2;
-}
-var smlk1 = 0;
-function smiles1load() {
-	if( smlk1 == 0 ) {
-		$('#btnsmlrz').html('<small>&nbsp; ����� �������� &nbsp;</small>');
-		smlk1 = 1;
-		$('#smilesDiv').hide();
-		$('#smilesDiv2').show();
-		$('#smilesDiv3').hide();
-	}else{
-		$('#btnsmlrz').html('<small>&nbsp; ������ �������� &nbsp;</small>');
-		smlk1 = 0;
-		$('#smilesDiv').show();
-		$('#smilesDiv2').hide();
-		$('#smilesDiv3').hide();
-	}
-}
-</script>
-<style>
-#qsst {
-	position:absolute;
-	z-index:10000000;
-	cursor:default;
-	display:none;
-}
-#onbon {
-	position:absolute;
-	z-index:100;
-	cursor:default;
-	display:none;
-	bottom:30px;
-	left:18px;
-}
-#mini_qsst {
-	position:absolute;
-	z-index:100;
-	cursor:default;
-	display:none;
-	bottom:10px;
-	right:18px;
-}
-</style>
-<div id="qsst"></div>
-<div id="ttl" class="ttl_css" style="display:none;z-index:1111;" /></div>
-<div id="nfml" style="display:none;position:absolute;" /></div>
-<div id="persmenu" style="display:none;z-index:1110;" /></div>
-<div id="windows" style="position:absolute;z-index:1101;"></div>
-<div id="wupbox" onmouseup="win.WstopDrag()" onmousemove="win.WmoveDrag(event)" onselectstart="return false"></div>
-<div id="chconfig">
-<center><b>��������� ����</b></center>
-<img title="��������� ����� (o_O)" src="https://<?=$c['img'];?>/1x1.gif" class="eLine"><br>
-�������� ����������: <SELECT id="chcf0"><OPTION value='-1'>�������</OPTION><OPTION value='1'>15 ���.</OPTION><OPTION selected value='2'>30 ���.</OPTION><OPTION value='3'>1 ���.</OPTION><OPTION value='4'>5 ���.</OPTION></SELECT><br>
-<div>���������� ������ ������: <SELECT id="chcf8"><OPTION value='0' selected>�� ������</OPTION><OPTION value='1'>�� ������</OPTION><OPTION value='2'>�� ���������</OPTION><OPTION value='3'>�� �����</OPTION></SELECT>
-<input name="chcf9" type="checkbox" id="chcf9" value="1"><small>�� ��������</small></div>
-<div><input name="chcf12" type="checkbox" id="chcf12" value="1"> �������� �������</div>
-<div style="display:<? if($u->info['admin']>0 || ($u->info['align']>1 && $u->info['align']<2) || ($u->info['align']>3 && $u->info['align']<4)) { echo ''; }else{ echo 'none;'; } ?>"><input name="chcf7" type="checkbox" id="chcf7" value="1"> <span title="�������� ��������� �� ���������� �� ������� �������� �������� ��������">��������� � ���������</span></div>
-<img title="��������� ����� (o_O)" src="https://<?=$c['img'];?>/1x1.gif" class="eLine">
-<div>&nbsp; &nbsp;&nbsp; <span><a href="javascript:void(0)" onclick="chat.ignorListOpen();chconf();">������ ������������</a></span></div>
-</div>
-<!-- <div id="counters"></div> -->
-<!-- ������� -->
-<div id="actionDiv" style="position:absolute;"></div>
-<!--<div id="reline3" onselectstart="return false">
-	<img src="https://img.new-combats.com/1x1.gif" width="9" height="4" style="float:left; display:block; position:absolute; background-image:url(https://img.new-combats.com/i/lite/_top_24.gif);">
-	<img src="https://img.new-combats.com/1x1.gif" width="10" height="4" style="float:right; display:block; background-image:url(https://img.new-combats.com/i/lite/_top_28.gif);">
-</div>-->
-<div id="reline1" onselectstart="return false">
-    
-  <img src="https://img.new-combats.com/1x1.gif" width="9" height="4" style="float:left; display:block; position:absolute; background-image:url(https://img.new-combats.com/i/lite/_top_24.gif);">
-  <img src="https://img.new-combats.com/1x1.gif" width="10" height="4" style="float:right; display:block; background-image:url(https://img.new-combats.com/i/lite/_top_28.gif);">
-</div>
-<div id="reline2" onselectstart="return false"></div>
-<!-- ������� -->
-<div id="upbox" onselectstart="return false"></div>
-    <div style="position:absolute; top:0; left:0; height:37px; width:100%;" onselectstart="return false">
-    <div title="����� �����" style="display:none; position:absolute; left: 198px; top: 13px; width:24px; height:15px; background-image:url(https://img.new-combats.com/i/mail2.gif);" class="postdiv" id="postdiv"></div>
-    <div style="background: url(https://img.new-combats.com/i/lite/capitalcity/top_lite_cap_11.gif) repeat-x bottom; ">
-     <table width="100%" border="0" cellspacing="0" cellpadding="0" style="background: url(https://img.new-combats.com/i/lite/top_lite_cap_03.gif) repeat-x top; ">
-        <tr>
-          <td align="left"><img src="https://img.new-combats.com/i/lite/capitalcity/top_lite_cap_01.gif" width="64" height="14" class="db" style="padding-left:15px;" /></td>
-          <td align="right" class="main_text" style="position: relative; width:225px"><table cellspacing="0" cellpadding="0" border="0" width="565">
-            <tr valign="bottom" align="center">
-              <td width="31" height="14"><img class="db" height="14" src="https://img.new-combats.com/i/lite/mennu112_06_lite.gif" width="31" /></td>
-              <td align="center"><table height="14" cellspacing="0" cellpadding="0" width="100%" background="https://img.new-combats.com/i/lite/mennu112_06.gif" border="0">
-                <tr align="middle">
-                  <td id="el1" class="main_text" onClick="this.style.backgroundColor='#404040'; this.style.color='#FFFFFF'; showtable('1');" align="center">������</td>
-                  <td width="1"><img class="db" height="11" src="https://img.new-combats.com/i/lite/mennu112_09.gif" width="1" /></td>
-                  <td id="el2" class="main_text" onClick="this.style.backgroundColor='#404040'; this.style.color='#FFFFFF'; showtable('2');" style="background:#404040; color:#FFFFFF;" align="center">��������</td>
-                  <td width="1"><img class="db" height="11" src="https://img.new-combats.com/i/lite/mennu112_09.gif" width="1" /></td>
-                  <td id="el3" class="main_text" onClick="if(confirm('����� �� ����?')){ top.location = '/bk?exit&rnd=<?=$code?>'; }"  align="center">�����</td>
-                </tr>
-              </table></td>
-              <td width="38"><img class="db" height="14" src="https://img.new-combats.com/i/lite/mennu112_04_lite.gif" width="37" /></td>
-            </tr>
-          </table>
-          </td>
-        </tr>
-        <tr>
-          <td align="left"><img style="display:block; float:left; margin-left:17px;" src="https://img.new-combats.com/i/lite/top_lite_cap_07.gif" width="15" height="17" /><img src="https://img.new-combats.com/i/lite/capitalcity/top_lite_cap_08.gif" width="152" height="17" class="db" /></td>
-          <td align="right">
-          <table cellspacing="0" cellpadding="0" width="565" style="background-image:url(https://img.new-combats.com/i/lite/top_lite_cap_15.gif);" border="0">
-            <tr>
-              <td align="right" class="menutop"><table width="100%" border="0" cellpadding="0" cellspacing="0">
-                  <tr>
-                    <td width="20"><img class="db" src="https://img.new-combats.com/i/lite/top_lite_13.gif" width="20" height="17" /></td>
-                    <td align="center" valign="top" background="https://img.new-combats.com/i/lite/top_lite_low_15.gif" style="font-size:10px;">
-                        <span style="display:none; text-align:center;" id="menu1"> <a href="/main.php?referals" target="main" class="menutop" style="color:green">�������</a> | <a href="https://new-combats.com/forum/" target="_blank" class="menutop">�����</a> | <a href="https://new-combats.com/encicl/law.html" target="_blank" class="menutop"><font color=red>������</font></a> | <a href="https://new-combats.com/rating_pers" target="_blank" class="menutop">�������</a> | <a href="https://new-combats.com/rating_clans" target="_blank" class="menutop">�����</a> | <a href="main.php?security" target="main" class="menutop" style="color:green">������������</a> | <a href="https://new-combats.com/news_script/lib/pisheri.html" target="_blank" class="menutop"><font color=darkgreen>�� � �������</font></a> </span>
-                        <span style="display:; text-align:center;" id="menu2"><a href="/main.php?inv=1&rn=<?=$c[9]?>" target="main" class="menutop">���������</a> |<span style="display:; text-align:center;" id="menu2"><a href="main.php?titul" target="main" class="menutop" style="color:green"> ����������</a> | <a href="/main.php?skills=1&side=5" target="main" class="menutop">������</a> | <a href="/main.php?zayvka=1" target="main" class="menutop">��������</a> | <a href="/forum/?read=10957&rnd=1" target="_blank" class="menutop" style="color:red">���� �������</a> | <a href="/n" target="_blank" class="menutop" style="color:blue">�������</a> | <a href="settings" target="_blank" class="menutop">������</a></span>
-                    </td>
-                    <td width="22"><img class="db" src="https://img.new-combats.com/i/lite/top_lite_18.gif" width="22" height="17" /></td>
-                  </tr>             
-                </table></td>
-            </tr>
-          </table></td>
-        </tr>
-      </table>
-    </div>
-    <table width="100%" border="0" cellspacing="0" cellpadding="0">
-      <tr>
-        <td width="15" height="6"><img class="db" src="https://img.new-combats.com/i/lite/_lit_20.gif" width="15" height="6" /></td>
-        <td background="https://img.new-combats.com/i/lite/_top_20s.gif"></td>
-        <td width="24" height="6"><img class="db" src="https://img.new-combats.com/i/lite/_lit_27.gif" width="24" height="6" /></td>
-      </tr>
-    </table>
-    <!-- -->
-</div>
-<table id="globalMain" width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
-  <tr>
-    <td height="31" width="9" bgcolor="#D6D6D6"></td>
-    <td height="31" bgcolor="#D6D6D6">&nbsp;</td>
-    <td height="31" width="12" bgcolor="#D6D6D6"></td>
-  </tr>
-  <tr>
-    <td bgcolor="#D6D6D6" background="https://img.new-combats.com/i/lite/_top_24.gif"></td>
-    <td valign="top" bgcolor="#e2e0e0" id="main_td">
-    <div id="touchmain" style="margin-top:3px;">
-    	<iframe id="main" name="main" src="main.php" frameborder="0" style="display:block;padding-top:0px;padding:0;margin:0;width:100%;border:0;" scrolling="auto"></iframe>
-    </div>
-    </td>
-    <td bgcolor="#D6D6D6" background="https://img.new-combats.com/i/lite/_top_28.gif"></td>
-  </tr>
-  <tr>
-    <td bgcolor="#D6D6D6" background="https://img.new-combats.com/i/lite/_top_24.gif"></td>
-    <td id="chat" valign="top" height="40%" bgcolor="#eeeeee">
-    <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" style="border-top:1px solid #CCCCCC">
-      <tr>
-        <td valign="top" id="chat_block" style="position:relative;border-top:1px solid #808080"><!-- display:block;-->
-            <div id="mini_qsst" onClick="top.qn_slk()" style="cursor:pointer"></div>
-            <div id="onbon"></div>
-            <div id="chat_menus" unselectable="on" onselectstart="return false;" style="display:block;position:absolute; right:0px; top:3px; padding-right:20px; height:18px; text-align:right; white-space:nowrap;">
-              	<!-- -->
-                <table border="0" style="margin-top:-3px;" align="right" cellpadding="0" cellspacing="0">
-                    <tr>
-                      <td>
-                        <div id="chat_menu" style="text-align:right; white-space:nowrap;">
-                            <? /*<div id="addbs" style="float:left;display:;"><a href="javascript:top.add_cb(0,'new',0,0);"><img src="addmn.gif" width="16" height="16" title="�������� ����� �������" /></a></div>*/ ?>
-                        </div>
-                      </td>
-                      <td style="display:none;" id="scroll_none" width="3"></td>
-                    </tr>
-                </table>
-                <!-- -->
-              </div>
-
-        <div id="ttSmiles" onselectstart="return false" style="display:none;z-index:1100;" />
-        	<div id="smilesDiv">�������� ���������</div>
-            <div id="smilesDiv2" style="display:none">
-            <?
-            echo '<center><small>����� �������� �������� ������ � <a href="/ekr.php" target="_blank">������������ ������</a><br>�������� ��������, ���� ��������� ������� �� �����������</small></center><hr>';
-			//
-			if( $u->info['add_smiles'] == '' ) { ?>
-            <center><br><br><br><br><br><br><br><font color="grey">� ��� ��� ������ ���������</font></center>
-            <? }else{
-								
-				$ex = explode(',',$u->info['add_smiles']);
-				$i = 0;
-				while( $i < count($ex) ) {
-					echo '<img src="https://img.new-combats.com/i/smile/'.$ex[$i].'.gif" title=":'.$ex[$i].':" style="cursor:pointer" onclick="chat.addSmile(\''.$ex[$i].'\');"> ';
-					$i++;
-				}
-				
-			} ?>
-            </div>
-            <div id="smilesDiv3" style="display:none">
-            
-            </div>
-            <div align="center" style="padding-left:5px; padding-right:5px;">
-            <button class="btn fl" style="display:none; padding:0; margin:0; margin-top:5px; margin-right:2px;" disabled="disabled"><small>&nbsp; ������ &nbsp;</small></button>
-            <button class="btn fl" style="padding:0; margin:0; margin-top:5px;" id="btnsmlrz" onClick="smiles1load();"><small>&nbsp; ������ �������� &nbsp;</small></button>
-            <button class="btn fr" style="padding:0; margin:0; margin-top:5px;" onClick="chat.lookSmiles()"><small>&nbsp; ������� &nbsp;</small></button>
-            </div>
-        </div>
-        
-          <div id="chat_list" style="cursor:default;">
-                <div id="canals">
-                	<div id="canal5"></div>
-                    <div id="canal6" style="display:none;"></div>
-                </div>
-          </div>        
-        </td>
-        <td width="350" valign="top" bgcolor="#faf2f2" style="border-left:2px solid #CCCCCC;border-top:1px solid #808080" id="online">
-        <div id="online_list" style="cursor:default;">
-          <div align="center" style="margin-top:5px;">
-          	<button class="btn" id="robtn" onClick="chat.reflesh()">��������</button>
-          	<button  TYPE=button class="btn" onClick="window.open('https://new-combats.com/monitoring', 'monitoring', 'location=yes,menubar=yes,status=yes,resizable=yes,toolbar=yes,scrollbars=yes,scrollbars=yes')" title="������� ������\��������"><img src="https://img.new-combats.com/i/fighttype0.gif" width="20" height="20"></button>
-          </div>
-          <font class="db" style="padding:0px 0 8px 0;font-size: 10pt; color:#8f0000;"><b id="roomName"></b></font>
-          <div id="onlist"></div>
-          <div style="padding:5px;margin-top:5px;">
-              <!-- <div><label><input type="checkbox" value="1" <? if( $u->info['level'] < 8 ) { ?>checked<? } ?> id="autoRefOnline">��������� �������.</label></div>-->
-			  <div><label><input type="checkbox" value="1" checked id="autoRefOnline">��������� �������.</label></div>
-              <? if( $u->info['admin'] > 0 ) { ?>
-              <!--<div><label><input name="chcf10" type="checkbox" id="chcf10" <? if( $u->info['level'] < 8 ) { ?>checked<? } ?> value="0">�������� ���� �������</label></div>-->
-			  <div><label><input name="chcf10" type="checkbox" id="chcf10" checked value="0">�������� ���� �������</label></div>
-          	  <? } ?>
-          </div>
-        </div>
-      </td>
-      </tr>
-    </table>
-    </td>
-    <td bgcolor="#D6D6D6" background="https://img.new-combats.com/i/lite/_top_28.gif"></td>
-  </tr>
-  <tr>
-    <td height="30" valign="bottom"><img class="db" src="https://img.new-combats.com/i/lite/bkf_l_r1_02.gif" width="9" height="30"></td>
-    <td height="30" bgcolor="#E9E9E9" background="https://img.new-combats.com/i/buttons/chat_bg.gif">
-    <table width="100%" height="26" border="0" cellspacing="0" cellpadding="0">
-      <tr>
-        <td width="30"><img <? if( $u->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="���"></td>
-        <td style="display:none;" width="100" align="center" id="trader1"><div id="trader" style="border:1px solid #CCCCCC;padding:2px; margin-left:-2px; width:90%;" class="klan"><small id="moneyGM"><b>�������� ���</b></small></div></td>
-        <td><input type="hidden" name="trader" id="trader_val" value="0"><input onmouseup="top.chat.inObj=undefined;" type="text" name="textmsg" id="textmsg" maxlength="240" onKeyPress="top.testKey(event)" style="width:100%;font-size:11pt;margin-bottom:2px; border-radius: 5px; -webkit-border-radius: 5px;	-moz-border-radius: 5px;" /></td>
-        <td width="6">&nbsp;</td>
-        <td width="30"><img onClick="chat.subSend();" src="https://img.new-combats.com/1x1.gif" class="db cp chatBtn2_1"></td>
-        <td width="5">
-        <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="1" height="1" id="Sound" align="middle">
-			<param name="allowScriptAccess" value="always" />
-			<param name="movie" value="flash/Sound2.1.swf" />
-			<param name="quality" value="high" />
-			<param name="scale" value="noscale" />
-			<param name="wmode" value="transparent" />
-			<embed src="flash/Sound2.1.swf" quality="high" scale="noscale" wmode="transparent" width="1" height="1" name="Sound" id="Sound2" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer" />
-        </object>
-        </td>
-        <?if($u->info['level']>9){ ?>
-        <td width="30"><img onclick="window.open('audio/index.php')" class="db cp" title="��������� ���������" src="https://img.new-combats.com/b___.gif"></td>
-        <? } ?>
-		<td width="30"><img onClick="chat.clear();" class="db cp" title="�������� ������ �����" src="https://img.new-combats.com/i/buttons/chatBtn3.gif"></td>
-        <td width="30"><img onClick="chat.filterMsg();" id="chbtn1" title="���������� � ���� ������ ��������� ������������ ���" src="https://img.new-combats.com/1x1.gif" class="db cp chatBtn1_1"></td>
-        <td width="30"><img onClick="chat.systemMsg();" id="chbtn4" title="���������� � ���� ��������� ���������" src="https://img.new-combats.com/1x1.gif" class="db cp chatBtn4_<? if(isset($_COOKIE['citySys']) && $_COOKIE['citySys']==1){ echo 2; }else{ echo 1; } ?>"></td>
-        <td width="30"><img id="chbtn6" onClick="chat.translitChat()" title="��������������� �������� � ������� �����" src="https://img.new-combats.com/1x1.gif" class="db cp chatBtn6_1"></td>
-        <td width="30"><img id="chbtn7" onClick="chat.soundChat()" src="https://img.new-combats.com/1x1.gif" title="�����" class="db cp chatBtn7_1"></td>
-        <td width="10">&nbsp;</td>
-        <td width="30"><img id="chbtn8" class="db cp chatBtn8_1" onClick="chat.lookSmiles()" title="��������" src="https://img.new-combats.com/1x1.gif"></td>
-        <!--<td width="30"><img id="chbtn8" class="cp" title="������ �������� �������" onClick="fastpanel()" src="https://img.new-combats.com/b___cl1.gif"></td>-->
-        <td width="16" bgcolor="#BAB7B3"><img src="https://img.new-combats.com/i/buttons/chat_explode.gif" width="16" height="30" class="db" /></td>
-        <td width="30"><img onclick="top.getUrl('main','main.php?inv=1&rnd='+c.rnd);" class="db cp" title="���������" src="https://img.new-combats.com/i/buttons/chatBtn13.gif"></td>
-		<?   if($u->info['level']>7){ ?>
-        <td width="30"><img onClick="top.getUrl('main','main.php?transfer=1&rnd='+c.rnd);" class="db cp" title="��������" src="https://img.new-combats.com/i/buttons/chatBtn16.gif"></td>
-        <? } if($u->info['level']>=0){ ?>
-		<!--�������� online
-        <td width="30"><img onClick="top.getUrl('main','main.php?alh=1&rnd='+c.rnd);" class="db cp" src="https://img.new-combats.com/i/buttons/chatBtn9.gif"></td>-->
-		<td width="30"><img onClick="top.getUrl('main','main.php?add_eff=1&rnd='+c.rnd);" class="db cp" title="������" src="https://img.new-combats.com/i/buttons/chatBtn151.gif"></td>
-        <? } if($u->info['align']==50 || $u->info['align2']==50 || $u->info['admin'] == 1) {?>
-		<td width="30"><img onClick="top.getUrl('main','main.php?alhp=1&rnd='+c.rnd);" class="db cp" src="https://img.new-combats.com/i/buttons/chatBtn20.gif"></td>
-		<?}  if($u->info['align']>=1.1 && $u->info['align']<2 ){ ?>
-        <td width="30"><img onClick="top.getUrl('main','main.php?light=1&rnd='+c.rnd);" class="db cp" title="������ ��������" src="https://img.new-combats.com/i/buttons/chatBtn15.gif"></td>
-        <? } if($u->info['align']>=3.01 && $u->info['align']<4){ ?>
-        <td width="30"><img onClick="top.getUrl('main','main.php?dark=1&rnd='+c.rnd);" class="db cp" title="������ �������" src="https://img.new-combats.com/i/buttons/chatBtn10.gif"></td>
-        <? } if($u->info['vip']>time() || $u->stats['silvers']>0 || $u->stats['bronze']>0 || $u->stats['gold']>0 ){ ?>
-		<!-- VIP -->
-       <td width="30"><img onClick="top.getUrl('main','main.php?vip=1&rnd='+c.rnd);" class="db cp"  src="https://img.new-combats.com/i/buttons/a___ang17.gif" onMouseOver="top.hi(this,'<b>������ ��������� ������ <?=$u->info['login']?></b>',event,3,0,1,0,'');" onMouseOut="top.hic();" onMouseDown="top.hic();"> </td></td>
-
-        <? } if($u->info['level']>= 0){ ?>
-        <td width="30"><img onClick="top.getUrl('main','main.php?friends=1&rnd='+c.rnd);" class="db cp" title="������" src="https://img.new-combats.com/i/buttons/chatBtn12.gif"></td>
-		<?}  if($u->info['align']>=1 && $u->info['align']<2){ ?>
-		<td width="30"><img onClick="top.getUrl('main','main.php?1_panel=1&rnd='+c.rnd);" class="db cp" title="������ �����" src="https://img.new-combats.com/i/buttons/chatBtn15.gif"></td>
-		<?}  if($u->info['align']>=3 && $u->info['align']<4){ ?>
-		<td width="30"><img onClick="top.getUrl('main','main.php?3_panel=1&rnd='+c.rnd);" class="db cp" title="������ ����" src="https://img.new-combats.com/i/buttons/chatBtn10.gif"></td>
-		<?}  if($u->info['align']==7) { ?>
-		<td width="30"><img onClick="top.getUrl('main','main.php?7_panel=1&rnd='+c.rnd);" class="db cp" title="������ ������������" src="https://img.new-combats.com/i/buttons/a___neutral.gif"></td>
-		<? } if($u->info['bukmeker']==1 || $u->info['admin']==1){ ?>
-        <td width="30"><img onClick="top.getUrl('main','main.php?bukmeker=1&rnd='+c.rnd);" class="db cp" title="������ ��������� " src="https://img.new-combats.com/i/buttons/bukmek.gif"></td>
-	   <? } if($u->info['admin'] > 0 || $u->info['align'] == 50){ ?>
-		<!--�������
-        <td width="30"><img onClick="top.getUrl('main','main.php?notepad=1&rnd='+c.rnd);" class="db cp" src="https://img.new-combats.com/b_notepad.gif"></td>-->
-		<? } if($u->info['level']>-1){ ?>
-
-        <? } if($u->info['clan']>0){ ?>
-        <td width="30"><img onClick="top.getUrl('main','main.php?clan=1&rnd='+c.rnd);" class="db cp" title="����" src="https://img.new-combats.com/i/buttons/chatBtn14.gif"></td>
-        <? } if($u->info['admin']>0){ ?>
-        <td width="30"><img onClick="top.getUrl('main','main.php?admin=1&rnd='+c.rnd);" class="db cp" src="https://img.new-combats.com/i/buttons/chatBtn19.gif"></td>
-        <? } ?>
-        <!--
-        <td width="30"><img onClick="top.getUrl('main','main.php?bagreport=1&rnd='+c.rnd);" class="db cp" src="https://img.new-combats.com/i/buttons/chatBtnBugs.gif"></td>
-        -->
-        <!--<td width="30"><img onClick="if(confirm('����� �� ����?')){ top.location = '/bk?exit&rnd=<?=$code?>'; }" class="db cp" src="https://img.new-combats.com/i/buttons/chatBtn11.gif"></td>-->
-		<td width="30"><img onclick="window.open('ekr2.php')" class="db cp" title="������� ������������" src="https://img.new-combats.com/i/buttons/a___nak.gif"></td>
-        <!-- <td width="70">
-            <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="70" height="25">
-           		<param name="movie" value="flash/clock.swf?hours=<?=date("H")?>&amp;minutes=<?=date("i")?>&amp;sec=<?=date("s")?>">
-            	<param name="quality" value="high">
-            	<embed src="flash/clock.swf?hours=<?=date("H")?>&minutes=<?=date("i")?>&sec=<?=date("s")?>" quality="high" pluginspage="https://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="70" height="25"></embed>
-            </object>
-        </td> -->
-      </tr>
-    </table>
-    </td>
-    <td height="30" align="right" bgcolor="#D6D6D6"><img class="db" src="https://img.new-combats.com/i/lite/bkf_l_r1_06.gif" width="9" height="30"></td>
-  </tr>
-  <tr>
-    <td height="5" bgcolor="#D6D6D6" style="background:url(https://img.new-combats.com/sand_mid_31.png);"></td>
-    <td height="5" bgcolor="#D6D6D6" style="background:url(https://img.new-combats.com/sand_mid_31.png);"><!-- iFrames zone --></td>
-    <td height="5" bgcolor="#D6D6D6" style="background:url(https://img.new-combats.com/sand_mid_31.png);"></td>
-  </tr>
-</table>
-<?
-if($u->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 '<script>chat.sendMsg(["new","'.time().'","6","","'.$u->info['login'].'","<small>�� ��� �������� ���� <b>'.$u->info['mail'].'</b> ���������� ������ � ����������� �� ��������� ��������. (������ ������� � ������� 15 �����, � ���-�� ��������� ������ &quot;����&quot;)</small>","Black","1","1","0"]);</script>';
-		//$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('<script>top.location = "https://'.$c[$u->info['city']].'/bk";</script>');
-		}
-	}
-	*/
-}
-?>
-<script>
-startEngine();
-chat.testTimer(false);
-//setTimeout('chat.nozpros=0;',20);
-<? if( $u->info['design'] == 1 ) { ?>
-/*
-top.add_cb(1,'���',1,'ch1','<br>');
-top.add_cb(5,'���',1,'ch5','<br>');
-top.add_cb(3,'���',1,'ch3','<br><div id="battle_logg"></div>');
-top.add_cb(4,'��������� ���������',1,'ch4','<br>');
-*/
-
-<? } ?>
-</script>
-</body>
-</html>
-<?
-unset($db);
-?>
\ 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 @@
-<?
+<?php
 include_once('_incl_data/__config.php');
-define('GAME',true);
+const GAME = true;
 include_once('_incl_data/class/__db_connect.php');
-include_once('_incl_data/class/__user.php');
-define('LOWERCASE',3);
-define('UPPERCASE',1);
 
-	$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') {
-		
-	}else{
-		$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('<html><head>
+$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(
+        '<html><head>
 		<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
 		<meta http-equiv="Content-Language" content="ru">
 		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
@@ -31,239 +36,323 @@ define('UPPERCASE',1);
 		��������� ������: <pre>��������� ���� �� ������...</pre>
 		<b><p><a href = "javascript:window.history.go(-1);">�����</b></a>
 		<HR>
-		<p align="right">(c) <a href="index.html">'.$c['title'].'</a></p>
-		'.$c['counters'].'
-		</body></html>');
-	}	
-	
-	$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 = '<span style=\'color:red;\'>-'.($r1['pos']-$r2['pos']).'</span>';
-		}elseif( $r2['pos'] > $r1['pos'] ) {
-			$vid = '<span style=\'color:green;\'>+'.($r2['pos']-$r1['pos']).'</span>';
-		}
-	}
-	
-	$clan_info = mysql_fetch_array(mysql_query('SELECT * FROM `clan_info` WHERE `id` = "'.$clan['id'].'" LIMIT 1'));
-	if( $clan_info['info'] == '' ) {
-		$clan_info['info'] = '<i>���������� � ����� �����������.</i>';
-	}
-	
-	$vid1 = '';
-	if( isset($r2['pos']) ) {
-		if( round($r2['global']/(15678+$r2['level']),3) < round($r1['global']/(15678+$r1['level']),3) ) {
-			$vid1 = '&nbsp;<sup><span style=\'color:green;\'>+'.(round($r1['global']/(15678+$r1['level']),3) - round($r2['global']/(15678+$r2['level']),3)).'</span></sup>';
-		}elseif( round($r2['global']/(15678+$r2['level']),3) > round($r1['global']/(15678+$r1['level']),3) ) {
-			$vid1 = '&nbsp;<sup><span style=\'color:red;\'>-'.(round($r2['global']/(15678+$r2['level']),3) - round($r1['global']/(15678+$r1['level']),3)).'</span></sup>';
-		}
-	}
-	
-	$vid2 = '';
-	if( isset($r2['pos']) ) {
-		if( $r2['exp_real'] < $r1['exp_real'] ) {
-			$vid2 = '&nbsp;<sup><span style=\'color:green;\'>+'.($r1['exp_real']-$r2['exp_real']).'</span></sup>';
-		}elseif( $r2['exp_real'] > $r1['exp_real'] ) {
-			$vid2 = '&nbsp;<sup><span style=\'color:red;\'>-'.($r2['exp_real']-$r1['exp_real']).'</span></sup>';
-		}
-	}
-	
-	$vid3 = '';
-	if( isset($r2['pos']) ) {
-		if( $r2['win'] < $r1['win'] ) {
-			$vid3 = '&nbsp;<sup><span style=\'color:green;\'>+'.($r1['win']-$r2['win']).'</span></sup>';
-		}elseif( $r2['win'] > $r1['win'] ) {
-			$vid3 = '&nbsp;<sup><span style=\'color:red;\'>-'.($r2['win']-$r1['win']).'</span></sup>';
-		}
-	}
-	
-	$vid4 = '';
-	if( isset($r2['pos']) ) {
-		if( $r2['lose'] < $r1['lose'] ) {
-			$vid4 = '&nbsp;<sup><span style=\'color:red;\'>+'.($r1['lose']-$r2['lose']).'</span></sup>';
-		}elseif( $r2['lose'] > $r1['lose'] ) {
-			$vid4 = '&nbsp;<sup><span style=\'color:green;\'>-'.($r2['lose']-$r1['lose']).'</span></sup>';
-		}
-	}
-	
-	$vid5 = '';
-	if( isset($r2['pos']) ) {
-		if( $r2['nich'] < $r1['nich'] ) {
-			$vid5 = '&nbsp;<sup><span style=\'color:red;\'>+'.($r1['nich']-$r2['nich']).'</span></sup>';
-		}elseif( $r2['nich'] > $r1['nich'] ) {
-			$vid5 = '&nbsp;<sup><span style=\'color:green;\'>-'.($r2['nich']-$r1['nich']).'</span></sup>';
-		}
-	}
+		<p align="right">(c) <a href="index.html">' . $c['title'] . '</a></p>
+		' . $c['counters'] . '
+		</body></html>'
+    );
+}
+
+$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 = '<span style=\'color:red;\'>-' . ($r1['pos'] - $r2['pos']) . '</span>';
+    } elseif ($r2['pos'] > $r1['pos']) {
+        $vid = '<span style=\'color:green;\'>+' . ($r2['pos'] - $r1['pos']) . '</span>';
+    }
+}
+
+$clan_info = mysql_fetch_array(mysql_query('SELECT * FROM `clan_info` WHERE `id` = "' . $clan['id'] . '" LIMIT 1'));
+if ($clan_info['info'] == '') {
+    $clan_info['info'] = '<i>���������� � ����� �����������.</i>';
+}
+
+$vid1 = '';
+if (isset($r2['pos'])) {
+    if (round($r2['global'] / (15678 + $r2['level']), 3) < round($r1['global'] / (15678 + $r1['level']), 3)) {
+        $vid1 = '&nbsp;<sup><span style=\'color:green;\'>+' . (round($r1['global'] / (15678 + $r1['level']), 3) - round(
+                    $r2['global'] / (15678 + $r2['level']), 3
+                )) . '</span></sup>';
+    } elseif (round($r2['global'] / (15678 + $r2['level']), 3) > round($r1['global'] / (15678 + $r1['level']), 3)) {
+        $vid1 = '&nbsp;<sup><span style=\'color:red;\'>-' . (round($r2['global'] / (15678 + $r2['level']), 3) - round(
+                    $r1['global'] / (15678 + $r1['level']), 3
+                )) . '</span></sup>';
+    }
+}
+
+$vid2 = '';
+if (isset($r2['pos'])) {
+    if ($r2['exp_real'] < $r1['exp_real']) {
+        $vid2 = '&nbsp;<sup><span style=\'color:green;\'>+' . ($r1['exp_real'] - $r2['exp_real']) . '</span></sup>';
+    } elseif ($r2['exp_real'] > $r1['exp_real']) {
+        $vid2 = '&nbsp;<sup><span style=\'color:red;\'>-' . ($r2['exp_real'] - $r1['exp_real']) . '</span></sup>';
+    }
+}
+
+$vid3 = '';
+if (isset($r2['pos'])) {
+    if ($r2['win'] < $r1['win']) {
+        $vid3 = '&nbsp;<sup><span style=\'color:green;\'>+' . ($r1['win'] - $r2['win']) . '</span></sup>';
+    } elseif ($r2['win'] > $r1['win']) {
+        $vid3 = '&nbsp;<sup><span style=\'color:red;\'>-' . ($r2['win'] - $r1['win']) . '</span></sup>';
+    }
+}
+
+$vid4 = '';
+if (isset($r2['pos'])) {
+    if ($r2['lose'] < $r1['lose']) {
+        $vid4 = '&nbsp;<sup><span style=\'color:red;\'>+' . ($r1['lose'] - $r2['lose']) . '</span></sup>';
+    } elseif ($r2['lose'] > $r1['lose']) {
+        $vid4 = '&nbsp;<sup><span style=\'color:green;\'>-' . ($r2['lose'] - $r1['lose']) . '</span></sup>';
+    }
+}
+
+$vid5 = '';
+if (isset($r2['pos'])) {
+    if ($r2['nich'] < $r1['nich']) {
+        $vid5 = '&nbsp;<sup><span style=\'color:red;\'>+' . ($r1['nich'] - $r2['nich']) . '</span></sup>';
+    } elseif ($r2['nich'] > $r1['nich']) {
+        $vid5 = '&nbsp;<sup><span style=\'color:green;\'>-' . ($r2['nich'] - $r1['nich']) . '</span></sup>';
+    }
+}
+
+$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 .= '<img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $clw['name'] . '.gif"><b>' . $clw['name'] . ' </b>';
+    } else {
+        $clw = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $clanwa['clan1'] . '" LIMIT 1'));
+        $clwe .= '<img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $clw['name'] . '.gif"><b>' . $clw['name'] . ' </b>';
+
+    }
+}
+
 
-		$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 .= '<img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$clw['name'].'.gif"><b>'.$clw['name'].' </b>';
-				}
-				else
-				{
-					$clw = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$clanwa['clan1'].'" LIMIT 1'));
-					$clwe .= '<img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$clw['name'].'.gif"><b>'.$clw['name'].' </b>';
-					
-				}
-			}
-		
-		
-		
-	
 ?>
 <HTML>
 <HEAD>
-<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
-<title>���������� � ����� <?=$clan['name']?></title>
-<meta content="text/html; charset=windows-1251" http-equiv=Content-type>
-<link href="https://img.new-combats.com/i/move/design3.css" rel="stylesheet" type="text/css">
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
-<link href="/res/css/style.css" rel="stylesheet" type="text/css" media="all" />
-<script type="text/javascript" src="js/jquery.js"></script>
-<META Http-Equiv=Cache-Control Content="no-cache, max-age=0, must-revalidate, no-store">
-<meta http-equiv=PRAGMA content=NO-CACHE>
-<META Http-Equiv=Expires Content=0>
+    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
+    <title>���������� � ����� <?= $clan['name'] ?></title>
+    <meta content="text/html; charset=windows-1251" http-equiv=Content-type>
+    <link href="https://img.new-combats.com/i/move/design3.css" rel="stylesheet" type="text/css">
+    <link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
+    <link href="/res/css/style.css" rel="stylesheet" type="text/css" media="all"/>
+    <script type="text/javascript" src="js/jquery.js"></script>
+    <META Http-Equiv=Cache-Control Content="no-cache, max-age=0, must-revalidate, no-store">
+    <meta http-equiv=PRAGMA content=NO-CACHE>
+    <META Http-Equiv=Expires Content=0>
 </HEAD>
 <body style="margin:10px; margin-top:5px; background-repeat:no-repeat; background-position: top right" bgcolor=e2e0e0>
 <div id="main" style="margin: 5px 5px 0 5px;">
-<table width=100%><tr>
-  <td style="background: #C7C7C7; border: 1px solid #A6A5A3; padding: 4px 20px 4px 20px;">
-    <h3 style="width: 250px; float: left;"><?=$clan['name']?></h3>
-    <h3 style="width: 250px; float: right;"><a href="/rating_clans#<?=$clan['id']?>" target="_blank">�������: <?=(0+$r1['pos'])?></a> <sup><?=$vid?></sup></h3>
-    <h3>�������: <?=round($r1['global']/(15678+$r1['level']),3).$vid1?></sup></h3>
-  </td>
-</tr></table>
-<table width="100%" border="0" cellspacing="0" cellpadding="0">
-  <tr>
-    <td align="left" valign="top">
-    <div style="padding-right:60px;">
-    <fieldset id="aboutclan" style="border: 1px solid white; display: block; float:left; clear: left; width:100%;min-height:20px; padding:10px; margin-top:15px;">
-    <legend style='font-weight:bold; color:#8F0000;'>���������� � ����� <?=$clan['name']?></legend>
-    <?=$clan_info['info']?>
-	</fieldset>
-	<fieldset id="aboutclan" style="border: 1px solid white; display: block; float:left; clear: left; width:100%;min-height:20px; padding:10px; margin-top:15px;">
-   <legend style='font-weight:bold; color:#8F0000;'>���� ����:</legend> <a href="<?=$clan['site'];?>" target="_blank"> <?=$clan['site'];?> </a>
-	
-	</fieldset>
-    
-    <fieldset id="statclan" style="border: 1px solid white; display: block; float:left; clear: left; width:100%;min-height:100px; padding: 10px; margin-top:15px;margin-bottom: 15px;">
-    <legend style='font-weight:bold; color:#8F0000;'>���������� �����</legend>
-    <table width="100%" cellpadding="0" cellspacing="0">
-    <tr><td width="150"><b>�������:</b></td>
-    <td><?=round($r1['global']/(15678+$r1['level']),3).$vid1?></td></tr>
-    <tr><td colspan="2">&nbsp;</td></tr>
-    <tr><td width="150"><b>����:</b></td>
-    <td><?=number_format($r1['exp_real'], 0, ",", " ").$vid2?></td></tr>
-    <tr><td width="150"><b>�������:</b></td><td><span title="������� ����� � ����� ��������"><a href="/rating_clans#<?=$clan['id']?>" target="_blank"><?=(0+$r1['pos'])?></a></span> <sup title="��������� ������� ����� �� ����"><?=$vid?></sup></td></tr>
-    <tr><td colspan="2">&nbsp;</td></tr>
-    <tr><td colspan="2"><b><font color=green>���������� ����������:</font></b></td></tr>
-    <tr><td width="150"><b>�����:</b></td>
-    <td><?=number_format($r1['win'], 0, ",", " ").$vid3?></td></tr>
-    <tr><td width="150"><b>���������:</b></td>
-    <td><?=number_format($r1['lose'], 0, ",", " ").$vid4?></td></tr>
-    <tr><td width="150"><b>������:</b></td>
-      <td><?=number_format($r1['nich'], 0, ",", " ").$vid5?></td></tr>
-    <tr><td colspan="2">&nbsp;</td></tr>
-    <tr><td colspan="2"><b><font color=#A00>���������� ����:</font></b></td></tr>
-    <tr><td width="150"><b>������� �����:</b></td>
-	  <td><span><? echo $clwe;?></span></td></tr>
-	<tr><td width="150"><b>�����:</b></td>
-      <td><span><? echo $clanw;?></span></td></tr>
-    <tr><td width="150"><b>���������:</b></td>
-    <td><span><? echo $clanl;?></span></td></tr>
-	<tr><td colspan="2">&nbsp;</td></tr>
-    <tr><td width="150"><b>��������� �������:</b></td><td><span><?echo ($clanw-$clanl)*10000;?></span></td></tr>
-    <tr><td colspan="2">&nbsp;</td></tr>
-    <tr><td width="150"><b>���� �����������:</b></td><td><span title="���� ����������� �����"><?=date('d.m.Y',$clan['time_reg'])?></span></td></tr>
+    <table width=100%>
+        <tr>
+            <td style="background: #C7C7C7; border: 1px solid #A6A5A3; padding: 4px 20px 4px 20px;">
+                <h3 style="width: 250px; float: left;"><?= $clan['name'] ?></h3>
+                <h3 style="width: 250px; float: right;"><a href="/rating_clans#<?= $clan['id'] ?>" target="_blank">�������: <?= (0 + $r1['pos']) ?></a>
+                    <sup><?= $vid ?></sup></h3>
+                <h3>�������: <?= round($r1['global'] / (15678 + $r1['level']), 3) . $vid1 ?></sup></h3>
+            </td>
+        </tr>
+    </table>
+    <table width="100%" border="0" cellspacing="0" cellpadding="0">
+        <tr>
+            <td align="left" valign="top">
+                <div style="padding-right:60px;">
+                    <fieldset id="aboutclan"
+                              style="border: 1px solid white; display: block; float:left; clear: left; width:100%;min-height:20px; padding:10px; margin-top:15px;">
+                        <legend style='font-weight:bold; color:#8F0000;'>���������� �
+                            ����� <?= $clan['name'] ?></legend>
+                        <?= $clan_info['info'] ?>
+                    </fieldset>
+                    <fieldset id="aboutclan"
+                              style="border: 1px solid white; display: block; float:left; clear: left; width:100%;min-height:20px; padding:10px; margin-top:15px;">
+                        <legend style='font-weight:bold; color:#8F0000;'>���� ����:</legend>
+                        <a href="<?= $clan['site']; ?>" target="_blank"> <?= $clan['site']; ?> </a>
+
+                    </fieldset>
+
+                    <fieldset id="statclan"
+                              style="border: 1px solid white; display: block; float:left; clear: left; width:100%;min-height:100px; padding: 10px; margin-top:15px;margin-bottom: 15px;">
+                        <legend style='font-weight:bold; color:#8F0000;'>���������� �����</legend>
+                        <table width="100%" cellpadding="0" cellspacing="0">
+                            <tr>
+                                <td width="150"><b>�������:</b></td>
+                                <td><?= round($r1['global'] / (15678 + $r1['level']), 3) . $vid1 ?></td>
+                            </tr>
+                            <tr>
+                                <td colspan="2">&nbsp;</td>
+                            </tr>
+                            <tr>
+                                <td width="150"><b>����:</b></td>
+                                <td><?= number_format($r1['exp_real'], 0, ",", " ") . $vid2 ?></td>
+                            </tr>
+                            <tr>
+                                <td width="150"><b>�������:</b></td>
+                                <td><span title="������� ����� � ����� ��������"><a
+                                                href="/rating_clans#<?= $clan['id'] ?>"
+                                                target="_blank"><?= (0 + $r1['pos']) ?></a></span> <sup
+                                            title="��������� ������� ����� �� ����"><?= $vid ?></sup></td>
+                            </tr>
+                            <tr>
+                                <td colspan="2">&nbsp;</td>
+                            </tr>
+                            <tr>
+                                <td colspan="2"><b><font color=green>���������� ����������:</font></b></td>
+                            </tr>
+                            <tr>
+                                <td width="150"><b>�����:</b></td>
+                                <td><?= number_format($r1['win'], 0, ",", " ") . $vid3 ?></td>
+                            </tr>
+                            <tr>
+                                <td width="150"><b>���������:</b></td>
+                                <td><?= number_format($r1['lose'], 0, ",", " ") . $vid4 ?></td>
+                            </tr>
+                            <tr>
+                                <td width="150"><b>������:</b></td>
+                                <td><?= number_format($r1['nich'], 0, ",", " ") . $vid5 ?></td>
+                            </tr>
+                            <tr>
+                                <td colspan="2">&nbsp;</td>
+                            </tr>
+                            <tr>
+                                <td colspan="2"><b><font color=#A00>���������� ����:</font></b></td>
+                            </tr>
+                            <tr>
+                                <td width="150"><b>������� �����:</b></td>
+                                <td><span><?php echo $clwe; ?></span></td>
+                            </tr>
+                            <tr>
+                                <td width="150"><b>�����:</b></td>
+                                <td><span><?php echo $clanw; ?></span></td>
+                            </tr>
+                            <tr>
+                                <td width="150"><b>���������:</b></td>
+                                <td><span><?php echo $clanl; ?></span></td>
+                            </tr>
+                            <tr>
+                                <td colspan="2">&nbsp;</td>
+                            </tr>
+                            <tr>
+                                <td width="150"><b>��������� �������:</b></td>
+                                <td><span><?php echo ($clanw - $clanl) * 10000; ?></span></td>
+                            </tr>
+                            <tr>
+                                <td colspan="2">&nbsp;</td>
+                            </tr>
+                            <tr>
+                                <td width="150"><b>���� �����������:</b></td>
+                                <td><span title="���� ����������� �����"><?= date('d.m.Y', $clan['time_reg']) ?></span>
+                                </td>
+                            </tr>
+                        </table>
+                    </fieldset>
+                </div>
+            </td>
+            <td width="400" align="left" valign="top">
+                <div style="width:390px;display: block;">
+                    <fieldset id="clansostav"
+                              style="width:390px; border: 1px solid white; display: block; clear:right; float: right; padding: 10px;margin-top:15px;">
+                        <legend style='font-weight:bold; color:#8F0000;'>������</legend>
+
+                        <?php
+                        $sp = mysql_query(
+                            'SELECT * FROM `users` WHERE `clan` = "' . $clan['id'] . '" AND `clan_prava` = "glava" ORDER BY `login` ASC'
+                        );
+                        $html = '';
+                        while ($pl = mysql_fetch_array($sp)) {
+                            if ($pl['online'] < time() - 520) {
+                                $html .= '<div style="color:grey">';
+                            } else {
+                                $html .= '<div>';
+                            }
+                            $html .= '<img src="https://img.new-combats.com/i/align/align' . $pl['align'] . '.gif"> ';
+                            if ($pl['align2'] > 0) {
+                                $html .= '<img src="https://img.new-combats.com/i/align/align' . $pl['align2'] . '.gif"> ';
+                            }
+                            $html .= '<img src="https://img.new-combats.com/i/clan/' . $clan['name'] . '.gif"> ';
+                            $html .= '<b>' . $pl['login'] . '</b> [' . $pl['level'] . ']';
+                            $html .= ' <a href="/info/' . $pl['id'] . '" target="_blank"><img src="https://img.new-combats.com/i/inf_capitalcity.gif"></a>';
+                            $html .= ' <small>- <font color=#008080><b>����� �����</b></font></small>';
+                            if ($pl['online'] < time() - 520) {
+                                $html .= '&nbsp; <sup><i>�� � ����</i></sup></div>';
+                            } else {
+                                $html .= '</div>';
+                            }
+                        }
+
+                        $html .= '<br>';
+
+                        $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 .= '<div>';
+                            $html .= '<img src="https://img.new-combats.com/i/align/align' . $pl['align'] . '.gif"> ';
+                            if ($pl['align2'] > 0) {
+                                $html .= '<img src="https://img.new-combats.com/i/align/align' . $pl['align2'] . '.gif"> ';
+                            }
+                            $html .= '<img src="https://img.new-combats.com/i/clan/' . $clan['name'] . '.gif"> ';
+                            $html .= '<b>' . $pl['login'] . '</b> [' . $pl['level'] . ']';
+                            $html .= ' <a href="/info/' . $pl['id'] . '" target="_blank"><img src="https://img.new-combats.com/i/inf_capitalcity.gif"></a>';
+                            $html .= ' <small>- ' . $pl['mod_zvanie'] . '</small>';
+                            $html .= '</div>';
+                        }
+                        $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 .= '<div style="color:grey">';
+                            $html .= '<img src="https://img.new-combats.com/i/align/align' . $pl['align'] . '.gif"> ';
+                            if ($pl['align2'] > 0) {
+                                $html .= '<img src="https://img.new-combats.com/i/align/align' . $pl['align2'] . '.gif"> ';
+                            }
+                            $html .= '<img src="https://img.new-combats.com/i/clan/' . $clan['name'] . '.gif"> ';
+                            $html .= '<b>' . $pl['login'] . '</b> [' . $pl['level'] . ']';
+                            $html .= ' <a href="/info/' . $pl['id'] . '" target="_blank"><img src="https://img.new-combats.com/i/inf_capitalcity.gif"></a>';
+                            $html .= ' <small>- ' . $pl['mod_zvanie'] . '</small>';
+                            $html .= '&nbsp; <sup><i>�� � ����</i></sup></div>';
+                        }
+                        echo $html;
+                        unset($html);
+                        ?>
+
+                        <br/>�����: <b><?= (0 + $xu) ?></b>
+                    </fieldset>
+                </div>
+            </td>
+        </tr>
     </table>
-    </fieldset>
-    </div>
-    </td>
-    <td width="400" align="left" valign="top">    
-    <div style="width:390px;display: block;">     
-    <fieldset id="clansostav" style="width:390px; border: 1px solid white; display: block; clear:right; float: right; padding: 10px;margin-top:15px;">
-    <legend style='font-weight:bold; color:#8F0000;'>������</legend>
-    
-    <?
-	$sp = mysql_query('SELECT * FROM `users` WHERE `clan` = "'.$clan['id'].'" AND `clan_prava` = "glava" ORDER BY `login` ASC');
-	$html = '';
-	while( $pl = mysql_fetch_array($sp) ) {
-		if( $pl['online'] < time() - 520 ) {
-			$html .= '<div style="color:grey">';
-		}else{
-			$html .= '<div>';
-		}
-		$html .= '<img src="https://img.new-combats.com/i/align/align'.$pl['align'].'.gif"> ';
-		if( $pl['align2'] > 0 ) {
-			$html .= '<img src="https://img.new-combats.com/i/align/align'.$pl['align2'].'.gif"> ';
-		}
-		$html .= '<img src="https://img.new-combats.com/i/clan/'.$clan['name'].'.gif"> ';
-		$html .= '<b>'.$pl['login'].'</b> ['.$pl['level'].']';
-		$html .= ' <a href="/info/'.$pl['id'].'" target="_blank"><img src="https://img.new-combats.com/i/inf_capitalcity.gif"></a>';
-		$html .= ' <small>- <font color=#008080><b>����� �����</b></font></small>';
-		if( $pl['online'] < time() - 520 ) {
-			$html .= '&nbsp; <sup><i>�� � ����</i></sup></div>';
-		}else{
-			$html .= '</div>';
-		}
-	}
-	
-	$html .= '<br>';
-	
-	$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 .= '<div>';
-		$html .= '<img src="https://img.new-combats.com/i/align/align'.$pl['align'].'.gif"> ';
-		if( $pl['align2'] > 0 ) {
-			$html .= '<img src="https://img.new-combats.com/i/align/align'.$pl['align2'].'.gif"> ';
-		}
-		$html .= '<img src="https://img.new-combats.com/i/clan/'.$clan['name'].'.gif"> ';
-		$html .= '<b>'.$pl['login'].'</b> ['.$pl['level'].']';
-		$html .= ' <a href="/info/'.$pl['id'].'" target="_blank"><img src="https://img.new-combats.com/i/inf_capitalcity.gif"></a>';
-		$html .= ' <small>- '.$pl['mod_zvanie'].'</small>';
-		$html .= '</div>';
-	}
-	$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 .= '<div style="color:grey">';
-		$html .= '<img src="https://img.new-combats.com/i/align/align'.$pl['align'].'.gif"> ';
-		if( $pl['align2'] > 0 ) {
-			$html .= '<img src="https://img.new-combats.com/i/align/align'.$pl['align2'].'.gif"> ';
-		}
-		$html .= '<img src="https://img.new-combats.com/i/clan/'.$clan['name'].'.gif"> ';
-		$html .= '<b>'.$pl['login'].'</b> ['.$pl['level'].']';
-		$html .= ' <a href="/info/'.$pl['id'].'" target="_blank"><img src="https://img.new-combats.com/i/inf_capitalcity.gif"></a>';
-		$html .= ' <small>- '.$pl['mod_zvanie'].'</small>';
-		$html .= '&nbsp; <sup><i>�� � ����</i></sup></div>';
-	}
-	echo $html;
-	unset($html);
-	?>
-    
-    <br />�����: <b><?=(0+$xu)?></b>
-    </fieldset>
-    </div>    
-    </td>
-  </tr>
-  </table>
 </div>
 </body>
 </HTML>
diff --git a/confirm.php b/confirm.php
index 48f5765f..091768c6 100644
--- a/confirm.php
+++ b/confirm.php
@@ -1,5 +1,5 @@
 <?
-include('_incl_data/__config.php');
+require_once('_incl_data/__config.php');
 ?>
 <HTML><HEAD>
 <link rel=stylesheet type="text/css" href="https://img.new-combats.com/css/main.css">
diff --git a/contacts.html b/contacts.html
index b8a897e5..75fe36b8 100644
--- a/contacts.html
+++ b/contacts.html
@@ -1,41 +1,43 @@
 <!DOCTYPE html>
 <html lang="ru-RU">
- <head>
-  <meta charset="windows-1251">
-  <title>����� ����������� ���� - ����������� ���������� ������ ����</title>
-  <meta name="description" content="���������� ���� ������ ��. ������ ���������� ����. ����� ���������� ����."/>
-  <meta name="keywords" content="���������� ���� ������, ���������� ����, Combats.com, ������ ���������� ����, ���� ���������� ����, ������ � �������, �������, ���������� ������ ����, Acombats, ������ ��, ������ � ������ ��, oldcombats, ������ ���, ���, likebk, Comabts, legbk, acomabts.com, ���� ����, ���� ������, ���� ����, ���� ����"/>
-  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0"/>
-  <meta http-equiv="Cache-Control" content="max-age=3600"/>
-  <meta name="msapplication-config" content="browserconfig.xml"/>
-  <link type="text/css" rel="stylesheet" href="stylen.css" />
+<head>
+    <meta charset="windows-1251">
+    <title>����� ����������� ���� - ����������� ���������� ������ ����</title>
+    <meta name="description" content="���������� ���� ������ ��. ������ ���������� ����. ����� ���������� ����."/>
+    <meta name="keywords"
+          content="���������� ���� ������, ���������� ����, Combats.com, ������ ���������� ����, ���� ���������� ����, ������ � �������, �������, ���������� ������ ����, Acombats, ������ ��, ������ � ������ ��, oldcombats, ������ ���, ���, likebk, Comabts, legbk, acomabts.com, ���� ����, ���� ������, ���� ����, ���� ����"/>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0"/>
+    <meta http-equiv="Cache-Control" content="max-age=3600"/>
+    <meta name="msapplication-config" content="browserconfig.xml"/>
+    <link type="text/css" rel="stylesheet" href="stylen.css"/>
     <!-- capcha google counter -->
- </head>
- <body>
-	<div class="page-background"><img class="img1" src="werhr.jpg" alt="������ ���������� ���� ������ � �������� ������ � ���� new-combats.com">
-	<div align="center">
-            <a href='/news' target="_blank">������� �������</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-            <a href='/repass'>�������������� ������</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-            <a href='/register'>����������� � ����</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-            <a href='/forum' target="_blank">����� �������</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-            <a href="/rating_pers" target="_blank">������� ����������</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-            <a href="/rating_clans" target="_blank">������� ������</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-         	<br>
-			<br>
-            <br>
-	</div>
-         		<h1>��������</h1>
+</head>
+<body>
+<div class="page-background">
+    <img class="img1" src="werhr.jpg" alt="������ ���������� ���� ������ � �������� ������ � ���� new-combats.com">
+    <div style="text-align: center; margin-bottom: 50px;">
+        <a href='/news' target="_blank">������� �������</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+        <a href='/repass'>�������������� ������</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+        <a href='/register'>����������� � ����</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+        <a href='/forum' target="_blank">����� �������</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+        <a href="/rating_pers" target="_blank">������� ����������</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+        <a href="/rating_clans" target="_blank">������� ������</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+    </div>
+    <h1>��������</h1>
 
-                    <p align="center">���������� ���������� <br>
-					�� ����������� �� ������: �. ������, ��. ������� ������ �.8 ���.1 <br>
-					��� �����: +79107779911 <br>
-					������ ������: ��-�� 10:00 � 18:00, ��-�� - ��������<strong></p><br><br><br>
-	<div align="center">
-			<a href="/encicl/law2.html" target="_blank">���������������� ����������</a> &nbsp;&nbsp;&nbsp;
-			<a href="/encicl/law3.html" target="_blank">�������� ������������������</a>&nbsp;&nbsp;&nbsp;
-			<a href="/encicl/law4.html" target="_blank">��������� ������� ������</a>&nbsp;&nbsp;&nbsp;
-			<a href="/support/index.php" target="_blank">���������</a> &nbsp;&nbsp;&nbsp;
-			<a href="/support/index.php" target="_blank">��������</a> &nbsp;&nbsp;&nbsp;
-	</div>
-  </body>
+    <div style="text-align: center; margin-bottom: 50px;">
+        ���������� ���������� <br>
+        �� ����������� �� ������: �. ������, ��. ������� ������ �.8 ���.1 <br>
+        ��� �����: +79107779911 <br>
+        ������ ������: ��-�� 10:00 � 18:00, ��-�� - ��������
+    </div>
+    <div style="text-align: center; font-weight: bold;">
+        <a href="/encicl/law2.html" target="_blank">���������������� ����������</a> &nbsp;&nbsp;&nbsp;
+        <a href="/encicl/law3.html" target="_blank">�������� ������������������</a>&nbsp;&nbsp;&nbsp;
+        <a href="/encicl/law4.html" target="_blank">��������� ������� ������</a>&nbsp;&nbsp;&nbsp;
+        <a href="/support/index.php" target="_blank">���������</a> &nbsp;&nbsp;&nbsp;
+        <a href="/support/index.php" target="_blank">��������</a> &nbsp;&nbsp;&nbsp;
+    </div>
+</div>
+</body>
 </html>
\ 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 @@
 <?php
-define('GAME',true);
-setlocale(LC_CTYPE ,"ru_RU.CP1251");
-include('/home/newcom1/public_html/_incl_data/__config.php');
+const GAME = true;
 include('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
-include('/home/newcom1/public_html/_incl_data/class/__user.php');
 //11. ������ � ����� ��������� ��� ���������� ���� ���� �� ������� ���
-$test=0;
-while( $test == 0 )
-	{
-		
-		$tbtl=mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `team_win`=-1 ORDER BY `id` ASC LIMIT 1'));
-		echo "���: ";
-		echo $tbtl['id']."<br>";
-		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'] . "<br>";
+    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 @@
 <?php
 
-define('GAME',true);
-setlocale(LC_CTYPE ,"ru_RU.CP1251");
-include('/home/newcom1/public_html/_incl_data/__config.php');
+const GAME = true;
 include('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
-include('/home/newcom1/public_html/_incl_data/class/__user.php');
 
 /*
 
@@ -33,13 +30,11 @@ while( $pl = mysql_fetch_array($sp) ) {
 	{
 		mysql_query('UPDATE `battle` SET `timeout` = "60" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
 	}
-	elseif ($test['count'] >= 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_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 @@
 <?php
-define('GAME',true);
-setlocale(LC_CTYPE ,"ru_RU.CP1251");
-include('/home/newcom1/public_html/_incl_data/__config.php');
+const GAME = true;
 include('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
-include('/home/newcom1/public_html/_incl_data/class/__user.php');
 
 /*
 
@@ -127,4 +124,3 @@ mysql_query('DELETE FROM `actions` WHERE `vals`= "loto"');
 
 mysql_query('DELETE FROM `uploads` WHERE `id` > 0');
 
-?>
diff --git a/cron/clear.php b/cron/clear.php
index 22096cbf..759aed38 100644
--- a/cron/clear.php
+++ b/cron/clear.php
@@ -1,9 +1,6 @@
 <?php
-define('GAME',true);
-setlocale(LC_CTYPE ,"ru_RU.CP1251");
-include('/home/newcom1/public_html/_incl_data/__config.php');
+const GAME = true;
 include('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
-include('/home/newcom1/public_html/_incl_data/class/__user.php');
 
 if( isset($_GET['actions']) ) {
 	//
diff --git a/cron/comission.php b/cron/comission.php
index da587b16..7ebadcee 100644
--- a/cron/comission.php
+++ b/cron/comission.php
@@ -3,8 +3,7 @@
  * CRON ������������� ��������
  * ���� ������� ����� ��� 2 � ����� ������, ��������� ������� �� 50% �� ��� ��������� � ������ ������.
  * ������ ���������� �� �����.
- * @var PDO $pdo
- * @var user $u
+ * @var PDO  $pdo
  * @author Insallah
  */
 const GAME = true;
@@ -14,7 +13,7 @@ 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();
 
 $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) {
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 '<div>������� �����\��������: '.$i.'/'.$x.'</div>';
-/*if( $i > 0 ) {
-	die('<script>function test(){ top.location = top.location; } setTimeout("test()",1000);</script>');
-}*/
-?>
\ No newline at end of file
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 @@
 <?php
 
-define('GAME',true);
+const GAME = true;
 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');
-
-
-
-
-
 
 $sp = mysql_query('SELECT * FROM `stats` WHERE `priemslot` > 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']."<br>"; 
-			
-			}
-	$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."<br>";
-		
+
 		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."<br>";
 	}
 }
-
-
-
-?>
\ No newline at end of file
diff --git a/cron_GAMECORE.php b/cron_GAMECORE.php
index 632e8881..efc5239f 100644
--- a/cron_GAMECORE.php
+++ b/cron_GAMECORE.php
@@ -24,8 +24,8 @@ if(getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1' && getIP() != ''
 
 define('GAME',true);
 
-include('_incl_data/__config.php');
-include('_incl_data/class/__db_connect.php');
+require_once('_incl_data/__config.php');
+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').' (����������� ������): <b>'.mysql_real_escape_string($t).'</b>","capitalcity","LEL","6","1","-1")');
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 @@
 <?php
 
-//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() != '31.131.97.206') {
-	die(getIPblock().'<br>'.$_SERVER['SERVER_ADDR']);
+if (getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && getIPblock() != '' && getIPblock(
+    ) != '31.131.97.206') {
+    die(getIPblock() . '<br>' . $_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').' (����������� ������): <b>'.mysql_real_escape_string($t).'</b>","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 = '<font color=red>��������!</font><b><font color=darkgreen><u>��� ���������� �������, ���������� ���������!</u></font></b>';
+        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 = '<font color=red><b>��������!</b></font><font color=darkgreen><b> ��� ���������� ������� � 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 = '<font color=red>��������!</font><b><font color=darkgreen><u>��� ���������� �������, ���������� ���������!</u></font></b>';
-	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 = '<font color=red><b>��������!</b></font><font color=darkgreen><b> ��� ���������� ������� � 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 @@
-<?php
-
-die();
-
-function getIP() {
-   if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
-   return $_SERVER['REMOTE_ADDR'];
-}
-
-if(!isset($_GET['test'])) {
-	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().'<br>'.$_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
-
-( "<i><font color=green>����������! </b>(��� ���)<b></font></i>","1","capitalcity","0","51","300","120","8","8","8","8","1","5","'.time().'","0","30" ),
-( "<i><font color=green>����������! </b>(��� ���)<b></font></i>","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 @@
 <?php
-/*
-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']) { die('<center><br><h3>��� �� ������;)</h3><img src="i/fack.jpg">'); }
-/*
-if(getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1' && getIP() != '' && getIP() != '31.131.97.206' && !isset($_GET['robot'])) {
-	die(getIP().'<br>'.$_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').' (����������� ������): <b>'.mysql_real_escape_string($t).'</b>","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 '<b>|'.$pl['battle'].'|'.$pl['id'].'|inBATTLE</b> | ';
-		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 '<b>|' . $pl['battle'] . '|' . $pl['id'] . '|inBATTLE</b> | ';
+            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..ee95d5ba 100644
--- a/cron_bs.php
+++ b/cron_bs.php
@@ -27,9 +27,9 @@ if(getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && get
 
 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');
+require_once('_incl_data/__config.php');
+require_once('_incl_data/class/__db_connect.php');
+//require_once('_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..bee1fb3f 100644
--- a/cron_dungeon_getOut.php
+++ b/cron_dungeon_getOut.php
@@ -22,10 +22,10 @@ function getIPblock() {
 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/__dungeon.php');
+require_once('_incl_data/__config.php');
+require_once('_incl_data/class/__db_connect.php');
+//require_once('_incl_data/class/__user.php');
+//require_once('_incl_data/class/__dungeon.php');
  
 # ������ �������.
 function start() {
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().'<br>'.$_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').' (����������� ������): <b>'.mysql_real_escape_string($t).'</b>","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[] = ' <strong>'.$k['login'].'</strong>'; 
-			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[] = ' <strong>' . $k['login'] . '</strong>';
+            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($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;
-	}
+			"' . $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 @@
 <?php
 
-//die('���-�� ��� �� ���...');
-
-function getIP() {
-   if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
-   return $_SERVER['REMOTE_ADDR'];
-}
-
-# �������� IP
-function getIPblock() {
-   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(getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && getIPblock() != '' && getIPblock() != '5.187.7.71') {
-	die(getIPblock().'<br>'.$_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').' (����������� ������): <b>'.mysql_real_escape_string($t).'</b>","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_h.php b/cron_h.php
index 2a02a0e0..80e4a09d 100644
--- a/cron_h.php
+++ b/cron_h.php
@@ -23,8 +23,8 @@ if(getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && get
 
 define('GAME',true);
 
-include('_incl_data/__config.php');
-include('_incl_data/class/__db_connect.php');
+require_once('_incl_data/__config.php');
+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').' (����������� ������): <b>'.mysql_real_escape_string($t).'</b>","capitalcity","ENERGY STAR","6","1","-1")');
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().'<br>'.$_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() . '<br>' . $_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').' (����������� ������): <b>'.mysql_real_escape_string($t).'</b>","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'
+        ) . ' (����������� ������): <b>' . mysql_real_escape_string($t) . '</b>","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 '&bull;'.$pl['login'].'<br>';
-		}
-		
-		//������� ������ � ����
-		$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 '&bull;' . $pl['login'] . '<br>';
+        }
+
+        //������� ������ � ����
+        $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 @@
 <?php
 
-// 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['tests'])) {
-	//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() != '51.89.6.100') {
-		die(getIP().'<br>'.$_SERVER['SERVER_ADDR']);
-	}
+if (!isset($_GET['tests']) && getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1' && getIP(
+    ) != '51.89.6.100') {
+    exit(getIP() . '<br>' . $_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 ("<i><font color=green>����������! </b>���� ����� �� ��������<b></font></i>","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(
+    [
+        "<i style='color: green;'>����������! <b>���� ����� �� ��������</b></i>",
+        1, 1, 'capitalcity', 0, 33, 300, 180, 8, 8, 12, 12, 1, 5, 1, 1, 40, 0, 0,
+    ]
+);
 
-$t='<font color=red>��������!!!</font> <b>����������� ��������</b> ��������.';
-mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("<font color=#cb0000>'.$t.'</font>","capitalcity","","6","1","'.time().'")');
+$pdo->prepare('insert into chat (`text`,`type`,`new`,`time`) values (?,?,?,unix_timestamp())')
+    ->execute(
+        ["<span style='color: red'>��������!!!</span> <span style='color:#cb0000'><b>����������� ��������</b> ��������.</span>", 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 @@
 <?php
 
-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()
+{
+    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(getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && getIPblock() != '' && getIPblock() != '5.187.7.71') {
-	die(getIPblock().'<br>'.$_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() . '<br>' . $_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').' (����������� ������): <b>'.mysql_real_escape_string($t).'</b>","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'] = '<b>'.$fxv['user_win']['login'].'</b> ���������� � ����� �� ������� &quot;'.$fxv['itm']['name'].'&quot;';
-				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'] = '<b>' . $fxv['user_win']['login'] . '</b> ���������� � ����� �� ������� &quot;' . $fxv['itm']['name'] . '&quot;';
+            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_q.php b/cron_q.php
index 28fff632..29aec002 100644
--- a/cron_q.php
+++ b/cron_q.php
@@ -2,8 +2,8 @@
 
 define('GAME',true);
 setlocale(LC_CTYPE ,"ru_RU.CP1251");
-include('_incl_data/__config.php');
-include('_incl_data/class/__db_connect.php');
+require_once('_incl_data/__config.php');
+require_once('_incl_data/class/__db_connect.php');
 
 $html = '';
 
diff --git a/cron_rating.php b/cron_rating.php
index 698c62ae..f3f175e4 100644
--- a/cron_rating.php
+++ b/cron_rating.php
@@ -3,7 +3,7 @@
 //die('���-�� ��� �� ���...');
 
 define('GAME',true);
-include('_incl_data/class/__db_connect.php');
+require_once('_incl_data/class/__db_connect.php');
 
 //������� ����������
 
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 @@
-----<?php
+<?php
 
-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['test'])) {
-	//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() != '31.131.106.205') {
-		die(getIP().'<br>'.$_SERVER['SERVER_ADDR']);
-	}
-}
+if (!isset($_GET['test']) && getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1' && getIP() != '' && getIP(
+    ) != '31.131.106.205') {
+        exit(getIP() . '<br>' . $_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']  = '<b>';
-	if( $bus['align'] > 0 ) {
-		$bus['login_BIG'] .= '<img src=https://img.new-combats.com/i/align/align'.$bus['align'].'.gif width=12 height=15 >';
-	}
-	if( $bus['clan'] > 0 ) {
-		$bus['login_BIG'] .= '<img src=https://img.new-combats.com/i/clan/'.$bus['clan'].'.gif width=24 height=15 >';
-	}
-	$bus['login_BIG'] .= ''.$bus['login'].'</b>['.$bus['level'].']<a target=_blank href=https://new-combats.com/info/'.$bus['id'].' ><img width=12 hiehgt=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-	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'] = '<b>';
+    if ($bus['align'] > 0) {
+        $bus['login_BIG'] .= '<img src=https://img.new-combats.com/i/align/align' . $bus['align'] . '.gif width=12 height=15 >';
+    }
+    if ($bus['clan'] > 0) {
+        $bus['login_BIG'] .= '<img src=https://img.new-combats.com/i/clan/' . $bus['clan'] . '.gif width=24 height=15 >';
+    }
+    $bus['login_BIG'] .= '' . $bus['login'] . '</b>[' . $bus['level'] . ']<a target=_blank href=https://new-combats.com/info/' . $bus['id'] . ' ><img width=12 hiehgt=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
+    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 ("<font color=#cb0000>'.mysql_real_escape_string($t).'</font>","capitalcity","","6","1","'.time().'")');
+function e($t)
+{
+    mysql_query(
+        'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("<font color=#cb0000>' . mysql_real_escape_string(
+            $t
+        ) . '</font>","capitalcity","","6","1","' . time() . '")'
+    );
 }
 
-function e2($t) {
-	mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("<font color=#cb0000>'.mysql_real_escape_string($t).'</font>","capitalcity","��������","6","1","-1")');
+function e2($t)
+{
+    mysql_query(
+        'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("<font color=#cb0000>' . mysql_real_escape_string(
+            $t
+        ) . '</font>","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} <a target=_blank href=/logs.php?log='.$btl_id.' >��</a>';
-			}else{
-				$text = '{u1} ��������� � �������� ������ {u2} <a target=_blank href=/logs.php?log='.$btl_id.' >��</a>';
-			}
-		}else{
-			//������� � ��� ��
-			if( $u1['sex'] == 0 ) {
-				$text = '{u1} ����� �� {u2} ��������� ��� <a target=_blank href=/logs.php?log='.$btl_id.' >��</a>';
-			}else{
-				$text = '{u1} ������ �� {u2} ��������� ��� <a target=_blank href=/logs.php?log='.$btl_id.' >��</a>';
-			}
-		}
-		if( isset($usr_real['id'])) {
-			$usrreal = '';
-			if( $usr_real['align'] > 0 ) {
-				$usrreal .= '<img src=https://img.new-combats.com/i/align/align'.$usr_real['align'].'.gif width=12 height=15 >';
-			}
-			if( $usr_real['clan'] > 0 ) {
-				$usrreal .= '<img src=https://img.new-combats.com/i/clan/'.$usr_real['clan'].'.gif width=24 height=15 >';
-			}
-			$usrreal .= '<b>'.$usr_real['login'].'</b>['.$usr_real['level'].']<a target=_blank href=https://new-combats.com/info/'.$usr_real['id'].' ><img width=12 hiehgt=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-		}else{
-			$mereal = '<i>���������</i>[??]';
-		}
-		if( isset($me_real['id']) ) {
-			$mereal = '';
-			if( $me_real['align'] > 0 ) {
-				$mereal .= '<img src=https://img.new-combats.com/i/align/align'.$me_real['align'].'.gif width=12 height=15 >';
-			}
-			if( $me_real['clan'] > 0 ) {
-				$mereal .= '<img src=https://img.new-combats.com/i/clan/'.$me_real['clan'].'.gif width=24 height=15 >';
-			}
-			$mereal .= '<b>'.$me_real['login'].'</b>['.$me_real['level'].']<a target=_blank href=https://new-combats.com/info/'.$me_real['id'].' ><img width=12 hiehgt=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-		}else{
-			$mereal = '<i>���������</i>[??]';
-		}
-		$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} <a target=_blank href=/logs.php?log=' . $btl_id . ' >��</a>';
+            } else {
+                $text = '{u1} ��������� � �������� ������ {u2} <a target=_blank href=/logs.php?log=' . $btl_id . ' >��</a>';
+            }
+        } else {
+            //������� � ��� ��
+            if ($u1['sex'] == 0) {
+                $text = '{u1} ����� �� {u2} ��������� ��� <a target=_blank href=/logs.php?log=' . $btl_id . ' >��</a>';
+            } else {
+                $text = '{u1} ������ �� {u2} ��������� ��� <a target=_blank href=/logs.php?log=' . $btl_id . ' >��</a>';
+            }
+        }
+        if (isset($usr_real['id'])) {
+            $usrreal = '';
+            if ($usr_real['align'] > 0) {
+                $usrreal .= '<img src=https://img.new-combats.com/i/align/align' . $usr_real['align'] . '.gif width=12 height=15 >';
+            }
+            if ($usr_real['clan'] > 0) {
+                $usrreal .= '<img src=https://img.new-combats.com/i/clan/' . $usr_real['clan'] . '.gif width=24 height=15 >';
+            }
+            $usrreal .= '<b>' . $usr_real['login'] . '</b>[' . $usr_real['level'] . ']<a target=_blank href=https://new-combats.com/info/' . $usr_real['id'] . ' ><img width=12 hiehgt=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
+        } else {
+            $mereal = '<i>���������</i>[??]';
+        }
+        if (isset($me_real['id'])) {
+            $mereal = '';
+            if ($me_real['align'] > 0) {
+                $mereal .= '<img src=https://img.new-combats.com/i/align/align' . $me_real['align'] . '.gif width=12 height=15 >';
+            }
+            if ($me_real['clan'] > 0) {
+                $mereal .= '<img src=https://img.new-combats.com/i/clan/' . $me_real['clan'] . '.gif width=24 height=15 >';
+            }
+            $mereal .= '<b>' . $me_real['login'] . '</b>[' . $me_real['level'] . ']<a target=_blank href=https://new-combats.com/info/' . $me_real['id'] . ' ><img width=12 hiehgt=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
+        } else {
+            $mereal = '<i>���������</i>[??]';
+        }
+        $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'].' ������� � <b>����� ������</b> �� ������� �� �������: ������������ ���������� '.timeOut($pl['time_start']-time()).' (<small>'.date('d.m.Y H:i',$pl['time_start']).'</small>)');
-		}else{
-			//if( timeOut($pl['time_start']-time()) != '44 ���.' ) {
-				e('������ ������� ����� ������, ��� '.$pl['to_lvl'].' ������� � <b>����� ������</b> ����� '.timeOut($pl['time_start']-time()).' (<small>'.date('d.m.Y H:i',$pl['time_start']).'</small>), ������� �������� ����: 0.00 ��., <b>1.00</b> ���., ������: 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'] . ' ������� � <b>����� ������</b> �� ������� �� �������: ������������ ���������� ' . timeOut(
+                    $pl['time_start'] - time()
+                ) . ' (<small>' . date('d.m.Y H:i', $pl['time_start']) . '</small>)'
+            );
+        } else {
+            e(
+                '������ ������� ����� ������, ��� ' . $pl['to_lvl'] . ' ������� � <b>����� ������</b> ����� ' . timeOut(
+                    $pl['time_start'] - time()
+                ) . ' (<small>' . date(
+                    'd.m.Y H:i', $pl['time_start']
+                ) . '</small>), ������� �������� ����: 0.00 ��., <b>1.00</b> ���., ������: 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 = '������ ��������. ����������: <i>�����������</i> (������ ���������� �� ��������). �������� ����: <b>'.round($pl['money']*0.85,2).'</b> ��.';
-			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 = '������ ��������. ����������: <i>�����������</i> (������ ���������� �� ��������). �������� ����: <b>' . round(
+                    $pl['money'] * 0.85, 2
+                ) . '</b> ��.';
+            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'].' ������� � <b>����� ������</b> ���������� �� ��������. ������ ������ ������� ����� '.timeOut($pl['time_start']-time()-3600).' (<small>'.date('d.m.Y H:i',$pl['time_start']).'</small>)');
-			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'].' ������� � <b>����� ������</b> ����������. ����������: '.microLogin2($uwin).'. ����: <b>'.round($pl['money']*0.85,2).'</b> ��. � <b>1</b> ���.<b>'.round($swin_bot['exp']).'</b> �����. ������ ������ ������� ����� '.timeOut($pl['time_start']-time()).' (<small>'.date('d.m.Y H:i',$pl['time_start']).'</small>)');
-							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).'. ����: <b>'.round($pl['money']*0.85,2).'</b> ��. � 1 ���.<b>'.round($swin_bot['exp']).'</b> �����.';
-						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'] . ' ������� � <b>����� ������</b> ���������� �� ��������. ������ ������ ������� ����� ' . timeOut(
+                    $pl['time_start'] - time() - 3600
+                ) . ' (<small>' . date('d.m.Y H:i', $pl['time_start']) . '</small>)'
+            );
+            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'] . ' ������� � <b>����� ������</b> ����������. ����������: ' . microLogin2(
+                                    $uwin
+                                ) . '. ����: <b>' . round(
+                                    $pl['money'] * 0.85, 2
+                                ) . '</b> ��. � <b>1</b> ���.<b>' . round(
+                                    $swin_bot['exp']
+                                ) . '</b> �����. ������ ������ ������� ����� ' . timeOut(
+                                    $pl['time_start'] - time()
+                                ) . ' (<small>' . date('d.m.Y H:i', $pl['time_start']) . '</small>)'
+                            );
+                            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) . '. ����: <b>' . round(
+                                $pl['money'] * 0.85, 2
+                            ) . '</b> ��. � 1 ���.<b>' . round($swin_bot['exp']) . '</b> �����.';
+                        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 = '������ ��������. ����������: <i>�����������</i> (����� �� ������� � �����). �������� ����: <b>'.round($pl['money']*0.85,2).'</b> ��.';
-					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'].' ������� � <b>����� ������</b> ����������. ����������: <i>�����������</i> (����� �� ������� � �����). �������� ���� <b>'.round($pl['money']*0.85,2).'</b> ��. ������ ������ ������� ����� '.timeOut($pl['time_start']-time()-3600).' (<small>'.date('d.m.Y H:i',$pl['time_start']).'</small>)');
-					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 = '������ ��������. ����������: <i>�����������</i> (����� �� ������� � �����). �������� ����: <b>' . round(
+                            $pl['money'] * 0.85, 2
+                        ) . '</b> ��.';
+                    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'] . ' ������� � <b>����� ������</b> ����������. ����������: <i>�����������</i> (����� �� ������� � �����). �������� ���� <b>' . round(
+                            $pl['money'] * 0.85, 2
+                        ) . '</b> ��. ������ ������ ������� ����� ' . timeOut(
+                            $pl['time_start'] - time() - 3600
+                        ) . ' (<small>' . date('d.m.Y H:i', $pl['time_start']) . '</small>)'
+                    );
+                    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']  = '<b>';
-					if( $bus['align'] > 0 ) {
-						$bus['login_BIG'] .= '<img src=https://img.new-combats.com/i/align/align'.$bus['align'].'.gif width=12 height=15 >';
-					}
-					if( $bus['clan'] > 0 ) {
-						$bus['login_BIG'] .= '<img src=https://img.new-combats.com/i/clan/'.$bus['clan'].'.gif width=24 height=15 >';
-					}
-					$bus['login_BIG'] .= ''.$bus['login'].'</b>['.$bus['level'].']<a target=_blank href=https://new-combats.com/info/'.$bus['id'].' ><img width=12 hiehgt=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
-					$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'] = '<b>';
+                    if ($bus['align'] > 0) {
+                        $bus['login_BIG'] .= '<img src=https://img.new-combats.com/i/align/align' . $bus['align'] . '.gif width=12 height=15 >';
+                    }
+                    if ($bus['clan'] > 0) {
+                        $bus['login_BIG'] .= '<img src=https://img.new-combats.com/i/clan/' . $bus['clan'] . '.gif width=24 height=15 >';
+                    }
+                    $bus['login_BIG'] .= '' . $bus['login'] . '</b>[' . $bus['level'] . ']<a target=_blank href=https://new-combats.com/info/' . $bus['id'] . ' ><img width=12 hiehgt=11 src=https://img.new-combats.com/i/inf_capitalcity.gif ></a>';
+                    $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'].' ������� � <b>����� ������</b>. ���������: '.$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'].' ������� � <b>����� ������</b> ����� '.timeOut($pl['time_start']-time()).' (<small>'.date('d.m.Y H:i',$pl['time_start']).'</small>), ������� �������� ����: '.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'].' ������� � <b>����� ������</b> ����� '.timeOut($pl['time_start']-time()).' (<small>'.date('d.m.Y H:i',$pl['time_start']).'</small>), ������� �������� ����: '.round($pl['money']*0.85,2).' ��., <b>1.00</b> ���., ������: '.$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'] . ' ������� � <b>����� ������</b>. ���������: ' . $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'].' ������� � <b>����� ������</b> ����� '.timeOut($pl['time_start']-time()).' (<small>'.date('d.m.Y H:i',$pl['time_start']).'</small>), ������� �������� ����: '.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'] . ' ������� � <b>����� ������</b> ����� ' . timeOut(
+                        $pl['time_start'] - time()
+                    ) . ' (<small>' . date(
+                        'd.m.Y H:i', $pl['time_start']
+                    ) . '</small>), ������� �������� ����: ' . round(
+                        $pl['money'] * 0.85, 2
+                    ) . ' ��., <b>1.00</b> ���., ������: ' . $pl['users'] . ''
+                );
+            }
+        }
+    }
 }
 echo '#finish#';
-?>
\ No newline at end of file
diff --git a/cron_trupojor.php b/cron_trupojor.php
index b42a8711..711edbdb 100644
--- a/cron_trupojor.php
+++ b/cron_trupojor.php
@@ -24,8 +24,8 @@ if(!isset($_GET['test']))
 
 define('GAME',true);
 
-include('_incl_data/__config.php');
-include('_incl_data/class/__db_connect.php');
+require_once('_incl_data/__config.php');
+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').' (���������� ������): <b>'.mysql_real_escape_string($t).'</b>","capitalcity","LEL","6","1","-1")');
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 @@
 <?php
 
-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['test'])) {
-	//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() != '31.131.97.206') {
-		die(getIP().'<br>'.$_SERVER['SERVER_ADDR']);
-	}
-}
+if (!isset($_GET['test']) && getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1' && getIP() != '' && getIP(
+    ) != '31.131.97.206') {
+        die(getIP() . '<br>' . $_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 @@
-<?php
-
-function getIP() {
-   if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
-   return $_SERVER['REMOTE_ADDR'];
-}
-
-if(!isset($_GET['test'])) {
-	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().'<br>'.$_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,'','<font color=green>��� ����������� �������� �� ����������� �������, ������� ���� ������� � ���� ����� � �������� ������� �� ������!',time());
-			send_chat(1,'','<font color=red><b>��������</b>: ���-�� � ���� ����, � ��������� �����, �� �� �����</font> :vamp:',time());
-			send_chat(1,'','<font color=blue><b>�����������</b>:� ������ ����� ������ ���� ���</font> :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..0cc69d0e 100644
--- a/cron_zv.php
+++ b/cron_zv.php
@@ -1,72 +1,26 @@
 <?php
 
-function getIP() {
-   if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
-   return $_SERVER['REMOTE_ADDR'];
-}
-
 # �������� IP
-function getIPblock() {
-   if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
-   return $_SERVER['REMOTE_ADDR'];
-}
+use Insallah\Db;
 
-# ��������� �������� ������������. 
-
-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().'<br>'.$_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');
 
-function e($t) {
-	mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #'.date('d.m.Y').' %'.date('H:i:s').' (����������� ������): <b>'.mysql_real_escape_string($t).'</b>","capitalcity","LEL","6","1","-1")');
+$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)';
+$sp = Db::getRows($query);
+
+foreach ($sp as $pl) {
+    if (!$pl['id']) {
+        continue;
+    }
+    $uid = $pl['id'];
+    $pass = $pl['pass'];
+    $cron_core = md5($uid . '_brfCOreW@!_' . $pass);
+    echo file_get_contents("https://new-combats.com/jx/battle/refresh.php?uid=$uid&cron_core=$cron_core&pass=$pass");
+    echo '<hr>';
 }
 
-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 '<hr>';
-	}
-}
-
-//
-$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 = new FightRequest();
 $zv->testCronZv();
-?>
diff --git a/dn_editor.php b/dn_editor.php
index 3f5779d0..2bd5ffff 100644
--- a/dn_editor.php
+++ b/dn_editor.php
@@ -1,1170 +1,1433 @@
-<?
-session_start();
-
-function er($e)
-{
-	 global $c;
-	 die('<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"><meta http-equiv="Content-Language" content="ru"><TITLE>��������� ������</TITLE></HEAD><BODY text="#FFFFFF"><p><font color=black>��������� ������: <pre>'.$e.'</pre><b><p><a href="https://'.$c[0].'/">�����</b></a><HR><p align="right">(c) <a href="https://'.$c[0].'/">'.$c[1].'</a></p></body></html>');
-}
-
-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);
+<?php
+# Admin Only Area
+const GAME = true;
 
 include_once('_incl_data/__config.php');
 include_once('_incl_data/class/__db_connect.php');
-include_once('_incl_data/class/__user.php');
+define('IP', UserIp::get());
+$u = User::start();
 
-if($u->info['admin'] == 0) {
-	die('<meta http-equiv="refresh" content="0; URL=https://new-combats.com/">');
+if (!$u->info['admin']) {
+    die('<meta http-equiv="refresh" content="0; URL=https://new-combats.com/">');
 }
 
-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{
-		//������� ������
-		/*
-	$('#ore_id').val(op[0]);
-	$('#ore_img').val(op[4]);
-	$('#ore_name').val(op[1]);
-	$('#ore_x').val(op['x']);
-	$('#ore_y').val(op['y']);
-	$('#ore_t').val(top.obi['t']);
-	$('#ore_l').val(top.obi['l']);
-	$('#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']).'",				
+				`type` = "' . mysql_real_escape_string($_POST['ore_type']) . '" WHERE `id` = "' . $obj['id'] . '" LIMIT 1		
+		'
+        );
+        echo '������ ���������';
+    } else {
+        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'])) {
 ?>
 <!DOCTYPE html>
 <html>
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
-<title>���������� �������� ���������� &copy; new-combats.com</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"/>
+    <title>���������� �������� ���������� &copy; new-combats.com</title>
 
-<script type="text/javascript" src="js/jquery.js"></script>
-<script type="text/javascript" src="js/jqueryrotate.js"></script>
-<script type="text/javascript" src="js/jquery.zclip.js"></script>
-<script type="text/javascript" src="js/jquery.cookie.js"></script>
-<script type="text/javascript" src="js/title.js"></script>
+    <script type="text/javascript" src="js/jquery.js"></script>
+    <script type="text/javascript" src="js/jqueryrotate.js"></script>
+    <script type="text/javascript" src="js/jquery.zclip.js"></script>
+    <script type="text/javascript" src="js/jquery.cookie.js"></script>
+    <script type="text/javascript" src="js/title.js"></script>
 
-<link href="https://img.new-combats.com/css/dungeon_<? echo $d->point['css']; ?>.css" rel="stylesheet" type="text/css">
+    <link href="https://img.new-combats.com/css/dungeon_<?php echo $d->point['css']; ?>.css" rel="stylesheet"
+          type="text/css">
 
-<script>
+    <script>
 
 
-//�������������� ��������
+        //�������������� ��������
 
-var obi = {'obj':0,
-	'w':0,
-	'h':0,
-	't':0,
-	'l':0,
-	'position':0,
-	'val':0};
+        var obi = {
+            'obj': 0,
+            'w': 0,
+            'h': 0,
+            't': 0,
+            'l': 0,
+            'position': 0,
+            'val': 0
+        };
 
-function editObjResize(objs,vl,iii) {
-	$(top.obi['obj']).css({'background-color':''});	
-	top.obi = {
-		'obj':objs,
-		'id':$(top.obi['obj']).attr('id'),
-		'w':$(objs).width(),
-		'h':$(objs).height(),
-		't':$(objs).css('top'),
-		'l':$(objs).css('left'),
-		'position':0,
-		'val':0
-	};
+        function editObjResize(objs, vl, iii) {
+            $(top.obi['obj']).css({'background-color': ''});
+            top.obi = {
+                'obj': objs,
+                'id': $(top.obi['obj']).attr('id'),
+                'w': $(objs).width(),
+                'h': $(objs).height(),
+                't': $(objs).css('top'),
+                'l': $(objs).css('left'),
+                'position': 0,
+                'val': 0
+            };
 
-	$('#eo').css({
-		'display':'',
-		'position':'absolute',
-		'top':$(objs).css('top'),
-		'left':$(objs).css('left'),
-		'width':$(objs).width()+'px',
-		'height':$(objs).height()+'px'
-	});
-	resizeObj1(event,iii);
-	//$('#eo').bind('mousedown',function(event){ moveObj1(event); });
-	//$(top.obi['obj']).css({'background-color':'red'});	
-}
+            $('#eo').css({
+                'display': '',
+                'position': 'absolute',
+                'top': $(objs).css('top'),
+                'left': $(objs).css('left'),
+                'width': $(objs).width() + 'px',
+                'height': $(objs).height() + 'px'
+            });
+            resizeObj1(event, iii);
+        }
 
-function resizeObj1(e,iii) {
-	$('#object_resize_editor').css({'display':''});
-	$('#Dungeon2').css({'display':''});
-	$('#Dungeon2').bind('mousemove',function(event){ resizeObj(event); });
-	$('#Dungeon2').bind('click',function(event){ moveObjEnd2(); });
-	
-	//ore_save_obj
-	var op = objs[iii];
-	$('#ore_id').val(op[0]);
-	$('#ore_img').val(op[4]);
-	$('#ore_name').val(op[1]);
-	$('#ore_x').val(op['x']);
-	$('#ore_y').val(op['y']);
-	$('#ore_t').val(top.obi['t']);
-	$('#ore_l').val(top.obi['l']);
-	$('#ore_w').val(op[7]);
-	$('#ore_h').val(op[8]);
-	$('#ore_w2').val(op[7]);
-	$('#ore_h2').val(op[8]);
-		
-	$('#ore_type').val(op[12]);
-	$('#ore_type2').val(op[13]);
-	$('#ore_s').val(op[14]);
-	$('#ore_s2').val(op[15]);
-	$('#ore_os1').val(op[16]);
-	$('#ore_os2').val(op[17]);
-	$('#ore_os3').val(op[18]);
-	$('#ore_os4').val(op[19]);
-	$('#ore_fix_x_y').val(op[20]);
-	saveCord();
-	
-	var npos = $('#'+$(top.obi['obj']).attr('id')+'_2').offset();
-	
-	$('#'+$(top.obi['obj']).attr('id')+'_2').css({'background-color':'blue','opacity':'0.25'});
-}
+        function resizeObj1(e, iii) {
+            $('#object_resize_editor').css({'display': ''});
+            $('#Dungeon2').css({'display': ''});
+            $('#Dungeon2').bind('mousemove', function (event) {
+                resizeObj(event);
+            });
+            $('#Dungeon2').bind('click', function (event) {
+                moveObjEnd2();
+            });
 
-function ore_save_obj() {
-		$.post('dn_editor.php?look=1',{
-			ore_id:$('#ore_id').val(),
-			ore_img:$('#ore_img').val(),
-			ore_name:$('#ore_name').val(),
-			ore_x:$('#ore_x').val(),
-			ore_y:$('#ore_y').val(),
-			ore_t:$('#ore_t').val(),
-			ore_l:$('#ore_l').val(),
-			ore_w:$('#ore_w').val(),
-			ore_h:$('#ore_h').val(),
-			
-			ore_type:$('#ore_type').val(),
-			ore_type2:$('#ore_type2').val(),
-			ore_s:$('#ore_s').val(),
-			ore_s2:$('#ore_s2').val(),
-			ore_os1:$('#ore_os1').val(),
-			ore_os2:$('#ore_os2').val(),
-			ore_os3:$('#ore_os3').val(),
-			ore_os4:$('#ore_os4').val(),
-			ore_fix_x_y:$('#ore_fix_x_y').val(),
-			
-			id_dng:<?=(0+$_POST['id_dng'])?>
-		},function(data){ $('#textAjaxGo').html('['+data+']'); top.goPix(top.sel_id,top.sel_x,top.sel_y); });
-}
+            //ore_save_obj
+            var op = objs[iii];
+            $('#ore_id').val(op[0]);
+            $('#ore_img').val(op[4]);
+            $('#ore_name').val(op[1]);
+            $('#ore_x').val(op['x']);
+            $('#ore_y').val(op['y']);
+            $('#ore_t').val(top.obi['t']);
+            $('#ore_l').val(top.obi['l']);
+            $('#ore_w').val(op[7]);
+            $('#ore_h').val(op[8]);
+            $('#ore_w2').val(op[7]);
+            $('#ore_h2').val(op[8]);
 
-function ore_delete_obj() {
-		$.post('dn_editor.php?look=1',{
-			ore_delete_id:$('#ore_id').val()
-		},function(data){ $('#textAjaxGo').html('['+data+']'); top.goPix(top.sel_id,top.sel_x,top.sel_y); });
-}
+            $('#ore_type').val(op[12]);
+            $('#ore_type2').val(op[13]);
+            $('#ore_s').val(op[14]);
+            $('#ore_s2').val(op[15]);
+            $('#ore_os1').val(op[16]);
+            $('#ore_os2').val(op[17]);
+            $('#ore_os3').val(op[18]);
+            $('#ore_os4').val(op[19]);
+            $('#ore_fix_x_y').val(op[20]);
+            saveCord();
 
-function moveObjEnd2() {
-	$('#Dungeon2').unbind('mousemove');
-	$('#Dungeon2').unbind('click');
-	
-	$('#'+$(top.obi['obj']).attr('id')+'_2').css({'background-color':'','opacity':'1.0'});
-	//$(top.obi['obj']).css({'top':(y+2)+'px','left':x+'px'});
-	$('#Dungeon2').css({'display':'none'});
+            var npos = $('#' + $(top.obi['obj']).attr('id') + '_2').offset();
 
-	$('#eo').css({
-		'display':'none'
-	});
-	$('#object_resize_editor').css({
-		'display':'none'
-	});
+            $('#' + $(top.obi['obj']).attr('id') + '_2').css({'background-color': 'blue', 'opacity': '0.25'});
+        }
 
-	var obi = {'obj':0,
-		'w':0,
-		'h':0,
-		't':0,
-		'l':0,
-		'position':0,
-		'val':0};
-}
+        function ore_save_obj() {
+            $.post('dn_editor.php?look=1', {
+                ore_id: $('#ore_id').val(),
+                ore_img: $('#ore_img').val(),
+                ore_name: $('#ore_name').val(),
+                ore_x: $('#ore_x').val(),
+                ore_y: $('#ore_y').val(),
+                ore_t: $('#ore_t').val(),
+                ore_l: $('#ore_l').val(),
+                ore_w: $('#ore_w').val(),
+                ore_h: $('#ore_h').val(),
 
-function editObj(objs,vl) {
-	$(top.obi['obj']).css({'background-color':''});	
-	top.obi = {
-		'obj':objs,
-		'id':$(top.obi['obj']).attr('id'),
-		'w':$(objs).width(),
-		'h':$(objs).height(),
-		't':$(objs).css('top'),
-		'l':$(objs).css('left'),
-		'position':0,
-		'val':0
-	};
+                ore_type: $('#ore_type').val(),
+                ore_type2: $('#ore_type2').val(),
+                ore_s: $('#ore_s').val(),
+                ore_s2: $('#ore_s2').val(),
+                ore_os1: $('#ore_os1').val(),
+                ore_os2: $('#ore_os2').val(),
+                ore_os3: $('#ore_os3').val(),
+                ore_os4: $('#ore_os4').val(),
+                ore_fix_x_y: $('#ore_fix_x_y').val(),
 
-	$('#eo').css({
-		'display':'',
-		'position':'absolute',
-		'top':$(objs).css('top'),
-		'left':$(objs).css('left'),
-		'width':$(objs).width()+'px',
-		'height':$(objs).height()+'px'
-	});
-	moveObj1(event);
-	//$('#eo').bind('mousedown',function(event){ moveObj1(event); });
-	//$(top.obi['obj']).css({'background-color':'red'});	
-}
+                id_dng: <?=(0 + $_POST['id_dng'])?>
+            }, function (data) {
+                $('#textAjaxGo').html('[' + data + ']');
+                top.goPix(top.sel_id, top.sel_x, top.sel_y);
+            });
+        }
 
-function moveObj1(e) {
-	$('#Dungeon2').css({'display':''});
-	$('#Dungeon2').bind('mousemove',function(event){ moveObj(event); });
-	$('#Dungeon2').bind('click',function(event){ moveObjEnd(event); });
-	$('#'+$(top.obi['obj']).attr('id')+'_2').css({'background-color':'red','opacity':'0.21'});
-}
+        function ore_delete_obj() {
+            $.post('dn_editor.php?look=1', {
+                ore_delete_id: $('#ore_id').val()
+            }, function (data) {
+                $('#textAjaxGo').html('[' + data + ']');
+                top.goPix(top.sel_id, top.sel_x, top.sel_y);
+            });
+        }
 
-function moveObj(e) {
-	if (!e) e = window.event;
-	var x = e.pageX, y = e.pageY;
-	var xm = parseFloat($('#Dungeon2').offset().left), ym = parseFloat($('#Dungeon2').offset().top);
-		Math.round(x = x-xm-($(top.obi['obj']).width()/2));
-		Math.round(y = y-ym-($(top.obi['obj']).height()/2));
-	
-	
-	$('#'+$(top.obi['obj']).attr('id')+'_2').css({'top':y+'px','left':x+'px'});
-	
-	$(top.obi['obj']).css({'top':(y+2)+'px','left':x+'px'});
-	$('#eo').css({'top':y+'px','left':x+'px'});
-}
+        function moveObjEnd2() {
+            $('#Dungeon2').unbind('mousemove');
+            $('#Dungeon2').unbind('click');
 
-function moveObjEnd(e) {
-	$('#Dungeon2').unbind('mousemove');
-	$('#Dungeon2').unbind('click');
-	if (!e) e = window.event;
-	var x = e.pageX, y = e.pageY;
-	var xm = parseFloat($('#Dungeon2').offset().left), ym = parseFloat($('#Dungeon2').offset().top);
-		x = Math.round(x-xm-($(top.obi['obj']).width()/2));
-		y = Math.round(y-ym-($(top.obi['obj']).height()/2));
-	
-	$('#'+$(top.obi['obj']).attr('id')+'_2').css({'background-color':'','opacity':'1.0'});
-	//$(top.obi['obj']).css({'top':(y+2)+'px','left':x+'px'});
-	
-	$('#eo').css({'top':y+'px','left':x+'px'});
-	$('#Dungeon2').css({'display':'none'});
+            $('#' + $(top.obi['obj']).attr('id') + '_2').css({'background-color': '', 'opacity': '1.0'});
+            $('#Dungeon2').css({'display': 'none'});
+
+            $('#eo').css({
+                'display': 'none'
+            });
+            $('#object_resize_editor').css({
+                'display': 'none'
+            });
+
+            var obi = {
+                'obj': 0,
+                'w': 0,
+                'h': 0,
+                't': 0,
+                'l': 0,
+                'position': 0,
+                'val': 0
+            };
+        }
+
+        function editObj(objs, vl) {
+            $(top.obi['obj']).css({'background-color': ''});
+            top.obi = {
+                'obj': objs,
+                'id': $(top.obi['obj']).attr('id'),
+                'w': $(objs).width(),
+                'h': $(objs).height(),
+                't': $(objs).css('top'),
+                'l': $(objs).css('left'),
+                'position': 0,
+                'val': 0
+            };
+
+            $('#eo').css({
+                'display': '',
+                'position': 'absolute',
+                'top': $(objs).css('top'),
+                'left': $(objs).css('left'),
+                'width': $(objs).width() + 'px',
+                'height': $(objs).height() + 'px'
+            });
+            moveObj1(event);
+        }
+
+        function moveObj1(e) {
+            $('#Dungeon2').css({'display': ''});
+            $('#Dungeon2').bind('mousemove', function (event) {
+                moveObj(event);
+            });
+            $('#Dungeon2').bind('click', function (event) {
+                moveObjEnd(event);
+            });
+            $('#' + $(top.obi['obj']).attr('id') + '_2').css({'background-color': 'red', 'opacity': '0.21'});
+        }
+
+        function moveObj(e) {
+            if (!e) e = window.event;
+            var x = e.pageX, y = e.pageY;
+            var xm = parseFloat($('#Dungeon2').offset().left), ym = parseFloat($('#Dungeon2').offset().top);
+            Math.round(x = x - xm - ($(top.obi['obj']).width() / 2));
+            Math.round(y = y - ym - ($(top.obi['obj']).height() / 2));
 
 
-	//��������� ������� �������
-	$.post('dn_editor.php',{saveObjPosition:$(top.obi['obj']).attr('id'),rz:$(top.obi['obj']).attr('rz'),objx:x,objy:y,x:top.sel_x,y:top.sel_y,s:top.sel_s},function(data){ $('#textAjaxGo').html('['+data+']'); });
+            $('#' + $(top.obi['obj']).attr('id') + '_2').css({'top': y + 'px', 'left': x + 'px'});
 
-	$('#eo').css({
-		'display':'none'
-	});
+            $(top.obi['obj']).css({'top': (y + 2) + 'px', 'left': x + 'px'});
+            $('#eo').css({'top': y + 'px', 'left': x + 'px'});
+        }
 
-	var obi = {'obj':0,
-		'w':0,
-		'h':0,
-		't':0,
-		'l':0,
-		'position':0,
-		'val':0};
-}
+        function moveObjEnd(e) {
+            $('#Dungeon2').unbind('mousemove');
+            $('#Dungeon2').unbind('click');
+            if (!e) e = window.event;
+            var x = e.pageX, y = e.pageY;
+            var xm = parseFloat($('#Dungeon2').offset().left), ym = parseFloat($('#Dungeon2').offset().top);
+            x = Math.round(x - xm - ($(top.obi['obj']).width() / 2));
+            y = Math.round(y - ym - ($(top.obi['obj']).height() / 2));
+
+            $('#' + $(top.obi['obj']).attr('id') + '_2').css({'background-color': '', 'opacity': '1.0'});
+            //$(top.obi['obj']).css({'top':(y+2)+'px','left':x+'px'});
+
+            $('#eo').css({'top': y + 'px', 'left': x + 'px'});
+            $('#Dungeon2').css({'display': 'none'});
 
 
-var sel_id = 0 , sel_x = 0 , sel_y = 0 , sel_s = 1;
-function goPix(id,x,y) {
-	
-	$('#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=<?=$id?>&xx="+x+"&&yy="+y+"");
-	$.post('dn_editor.php?look=1',{id:<?=$id?>,id_p:id,x:x,y:y,s:top.sel_s},function(data){ $('#dngseemap').html(data); });
-}
+            //��������� ������� �������
+            $.post('dn_editor.php', {
+                saveObjPosition: $(top.obi['obj']).attr('id'),
+                rz: $(top.obi['obj']).attr('rz'),
+                objx: x,
+                objy: y,
+                x: top.sel_x,
+                y: top.sel_y,
+                s: top.sel_s
+            }, function (data) {
+                $('#textAjaxGo').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 += '<a href="main.php?talk='+talk+'&rnd=0.28626200682069150">������</a><br>';
-		}
-		if(atk==1)
-		{
-			t += '<a href="main.php?atack='+id+'&rnd=0.28626200682069150">�������</a><br>';
-		}
-		if(look==1)
-		{
-			t += '��������<br>';
-		}
-		if(take==1)
-		{
-			t += '�������<br>';
-		}
-		d.innerHTML = t+'<small style="float:right;"><button style="border: solid 1pt #B0B0B0; font-family: MS Sans Serif; font-size: 10px; color: #191970; MARGIN-BOTTOM: 2px; MARGIN-TOP: 1px;" type="button" onClick="exitDem();">x</button></center>';
-		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';
-		}
-	}
-}
+            $('#eo').css({
+                'display': 'none'
+            });
 
-function exitDem()
-{
-	var d = document.getElementById('deMenu');
-	if(d!=undefined)
-	{
-		d.innerHTML = '';
-		d.style.display = 'none';
-		d.style.top = '0px';
-		d.style.right = '0px';
-	}
-}
-
-<? } if($id > 0) { ?>
-<? if(isset($_GET['look'])){ echo '<script>'; } if(!isset($_GET['look'])){ echo 'var'; }?> objects = {};
-//i:{id,login,mapPoint,sex,obraz,type,users_p},
-<? if(!isset($_GET['look'])){ echo 'var'; }?> users   = {};
-<? if(!isset($_GET['look'])){ echo 'var'; }?> objs   = {<? echo $d->genObjects(); ?>};
-<? if(!isset($_GET['look'])){ echo 'var'; }?> items   = {};
-<? if(!isset($_GET['look'])){ echo 'var'; }?> actions = {};
-<? if(!isset($_GET['look'])){ echo 'var'; }?> dsee = <? echo 0+$d->gs; ?>;
-<? if(!isset($_GET['look'])){ echo 'var'; }?> 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'}
-<? if(!isset($_GET['look'])){ echo 'var'; }?> zmap = {5:894,8:0,12:0}
-<? if(!isset($_GET['look'])){ echo 'var'; }?> zfloor0 = {1:'',2:'',3:'',4:'',5:''};
-<? } if(isset($_GET['look'])){ echo '</script>'; }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] = '<img id="obj_true_'+v[0]+'_2" rz="'+rz+'" oncontextmenu="top.editObjResize(\'#obj_true_'+v[0]+'\',\''+v+'\',\''+iii+'\'); return false" title="'+v[1]+'" onClick="top.editObj(\'#obj_true_'+v[0]+'\',\''+v+'\')" src="https://img.new-combats.com/1x1.gif" style="cursor:pointer;position:absolute;top:'+new_top+'px;left:'+new_left+'px;width:'+new_w+'px;height:'+new_h+'px;" />'+zfloor0[rz];			
-		} else {
-			zfloor0[rz] = '<img id="obj_true_'+v[0]+'_2" rz="'+rz+'" oncontextmenu="top.editObjResize(\'#obj_true_'+v[0]+'\',\''+v+'\',\''+iii+'\'); return false" title="'+v[1]+'" onClick="top.editObj(\'#obj_true_'+v[0]+'\',\''+v+'\')" src="https://img.new-combats.com/1x1.gif" style="position:absolute;top:'+new_top+'px;left:'+new_left+'px;width:'+new_w+'px;height:'+new_h+'px;" />'+zfloor0[rz];
-		}
-		r = '<img id="obj_true_'+v[0]+'" rz="'+rz+'" oncontextmenu="top.editObjResize(\'#obj_true_'+v[0]+'\',\''+v[1]+'\',\''+iii+'\'); return false" onClick="top.editObj(\'#obj_true_'+v[0]+'\',\''+v[1]+'\')" title="obj" src="https://img.new-combats.com/i/sprites/'+v[4]+'" class="dObj" style="position:absolute;top:'+new_top+'px;left:'+new_left+'px;width:'+new_w+'px;height:'+new_h+'px;" />';
-	}
-	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] += '<img title="'+v[1]+'" onClick="'+action+'" src="https://img.new-combats.com/1x1.gif" style="cursor:pointer;position:absolute;top:'+new_top+'px;left:'+new_left+'px;width:'+new_w+'px;height:'+new_h+'px;" />';			
-		} else {
-			zfloor0[rz] += '<img title="'+v[1]+'" src="https://img.new-combats.com/1x1.gif" style="position:absolute;top:'+new_top+'px;left:'+new_left+'px;width:'+new_w+'px;height:'+new_h+'px;" />';
-		}
-		r = '<img title="user" src="https://img.new-combats.com/chars/'+v[3]+'/'+v[4]+'.png" class="dUser" style="position:absolute;top:'+new_top+'px;left:'+new_left+'px;width:'+new_w+'px;height:'+new_h+'px;" />';
-	}
-	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 != '�� ��������� <b>'+gotext777+'</b> (<a href="javascript:void(0)" onclick="cancelgoto()">������</a>)') {
-			//document.getElementById('gotext777').style.display = 'block';
-			document.getElementById('gotext777').innerHTML = '�� ��������� <b>'+gotext777+'</b> (<a href="javascript:void(0)" onclick="cancelgoto()">������</a>)';
-		}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
+            };
+        }
 
 
-</script>
+        var sel_id = 0, sel_x = 0, sel_y = 0, sel_s = 1;
 
-<style>
-.cq { background-color:#F2F2F2; }
-.cq:hover { background-color:#d6e4c6; }
-.hintDm {
-	position:absolute;
-	background-color:#E4E4E4;
-	padding:5px;
-	border:1px solid #999;	
-	z-index:1;
-	width:70px;
-}
-.dUser { 
-	max-height:220px;
-	max-width:120px;
-	min-width:30px;
-	min-height:55px;
-	border:		0px solid;
-	padding:	0px;
-	margin:		0px;
-}
-*[onselectstart="return false"] {  
-	-moz-user-select: none;  
-	-o-user-select:none;  
-	-khtml-user-select: none;  
-	-webkit-user-select: none;  
-	-ms-user-select: none;  
-	user-select: none; 
-}
-.dObj {
-	border:		0px solid;
-	padding:	0px;
-	margin:		0px;
-}
-.test1 {
-	text-align: right;
-}
-#pline1 {
-	background-image:url(https://img.new-combats.com/wait3.gif);
-	height:9px;
-	z-index:1000;
-}
+        function goPix(id, x, y) {
 
-</style>
+            $('#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=<?=$id?>&xx=" + x + "&&yy=" + y + "");
+            $.post('dn_editor.php?look=1', {id: <?=$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 += '<a href="main.php?talk=' + talk + '&rnd=0.28626200682069150">������</a><br>';
+                }
+                if (atk == 1) {
+                    t += '<a href="main.php?atack=' + id + '&rnd=0.28626200682069150">�������</a><br>';
+                }
+                if (look == 1) {
+                    t += '��������<br>';
+                }
+                if (take == 1) {
+                    t += '�������<br>';
+                }
+                d.innerHTML = t + '<small style="float:right;"><button style="border: solid 1pt #B0B0B0; font-family: MS Sans Serif; font-size: 10px; color: #191970; MARGIN-BOTTOM: 2px; MARGIN-TOP: 1px;" type="button" onClick="exitDem();">x</button></center>';
+                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';
+            }
+        }
+
+        <?php } if($id > 0) { ?>
+        <?php if (isset($_GET['look'])) {
+            echo '<script>';
+        } if (!isset($_GET['look'])) {
+            echo 'var';
+        }?> objects = {};
+        //i:{id,login,mapPoint,sex,obraz,type,users_p},
+        <?php if (!isset($_GET['look'])) {
+            echo 'var';
+        }?> users = {};
+        <?php if (!isset($_GET['look'])) {
+            echo 'var';
+        }?> objs = {<?php echo $d->genObjects(); ?>};
+        <?php if (!isset($_GET['look'])) {
+            echo 'var';
+        }?> items = {};
+        <?php if (!isset($_GET['look'])) {
+            echo 'var';
+        }?> actions = {};
+        <?php if (!isset($_GET['look'])) {
+            echo 'var';
+        }?> dsee = <?php echo 0 + $d->gs; ?>;
+        <?php if (!isset($_GET['look'])) {
+            echo 'var';
+        }?> 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'
+        }
+        <?php if (!isset($_GET['look'])) {
+            echo 'var';
+        }?> zmap = {5: 894, 8: 0, 12: 0}
+        <?php if (!isset($_GET['look'])) {
+            echo 'var';
+        }?> zfloor0 = {1: '', 2: '', 3: '', 4: '', 5: ''};
+        <?php } if(isset($_GET['look'])){
+            echo '</script>';
+        }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] = '<img id="obj_true_' + v[0] + '_2" rz="' + rz + '" oncontextmenu="top.editObjResize(\'#obj_true_' + v[0] + '\',\'' + v + '\',\'' + iii + '\'); return false" title="' + v[1] + '" onClick="top.editObj(\'#obj_true_' + v[0] + '\',\'' + v + '\')" src="https://img.new-combats.com/1x1.gif" style="cursor:pointer;position:absolute;top:' + new_top + 'px;left:' + new_left + 'px;width:' + new_w + 'px;height:' + new_h + 'px;" />' + zfloor0[rz];
+                } else {
+                    zfloor0[rz] = '<img id="obj_true_' + v[0] + '_2" rz="' + rz + '" oncontextmenu="top.editObjResize(\'#obj_true_' + v[0] + '\',\'' + v + '\',\'' + iii + '\'); return false" title="' + v[1] + '" onClick="top.editObj(\'#obj_true_' + v[0] + '\',\'' + v + '\')" src="https://img.new-combats.com/1x1.gif" style="position:absolute;top:' + new_top + 'px;left:' + new_left + 'px;width:' + new_w + 'px;height:' + new_h + 'px;" />' + zfloor0[rz];
+                }
+                r = '<img id="obj_true_' + v[0] + '" rz="' + rz + '" oncontextmenu="top.editObjResize(\'#obj_true_' + v[0] + '\',\'' + v[1] + '\',\'' + iii + '\'); return false" onClick="top.editObj(\'#obj_true_' + v[0] + '\',\'' + v[1] + '\')" title="obj" src="https://img.new-combats.com/i/sprites/' + v[4] + '" class="dObj" style="position:absolute;top:' + new_top + 'px;left:' + new_left + 'px;width:' + new_w + 'px;height:' + new_h + 'px;" />';
+            }
+            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] += '<img title="' + v[1] + '" onClick="' + action + '" src="https://img.new-combats.com/1x1.gif" style="cursor:pointer;position:absolute;top:' + new_top + 'px;left:' + new_left + 'px;width:' + new_w + 'px;height:' + new_h + 'px;" />';
+                } else {
+                    zfloor0[rz] += '<img title="' + v[1] + '" src="https://img.new-combats.com/1x1.gif" style="position:absolute;top:' + new_top + 'px;left:' + new_left + 'px;width:' + new_w + 'px;height:' + new_h + 'px;" />';
+                }
+                r = '<img title="user" src="https://img.new-combats.com/chars/' + v[3] + '/' + v[4] + '.png" class="dUser" style="position:absolute;top:' + new_top + 'px;left:' + new_left + 'px;width:' + new_w + 'px;height:' + new_h + 'px;" />';
+            }
+            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 != '�� ��������� <b>' + gotext777 + '</b> (<a href="javascript:void(0)" onclick="cancelgoto()">������</a>)') {
+                    //document.getElementById('gotext777').style.display = 'block';
+                    document.getElementById('gotext777').innerHTML = '�� ��������� <b>' + gotext777 + '</b> (<a href="javascript:void(0)" onclick="cancelgoto()">������</a>)';
+                } else if (document.getElementById('gotext777').innerHTML != '' && gotoup777 == 0 && gotext777 == '') {
+                    //document.getElementById('gotext777').style.display = 'none';
+                    document.getElementById('gotext777').innerHTML = '';
+                }
+            }
+        }
+
+
+    </script>
+
+    <style>
+        .cq {
+            background-color: #F2F2F2;
+        }
+
+        .cq:hover {
+            background-color: #d6e4c6;
+        }
+
+        .hintDm {
+            position: absolute;
+            background-color: #E4E4E4;
+            padding: 5px;
+            border: 1px solid #999;
+            z-index: 1;
+            width: 70px;
+        }
+
+        .dUser {
+            max-height: 220px;
+            max-width: 120px;
+            min-width: 30px;
+            min-height: 55px;
+            border: 0px solid;
+            padding: 0px;
+            margin: 0px;
+        }
+
+        *[onselectstart="return false"] {
+            -moz-user-select: none;
+            -o-user-select: none;
+            -khtml-user-select: none;
+            -webkit-user-select: none;
+            -ms-user-select: none;
+            user-select: none;
+        }
+
+        .dObj {
+            border: 0px solid;
+            padding: 0px;
+            margin: 0px;
+        }
+
+        .test1 {
+            text-align: right;
+        }
+
+        #pline1 {
+            background-image: url(https://img.new-combats.com/wait3.gif);
+            height: 9px;
+            z-index: 1000;
+        }
+
+    </style>
 </head>
 
 <body>
 <table width="100%" border="0" cellspacing="0" cellpadding="10">
-  <tr>
-    <td height="40">
-    <div style="padding:10px;">
-        <form method="post" action="?<?=time()?>">
-        <small style="margin:5px; background:#999999;"><span style="color:#CCCCCC">&nbsp; ������# <b><?=$id?></b> &nbsp;</span> </small>
-        <select name="id_dng" id="id_dng">
-        <option value="0">�������� ����� ������</option>
-        <? 	$i = 0;
-            while($i <= 200) {
-            $sp = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "'.$i.'" LIMIT 1'));
-            if(isset($sp['id'])) {
-        ?>
-        <option <? if($id == $i){ echo 'selected'; } ?> value="<?=$i?>"><? if($id == $i){ echo '*'.$i.'*'; }else{ echo $i; } ?></option>
-        <? 
-            }
-            $i++;
-        }
-        ?>
-      </select>
-      <button type="submit">���������</button>
-      </form>
-      <div style="height:23px;" id="textAjaxGo"></div>
-    </div>
-    </td>
-  </tr>
-  <tr>
-    <td height="300" align="center" bgcolor="#F2F2F2">
-    <table width="100%" border="0" cellspacing="0" cellpadding="5">
-      <tr>
-        <td width="500" height="600" align="center" valign="top" id="dngseemap">
-		<? } ?>
-        <a href="dn_editor_bots.php?id_dn=<?=$id?>&xx=<?=$u->info['psevdo_x']?>&&yy=<?=$u->info['psevdo_y']?>" target="fm1">������������� �����</a>
-        <div>
-            <div style="float:left"><a href="javascript:void(0)" onClick="top.sel_s++;top.goPix(top.sel_id,top.sel_x,top.sel_y);">������</a></div>
-            <div style="float:right"><a href="javascript:void(0)" onClick="top.sel_s--;top.goPix(top.sel_id,top.sel_x,top.sel_y);">�������</a></div>
-        </div>
-        <!-- ---------------------------------------------------- -->
-              
-            <div id="Dungeon" class="Dungeon" align="center" style="width:352px;height:240px;padding:0px;margin:10px;">
-            <div id="Dungeon2" onselectstart="return false" style="z-index:10005000; display:none; position:absolute; width: 352px; height: 240px; left: 0px; top: 0px;"></div>
-            <div id="eo" onselectstart="return false" style="display:none;z-index:10000000"></div>
-                <!-- / MAP \ -->
-              <div id="Floor0" class="Floor0">
-                  <div class="Floor1">
-                    <div class="<? if($pd[1]==1){ echo 'LeftSide4_1'; } ?>">
-                      <div class="<? if($pd[2]==1){ echo 'RightSide4_1'; } ?>">
-                        <div id="4_0r" class="<? if($pd[3]==1){ echo 'RightSide4_0'; } ?>">
-                          <div id="4_0l" class="<? if($pd[4]==1){ echo 'LeftSide4_0'; } ?>">
-                            <div id="3_2l" class="<? if($pd[5]==1){ echo 'LeftFront3_2'; } ?>">
-                              <div id="3_2r" class="<? if($pd[6]==1){ echo 'RightFront3_2'; } ?>">
-                                <div class="<? if($pd[7]==1){ echo 'LeftFront3_1'; } ?>">
-                                  <div class="<? if($pd[8]==1){ echo 'RightFront3_1'; } ?>">
-                                    <div id="3_1f" class="<? if($pd[9]==1){ echo 'LeftFront3_0'; } ?>">
-                                      <div id="3_1l" class="<? if($pd[10]==1){ echo 'LeftFront3_1'; } ?>">
-                                        <div id="3_1r" class="<? if($pd[11]==1){ echo 'RightFront3_1'; } ?>">
-                                          <div class="<? if($pd[12]==1){ echo 'LeftSide3_0'; } ?>">
-                                            <div id="3_0l" class="<? if($pd[13]==1){ echo 'RightSide3_0'; } ?>">
-                                              <div id="2_1l" class="<? if($pd[14]==1){ echo 'LeftFront2_1'; } ?>">
-                                                <div id="2_1r" class="<? if($pd[15]==1){ echo 'RightFront2_1'; } ?>">
-                                                  <div id="2_1f" class="<? if($pd[16]==1){ echo 'LeftFront2_0'; } ?>">
-                                                    <div class="<? if($pd[17]==1){ echo 'LeftSide2_0'; } ?>">
-                                                      <div id="2_0l" class="<? if($pd[18]==1){ echo 'RightSide2_0'; } ?>">
-                                                        <div id="1_1l" class="<? if($pd[19]==1){ echo 'LeftFront1_1'; } ?>">
-                                                          <div id="1_1r" class="<? if($pd[20]==1){ echo 'RightFront1_1'; } ?>">
-                                                            <div id="1_1f" class="<? if($pd[21]==1){ echo 'LeftFront1_0'; } ?>">
-                                                              <div class="<? if($pd[22]==1){ echo 'LeftSide1_0'; } ?>">
-                                                                <div id="1_0l" class="<? if($pd[23]==1){ echo 'RightSide1_0'; } ?>">
-                                                                  <div sid="0_1l" class="<? if($pd[24]==1){ echo 'LeftFront0_1'; } ?>">
-                                                                    <div id="0_1r" class="<? if($pd[25]==1){ echo 'RightFront0_1'; } ?>">
-                                                                      <div id="0_0f" class="<? if($pd[26]==1){ echo 'LeftFront0_0'; } ?>">
-                                                                        <div class="<? if($pd[27]==1){ echo 'LeftSide0_0'; } ?>">
-                                                                          <div id="0_0l" class="<? if($pd[28]==1){ echo 'RightSide0_0'; } ?>">
-                                                                            <? if($u->info['admin']==0){ ?>
-                                                                            <div><img src="https://img.new-combats.com/i/1x1.gif" usemap="#ObjectsMap" border="0" /></div>
-                                                                          </div>
-                                                                        </div>
-                                                                      </div>
-                                                                    </div>
-                                                                  </div>
-                                                                </div>
-                                                              </div>
-                                                            </div>
-                                                          </div>
-                                                        </div>
-                                                      </div>
-                                                    </div>
-                                                  </div>
-                                                </div>
-                                              </div>
-                                            </div>
-                                          </div>
-                                        </div>
-                                      </div>
-                                    </div>
-                                  </div>
-                                </div>
-                              </div>
-                            </div>
-                          </div>
-                        </div>
-                      </div>
-                    </div>
-                  </div>
-              </div>
-                <!-- / MAP \ -->
-                <span class="<? if($pd[28]==1){ echo 'RightSide0_0'; } ?>">
-                <? } ?>
-                </span></div>
+    <tr>
+        <td height="40">
+            <div style="padding:10px;">
+                <form method="post" action="?<?= time() ?>">
+                    <small style="margin:5px; background:#999999;"><span
+                                style="color:#CCCCCC">&nbsp; ������# <b><?= $id ?></b> &nbsp;</span> </small>
+                    <select name="id_dng" id="id_dng">
+                        <option value="0">�������� ����� ������</option>
+                        <?php $i = 0;
+                        while ($i <= 200) {
+                            $sp = mysql_fetch_array(
+                                mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . $i . '" LIMIT 1')
+                            );
+                            if (isset($sp['id'])) {
+                                ?>
+                                <option <?php if ($id == $i) {
+                                    echo 'selected';
+                                } ?> value="<?= $i ?>"><?php if ($id == $i) {
+                                        echo '*' . $i . '*';
+                                    } else {
+                                        echo $i;
+                                    } ?></option>
+                                <?php
+                            }
+                            $i++;
+                        }
+                        ?>
+                    </select>
+                    <button type="submit">���������</button>
+                </form>
+                <div style="height:23px;" id="textAjaxGo"></div>
             </div>
-			<script>
-            genMap();
-            </script>
-        <!-- ---------------------------------------------------- -->
-        <? if(!isset($_GET['look'])) { ?>
         </td>
-        <td valign="top">
-        <iframe id="fm1" name="fm1" frameborder="0" src="" width="500px" height="500px"></iframe>
-        <script>
-		var audW = 0,audH = 0;
-		function autoDext(id) {
-			if(id == 0) {
-				var aW = 0,aW = 0, aR = 0;
-				aW = parseInt(top.audW);
-				mW = parseInt($('#ore_w2').val());			
-				aR = aW / 100;
-				aR = (mW / aR - 100);
-				var aR2 = parseInt(audH) / 100;
-				aR = Math.ceil(parseInt(audH) + (aR * aR2)); 								
-				$('#ore_h2').val( aR );
-			}else{
-				
-			}
-		}
-		function saveCord() {
-			top.audW = parseInt($('#ore_w2').val());
-			top.audH = parseInt($('#ore_h2').val());
-		}
-		var utmr = 0;
-		var utmrp = 0;
-		function autoDext2() {
-			//clearTimeout(top.utmr);
-			//top.utmr = setTimeout('autoDext2('+utmrp+')',20); 
-			top.autoDext(utmrp);
-		}
-		</script>
-        <div id="object_resize_editor" style="display:none">
-        <b>�������� �������</b><br>
-        <div>
-        	<div style="display:inline-block;width:100px;">ID:</div>
-            <input id="ore_id" type="text" value=""> (��� ������ ���������: 0)
-        </div>
-        <div>
-        	<div style="display:inline-block;width:100px;">��������:</div>
-            <input id="ore_name" type="text" value="">
-        </div>
-        <div>
-        	<div style="display:inline-block;width:100px;">�����������:</div>
-            <input id="ore_img" type="text" value="">
-        </div>
-        ------[��� ������� �������]-----<br>
-        <div>
-        	<div style="display:inline-block;width:70px;">������:</div>
-            <input id="ore_w" type="text" value=""> (�����) <input id="ore_w2" onKeyUp="utmrp=0;autoDext2();" type="text" value=""> (<a href="javascript:void(0)" onClick="saveCord();">����� ������</a>)
-        </div>
-        <div>
-        	<div style="display:inline-block;width:70px;">������:</div>
-            <input id="ore_h" type="text" value=""> (�����) <input id="ore_h2" type="text" value="">
-        </div>
-        <div>
-        	<div style="display:inline-block;width:70px;">top:</div>
-            <input id="ore_t" type="text" value="">
-        </div>
-        <div>
-        	<div style="display:inline-block;width:70px;">left:</div>
-            <input id="ore_l" type="text" value="">
-        </div>
-        <div>
-        	<div style="display:inline-block;width:70px;">X:</div>
-            <input id="ore_x" type="text" value="">
-        </div>
-        <div>
-        	<div style="display:inline-block;width:70px;">Y:</div>
-            <input id="ore_y" type="text" value="">
-        </div>
-        ------[������ �����������]-----<br>
-        <div>
-        	<div style="display:inline-block;width:70px;">TYPE:</div>
-            <input id="ore_type" type="text" value="">
-        </div>
-        <div>
-        	<div style="display:inline-block;width:70px;">TYPE2:</div>
-            <input id="ore_type2" type="text" value="">
-        </div>
-        <div>
-        	<div style="display:inline-block;width:70px;">S:</div>
-            <input id="ore_s" type="text" value="">
-        </div>
-        <div>
-        	<div style="display:inline-block;width:70px;">S2:</div>
-            <input id="ore_s2" type="text" value="">
-        </div>
-        <? $i = 1; while($i <= 4) { ?>
-        <div>
-        	<div style="display:inline-block;width:70px;">OS<?=$i?>:</div>
-            <input id="ore_os<?=$i?>" type="text" value="">
-        </div>
-        <? $i++; } ?>
-        <div>
-        	<div style="display:inline-block;width:70px;">FIX_X_Y:</div>
-            <input id="ore_fix_x_y" type="text" value="">
-        </div>
-        <a onClick="ore_save_obj()" href="javascript:void(0)">��������� / �������� ������</a><br>
-        -------------------------------------<br>
-        <a onClick="ore_delete_obj()" href="javascript:void(0)">������� ������</a>        
-        </div>
+    </tr>
+    <tr>
+        <td height="300" align="center" bgcolor="#F2F2F2">
+            <table width="100%" border="0" cellspacing="0" cellpadding="5">
+                <tr>
+                    <td width="500" height="600" align="center" valign="top" id="dngseemap">
+                        <?php } ?>
+                        <a href="dn_editor_bots.php?id_dn=<?= $id ?>&xx=<?= $u->info['psevdo_x'] ?>&&yy=<?= $u->info['psevdo_y'] ?>"
+                           target="fm1">������������� �����</a>
+                        <div>
+                            <div style="float:left"><a href="javascript:void(0)"
+                                                       onClick="top.sel_s++;top.goPix(top.sel_id,top.sel_x,top.sel_y);">������</a>
+                            </div>
+                            <div style="float:right"><a href="javascript:void(0)"
+                                                        onClick="top.sel_s--;top.goPix(top.sel_id,top.sel_x,top.sel_y);">�������</a>
+                            </div>
+                        </div>
+                        <!-- ---------------------------------------------------- -->
+
+                        <div id="Dungeon" class="Dungeon" align="center"
+                             style="width:352px;height:240px;padding:0px;margin:10px;">
+                            <div id="Dungeon2" onselectstart="return false"
+                                 style="z-index:10005000; display:none; position:absolute; width: 352px; height: 240px; left: 0px; top: 0px;"></div>
+                            <div id="eo" onselectstart="return false" style="display:none;z-index:10000000"></div>
+                            <!-- / MAP \ -->
+                            <div id="Floor0" class="Floor0">
+                                <div class="Floor1">
+                                    <div class="<?php if ($pd[1] == 1) {
+                                        echo 'LeftSide4_1';
+                                    } ?>">
+                                        <div class="<?php if ($pd[2] == 1) {
+                                            echo 'RightSide4_1';
+                                        } ?>">
+                                            <div id="4_0r" class="<?php if ($pd[3] == 1) {
+                                                echo 'RightSide4_0';
+                                            } ?>">
+                                                <div id="4_0l" class="<?php if ($pd[4] == 1) {
+                                                    echo 'LeftSide4_0';
+                                                } ?>">
+                                                    <div id="3_2l" class="<?php if ($pd[5] == 1) {
+                                                        echo 'LeftFront3_2';
+                                                    } ?>">
+                                                        <div id="3_2r" class="<?php if ($pd[6] == 1) {
+                                                            echo 'RightFront3_2';
+                                                        } ?>">
+                                                            <div class="<?php if ($pd[7] == 1) {
+                                                                echo 'LeftFront3_1';
+                                                            } ?>">
+                                                                <div class="<?php if ($pd[8] == 1) {
+                                                                    echo 'RightFront3_1';
+                                                                } ?>">
+                                                                    <div id="3_1f" class="<?php if ($pd[9] == 1) {
+                                                                        echo 'LeftFront3_0';
+                                                                    } ?>">
+                                                                        <div id="3_1l" class="<?php if ($pd[10] == 1) {
+                                                                            echo 'LeftFront3_1';
+                                                                        } ?>">
+                                                                            <div id="3_1r" class="<?php if ($pd[11] == 1) {
+                                                                                echo 'RightFront3_1';
+                                                                            } ?>">
+                                                                                <div class="<?php if ($pd[12] == 1) {
+                                                                                    echo 'LeftSide3_0';
+                                                                                } ?>">
+                                                                                    <div id="3_0l"
+                                                                                         class="<?php if ($pd[13] == 1) {
+                                                                                             echo 'RightSide3_0';
+                                                                                         } ?>">
+                                                                                        <div id="2_1l"
+                                                                                             class="<?php if ($pd[14] == 1) {
+                                                                                                 echo 'LeftFront2_1';
+                                                                                             } ?>">
+                                                                                            <div id="2_1r"
+                                                                                                 class="<?php if ($pd[15] == 1) {
+                                                                                                     echo 'RightFront2_1';
+                                                                                                 } ?>">
+                                                                                                <div id="2_1f"
+                                                                                                     class="<?php if ($pd[16] == 1) {
+                                                                                                         echo 'LeftFront2_0';
+                                                                                                     } ?>">
+                                                                                                    <div class="<?php if ($pd[17] == 1) {
+                                                                                                        echo 'LeftSide2_0';
+                                                                                                    } ?>">
+                                                                                                        <div id="2_0l"
+                                                                                                             class="<?php if ($pd[18] == 1) {
+                                                                                                                 echo 'RightSide2_0';
+                                                                                                             } ?>">
+                                                                                                            <div id="1_1l"
+                                                                                                                 class="<?php if ($pd[19] == 1) {
+                                                                                                                     echo 'LeftFront1_1';
+                                                                                                                 } ?>">
+                                                                                                                <div id="1_1r"
+                                                                                                                     class="<?php if ($pd[20] == 1) {
+                                                                                                                         echo 'RightFront1_1';
+                                                                                                                     } ?>">
+                                                                                                                    <div id="1_1f"
+                                                                                                                         class="<?php if ($pd[21] == 1) {
+                                                                                                                             echo 'LeftFront1_0';
+                                                                                                                         } ?>">
+                                                                                                                        <div class="<?php if ($pd[22] == 1) {
+                                                                                                                            echo 'LeftSide1_0';
+                                                                                                                        } ?>">
+                                                                                                                            <div id="1_0l"
+                                                                                                                                 class="<?php if ($pd[23] == 1) {
+                                                                                                                                     echo 'RightSide1_0';
+                                                                                                                                 } ?>">
+                                                                                                                                <div sid="0_1l"
+                                                                                                                                     class="<?php if ($pd[24] == 1) {
+                                                                                                                                         echo 'LeftFront0_1';
+                                                                                                                                     } ?>">
+                                                                                                                                    <div id="0_1r"
+                                                                                                                                         class="<?php if ($pd[25] == 1) {
+                                                                                                                                             echo 'RightFront0_1';
+                                                                                                                                         } ?>">
+                                                                                                                                        <div id="0_0f"
+                                                                                                                                             class="<?php if ($pd[26] == 1) {
+                                                                                                                                                 echo 'LeftFront0_0';
+                                                                                                                                             } ?>">
+                                                                                                                                            <div class="<?php if ($pd[27] == 1) {
+                                                                                                                                                echo 'LeftSide0_0';
+                                                                                                                                            } ?>">
+                                                                                                                                                <div id="0_0l"
+                                                                                                                                                     class="<?php if ($pd[28] == 1) {
+                                                                                                                                                         echo 'RightSide0_0';
+                                                                                                                                                     } ?>">
+                                                                                                                                                    <?php if ($u->info['admin'] == 0){ ?>
+                                                                                                                                                    <div>
+                                                                                                                                                        <img src="https://img.new-combats.com/i/1x1.gif"
+                                                                                                                                                             usemap="#ObjectsMap"
+                                                                                                                                                             border="0"/>
+                                                                                                                                                    </div>
+                                                                                                                                                </div>
+                                                                                                                                            </div>
+                                                                                                                                        </div>
+                                                                                                                                    </div>
+                                                                                                                                </div>
+                                                                                                                            </div>
+                                                                                                                        </div>
+                                                                                                                    </div>
+                                                                                                                </div>
+                                                                                                            </div>
+                                                                                                        </div>
+                                                                                                    </div>
+                                                                                                </div>
+                                                                                            </div>
+                                                                                        </div>
+                                                                                    </div>
+                                                                                </div>
+                                                                            </div>
+                                                                        </div>
+                                                                    </div>
+                                                                </div>
+                                                            </div>
+                                                        </div>
+                                                    </div>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                            <!-- / MAP \ -->
+                            <span class="<?php if ($pd[28] == 1) {
+                                echo 'RightSide0_0';
+                            } ?>">
+                <?php } ?>
+                </span></div>
+                        </div>
+                        <script>
+                            genMap();
+                        </script>
+                        <!-- ---------------------------------------------------- -->
+                        <?php if (isset($_GET['look'])) {
+                            return;
+                        } ?>
+                    </td>
+                    <td valign="top">
+                        <iframe id="fm1" name="fm1" frameborder="0" src="" width="500px" height="500px"></iframe>
+                        <script>
+                            var audW = 0, audH = 0;
+
+                            function autoDext(id) {
+                                if (id == 0) {
+                                    var aW = 0, aW = 0, aR = 0;
+                                    aW = parseInt(top.audW);
+                                    mW = parseInt($('#ore_w2').val());
+                                    aR = aW / 100;
+                                    aR = (mW / aR - 100);
+                                    var aR2 = parseInt(audH) / 100;
+                                    aR = Math.ceil(parseInt(audH) + (aR * aR2));
+                                    $('#ore_h2').val(aR);
+                                } else {
+
+                                }
+                            }
+
+                            function saveCord() {
+                                top.audW = parseInt($('#ore_w2').val());
+                                top.audH = parseInt($('#ore_h2').val());
+                            }
+
+                            var utmr = 0;
+                            var utmrp = 0;
+
+                            function autoDext2() {
+                                //clearTimeout(top.utmr);
+                                //top.utmr = setTimeout('autoDext2('+utmrp+')',20);
+                                top.autoDext(utmrp);
+                            }
+                        </script>
+                        <div id="object_resize_editor" style="display:none">
+                            <b>�������� �������</b><br>
+                            <div>
+                                <div style="display:inline-block;width:100px;">ID:</div>
+                                <input id="ore_id" type="text" value=""> (��� ������ ���������: 0)
+                            </div>
+                            <div>
+                                <div style="display:inline-block;width:100px;">��������:</div>
+                                <input id="ore_name" type="text" value="">
+                            </div>
+                            <div>
+                                <div style="display:inline-block;width:100px;">�����������:</div>
+                                <input id="ore_img" type="text" value="">
+                            </div>
+                            ------[��� ������� �������]-----<br>
+                            <div>
+                                <div style="display:inline-block;width:70px;">������:</div>
+                                <input id="ore_w" type="text" value=""> (�����) <input id="ore_w2"
+                                                                                       onKeyUp="utmrp=0;autoDext2();"
+                                                                                       type="text" value=""> (<a
+                                        href="javascript:void(0)" onClick="saveCord();">����� ������</a>)
+                            </div>
+                            <div>
+                                <div style="display:inline-block;width:70px;">������:</div>
+                                <input id="ore_h" type="text" value=""> (�����) <input id="ore_h2" type="text" value="">
+                            </div>
+                            <div>
+                                <div style="display:inline-block;width:70px;">top:</div>
+                                <input id="ore_t" type="text" value="">
+                            </div>
+                            <div>
+                                <div style="display:inline-block;width:70px;">left:</div>
+                                <input id="ore_l" type="text" value="">
+                            </div>
+                            <div>
+                                <div style="display:inline-block;width:70px;">X:</div>
+                                <input id="ore_x" type="text" value="">
+                            </div>
+                            <div>
+                                <div style="display:inline-block;width:70px;">Y:</div>
+                                <input id="ore_y" type="text" value="">
+                            </div>
+                            ------[������ �����������]-----<br>
+                            <div>
+                                <div style="display:inline-block;width:70px;">TYPE:</div>
+                                <input id="ore_type" type="text" value="">
+                            </div>
+                            <div>
+                                <div style="display:inline-block;width:70px;">TYPE2:</div>
+                                <input id="ore_type2" type="text" value="">
+                            </div>
+                            <div>
+                                <div style="display:inline-block;width:70px;">S:</div>
+                                <input id="ore_s" type="text" value="">
+                            </div>
+                            <div>
+                                <div style="display:inline-block;width:70px;">S2:</div>
+                                <input id="ore_s2" type="text" value="">
+                            </div>
+                            <?php $i = 1;
+                            while ($i <= 4) { ?>
+                                <div>
+                                    <div style="display:inline-block;width:70px;">OS<?= $i ?>:</div>
+                                    <input id="ore_os<?= $i ?>" type="text" value="">
+                                </div>
+                                <?php $i++;
+                            } ?>
+                            <div>
+                                <div style="display:inline-block;width:70px;">FIX_X_Y:</div>
+                                <input id="ore_fix_x_y" type="text" value="">
+                            </div>
+                            <a onClick="ore_save_obj()" href="javascript:void(0)">��������� / �������� ������</a><br>
+                            -------------------------------------<br>
+                            <a onClick="ore_delete_obj()" href="javascript:void(0)">������� ������</a>
+                        </div>
+                    </td>
+                    <td>
+                        <div style="overflow:auto; height:410px">
+                            <?php
+                            if (!isset($test_id)) {
+                                echo '<br><br><br><br><br><center>������ �� ����������</center>';
+                            } 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']] = '<img class="cq" onClick="top.goPix(' . $pl['id'] . ',' . $pl['x'] . ',' . $pl['y'] . ');" id="px_' . $pl['id'] . '" style="' . $style . '" width="20" height="20" src="https://img.new-combats.com/1x1.gif" title="X: ' . $pl['x'] . ', Y: ' . $pl['y'] . '">';
+                                }
+
+                                echo '<center><b>����� ������</b> (X: [' . $min_x . '] - [' . $max_x . '] , Y: [' . $min_y . '] - [' . $max_y . '])</center><br><br>';
+
+                                $r = '<table border="0" cellspacing="0" cellpadding="0">';
+                                $i = $max_y;
+                                while ($i >= $min_y) {
+                                    $j = $min_x;
+                                    $r .= '<tr>';
+                                    while ($j <= $max_x) {
+                                        if (isset($map[$j][$i])) {
+                                            $r .= '<td>' . $map[$j][$i] . '</td>';
+                                        } else {
+                                            $r .= '<td><img style="vertical-align:bottom" width="1" height="1" src="https://img.new-combats.com/1x1.gif"></td>';
+                                        }
+                                        $j++;
+                                    }
+                                    $r .= '</tr>';
+                                    $i--;
+                                }
+                                $r .= '</table>';
+
+                                echo $r;
+                            }
+                            ?>
+                        </div>
+                    </td>
+                </tr>
+            </table>
+
         </td>
-        <td><div style="overflow:auto; height:410px">
-          <?
-    if(!isset($test_id)) {
-        echo '<br><br><br><br><br><center>������ �� ����������</center>';
-    }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']] = '<img class="cq" onClick="top.goPix('.$pl['id'].','.$pl['x'].','.$pl['y'].');" id="px_'.$pl['id'].'" style="'.$style.'" width="20" height="20" src="https://img.new-combats.com/1x1.gif" title="X: '.$pl['x'].', Y: '.$pl['y'].'">';
-		}
-		
-        echo '<center><b>����� ������</b> (X: ['.$min_x.'] - ['.$max_x.'] , Y: ['.$min_y.'] - ['.$max_y.'])</center><br><br>';
-		
-		$r = '<table border="0" cellspacing="0" cellpadding="0">';		
-		$i = $max_y;
-		while($i >= $min_y) {
-			$j = $min_x;
-			$r .= '<tr>';
-			while($j <= $max_x) {
-				if(isset($map[$j][$i])) {
-					$r .= '<td>'.$map[$j][$i].'</td>';
-				}else{	
-					$r .= '<td><img style="vertical-align:bottom" width="1" height="1" src="https://img.new-combats.com/1x1.gif"></td>';	
-				}
-				$j++;
-			}
-			$r .= '</tr>';	
-			$i--;
-		}
-		$r .= '</table>';
-		
-		echo $r;
-    }
-    ?>
-        </div></td>
-      </tr>
-      </table>
-        
-    </td>
-  </tr>
+    </tr>
 </table>
 </body>
 </html>
-<? } ?>
\ No newline at end of file
diff --git a/dn_editor_bots.php b/dn_editor_bots.php
index 5ba63c44..65aaa2c3 100644
--- a/dn_editor_bots.php
+++ b/dn_editor_bots.php
@@ -1,91 +1,92 @@
-<?
-session_start();
-
-function er($e)
-{
-	 global $c;
-	 die('<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"><meta http-equiv="Content-Language" content="ru"><TITLE>��������� ������</TITLE></HEAD><BODY text="#FFFFFF"><p><font color=black>��������� ������: <pre>'.$e.'</pre><b><p><a href="https://'.$c[0].'/">�����</b></a><HR><p align="right">(c) <a href="https://'.$c[0].'/">'.$c[1].'</a></p></body></html>');
-}
-
-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);
+<?php
+# Admin Only Area
+const GAME = true;
 
 include_once('_incl_data/__config.php');
 include_once('_incl_data/class/__db_connect.php');
-include_once('_incl_data/class/__user.php');
+define('IP', UserIp::get());
+$u = User::start();
 
-if( $u->info['admin'] == 0) {
-	die('<meta http-equiv="refresh" content="0; URL=https://new-combats.com/">');
+if (!$u->info['admin']) {
+    die('<meta http-equiv="refresh" content="0; URL=https://new-combats.com/">');
 }
 
-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;
 }
 
 ?>
 <form method="post" action="?gotonew">
-id ������: <input name="id_dn" value="<?=$_POST['id_dn']?>"><br>
-x : <input name="xx" value="<?=$_POST['xx']?>"><br>
-y : <input name="yy" value="<?=$_POST['yy']?>"><br>
-<input type="submit" value="�������">
+    id ������: <input name="id_dn" value="<?= $_POST['id_dn'] ?>"><br>
+    x : <input name="xx" value="<?= $_POST['xx'] ?>"><br>
+    y : <input name="yy" value="<?= $_POST['yy'] ?>"><br>
+    <input type="submit" value="�������">
 </form>
 --------------- ���� -------------:<br>
-<? 
+<?php
 
-if(isset($_POST['new_bot_id'])) {
-	mysql_query('INSERT INTO `dungeon_bots` (`id_bot`,`bot_group`,`for_dn`,`colvo`,`x`,`y`,`atack`,`go_bot`) VALUES ("'.mysql_real_escape_string($_POST['new_bot_id']).'","'.mysql_real_escape_string($_POST['new_bot_group']).'","'.mysql_real_escape_string($_POST['id_dn']).'","'.mysql_real_escape_string($_POST['new_bot_colvo']).'", "'.mysql_real_escape_string($_POST['xx']).'","'.mysql_real_escape_string($_POST['yy']).'","1","'.mysql_real_escape_string($_POST['new_bot_go']).'")');
-}elseif(isset($_GET['delete'])) {
-	mysql_query('DELETE FROM `dungeon_bots` WHERE `id2` = "'.mysql_real_escape_string($_GET['delete']).'" LIMIT 1');
+if (isset($_POST['new_bot_id'])) {
+    mysql_query(
+        'INSERT INTO `dungeon_bots` (`id_bot`,`bot_group`,`for_dn`,`colvo`,`x`,`y`,`atack`,`go_bot`) VALUES ("' . mysql_real_escape_string(
+            $_POST['new_bot_id']
+        ) . '","' . mysql_real_escape_string($_POST['new_bot_group']) . '","' . mysql_real_escape_string(
+            $_POST['id_dn']
+        ) . '","' . mysql_real_escape_string($_POST['new_bot_colvo']) . '", "' . mysql_real_escape_string(
+            $_POST['xx']
+        ) . '","' . mysql_real_escape_string($_POST['yy']) . '","1","' . mysql_real_escape_string(
+            $_POST['new_bot_go']
+        ) . '")'
+    );
+} elseif (isset($_GET['delete'])) {
+    mysql_query('DELETE FROM `dungeon_bots` WHERE `id2` = "' . mysql_real_escape_string($_GET['delete']) . '" LIMIT 1');
 }
 
-$sp = mysql_query('SELECT * FROM `dungeon_bots` WHERE `dn` = "0" AND `for_dn` = "'.mysql_real_escape_string($_POST['id_dn']).'" AND `x` = "'.mysql_real_escape_string($_POST['xx']).'" AND `y` = "'.mysql_real_escape_string($_POST['yy']).'" ORDER BY `id2`');
+$sp = mysql_query(
+    'SELECT * FROM `dungeon_bots` WHERE `dn` = "0" AND `for_dn` = "' . mysql_real_escape_string(
+        $_POST['id_dn']
+    ) . '" AND `x` = "' . mysql_real_escape_string($_POST['xx']) . '" AND `y` = "' . mysql_real_escape_string(
+        $_POST['yy']
+    ) . '" ORDER BY `id2`'
+);
 $i = 1;
-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'].'] <b>'.$bot['login'].'</b> [id '.$bot['id'].'] , [x'.$pl['colvo'].'] <a href="?delete='.$pl['id2'].'&id_dn='.$pl['for_dn'].'&xx='.$pl['x'].'&yy='.$pl['y'].'">�������</a>  <br>';
-	 } 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 ' <strong>'.$bot['login'].'</strong> [id '.$bot['id'].'], ';
-			   $jjj++;
-		  }
-		  echo ' [x'.$pl['colvo'].'] <a href="?delete='.$pl['id2'].'&id_dn='.$pl['for_dn'].'&xx='.$pl['x'].'&yy='.$pl['y'].'">�������</a><br/>';
-	 }
-	$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'] . '] <b>' . $bot['login'] . '</b> [id ' . $bot['id'] . '] , [x' . $pl['colvo'] . '] <a href="?delete=' . $pl['id2'] . '&id_dn=' . $pl['for_dn'] . '&xx=' . $pl['x'] . '&yy=' . $pl['y'] . '">�������</a>  <br>';
+    } 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 ' <strong>' . $bot['login'] . '</strong> [id ' . $bot['id'] . '], ';
+            }
+            $jjj++;
+        }
+        echo ' [x' . $pl['colvo'] . '] <a href="?delete=' . $pl['id2'] . '&id_dn=' . $pl['for_dn'] . '&xx=' . $pl['x'] . '&yy=' . $pl['y'] . '">�������</a><br/>';
+    }
+    $i++;
 }
 
 echo '<hr>';
 ?>
 <form method="post" action="?gotonew">
-�������� ������:<br />
-<input type="hidden" name="id_dn" value="<?=$_POST['id_dn']?>">
-<input type="hidden" name="xx" value="<?=$_POST['xx']?>">
-<input type="hidden" name="yy" value="<?=$_POST['yy']?>">
-ID ����: <input name="new_bot_id" value="<?=$_POST['new_bot_id']?>"><br />
-��������� ����: <input name="new_bot_group" value="<?=$_POST['new_bot_group']?>"><br />
-����������: <input name="new_bot_colvo" value="<?=(0+$_POST['new_bot_colvo'])?>"><br />
-������������: <input name="new_bot_go" value="<?=(0+$_POST['new_bot_go'])?>"> (0 - ���, 1 - ��)<br />
-<input type="submit" value="���������" />
+    �������� ������:<br/>
+    <input type="hidden" name="id_dn" value="<?= $_POST['id_dn'] ?>">
+    <input type="hidden" name="xx" value="<?= $_POST['xx'] ?>">
+    <input type="hidden" name="yy" value="<?= $_POST['yy'] ?>">
+    ID ����: <input name="new_bot_id" value="<?= $_POST['new_bot_id'] ?>"><br/>
+    ��������� ����: <input name="new_bot_group" value="<?= $_POST['new_bot_group'] ?>"><br/>
+    ����������: <input name="new_bot_colvo" value="<?= (0 + $_POST['new_bot_colvo']) ?>"><br/>
+    ������������: <input name="new_bot_go" value="<?= (0 + $_POST['new_bot_go']) ?>"> (0 - ���, 1 - ��)<br/>
+    <input type="submit" value="���������"/>
 </form>
\ No newline at end of file
diff --git a/dn_editor_botsAll.php b/dn_editor_botsAll.php
index 7f8eb2bd..4c1a9500 100644
--- a/dn_editor_botsAll.php
+++ b/dn_editor_botsAll.php
@@ -1,63 +1,45 @@
-<?
-session_start();
-
-function er($e)
-{
-	 global $c;
-	 die('<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"><meta http-equiv="Content-Language" content="ru"><TITLE>��������� ������</TITLE></HEAD><BODY text="#FFFFFF"><p><font color=black>��������� ������: <pre>'.$e.'</pre><b><p><a href="https://'.$c[0].'/">�����</b></a><HR><p align="right">(c) <a href="https://'.$c[0].'/">'.$c[1].'</a></p></body></html>');
-}
-
-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);
+<?php
+# Admin Only Area
+const GAME = true;
 
 include_once('_incl_data/__config.php');
 include_once('_incl_data/class/__db_connect.php');
-include_once('_incl_data/class/__user.php');
+define('IP', UserIp::get());
+$u = User::start();
 
-if(!isset($u->info['id']) || $u->info['ip'] != IP || $u->info['admin'] == 0) {
-	die('<meta http-equiv="refresh" content="0; URL=https://new-combats.com/">');
+if (!isset($u->info['id']) || $u->info['ip'] != IP || !$u->info['admin']) {
+    die('<meta http-equiv="refresh" content="0; URL=https://new-combats.com/">');
 }
 
-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;
 }
 
 ?>
 <form method="post" action="?gotonew">
-id ������: <input name="id_dn" value="<?=$_POST['id_dn']?>"><br>
-botlogin: <input name="botlogin" value="<?=$_POST['botlogin']?>"><br>
-<input type="submit" value="�������">
+    id ������: <label>
+        <input name="id_dn" value="<?= $_POST['id_dn'] ?>">
+    </label><br>
+    botlogin: <label>
+        <input name="botlogin" value="<?= $_POST['botlogin'] ?>">
+    </label><br>
+    <input type="submit" value="�������">
 </form>
 --------------- ���� -------------:<br>
-<?
+<?php
 $sp = mysql_query('SELECT * FROM `test_bot` WHERE login LIKE `%������ ������ [8]%`');
 $i = 1;
-while($pl = mysql_fetch_array($sp)) {
-	//$bot = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "'.$pl['id'].'" LIMIT 1'));
-	//echo $i.'.['.$pl['id'].'] <b>[login:'.$bot['login'].']</b> [id '.$bot['id'].'] , [stats:'.$bot['stats'].'] '.$bot['obraz'].'&level='.$bot['level'].'<br>';
-	echo "<br/>+<br/>";
-	$i++;
+while ($pl = mysql_fetch_array($sp)) {
+    echo "<br/>+<br/>";
+    $i++;
 }
-?> 
+?>
 
-</hr>
- 
\ No newline at end of file
+<hr>
diff --git a/dn_editor_bots_itms.php b/dn_editor_bots_itms.php
index 03581cd6..1dc4b25a 100644
--- a/dn_editor_bots_itms.php
+++ b/dn_editor_bots_itms.php
@@ -1,86 +1,73 @@
-<?
-session_start();
-
-function er($e)
-{
-	 global $c;
-	 die('<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"><meta http-equiv="Content-Language" content="ru"><TITLE>��������� ������</TITLE></HEAD><BODY text="#FFFFFF"><p><font color=black>��������� ������: <pre>'.$e.'</pre><b><p><a href="https://'.$c[0].'/">�����</b></a><HR><p align="right">(c) <a href="https://'.$c[0].'/">'.$c[1].'</a></p></body></html>');
-}
-
-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);
+<?php
+# Admin Only Area
+const GAME = true;
 
 include_once('_incl_data/__config.php');
 include_once('_incl_data/class/__db_connect.php');
-include_once('_incl_data/class/__user.php');
+define('IP', UserIp::get());
+$u = User::start();
 
-if($u->info['admin'] == 0) {
-	die('<meta http-equiv="refresh" content="0; URL=https://new-combats.com/">');
+if (!$u->info['admin']) {
+    die('<meta http-equiv="refresh" content="0; URL=https://new-combats.com/">');
 }
 
 ?>
-<form method="post" action="?gotonew">
-id ����: <input name="id_bot" value="<?=$_POST['id_bot']?>"><br>
-<input type="submit" value="�������">
-</form>
---------------- ��� -------------<br>
-<?
-$pl = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "'.mysql_real_escape_string($_POST['id_bot']).'" LIMIT 1'));
-if(isset($pl['id'])) {
-	
-	if(isset($_GET['save'])) {
-		
-		mysql_query('UPDATE `test_bot` SET
+    <form method="post" action="?gotonew">
+        id ����: <input name="id_bot" value="<?= $_POST['id_bot'] ?>"><br>
+        <input type="submit" value="�������">
+    </form>
+    --------------- ��� -------------<br>
+<?php
+$pl = mysql_fetch_array(
+    mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . mysql_real_escape_string($_POST['id_bot']) . '" LIMIT 1')
+);
+if (isset($pl['id'])) {
+
+    if (isset($_GET['save'])) {
+
+        mysql_query(
+            'UPDATE `test_bot` SET
+		    `login` = "' . mysql_real_escape_string($_POST['login']) . '",
+			`obraz` = "' . mysql_real_escape_string($_POST['obraz']) . '",
+			`level` = "' . mysql_real_escape_string($_POST['level']) . '",
+			`sex` = "' . mysql_real_escape_string($_POST['sex']) . '",
+			`name` = "' . mysql_real_escape_string($_POST['name']) . '",
+			`agressor` = "' . mysql_real_escape_string($_POST['agressor']) . '",
+			`expB` = "' . mysql_real_escape_string($_POST['expB']) . '",
+			`stats` = "' . mysql_real_escape_string($_POST['stats']) . '",
+			`itemsUse` = "' . mysql_real_escape_string($_POST['itemsUse']) . '",
+			`p_items` = "' . mysql_real_escape_string($_POST['p_items']) . '" WHERE `id` = "' . $pl['id'] . '"
 			
-			`login` = "'.mysql_real_escape_string($_POST['login']).'",
-			`obraz` = "'.mysql_real_escape_string($_POST['obraz']).'",
-			`level` = "'.mysql_real_escape_string($_POST['level']).'",
-			`sex` = "'.mysql_real_escape_string($_POST['sex']).'",
-			`name` = "'.mysql_real_escape_string($_POST['name']).'",
-			`agressor` = "'.mysql_real_escape_string($_POST['agressor']).'",
-			`expB` = "'.mysql_real_escape_string($_POST['expB']).'",
-			`stats` = "'.mysql_real_escape_string($_POST['stats']).'",
-			`itemsUse` = "'.mysql_real_escape_string($_POST['itemsUse']).'",
-			`p_items` = "'.mysql_real_escape_string($_POST['p_items']).'" WHERE `id` = "'.$pl['id'].'"
-			
-		LIMIT 1');
-		
-		$pl = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "'.mysql_real_escape_string($_POST['id_bot']).'" LIMIT 1'));
-		
-	}
-	
-?>
-<form method="post" action="?gotonew&save"><input type="hidden" name="id_bot" value="<?=$_POST['id_bot']?>">
-�����: <input name="login" value="<?=$pl['login']?>"><br />
-�����: <input name="obraz" value="<?=$pl['obraz']?>"><br />
-�������: <input name="level" value="<?=$pl['level']?>"><br />
-���: <input name="sex" value="<?=$pl['sex']?>"> (0 - ���. , 1 - ���.)<br />
-���: <input name="name" value="<?=$pl['name']?>"><br />
-��������: <input name="agressor" value="<?=$pl['agressor']?>"> (0-100%)<br />
-���� (%): <input name="expB" value="<?=$pl['expB']?>"><br />
-�����:<br />
-<textarea rows="5" cols="75" name="stats"><?=$pl['stats']?></textarea>
-<br />
-�������� (�� ����, 2605 - ���������� ������. ����������� ����� ������� id ��������):<br />
-<textarea rows="5" cols="75" name="itemsUse"><?=$pl['itemsUse']?></textarea>
-<br />
-�������� ������� ������ � ����:<br />
-<textarea rows="5" cols="75" name="p_items"><?=$pl['p_items']?></textarea>
-<br><input type="submit" value="���������"></form>
-<?
-}elseif(isset($_POST['id_bot'])) {
-	echo '��� �� ������';
+		LIMIT 1'
+        );
+
+        $pl = mysql_fetch_array(
+            mysql_query(
+                'SELECT * FROM `test_bot` WHERE `id` = "' . mysql_real_escape_string($_POST['id_bot']) . '" LIMIT 1'
+            )
+        );
+
+    }
+
+    ?>
+    <form method="post" action="?gotonew&save"><input type="hidden" name="id_bot" value="<?= $_POST['id_bot'] ?>">
+        �����: <input name="login" value="<?= $pl['login'] ?>"><br/>
+        �����: <input name="obraz" value="<?= $pl['obraz'] ?>"><br/>
+        �������: <input name="level" value="<?= $pl['level'] ?>"><br/>
+        ���: <input name="sex" value="<?= $pl['sex'] ?>"> (0 - ���. , 1 - ���.)<br/>
+        ���: <input name="name" value="<?= $pl['name'] ?>"><br/>
+        ��������: <input name="agressor" value="<?= $pl['agressor'] ?>"> (0-100%)<br/>
+        ���� (%): <input name="expB" value="<?= $pl['expB'] ?>"><br/>
+        �����:<br/>
+        <textarea rows="5" cols="75" name="stats"><?= $pl['stats'] ?></textarea>
+        <br/>
+        �������� (�� ����, 2605 - ���������� ������. ����������� ����� ������� id ��������):<br/>
+        <textarea rows="5" cols="75" name="itemsUse"><?= $pl['itemsUse'] ?></textarea>
+        <br/>
+        �������� ������� ������ � ����:<br/>
+        <textarea rows="5" cols="75" name="p_items"><?= $pl['p_items'] ?></textarea>
+        <br><input type="submit" value="���������"></form>
+    <?php
+} elseif (isset($_POST['id_bot'])) {
+    echo '��� �� ������';
 }
-?>
\ 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 @@
-<?
-if(!defined('GAME'))
-{
-	die();
-}
-
-class dungeon
-{
-	public $bs,$info,$see,$error,$gs = 1,$map = array(
-				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($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')
-						{
-							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 .= '&quot;'.$trm['name'].'&quot;, ';	
-							}
-						}
-					}
-				}
-				$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($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')
-						{
-							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 @@
-<?
+<?php
 include_once('_incl_data/__config.php');
-define('GAME',true);
+const GAME = true;
 include_once('_incl_data/class/__db_connect.php');
-include_once('_incl_data/class/__user.php');
 
-if(isset($_GET['for'])) {
-	
-	//
-	
-	function array_to_sql($t,$m,$id_name,$id) {
-		$r = '';
-		//
-		$k = array_keys($m);
-		$a = '';
-		$b = '';
-		$i = 0;
-		while( $i < count($k) ) {
-			$a .= ',`'.$k[$i].'`';
-			if( $id != false && $k[$i] == $id_name ) {
-				$b .= ','.$id.'';
-			}else{
-				$b .= ',"'.str_replace('"','&quot;',$m[$k[$i]]).'"';
-			}
-			$i++;
-		}
-		$a = ltrim($a,',');
-		$b = ltrim($b,',');
-		//
-		$r = 'INSERT INTO `'.$t.'` ( '.$a.' ) VALUES ( '.$b.' );';
-		//
-		return $r;
-	}
-	
-	$dng = (int)$_GET['dng'];
-	
-	$sql = '';
-	
-	$test_bot = array();
-	$dungeon_bots = array();
-	$dungeon_items = array();
-	$dungeon_obj = array();
-	$dungeon_map = array();
-	$items_main = array();
-	$eff_main = array();
-	
-	//
-	
-	if( $_GET['step'] == 1 ) {
-		$sp = mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "'.mysql_real_escape_string($dng).'" ORDER BY `x` ASC, `y` ASC');
-		while( $pl = mysql_fetch_assoc($sp) ) {
-			$sql .= array_to_sql('dungeon_map',$pl,'id','NULL').'<hr>';
-		}
-	}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').'<hr>';
-		}
-	}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'].'"').'<hr>';
-				}
-				$sql .= array_to_sql('dungeon_bots',$pl,'id2','NULL').'<hr>';
-			}
-		}
-	}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('"', '&quot;', $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') . '<hr>';
+    }
+} 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') . '<hr>';
+    }
+} 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'] . '"') . '<hr>';
+            }
+            $sql .= array_to_sql('dungeon_bots', $pl, 'id2', 'NULL') . '<hr>';
+        }
+    }
+}
+echo $sql;
diff --git a/do.php b/do.php
deleted file mode 100644
index 07f467a4..00000000
--- a/do.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?
-if(!defined('GAME'))
-{
-	die();
-}
-
-$login = mysql_query('SELECT * FROM `users` WHERE `login` = "'.$u->info['login'].'"LIMIT 1');
-
-mysql_query('');
\ No newline at end of file
diff --git a/dress.php b/dress.php
deleted file mode 100644
index f49a59a5..00000000
--- a/dress.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-define('GAME',true);
-
-include('_incl_data/__config.php');
-include('_incl_data/class/__db_connect.php');
-include('_incl_data/class/__chat_class.php');
-include('_incl_data/class/__filter_class.php');
-include('_incl_data/class/__user.php');
-
-if(isset($_GET['upg'])) {
-	$sp = mysql_query('SELECT * FROM `items_main` WHERE `price1` = 0');
-	while( $pl = mysql_fetch_array($sp) ) {
-		$pl2 = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_prc` WHERE `id` = "'.$pl['id'].'" LIMIT 1'));
-		if( $pl2['price1'] != $pl['price1'] ) {
-			mysql_query('UPDATE `items_main` SET `price1` = "'.$pl2['price1'].'" WHERE `id` = "'.$pl['id'].'" LIMIT 1');
-		}
-	}
-	die();
-}
-
-
-$urla = explode('?',$_SERVER["REQUEST_URI"]);
-$url = explode('/',$urla[0]);
-
-if( $url[2] == 'js_data' ) {
-	//��������� JS ��������, ���� �����!
-	
-	//
-	die();	
-}
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
-<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
-<meta http-equiv=Cache-Control Content=no-cache>
-<meta http-equiv=PRAGMA content=NO-CACHE>
-<meta http-equiv=Expires Content=0>
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
-<script type="text/javascript" src="https://new-combats.com/js/jquery.js"></script>
-<!-- -->
-<script type="text/javascript" src="https://new-combats.com/dress/js_data"></script>
-<!-- -->
-<script type="text/javascript" src="https://new-combats.com/dress.js"></script>
-<script>
-var u = {
-	info:{
-			'id':0,
-			'login':'����� ���������',
-			'level':0,
-			'up':0,
-			'align':'0',
-			'clan':['','0.gif'],
-			'shadow':'0.gif',
-			'sex':0
-		}
-};
-</script>
-</head>
-<body onLoad="dress.start();" style="padding-top:0px; margin-top:7px; height:100%; background-color:#dedede;">
-<table width="100%" border="0" cellspacing="0" cellpadding="0">
-  <tr>
-    <td>&nbsp;</td>
-  </tr>
-  <tr>
-    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
-      <tr>
-        <td width="300" align="center" valign="top" id="main1">
-        	�����, �����, ������, �������
-        </td>
-        <td valign="top" id="main2">
-        	�����, ������, ����� �� �������, �����, �������, �����, ����
-        </td>
-        <td valign="top" id="main3">
-        	��������, ������������, ��������, ������, ������
-        </td>
-        <td valign="top" id="main4">
-        	���������, �������������� ���������
-        </td>
-      </tr>
-    </table></td>
-  </tr>
-  <tr>
-    <td>�������� � �������������.</td>
-  </tr>
-</table>
-</body>
-</html>
\ No newline at end of file
diff --git a/dz.php b/dz.php
deleted file mode 100644
index 627d389e..00000000
--- a/dz.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-//������� ������� v2.0
-$yaica = '����';
-$skovoroda = '���������';
-$plita = '�����';
-
-$kol = 10;
-$tme = 30;
-
-$end_gotovka = '�� ��� �� � ����������� ������� ';
-
-if ($plita != 1){ // ������� true
-		echo '��������� �����';
-	}else{
-		echo '�� ���� ������ �����';
-	}
-if ($skovoroda == '�����'){ // ������� false
-	echo '���� �����';
-	}else{
-		echo '<br>���� ���������';
-	}
-if ($kol >= 9 ){
-		echo '<br>���� 10 ���'; // ������� true
-	}else{
-		echo '���� �����';
-	}
-if ($skovoroda != $kol + $tme){ 
-		echo '<br>��������� ' .$yaica;//true
-	}else{
-		echo '���������' .$plita;
-	}
-if ($tme == 10 && $kol < 50){
-		echo '�������';  //false
-	}
-	else if ($tme == 30){
-		echo '<br>������� �� ��������� '.$yaica;//true (��� ��������)
-	}else{
-		echo '���������� � ���� '.$yaica;
-	}
-	
-if ($tme = 31 || $kol = 10){ // true ��� ��� � ��������� $tme = false a, $kol = true, ��, � ������ '||' ���������� 1 true 
-		echo '<br>����� ���� �������';
-	}else{
-		echo '����� �����';
-	}
-if ($tme > 41){ //false = ��� �������� � ������� - true
-		echo '$tme�� ����� 33 ����';
-	}
-	else if ($tme == 30){
-		echo '<br>'.$end_gotovka . $yaica;
-	}else{
-		echo '��� ������';
-	}
-?>
\ 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 @@
-<?
+<?php
+# Admin Only Area
 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']) || $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']);
 <!doctype html>
 <html>
 <head>
-<meta charset="windows-1251">
-<title>�������� ��������� � ��������</title>
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
-<script type="text/javascript">
-function MM_jumpMenu(targ,selObj,restore){ //v3.0
-  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
-  if (restore) selObj.selectedIndex=0;
-}
-</script>
+    <meta charset="windows-1251">
+    <title>�������� ��������� � ��������</title>
+    <link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
+    <script type="text/javascript">
+        function MM_jumpMenu(targ, selObj, restore) { //v3.0
+            eval(targ + ".location='" + selObj.options[selObj.selectedIndex].value + "'");
+            if (restore) selObj.selectedIndex = 0;
+        }
+    </script>
 </head>
 
 <body>
-<form method="post" action="/editor_shop.php?sid=<?=$sid.'&r='.$r?>">
-<table width="1000" border="0" align="center" cellpadding="10" cellspacing="0">
-  <tr>
-    <td align="center"><p>�������: 
-      <select name="shop_id" id="shop_id" onChange="MM_jumpMenu('parent',this,0)">
-        <?
-	  
-	  if( isset($_POST['additemnow']) ) {
-			mysql_query('INSERT INTO `items_shop` (
+<form method="post" action="/editor_shop.php?sid=<?= $sid . '&r=' . $r ?>">
+    <table width="1000" border="0" align="center" cellpadding="10" cellspacing="0">
+        <tr>
+            <td align="center"><p>�������:
+                    <select name="shop_id" id="shop_id" onChange="MM_jumpMenu('parent',this,0)">
+                        <?php
+
+                        if (isset($_POST['additemnow'])) {
+                            mysql_query(
+                                'INSERT INTO `items_shop` (
 				`item_id`,`kolvo`,`sid`,`r`,`real`
 			) VALUES (
-				"'.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 '<option ';
-		 if( $pl['sid'] == $sid ) {
-			 echo ' selected="selected" ';
-		 }
-		 echo ' value="/editor_shop.php?sid='.$pl['sid'].'&r='.$r.'">'.$pl['sid'].'</option>'; 
-	  }
-	  ?>
-      </select> 
-      ������ ��������: 
-      <select name="r_id" id="r_id" onChange="MM_jumpMenu('parent',this,0)">
-        <?
-	  $sp = mysql_query('SELECT `r` FROM `items_shop` WHERE `sid` = "'.mysql_real_escape_string($sid).'" GROUP BY `r`');
-	  while( $pl = mysql_fetch_array($sp) ) {
-		 echo '<option ';
-		 if( $pl['r'] == $r ) {
-			 echo ' selected="selected" ';
-		 }
-		 echo ' value="/editor_shop.php?sid='.$sid.'&r='.$pl['r'].'">'.$pl['r'].'</option>'; 
-	  }
-	  ?>
-      </select>
-      </p>
-      <p><a href="/editor_shop.php?sid=<?=$sid?>&r=<?=$r?>">�������� ��������</a><br>
-        <br>
-      </p>
-      <hr>
-    </td>
-  </tr>
-  <tr>
-    <td align="center">�������� ������� (id ��������): <input type="text" value="" name="item_add"> � ���� ������. <input type="submit" name="additemnow" value="�������� � ������� <?=$sid?>, ������ <?=$r?>"><br><br><hr></td>
-  </tr>
-  <tr>
-    <td>
-    <?
-	$sp = mysql_query('SELECT * FROM `items_shop` WHERE `sid` = "'.$sid.'" AND `r` = "'.$r.'"');
-	while( $pl = mysql_fetch_array($sp) ) {
-		$itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$pl['item_id'].'" LIMIT 1'));
-		
-		$del = 0;
-		
-		if( isset($_POST['del'.$pl['iid'].'x'])) {
-			$del = 1;
-			mysql_query('DELETE FROM `items_shop` WHERE `iid` = "'.$pl['iid'].'" LIMIT 1');
-		}
-		
-		if($del == 0) {
-			if(isset($_POST['itm_'.$pl['iid'].'_b1'])) {
-				
-				$pl['kolvo'] = $_POST['itm_'.$pl['iid'].'_x'];
-				
-				$pl['price_1'] = $_POST['itm_'.$pl['iid'].'_p1'];
-				$pl['price_2'] = $_POST['itm_'.$pl['iid'].'_p2'];
-				
-				$itm['price1'] = $_POST['itm_'.$pl['iid'].'_b1'];
-				$itm['price2'] = $_POST['itm_'.$pl['iid'].'_b2'];
-				
-				mysql_query('UPDATE `items_shop` SET
-				`kolvo` = "'.mysql_real_escape_string($pl['kolvo']).'",
-				`price_1` = "'.mysql_real_escape_string($pl['price_1']).'",
-				`price_2` = "'.mysql_real_escape_string($pl['price_2']).'"
-				WHERE `iid` = "'.$pl['iid'].'" LIMIT 1');
-				
-				mysql_query('UPDATE `items_main` SET
-				`price1` = "'.mysql_real_escape_string($itm['price1']).'",
-				`price2` = "'.mysql_real_escape_string($itm['price2']).'"
-				WHERE `id` = "'.$itm['id'].'" LIMIT 1');
-				
-			}
-			?>
-			<table name="itm_<?=$pl['iid']?>" id="itm_<?=$pl['iid']?>" width="100%" border="0" cellspacing="0" cellpadding="10">
-			  <tr>
-				<td width="200" align="center" valign="middle">
-					<img src="https://img.new-combats.com/i/items/<?=$itm['img']?>"><br>
-					���-��: <input value="<?=$pl['kolvo']?>" type="text" name="itm_<?=$pl['iid']?>_x"><br>
-					#<?=$pl['item_id']?>
-					<br>
-					<input type="submit" value="��������� ���������">
-				</td>
-				<td valign="top">
-				<a href="https://new-combats.com/item/<?=$itm['id']?>" ><?=$itm['name']?></a><br>
-				���� � ����: <input value="<?=$itm['price1']?>" type="text" name="itm_<?=$pl['iid']?>_b1"> ��.<br>
-				���� � ����: <input value="<?=$itm['price2']?>" type="text" name="itm_<?=$pl['iid']?>_b2"> ���.<hr>
-				���� � ��������: <input value="<?=$pl['price_1']?>" type="text" name="itm_<?=$pl['iid']?>_p1"> ��.<br>
-				���� � ��������: <input value="<?=$pl['price_2']?>" type="text" name="itm_<?=$pl['iid']?>_p2"> ���.<hr>
-				<br><br><br><br><input type="submit" name="del<?=$pl['iid']?>x" value="������� �� �������� (������ �������� ��� ��������������!!!)">
-				</td>
-			  </tr>
-			</table><hr><?
-		}
-	}
-	?>
-    </td>
-  </tr>
-</table>
+				"' . 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 '<option ';
+                            if ($pl['sid'] == $sid) {
+                                echo ' selected="selected" ';
+                            }
+                            echo ' value="/editor_shop.php?sid=' . $pl['sid'] . '&r=' . $r . '">' . $pl['sid'] . '</option>';
+                        }
+                        ?>
+                    </select>
+                    ������ ��������:
+                    <select name="r_id" id="r_id" onChange="MM_jumpMenu('parent',this,0)">
+                        <?php
+                        $sp = mysql_query(
+                            'SELECT `r` FROM `items_shop` WHERE `sid` = "' . mysql_real_escape_string(
+                                $sid
+                            ) . '" GROUP BY `r`'
+                        );
+                        while ($pl = mysql_fetch_array($sp)) {
+                            echo '<option ';
+                            if ($pl['r'] == $r) {
+                                echo ' selected="selected" ';
+                            }
+                            echo ' value="/editor_shop.php?sid=' . $sid . '&r=' . $pl['r'] . '">' . $pl['r'] . '</option>';
+                        }
+                        ?>
+                    </select>
+                </p>
+                <p><a href="/editor_shop.php?sid=<?= $sid ?>&r=<?= $r ?>">�������� ��������</a><br>
+                    <br>
+                </p>
+                <hr>
+            </td>
+        </tr>
+        <tr>
+            <td align="center">�������� ������� (id ��������): <input type="text" value="" name="item_add"> � ����
+                ������. <input type="submit" name="additemnow" value="�������� � ������� <?= $sid ?>, ������ <?= $r ?>"><br><br>
+                <hr>
+            </td>
+        </tr>
+        <tr>
+            <td>
+                <?php
+                $sp = mysql_query('SELECT * FROM `items_shop` WHERE `sid` = "' . $sid . '" AND `r` = "' . $r . '"');
+                while ($pl = mysql_fetch_array($sp)) {
+                    $itm = mysql_fetch_array(
+                        mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $pl['item_id'] . '" LIMIT 1')
+                    );
+
+                    $del = 0;
+
+                    if (isset($_POST['del' . $pl['iid'] . 'x'])) {
+                        $del = 1;
+                        mysql_query('DELETE FROM `items_shop` WHERE `iid` = "' . $pl['iid'] . '" LIMIT 1');
+                    }
+
+                    if ($del == 0) {
+                        if (isset($_POST['itm_' . $pl['iid'] . '_b1'])) {
+
+                            $pl['kolvo'] = $_POST['itm_' . $pl['iid'] . '_x'];
+
+                            $pl['price_1'] = $_POST['itm_' . $pl['iid'] . '_p1'];
+                            $pl['price_2'] = $_POST['itm_' . $pl['iid'] . '_p2'];
+
+                            $itm['price1'] = $_POST['itm_' . $pl['iid'] . '_b1'];
+                            $itm['price2'] = $_POST['itm_' . $pl['iid'] . '_b2'];
+
+                            mysql_query(
+                                'UPDATE `items_shop` SET
+				`kolvo` = "' . mysql_real_escape_string($pl['kolvo']) . '",
+				`price_1` = "' . mysql_real_escape_string($pl['price_1']) . '",
+				`price_2` = "' . mysql_real_escape_string($pl['price_2']) . '"
+				WHERE `iid` = "' . $pl['iid'] . '" LIMIT 1'
+                            );
+
+                            mysql_query(
+                                'UPDATE `items_main` SET
+				`price1` = "' . mysql_real_escape_string($itm['price1']) . '",
+				`price2` = "' . mysql_real_escape_string($itm['price2']) . '"
+				WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
+                            );
+
+                        }
+                        ?>
+                        <table name="itm_<?= $pl['iid'] ?>" id="itm_<?= $pl['iid'] ?>" width="100%" border="0"
+                               cellspacing="0" cellpadding="10">
+                            <tr>
+                                <td width="200" align="center" valign="middle">
+                                    <img src="https://img.new-combats.com/i/items/<?= $itm['img'] ?>"><br>
+                                    ���-��: <input value="<?= $pl['kolvo'] ?>" type="text"
+                                                   name="itm_<?= $pl['iid'] ?>_x"><br>
+                                    #<?= $pl['item_id'] ?>
+                                    <br>
+                                    <input type="submit" value="��������� ���������">
+                                </td>
+                                <td valign="top">
+                                    <a href="https://new-combats.com/item/<?= $itm['id'] ?>"><?= $itm['name'] ?></a><br>
+                                    ���� � ����: <input value="<?= $itm['price1'] ?>" type="text"
+                                                        name="itm_<?= $pl['iid'] ?>_b1"> ��.<br>
+                                    ���� � ����: <input value="<?= $itm['price2'] ?>" type="text"
+                                                        name="itm_<?= $pl['iid'] ?>_b2"> ���.
+                                    <hr>
+                                    ���� � ��������: <input value="<?= $pl['price_1'] ?>" type="text"
+                                                            name="itm_<?= $pl['iid'] ?>_p1"> ��.<br>
+                                    ���� � ��������: <input value="<?= $pl['price_2'] ?>" type="text"
+                                                            name="itm_<?= $pl['iid'] ?>_p2"> ���.
+                                    <hr>
+                                    <br><br><br><br><input type="submit" name="del<?= $pl['iid'] ?>x"
+                                                           value="������� �� �������� (������ �������� ��� ��������������!!!)">
+                                </td>
+                            </tr>
+                        </table>
+                        <hr><?php
+                    }
+                }
+                ?>
+            </td>
+        </tr>
+    </table>
 </form>
 </body>
 </html>
\ 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 @@
-<?
-if(!isset($backdoor)) {
-	define('GAME',true);
-	
-	//10:05 ��������! �� ������� ��������� ���� ������� ���� �� <b>0.13 ���</b>. �������� ��� ����!
-	
-	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 = '������ ������� ������� ����������! ������ ������� ��� � ������� ������ ��������. ��� �������� <b>:s'.$o['id'].':</b>';
-			}
-		}
-	}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('&nbsp;',' ',$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 = '�� ������� ������� ����� �� &quot;'.$u->info['login'].'&quot; ����������� � ���� � ������� ��������.';
-			}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 "<html>".
-			  "<script type=\"text/javascript\" src=\"js/jquery.js\"></script><form id=\'F1\' action='https://www.free-kassa.ru/merchant/cash.php' method=POST>".
-			  "����� �������: ".$out_ekr." ���. ".
-			  "<input type=hidden name=m value=$mrh_login>".
-			  "<input type=hidden name=oa value=$out_summ>".
-			  "<input type=hidden name=InvId value=$inv_id>".
-			  "<input type=hidden name=Desc value='$inv_desc'>".
-			  "<input type=hidden name=s value=$crc>".
-			  "<input type=hidden name=ovalue='$shp_item'>".
-			  "<input type=hidden name=i value=$in_curr>".
-			  "<input type=hidden name=lang value=$culture>".
-			  "<input type=submit value='��������'><Br>".
-			  "(��� �������� ���� �� �������� � ��������� ����)".
-			  "</form><script>$('#F1').sumbit();</script></html>";
-		die();
-	}
-
-?>
-<HTML>
-<HEAD>
-  <title>������� ������������ - ���������� ����</title>
-  <!--<link rel=stylesheet type="text/css" href="/i/main.css">-->
-  <script type="text/javascript" src="https://new-combats.com/res/js/jquery-1.7.1.min.js"></script>
-  <meta content="text/html; charset=windows-1251" http-equiv=Content-Type>
-  <link href="/res/css/style.css" rel="stylesheet" type="text/css" media="all" />
-  <META Http-Equiv=Cache-Control Content=no-cache>
-  <meta http-equiv=PRAGMA content=NO-CACHE>
-  <META Http-Equiv=Expires Content=0>
-
-  <style type="text/css">
-
-            .t, .t tr, .t tr td { font-family: Times New Roman; font-size: 16px;
-                    border: 1px solid black; border-collapse: collapse; text-align: center; vertical-align: top; }
-            .t { border: 3px solid black; border-collapse: collapse;}
-            .t .al { text-align: left; }
-            .t .vam { vertical-align: middle; }
-            .t .ac { text-align: center; }
-            .t .b { font-weight: bold; }
-            .t .p { padding: 0px 5px 0px 5px; }
-            .t .btop { border-top: 3px solid black; border-collapse: collapse;}
-            .t .bright { border-right: 3px solid black; border-collapse: collapse;}
-            .t .bleft { border-left: 3px solid black; border-collapse: collapse;}
-            .t .bbottom { border-bottom: 3px solid black; border-collapse: collapse;}
-            .t .light { background: #D6F5D3; color: green; font-weight: bold;}
-
-            </style>
-
-</HEAD>
-<body>
-<div id="main">
-
-<!--<br />
-<h3>������� ������������</h3>
-                             -->
-<table style="width:98%; margin: auto;">
-<!--
-<tr><td colspan="2" style='font-weight:bold; color:red; padding: 10px 0 10px 0; font-size: 1.5em;'><center>���������� ��� �������� ��������������!</center></td></tr>
--->
-  <? if($ball == 0) { ?>
-  <tr><td colspan="2" style='font-weight:bold; color:brown; padding: 10px 0 10px 0; font-size: 1.2em;'><center style="color:red">�����! ��� ������ ���������� �������,<br />�� ��������� ������������� 20% ��� � ����� ������� ���������.
-  <br>
-  </center></td></tr>
-  <? }
-  	
-	if(isset($u->info['id'])) { ?>
-  <center><? echo '<div style="padding:10px; border-bottom:1px solid #fff;">��������: '.$u->microLogin($u->info['id'],1).'</div>';?></center>
-  <? }
-  if( $u->error != '' ) {
-	 echo '<div style="padding:10px;"><b><font color="red">'.$u->error.'</font></b></div>'; 
-  }
-  ?>
-  <a href="https://new-combats.com/ekr.php"> <img border="0" alt="freekassa" src="image/free.png" width="300" height="110"></a>&nbsp
-  <a href="https://new-combats.com/ekr2.php"> <img border="0" alt="interkassa" src="image/inter2.png" width="300" height="110"></a>
-  <tr>
-  <td style="width: 500px; padding: 10px; vertical-align: top;">
-    <fieldset style="border: 1px solid white; padding: 10px;margin-top:15px;">
-    <b><span style='color:#8F0000;'>��� ������������� �����:</span> <font color=green><?=$bns[$b1][1]?>% (<?=$ball?> ���)</font></b>
-    </fieldset>
-
-    <fieldset style="width:480px; border: 1px solid white; padding: 10px;margin-top:15px; padding-bottom:10px;">
-      <legend style='font-weight:bold; color:#8F0000;'>������� ���</legend>
-
-      <form method="post" id="ekrform" action="ekr.php?buy_ekr=1" onsubmit="if(document.getElementById('ch_1').checked==false) {alert('�� �� ����������� � ���������������� �����������.');return false;} else {if(document.getElementById('ch_2').checked==false) {alert('�� �� ����������� � ��������� ������.');return false;};}; if(document.getElementById('ekr').value<1) {alert('������ ������ ����� 1 ���!');return false;};">
-      <b>����� ���:</b> <input type="text" name="ekr" id="ekr" value="" size="8" onchange="calc();" onkeyup="if(event.keyCode<35||event.keyCode>40) calc();"> &nbsp; <input type="submit" class="btn btn-success" value="��������� ������"><br />
-
-      <!--<input type="button" class="btn btn-primary" value="�������� � ������� VISA / MASTERCARD" onclick="$('#ekrform').attr('action','ekr_fk_go.php'); $('#ekrform').submit();" style="width: 461px;">-->
-
-      <div id="calc" style="font-weight: bold; margin: auto; width: 400px; margin-top: 10px; margin-bottom: 10px;">&nbsp;<br />&nbsp;<br />&nbsp;</div>
-
-      <script>
-      function bonus_n(a) { var pr = <?=(0+$bns[$b1][1])?>; return (Math.floor( (a*pr/100) *100)/100);};
-      function bonus_s(a) { if(a>=100) {pr=20;} else if(a>=90) {pr=10;} else if(a>=80) {pr=10;} else if(a>=70) {pr=10;} else if(a>=60) {pr=10;} else if(a>=50) {pr=10;} else if(a>=40) {pr=10;} else if(a>=30) {pr=10;} else if(a>=20) {pr=10;} else if(a>=10) {pr=10;} else {pr=0;} return (Math.floor( (a*pr/100) *100)/100);};
-      function calc() {
-        document.getElementById('ekr').value = document.getElementById('ekr').value.replace(/[^\d\.]+/g,'');
-        //if(document.getElementById('ekr').value<0.1) document.getElementById('ekr').value=0.1;
-        //if(document.getElementById('ekr').value>120) document.getElementById('ekr').value=120;
-        var ekr = document.getElementById('ekr').value;
-        if (ekr.match(/^[-\+]?[\d]+\.?[\d]*$/) === null) {ekr=0;}
-
-        ekr4 = ekr = Math.round(ekr*100)/100;
-		var ekr4 = ekr.toFixed(2);
-
-		if(document.getElementById('ekr').value!=ekr) {
-			document.getElementById('ekr').value=ekr;
-		}
-                                            //alert(ekr);
-        var ekr2 = bonus_n(ekr);    //alert(ekr2);
-        var ekr3 = bonus_s(ekr);              //alert(ekr3);
-        var ekr7 = 0;
-        ekr2 = Math.floor(ekr2*100)/100;
-        ekr3 = Math.floor(ekr3*100)/100;
-        var ekr7 = 0;
-		<? if($ball == 0) { ?>
-		ekr7 = Math.floor((ekr/5)*100)/100;
-		<? } ?>
-        //var ekrr = parseFloat(ekr) + parseFloat(ekr2) + parseFloat(ekr3);
-        var ekrr = ekr + ekr2 + ekr3 + ekr7;
-        ekrr = Math.round(ekrr*100)/100;
-
-        //document.getElementById('calc').innerHTML = ekr+' + '+ekr2+' + '+ekr3+' = '+ekrr+' ���';        
-        document.getElementById('calc').innerHTML = '������������� �����: <font color=green>'+ekr2+' ���</font><br />������� �����: <font color=green>'+ekr3+' ���</font><? if($ball == 0) { ?><br />����� �� 1-�� ����������: <font color=red>'+ekr7+' ���</font><? } ?><br />�����: <font color=green>'+ekrr+' ���</font>';
-        }
-      calc();
-      </script>
-
-      <table style="border: 1px solid white; margin: auto; width: 400px;">
-        <tr style="border-bottom: 1px solid white;"><td style="border-right: 1px solid white;padding:2px;">1 ���</td><td style="padding:2px;"><?=round($bt['cur'],2)?> ������</td></tr>
-        <tr style="border-bottom: 1px solid white;"><td style="border-right: 1px solid white;padding:2px;">1 ���</td><td style="padding:2px;"><?=round($bt['cur']/$bt['USD'],2)?> ������� *</td></tr>
-              </table>
-      <small>
-      * - ������� �� ������� ������ �����<br />
-      <b>�������� ������� ������ ������������ � �������������� ������, ����� ��  ����� ������!</b>
-      <br /><br />
-      ��� ������ ����� ��������� �������� �� ����������, ������ �� ����� 1 ����. ���� �� ��������� ���������� ����� ������ ��� � �� ��������� �� ��� ������, �� ���������� ���������� � <a href="https://www.free-kassa.ru/support.php" target="_blank">������ ��������� FREE-KASSA</a>.
-      </small>
-      <br /><br />
-      </form>
-
-      <small>
-      <label><input type="checkbox" name="ch1" id="ch_1" /> ��������! ��� ���������� ������� �� ������������ � <a href="https://new-combats.com/encicl/law2.html" target="_blank">����������� � �������������� ������� ���� &laquo; ���������� ���� &raquo;</a>.</label><br>
-	  <label><input type="checkbox" name="ch1" id="ch_1" /> ��������! ��� ���������� ������� �� ������������ � <a href="https://new-combats.com/encicl/law3.html" target="_blank">��������� ������������������ ������� &laquo; ���������� ���� &raquo;</a>.</label><br>
-	  <label><input type="checkbox" name="ch1" id="ch_1" /> ��������! ��� ���������� ������� �� ������������ � <a href="https://new-combats.com/encicl/law4.html" target="_blank">��������� ��������� ������ &laquo; ���������� ���� &raquo;</a>.</label>
-      <br />
-      ���� �� ����� ������ �� �������� ������ �� ������� ����, �� ��� ���������� �������� �������, ���������� �� ������� � <b> �������������� </b> �������.
-      <br /><br />
-      </small>
-    </fieldset>
-
-  </td>
-
-
-  <td style="padding: 10px; vertical-align: top;">
-    <fieldset style="border: 1px solid white; padding: 10px;margin-top:15px;">
-    <b><span style='color:#8F0000;'>��� ������ �����: <font color=green><b><?=$u->info['money2']?> ���</b></font> � <font color=black><b><?=$u->info['money']?> ��</b></font>.</span></b>
-    </fieldset>
-
-    <fieldset style="border: 1px solid white; padding: 10px;margin-top:15px;">
-      <legend style='font-weight:bold; color:#8F0000;'>�����</legend>
-      <form method="post" action="ekr.php" onsubmit="if(document.getElementById('ekr2').value><?=$day1?>) {alert('������� �� ������ ��� �������� �� ����� <?=$day1?> ���');return false;} else if(document.getElementById('ekr2').value<0.01||document.getElementById('ekr2').value><?=$day1?>) {alert('�� 1 ��� �� ������ �������� ����� �� 0.01 �� <?=$day1?> ���.');return false;} else {return confirm('�� ������������� ������ �������� '+document.getElementById('ekr2').value+' ��� �� '+(document.getElementById('ekr2').value*<?=$c['ecrtocr']*2.5?>)+' �� ? � �������� ����������� ����� � �� �� ��� ����� ����������.');};">
-      �������� ��� �� �� �� ����� <b>1���=<?=$c['ecrtocr']*2.5?>��</b>: &nbsp; <input type="text" name="ekr2" id="ekr2" value="" size="5" placeholder="<?=$day1?> max" onchange="calc22();" onkeyup="if(event.keyCode<35||event.keyCode>40) calc22();"> &nbsp; <input type="submit" class="btn btn-success" name="submit" id="calc2" value="��������"><br />
-      </form>
-      <form method="post" action="ekr.php" onsubmit="if(document.getElementById('kr001').value<<?=round($c['crtoecr']/100,2)?>) {alert('����������� ����� ������ <?=round($c['crtoecr']/100,2)?> ��');return false;}else if(document.getElementById('kr001').value><?=$day2?>) {alert('������� �� ������ ��� �������� �� ����� <?=$day2?> ��');return false;} else {return confirm('�� ������������� ������ �������� '+document.getElementById('kr001').value+' �� �� '+(Math.round(document.getElementById('kr001').value/10)/50)+' ���? �������� �������� ������ ����� ����������.');};">
-      �������� �� �� ��� �� ����� <b><?=$c['crtoecr']?>��=1���</b>: <input type="text" style="margin-left:1px;" name="kr001" id="kr001" value="" placeholder="<?=$day2?> max" size="5" onchange="calc24();" onkeyup="if(event.keyCode<35||event.keyCode>40) calc23();"> &nbsp; <input type="submit" class="btn btn-success" name="submit" id="calc3" value="��������"><br />
-      </form>
-      <script>
-      function calc23() {
-          document.getElementById('kr001').value = document.getElementById('kr001').value.replace(/[^\d]+/g,'');
-          var kr001 = document.getElementById('kr001').value;
-          kr001 = Math.floor(kr001/10)*10;
-          var kr001ekr = kr001/<?=$c['crtoecr']?>;
-          //kr001ekr = kr001ekr.toFixed(2);
-
-          //document.getElementById('kr001').value = kr001;
-          
-          document.getElementById('calc3').value = '�������� '+kr001+' �� �� '+kr001ekr+' ���';
-          return kr001;
-          }
-
-      function calc24() {
-          document.getElementById('kr001').value = calc23();
-          if(document.getElementById('kr001').value==0) document.getElementById('kr001').value='';
-          }
-
-      calc24();
-      function calc22() {
-          document.getElementById('ekr2').value = document.getElementById('ekr2').value.replace(/[^\d\.]+/g,'');
-          var ekre = document.getElementById('ekr2').value;
-          if(ekre.match(/^[-\+]?[\d]+\.?[\d]*$/) === null) { ekre=0; }
-
-          ekre = Math.floor(ekre*100)/100;
-          var ekr4 = ekre.toFixed(2);
-
-          if(document.getElementById('ekr2').value!=ekre) { document.getElementById('ekr2').value=ekr4; }
-          var kre = parseFloat(ekre) * <?=$c['ecrtocr']*2.5?>;
-
-          document.getElementById('calc2').value = '�������� '+ekre+' ��� �� '+kre.toFixed(0)+' ��';
-          }
-      calc22();
-      </script>
-    </fieldset>
-
-    <fieldset style="border: 1px solid white; padding: 20px 11px 21px 11px;margin-top:15px;">
-      <legend style='font-weight:bold; color:#8F0000;'>������������� ������</legend>
-            <table class="t" style="width: 500px; margin: auto;">
-        <tr class="b"><td>���</td><td class="bright ">�����</td><td>���</td><td>�����</td></tr>
-        <tr><td class="">800 ���</td><td class="bright ">10%</td><td class="">3 000 ��� <img src="/res/img/medals/vip.gif" title="VIP" width=20 style="margin-top:2px;" /></td><td class="">30%</td></tr>
-        <tr><td class="">700 ���</td><td class="bright ">9%</td><td class="">2 500 ��� <img src="/res/img/medals/vip.gif" title="VIP" width=20 style="margin-top:2px;" /></td><td class="">27%</td></tr>
-        <tr><td class="">600 ���</td><td class="bright ">8%</td><td class="">2 000 ��� <img src="/res/img/medals/vip.gif" title="VIP" width=20 style="margin-top:2px;" /></td><td class="">25%</td></tr>
-        <tr><td class="">500 ���</td><td class="bright ">7%</td><td class="">1 700 ��� <img src="/res/img/medals/vip.gif" title="VIP" width=20 style="margin-top:2px;" /></td><td class="">23%</td></tr>
-        <tr><td class="">400 ���</td><td class="bright ">6%</td><td class="">1 500 ��� <img src="/res/img/medals/vip.gif" title="VIP" width=20 style="margin-top:2px;" /></td><td class="">21%</td></tr>
-        <tr><td class="">300 ���</td><td class="bright ">5%</td><td class="">1 300 ��� <img src="/res/img/medals/vip.gif" title="VIP" width=20 style="margin-top:2px;" /></td><td class="">19%</td></tr>
-        <tr><td class="">200 ���</td><td class="bright ">4%</td><td class="">1 200 ��� <img src="/res/img/medals/vip.gif" title="VIP" width=20 style="margin-top:2px;" /></td><td class="">17%</td></tr>
-        <tr><td class="">100 ���</td><td class="bright ">3%</td><td class="">1 100 ��� <img src="/res/img/medals/vip.gif" title="VIP" width=20 style="margin-top:2px;" /></td><td class="">15%</td></tr>
-        <tr><td class="">50 ���</td><td class="bright ">2%</td><td class="">1 000 ��� <img src="/res/img/medals/vip.gif" title="VIP" width=20 style="margin-top:2px;" /></td><td class="">13%</td></tr>
-        <tr><td class="">10 ���</td><td class="bright ">1%</td><td class="">900 ���</td><td class="">11%</td></tr>
-      </table>
-    </fieldset>
-
-    <fieldset style="border: 1px solid white; padding: 18px 12px 18px 12px;margin-top:15px;">
-      <legend style='font-weight:bold; color:#8F0000;'>������� ������</legend>
-
-      <table class="t" style="width: 500px; margin: auto;">
-        <tr class="b light"><td>�����</td><td>10%</td><td>10%</td><td>10%</td><td>10%</td><td>10%</td></tr>
-        <tr style="border-bottom: 2px solid black;"><td class="b">�����</td><td>10 ���</td><td>20 ���</td><td>30 ���</td><td>40 ���</td><td>50 ���</td></tr>
-        <tr class="b light"><td class="b">�����</td><td>10%</td><td>10%</td><td>10%</td><td>10%</td><td>20%</td></tr>
-        <tr><td class="b">�����</td><td>60 ���</td><td>70 ���</td><td>80 ���</td><td>90 ���</td><td>100 ���</td></tr>
-      </table>
-    </fieldset>
-
-  </td>
-</tr>
-
-<!--
-<tr><td colspan="2" style='font-weight:bold; padding: 10px; font-size: 0.8em;'><center>��� ������ � ��������� ���� ����� ��������� �������� �� ����������, ������ �� ����� 1 ����. ��� �� ����� ���������� ����� � ���������� ����� ��������� �����, ��� ����� ���������� ������� � ������ ������ ������ ���������� � ��������� ����, ���� ��������� ����� ������� �������.</center></td></tr>
--->
-
-<tr><td colspan="2" style='font-weight:bold; color:#8F0000; padding: 10px 0 10px 0; font-size: 1.5em;'><center>������������ ������</center></td></tr>
-<tr><td style="padding: 10px; vertical-align: top;">
-
-    <!-- komplekt form -->
-  				<div class="komplekt-form" id="theLayer" style="position: absolute; left: -300px; top: 160px; visibility:hidden; width: 150px; height:320px;">
-    				<div class="form-title" id="titleBar">
-    				 <label id="ftitle">��������</label>
-    				 <button type="button" class="close" onclick="document.getElementById('theLayer').style.visibility = 'hidden';return false" data-dismiss="modal" aria-hidden="true">x</button>
-    				</div>
-    				<div class="form">
-              <form method="post" id="fform" action="ekr.php">
-              <input type="hidden" name="do" value="newShadow" />
-              <input type="hidden" id="ffinput" name="ffinput" value="" />
-    			<center>
-                <img src="" id="ffimg" width="120" height="220" style="margin-bottom: 5px;" /><br>
-                 <div style="padding:5px;">
-                  <select name="ffsex" id="ffsex">
-                    <option value="0" <? if($u->info['sex'] == 0) { echo 'selected="selected"'; }?> >������� �����</option>
-                    <option value="1" <? if($u->info['sex'] == 1) { echo 'selected="selected"'; }?> >������� �����</option>
-                  </select>
-				</div>
-                <div style="width:240px; margin-left:-6px;background:#cbc4aa;padding:5px 0px 5px 0px;border:1px solid #cbc4aa;background-color:#eee;border:1px solid #999;border:1px solid rgba(0,0,0,0.3);*border:1px solid #999;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;outline:none;-webkit-box-shadow:0 3px 7px rgba(0,0,0,0.3);-moz-box-shadow:0 3px 7px rgba(0,0,0,0.3);box-shadow:0 3px 7px rgba(0,0,0,0.3);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box;">
-                <input type="button" class="btn btn-success" value="�����������" style="height: 28px; line-height: 20px; width: 100px;font-size:13px;" onclick="if(confirm('������������� ������ ������ ��� �����������?')) $('#fform').submit();" />
-                <input type="button" class="btn btn-danger" value="��������" onclick="document.getElementById('theLayer').style.visibility = 'hidden';return false" style="height: 28px; line-height: 20px; width: 100px;font-size:13px;" />
-             	</div>
-              </center>
-              </form>
-    		  </div>
-  			  </div>
-		  <!-- end komplekt form -->
-    <fieldset style="width:480px; border: 1px solid white; padding: 10px;margin-top:15px;">
-      <legend style='font-weight:bold; color:#8F0000;'>������� ������� ������</legend>
-      <small>
-      <b>��������� ������: 100 ���</b><br>
-      ���������� � ������������� ������:<br />
-      GIF-�������� �������� 120x220 (���) � ����� �� 300 ��.<br />
-      <br>
-      �������� ��������: <input type="file" id="imgFile" />
-      <script>
-
-      function showImgPreview(img) {
-        document.getElementById('theLayer').style.visibility = "visible";
-        document.getElementById('theLayer').style.left = 300;
-        document.getElementById('theLayer').style.top = 300;
-        $('img#ffimg').attr('src','https://new-combats.com/clan_prw/'+img);
-        document.getElementById('ffinput').value = img;
-        $('img#ffimg').attr('height','220');
-        document.getElementById('theLayer').style.height = 290;
-      }
-
-      function showImgPreviewPet(img) {
-        document.getElementById('theLayer').style.visibility = "visible";
-        document.getElementById('theLayer').style.left = 300;
-        document.getElementById('theLayer').style.top = 300;
-        $('img#ffimg').attr('src','https://new-combats.com/clan_prw/'+img);
-        $('img#ffimg').attr('height','40');
-        //$('#theLayer').attr('height','120');
-        document.getElementById('ffinput').value = img;
-        document.getElementById('ffsex').style.display = 'none';
-        document.getElementById('theLayer').style.height = 105;
-        $('html, body').animate({scrollTop:0}, 'slow');
-      }
-	  
-      function showImgPreviewSmile(img) {
-        document.getElementById('theLayer').style.visibility = "visible";
-        document.getElementById('theLayer').style.left = 300;
-        document.getElementById('theLayer').style.top = 300;
-        $('img#ffimg').attr('src','https://new-combats.com/clan_prw/'+img);
-		$('img#ffimg').attr('width',null);
-		$('img#ffimg').attr('height',null);
-        document.getElementById('ffinput').value = img;
-        document.getElementById('ffsex').style.display = 'none';
-        document.getElementById('theLayer').style.height = 105;
-        $('html, body').animate({scrollTop:0}, 'slow');
-      }
-
-      $('#imgFile').change(function(){
-        var fd = new FormData();
-        fd.append('type', 'person');
-        fd.append('img', $('#imgFile')[0].files[0]);
-        $.ajax({
-          type: 'POST',
-          url: 'ekr.php',
-          data: fd,
-          processData: false,
-          contentType: false,
-          dataType: "json", // �������� �� json
-          success: function(data) { if(data['img']!=undefined) { document.getElementById('ffsex').style.display = 'none';showImgPreview(data['img']) } else {alert(data['err']);} },
-          error: function(data) { alert('������ AJAX.') }
-          });
-        })
-      </script>
-      </small>
-    </fieldset>
-
-<fieldset style="border: 1px solid white; padding: 10px;margin-top:15px; padding-bottom: 15px;">
-      <legend style='font-weight:bold; color:#8F0000;'>������� ������� ��������</legend>
-      <small>
-      <b>��������� ������: <?$ekr_smile = 10; echo $ekr_smile;?> ���</b><br>
-      ���������� � ��������:<br />
-      GIF-�������� �������� �� 15x15 �� 95x21 (���) � ����� �� 30 ��.<br />
-      <br>
-      �������� ��������: <input type="file" id="imgFile5" />
-      <script>
-
-      $('#imgFile5').change(function(){
-        var fd = new FormData();
-        fd.append('type', 'person');
-        fd.append('img5', $('#imgFile5')[0].files[0]);
-        $.ajax({
-          type: 'POST',
-          url: 'ekr.php',
-          data: fd,
-          processData: false,
-          contentType: false,
-          dataType: "json", // �������� �� json
-          success: function(data) { if(data['img']!=undefined) { showImgPreviewSmile(data['img']) } else {alert(data['err']);} },
-          error: function(data) { alert('������ AJAX.'); }
-          });
-        })
-      </script>
-      </small>
-    </fieldset>
-
-    <fieldset style="border: 1px solid white; padding: 10px;margin-top:15px;">
-      <legend style='font-weight:bold; color:#8F0000;'>����� ����� ���������</legend>
-      <small>
-      <b>��������� ������: 25 ���</b><br>
-      ������� ���: <?=$u->info['login']?><br>
-      <form method="post" action="ekr.php" id="lform">
-        <input type="hidden" name="do" value="changeLogin" />
-        <input type="text" name="login" id="llogin" onkeyup="check_login();" size=35 placeholder="������� ����� ���.." style="margin: 5px 0 5px 0;" /> <span id="ajaxLogin"></span><br>
-        <input type="button" class="btn btn-success" value="������� ���" onclick="if(confirm('������������� ������ ������� ���?')) $('#lform').submit();" />
-      </form>
-      <script>
-      function check_login() {
-        $("#ajaxLogin").html('<b>�������� �����������...</b>');
-        $.ajax({
-          url: "ajax_checklogin.php?login="+$('#llogin').val(),
-          cache: false
-          }).done(function( html ) {
-            $("#ajaxLogin").html(html);
-            });
-        }
-      </script>
-      </small>
-    </fieldset>
-    
-</td></tr>
-
-<tr><td colspan="2">&nbsp;</td></tr>
-
-
-</table>
-
-</div>
-</BODY>
-</HTML>
-<?
-}
-?>
\ No newline at end of file
diff --git a/enter.php b/enter.php
index 608a9f82..99cafe08 100644
--- a/enter.php
+++ b/enter.php
@@ -1,62 +1,39 @@
 <?php
-define('GAME',true);
-
-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;
+if (session_status() == PHP_SESSION_NONE) {
+    session_start();
 }
 
-define('IP',GetRealIp());
+const GAME = true;
 
 include('_incl_data/__config.php');
 include('_incl_data/class/__db_connect.php');
-include('_incl_data/class/__chat_class.php');
-//session_reset();
-session_start();
+define('IP', UserIp::get());
+$chat = new Chat();
 
-if( isset($_GET['login'])) {
-	$_POST['login'] = $_GET['login'];
-	$_POST['pass'] = $_GET['pass'];
-	$_POST['code']=$_GET['code'];
+if (isset($_GET['login'])) {
+    $_POST['login'] = $_GET['login'];
+    $_POST['pass'] = $_GET['pass'];
+    $_POST['code'] = $_GET['code'];
 }
 
-if(isset($_POST['psw'])) {
-	$_POST['pass'] = $_POST['psw'];
+if (isset($_POST['psw'])) {
+    $_POST['pass'] = $_POST['psw'];
 }
 
-if( isset($_SESSION['login']) ) {
-	$_POST['login'] = $_SESSION['login'];
-	$_POST['pass'] = $_SESSION['pass'];
+if (isset($_SESSION['login'])) {
+    $_POST['login'] = $_SESSION['login'];
+    $_POST['pass'] = $_SESSION['pass'];
 }
 
-if( isset($_GET['cookie_login']) && $_GET['cookie_login'] != '' ) {
-	setcookie('login',$_GET['cookie_login'],time()+60*60*24*7,'',$c['host']);
-	setcookie('pass',$_GET['cookie_pass'],time()+60*60*24*7,'',$c['host']);
-	//header('location: /bk');
-	die();
+if (isset($_GET['cookie_login']) && $_GET['cookie_login'] != '') {
+    setcookie('login', $_GET['cookie_login'], time() + 60 * 60 * 24 * 7, '', $c['host']);
+    setcookie('pass', $_GET['cookie_pass'], time() + 60 * 60 * 24 * 7, '', $c['host']);
+    die();
 }
 
 function error($e)
 {
-	 global $c;
-	 //$_SESSION['login']='';
-	 //$_SESSION['pass']='';
-	 	 
-	 //die('<script>location = "index.php?error='.$e.'";</script>')
-	 //die('Location: index.php?error='.$e);
-	 die(' 
+    die(' 
 	 <link rel="stylesheet" href="error.css">
 	 <div class="text-wrapper">
     <div class="title" data-content="������">
@@ -64,7 +41,7 @@ function error($e)
     </div>
 
     <div class="subtitle">
-        '.$e.'
+        ' . $e . '
     </div>
 
     <div class="buttons">
@@ -78,99 +55,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++)
-    {
-        $res[$i] = ord($src{$i}) ^ $i * 4;
-    } 
-    for ($i = 0; $i < 4; $i++)
-    {
-        for ($j = 0; $j < 4; $j++)
-        {
+
+    $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++) {
             $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 +101,252 @@ $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'].'".<br>������ ����� �� ����� �� ������ ������. ��� ����� ��������� �� ������: <a href="/repass.php?login='.htmlspecialchars($_POST['login'],NULL,'cp1251').'">����� ������</a><br><br>��� ���������� ������� ������ ��� ������������ ���������, �� ����� �� ������� ��������������� �������� ������ ����� �������� ��������������� ������.<br>���� � ��� ��� ������� � 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'] . '".<br>������ ����� �� ����� �� ������ ������. ��� ����� ��������� �� ������: <a href="/repass.php?login=' . htmlspecialchars($_POST['login'], null, 'cp1251') . '">����� ������</a><br><br>��� ���������� ������� ������ ��� ������������ ���������, �� ����� �� ������� ��������������� �������� ������ ����� �������� ��������������� ������.<br>���� � ��� ��� ������� � 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'] = '������� ����������: <i>������� ����-��� �� �������.</i>';
-	}
-	error(
-		'�������� <b>'.$_POST['login'].'</b> ������������.'.
-		'<br>'.$fm['text'].'<br>'.
-		'<br><b>��������!</b> ���� �� �������, ��� ��������� ������ � �� ������ �� ��������, �������������������, ��������� �������� ������������� � �������� ������!</a>'.
-		'<br>����� ��� ��� ������, <b>�����������</b> ������������ � <a target="_blank" href="https://new-combats.com/lib/zakon/">������������ ��������.'
-		.'<br><br>���� �� ������������� ����������, �� � ��� ��� ������ �� ������������� ������ �������� ���������.'
-	);
-}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 = '�������� ������ ������<br>';};
-			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 = '<font color="red"><b>'.$koko.'</b></font>';
-		}
-		if( $good2 == false ) {
-?>
-			<!Doctype html>
-			<HTML>
-			<HEAD>
-				<link rel=stylesheet type="text/css">
-				<meta charset="windows-1251">
-				<meta name="msapplication-config" content="browserconfig.xml"/>
-				<TITLE>������ ������</TITLE>
-			</HEAD>
-			<body bgcolor=dfdfde>
-			<H3><FONT COLOR="black">������ ������� ������ � ���������.</FONT></H3>
-			<?=$koko?>
-			<div align="center">
-	<br>
-	<br>
-	
-	<img id="pass" onClick="" width="295" src="i/pin/e0.png" >
-	<br>
-	<br>
-	<img id="p1" onClick="" src="" >
-	<img  id="p2" onClick="" src="" >
-	<img  id="p3" onClick="" src="" >
-	<br>
-	<img  id="p4" onClick="" src="" >
-	<img  id="p5" onClick="" src="" >
-	<img  id="p6" onClick="" src="" >
-	<br>
-	<img  id="p7" onClick="" src="" >
-	<img  id="p8" onClick="" src="" >
-	<img  id="p9" onClick="" src="" >
-	<br>
-	<img  onClick="keypush(12);" src="i/pin/12.png" >
-	<img  id="p0" name="image" onClick="" src="" >
-	<img  onClick="keypush(11);" src="i/pin/11.png" >
-	<br>
-			</div>
-			</BODY>
-			<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
-			 <!--<script src="https://new-combats.com/js/jquery.js" type="text/javascript"></script>-->
-			 <script>
-			 
- var dopass='';
- var tdopass='';
- var lenth=0;
- randomp();
- function randomp()
- {
-    var ss = new Array();
-	var n=0;
-	while (n<10)
-	{
-		ss[n]=n;
-		n++;
-	}
-	
-	var i=0;
-	var k=0;
-	var m=0;
-	var tmpp=0;
-	while (i<10)
-	{
-		k = getRandomInt(10);
-		m = getRandomInt(10);
-		if (k != m)
-		{
-		  tmpp=ss[k];
-		  ss[k]=ss[m];
-		  ss[m]=tmpp;
-		  i++;	
-		}
-		
-	}
-	
+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'] = '������� ����������: <i>������� ����-��� �� �������.</i>';
+    }
+    error('�������� <b>' . $_POST['login'] . '</b> ������������.' . '<br>' . $fm['text'] . '<br>' . '<br><b>��������!</b> ���� �� �������, ��� ��������� ������ � �� ������ �� ��������, �������������������, ��������� �������� ������������� � �������� ������!</a>' . '<br>����� ��� ��� ������, <b>�����������</b> ������������ � <a target="_blank" href="https://new-combats.com/lib/zakon/">������������ ��������.' . '<br><br>���� �� ������������� ����������, �� � ��� ��� ������ �� ������������� ������ �������� ���������.');
+} else {
 
-    n=10;
-	while (n>-1)
-	{
-		n=n-1;
-		document.getElementById('p'+n).setAttribute("src", "i/pin/"+ss[n]+".png");
-		document.getElementById('p'+n).setAttribute("onClick", "keypush("+ss[n]+");");
-		
-	}
- }
+    //������ ������
+    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 = '�������� ������ ������<br>';
+            };
+            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);
+        }
 
-function getRandomInt(max) {
-  return Math.floor(Math.random() * Math.floor(max));
-}
-function keypush(n)
- {
-	if (n==12)
-	{
-		
-		if (lenth>0)
-		{
+        if ($koko != '') {
+            $koko = '<font color="red"><b>' . $koko . '</b></font>';
+        }
+        if ($good2 == false) {
+            ?>
+            <!Doctype html>
+            <HTML>
+            <HEAD>
+                <link rel=stylesheet type="text/css">
+                <meta charset="windows-1251">
+                <meta name="msapplication-config" content="browserconfig.xml"/>
+                <TITLE>������ ������</TITLE>
+            </HEAD>
+            <body bgcolor=dfdfde>
+            <H3><FONT COLOR="black">������ ������� ������ � ���������.</FONT></H3>
+            <?= $koko ?>
+            <div align="center">
+                <br>
+                <br>
 
-			dopass='';
-			
-			lenth=0;
-			document.getElementById('pass').setAttribute("src", "i/pin/e"+lenth+".png");
-		}
-	}
-	else if (n==11)
-	{
-		
-		var $_POST = <?php echo json_encode($_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']);
+                <img id="pass" onClick="" width="295" src="i/pin/e0.png">
+                <br>
+                <br>
+                <img id="p1" onClick="" src="">
+                <img id="p2" onClick="" src="">
+                <img id="p3" onClick="" src="">
+                <br>
+                <img id="p4" onClick="" src="">
+                <img id="p5" onClick="" src="">
+                <img id="p6" onClick="" src="">
+                <br>
+                <img id="p7" onClick="" src="">
+                <img id="p8" onClick="" src="">
+                <img id="p9" onClick="" src="">
+                <br>
+                <img onClick="keypush(12);" src="i/pin/12.png">
+                <img id="p0" name="image" onClick="" src="">
+                <img onClick="keypush(11);" src="i/pin/11.png">
+                <br>
+            </div>
+            </BODY>
+            <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
+            <script>
+
+                var dopass = '';
+                var tdopass = '';
+                var lenth = 0;
+                randomp();
+
+                function randomp() {
+                    var ss = new Array();
+                    var n = 0;
+                    while (n < 10) {
+                        ss[n] = n;
+                        n++;
+                    }
+
+                    var i = 0;
+                    var k = 0;
+                    var m = 0;
+                    var tmpp = 0;
+                    while (i < 10) {
+                        k = getRandomInt(10);
+                        m = getRandomInt(10);
+                        if (k != m) {
+                            tmpp = ss[k];
+                            ss[k] = ss[m];
+                            ss[m] = tmpp;
+                            i++;
+                        }
+
+                    }
+
+
+                    n = 10;
+                    while (n > -1) {
+                        n = n - 1;
+                        document.getElementById('p' + n).setAttribute("src", "i/pin/" + ss[n] + ".png");
+                        document.getElementById('p' + n).setAttribute("onClick", "keypush(" + ss[n] + ");");
+
+                    }
                 }
-				 });
-				//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");
-		}
 
-	}
-	
- }
-</script>
-			</HTML>
-<?
-			die();
-		}
-		
-	}
-	
-	$st = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id`="'.$u['id'].'" LIMIT 1'));
-	if(!isset($st['id']))
-	{
-		mysql_query("INSERT INTO `stats` (`id`,`stats`) VALUES ('".$u['id']."','s1=3|s2=3|s3=3|s4=3|rinv=40|m9=5|m6=10')");
-	}
-	$on = mysql_fetch_array(mysql_query('SELECT * FROM `online` WHERE `uid`="'.$u['id'].'" LIMIT 1'));
-	if(!isset($on['id']))
-	{
-		mysql_query("INSERT INTO `online` (`uid`,`timeStart`) VALUES ('".$u['id']."','".time()."')");
-	}
-	if(isset($_COOKIE['login']) || isset($_COOKIE['pass']))
-	{
-		setcookie('login','',time()-60*60*24,'',$c['host']);
-		setcookie('pass','',time()-60*60*24,'',$c['host']);
-	}
-	
-	//������
-	if($u['admin']==0)
-	{
-		$ipm1 = mysql_fetch_array(mysql_query('SELECT * FROM `logs_auth` WHERE `uid` = "'.mysql_real_escape_string($u['id']).'" AND `ip`!="'.mysql_real_escape_string($u['ip']).'" ORDER BY `id` ASC LIMIT 1'));
-		$ppl = mysql_query('SELECT * FROM `logs_auth` WHERE `ip`!="" AND (`ip` = "'.mysql_real_escape_string($u['ip']).'" OR `ip`="'.mysql_real_escape_string($ipm1['ip']).'" OR `ip`="'.mysql_real_escape_string($u['ipreg']).'" OR `ip`="'.mysql_real_escape_string(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` = "'.$u['id'].'") OR (`uid2` = "'.$spl['uid'].'" AND `uid` = "'.$u['id'].'") LIMIT 1'));
-			if(!isset($ml['id']) && $spl['uid']!=$inf['id'] && $spl['ip']!='' && $spl['ip']!='127.0.0.1' && $spl['ip']!='188.120.246.101')
-			{
-				mysql_query('INSERT INTO `mults` (`uid`,`uid2`,`ip`) VALUES ("'.$u['id'].'","'.$spl['uid'].'","'.$spl['ip'].'")');
-			}
-		}
-	}
-	
-	
-		if( (int)date('d') >= 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 = <?php echo json_encode($_POST); ?>;
+                        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");
+                        }
+
+                    }
+
+                }
+            </script>
+            </HTML>
+            <?
+            die();
+        }
+    }
+
+    $st = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id`="' . $u['id'] . '" LIMIT 1'));
+    if (!isset($st['id'])) {
+        mysql_query("INSERT INTO `stats` (`id`,`stats`) VALUES ('" . $u['id'] . "','s1=3|s2=3|s3=3|s4=3|rinv=40|m9=5|m6=10')");
+    }
+    $on = mysql_fetch_array(mysql_query('SELECT * FROM `online` WHERE `uid`="' . $u['id'] . '" LIMIT 1'));
+    if (!isset($on['id'])) {
+        mysql_query("INSERT INTO `online` (`uid`,`timeStart`) VALUES ('" . $u['id'] . "','" . time() . "')");
+    }
+    if (isset($_COOKIE['login']) || isset($_COOKIE['pass'])) {
+        setcookie('login', '', time() - 60 * 60 * 24, '', $c['host']);
+        setcookie('pass', '', time() - 60 * 60 * 24, '', $c['host']);
+    }
+
+    //������
+    if ($u['admin'] == 0) {
+        $ipm1 = mysql_fetch_array(mysql_query('SELECT * FROM `logs_auth` WHERE `uid` = "' . mysql_real_escape_string($u['id']) . '" AND `ip`!="' . mysql_real_escape_string($u['ip']) . '" ORDER BY `id` ASC LIMIT 1'));
+        $ppl = mysql_query('SELECT * FROM `logs_auth` WHERE `ip`!="" AND (`ip` = "' . mysql_real_escape_string($u['ip']) . '" OR `ip`="' . mysql_real_escape_string($ipm1['ip']) . '" OR `ip`="' . mysql_real_escape_string($u['ipreg']) . '" OR `ip`="' . mysql_real_escape_string(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` = "' . $u['id'] . '") OR (`uid2` = "' . $spl['uid'] . '" AND `uid` = "' . $u['id'] . '") LIMIT 1'));
+            if (!isset($ml['id']) && $spl['uid'] != $inf['id'] && $spl['ip'] != '' && $spl['ip'] != '127.0.0.1' && $spl['ip'] != '188.120.246.101') {
+                mysql_query('INSERT INTO `mults` (`uid`,`uid2`,`ip`) VALUES ("' . $u['id'] . '","' . $spl['uid'] . '","' . $spl['ip'] . '")');
+            }
+        }
+    }
+
+
+    if ((int)date('d') >= 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'],'� ����� ��� �������� ������� �� ��������� ������ &quot;���� �������� �����&quot;! (������ ����������� ������ ��� ����� �� �������� �� ���������)',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'],'��� ������������: <b>'.$u['login'].'</b>.',time(),6,0,0,0,1);
-			}
-		}
-	}
-	
-	$apu = '';
+        $chat->send('', $u['room'], $u['city'], '', $u['login'], '� ����� ��� �������� ������� �� ��������� ������ &quot;���� �������� �����&quot;! (������ ����������� ������ ��� ����� �� �������� �� ���������)', 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'], '��� ������������: <b>' . $u['login'] . '</b>.', 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! <br>";
-			
-	  }
-?>
diff --git a/enter2.php b/enter2.php
index 393301ef..af5bae54 100644
--- a/enter2.php
+++ b/enter2.php
@@ -1,112 +1,77 @@
-<html>
- <head>
- </head>
- <body>
-	������ ������� ������ � ���������.
-	<br>
-	<br>
-	
-	<img id="pass" onClick="" width="295" src="i/pin/e0.png" >
-	<br>
-	<br>
-	<img id="p1" onClick="" src="" >
-	<img  id="p2" onClick="" src="" >
-	<img  id="p3" onClick="" src="" >
-	<br>
-	<img  id="p4" onClick="" src="" >
-	<img  id="p5" onClick="" src="" >
-	<img  id="p6" onClick="" src="" >
-	<br>
-	<img  id="p7" onClick="" src="" >
-	<img  id="p8" onClick="" src="" >
-	<img  id="p9" onClick="" src="" >
-	<br>
-	<img  onClick="keypush(12);" src="i/pin/12.png" >
-	<img  id="p0" name="image" onClick="" src="" >
-	<img  onClick="keypush(11);" src="i/pin/11.png" >
-	<br>
-	<div id="text"><div>
-	
-	
+<!DOCTYPE>
+<html lang="ru">
+<head><title></title><meta charset="windows-1251"></head>
+<body>
+������ ������� ������ � ���������.<br><br>
+<img id="pass" onClick="" width="295" src="i/pin/e0.png" alt=""><br><br>
+<img id="p1" alt="" src=""><img id="p2" alt="" src=""><img id="p3" alt="" src=""><br>
+<img id="p4" alt="" src=""><img id="p5" alt="" src=""><img id="p6" alt="" src=""><br>
+<img id="p7" alt="" src=""><img id="p8" alt="" src=""><img id="p9" alt="" src=""><br>
+<img onClick="keypush(12);" src="i/pin/12.png" alt="">
+<img id="p0" name="image" src="" alt="">
+<img onClick="keypush(11);" src="i/pin/11.png" alt="">
+<br>
+<div id="text"></div>
+</body>
+<script>
+    var dopass = '';
+    var tdopass = '';
+    var lenth = 0;
+    randomp();
 
- </body>
- <script>
- var dopass='';
- var tdopass='';
- var lenth=0;
- randomp();
- function randomp()
- {
-    var ss = new Array();
-	var n=0;
-	while (n<10)
-	{
-		ss[n]=n;
-		n++;
-	}
-	
-	var i=0;
-	var k=0;
-	var m=0;
-	var tmpp=0;
-	while (i<10)
-	{
-		k = getRandomInt(10);
-		m = getRandomInt(10);
-		if (k != m)
-		{
-		  tmpp=ss[k];
-		  ss[k]=ss[m];
-		  ss[m]=tmpp;
-		  i++;	
-		}
-		
-	}
-	
+    function randomp() {
+        var ss = new Array();
+        var n = 0;
+        while (n < 10) {
+            ss[n] = n;
+            n++;
+        }
 
-    n=10;
-	while (n>-1)
-	{
-		n=n-1;
-		document.getElementById('p'+n).setAttribute("src", "i/pin/"+ss[n]+".png");
-		document.getElementById('p'+n).setAttribute("onClick", "keypush("+ss[n]+");");
-		
-	}
- }
+        var i = 0;
+        var k = 0;
+        var m = 0;
+        var tmpp = 0;
+        while (i < 10) {
+            k = getRandomInt(10);
+            m = getRandomInt(10);
+            if (k != m) {
+                tmpp = ss[k];
+                ss[k] = ss[m];
+                ss[m] = tmpp;
+                i++;
+            }
+        }
 
-function getRandomInt(max) {
-  return Math.floor(Math.random() * Math.floor(max));
-}
-function keypush(n)
- {
-	if (n==12 )
-	{
-		if (lenth>0)
-		{
+        n = 10;
+        while (n > -1) {
+            n = n - 1;
+            document.getElementById('p' + n).setAttribute("src", "i/pin/" + ss[n] + ".png");
+            document.getElementById('p' + n).setAttribute("onClick", "keypush(" + ss[n] + ");");
 
-			dopass='';
-			
-			lenth=0;
-			document.getElementById('pass').setAttribute("src", "i/pin/e"+lenth+".png");
-		}
-	}
-	else if (n==11)
-	{
-		//document.getElementById("text").innerHTML = ''+dopass;
-		println(dopass);
-	}
-	else
-	{
-		
-		if (lenth<8)
-		{
-			dopass=dopass+''+n;
-			lenth++;
-			document.getElementById('pass').setAttribute("src", "i/pin/e"+lenth+".png");
-		}
+        }
+    }
 
-	}
-	
- }
+    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) {
+            //document.getElementById("text").innerHTML = ''+dopass;
+            println(dopass);
+        } else {
+            if (lenth < 8) {
+                dopass = dopass + '' + n;
+                lenth++;
+                document.getElementById('pass').setAttribute("src", "i/pin/e" + lenth + ".png");
+            }
+        }
+    }
 </script>
 </html>
diff --git a/error.css b/error.css
index 1ac7e8de..54a88ee7 100644
--- a/error.css
+++ b/error.css
@@ -1,63 +1,63 @@
-@import url(https://fonts.googleapis.com/css?family=Raleway:700);

-

-$color1: #EE4B5E;

-$color2: #342643;

-$color3: #1FA9D6;

-

-*, *:before, *:after {

-  box-sizing: border-box;

-}

-html {

-    height: 100%;

-}

-body {

-    background: url(https://i.imgur.com/76NZB7A.gif) no-repeat center center fixed; 

-    background-size: cover;

-    font-family: 'Raleway', sans-serif;

-    background-color: $color2; 

-    height: 100%;

-}

-

-.text-wrapper {

-    height: 100%;

-   display: flex;

-   flex-direction: column;

-   align-items: center;

-   justify-content: center;

-}

-

-.title {

-    font-size: 6em;

-    font-weight: 700;

-    color: $color1;

-}

-

-.subtitle {

-    font-size: 40px;

-    font-weight: 700;

-    color: $color3;

-}

-

-.buttons {

-    margin: 30px;

-    

-    a.button {

-        font-weight: 700;

-        border: 2px solid $color1;

-        text-decoration: none;

-        padding: 15px;

-        text-transform: uppercase;

-        color: $color1;

-        border-radius: 26px;

-        transition: all 0.2s ease-in-out;

-        

-        &:hover {

-            background-color: $color1;

-            color: white;

-            transition: all 0.2s ease-in-out;

-        }

-    }

-

-    

-}

-

+@import url(https://fonts.googleapis.com/css?family=Raleway:700);
+
+$color1: #EE4B5E;
+$color2: #342643;
+$color3: #1FA9D6;
+
+*, *:before, *:after {
+  box-sizing: border-box;
+}
+html {
+    height: 100%;
+}
+body {
+    background: url(https://i.imgur.com/76NZB7A.gif) no-repeat center center fixed; 
+    background-size: cover;
+    font-family: 'Raleway', sans-serif;
+    background-color: $color2; 
+    height: 100%;
+}
+
+.text-wrapper {
+    height: 100%;
+   display: flex;
+   flex-direction: column;
+   align-items: center;
+   justify-content: center;
+}
+
+.title {
+    font-size: 6em;
+    font-weight: 700;
+    color: $color1;
+}
+
+.subtitle {
+    font-size: 40px;
+    font-weight: 700;
+    color: $color3;
+}
+
+.buttons {
+    margin: 30px;
+    
+    a.button {
+        font-weight: 700;
+        border: 2px solid $color1;
+        text-decoration: none;
+        padding: 15px;
+        text-transform: uppercase;
+        color: $color1;
+        border-radius: 26px;
+        transition: all 0.2s ease-in-out;
+        
+        &:hover {
+            background-color: $color1;
+            color: white;
+            transition: all 0.2s ease-in-out;
+        }
+    }
+
+    
+}
+
diff --git a/fastpanel.php b/fastpanel.php
deleted file mode 100644
index 8f428ccc..00000000
--- a/fastpanel.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-	header('Content-Type: text/html; charset=windows-1251');
-		
-	define('GAME',true);
-	include('_incl_data/__config.php');	
-	include('_incl_data/class/__db_connect.php');	
-	include('_incl_data/class/__user.php');
-	include('_incl_data/class/__filter_class.php');
-	include('_incl_data/class/__chat_class.php');	
-	
-	if(!isset($u->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('��� ���������� ������������ ���������.<br>��������������� � ������� ��������.');
-	}
-	
-	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/main.c b/fight/main.c
index 44b78fa4..56e29b48 100644
--- a/fight/main.c
+++ b/fight/main.c
@@ -1,173 +1,173 @@
-class Zone {

-	int id;

-	int type;

-	vector pos;

-	float radius;

-}

-

-enum ZoneType {

-	SAFE,

-	PSI,

-	RAD,

-	BIO

-}

-

-ref array<ref Zone> ga_zones = new array<ref Zone>;

-

-ref ControllerZones ctrl_zones = new ControllerZones;

-

-class ControllerZones {

-	void ControllerZones() {

-		

-		int id = 0;//

-		vector pos;

-		float radius;

-		int type = 0;

-		// only RAD param ↓↓↓ 

-		id = id + 1; // Територия янтаратя 200 метров RAD

-		pos = "2405 0 6541"; 

-		radius = 200.0;

-		AddZone(id, pos, radius, ZoneType.RAD);

-		

-		// only PSI param ↓↓↓

-		id = id + 1; // Територия янтаратя 200 метров PSI

-		pos = "2405 0 6541"; 

-		radius = 200.0;

-		AddZone(id, pos, radius, ZoneType.PSI);

-

-		GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(CheckZones, 5000, true);

-	}

-	

-	void ~ControllerZones() {

-	}

-	

-	void AddZone(int id, vector pos, float radius, int type) {

-		ref Zone zone = new ref Zone;

-		zone.id = id;

-		zone.pos = pos;

-		zone.radius = radius;

-		zone.type = type;

-

-		ga_zones.Insert(zone);

-	}

-	

-	bool InZone(PlayerBase player, ref Zone zone) {

-		vector player_position = player.GetPosition();

-		player_position[1] = 0;

-

-		EntityAI attachment;

-		ItemBase item;

-		string className;

-		float biosafe = 0;

-		float psisafe = 0;

-		float damage_player;

-		float damage_zone = 0;

-		float damage_zonePSI = 8.0;

-		float rpu = 1.0;

-			

-		if( (vector.Distance(player_position, zone.pos)) < zone.radius && zone.type == ZoneType.RAD) {

-			

-

-			

-			attachment = player.FindAttachmentBySlotName("Mask"); // Перечеь защиты от радиации

-			if ( attachment && attachment.IsItemBase() ) 

-				{

-					item		=	Class.Cast(attachment);

-					className	=	item.GetType();

-					if ( className.Contains("dzrp_GasMask_GP1") ) 

-					{

-						biosafe = biosafe + 1.0;

-					}

-				}

-		    attachment = player.FindAttachmentBySlotName("Body");

-			if ( attachment && attachment.IsItemBase() ) 

-			{

-				item		=	Class.Cast(attachment);

-				className	=	item.GetType();

-				if ( className.Contains("Top_Admin") ) 

-					{

-						biosafe = biosafe + 1.0;

-					}	

-				}

-			

-			if (((ga_zones.Get(j).radius - (vector.Distance(player_position, ga_zones.Get(j).pos)) ) * rpu) > 1 )

-			{

-				radiationcnt = ((ga_zones.Get(j).radius - (vector.Distance(player_position, ga_zones.Get(j).pos)) ) * rpu) + Math.RandomInt(1,10000)*0.00001;

-				if ( DayZRP_Static.IsItemInInventory( player, "DayZRP_Doz" ) ){

-					Param1<string> m_MessageParamRD = new Param1<string>( "Дозиметр : " + radiationcnt + "м3в" );

-					GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_MessageParamRD, true, player.GetIdentity());

-				}

-			}

-			if (biosafe<1)

-				{

-					damage_zone=((ga_zones.Get(j).radius - (vector.Distance(player_position, ga_zones.Get(j).pos)) ) * rpu)/50;

-					damage_player = player.GetHealth("GlobalHealth", "Health");

-					player.SetHealth("GlobalHealth", "Health", damage_player - (damage_zone - (damage_zone * biosafe)));

-					if (biosafe==0)

-						{

-							player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_COUGH); //Кашель

-							Param1<string> m_MessageParam = new Param1<string>("Воздействие Радиации! Одень противогаз!");

-							GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_MessageParam, true, player.GetIdentity()); 

-						}

-				}

-			

-		}		

-		else if((vector.Distance(player_position, zone.pos)) < zone.radius && zone.type == ZoneType.PSI) {

-	

-			attachment = player.FindAttachmentBySlotName("Mask");// Перечеь защиты от PSI

-			if ( attachment && attachment.IsItemBase() ) {

-				item		=	Class.Cast(attachment);

-				className	=	item.GetType();

-				if ( className.Contains("dzrp_GasMask_GP7") ) {

-					psisafe = psisafe + 1.0;

-				}

-			}

-			attachment = player.FindAttachmentBySlotName("Body");

-			if ( attachment && attachment.IsItemBase() ) {

-			item		=	Class.Cast(attachment);

-			className	=	item.GetType();

-			if ( className.Contains("Top_Admin") ) {

-				psisafe = psisafe + 1.0;

-			}	

-			}

-

-			damage_player = player.GetHealth("GlobalHealth", "Health");

-			player.SetHealth("GlobalHealth", "Health", damage_player - (damage_zonePSI - (damage_zonePSI * psisafe)));

-			if (psisafe>=1)

-				{

-					return true;

-				}					

-			if (psisafe==0)

-				{

-					if (psisafe<0.5)

-					{

-						player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_VOMIT); // рвота // SNEEZE - чихать

-					}

-					Param1<string> m_MessageParamPSI = new Param1<string>("Воздействие PSI! Нужно бежать!");

-					GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_MessageParamPSI, true, player.GetIdentity());

-				}

-			return true;

-		}

-		

-			

-		

-		return false;

-	}

-	

-	void CheckZones() {

-		ref array<Man> players = new array<Man>;

-		GetGame().GetPlayers( players );

-		

-		for ( int i = 0; i < players.Count(); i++ )

-		{

-			PlayerBase player;

-			Class.CastTo(player, players.Get(i));

-			

-			for ( int j = 0; j < ga_zones.Count(); j++ ) {

-				if(InZone(player, ga_zones.Get(j))) {

-					break;

-				}

-			}

-		}

-	}

+class Zone {
+	int id;
+	int type;
+	vector pos;
+	float radius;
+}
+
+enum ZoneType {
+	SAFE,
+	PSI,
+	RAD,
+	BIO
+}
+
+ref array<ref Zone> ga_zones = new array<ref Zone>;
+
+ref ControllerZones ctrl_zones = new ControllerZones;
+
+class ControllerZones {
+	void ControllerZones() {
+		
+		int id = 0;//
+		vector pos;
+		float radius;
+		int type = 0;
+		// only RAD param ↓↓↓ 
+		id = id + 1; // Територия янтаратя 200 метров RAD
+		pos = "2405 0 6541"; 
+		radius = 200.0;
+		AddZone(id, pos, radius, ZoneType.RAD);
+		
+		// only PSI param ↓↓↓
+		id = id + 1; // Територия янтаратя 200 метров PSI
+		pos = "2405 0 6541"; 
+		radius = 200.0;
+		AddZone(id, pos, radius, ZoneType.PSI);
+
+		GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(CheckZones, 5000, true);
+	}
+	
+	void ~ControllerZones() {
+	}
+	
+	void AddZone(int id, vector pos, float radius, int type) {
+		ref Zone zone = new ref Zone;
+		zone.id = id;
+		zone.pos = pos;
+		zone.radius = radius;
+		zone.type = type;
+
+		ga_zones.Insert(zone);
+	}
+	
+	bool InZone(PlayerBase player, ref Zone zone) {
+		vector player_position = player.GetPosition();
+		player_position[1] = 0;
+
+		EntityAI attachment;
+		ItemBase item;
+		string className;
+		float biosafe = 0;
+		float psisafe = 0;
+		float damage_player;
+		float damage_zone = 0;
+		float damage_zonePSI = 8.0;
+		float rpu = 1.0;
+			
+		if( (vector.Distance(player_position, zone.pos)) < zone.radius && zone.type == ZoneType.RAD) {
+			
+
+			
+			attachment = player.FindAttachmentBySlotName("Mask"); // Перечеь защиты от радиации
+			if ( attachment && attachment.IsItemBase() ) 
+				{
+					item		=	Class.Cast(attachment);
+					className	=	item.GetType();
+					if ( className.Contains("dzrp_GasMask_GP1") ) 
+					{
+						biosafe = biosafe + 1.0;
+					}
+				}
+		    attachment = player.FindAttachmentBySlotName("Body");
+			if ( attachment && attachment.IsItemBase() ) 
+			{
+				item		=	Class.Cast(attachment);
+				className	=	item.GetType();
+				if ( className.Contains("Top_Admin") ) 
+					{
+						biosafe = biosafe + 1.0;
+					}	
+				}
+			
+			if (((ga_zones.Get(j).radius - (vector.Distance(player_position, ga_zones.Get(j).pos)) ) * rpu) > 1 )
+			{
+				radiationcnt = ((ga_zones.Get(j).radius - (vector.Distance(player_position, ga_zones.Get(j).pos)) ) * rpu) + Math.RandomInt(1,10000)*0.00001;
+				if ( DayZRP_Static.IsItemInInventory( player, "DayZRP_Doz" ) ){
+					Param1<string> m_MessageParamRD = new Param1<string>( "Дозиметр : " + radiationcnt + "м3в" );
+					GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_MessageParamRD, true, player.GetIdentity());
+				}
+			}
+			if (biosafe<1)
+				{
+					damage_zone=((ga_zones.Get(j).radius - (vector.Distance(player_position, ga_zones.Get(j).pos)) ) * rpu)/50;
+					damage_player = player.GetHealth("GlobalHealth", "Health");
+					player.SetHealth("GlobalHealth", "Health", damage_player - (damage_zone - (damage_zone * biosafe)));
+					if (biosafe==0)
+						{
+							player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_COUGH); //Кашель
+							Param1<string> m_MessageParam = new Param1<string>("Воздействие Радиации! Одень противогаз!");
+							GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_MessageParam, true, player.GetIdentity()); 
+						}
+				}
+			
+		}		
+		else if((vector.Distance(player_position, zone.pos)) < zone.radius && zone.type == ZoneType.PSI) {
+	
+			attachment = player.FindAttachmentBySlotName("Mask");// Перечеь защиты от PSI
+			if ( attachment && attachment.IsItemBase() ) {
+				item		=	Class.Cast(attachment);
+				className	=	item.GetType();
+				if ( className.Contains("dzrp_GasMask_GP7") ) {
+					psisafe = psisafe + 1.0;
+				}
+			}
+			attachment = player.FindAttachmentBySlotName("Body");
+			if ( attachment && attachment.IsItemBase() ) {
+			item		=	Class.Cast(attachment);
+			className	=	item.GetType();
+			if ( className.Contains("Top_Admin") ) {
+				psisafe = psisafe + 1.0;
+			}	
+			}
+
+			damage_player = player.GetHealth("GlobalHealth", "Health");
+			player.SetHealth("GlobalHealth", "Health", damage_player - (damage_zonePSI - (damage_zonePSI * psisafe)));
+			if (psisafe>=1)
+				{
+					return true;
+				}					
+			if (psisafe==0)
+				{
+					if (psisafe<0.5)
+					{
+						player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_VOMIT); // рвота // SNEEZE - чихать
+					}
+					Param1<string> m_MessageParamPSI = new Param1<string>("Воздействие PSI! Нужно бежать!");
+					GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_MessageParamPSI, true, player.GetIdentity());
+				}
+			return true;
+		}
+		
+			
+		
+		return false;
+	}
+	
+	void CheckZones() {
+		ref array<Man> players = new array<Man>;
+		GetGame().GetPlayers( players );
+		
+		for ( int i = 0; i < players.Count(); i++ )
+		{
+			PlayerBase player;
+			Class.CastTo(player, players.Get(i));
+			
+			for ( int j = 0; j < ga_zones.Count(); j++ ) {
+				if(InZone(player, ga_zones.Get(j))) {
+					break;
+				}
+			}
+		}
+	}
 }
\ 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 @@
-<?
-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' );
+<?php
+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');
 
-define('GAME',true);
+const GAME = true;
 include('../_incl_data/class/__db_connect.php');
-include('../_incl_data/class/__user.php');
+$u = User::start();
 mysql_query('SET NAMES utf8');
 
-if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
-	if( isset($u->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' => '<br />', 
-				'\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' => '<br />',
+                '\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/fight/take.user.php b/fight/take.user.php
index 50245c59..ef9a0964 100644
--- a/fight/take.user.php
+++ b/fight/take.user.php
@@ -7,7 +7,7 @@ header( 'Pragma: no-cache' );
 header( 'Content-Type: text/html; charset=windows-1251' );
 
 define('GAME',true);
-include('../_incl_data/class/__db_connect.php');
+require_once('../_incl_data/class/__db_connect.php');
 mysql_query('SET NAMES utf8');
 
 if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
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 @@
 <?php
-if(!defined('GAME'))
-{
-	die();
+if (!defined('GAME')) {
+    die();
 }
 
 //Forum class
-class forum 
+class forum
 {
-	public $mod = 0,$see = array(), $lst = array(),$gd = array(),$menu = '',$pages = '',$r ,$user = false,$fm = false,$error,$acs = array(0=>'������ ������',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.='<u>'.$i."</u>";
-				}elseif( ( $_GET['page']!=$i || $pagers!=0 ) ){
-              		$plist.='<a href="'.$_SERVER['PHP_SELF'].'?'.$pre_url.'page='.$i.'"><b>'.$i."</b></a>";
-			  	}else{
-			  		$plist.='<u>'.$i.'</u>';
-			  	}
+
+    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 .= '<u>' . $i . "</u>";
+            } elseif (($_GET['page'] != $i || $pagers != 0)) {
+                $plist .= '<a href="' . $_SERVER['PHP_SELF'] . '?' . $pre_url . 'page=' . $i . '"><b>' . $i . "</b></a>";
+            } else {
+                $plist .= '<u>' . $i . '</u>';
             }
-			if($plist == '') {
-				$plist = '<u>1</u>';
-			}
-		return '<pages>'.$plist.'</pages>';
-	}
-	
-	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('<meta http-equiv="refresh" content="0; URL=https://new-combats.com/forum?read='.round((int)$_GET['read']).'&page='.round((int)$_GET['page']).'">');
-						}
-					}
-				}
-				$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 = '<b>'.$prc.'</b>';
-								}
-							}else{
-								$prc = floor($prc/$pr_all*100);
-								if($prc > 0) {
-									$pr_lst += $prc;
-									$prc = '<b>'.$prc.'</b>';
-								}
-							}
-							if(isset($this->user['id'])) {
-								if(isset($yg['id'])) {
-									if($yg['answer'] == $j) {
-										$zm = '<tr class="answ1h"><td>&bull; <b>'.$ra[$j].'</b></td><td> &nbsp; &nbsp; - &nbsp; '.$prc.'% &nbsp; <small style="color:red">(��� �����)</small></td></tr>';
-									}else{
-										$zm = '<tr><td>&bull; '.$ra[$j].'</td><td> &nbsp; &nbsp; - &nbsp; '.$prc.'%</td></tr>';
-									}
-								}else{
-									$zm = '<tr onclick="location.href=\'?read='.round((int)$_GET['read']).'&page='.round((int)$_GET['page']).'&q_now='.$i.'&answer_now='.$j.'\'" class="answ1" title="���������� �� ���� �������"><td>&bull; '.$ra[$j].'</td><td> &nbsp; &nbsp; - &nbsp; '.$prc.'%</td></tr>';
-								}
-							}else{
-								$zm = '<tr><td>&bull; '.$ra[$j].'</td><td> &nbsp; &nbsp; - &nbsp; '.$prc.'%</td></tr>';
-							}
-							
-							$text = str_replace('[:]'.$ra[$j],$zm,$text);
-						}else{
-							$zm = '<h4>'.$ra[$j].'</h4><table>';
-							$text = str_replace(str_replace('<br>','',$ra[$j]),$zm,$text);
-						}
-					}else{
-						$j = -2;
-					}
-					$j++;
-				}	
-				$text = str_replace('[?]','',$text);
-			}else{
-				$i = -2;
-			}
-			$i++;
-		}
-		$text = str_replace('[/?]','</table><br><br>����� ������������� ����� '.$pr_us_all.'<div class="line2"></div>',$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'] = '<b>'.$ufr['login'].'</b> ['.$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 '&nbsp; <div class="btnAdm">';
-				if($this->user['admin']>0) {
-					echo '<a href="?aem='.$this->see['id'].'"><img title="�������������" src="https://new-combats.com/forum_script/img/ic_acc3.gif" width="10" height="10"></a>';
-				}
-				echo '<a href="?delete_msg='.$this->see['id'].'&read='.$this->see['id'].'"><img title="������� ������" src="https://new-combats.com/forum_script/img/ic_acc0.gif" width="10" height="10"></a>';
-				echo '<img onclick="acma('.$this->see['id'].');" title="��������������" src="https://new-combats.com/forum_script/img/ic_acc2.gif" width="10" height="10" style="cursor:pointer">';
-				echo '</div>';
-			}
-			echo ' &nbsp; &nbsp; (<span class="date">'.date('d.m.Y H:i',$this->see['time']).'</span>)<br>';
-			$this->see['text'] = str_replace("\n", "<br>", $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.'. <b>'.$pu1['login'].'</b>['.$pu1['level'].']';
-						if($pu1['online']>time()-520) {
-							$uslist .= ' <small>online</small>';
-						}
-						$uslist .= '<br>';
-					}
-				}
-				$this->see['text'] = str_replace("{users-list}", '<b style="color:green">������ ����������</b> ['.$xu1.'/25]:<br>'.$uslist.'<br>', $this->see['text']);
-				unset($uslist,$pu1,$su1,$xu1,$usrs);
-			}*/
-			
-			$rtrn = '';
-			$rtrn .= '<div';
-			if($this->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 .= '<div style="margin-left:31px;color:#9d9472;padding:10px;border:1px solid #ebdca0;">'.$this->see['text'].'</div>';
-				}
-				$rtrn .= '<div style="margin-left:31px;"><font color=red>������ ���� �������';
-				if($this->user['del_admin'] == 0) {
-					$rtrn .= ', <img src="https://'.$c['img'].'/i/align/align'.$this->see['del_align'].'.gif"><b>'.$this->see['del_login'].'</b>';
-				}
-				$rtrn .= '</font></div>';
-			}
-			
-			//������ ����������� � �������
-			$sp1 = mysql_query('SELECT * FROM `forum_msg_mod` WHERE `msg_id` = "'.$this->see['id'].'"');
-			while($pl1 = mysql_fetch_array($sp1)) {
-				$rtrn .= '<div style="margin-left:31px;color:'.$pl1['color'].';">';
-				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", "<br>", $pl1['text']);	
-				$rtrn .= $this->link_it($pl1['text']).'</div>';
-			}
-			
-			$rtrn .= '</div><div class="line2"></div>';
-			//������� �����������
-			$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 .= '&nbsp; <div class="btnAdm">';
-					if($this->user['admin']>0) {
-						$rtrn .= '<a href="?aem='.$pl['id'].'"><img title="�������������" src="https://new-combats.com/forum_script/img/ic_acc3.gif" width="10" height="10"></a>';
-					}
-					$rtrn .= '<a href="?delete_msg='.$pl['id'].'&read='.$pl['topic'].'"><img title="������� �����������" src="https://new-combats.com/forum_script/img/ic_acc0.gif" width="10" height="10"></a>';
-					$rtrn .= '<img onclick="acma('.$pl['id'].');" title="��������������" src="https://new-combats.com/forum_script/img/ic_acc2.gif" width="10" height="10" style="cursor:pointer">';
-					$rtrn .= '</div>';
-				}
-				$rtrn .= ' &nbsp; &nbsp; (<span class="date">'.date('d.m.Y H:i',$pl['time']).'</span>)<br>';
-				$pl['text'] = $this->parse_bb_code($pl['text']);
-				$pl['text'] = str_replace("\n", "<br>", $pl['text']);				
-				if($pl['clear']==0){
-					$rtrn .= '<div style="margin-left:31px;">'.$pl['text'].'</div>';
-				}else{
-					if($this->user['admin'] > 0) {
-						$rtrn .= '<div style="margin-left:31px;color:#9d9472;padding:10px;border:1px solid #ebdca0;">'.$pl['text'].'</div>';
-					}
-					$rtrn .= '<div style="margin-left:31px;"><font color=red>����������� ������';
-					if($this->user['del_admin'] == 0) {
-						$rtrn .= ', <img src="https://'.$c['img'].'/i/align/align'.$pl['del_align'].'.gif"><b>'.$pl['del_login'].'</b>';
-					}
-					$rtrn .= '</font></div>';
-				}
-				
-				//������ ����������� � �������
-				$sp1 = mysql_query('SELECT * FROM `forum_msg_mod` WHERE `msg_id` = "'.$pl['id'].'"');
-				while($pl1 = mysql_fetch_array($sp1)) {
-					$rtrn .= '<div style="margin-left:31px;color:'.$pl1['color'].';">';
-					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", "<br>", $pl1['text']);	
-					$rtrn .= $this->link_it($pl1['text']).'</div>';
-				}
-				
-				$rtrn .= '<div class="line2"></div>';	
-			}
-			echo $rtrn;	
-			
-		}
-	}
-	
-	public function link_it($text) {
-		$text= preg_replace("/(^|[\n ])([\w]*?)((ht|f)tp(s)?:\/\/[\w]+[^ \,\"\n\r\t<]*)/is", "$1$2<a target=\"_blank\" href=\"$3\" >$3</a>", $text);
-		$text= preg_replace("/(^|[\n ])([\w]*?)((www|ftp)\.[^ \,\"\t\n\r<]*)/is", "$1$2<a target=\"_blank\" href=\"https://$3\" >$3</a>", $text);
-		$text= preg_replace("/(^|[\n ])([a-z0-9&\-_\.]+?)@([\w\-]+\.([\w\-\.]+)+)/i", "$1<a target=\"_blank\" href=\"mailto:$2@$3\">$2@$3</a>", $text);
-		return($text);
-	}
+        }
+        if ($plist == '') {
+            $plist = '<u>1</u>';
+        }
+        return '<pages>' . $plist . '</pages>';
+    }
 
-	
-	public function genuser($id,$login,$level,$align,$clan,$invis,$city,$cityreg)
-	{
-		global $c,$code;
-		$ufr = '';
-		if($align>0)
-		{
-			$u .= '<img src="https://'.$c['img'].'/i/align/align'.$align.'.gif" />';
-		}
-		if($clan>0)
-		{
-			$clan = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.((int)$clan).'" LIMIT 1'));
-			if(isset($clan['id']))
-			{
-				$u .= '<img src="https://'.$c['img'].'/i/clan/'.$clan['name_mini'].'.gif" />';
-			}
-		}
-		
-		if($login == '<�������������>')
-		{
-			$login = '�������������';
-		}
-		
-		$u .= '<b>'.$login.'</b> ['.$level.']<a href="https://'.$c['host'].'/info/'.$id.'" target="_blank" title="���. � '.$login.'"><img src="https://'.$c['img'].'/i/inf_capitalcity.gif"></a>';
-		
-		if($city!='')
-		{
-			$ufr = '<img title="'.$city.'" src="https://new-combats.com/forum_script/img/city/'.$city.'.gif" width="17" height="15"> &nbsp; '.$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\]/', '<pre><code>', $text);
-		$text = preg_replace('/\[\/code\]/', '</code></pre>', $text);
-		
-		$text = preg_replace('/\[(\/?)quote\]/', "<$1blockquote>", $text);
-		$text = preg_replace('/\[(\/?)quote(\s*=\s*([\'"]?)([^\'"]+)\3\s*)?\]/', "<$1blockquote>������ $4:<br>", $text);
-		
-		//$text = preg_replace('/\[url\](?:https:\/\/)?([a-z0-9-.]+\.\w{2,4})\[\/url\]/', "<a href=\"https://$1\">$1</a>", $text);
-		$text = preg_replace('/\[url=(.+?)\](.+?)\[\/url\]/', "<a target=\"_blank\" href=\"$1\">$2</a>", $text);
-		$text = preg_replace('/\[url\s?=\s?([\'"]?)(?:https:\/\/)?([a-z0-9-.]+\.\w{2,4})\1\](.*?)\[\/url\]/', "<a href=\"https://$2\">$3</a>", $text);
-		
-		
-		$text = preg_replace('/\[img\s*\]([^\]\[]+)\[\/img\]/', "<img src='$1'/>", $text);
-		$text = preg_replace('/\[img\s*=\s*([\'"]?)([^\'"\]]+)\1\]/', "<img src='$2'/>", $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("#</([a-z]+)>#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 .= '</'.$openedtags[$i].'>';
-				}
-			} 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 = 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 = '<b>'.date('d.m.Y H:i').'</b> �� ������ ����������� ����� ����� � ����������, � ������� �� ��������� �������. <a href=https://new-combats.com/forum?read='.$topic.' target=_blank \>������ �����</a>';
-						$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='<small>'.$this->paginator(2,$pl['id']).'</small>';
-			if($plist!=''){
-			$plist='<img src="https://new-combats.com/forum_script/img/p.gif" width="10" height="12"> '.$plist.'';}
-			
-			$re .= '<div';
-			$fxd = '';
-			if($pl['fixed'] > 0) {
-				$fxd = '<img src="https://new-combats.com/forum_script/img/fixed.gif"> ';
-				$re .= ' class="fixed_topik"';
-			}
-			$re .= ' style="margin-top:10px;">';
-			$re .= '<div>'.$fxd.'<img style="border:0px;" src="https://new-combats.com/forum_script/img/icon'.$pl['ico'].'.gif"> <a href="?read='.$pl['id'].'&rnd='.$code.'"><b>'.$pl['title'].'</b></a> '.$plist.' &nbsp; '.$this->genuser($pl['uid'],$pl['login'],$pl['level'],$pl['align'],$pl['clan'],$pl['invis'],$pl['city'],$pl['cityreg']).'</div>';
-			$re .= '<div style="margin-left:21px;"><small class="date">'.date('d.m.Y H:i',$pl['time']).'</small> &raquo; <small style="color:#606060;">';
-			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 .= '</small></div>';
-			$re .= '<div style="margin-left:21px;"><small>�������: <b>'.$row.'</b> ... ';
-			
-			$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 .= ' &nbsp;  &nbsp; ('.date('d.m.Y H:i',$lstDT).')</small></div>';
-			$re .= '</div>';
-			$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 = '<img width="10" height="10" title="'.$this->acs[$ico].'" src="https://new-combats.com/forum_script/img/ic_acc'.$ico.'.gif">';
-			$rt = ''.$ico.' <a href="?r='.$pl['id'].'&rnd='.$code.'"><b>'.$pl['name'].'</b></a>';
-		}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).'<br>';
-				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 .= '&nbsp;&nbsp;&nbsp;&nbsp;'.$this->genRz($pl2).'<br>';
-						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 .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$this->genRz($pl3).'<br>';
-							}
-						}
-					}
-				}
-			}
-		}		
-		
-		$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('<meta http-equiv="refresh" content="0; URL=https://new-combats.com/forum?read=' . round((int)$_GET['read']) . '&page=' . round((int)$_GET['page']) . '">');
+                        }
+                    }
+                }
+                $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 = '<b>' . $prc . '</b>';
+                                }
+                            } else {
+                                $prc = floor($prc / $pr_all * 100);
+                                if ($prc > 0) {
+                                    $pr_lst += $prc;
+                                    $prc = '<b>' . $prc . '</b>';
+                                }
+                            }
+                            if (isset($this->user['id'])) {
+                                if (isset($yg['id'])) {
+                                    if ($yg['answer'] == $j) {
+                                        $zm = '<tr class="answ1h"><td>&bull; <b>' . $ra[$j] . '</b></td><td> &nbsp; &nbsp; - &nbsp; ' . $prc . '% &nbsp; <small style="color:red">(��� �����)</small></td></tr>';
+                                    } else {
+                                        $zm = '<tr><td>&bull; ' . $ra[$j] . '</td><td> &nbsp; &nbsp; - &nbsp; ' . $prc . '%</td></tr>';
+                                    }
+                                } else {
+                                    $zm = '<tr onclick="location.href=\'?read=' . round((int)$_GET['read']) . '&page=' . round((int)$_GET['page']) . '&q_now=' . $i . '&answer_now=' . $j . '\'" class="answ1" title="���������� �� ���� �������"><td>&bull; ' . $ra[$j] . '</td><td> &nbsp; &nbsp; - &nbsp; ' . $prc . '%</td></tr>';
+                                }
+                            } else {
+                                $zm = '<tr><td>&bull; ' . $ra[$j] . '</td><td> &nbsp; &nbsp; - &nbsp; ' . $prc . '%</td></tr>';
+                            }
+
+                            $text = str_replace('[:]' . $ra[$j], $zm, $text);
+                        } else {
+                            $zm = '<h4>' . $ra[$j] . '</h4><table>';
+                            $text = str_replace(str_replace('<br>', '', $ra[$j]), $zm, $text);
+                        }
+                    } else {
+                        $j = -2;
+                    }
+                    $j++;
+                }
+                $text = str_replace('[?]', '', $text);
+            } else {
+                $i = -2;
+            }
+            $i++;
+        }
+        $text = str_replace('[/?]', '</table><br><br>����� ������������� ����� ' . $pr_us_all . '<div class="line2"></div>', $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'] = '<b>' . $ufr['login'] . '</b> [' . $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 '&nbsp; <div class="btnAdm">';
+                if ($this->user['admin'] > 0) {
+                    echo '<a href="?aem=' . $this->see['id'] . '"><img title="�������������" src="https://new-combats.com/forum_script/img/ic_acc3.gif" width="10" height="10"></a>';
+                }
+                echo '<a href="?delete_msg=' . $this->see['id'] . '&read=' . $this->see['id'] . '"><img title="������� ������" src="https://new-combats.com/forum_script/img/ic_acc0.gif" width="10" height="10"></a>';
+                echo '<img onclick="acma(' . $this->see['id'] . ');" title="��������������" src="https://new-combats.com/forum_script/img/ic_acc2.gif" width="10" height="10" style="cursor:pointer">';
+                echo '</div>';
+            }
+            echo ' &nbsp; &nbsp; (<span class="date">' . date('d.m.Y H:i', $this->see['time']) . '</span>)<br>';
+            $this->see['text'] = str_replace("\n", "<br>", $this->see['text']);
+            $this->see['text'] = $this->testAnswer($this->see['text']);
+            $this->see['text'] = $this->parse_bb_code($this->see['text']);
+
+            $rtrn = '';
+            $rtrn .= '<div';
+            if ($this->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 .= '<div style="margin-left:31px;color:#9d9472;padding:10px;border:1px solid #ebdca0;">' . $this->see['text'] . '</div>';
+                }
+                $rtrn .= '<div style="margin-left:31px;"><font color=red>������ ���� �������';
+                if ($this->user['del_admin'] == 0) {
+                    $rtrn .= ', <img src="https://' . $c['img'] . '/i/align/align' . $this->see['del_align'] . '.gif"><b>' . $this->see['del_login'] . '</b>';
+                }
+                $rtrn .= '</font></div>';
+            }
+
+            //������ ����������� � �������
+            $sp1 = mysql_query('SELECT * FROM `forum_msg_mod` WHERE `msg_id` = "' . $this->see['id'] . '"');
+            while ($pl1 = mysql_fetch_array($sp1)) {
+                $rtrn .= '<div style="margin-left:31px;color:' . $pl1['color'] . ';">';
+                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", "<br>", $pl1['text']);
+                $rtrn .= $this->link_it($pl1['text']) . '</div>';
+            }
+
+            $rtrn .= '</div><div class="line2"></div>';
+            //������� �����������
+            $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 .= '&nbsp; <div class="btnAdm">';
+                    if ($this->user['admin'] > 0) {
+                        $rtrn .= '<a href="?aem=' . $pl['id'] . '"><img title="�������������" src="https://new-combats.com/forum_script/img/ic_acc3.gif" width="10" height="10"></a>';
+                    }
+                    $rtrn .= '<a href="?delete_msg=' . $pl['id'] . '&read=' . $pl['topic'] . '"><img title="������� �����������" src="https://new-combats.com/forum_script/img/ic_acc0.gif" width="10" height="10"></a>';
+                    $rtrn .= '<img onclick="acma(' . $pl['id'] . ');" title="��������������" src="https://new-combats.com/forum_script/img/ic_acc2.gif" width="10" height="10" style="cursor:pointer">';
+                    $rtrn .= '</div>';
+                }
+                $rtrn .= ' &nbsp; &nbsp; (<span class="date">' . date('d.m.Y H:i', $pl['time']) . '</span>)<br>';
+                $pl['text'] = $this->parse_bb_code($pl['text']);
+                $pl['text'] = str_replace("\n", "<br>", $pl['text']);
+                if ($pl['clear'] == 0) {
+                    $rtrn .= '<div style="margin-left:31px;">' . $pl['text'] . '</div>';
+                } else {
+                    if ($this->user['admin'] > 0) {
+                        $rtrn .= '<div style="margin-left:31px;color:#9d9472;padding:10px;border:1px solid #ebdca0;">' . $pl['text'] . '</div>';
+                    }
+                    $rtrn .= '<div style="margin-left:31px;"><font color=red>����������� ������';
+                    if ($this->user['del_admin'] == 0) {
+                        $rtrn .= ', <img src="https://' . $c['img'] . '/i/align/align' . $pl['del_align'] . '.gif"><b>' . $pl['del_login'] . '</b>';
+                    }
+                    $rtrn .= '</font></div>';
+                }
+
+                //������ ����������� � �������
+                $sp1 = mysql_query('SELECT * FROM `forum_msg_mod` WHERE `msg_id` = "' . $pl['id'] . '"');
+                while ($pl1 = mysql_fetch_array($sp1)) {
+                    $rtrn .= '<div style="margin-left:31px;color:' . $pl1['color'] . ';">';
+                    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", "<br>", $pl1['text']);
+                    $rtrn .= $this->link_it($pl1['text']) . '</div>';
+                }
+
+                $rtrn .= '<div class="line2"></div>';
+            }
+            echo $rtrn;
+
+        }
+    }
+
+    public function link_it($text)
+    {
+        $text = preg_replace("/(^|[\n ])([\w]*?)((ht|f)tp(s)?:\/\/[\w]+[^ \,\"\n\r\t<]*)/is", "$1$2<a target=\"_blank\" href=\"$3\" >$3</a>", $text);
+        $text = preg_replace("/(^|[\n ])([\w]*?)((www|ftp)\.[^ \,\"\t\n\r<]*)/is", "$1$2<a target=\"_blank\" href=\"https://$3\" >$3</a>", $text);
+        $text = preg_replace("/(^|[\n ])([a-z0-9&\-_\.]+?)@([\w\-]+\.([\w\-\.]+)+)/i", "$1<a target=\"_blank\" href=\"mailto:$2@$3\">$2@$3</a>", $text);
+        return ($text);
+    }
+
+
+    public function genuser($id, $login, $level, $align, $clan, $invis, $city, $cityreg)
+    {
+        global $c, $code;
+        $ufr = '';
+        if ($align > 0) {
+            $u .= '<img src="https://' . $c['img'] . '/i/align/align' . $align . '.gif" />';
+        }
+        if ($clan > 0) {
+            $clan = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . ((int)$clan) . '" LIMIT 1'));
+            if (isset($clan['id'])) {
+                $u .= '<img src="https://' . $c['img'] . '/i/clan/' . $clan['name_mini'] . '.gif" />';
+            }
+        }
+
+        if ($login == '<�������������>') {
+            $login = '�������������';
+        }
+
+        $u .= '<b>' . $login . '</b> [' . $level . ']<a href="https://' . $c['host'] . '/info/' . $id . '" target="_blank" title="���. � ' . $login . '"><img src="https://' . $c['img'] . '/i/inf_capitalcity.gif"></a>';
+
+        if ($city != '') {
+            $ufr = '<img title="' . $city . '" src="https://new-combats.com/forum_script/img/city/' . $city . '.gif" width="17" height="15"> &nbsp; ' . $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\]/', '<pre><code>', $text);
+        $text = preg_replace('/\[\/code\]/', '</code></pre>', $text);
+
+        $text = preg_replace('/\[(\/?)quote\]/', "<$1blockquote>", $text);
+        $text = preg_replace('/\[(\/?)quote(\s*=\s*([\'"]?)([^\'"]+)\3\s*)?\]/', "<$1blockquote>������ $4:<br>", $text);
+
+        //$text = preg_replace('/\[url\](?:https:\/\/)?([a-z0-9-.]+\.\w{2,4})\[\/url\]/', "<a href=\"https://$1\">$1</a>", $text);
+        $text = preg_replace('/\[url=(.+?)\](.+?)\[\/url\]/', "<a target=\"_blank\" href=\"$1\">$2</a>", $text);
+        $text = preg_replace('/\[url\s?=\s?([\'"]?)(?:https:\/\/)?([a-z0-9-.]+\.\w{2,4})\1\](.*?)\[\/url\]/', "<a href=\"https://$2\">$3</a>", $text);
+
+
+        $text = preg_replace('/\[img\s*\]([^\]\[]+)\[\/img\]/', "<img src='$1'/>", $text);
+        $text = preg_replace('/\[img\s*=\s*([\'"]?)([^\'"\]]+)\1\]/', "<img src='$2'/>", $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("#</([a-z]+)>#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 .= '</' . $openedtags[$i] . '>';
+                }
+            } 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 = '<b>' . date('d.m.Y H:i') . '</b> �� ������ ����������� ����� ����� � ����������, � ������� �� ��������� �������. <a href=https://new-combats.com/forum?read=' . $topic . ' target=_blank \>������ �����</a>';
+                        $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 = '<small>' . $this->paginator(2, $pl['id']) . '</small>';
+            if ($plist != '') {
+                $plist = '<img src="https://new-combats.com/forum_script/img/p.gif" width="10" height="12"> ' . $plist . '';
+            }
+
+            $re .= '<div';
+            $fxd = '';
+            if ($pl['fixed'] > 0) {
+                $fxd = '<img src="https://new-combats.com/forum_script/img/fixed.gif"> ';
+                $re .= ' class="fixed_topik"';
+            }
+            $re .= ' style="margin-top:10px;">';
+            $re .= '<div>' . $fxd . '<img style="border:0px;" src="https://new-combats.com/forum_script/img/icon' . $pl['ico'] . '.gif"> <a href="?read=' . $pl['id'] . '&rnd=' . $code . '"><b>' . $pl['title'] . '</b></a> ' . $plist . ' &nbsp; ' . $this->genuser($pl['uid'], $pl['login'], $pl['level'], $pl['align'], $pl['clan'], $pl['invis'], $pl['city'], $pl['cityreg']) . '</div>';
+            $re .= '<div style="margin-left:21px;"><small class="date">' . date('d.m.Y H:i', $pl['time']) . '</small> &raquo; <small style="color:#606060;">';
+            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 .= '</small></div>';
+            $re .= '<div style="margin-left:21px;"><small>�������: <b>' . $row . '</b> ... ';
+
+            $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 .= ' &nbsp;  &nbsp; (' . date('d.m.Y H:i', $lstDT) . ')</small></div>';
+            $re .= '</div>';
+            $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 = '<img width="10" height="10" title="' . $this->acs[$ico] . '" src="https://new-combats.com/forum_script/img/ic_acc' . $ico . '.gif">';
+            $rt = '' . $ico . ' <a href="?r=' . $pl['id'] . '&rnd=' . $code . '"><b>' . $pl['name'] . '</b></a>';
+        } 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) . '<br>';
+                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 .= '&nbsp;&nbsp;&nbsp;&nbsp;' . $this->genRz($pl2) . '<br>';
+                        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 .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $this->genRz($pl3) . '<br>';
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        $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 @@
-<?
+<?php
 
-define('GAME',true);
+define('GAME', true);
 include('../_incl_data/__config.php');
 include('../_incl_data/class/__db_connect.php');
-include('../_incl_data/class/__filter_class.php');
-include('../_incl_data/class/__user.php');
+$filter = new Filter();
+$u = User::start();
 include('_forum.class.php');
 
-$url = explode('?',$_SERVER["REQUEST_URI"]);
-if(isset($url[1])) {
-	$i = 0;
-	$x = explode('&',$url[1]);
-	while( $i < count($x) ) {
-		$x2 = explode('=',$x[$i]);
-		if(is_array($x2)) {
-			if(!isset($x2[1])) {
-				$x2[1] = true;
-			}
-			$_GET[$x2[0]] = $x2[1];
-		}else{
-			$_GET[$x[$i]] = true;
-		}
-		$i++;
-	}
+$url = explode('?', $_SERVER["REQUEST_URI"]);
+if (isset($url[1])) {
+    $i = 0;
+    $x = explode('&', $url[1]);
+    while ($i < count($x)) {
+        $x2 = explode('=', $x[$i]);
+        if (is_array($x2)) {
+            if (!isset($x2[1])) {
+                $x2[1] = true;
+            }
+            $_GET[$x2[0]] = $x2[1];
+        } else {
+            $_GET[$x[$i]] = true;
+        }
+        $i++;
+    }
 }
 
-if(isset($_GET['page'])) {
-	$_GET['page'] = round((int)$_GET['page']);
-	if($_GET['page'] < 1) {
-		$_GET['page'] = 1;
-	}
-}else{
-	$_GET['page'] = 1;
+if (isset($_GET['page'])) {
+    $_GET['page'] = round((int)$_GET['page']);
+    if ($_GET['page'] < 1) {
+        $_GET['page'] = 1;
+    }
+} else {
+    $_GET['page'] = 1;
 }
 
 
 $f->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 = '�� ������, � ������� &quot;�������&quot; ������������ ����� ������ &quot;<b>'.$_POST['title'].'</b>&quot;. <a href=https://'.$c['host'].'/forum?read='.$add.' target=_blank \>������ �����</a>';
-				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 = '�� ������, � ������� &quot;�������&quot; ������������ ����� ������ &quot;<b>' . $_POST['title'] . '</b>&quot;. <a href=https://' . $c['host'] . '/forum?read=' . $add . ' target=_blank \>������ �����</a>';
+            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 => '������ ��� ��������'];
 ?>
 <!DOCTYPE html>
 <html>
 <head>
-<meta charset="windows-1251" />
-<link rel="canonical" href="https://new-combats.com/forum"/>
-<title>����� ���������� ������ ���� ����� ����������� ����</title>
-<meta name="description" content="����� ��������� ������� New Combats ? ����� ����������� �������� ����� ������� ����, ����������� ���� ��. ��������������� � ������� � �������� ���������� MMORPG."/>
-<meta name="keywords" content="���������� ���� ������, ���������� ����, Combats.com, ������ ���������� ����, ���� ���������� ����, ������ � �������, �������, ���������� ������ ����, Acombats, ������ ��, ������ � ������ ��, oldcombats, ������ ���, ���, likebk, Comabts, legbk, acomabts.com, ���� ����, ���� ������, ���� ����, ���� ����"/>
-<meta name="viewport" content="width=device-width, initial-scale=0.5, maximum-scale=1.0, user-scalable=no">
-<script  src="https://<?=$c['host']?>/js/jquery.js"></script>
-<script  src="https://<?=$c['host']?>/js/jquery.zclip.js"></script>
-<script>
-$.ajaxSetup({cache: false});
-$(window).error(function(){
-  return true;
-});
-</script>
-<script src="https://<?=$c['host']?>/js/interface.js"></script>
-<script src="https://<?=$c['host']?>/js/jqueryrotate.js"></script>
+    <meta charset="windows-1251"/>
+    <link rel="canonical" href="https://new-combats.com/forum"/>
+    <title>����� ���������� ������ ���� ����� ����������� ����</title>
+    <meta name="description"
+          content="����� ��������� ������� New Combats ? ����� ����������� �������� ����� ������� ����, ����������� ���� ��. ��������������� � ������� � �������� ���������� MMORPG."/>
+    <meta name="keywords"
+          content="���������� ���� ������, ���������� ����, Combats.com, ������ ���������� ����, ���� ���������� ����, ������ � �������, �������, ���������� ������ ����, Acombats, ������ ��, ������ � ������ ��, oldcombats, ������ ���, ���, likebk, Comabts, legbk, acomabts.com, ���� ����, ���� ������, ���� ����, ���� ����"/>
+    <meta name="viewport" content="width=device-width, initial-scale=0.5, maximum-scale=1.0, user-scalable=no">
+    <script src="https://<?= $c['host'] ?>/js/jquery.js"></script>
+    <script src="https://<?= $c['host'] ?>/js/jquery.zclip.js"></script>
+    <script>
+        $.ajaxSetup({cache: false});
+        $(window).error(function () {
+            return true;
+        });
+    </script>
+    <script src="https://<?= $c['host'] ?>/js/interface.js"></script>
+    <script src="https://<?= $c['host'] ?>/js/jqueryrotate.js"></script>
 
-<link rel="stylesheet" type="text/css" href="https://<?=$c['host']?>/css/windows.css" />
-<style type="text/css">
+    <link rel="stylesheet" type="text/css" href="https://<?= $c['host'] ?>/css/windows.css"/>
+    <style type="text/css">
+        <!--
+        html {
+            width: 100%;
+            height: 100%;
+        }
+
+        img {
+            border: none;
+        }
+
+        body {
+            width: 100%;
+            height: 100%;
+            margin-left: 0px;
+            margin-top: 0px;
+            margin-right: 0px;
+            margin-bottom: 0px;
+            background-color: #3D3D3B;
+            font-size: 10pt;
+            font-family: Verdana, Helvetica, Arial, Tahoma, sans-serif;
+        }
+
+        #header {
+            width: 100%;
+            height: 135px;
+            text-align: center;
+            background-image: url(https://new-combats.com/forum_script/img/line_capitalcity.jpg);
+        }
+
+        #footer {
+            width: 100%;
+            text-align: center;
+            background-image: url(https://new-combats.com/forum_script/img/footer_capitalcity.jpg);
+            background-repeat: repeat-x;
+            padding-top: 13px;
+            background-color: #000000;
+        }
+
+        #main {
+            width: 100%;
+            text-align: center;
+        }
+
+        #leftground {
+            background-image: url(https://new-combats.com/forum_script/img/leftground.jpg);
+        }
+
+        .text {
+            font-weight: normal;
+            /* font-size: 13px; */
+            font-size: 10pt;
+            color: #000000;
+            font-family: Verdana, Helvetica, Arial, Tahoma, sans-serif;
+        }
+
+        H3 {
+            font-weight: bold;
+            /* font-size: 16px; */
+            font-size: 12pt;
+            color: #8f0000;
+            font-family: Verdana, Helvetica, Arial, Tahoma, sans-serif;
+            text-align: center;
+        }
+
+        .answ1 {
+
+        }
+
+        .answ1:hover {
+            background-color: #EBDCA0;
+            background-image: url(https://new-combats.com/forum_script/img/ao.png);
+            cursor: pointer;
+        }
+
+        .answ1h {
+            background-color: #EBDCA0;
+            background-image: url(https://new-combats.com/forum_script/img/ao.png);
+            cursor: pointer;
+        }
+
+        H4 {
+            font-weight: bold;
+            /* font-size: 15px; */
+            font-size: 11pt;
+            margin-bottom: 5px;
+            color: #8f0000;
+            font-family: Verdana, Helvetica, Arial, Tahoma, sans-serif;
+        }
+
+        A:link {
+            font-weight: normal;
+            color: #524936;
+            text-decoration: none;
+        }
+
+        a:visited {
+            font-weight: normal;
+            color: #633525;
+            text-decoration: none;
+        }
+
+        a:active {
+            font-weight: normal;
+            color: #77684d;
+            text-decoration: none;
+        }
+
+        a:hover {
+            color: #1E1E1E;
+            text-decoration: underline;
+        }
+
+        .date {
+            font-weight: normal;
+            /* font-size: 11px; */
+            font-size: 8pt;
+            color: #007000;
+            font-family: Courier, Verdana, Helvetica, Arial, Tahoma, sans-serif;
+            text-decoration: none;
+        }
+
+        .line1 {
+            border-top-width: 1px;
+            border-top-style: solid;
+            border-top-color: #837B5C;
+            width: 100%;
+            margin-top: 7px;
+            margin-bottom: 7px;
+        }
+
+        .line2 {
+            border-top-width: 1px;
+            border-top-style: solid;
+            border-top-color: #C4BFAA;
+            width: 100%;
+            margin-top: 9px;
+            margin-bottom: 9px;
+        }
+
+        .text1 {
+            color: #8F0000;
+            font-size: 12px;
+        }
+
+        .inup {
+            border-right: #302F2A 1px double;
+            border-top: #302F2A 1px double;
+            /* font-size: 11px; */
+            font-size: 8pt;
+            border-left: #302F2A 1px double;
+            color: #000000;
+            border-bottom: #302F2A 1px double;
+            font-family: Verdana, Helvetica, Arial, Tahoma, sans-serif;
+            background-color: #DED7BD;
+        }
+
+        .text {
+            font-weight: normal;
+            /* font-size: 13px; */
+            font-size: 10pt;
+            color: #000000;
+            font-family: Verdana, Helvetica, Arial, Tahoma, sans-serif;
+        }
+
+        SELECT {
+            border-right: #b0b0b0 1pt solid;
+            border-top: #b0b0b0 1pt solid;
+            margin-top: 1px;
+            font-size: 10px;
+            margin-bottom: 2px;
+            border-left: #b0b0b0 1pt solid;
+            color: #191970;
+            border-bottom: #b0b0b0 1pt solid;
+            font-family: Verdana, Helvetica, Arial, Tahoma, sans-serif;
+        }
+
+        TEXTAREA {
+            border-right: #b0b0b0 1pt solid;
+            border-top: #b0b0b0 1pt solid;
+            margin-top: 1px;
+            font-size: 10px;
+            margin-bottom: 2px;
+            border-left: #b0b0b0 1pt solid;
+            color: #191970;
+            border-bottom: #b0b0b0 1pt solid;
+            font-family: Verdana, Helvetica, Arial, Tahoma, sans-serif;
+        }
+
+        INPUT {
+            border-right: #b0b0b0 1pt solid;
+            border-top: #b0b0b0 1pt solid;
+            margin-top: 1px;
+            font-size: 10px;
+            margin-bottom: 2px;
+            border-left: #b0b0b0 1pt solid;
+            color: #191970;
+            border-bottom: #b0b0b0 1pt solid;
+            font-family: Verdana, Helvetica, Arial, Tahoma, sans-serif;
+        }
+
+        pages a {
+            color: #5b3e33;
+            padding: 1px 3px 1px 3px;
+        }
+
+        pages u {
+            padding: 1px 3px 1px 3px;
+            color: #6f0000;
+            font-weight: bold;
+        }
+
+        pages a:hover {
+            background-color: #FFFFFF;
+        }
+
+        div.fixed_topik {
+            background-color: #EBDCA0;
+            background-image: url(https://new-combats.com/forum_script/img/ao.png);
+            background-repeat: repeat-x;
+            -webkit-border-radius: 8px;
+            -moz-border-radius: 8px;
+            border-radius: 8px;
+            -ms-border-radius: 8px;
+            margin-top: 2px;
+            margin-bottom: 2px;
+            padding: 5px;
+
+        }
+
+        div.fixed_topik_in {
+            background-color: #EBDCA0;
+            background-image: url(https://new-combats.com/forum_script/img/ao.png);
+            background-repeat: repeat-x;
+            margin-right: 120px;
+            -webkit-border-radius: 8px;
+            -moz-border-radius: 8px;
+            border-radius: 8px;
+            -ms-border-radius: 8px;
+            padding: 5px;
+        }
+
+        .btnAdm {
+            display: inline-block;
+            background-color: #ebdda4;
+            border: 1px solid #cabb80;
+            margin: 1px 1px -5px 1px;
+        }
+
+        .btnAdm img {
+            padding: 5px;
+            display: block;
+            float: left;
+        }
+
+        .btnAdm img:hover {
+            background-color: #c1b278;
+        }
+
+        -->
+    </style>
+    <script>
+        var c = {
+            url: '<?=$c['host']?>',
+            img: '<?=$c['img']?>',
+            uid: <?=(0 + $f->user['id'])?>,
+            login: '<?=$f->user['login']?>',
+            city: '<?=$f->user['city']?>',
+            lvl: <?=(0 + $f->user['level'])?>,
+            rnd: '1',
+            filter: 0,
+            time: <?=time()?>,
+            pl: 0,
+            align: <?=(0 + $f->user['align'])?>,
+            clan: <?=(0 + $f->user['clan'])?>,
+            admin: <?=(0 + $f->user['admin'])?>,
+            sound: 0,
+            money: 0
+        }, sd4key = "0f27a8a6a79921703aee0ba6ff02e4c2", lafstReg = {}, enterUse = 0;
+
+        function ctest(city) {
+            if (city != c['city']) {
+                top.location = 'club';
+            }
+        }
+
+        var key_actions = {};
 <!--
-html {
-	width:100%;
-	height:100%;
-}
-img {
-	border:none;
-}
-body {
-	width:100%;
-	height:100%;
-	margin-left: 0px;
-	margin-top: 0px;
-	margin-right: 0px;
-	margin-bottom: 0px;
-	background-color: #3D3D3B;
-	font-size: 10pt; font-family: Verdana, Helvetica, Arial, Tahoma, sans-serif; 
-}
-#header {
-	width:100%;
-	height:135px;
-	text-align:center;
-	background-image:url(https://new-combats.com/forum_script/img/line_capitalcity.jpg);
-}
-#footer {
-	width:100%;
-	text-align:center;
-	background-image:url(https://new-combats.com/forum_script/img/footer_capitalcity.jpg);
-	background-repeat:repeat-x;
-	padding-top:13px;
-	background-color:#000000;
-}
-#main {
-	width:100%;
-	text-align:center;
-}
-#leftground {
-	background-image:url(https://new-combats.com/forum_script/img/leftground.jpg);
-}
-.text {
-    font-weight: normal;
-    /* font-size: 13px; */
-    font-size: 10pt; 
-    color: #000000;
-    font-family: Verdana, Helvetica, Arial, Tahoma, sans-serif;
+function MM_jumpMenu(targ, selObj, restore) { //v3.0
+    eval(targ + ".location='" + selObj.options[selObj.selectedIndex].value + "'");
+    if (restore) selObj.selectedIndex = 0;
 }
 
-H3 {
-    font-weight: bold;
-    /* font-size: 16px; */
-    font-size: 12pt; 
-    color: #8f0000; 
-    font-family: Verdana, Helvetica, Arial, Tahoma, sans-serif; 
-    text-align: center;
-}
+        function acma(id) {
+            var html = '';
 
-.answ1 {
-	
-}
-.answ1:hover {
-    background-color: #EBDCA0;
-    background-image:  url(https://new-combats.com/forum_script/img/ao.png);
-	cursor:pointer;
-}
+            html += '<form method="post" action="https://new-combats.com/forum?read=<?=round(
+                    (int)$_GET['read']
+                )?>&page=<?=$_GET['page']?>">' +
+                '<table align="center">' +
+                '<tr>' +
+                '<td><h4>����� ����� ������:</h4></td>' +
+                '</tr>' +
+                '<tr>' +
+                '<td><textarea rows="8" class="inup" name="text2_adm" cols="85" wrap="virtual"></textarea></td>' +
+                '<td><input name="add2" type="button" class="btn" value=" � " title="������">' +
+                '<br />' +
+                '<input name="add2" type="button" class="btn" value=" � " title="���������">' +
+                '<br />' +
+                '<input name="add2" type="button" class="btn" value=" � " title="������������">' +
+                '<br />' +
+                '<input name="add2" type="button" class="btn" value="���" title="����� ���������"></td>' +
+                '</tr>' +
+                '<tr>' +
+                '<td colspan="2"><table width="100%">' +
+                '<tr>' +
+                <? if($f->user['admin'] > 0 ) { ?>
+                '<td><div align="left"><input name="adminname_adm" id="adminname_adm" type="checkbox" value="1" /><label for="adminname_adm"> �� ����� ������������� �������.</label></div><br><br /></td>' +
+                <? } ?>
+                '<td width="120" align="right"><input type="submit" class="btn" value="��������" name="add2_adm" />' +
+                '<input type="hidden" id="add_otv_adm" name="add_otv_adm" value="' + id + '" /></td>' +
+                '</tr>' +
+                '</table></td>' +
+                '</tr>' +
+                '</table>' +
+                '</form>';
 
-.answ1h {
-    background-color: #EBDCA0;
-    background-image:  url(https://new-combats.com/forum_script/img/ao.png);
-	cursor:pointer;
-}
 
-H4 {
-    font-weight: bold;
-    /* font-size: 15px; */
-    font-size: 11pt; 
-    margin-bottom: 5px;
-    color: #8f0000; 
-    font-family: Verdana, Helvetica, Arial, Tahoma, sans-serif;
-}
-A:link {
-    font-weight: normal;
-    color: #524936;
-    text-decoration: none;
-}
-a:visited {
-    font-weight: normal;
-    color: #633525; 
-    text-decoration: none;
-}
-a:active {
-    font-weight: normal;
-    color: #77684d;
-    text-decoration: none;
-}
-a:hover {
-	color: #1E1E1E;
-	text-decoration: underline;
-}
-.date {
-    font-weight: normal; 
-    /* font-size: 11px; */
-    font-size: 8pt; 
-    color: #007000; 
-    font-family: Courier, Verdana, Helvetica, Arial, Tahoma, sans-serif;
-    text-decoration: none; 
-}
-.line1 {
-	border-top-width: 1px;
-	border-top-style: solid;
-	border-top-color: #837B5C;
-	width:100%;	
-	margin-top:7px;
-	margin-bottom:7px;
-}
-.line2 {
-	border-top-width: 1px;
-	border-top-style: solid;
-	border-top-color: #C4BFAA;
-	width:100%;
-	margin-top:9px;
-	margin-bottom:9px;
-}
-.text1 {
-	color:#8F0000;
-	font-size:12px;
-}
-.inup {
-	border-right: #302F2A 1px double;
-	border-top: #302F2A 1px double;
-	/* font-size: 11px; */
-	font-size: 8pt; 
-	border-left: #302F2A 1px double;
-	color: #000000;
-	border-bottom: #302F2A 1px double;
-	font-family: Verdana, Helvetica, Arial, Tahoma, sans-serif;
-	background-color: #DED7BD;
-}
-.text {
-	font-weight: normal;
-	/* font-size: 13px; */
-	font-size: 10pt; 
-	color: #000000;
-	font-family: Verdana, Helvetica, Arial, Tahoma, sans-serif;
-}
-SELECT {
-	border-right: #b0b0b0 1pt solid; border-top: #b0b0b0 1pt solid; margin-top: 1px; font-size: 10px; 
-	margin-bottom: 2px; border-left: #b0b0b0 1pt solid; color: #191970; border-bottom: #b0b0b0 1pt solid; 
-	font-family: Verdana, Helvetica, Arial, Tahoma, sans-serif;
-}
-TEXTAREA {
-	border-right: #b0b0b0 1pt solid; border-top: #b0b0b0 1pt solid; margin-top: 1px; font-size: 10px; 
-	margin-bottom: 2px; border-left: #b0b0b0 1pt solid; color: #191970; border-bottom: #b0b0b0 1pt solid; 
-	font-family: Verdana, Helvetica, Arial, Tahoma, sans-serif;
-}
-INPUT {
-	border-right: #b0b0b0 1pt solid; border-top: #b0b0b0 1pt solid; margin-top: 1px; font-size: 10px; 
-	margin-bottom: 2px; border-left: #b0b0b0 1pt solid; color: #191970; border-bottom: #b0b0b0 1pt solid; 
-	font-family: Verdana, Helvetica, Arial, Tahoma, sans-serif;
-}
-pages a {
-	color:#5b3e33;
-	padding: 1px 3px 1px 3px;
-}
-pages u {
-	padding: 1px 3px 1px 3px;
-	color: #6f0000;
-	font-weight: bold;
-}
-pages a:hover {
-	background-color:#FFFFFF;
-}
-div.fixed_topik {
-    background-color: #EBDCA0;
-    background-image:  url(https://new-combats.com/forum_script/img/ao.png);
-    background-repeat: repeat-x;
-    -webkit-border-radius:8px;
-    -moz-border-radius:8px;
-    border-radius:8px;
-    -ms-border-radius:8px;
-    margin-top: 2px;
-    margin-bottom: 2px;
-	padding:5px;
+            win.add('cmments1forum', '�������� ������ � �����������', html, {'a1': 'alert(' + id + ');'}, 0, 1, 'width:630px;');
+        }
 
-}
-div.fixed_topik_in {
-    background-color: #EBDCA0;
-    background-image:  url(https://new-combats.com/forum_script/img/ao.png);
-    background-repeat: repeat-x;
-    margin-right: 120px;
-    -webkit-border-radius:8px;
-    -moz-border-radius:8px;
-    border-radius:8px;
-    -ms-border-radius:8px;
-	padding:5px;
-}
-.btnAdm {
-	display:inline-block;
-	background-color:#ebdda4;
-	border:1px solid #cabb80;
-	margin:1px 1px -5px 1px;
-}
-.btnAdm img {
-	padding:5px;
-	display:block;
-	float:left;
-}
-.btnAdm img:hover {
-	background-color:#c1b278;
-}
--->
-</style>
-<script>
-var c = { 
-	url:'<?=$c['host']?>',
-	img:'<?=$c['img']?>',
-	uid:<?=(0+$f->user['id'])?>,
-	login:'<?=$f->user['login']?>',
-	city:'<?=$f->user['city']?>',
-	lvl:<?=(0+$f->user['level'])?>,
-	rnd:'1',
-	filter:0,
-	time:<?=time()?>,
-	pl:0,
-	align:<?=(0+$f->user['align'])?>,
-	clan:<?=(0+$f->user['clan'])?>,
-	admin:<?=(0+$f->user['admin'])?>,
-	sound:0,
-	money:0}, sd4key = "0f27a8a6a79921703aee0ba6ff02e4c2", lafstReg = {},enterUse = 0;
-
-function ctest(city) {
-	if(city != c['city']) {
-		top.location = 'club';
-	}
-}
-var key_actions = {};
-<!--
-function MM_jumpMenu(targ,selObj,restore){ //v3.0
-  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
-  if (restore) selObj.selectedIndex=0;
-}
-function acma(id) {
-	var html = '';
-	
-	 html += '<form method="post" action="https://new-combats.com/forum?read=<?=round((int)$_GET['read'])?>&page=<?=$_GET['page']?>">'+
-                     '<table align="center">'+
-                       '<tr>'+
-                         '<td><h4>����� ����� ������:</h4></td>'+
-                       '</tr>'+
-                       '<tr>'+
-                         '<td><textarea rows="8" class="inup" name="text2_adm" cols="85" wrap="virtual"></textarea></td>'+
-                         '<td><input name="add2" type="button" class="btn" value=" � " title="������">'+
-                             '<br />'+
-                             '<input name="add2" type="button" class="btn" value=" � " title="���������">'+
-                             '<br />'+
-                             '<input name="add2" type="button" class="btn" value=" � " title="������������">'+
-                             '<br />'+
-                             '<input name="add2" type="button" class="btn" value="���" title="����� ���������"></td>'+
-                       '</tr>'+
-                       '<tr>'+
-                         '<td colspan="2"><table width="100%">'+
-                             '<tr>'+
-                               <? if($f->user['admin'] > 0 ) { ?>
-							   '<td><div align="left"><input name="adminname_adm" id="adminname_adm" type="checkbox" value="1" /><label for="adminname_adm"> �� ����� ������������� �������.</label></div><br><br /></td>'+
-                               <? } ?>
-							   '<td width="120" align="right"><input type="submit" class="btn" value="��������" name="add2_adm" />'+
-                                   '<input type="hidden" id="add_otv_adm" name="add_otv_adm" value="'+id+'" /></td>'+
-                             '</tr>'+
-                         '</table></td>'+
-                       '</tr>'+
-                     '</table>'+
-                   '</form>';
-
-	
-	win.add('cmments1forum','�������� ������ � �����������',html,{'a1':'alert('+id+');'},0,1,'width:630px;');
-}
-//-->
-</script>
+        //-->
+    </script>
 </head>
 
 <body>
 <div id="windows" style="position:absolute;z-index:1101;"></div>
-<? /*
-<div id="wupbox" style="position:absolute;z-index:10101;width:100%;height:100%;" onmouseup="win.WstopDrag()" onmousemove="win.WmoveDrag(event)" onselectstart="return false"></div>
-*/ ?>
-<div id="header"><a href="https://new-combats.com/forum/"><img src="https://new-combats.com/inx/newlogo.jpg" width="924" height="135"></a></div>
+<div id="header"><a href="https://new-combats.com/forum/"><img src="https://new-combats.com/inx/newlogo.jpg" width="924"
+                                                               height="135"></a></div>
 <div id="main">
-  <table width="<? if($f->r==-1){ echo '80%'; }else{ echo '80%'; } ?>" border="0" align="center" cellpadding="0" cellspacing="0">
-    <tr>
-      <td width="29" background="https://new-combats.com/forum_script/img/leftground.jpg">&nbsp;</td>
-      <td width="1" bgcolor="#F2E5B1">&nbsp;</td>
-      <td valign="top" bgcolor="#F2E5B1" align="left">
-      <!-- -->
-      <?
-	  if(isset($f->error) && $f->error!='' && $f->r!=-2)
-	  {
-	  	 echo '<font color="red"><b>'.$f->error.'</b></font>';
-	  }
-	  if($f->user['admin']>0 && isset($_GET['aem']))
-	  {
-	  ?>
-      <div style="margin:30px;">
-        <p><a href="javascript:void(0);" onClick="history.back();">��������� �����</a></p>
-        <br>
-        <?
-		$ed = mysql_fetch_array(mysql_query('SELECT * FROM `forum_msg` WHERE `id` = "'.((int)$_GET['aem']).'" LIMIT 1'));
-		if(!isset($ed['id']))
-		{
-			echo '<br><br><center>������ ��� �������������� �� �������</center><br><br>';
-		}else{
-			$fm = mysql_fetch_array(mysql_query('SELECT * FROM `forum_menu` WHERE `id` = "'.$ed['fid'].'" LIMIT 1'));
-			echo 'ID: '.$ed['id'].'<br>������: <b>'.$fm['name'].'</b><br>';
-		}
-		?>
-        </div>
-        <?
-	  }elseif(isset($_GET['search'])) {
-	  //���� �� ������
-	  if(isset($_POST['search'])) {
-		 $_GET['search'] = $_POST['search']; 
-	  }else{
-		 $_POST['search'] = $_GET['search']; 
-	  }
-	  $word = $_POST['search'];
-	  $word = htmlspecialchars($word,NULL,'cp1251');
-	  $limw = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `forum_msg` WHERE ( `text` LIKE "%'.mysql_real_escape_string($_POST['search']).'%" OR `title` LIKE "%'.mysql_real_escape_string($_POST['search']).'%" OR `login` LIKE "%'.mysql_real_escape_string($_POST['search']).'%" ) AND `topic` < "0" AND `delete` = "0"'));
-	  $limw = $limw[0];
-	  ?>
-      <table width="100%" border="0" cellspacing="0" cellpadding="0">
+    <table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
         <tr>
-          <td width="210" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
-            <tr>
-              <td valign="top"><img src="https://new-combats.com/forum_script/img/fone1.jpg" width="118" height="257" style="margin-left:-15px;"></td>
-              </tr>
-            <tr>
-              <td><div align="center"><? if($f->user==false){ echo '�� �� ������������<br><a href="https://'.$c['host'].'/">����� �� ���������</a>'; }else{ echo '�� ����� ���: <br>'.$u->microLogin($u->info['id'],1).'<br><br>'; } ?>
-                <? if(($f->user['align']>1 && $f->user['align']<2) || ($f->user['align']>3 && $f->user['align']<4) || $f->user['admin']>0){ echo '<br><a href="?r='.$_GET['r'].'&mod_use&rnd='.$code.'">�������������� ['.$mod.']</a>'; }
-				   if($f->user['admin']>0 || $mod2=='on'){ echo '<br><a href="?r='.$_GET['r'].'&mod_use2&rnd='.$code.'">������������������ ['.$mod2.']</a>'; }  ?>
-              </div></td>
-            </tr>
-            <tr>
-              <td height="50" valign="bottom">
-              <div align="center" class="text1">
-                <div align="left"><b>�����������</b></div>
-                <div class="line1"></div>
-              </div>              </td>
-            </tr>
-            <tr>
-              <td>
-			  <? echo $f->menu; ?>
-              <div class="line1"></div>              </td>
-            </tr>
-            <tr>
-              <td><div align="center"><img src="https://new-combats.com/forum_script/img/icon7.gif" width="15" height="15" title="��������"> <a href="?smiles=1">��������</a></div>
-                <br><br><br></td>
-            </tr>
-          </table></td>
-          <td valign="top"><div align="center">
-            <table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
-              <tr>
-                <td><div align="center">
-                  <? echo '<H3>���������� ������ �� �������: &quot;'.$word.'&quot;. ������� ������� '.$limw.' ��.</H3><br>'; ?></div><div align="left"></div></td>
-              </tr>
-              <tr>
-                <td>
-                <table width="100%" border="0" cellspacing="0" cellpadding="0">
-                  <tr>
-				  <?
-				  $p_list=$f->paginator(1);
-				  ?>
-                    <td><div align="left"><img src="https://new-combats.com/forum_script/img/news.gif" width="16" height="16"> ��������:  <?echo $p_list;?></div></td>
-                    <td width="250"><div class="line2"></div><form method="post" action="?search">�����: <input type="text" value="<?=$word?>" name="search"/> <input type="submit" value="�����"></form></td>
-                  </tr>
-                </table>
-                <div class="line2"></div></td>
-              </tr>
-              <tr>
-                <td valign="top"><div align="left">
-                  <? $f->forumData(); ?>
-                </div></td>
-              </tr>
-              <tr>
-                <td><div align="left" style="margin-top:5px;"><img src="https://new-combats.com/forum_script/img/news.gif" width="16" height="16"> ��������:  <?echo $p_list;?></div></td>
-              </tr>
-              <tr>
-                <td>&nbsp;</td>
-              </tr>
-            </table>
-          </div></td>
-        </tr>
-      </table>
-	  <?
-	  }elseif($f->r>=1){
-	  //������� �������
-	  ?>
-      <table width="100%" border="0" cellspacing="0" cellpadding="0">
-        <tr>
-          <td width="210" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
-            <tr>
-              <td valign="top"><img src="https://new-combats.com/forum_script/img/fone1.jpg" width="118" height="257" style="margin-left:-15px;"></td>
-              </tr>
-            <tr>
-              <td><div align="center"><? if($f->user==false){ echo '�� �� ������������<br><a href="https://'.$c['host'].'/">����� �� ���������</a>'; }else{ echo '�� ����� ���: <br>'.$u->microLogin($u->info['id'],1).'<br><br>'; } ?>
-                <? if(($f->user['align']>1 && $f->user['align']<2) || ($f->user['align']>3 && $f->user['align']<4) || $f->user['admin']>0){ echo '<br><a href="?r='.$_GET['r'].'&mod_use&rnd='.$code.'">�������������� ['.$mod.']</a>'; }
-				   if($f->user['admin']>0 || $mod2=='on'){ echo '<br><a href="?r='.$_GET['r'].'&mod_use2&rnd='.$code.'">������������������ ['.$mod2.']</a>'; }  ?>
-              </div></td>
-            </tr>
-            <tr>
-              <td height="50" valign="bottom">
-              <div align="center" class="text1">
-                <div align="left"><b>�����������</b></div>
-                <div class="line1"></div>
-              </div>              </td>
-            </tr>
-            <tr>
-              <td>
-			  <? echo $f->menu; ?>
-              <div class="line1"></div>              </td>
-            </tr>
-            <tr>
-              <td><div align="center"><img src="https://new-combats.com/forum_script/img/icon7.gif" width="15" height="15" title="��������"> <a href="?smiles=1">��������</a></div>
-                <br><br><br></td>
-            </tr>
-          </table></td>
-          <td valign="top"><div align="center">
-            <table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
-              <tr>
-                <td><div align="center">
-                  <? echo '<H3>����������� "'.$f->fm['name'].'"</H3><br><br>'.$f->fm['opisan']; ?></div><div align="left"></div></td>
-              </tr>
-              <tr>
-                <td>
-                <table width="100%" border="0" cellspacing="0" cellpadding="0">
-                  <tr>
-				  <?
-				  $p_list=$f->paginator(1);
-				  ?>
-                    <td><div align="left"><img src="https://new-combats.com/forum_script/img/news.gif" width="16" height="16"> ��������:  <?echo $p_list;?></div></td>
-                    <td width="250"><div class="line2"></div><form method="post" action="?search">�����: <input type="text" value="" name="search"/> <input type="submit" value="�����"></form></td>
-                  </tr>
-                </table>
-                <div class="line2"></div></td>
-              </tr>
-              <tr>
-                <td valign="top"><div align="left">
-                  <? $f->forumData(); ?>
-                </div></td>
-              </tr>
-              <tr>
-                <td><div align="left" style="margin-top:5px;"><img src="https://new-combats.com/forum_script/img/news.gif" width="16" height="16"> ��������:  <?echo $p_list;?></div></td>
-              </tr>
-              <tr>
-                <td>&nbsp;</td>
-              </tr>
-              <tr>
-                <td>
-                <? if(isset($f->user['id'])){ ?>
-                <div style="border:1px solid #FFFFFF; margin:21px;">
-                <? 
-				if($f->gd[$f->fm['id']]!=2 && $f->gd[$f->fm['id']]!=4 && $f->user['admin']==0)
-				{
-					echo '<center><br>�� �� ������ ��������� ������ � ���� �����������<br><br></center>';
-				}elseif($f->lst['time']<time()-60){ ?>
-                <form method="post" action="https://new-combats.com/forum?r=<? echo $f->r.'&rnd='.$code.''; ?>">
-                <table align="center">
-                  <tr>
-                    <td colspan="2"><h4>�������� ���� ������ � �����</h4>
-                      ���� ���������
-                      <input type="text" class="inup" name="title" size="57" maxlength="70" value="" /></td>
-                  </tr>
-                  <tr>
-                    <td><textarea rows="8" class="inup" name="text" cols="85" wrap="virtual"></textarea>
-                    </td>
-                    <td><input name="add" style="width:35px;" type="button" class="btn" value=" � " title="������">
-                        <br />
-                        <input name="add" style="width:35px;" type="button" class="btn" value=" � " title="���������">
-                      <br />
-                        <input name="add" style="width:35px;" type="button" class="btn" value=" � " title="������������">
-                      <br />
-                        <input name="add" style="width:35px;" type="button" class="btn" value="���" title="����� ���������">
-                    </td>
-                  </tr>
-                  <tr>
-                    <td colspan="2"><table width="100%">
+            <td width="29" background="https://new-combats.com/forum_script/img/leftground.jpg">&nbsp;</td>
+            <td width="1" bgcolor="#F2E5B1">&nbsp;</td>
+            <td valign="top" bgcolor="#F2E5B1" align="left">
+                <!-- -->
+                <?= !empty($f->error) && $f->r != -2? '<b style="color: red">' . $f->error . '</b>' : ''?>
+                <?php
+
+                if ($f->user['admin'] > 0 && isset($_GET['aem'])) {
+                    ?>
+                    <div style="margin:30px;">
+                        <p><a href="javascript:void(0);" onClick="history.back();">��������� �����</a></p>
+                        <br>
+                        <?
+                        $ed = mysql_fetch_array(
+                            mysql_query('SELECT * FROM `forum_msg` WHERE `id` = "' . ((int)$_GET['aem']) . '" LIMIT 1')
+                        );
+                        if (!isset($ed['id'])) {
+                            echo '<br><br><center>������ ��� �������������� �� �������</center><br><br>';
+                        } else {
+                            $fm = mysql_fetch_array(
+                                mysql_query('SELECT * FROM `forum_menu` WHERE `id` = "' . $ed['fid'] . '" LIMIT 1')
+                            );
+                            echo 'ID: ' . $ed['id'] . '<br>������: <b>' . $fm['name'] . '</b><br>';
+                        }
+                        ?>
+                    </div>
+                    <?
+                } elseif (isset($_GET['search'])) {
+                    //���� �� ������
+                    if (isset($_POST['search'])) {
+                        $_GET['search'] = $_POST['search'];
+                    } else {
+                        $_POST['search'] = $_GET['search'];
+                    }
+                    $word = $_POST['search'];
+                    $word = htmlspecialchars($word, null, 'cp1251');
+                    $limw = mysql_fetch_array(
+                        mysql_query(
+                            'SELECT COUNT(*) FROM `forum_msg` WHERE ( `text` LIKE "%' . mysql_real_escape_string(
+                                $_POST['search']
+                            ) . '%" OR `title` LIKE "%' . mysql_real_escape_string(
+                                $_POST['search']
+                            ) . '%" OR `login` LIKE "%' . mysql_real_escape_string(
+                                $_POST['search']
+                            ) . '%" ) AND `topic` < "0" AND `delete` = "0"'
+                        )
+                    );
+                    $limw = $limw[0];
+                    ?>
+                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                         <tr>
-                          <td><?
-					  if($f->user['admin']>0)
-					  {
-					  	echo '<div align="left"><input name="adminname" id="adminname" type="checkbox" value="1" /><label for="adminname"> �� ����� ������������� �������.</label></div><br>';
-					  }
-					  ?>
-                            <input type="radio" name="icon" value="13" checked>
-                              <img src="https://new-combats.com/forum_script/img/icon13.gif" height="15" width="15"> &nbsp;
-                              <input type="radio" name="icon" value="14">
-                            <img src="https://new-combats.com/forum_script/img/icon14.gif" height="15" width="15"> &nbsp;
-                              <input type="radio" name="icon" value="6">
-                            <img src="https://new-combats.com/forum_script/img/icon6.gif" height="15" width="15"> &nbsp;
-                              <input type="radio" name="icon" value="9">
-                            <img src="https://new-combats.com/forum_script/img/icon9.gif" height="15" width="15"> &nbsp;
-                              <input type="radio" name="icon" value="1">
-                            <img src="https://new-combats.com/forum_script/img/icon1.gif" height="15" width="15"> &nbsp;
-                              <input type="radio" name="icon" value="10">
-                            <img src="https://new-combats.com/forum_script/img/icon10.gif" height="15" width="15"> &nbsp;
-                              <input type="radio" name="icon" value="11">
-                            <img src="https://new-combats.com/forum_script/img/icon11.gif" height="15" width="15"><BR>
-                              <input type="radio" name="icon" value="12">
-                            <img src="https://new-combats.com/forum_script/img/icon12.gif" height="15" width="15"> &nbsp;
-                              <input type="radio" name="icon" value="2">
-                            <img src="https://new-combats.com/forum_script/img/icon2.gif" height="15" width="15"> &nbsp;
-                              <input type="radio" name="icon" value="3">
-                            <img src="https://new-combats.com/forum_script/img/icon3.gif" height="15" width="15"> &nbsp;
-                              <input type="radio" name="icon" value="4">
-                            <img src="https://new-combats.com/forum_script/img/icon4.gif" height="15" width="15"> &nbsp;
-                              <input type="radio" name="icon" value="5">
-                            <img src="https://new-combats.com/forum_script/img/icon5.gif" height="15" width="15"> &nbsp;
-                              <input type="radio" name="icon" value="7">
-                            <img src="https://new-combats.com/forum_script/img/icon7.gif" height="15" width="15"> &nbsp;
-                              <input type="radio" name="icon" value="8">
-                            <img src="https://new-combats.com/forum_script/img/icon8.gif" height="15" width="15"> <br /></td>
-                          <td align="right" valign="top">
-                          	  <input type="submit" class="btn" value="��������" name="add" />
-                              <input type="hidden" id="key" name="key" value="<? echo $f->user['nextAct']; ?>" />
-                              <input type="hidden" id="add_top" name="add_top" value="<? echo $f->fm['id']; ?>" />                          </td>
+                            <td width="210" valign="top">
+                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                                    <tr>
+                                        <td valign="top"><img src="https://new-combats.com/forum_script/img/fone1.jpg"
+                                                              width="118" height="257" style="margin-left:-15px;"></td>
+                                    </tr>
+                                    <tr>
+                                        <td>
+                                            <div align="center"><?
+                                                if (!$f->user) {
+                                                    echo '�� �� ������������<br><a href="https://' . $c['host'] . '/">����� �� ���������</a>';
+                                                } else {
+                                                    echo '�� ����� ���: <br>' . $u->microLogin(
+                                                            $u->info['id'], 1
+                                                        ) . '<br><br>';
+                                                } ?>
+                                                <?
+                                                if (($f->user['align'] > 1 && $f->user['align'] < 2) || ($f->user['align'] > 3 && $f->user['align'] < 4) || $f->user['admin'] > 0) {
+                                                    echo '<br><a href="?r=' . $_GET['r'] . '&mod_use&rnd=' . $code . '">�������������� [' . $mod . ']</a>';
+                                                }
+                                                if ($f->user['admin'] > 0 || $mod2 == 'on') {
+                                                    echo '<br><a href="?r=' . $_GET['r'] . '&mod_use2&rnd=' . $code . '">������������������ [' . $mod2 . ']</a>';
+                                                } ?>
+                                            </div>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td height="50" valign="bottom">
+                                            <div align="center" class="text1">
+                                                <div align="left"><b>�����������</b></div>
+                                                <div class="line1"></div>
+                                            </div>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td>
+                                            <?
+                                            echo $f->menu; ?>
+                                            <div class="line1"></div>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td>
+                                            <div align="center"><img
+                                                        src="https://new-combats.com/forum_script/img/icon7.gif"
+                                                        width="15" height="15" title="��������"> <a href="?smiles=1">��������</a>
+                                            </div>
+                                            <br><br><br></td>
+                                    </tr>
+                                </table>
+                            </td>
+                            <td valign="top">
+                                <div align="center">
+                                    <table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
+                                        <tr>
+                                            <td>
+                                                <div align="center">
+                                                    <?
+                                                    echo '<H3>���������� ������ �� �������: &quot;' . $word . '&quot;. ������� ������� ' . $limw . ' ��.</H3><br>'; ?></div>
+                                                <div align="left"></div>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                                                    <tr>
+                                                        <?
+                                                        $p_list = $f->paginator(1);
+                                                        ?>
+                                                        <td>
+                                                            <div align="left"><img
+                                                                        src="https://new-combats.com/forum_script/img/news.gif"
+                                                                        width="16" height="16"> ��������: <?
+                                                                echo $p_list; ?></div>
+                                                        </td>
+                                                        <td width="250">
+                                                            <div class="line2"></div>
+                                                            <form method="post" action="?search">�����: <input
+                                                                        type="text" value="<?= $word ?>" name="search"/>
+                                                                <input type="submit" value="�����"></form>
+                                                        </td>
+                                                    </tr>
+                                                </table>
+                                                <div class="line2"></div>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td valign="top">
+                                                <div align="left">
+                                                    <?
+                                                    $f->forumData(); ?>
+                                                </div>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <div align="left" style="margin-top:5px;"><img
+                                                            src="https://new-combats.com/forum_script/img/news.gif"
+                                                            width="16" height="16"> ��������: <?
+                                                    echo $p_list; ?></div>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>&nbsp;</td>
+                                        </tr>
+                                    </table>
+                                </div>
+                            </td>
                         </tr>
-                    </table></td>
-                  </tr>
-                </table>
-                </form>
-                <? }else{ echo '<br><center>��������� ����������� �� �������� �������.<br> �������� ��������� '.round($f->lst['time']+61-time()).' ���.</center><br>'; } ?>
-                </div>
-                <? } ?>
-                </td>
-              </tr>
-            </table>
-          </div></td>
-        </tr>
-      </table>
-     <? }elseif($f->r==-1){
-	  //��������� �����������
-	  ?>
-      <table width="100%" border="0" cellspacing="0" cellpadding="0">
-        <tr>
-          <td width="118" valign="top"><img src="https://new-combats.com/forum_script/img/fone1.jpg" width="118" height="257" style="margin-left:-15px;"></td>
-          <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
-            <tr>
-              <td>&nbsp;</td>
-            </tr>
-            <tr>
-              <td><div align="center">
-              	<?
-				$url1 = 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` 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 = '<a href="?read='.$url1['id'].'" title="'.$url1['title'].'"><b>&laquo; ���������� �����</b></a>';
-				}else{
-					$url1 = '&laquo; ���������� �����';
-				}
-				if(isset($url2['id'])) {
-					$url2 = '<a href="?read='.$url2['id'].'" title="'.$url2['title'].'"><b>��������� ����� &raquo;</b></a>';
-				}else{
-					$url2 = '��������� ����� &raquo;';
-				}
-				
-				?>
-                  <DIV align="center"><?=$url1?>�|�<A href="?r=<? echo $f->fm['id']; ?>" title="����������� &quot;<? echo $f->fm['name']; ?>&quot;"><b>�����</b></A>�|�<?=$url2?><BR>
-                  </DIV>
-              </div></td>
-            </tr>
-            <tr>
-              <td>&nbsp;</td>
-            </tr>
-            <tr>
-			<?
-			$p_list=$f->paginator(2);
-			?>
-              <td>��������: <?echo $p_list;?></td>
-            </tr>
-            <tr>
-              <td style="padding-top:11px; padding-bottom:11px;" align="left">
-              <div style="float:left"><h4><img src="https://new-combats.com/forum_script/img/icon<? echo $f->see['ico']; ?>.gif"> <a href="?r=<? echo $f->fm['id'].'&rnd='.$code; ?>"><b><? echo $f->fm['name']; ?></b></a> &gt; <? echo $f->see['title']; ?></h4></div>
-              <? if(($f->user['align']>1.5 || $f->user['align']>3.05 || $f->user['admin']>0) && $f->mod == 1){ ?>
-              <div style="float:right;">
-                  ������: <? echo $dost[$f->see['nocom']]; ?><br>
-                  <select name="jumpTopic" id="jumpTopic" onChange="MM_jumpMenu('parent',this,0)">
-                    <option selected="selected">--------- ����������� ---------</option>
+                    </table>
                     <?
-					$rtn = '';
-					$sp = mysql_query('SELECT * FROM `forum_menu`');
-					while($pl = mysql_fetch_array($sp)) {
-						if($pl['only_admin'] == 0 || $f->user['admin'] > 0) {
-							$rtn .= '<option value="?read='.$_GET['read'].'&trm='.$pl['id'].'">'.$pl['name'].'</option>';
-						}
-					}
-					echo $rtn;
-					?>
-                  </select><br>
-                  <select name="actionTopic" id="actionTopic" onChange="MM_jumpMenu('parent',this,0)">
-                    <option selected>----------- �������� -----------</option>
-                    <? if($f->see['nocom']==0) { ?>
-                    <option value="?read=<? echo $_GET['read'].'&nocomment=1&rnd='.$code.''; ?>">��������� ��������� ������</option>
-                    <? } ?>
-                    <option value="?read=<? echo $_GET['read'].'&delete=1&rnd='.$code.''; ?>">������� �����</option>
-                    <? if($f->see['fixed']==0) { ?>
-                    <option value="?read=<? echo $_GET['read'].'&fixed=1&rnd='.$code.''; ?>">������������� �����</option>
-                    <? }else{ ?>
-                    <option value="?read=<? echo $_GET['read'].'&fixed=1&rnd='.$code.''; ?>">������ �������� ������</option>
+                } elseif ($f->r >= 1) {
+                    //������� �������
+                    ?>
+                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                        <tr>
+                            <td width="210" valign="top">
+                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                                    <tr>
+                                        <td valign="top"><img src="https://new-combats.com/forum_script/img/fone1.jpg"
+                                                              width="118" height="257" style="margin-left:-15px;"></td>
+                                    </tr>
+                                    <tr>
+                                        <td>
+                                            <div align="center"><?
+                                                if ($f->user == false) {
+                                                    echo '�� �� ������������<br><a href="https://' . $c['host'] . '/">����� �� ���������</a>';
+                                                } else {
+                                                    echo '�� ����� ���: <br>' . $u->microLogin(
+                                                            $u->info['id'], 1
+                                                        ) . '<br><br>';
+                                                } ?>
+                                                <?
+                                                if (($f->user['align'] > 1 && $f->user['align'] < 2) || ($f->user['align'] > 3 && $f->user['align'] < 4) || $f->user['admin'] > 0) {
+                                                    echo '<br><a href="?r=' . $_GET['r'] . '&mod_use&rnd=' . $code . '">�������������� [' . $mod . ']</a>';
+                                                }
+                                                if ($f->user['admin'] > 0 || $mod2 == 'on') {
+                                                    echo '<br><a href="?r=' . $_GET['r'] . '&mod_use2&rnd=' . $code . '">������������������ [' . $mod2 . ']</a>';
+                                                } ?>
+                                            </div>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td height="50" valign="bottom">
+                                            <div align="center" class="text1">
+                                                <div align="left"><b>�����������</b></div>
+                                                <div class="line1"></div>
+                                            </div>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td>
+                                            <?
+                                            echo $f->menu; ?>
+                                            <div class="line1"></div>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td>
+                                            <div align="center"><img
+                                                        src="https://new-combats.com/forum_script/img/icon7.gif"
+                                                        width="15" height="15" title="��������"> <a href="?smiles=1">��������</a>
+                                            </div>
+                                            <br><br><br></td>
+                                    </tr>
+                                </table>
+                            </td>
+                            <td valign="top">
+                                <div align="center">
+                                    <table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
+                                        <tr>
+                                            <td>
+                                                <div align="center">
+                                                    <?
+                                                    echo '<H3>����������� "' . $f->fm['name'] . '"</H3><br><br>' . $f->fm['opisan']; ?></div>
+                                                <div align="left"></div>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                                                    <tr>
+                                                        <?
+                                                        $p_list = $f->paginator(1);
+                                                        ?>
+                                                        <td>
+                                                            <div align="left"><img
+                                                                        src="https://new-combats.com/forum_script/img/news.gif"
+                                                                        width="16" height="16"> ��������: <?
+                                                                echo $p_list; ?></div>
+                                                        </td>
+                                                        <td width="250">
+                                                            <div class="line2"></div>
+                                                            <form method="post" action="?search">�����: <input
+                                                                        type="text" value="" name="search"/> <input
+                                                                        type="submit" value="�����"></form>
+                                                        </td>
+                                                    </tr>
+                                                </table>
+                                                <div class="line2"></div>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td valign="top">
+                                                <div align="left">
+                                                    <?
+                                                    $f->forumData(); ?>
+                                                </div>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <div align="left" style="margin-top:5px;"><img
+                                                            src="https://new-combats.com/forum_script/img/news.gif"
+                                                            width="16" height="16"> ��������: <?
+                                                    echo $p_list; ?></div>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>&nbsp;</td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <?
+                                                if (isset($f->user['id'])) { ?>
+                                                    <div style="border:1px solid #FFFFFF; margin:21px;">
+                                                        <?
+                                                        if ($f->gd[$f->fm['id']] != 2 && $f->gd[$f->fm['id']] != 4 && $f->user['admin'] == 0) {
+                                                            echo '<center><br>�� �� ������ ��������� ������ � ���� �����������<br><br></center>';
+                                                        } elseif ($f->lst['time'] < time() - 60) { ?>
+                                                            <form method="post"
+                                                                  action="https://new-combats.com/forum?r=<?
+                                                                  echo $f->r . '&rnd=' . $code . ''; ?>">
+                                                                <table align="center">
+                                                                    <tr>
+                                                                        <td colspan="2"><h4>�������� ���� ������ �
+                                                                                �����</h4>
+                                                                            ���� ���������
+                                                                            <input type="text" class="inup" name="title"
+                                                                                   size="57" maxlength="70" value=""/>
+                                                                        </td>
+                                                                    </tr>
+                                                                    <tr>
+                                                                        <td><textarea rows="8" class="inup" name="text"
+                                                                                      cols="85"
+                                                                                      wrap="virtual"></textarea>
+                                                                        </td>
+                                                                        <td><input name="add" style="width:35px;"
+                                                                                   type="button" class="btn" value=" � "
+                                                                                   title="������">
+                                                                            <br/>
+                                                                            <input name="add" style="width:35px;"
+                                                                                   type="button" class="btn" value=" � "
+                                                                                   title="���������">
+                                                                            <br/>
+                                                                            <input name="add" style="width:35px;"
+                                                                                   type="button" class="btn" value=" � "
+                                                                                   title="������������">
+                                                                            <br/>
+                                                                            <input name="add" style="width:35px;"
+                                                                                   type="button" class="btn" value="���"
+                                                                                   title="����� ���������">
+                                                                        </td>
+                                                                    </tr>
+                                                                    <tr>
+                                                                        <td colspan="2">
+                                                                            <table width="100%">
+                                                                                <tr>
+                                                                                    <td><?
+                                                                                        if ($f->user['admin'] > 0) {
+                                                                                            echo '<div align="left"><input name="adminname" id="adminname" type="checkbox" value="1" /><label for="adminname"> �� ����� ������������� �������.</label></div><br>';
+                                                                                        }
+                                                                                        ?>
+                                                                                        <input type="radio" name="icon"
+                                                                                               value="13" checked>
+                                                                                        <img src="https://new-combats.com/forum_script/img/icon13.gif"
+                                                                                             height="15" width="15">
+                                                                                        &nbsp;
+                                                                                        <input type="radio" name="icon"
+                                                                                               value="14">
+                                                                                        <img src="https://new-combats.com/forum_script/img/icon14.gif"
+                                                                                             height="15" width="15">
+                                                                                        &nbsp;
+                                                                                        <input type="radio" name="icon"
+                                                                                               value="6">
+                                                                                        <img src="https://new-combats.com/forum_script/img/icon6.gif"
+                                                                                             height="15" width="15">
+                                                                                        &nbsp;
+                                                                                        <input type="radio" name="icon"
+                                                                                               value="9">
+                                                                                        <img src="https://new-combats.com/forum_script/img/icon9.gif"
+                                                                                             height="15" width="15">
+                                                                                        &nbsp;
+                                                                                        <input type="radio" name="icon"
+                                                                                               value="1">
+                                                                                        <img src="https://new-combats.com/forum_script/img/icon1.gif"
+                                                                                             height="15" width="15">
+                                                                                        &nbsp;
+                                                                                        <input type="radio" name="icon"
+                                                                                               value="10">
+                                                                                        <img src="https://new-combats.com/forum_script/img/icon10.gif"
+                                                                                             height="15" width="15">
+                                                                                        &nbsp;
+                                                                                        <input type="radio" name="icon"
+                                                                                               value="11">
+                                                                                        <img src="https://new-combats.com/forum_script/img/icon11.gif"
+                                                                                             height="15" width="15"><BR>
+                                                                                        <input type="radio" name="icon"
+                                                                                               value="12">
+                                                                                        <img src="https://new-combats.com/forum_script/img/icon12.gif"
+                                                                                             height="15" width="15">
+                                                                                        &nbsp;
+                                                                                        <input type="radio" name="icon"
+                                                                                               value="2">
+                                                                                        <img src="https://new-combats.com/forum_script/img/icon2.gif"
+                                                                                             height="15" width="15">
+                                                                                        &nbsp;
+                                                                                        <input type="radio" name="icon"
+                                                                                               value="3">
+                                                                                        <img src="https://new-combats.com/forum_script/img/icon3.gif"
+                                                                                             height="15" width="15">
+                                                                                        &nbsp;
+                                                                                        <input type="radio" name="icon"
+                                                                                               value="4">
+                                                                                        <img src="https://new-combats.com/forum_script/img/icon4.gif"
+                                                                                             height="15" width="15">
+                                                                                        &nbsp;
+                                                                                        <input type="radio" name="icon"
+                                                                                               value="5">
+                                                                                        <img src="https://new-combats.com/forum_script/img/icon5.gif"
+                                                                                             height="15" width="15">
+                                                                                        &nbsp;
+                                                                                        <input type="radio" name="icon"
+                                                                                               value="7">
+                                                                                        <img src="https://new-combats.com/forum_script/img/icon7.gif"
+                                                                                             height="15" width="15">
+                                                                                        &nbsp;
+                                                                                        <input type="radio" name="icon"
+                                                                                               value="8">
+                                                                                        <img src="https://new-combats.com/forum_script/img/icon8.gif"
+                                                                                             height="15" width="15">
+                                                                                        <br/></td>
+                                                                                    <td align="right" valign="top">
+                                                                                        <input type="submit" class="btn"
+                                                                                               value="��������"
+                                                                                               name="add"/>
+                                                                                        <input type="hidden" id="key"
+                                                                                               name="key" value="<?
+                                                                                        echo $f->user['nextAct']; ?>"/>
+                                                                                        <input type="hidden"
+                                                                                               id="add_top"
+                                                                                               name="add_top" value="<?
+                                                                                        echo $f->fm['id']; ?>"/></td>
+                                                                                </tr>
+                                                                            </table>
+                                                                        </td>
+                                                                    </tr>
+                                                                </table>
+                                                            </form>
+                                                            <?
+                                                        } else {
+                                                            echo '<br><center>��������� ����������� �� �������� �������.<br> �������� ��������� ' . round(
+                                                                    $f->lst['time'] + 61 - time()
+                                                                ) . ' ���.</center><br>';
+                                                        } ?>
+                                                    </div>
+                                                    <?
+                                                } ?>
+                                            </td>
+                                        </tr>
+                                    </table>
+                                </div>
+                            </td>
+                        </tr>
+                    </table>
                     <?
-					}
-                    if($f->see['nocom']==0)
-					{
-				    if($f->user['admin']>0)
-					{
-					?>
-                    <option value="?read=<? echo $_GET['read'].'&onlyadmin=1&rnd='.$code.''; ?>">������ ��� �������</option>
-                    <?
-					}
-					if(($f->user['align']>1.5 && $f->user['align']<2) || $f->user['admin']>0)
-					{
-					?>
-                    <option value="?read=<? echo $_GET['read'].'&onlymoder=1&rnd='.$code.''; ?>">������ ��� ���������</option>
-                    <?
-					}
-					if(($f->user['align']>3.05 && $f->user['align']<4) || $f->user['admin']>0)
-					{
-					?>
-                    <option value="?read=<? echo $_GET['read'].'&onlymoder=2&rnd='.$code.''; ?>">������ ��� ��������</option>
-                    <?
-					}
-					}else{
-					?>
-                    <option value="?read=<? echo $_GET['read'].'&onlyall=1&rnd='.$code.''; ?>">��������� ��������� �����</option>
-                    <?
-					}
-					?>
-                  </select>
-                </div>
-              <? } ?>
-              </td>
-            </tr>
-            <tr>
-            	<td><? $f->seeTopic(); ?></td>
-            </tr>
-            <tr>
-              <td style="padding-top:3px; padding-bottom:3px;" align="left">��������:  <?echo $p_list;?></td>
-            </tr>
-            <tr>
-              <td style="padding-top:3px; padding-bottom:3px;" align="left"><? if(isset($f->user['id']) || !isset($f->user['id'])){ ?>
-                <div style="border:1px solid #EFEFEF; margin:21px;">
-                  <?
-				    if($f->see['nocom']>0)
-					{
-						echo '<center><br><font color="red"><b>���������� �������</b></font><br><br></center>';
-					}elseif($f->see['goodAdd']!=1 || $f->pravasee()!=1)
-					{
-						echo '<center><br>�� �� ������ ��������� ������ � ���� ������.<br>���������� ����� '.round($f->lst['time']+62-time()).' ���.<br><br></center>';
-					}/*elseif($f->gd[$f->see['fid']]!=3 && $f->gd[$f->see['fid']]!=4 && $f->user['admin']==0)
+                } elseif ($f->r == -1) {
+                    //��������� �����������
+                    ?>
+                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                        <tr>
+                            <td width="118" valign="top"><img src="https://new-combats.com/forum_script/img/fone1.jpg"
+                                                              width="118" height="257" style="margin-left:-15px;"></td>
+                            <td valign="top">
+                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                                    <tr>
+                                        <td>&nbsp;</td>
+                                    </tr>
+                                    <tr>
+                                        <td>
+                                            <div align="center">
+                                                <?
+                                                $url1 = 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` 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 = '<a href="?read=' . $url1['id'] . '" title="' . $url1['title'] . '"><b>&laquo; ���������� �����</b></a>';
+                                                } else {
+                                                    $url1 = '&laquo; ���������� �����';
+                                                }
+                                                if (isset($url2['id'])) {
+                                                    $url2 = '<a href="?read=' . $url2['id'] . '" title="' . $url2['title'] . '"><b>��������� ����� &raquo;</b></a>';
+                                                } else {
+                                                    $url2 = '��������� ����� &raquo;';
+                                                }
+
+                                                ?>
+                                                <DIV align="center"><?= $url1 ?>�|�<A href="?r=<?
+                                                    echo $f->fm['id']; ?>" title="����������� &quot;<?
+                                                    echo $f->fm['name']; ?>&quot;"><b>�����</b></A>�|�<?= $url2 ?><BR>
+                                                </DIV>
+                                            </div>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td>&nbsp;</td>
+                                    </tr>
+                                    <tr>
+                                        <?
+                                        $p_list = $f->paginator(2);
+                                        ?>
+                                        <td>��������: <?
+                                            echo $p_list; ?></td>
+                                    </tr>
+                                    <tr>
+                                        <td style="padding-top:11px; padding-bottom:11px;" align="left">
+                                            <div style="float:left"><h4><img
+                                                            src="https://new-combats.com/forum_script/img/icon<?
+                                                            echo $f->see['ico']; ?>.gif"> <a href="?r=<?
+                                                    echo $f->fm['id'] . '&rnd=' . $code; ?>"><b><?
+                                                            echo $f->fm['name']; ?></b></a> &gt; <?
+                                                    echo $f->see['title']; ?></h4></div>
+                                            <?
+                                            if (($f->user['align'] > 1.5 || $f->user['align'] > 3.05 || $f->user['admin'] > 0) && $f->mod == 1) { ?>
+                                                <div style="float:right;">
+                                                    ������: <?
+                                                    echo $dost[$f->see['nocom']]; ?><br>
+                                                    <select name="jumpTopic" id="jumpTopic"
+                                                            onChange="MM_jumpMenu('parent',this,0)">
+                                                        <option selected="selected">--------- ����������� ---------
+                                                        </option>
+                                                        <?
+                                                        $rtn = '';
+                                                        $sp = mysql_query('SELECT * FROM `forum_menu`');
+                                                        while ($pl = mysql_fetch_array($sp)) {
+                                                            if ($pl['only_admin'] == 0 || $f->user['admin'] > 0) {
+                                                                $rtn .= '<option value="?read=' . $_GET['read'] . '&trm=' . $pl['id'] . '">' . $pl['name'] . '</option>';
+                                                            }
+                                                        }
+                                                        echo $rtn;
+                                                        ?>
+                                                    </select><br>
+                                                    <select name="actionTopic" id="actionTopic"
+                                                            onChange="MM_jumpMenu('parent',this,0)">
+                                                        <option selected>----------- �������� -----------</option>
+                                                        <?
+                                                        if ($f->see['nocom'] == 0) { ?>
+                                                            <option value="?read=<?
+                                                            echo $_GET['read'] . '&nocomment=1&rnd=' . $code . ''; ?>">
+                                                                ��������� ��������� ������
+                                                            </option>
+                                                            <?
+                                                        } ?>
+                                                        <option value="?read=<?
+                                                        echo $_GET['read'] . '&delete=1&rnd=' . $code . ''; ?>">�������
+                                                            �����
+                                                        </option>
+                                                        <?
+                                                        if ($f->see['fixed'] == 0) { ?>
+                                                            <option value="?read=<?
+                                                            echo $_GET['read'] . '&fixed=1&rnd=' . $code . ''; ?>">
+                                                                ������������� �����
+                                                            </option>
+                                                            <?
+                                                        } else { ?>
+                                                            <option value="?read=<?
+                                                            echo $_GET['read'] . '&fixed=1&rnd=' . $code . ''; ?>">
+                                                                ������ �������� ������
+                                                            </option>
+                                                            <?
+                                                        }
+                                                        if ($f->see['nocom'] == 0) {
+                                                            if ($f->user['admin'] > 0) {
+                                                                ?>
+                                                                <option value="?read=<?
+                                                                echo $_GET['read'] . '&onlyadmin=1&rnd=' . $code . ''; ?>">
+                                                                    ������ ��� �������
+                                                                </option>
+                                                                <?
+                                                            }
+                                                            if (($f->user['align'] > 1.5 && $f->user['align'] < 2) || $f->user['admin'] > 0) {
+                                                                ?>
+                                                                <option value="?read=<?
+                                                                echo $_GET['read'] . '&onlymoder=1&rnd=' . $code . ''; ?>">
+                                                                    ������ ��� ���������
+                                                                </option>
+                                                                <?
+                                                            }
+                                                            if (($f->user['align'] > 3.05 && $f->user['align'] < 4) || $f->user['admin'] > 0) {
+                                                                ?>
+                                                                <option value="?read=<?
+                                                                echo $_GET['read'] . '&onlymoder=2&rnd=' . $code . ''; ?>">
+                                                                    ������ ��� ��������
+                                                                </option>
+                                                                <?
+                                                            }
+                                                        } else {
+                                                            ?>
+                                                            <option value="?read=<?
+                                                            echo $_GET['read'] . '&onlyall=1&rnd=' . $code . ''; ?>">
+                                                                ��������� ��������� �����
+                                                            </option>
+                                                            <?
+                                                        }
+                                                        ?>
+                                                    </select>
+                                                </div>
+                                                <?
+                                            } ?>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td><?
+                                            $f->seeTopic(); ?></td>
+                                    </tr>
+                                    <tr>
+                                        <td style="padding-top:3px; padding-bottom:3px;" align="left">��������: <?
+                                            echo $p_list; ?></td>
+                                    </tr>
+                                    <tr>
+                                        <td style="padding-top:3px; padding-bottom:3px;" align="left"><?
+                                            if (isset($f->user['id']) || !isset($f->user['id'])) { ?>
+                                                <div style="border:1px solid #EFEFEF; margin:21px;">
+                                                    <?
+                                                    if ($f->see['nocom'] > 0) {
+                                                        echo '<center><br><font color="red"><b>���������� �������</b></font><br><br></center>';
+                                                    } elseif ($f->see['goodAdd'] != 1 || $f->pravasee() != 1) {
+                                                        echo '<center><br>�� �� ������ ��������� ������ � ���� ������.<br>���������� ����� ' . round(
+                                                                $f->lst['time'] + 62 - time()
+                                                            ) . ' ���.<br><br></center>';
+                                                    }/*elseif($f->gd[$f->see['fid']]!=3 && $f->gd[$f->see['fid']]!=4 && $f->user['admin']==0)
 					{
 						echo '<center><br>�� �� ������ ��������� ������ � ���� ������<br><br></center>';
-					}*/elseif($f->lst['time']<time()-60){ ?>
-                  <form method="post" action="https://new-combats.com/forum?read=<? echo $f->see['id'].'&rnd='.$code.''; ?>">
-                    <table align="center">
-                      <tr>
-                        <td colspan="2"><h4>�������� ���� �����</h4>                      </td>
-                      </tr>
-                      <tr>
-                        <td><textarea rows="8" class="inup" name="text2" cols="85" wrap="virtual"></textarea>                        </td>
-                        <td><input name="add2" type="button" class="btn" value=" � " title="������">
-                            <br />
-                            <input name="add2" type="button" class="btn" value=" � " title="���������">
-                            <br />
-                            <input name="add2" type="button" class="btn" value=" � " title="������������">
-                            <br />
-                            <input name="add2" type="button" class="btn" value="���" title="����� ���������"></td>
-                      </tr>
-                      <tr>
-                        <td colspan="2"><table width="100%">
-                            <tr>
-                              <td><?
-					  if($f->user['admin']>0)
-					  {
-					  	echo '<div align="left"><input name="adminname" id="adminname" type="checkbox" value="1" /><label for="adminname"> �� ����� ������������� �������.</label></div><br>';
-					  }
-					  ?>                                <br /></td>
-                              <td width="120" align="right"><input type="submit" class="btn" value="��������" name="add2" />
-                                  <input type="hidden" id="key2" name="key2" value="<? echo $f->user['nextAct']; ?>" />
-                                  <input type="hidden" id="add_otv" name="add_otv" value="<? echo $f->see['id']; ?>" />                              </td>
-                            </tr>
-                        </table></td>
-                      </tr>
+					}*/ elseif ($f->lst['time'] < time() - 60) { ?>
+                                                        <form method="post"
+                                                              action="https://new-combats.com/forum?read=<?
+                                                              echo $f->see['id'] . '&rnd=' . $code . ''; ?>">
+                                                            <table align="center">
+                                                                <tr>
+                                                                    <td colspan="2"><h4>�������� ���� �����</h4></td>
+                                                                </tr>
+                                                                <tr>
+                                                                    <td><textarea rows="8" class="inup" name="text2"
+                                                                                  cols="85" wrap="virtual"></textarea>
+                                                                    </td>
+                                                                    <td><input name="add2" type="button" class="btn"
+                                                                               value=" � " title="������">
+                                                                        <br/>
+                                                                        <input name="add2" type="button" class="btn"
+                                                                               value=" � " title="���������">
+                                                                        <br/>
+                                                                        <input name="add2" type="button" class="btn"
+                                                                               value=" � " title="������������">
+                                                                        <br/>
+                                                                        <input name="add2" type="button" class="btn"
+                                                                               value="���" title="����� ���������"></td>
+                                                                </tr>
+                                                                <tr>
+                                                                    <td colspan="2">
+                                                                        <table width="100%">
+                                                                            <tr>
+                                                                                <td><?
+                                                                                    if ($f->user['admin'] > 0) {
+                                                                                        echo '<div align="left"><input name="adminname" id="adminname" type="checkbox" value="1" /><label for="adminname"> �� ����� ������������� �������.</label></div><br>';
+                                                                                    }
+                                                                                    ?> <br/></td>
+                                                                                <td width="120" align="right"><input
+                                                                                            type="submit" class="btn"
+                                                                                            value="��������"
+                                                                                            name="add2"/>
+                                                                                    <input type="hidden" id="key2"
+                                                                                           name="key2" value="<?
+                                                                                    echo $f->user['nextAct']; ?>"/>
+                                                                                    <input type="hidden" id="add_otv"
+                                                                                           name="add_otv" value="<?
+                                                                                    echo $f->see['id']; ?>"/></td>
+                                                                            </tr>
+                                                                        </table>
+                                                                    </td>
+                                                                </tr>
+                                                            </table>
+                                                        </form>
+                                                        <?
+                                                    } else {
+                                                        echo '<br><center>��������� ����������� �� ���������� �������.</center><br>';
+                                                    } ?>
+                                                </div>
+                                                <?
+                                            } ?></td>
+                                    </tr>
+                                </table>
+                            </td>
+                            <td width="118" valign="top">&nbsp;</td>
+                        </tr>
                     </table>
-                  </form>
-                  <? }else{ echo '<br><center>��������� ����������� �� ���������� �������.</center><br>'; } ?>
-                </div>
-                <? } ?></td>
-            </tr>
-          </table></td>
-          <td width="118" valign="top">&nbsp;</td>
+                    <?
+                } elseif ($f->r == -2) {
+                    //����-������� ������
+                    ?>
+                    <table width="100%" height="500" border="0" cellspacing="0" cellpadding="0">
+                        <tr>
+                            <td valign="middle" align="center"><strong>������:</strong> <?
+                                echo $f->error; ?><br><a href="https://new-combats.com/forum?rnd=<?
+                                echo $code; ?>">��������� �� �����</a></td>
+                        </tr>
+                    </table>
+                    <?
+                } ?>
+                <!-- -->
+            </td>
+            <td width="1" bgcolor="#F2E5B1">&nbsp;</td>
+            <td width="24" background="https://new-combats.com/forum_script/img/rightground.jpg">&nbsp;</td>
         </tr>
-      </table>
-      <? }elseif($f->r==-2){
-	  //����-������� ������
-	  ?>
-      <table width="100%" height="500" border="0" cellspacing="0" cellpadding="0">
-        <tr>
-          <td valign="middle" align="center"><strong>������:</strong> <? echo $f->error; ?><br><a href="https://new-combats.com/forum?rnd=<? echo $code; ?>">��������� �� �����</a></td>
-        </tr>
-      </table>
-	  <? } ?>
-      <!-- -->
-      </td>
-      <td width="1" bgcolor="#F2E5B1">&nbsp;</td>
-      <td width="24" background="https://new-combats.com/forum_script/img/rightground.jpg">&nbsp;</td>
-    </tr>
-  </table>
+    </table>
 </div>
 <div id="footer">
-  <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
-    <tr>
-      <td width="10%" scope="col"><DIV> <? echo $c['counters']; ?> </DIV></td>
-      <td width="80%" scope="col"><div align="center"><? echo $c['copyright']; ?></div></td>
-      <td width="10%" scope="col">&nbsp;</td>
-    </tr>
-  </table>
+    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
+        <tr>
+            <td width="10%" scope="col">
+                <DIV> <?
+                    echo $c['counters']; ?> </DIV>
+            </td>
+            <td width="80%" scope="col">
+                <div align="center"><?
+                    echo $c['copyright']; ?></div>
+            </td>
+            <td width="10%" scope="col">&nbsp;</td>
+        </tr>
+    </table>
 </div>
 </body>
 </html>
\ No newline at end of file
diff --git a/getbattle.php b/getbattle.php
index 84a293d1..5c185ee6 100644
--- a/getbattle.php
+++ b/getbattle.php
@@ -1,16 +1,8 @@
 <?php
-function GetRealIp(){
-	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'];
-}
-
-define('IP',GetRealIp());
-include('_incl_data/__config.php');
-define('GAME',true);
-include('_incl_data/class/__db_connect.php');
+const GAME = true;
+require_once('_incl_data/__config.php');
+require_once('_incl_data/class/__db_connect.php');
+define('IP', UserIp::get());
 
 class battleNew {
 	
@@ -242,4 +234,3 @@ if(isset($user['id']) && $user['battle'] > 0) {
 
 echo '{ "btl":"'.(0+$bt['id']).'" , "hod":"'.(0+$bt['hod']).'" , "you":"'.(0+$user['id']).'" , "enemy":"'.(0+$stats['enemy']).'" , "pr": [ "'.$stats['priems'].'" , "'.$stats['priems_z'].'" , '.(0+$stats['priemslot']).' ] , "dm":"'.floor($stats['battle_yron']).'" , "to":"'.round($bt['timeout']/60,2).'" , "r":{ '.ltrim($r,',').' } , "e":"'.$error.'" , "t1":"'.$stats['tactic1'].'" , "t2":"'.$stats['tactic2'].'" , "t3":"'.$stats['tactic3'].'" , "t4":"'.$stats['tactic4'].'" , "t5":"'.$stats['tactic5'].'" , "t6":"'.$stats['tactic6'].'" , "t7":"'.$stats['tactic7'].'" }';
 
-?>
\ 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 @@
-<?php
-define('GAME',true);
-function er($e)
-{
-	 global $c;
-	 die('<html><head><meta name="msapplication-config" content="browserconfig.xml"><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"><meta http-equiv="Content-Language" content="ru"><TITLE>��������� ������</TITLE></HEAD><BODY text="#FFFFFF"><p><font color=black>��������� ������: <pre>'.$e.'</pre><b><p><a href="https://'.$c[0].'/">�����</b></a><HR><p align="right">(c) <a href="https://'.$c[0].'/">'.$c[1].'</a></p></body></html>');
-}
-
-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('<script>top.location = "https://'.$c['host'].'/";</script>');
-}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 ���������<br>��������������� � ������� ��������.');
-}
-
-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();
-}
-
-?>
-<!DOCTYPE html>
-<html lang="ru-RU">
-<head>
-<meta charset="windows-1251" />
-<title>���������� ���� - ����� ���������� ����</title>
-<meta name="description" content="����� ���������� ���� << combats >>. ����������� ������ � ������ ���������� ���� � ��������. ������� ��� ������� � �������� � ������ ������� ��." />
-<meta name="keywords" content="���������� ���� ����, ���������� ���� ������, ���� ���������� ����, ������ ���������� ����, ���������� ���� ������ ����, ���������� ���� ���������� ����, ������ � ���������� ����, ���� ��, �� ����, ������ ��, ������ � ��, �� ������ ����, ����� ��, ����������� ���������� ����, ����������� ��, combats, �������, combats ru, combats com, OldBK, oldbk ru, oldbk com, �����, old bk, ��� ��, mycombats, rebk, recombats, oldcombats, obk2"/>
-<meta name="msapplication-config" content="browserconfig.xml" />
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
-<link rel="stylesheet" type="text/css" href="css/clu0b.css" />
-<link rel="stylesheet" type="text/css" href="css/windows.css" />
-<link rel="stylesheet" type="text/css" href="css/hack.css" />
-<!--[if IE]>
-<script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
-<![endif]-->
-<script>
-var des = <?=(0+$u->info['design'])?>;
-var c = { 
-	noEr:0,
-	noErTmr:0,
-	url:'<?=$c['host']?>',
-	img:'img.new-combats.com',
-	uid:<?=(0+$u->info['id'])?>,
-	login:'<?=$u->info['login']?>',
-	city:'<?=$u->info['city']?>',
-	lvl:<?=$u->info['level']?>,
-	rnd:'<?=$code?>',
-	filter:0,
-	time:<?=time()?>,
-	pl:0,
-	align:<?=$u->info['align']?>,
-	clan:<?=$u->info['clan']?>,
-	admin:<?=$u->info['admin']?>,
-	sound:0,
-	money:<?=$u->info['money']?>
-}, sd4key = "<?=$u->info['nextAct']?>", lafstReg = {},enterUse = 0;
-
-function ctest(city) {
-	if(city != c['city']) {
-		top.location = '/bk';
-	}
-}
-
-function testKey(event)
-{
-	if(event.keyCode==10 || event.keyCode==13)
-	{
-		if(top.enterUse == 0)
-		{
-			chat.subSend();
-			top.enterUse = 1;
-			setTimeout('top.enterUse = 0',1000);
-		}
-	}
-}
-setInterval('c.time++',1000);
-</script>
-<script type="text/javascript" src="js/jquery.js"></script>
-<script>
-$.ajaxSetup({cache: false});
-$(window).error(function(){
-  return true;
-});
-var iusrno = {};
-function ignoreUser(u) {
-	if( iusrno[u] == undefined || iusrno[u] == 0 ) {
-		//top.iusrno[u] = 1;
-		$('#main').attr({'src':'main.php?friends=1&ignore=' + u + ''});
-	}else{
-		//top.iusrno[u] = 0;
-		$('#main').attr({'src':'main.php?friends=1&ignore=' + u + ''});
-	}
-}
-</script>
-<script type="text/javascript" src="js/jqueryrotate.js"></script>
-<script type="text/javascript" src="js/jquery.zclip.js"></script>
-<script type="text/javascript" src="js/jquery.cookie.js"></script>
-<script type="text/javascript" src="js/title.js"></script>
-
-<script type="text/javascript" src="js/gameEngine.js?<?=time()?>"></script>
-<!-- <script type="text/javascript" src="js/chat-engine.js"></script> -->
-<script type="text/javascript" src="js/interface.js"></script>
-<script type="text/javascript" src="js/dataCenter.js"></script>
-
-<script type="text/javascript" src="js/onlineList.js"></script>
-<script type="text/javascript" src="js/hpregen.js"></script>
-<script type="text/javascript" src="js/jquery-fireHint.js"></script>
-<?
-//
-/*
-$fpi = mysql_fetch_array(mysql_query('SELECT * FROM `fastpanel` WHERE `uid` = "'.$u->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 '<script>'.$fph.'</script>';
-}*/
-//
-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 '<script type="text/javascript" src="js/jquery.nicescroll.js"></script>';
-?>
-<style type="text/css">
-#touchmain {
-	padding: 0px;
-	border: 0;
-	overflow: auto;
-	margin: 0px;
-}
-</style>
-
-<script>
-  $(document).ready(function() { 
-    $("#touchmain").niceScroll("#main",{autohidemode:false,boxzoom:false});	
-  });
-</script>
-<?
-}
-?>
-	<style type="text/css">
-		/* Additional classes examples */
-		.woman a {
-			color:#C33;
-		}
-		.woman a:hover {
-			color:#ff0000;
-		}
-		img { vertical-align:bottom; }
-		#tgf_loadingLine {
-			height:18px;
-			width:100%;
-			color:#776b4a;
-			background-color:#ddd5bf;
-			position:relative;
-		}
-		.tfpgs {
-			padding:5px;
-			background-color:#d4cbb4;
-			border-bottom:1px solid #988e73;
-			border-top:1px solid #eae3d0;
-			cursor:default;
-			text-align:center;
-		}
-		.tgf_msg0 { 
-			padding:5px;
-			background-color:#c6b893;
-			border-bottom:1px solid #988e73;
-			border-top:1px solid #eae3d0;
-			cursor:default;
-		}
-		.tgf_msg1 { 
-			padding:5px;
-			background-color:#d4cbb4;
-			border-bottom:1px solid #988e73;
-			border-top:1px solid #eae3d0;
-			cursor:default;
-		}
-		.tgf_msgt {
-			color:#988e73;
-			padding-left:2px;
-			padding-right:2px;
-			border-right:1px solid #b1a993;
-		}
-		.tf_btn1 {
-			background-color:#ddd5bf;
-			padding-left:10px;
-			padding-right:10px;
-			padding-bottom:3px;
-			padding-top:3px;
-			margin:1px;
-			color:#988e73;
-			cursor:pointer;
-		    -moz-border-radius: 4px;
-		    -webkit-border-radius: 4px;
-		    border-radius: 4px;
-		}
-		
-		.tf_btn1:hover {
-			background-color:#b7ae96;
-			color:#ddd5bf;
-			cursor:pointer;
-		}
-		
-		.tf_btn11 {
-			background-color:#988e73;
-			padding-left:10px;
-			padding-right:10px;
-			padding-bottom:3px;
-			padding-top:3px;
-			margin:1px;
-			color:#ddd5bf;
-			cursor:pointer;
-		    -moz-border-radius: 4px;
-		    -webkit-border-radius: 4px;
-		    border-radius: 4px;
-		}
-		.qel0 {
-			dispaly:none;
-			position:absolute;
-			z-index:100000;
-			border:4px solid #f5cc50;
-			border-top-left-radius: 4px;
-			border-top-right-radius: 4px;
-			border-bottom-right-radius: 4px;
-			border-bottom-left-radius: 4px;
-		}
-	</style>
-	<script>
-	function chatHello() {
-		<? if( $u->info['level'] <= 10) { ?>
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ��������� ������(<a href='https://new-combats.com/n/87/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; �������� ������(<a href='https://new-combats.com/n/262/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ��������� �����(<a href='https://new-combats.com/n/248/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ����� ������ ������ (<a href='https://new-combats.com/stats_bonus.php' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ��������� ������� � ������� �� �� ��������(<a href='https://new-combats.com/n/136/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ����� ����� �������� (<a href='https://new-combats.com/n/276/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ���� ������/�������� ����/���� (<a href='https://new-combats.com/n/606/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ����������� �������� (<a href='https://new-combats.com/n/567/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ���������� ������� � ������� �� �� ���������� (<a href='https://new-combats.com/n/389/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ���������� ���������� (<a href='https://new-combats.com/n/749/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ������ ��������� ����� (<a href='https://new-combats.com/n/792/' target='_blank'>������</a>). &nbsp;</b>","blue","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ����� ���������� - ����� ���������� (<a href='https://new-combats.com/n/986/' target='_blank'>������</a>). &nbsp;</b>","red","1","1","0"]);
-		chat.sendMsg(["new","<?=time()?>","1","","<?=$u->info['login']?>","global:<b style='background-color:#ffcccc'>&nbsp; ����� ������� - ������ (<a href='https://new-combats.com/n/1032/' target='_blank'>������</a>). &nbsp;</b>","red","1","1","0"]);
-		<? }?>
-	}
-    </script>
-</head>
-
-<body onLoad="bodyLoaded();chatHello();">
-<div style="display:none" class="qel0" id="qel0"></div>
-<noscript>� ����� �������� ����������� ��������� <strong>javascript<strong></noscript>
-<style>
-/* ����� ������ */
-.CSSteam0	{ font-weight: bold; cursor:pointer; }
-.CSSteam1	{ font-weight: bold; color: #6666CC; cursor:pointer; }
-.CSSteam2	{ font-weight: bold; color: #B06A00; cursor:pointer; }
-.CSSteam3 	{ font-weight: bold; color: #269088; cursor:pointer; }
-.CSSteam4 	{ font-weight: bold; color: #A0AF20; cursor:pointer; }
-.CSSteam5 	{ font-weight: bold; color: #0F79D3; cursor:pointer; }
-.CSSteam6 	{ font-weight: bold; color: #D85E23; cursor:pointer; }
-.CSSteam7 	{ font-weight: bold; color: #5C832F; cursor:pointer; }
-.CSSteam8 	{ font-weight: bold; color: #842B61; cursor:pointer; }
-.CSSteam9 	{ font-weight: bold; color: navy; cursor:pointer; }
-.CSSvs 		{ font-weight: bold; }
-.buttons:hover { background-color:#EFEFEF; }
-.buttons:active { color:#777777; }
-.buttons { background-color:#E9E9E9; }
-.menutop2{color:#003366;} .menutop2:hover{
-	color:#446B93;
-}
-.klan { font-weight:bold; color: green; background-color: #99FFCC;}
-.redColor {
-	color: #FF0000;
-	font-weight: bold;
-}
-.borderWhite {
-	border: 1px solid #f2f0f0;
-}
-.date21	{
-	font-family: Courier;
-	font-size: 8pt;
-	text-decoration:underline;
-	font-weight:normal;
-	color: #007000;
-	background-color: #00FFAA
-}
-
-
-.zoneCh_no {
-	float:left;
-	overflow:hidden;
-	height: 18px;
-	width: 18px;
-}
-
-.inpBtl {
-	color: #000000;
-	text-decoration: none;
-	background-color: #ECE9D8;
-	border: 1px solid #000000;    
-}
-
-.zoneCh_yes {
-	float:left;
-	overflow:hidden;
-	height: 18px;
-	width: 18px;
-	background-color: #A9AFB1;
-}
-	
-body {
-	background-color: #e8e8e8;
-}
-.st1222 {
-	font-size: 18px;
-	color: #990000;
-	font-weight: bold;
-}
-.crop {
-	float:left;
-	overflow:hidden;
-	height: 18px;
-	width: 18px;
-}
-
-.radio_off {
-    margin-left:0px;
-}
-
-.radio_on {
-    margin-left:-18px;
-}
-
-.battle_hod_style {
-    border-bottom-width: 1px;
-    border-bottom-style: solid;
-    border-bottom-color: #AEAEAE;
-}
-.zbtn1l{	width:9px;	height:18px;	background: url(https://new-combats.com/tab.png) 0px 0px repeat-x;}
-.zbtn1r {	width:9px;	height:18px;	background: url(https://new-combats.com/tab.png) -18px 0px repeat-x;}
-.zbtn1r2 {	width:9px;	height:18px;	background: url(https://new-combats.com/tab.png) 18px 0px repeat-x;}
-.zbtn2l{	width:9px;	height:18px;	background: url(https://new-combats.com/tab.png) -36px 0px repeat-x;}
-.zbtn2r {	width:9px;	height:18px;	background: url(https://new-combats.com/tab.png) -54px 0px repeat-x;}
-.zbtn2r2 {	width:9px;	height:18px;	background: url(https://new-combats.com/tab.png) -90px 0px repeat-x;}
-.zbtn2r3 {	width:9px;	height:18px;	background: url(https://new-combats.com/tab.png) 54px 0px repeat-x;}
-.zbtn1c{	background-color: #808080;	border-top-width: 1px;	border-bottom-width: 1px;	border-top-style: solid;	border-bottom-style: solid;	border-top-color: #000000;	border-bottom-color: #000000;	color: #FFFFFF;	cursor:default;	padding-left:5px;	padding-right:5px;	FONT-FAMILY: Verdana, Arial, Helvetica, Tahoma, sans-serif;}
-.zbtn2c{
-	background-color: #D5D2C9;
-	border-bottom-width: 1px;
-	border-bottom-style: solid;
-	border-bottom-color: #000000;
-	color: #000000;
-	cursor:default;
-	padding-left:5px;
-	padding-right:5px;
-	FONT-FAMILY: Verdana, Arial, Helvetica, Tahoma, sans-serif;
-	font-weight: bold;
-}
-</style>
-<?
-/*$yes = $u->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 '<table width="100%" height="100%" style="position:absolute;z-index:100000;background-color:#d6d6d6;color:#333333" border="0" cellspacing="0" cellpadding="0"><tr><td align="center" valign="middle"><table width="700" border="0" cellspacing="0" cellpadding="0"><tr><td>
-<div align="left">
-<b>�������� �� �������� ��� ��� �� �����?<br>���������� ������� ���� ������ ������ ������������ ������� � ���������� ���:</b><br><br>
-&nbsp; ������ ����, ����� ��� ���� ����! �� �������� ������ � ���������� ����? ��, ����� ������, �� ������� ���� � ������� �������
-���� �������� "������ ���� ��" � �.�., � �� �����, ��������, ��� ����� �� ��� ����. ������ ����� ��������
-������� ��������� ����������, ������� ���������� �������� ��������. ������� � ���������� ����� ����
-����� ����� ��������, ���� ������������! ��� ������ �� �����! ���������� ��������, ���������, �����,
-�� � � ����-�� ������������ ������ ������ �� ������ �������� �� ���� �������. �������� ��� ��� ����������
-��� ������ � �� ������ ������ ����� �� ���������� ��� �������!<br>
-&nbsp; ���������� � ���� ������� �� ������������ �� ����� ����� ������ � ��������� � ��������� � ���� ����� �������
-�� �������� � ���������� �����������! ��� ���� ��������� ������������ �����, � �� ����� ��� ������ �������� ��������������� ��������.
-<br><br><center><a href="club.php?yes='.$code.'">� ��������� �������� � ���������� ���� �������</a></center><br><br>���� �� �����-���� �������� �� �� ��������, �� ���������� �������� ��� ���� � ����� �� ����������! �������! ;-)
-</div></td></tr></table></td></tr></table>';*/
-//}
-?>
-<script>
-if(window.top !== window.self)
-{
-	document.write = "";
-	window.top.location = window.self.location;
-	setTimeout(function(){ document.body.innerHTML='������ �������.'; },500);
-	window.self.onload=function(evt){
-	document.body.innerHTML='������ �������.';};
-}
-function cc(el) {
-	$(window).resize(function(){
-		$(el).css({
-				position:'absolute',
-				left: ($(document).width() - $(el).outerWidth())/2,
-				top: ($(document).height() - $(el).outerHeight())/2
-		});
-	});		
-	$(window).resize();
-}
-</script>
-<? 
-	if($u->info['bithday'] == '01.01.1800') {
-?>
-<script>
-function startRegistration() {
-	//if( goodread >= 9 ) {
-		$.post( 'reg.php' , {
-			'ajax_reg':true,
-			'reg_login':$('#reg_login').val(),
-			'reg_mail':$('#reg_mail').val(),
-			'reg_dd':$('#reg_dd').val(),
-			'reg_mm':$('#reg_mm').val(),
-			'reg_yy':$('#reg_yy').val(),
-			'reg_sex':$('#reg_sex').val(),
-			'reg_pass':$('#reg_pass').val(),
-			'reg_pass2':$('#reg_pass2').val(),
-			'mail_post':$('#mail_post').attr('checked')
-		} , function(data) { 
-			$('#errorreg').html( data );
-		});
-	/*}else{
-		alert('������������ � "������� ������ �������" ������! \n ��� ���������� ����� ������� ���! \n �� ��������� '+goodread+' �� 9 �������!');
-	}*/
-}
-</script>
-<style>
-.proza {
-	filter:progid:DXImageTransform.Microsoft.Alpha(opacity=87); /* IE 5.5+*/
-	-moz-opacity: 0.87; /* Mozilla 1.6 � ���� */
-	-khtml-opacity: 0.87; /* Konqueror 3.1, Safari 1.1 */
-	opacity: 0.87; /* CSS3 - Mozilla 1.7b +, Firefox 0.9 +, Safari 1.2+, Opera 9+ */
-}
-.nobtn12 {
-	border:0;
-	bottom:80px;
-	left:225px;
-	position:absolute;
-}
-.nobtn12:active {
-	bottom:79px;
-}
-.inpreg1 {
-	padding:2px;
-	font-size:14px;
-	color:#003144;
-	background-color:#f6f4ec;
-	border:1px solid #d1cdb8;
-	width:178px;
-}
-.inpreg2 {
-	font-size:12px;
-	color:#003144;
-	background-color:#f6f4ec;
-	border:1px solid #d1cdb8;
-}
-#errorreg {
-	position:absolute;
-	width:680px;
-	top:0;
-	left:0;
-	text-align:center;
-	color:red;
-	font-weight:bold;
-}
-</style>
-<script>
-	cc('#regblock');
-</script>
-<?
-	}elseif($u->info['active']!='' && $u->info['mail']=='No E-mail') {
-		if($error!='') {
-			echo '<script>alert("'.$error.'");</script>';
-		}	
-?>
-<!-- ACTIVE -->
-<?
-}
-?>
-<script>
-var lasts = [-1,-1];
-function myexpLineTop27(e1,e2) {
-		$('#exp23mkrtkm').attr('title',"���� ���������"+"\n"+e1+" / "+e2);
-		$('#exp23mkrtkm').html(Math.ceil(e1/e2*100)+'%!');		
-		if( Math.ceil(e1/e2*100) < 1 ) {
-			$('#myexplin233').attr('width','1%');
-		}else{
-			if( lasts[1] < e2 ) {
-				$('#myexplin233').css('width','1%');
-			}
-			if( lasts[0] != e1 || lasts[1] != e2 ) {
-				$('#myexplin233').animate({'width':Math.ceil(e1/e2*100)+'%'},3000);
-			}
-		}
-		lasts[0] = e1;
-		lasts[1] = e2;
-}
-var smlk1 = 0;
-function smiles1load() {
-	if( smlk1 == 0 ) {
-		$('#btnsmlrz').html('<small>&nbsp; ����� �������� &nbsp;</small>');
-		smlk1 = 1;
-		$('#smilesDiv').hide();
-		$('#smilesDiv2').show();
-		$('#smilesDiv3').hide();
-	}else{
-		$('#btnsmlrz').html('<small>&nbsp; ������ �������� &nbsp;</small>');
-		smlk1 = 0;
-		$('#smilesDiv').show();
-		$('#smilesDiv2').hide();
-		$('#smilesDiv3').hide();
-	}
-}
-</script>
-<style>
-#qsst {
-	position:absolute;
-	z-index:10000000;
-	cursor:default;
-	display:none;
-}
-#onbon {
-	position:absolute;
-	z-index:100;
-	cursor:default;
-	display:none;
-	bottom:30px;
-	left:18px;
-}
-#mini_qsst {
-	position:absolute;
-	z-index:100;
-	cursor:default;
-	display:none;
-	bottom:10px;
-	right:18px;
-}
-</style>
-<div id="qsst"></div>
-<div id="ttl" class="ttl_css" style="display:none;z-index:1111;" /></div>
-<div id="nfml" style="display:none;position:absolute;" /></div>
-<div id="persmenu" style="display:none;z-index:1110;" /></div>
-<div id="windows" style="position:absolute;z-index:1101;"></div>
-<div id="wupbox" onmouseup="win.WstopDrag()" onmousemove="win.WmoveDrag(event)" onselectstart="return false"></div>
-<div id="chconfig">
-<center><b>��������� ����</b></center>
-<img title="��������� ����� (o_O)" src="https://<?=$c['img'];?>/1x1.gif" class="eLine"><br>
-�������� ����������: <SELECT id="chcf0"><OPTION value='-1'>�������</OPTION><OPTION value='1'>15 ���.</OPTION><OPTION selected value='2'>30 ���.</OPTION><OPTION value='3'>1 ���.</OPTION><OPTION value='4'>5 ���.</OPTION></SELECT><br>
-<div>���������� ������ ������: <SELECT id="chcf8"><OPTION value='0' selected>�� ������</OPTION><OPTION value='1'>�� ������</OPTION><OPTION value='2'>�� ���������</OPTION><OPTION value='3'>�� �����</OPTION></SELECT>
-<input name="chcf9" type="checkbox" id="chcf9" value="1"><small>�� ��������</small></div>
-<div><input name="chcf12" type="checkbox" id="chcf12" value="1"> �������� �������</div>
-<div style="display:<? if($u->info['admin']>0 || ($u->info['align']>1 && $u->info['align']<2) || ($u->info['align']>3 && $u->info['align']<4)) { echo ''; }else{ echo 'none;'; } ?>"><input name="chcf7" type="checkbox" id="chcf7" value="1"> <span title="�������� ��������� �� ���������� �� ������� �������� �������� ��������">��������� � ���������</span></div>
-<img title="��������� ����� (o_O)" src="https://<?=$c['img'];?>/1x1.gif" class="eLine">
-<div>&nbsp; &nbsp;&nbsp; <span><a href="javascript:void(0)" onclick="chat.ignorListOpen();chconf();">������ ������������</a></span></div>
-</div>
-<!-- <div id="counters"></div> -->
-<!-- ������� -->
-<div id="actionDiv" style="position:absolute;"></div>
-<!--<div id="reline3" onselectstart="return false">
-	<img src="https://img.new-combats.com/1x1.gif" width="9" height="4" style="float:left; display:block; position:absolute; background-image:url(https://img.new-combats.com/i/lite/_top_24.gif);">
-	<img src="https://img.new-combats.com/1x1.gif" width="10" height="4" style="float:right; display:block; background-image:url(https://img.new-combats.com/i/lite/_top_28.gif);">
-</div>-->
-<div id="reline1" onselectstart="return false">
-    
-  <img src="https://img.new-combats.com/1x1.gif" width="9" height="4" style="float:left; display:block; position:absolute; background-image:url(https://img.new-combats.com/i/lite/_top_24.gif);">
-  <img src="https://img.new-combats.com/1x1.gif" width="10" height="4" style="float:right; display:block; background-image:url(https://img.new-combats.com/i/lite/_top_28.gif);">
-</div>
-<div id="reline2" onselectstart="return false"></div>
-<!-- ������� -->
-<div id="upbox" onselectstart="return false"></div>
-    <div style="position:absolute; top:0; left:0; height:37px; width:100%;" onselectstart="return false">
-    <div title="����� �����" style="display:none; position:absolute; left: 198px; top: 13px; width:24px; height:15px; background-image:url(https://img.new-combats.com/i/mail2.gif);" class="postdiv" id="postdiv"></div>
-    <div style="background: url(https://img.new-combats.com/i/lite/capitalcity/top_lite_cap_11.gif) repeat-x bottom; ">
-     <table width="100%" border="0" cellspacing="0" cellpadding="0" style="background: url(https://img.new-combats.com/i/lite/top_lite_cap_03.gif) repeat-x top; ">
-        <tr>
-          <td align="left"><img src="https://img.new-combats.com/i/lite/capitalcity/top_lite_cap_01.gif" width="64" height="14" class="db" style="padding-left:15px;" /></td>
-          <td align="right" class="main_text" style="position: relative; width:225px"><table cellspacing="0" cellpadding="0" border="0" width="565">
-            <tr valign="bottom" align="center">
-              <td width="31" height="14"><img class="db" height="14" src="https://img.new-combats.com/i/lite/mennu112_06_lite.gif" width="31" /></td>
-              <td align="center"><table height="14" cellspacing="0" cellpadding="0" width="100%" background="https://img.new-combats.com/i/lite/mennu112_06.gif" border="0">
-                <tr align="middle">
-                  <td id="el1" class="main_text" onClick="this.style.backgroundColor='#404040'; this.style.color='#FFFFFF'; showtable('1');" align="center">������</td>
-                  <td width="1"><img class="db" height="11" src="https://img.new-combats.com/i/lite/mennu112_09.gif" width="1" /></td>
-                  <td id="el2" class="main_text" onClick="this.style.backgroundColor='#404040'; this.style.color='#FFFFFF'; showtable('2');" style="background:#404040; color:#FFFFFF;" align="center">��������</td>
-                  <td width="1"><img class="db" height="11" src="https://img.new-combats.com/i/lite/mennu112_09.gif" width="1" /></td>
-                  <td id="el3" class="main_text" onClick="if(confirm('����� �� ����?')){ top.location = '/bk?exit&rnd=<?=$code?>'; }"  align="center">�����</td>
-                </tr>
-              </table></td>
-              <td width="38"><img class="db" height="14" src="https://img.new-combats.com/i/lite/mennu112_04_lite.gif" width="37" /></td>
-            </tr>
-          </table>
-          </td>
-        </tr>
-        <tr>
-          <td align="left"><img style="display:block; float:left; margin-left:17px;" src="https://img.new-combats.com/i/lite/top_lite_cap_07.gif" width="15" height="17" /><img src="https://img.new-combats.com/i/lite/capitalcity/top_lite_cap_08.gif" width="152" height="17" class="db" /></td>
-          <td align="right">
-          <table cellspacing="0" cellpadding="0" width="565" style="background-image:url(https://img.new-combats.com/i/lite/top_lite_cap_15.gif);" border="0">
-            <tr>
-              <td align="right" class="menutop"><table width="100%" border="0" cellpadding="0" cellspacing="0">
-                  <tr>
-                    <td width="20"><img class="db" src="https://img.new-combats.com/i/lite/top_lite_13.gif" width="20" height="17" /></td>
-                    <td align="center" valign="top" background="https://img.new-combats.com/i/lite/top_lite_low_15.gif" style="font-size:10px;">
-                        <span style="display:none; text-align:center;" id="menu1"> <a href="/main.php?referals" target="main" class="menutop" style="color:green">�������</a> | <a href="https://new-combats.com/forum/" target="_blank" class="menutop">�����</a> | <a href="https://new-combats.com/encicl/law.html" target="_blank" class="menutop"><font color=red>������</font></a> | <a href="https://new-combats.com/rating_pers" target="_blank" class="menutop">�������</a> | <a href="https://new-combats.com/rating_clans" target="_blank" class="menutop">�����</a> | <a href="main.php?security" target="main" class="menutop" style="color:green">������������</a> | <a href="https://new-combats.com/news_script/lib/pisheri.html" target="_blank" class="menutop"><font color=darkgreen>�� � �������</font></a> </span>
-                        <span style="display:; text-align:center;" id="menu2"><a href="/main.php?inv=1&rn=<?=$c[9]?>" target="main" class="menutop">���������</a> |<span style="display:; text-align:center;" id="menu2"><a href="main.php?titul" target="main" class="menutop" style="color:green"> ����������</a> | <a href="/main.php?skills=1&side=5" target="main" class="menutop">������</a> | <a href="/main.php?zayvka=1" target="main" class="menutop">��������</a> | <a href="/forum/?read=10957&rnd=1" target="_blank" class="menutop" style="color:red">���� �������</a> | <a href="/n" target="_blank" class="menutop" style="color:blue">�������</a> | <a href="settings" target="_blank" class="menutop">������</a></span>
-                    </td>
-                    <td width="22"><img class="db" src="https://img.new-combats.com/i/lite/top_lite_18.gif" width="22" height="17" /></td>
-                  </tr>             
-                </table></td>
-            </tr>
-          </table></td>
-        </tr>
-      </table>
-    </div>
-    <table width="100%" border="0" cellspacing="0" cellpadding="0">
-      <tr>
-        <td width="15" height="6"><img class="db" src="https://img.new-combats.com/i/lite/_lit_20.gif" width="15" height="6" /></td>
-        <td background="https://img.new-combats.com/i/lite/_top_20s.gif"></td>
-        <td width="24" height="6"><img class="db" src="https://img.new-combats.com/i/lite/_lit_27.gif" width="24" height="6" /></td>
-      </tr>
-    </table>
-    <!-- -->
-</div>
-<table id="globalMain" width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
-  <tr>
-    <td height="31" width="9" bgcolor="#D6D6D6"></td>
-    <td height="31" bgcolor="#D6D6D6">&nbsp;</td>
-    <td height="31" width="12" bgcolor="#D6D6D6"></td>
-  </tr>
-  <tr>
-    <td bgcolor="#D6D6D6" background="https://img.new-combats.com/i/lite/_top_24.gif"></td>
-    <td valign="top" bgcolor="#e2e0e0" id="main_td">
-    <div id="touchmain" style="margin-top:3px;">
-    	<iframe id="main" name="main" src="main.php" frameborder="0" style="display:block;padding-top:0px;padding:0;margin:0;width:100%;border:0;" scrolling="auto"></iframe>
-    </div>
-    </td>
-    <td bgcolor="#D6D6D6" background="https://img.new-combats.com/i/lite/_top_28.gif"></td>
-  </tr>
-  <tr>
-    <td bgcolor="#D6D6D6" background="https://img.new-combats.com/i/lite/_top_24.gif"></td>
-    <td id="chat" valign="top" height="40%" bgcolor="#eeeeee">
-    <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" style="border-top:1px solid #CCCCCC">
-      <tr>
-        <td valign="top" id="chat_block" style="position:relative;border-top:1px solid #808080"><!-- display:block;-->
-            <div id="mini_qsst" onClick="top.qn_slk()" style="cursor:pointer"></div>
-            <div id="onbon"></div>
-            <div id="chat_menus" unselectable="on" onselectstart="return false;" style="display:block;position:absolute; right:0px; top:3px; padding-right:20px; height:18px; text-align:right; white-space:nowrap;">
-              	<!-- -->
-                <table border="0" style="margin-top:-3px;" align="right" cellpadding="0" cellspacing="0">
-                    <tr>
-                      <td>
-                        <div id="chat_menu" style="text-align:right; white-space:nowrap;">
-                            <? /*<div id="addbs" style="float:left;display:;"><a href="javascript:top.add_cb(0,'new',0,0);"><img src="addmn.gif" width="16" height="16" title="�������� ����� �������" /></a></div>*/ ?>
-                        </div>
-                      </td>
-                      <td style="display:none;" id="scroll_none" width="3"></td>
-                    </tr>
-                </table>
-                <!-- -->
-              </div>
-
-        <div id="ttSmiles" onselectstart="return false" style="display:none;z-index:1100;" />
-        	<div id="smilesDiv">�������� ���������</div>
-            <div id="smilesDiv2" style="display:none">
-            <?
-            echo '<center><small>����� �������� �������� ������ � <a href="/ekr.php" target="_blank">������������ ������</a><br>�������� ��������, ���� ��������� ������� �� �����������</small></center><hr>';
-			//
-			if( $u->info['add_smiles'] == '' ) { ?>
-            <center><br><br><br><br><br><br><br><font color="grey">� ��� ��� ������ ���������</font></center>
-            <? }else{
-								
-				$ex = explode(',',$u->info['add_smiles']);
-				$i = 0;
-				while( $i < count($ex) ) {
-					echo '<img src="https://img.new-combats.com/i/smile/'.$ex[$i].'.gif" title=":'.$ex[$i].':" style="cursor:pointer" onclick="chat.addSmile(\''.$ex[$i].'\');"> ';
-					$i++;
-				}
-				
-			} ?>
-            </div>
-            <div id="smilesDiv3" style="display:none">
-            
-            </div>
-            <div align="center" style="padding-left:5px; padding-right:5px;">
-            <button class="btn fl" style="display:none; padding:0; margin:0; margin-top:5px; margin-right:2px;" disabled="disabled"><small>&nbsp; ������ &nbsp;</small></button>
-            <button class="btn fl" style="padding:0; margin:0; margin-top:5px;" id="btnsmlrz" onClick="smiles1load();"><small>&nbsp; ������ �������� &nbsp;</small></button>
-            <button class="btn fr" style="padding:0; margin:0; margin-top:5px;" onClick="chat.lookSmiles()"><small>&nbsp; ������� &nbsp;</small></button>
-            </div>
-        </div>
-        
-          <div id="chat_list" style="cursor:default;">
-                <div id="canals">
-                	<div id="canal5"></div>
-                    <div id="canal6" style="display:none;"></div>
-                </div>
-          </div>        
-        </td>
-        <td width="350" valign="top" bgcolor="#faf2f2" style="border-left:2px solid #CCCCCC;border-top:1px solid #808080" id="online">
-        <div id="online_list" style="cursor:default;">
-          <div align="center" style="margin-top:5px;">
-          	<button class="btn" id="robtn" onClick="chat.reflesh()">��������</button>
-          	<button  TYPE=button class="btn" onClick="window.open('https://new-combats.com/monitoring', 'monitoring', 'location=yes,menubar=yes,status=yes,resizable=yes,toolbar=yes,scrollbars=yes,scrollbars=yes')" title="������� ������\��������"><img src="https://img.new-combats.com/i/fighttype0.gif" width="20" height="20"></button>
-          </div>
-          <font class="db" style="padding:0px 0 8px 0;font-size: 10pt; color:#8f0000;"><b id="roomName"></b></font>
-          <div id="onlist"></div>
-          <div style="padding:5px;margin-top:5px;">
-              <!-- <div><label><input type="checkbox" value="1" <? if( $u->info['level'] < 8 ) { ?>checked<? } ?> id="autoRefOnline">��������� �������.</label></div>-->
-			  <div><label><input type="checkbox" value="1" checked id="autoRefOnline">��������� �������.</label></div>
-              <? if( $u->info['admin'] > 0 ) { ?>
-              <!--<div><label><input name="chcf10" type="checkbox" id="chcf10" <? if( $u->info['level'] < 8 ) { ?>checked<? } ?> value="0">�������� ���� �������</label></div>-->
-			  <div><label><input name="chcf10" type="checkbox" id="chcf10" checked value="0">�������� ���� �������</label></div>
-          	  <? } ?>
-          </div>
-        </div>
-      </td>
-      </tr>
-    </table>
-    </td>
-    <td bgcolor="#D6D6D6" background="https://img.new-combats.com/i/lite/_top_28.gif"></td>
-  </tr>
-  <tr>
-    <td height="30" valign="bottom"><img class="db" src="https://img.new-combats.com/i/lite/bkf_l_r1_02.gif" width="9" height="30"></td>
-    <td height="30" bgcolor="#E9E9E9" background="https://img.new-combats.com/i/buttons/chat_bg.gif">
-    <table width="100%" height="26" border="0" cellspacing="0" cellpadding="0">
-      <tr>
-        <td width="30"><img <? if( $u->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="���"></td>
-        <td style="display:none;" width="100" align="center" id="trader1"><div id="trader" style="border:1px solid #CCCCCC;padding:2px; margin-left:-2px; width:90%;" class="klan"><small id="moneyGM"><b>�������� ���</b></small></div></td>
-        <td><input type="hidden" name="trader" id="trader_val" value="0"><input onmouseup="top.chat.inObj=undefined;" type="text" name="textmsg" id="textmsg" maxlength="240" onKeyPress="top.testKey(event)" style="width:100%;font-size:11pt;margin-bottom:2px; border-radius: 5px; -webkit-border-radius: 5px;	-moz-border-radius: 5px;" /></td>
-        <td width="6">&nbsp;</td>
-        <td width="30"><img onClick="chat.subSend();" src="https://img.new-combats.com/1x1.gif" class="db cp chatBtn2_1"></td>
-        <td width="5">
-        <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="1" height="1" id="Sound" align="middle">
-			<param name="allowScriptAccess" value="always" />
-			<param name="movie" value="flash/Sound2.1.swf" />
-			<param name="quality" value="high" />
-			<param name="scale" value="noscale" />
-			<param name="wmode" value="transparent" />
-			<embed src="flash/Sound2.1.swf" quality="high" scale="noscale" wmode="transparent" width="1" height="1" name="Sound" id="Sound2" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer" />
-        </object>
-        </td>
-        <?if($u->info['level']>9){ ?>
-        <td width="30"><img onclick="window.open('audio/index.php')" class="db cp" title="��������� ���������" src="https://img.new-combats.com/b___.gif"></td>
-        <? } ?>
-		<td width="30"><img onClick="chat.clear();" class="db cp" title="�������� ������ �����" src="https://img.new-combats.com/i/buttons/chatBtn3.gif"></td>
-        <td width="30"><img onClick="chat.filterMsg();" id="chbtn1" title="���������� � ���� ������ ��������� ������������ ���" src="https://img.new-combats.com/1x1.gif" class="db cp chatBtn1_1"></td>
-        <td width="30"><img onClick="chat.systemMsg();" id="chbtn4" title="���������� � ���� ��������� ���������" src="https://img.new-combats.com/1x1.gif" class="db cp chatBtn4_<? if(isset($_COOKIE['citySys']) && $_COOKIE['citySys']==1){ echo 2; }else{ echo 1; } ?>"></td>
-        <td width="30"><img id="chbtn6" onClick="chat.translitChat()" title="��������������� �������� � ������� �����" src="https://img.new-combats.com/1x1.gif" class="db cp chatBtn6_1"></td>
-        <td width="30"><img id="chbtn7" onClick="chat.soundChat()" src="https://img.new-combats.com/1x1.gif" title="�����" class="db cp chatBtn7_1"></td>
-        <td width="10">&nbsp;</td>
-        <td width="30"><img id="chbtn8" class="db cp chatBtn8_1" onClick="chat.lookSmiles()" title="��������" src="https://img.new-combats.com/1x1.gif"></td>
-        <!--<td width="30"><img id="chbtn8" class="cp" title="������ �������� �������" onClick="fastpanel()" src="https://img.new-combats.com/b___cl1.gif"></td>-->
-        <td width="16" bgcolor="#BAB7B3"><img src="https://img.new-combats.com/i/buttons/chat_explode.gif" width="16" height="30" class="db" /></td>
-        <td width="30"><img onclick="top.getUrl('main','main.php?inv=1&rnd='+c.rnd);" class="db cp" title="���������" src="https://img.new-combats.com/i/buttons/chatBtn13.gif"></td>
-		<?   if($u->info['level']>7){ ?>
-        <td width="30"><img onClick="top.getUrl('main','main.php?transfer=1&rnd='+c.rnd);" class="db cp" title="��������" src="https://img.new-combats.com/i/buttons/chatBtn16.gif"></td>
-        <? } if($u->info['level']>=0){ ?>
-		<!--�������� online
-        <td width="30"><img onClick="top.getUrl('main','main.php?alh=1&rnd='+c.rnd);" class="db cp" src="https://img.new-combats.com/i/buttons/chatBtn9.gif"></td>-->
-		<td width="30"><img onClick="top.getUrl('main','main.php?add_eff=1&rnd='+c.rnd);" class="db cp" title="������" src="https://img.new-combats.com/i/buttons/chatBtn151.gif"></td>
-        <? } if($u->info['align']==50 || $u->info['align2']==50 || $u->info['admin'] == 1) {?>
-		<td width="30"><img onClick="top.getUrl('main','main.php?alhp=1&rnd='+c.rnd);" class="db cp" src="https://img.new-combats.com/i/buttons/chatBtn20.gif"></td>
-		<?}  if($u->info['align']>=1.1 && $u->info['align']<2 ){ ?>
-        <td width="30"><img onClick="top.getUrl('main','main.php?light=1&rnd='+c.rnd);" class="db cp" title="������ ��������" src="https://img.new-combats.com/i/buttons/chatBtn15.gif"></td>
-        <? } if($u->info['align']>=3.01 && $u->info['align']<4){ ?>
-        <td width="30"><img onClick="top.getUrl('main','main.php?dark=1&rnd='+c.rnd);" class="db cp" title="������ �������" src="https://img.new-combats.com/i/buttons/chatBtn10.gif"></td>
-        <? } if($u->info['vip']>time() || $u->stats['silvers']>0 || $u->stats['bronze']>0 || $u->stats['gold']>0 ){ ?>
-		<!-- VIP -->
-       <td width="30"><img onClick="top.getUrl('main','main.php?vip=1&rnd='+c.rnd);" class="db cp"  src="https://img.new-combats.com/i/buttons/a___ang17.gif" onMouseOver="top.hi(this,'<b>������ ��������� ������ <?=$u->info['login']?></b>',event,3,0,1,0,'');" onMouseOut="top.hic();" onMouseDown="top.hic();"> </td></td>
-
-        <? } if($u->info['level']>= 0){ ?>
-        <td width="30"><img onClick="top.getUrl('main','main.php?friends=1&rnd='+c.rnd);" class="db cp" title="������" src="https://img.new-combats.com/i/buttons/chatBtn12.gif"></td>
-		<?}  if($u->info['align']>=1 && $u->info['align']<2){ ?>
-		<td width="30"><img onClick="top.getUrl('main','main.php?1_panel=1&rnd='+c.rnd);" class="db cp" title="������ �����" src="https://img.new-combats.com/i/buttons/chatBtn15.gif"></td>
-		<?}  if($u->info['align']>=3 && $u->info['align']<4){ ?>
-		<td width="30"><img onClick="top.getUrl('main','main.php?3_panel=1&rnd='+c.rnd);" class="db cp" title="������ ����" src="https://img.new-combats.com/i/buttons/chatBtn10.gif"></td>
-		<?}  if($u->info['align']==7) { ?>
-		<td width="30"><img onClick="top.getUrl('main','main.php?7_panel=1&rnd='+c.rnd);" class="db cp" title="������ ������������" src="https://img.new-combats.com/i/buttons/a___neutral.gif"></td>
-		<? } if($u->info['bukmeker']==1 || $u->info['admin']==1){ ?>
-        <td width="30"><img onClick="top.getUrl('main','main.php?bukmeker=1&rnd='+c.rnd);" class="db cp" title="������ ��������� " src="https://img.new-combats.com/i/buttons/bukmek.gif"></td>
-	   <? } if($u->info['admin'] > 0 || $u->info['align'] == 50){ ?>
-		<!--�������
-        <td width="30"><img onClick="top.getUrl('main','main.php?notepad=1&rnd='+c.rnd);" class="db cp" src="https://img.new-combats.com/b_notepad.gif"></td>-->
-		<? } if($u->info['level']>-1){ ?>
-
-        <? } if($u->info['clan']>0){ ?>
-        <td width="30"><img onClick="top.getUrl('main','main.php?clan=1&rnd='+c.rnd);" class="db cp" title="����" src="https://img.new-combats.com/i/buttons/chatBtn14.gif"></td>
-        <? } if($u->info['admin']>0){ ?>
-        <td width="30"><img onClick="top.getUrl('main','main.php?admin=1&rnd='+c.rnd);" class="db cp" src="https://img.new-combats.com/i/buttons/chatBtn19.gif"></td>
-        <? } ?>
-        <!--
-        <td width="30"><img onClick="top.getUrl('main','main.php?bagreport=1&rnd='+c.rnd);" class="db cp" src="https://img.new-combats.com/i/buttons/chatBtnBugs.gif"></td>
-        -->
-        <!--<td width="30"><img onClick="if(confirm('����� �� ����?')){ top.location = '/bk?exit&rnd=<?=$code?>'; }" class="db cp" src="https://img.new-combats.com/i/buttons/chatBtn11.gif"></td>-->
-		<td width="30"><img onclick="window.open('ekr2.php')" class="db cp" title="������� ������������" src="https://img.new-combats.com/i/buttons/a___nak.gif"></td>
-
-
-		<!-- ����� -->
-		<td width="71" id="tdDate">
-			<button id="contentDate"></button>
-		</td>
-		<!-- ����� -->
-
-      </tr>
-    </table>
-    </td>
-    <td height="30" align="right" bgcolor="#D6D6D6"><img class="db" src="https://img.new-combats.com/i/lite/bkf_l_r1_06.gif" width="9" height="30"></td>
-  </tr>
-  <tr>
-    <td height="5" bgcolor="#D6D6D6" style="background:url(https://img.new-combats.com/sand_mid_31.png);"></td>
-    <td height="5" bgcolor="#D6D6D6" style="background:url(https://img.new-combats.com/sand_mid_31.png);"><!-- iFrames zone --></td>
-    <td height="5" bgcolor="#D6D6D6" style="background:url(https://img.new-combats.com/sand_mid_31.png);"></td>
-  </tr>
-</table>
-
-<!-- ������ -->
-<script>
-	var $button = document.getElementById("contentDate")
-	var $div = document.createElement("div")
-	$div.id = "divFullDate"
-    document.body.append($div)
-	$div.hidden = true
-
-
-	var date = new Date()
-    var currentSec = (60 - date.getUTCSeconds()) * 1000
-    
-    asyncInterval()
-    async function asyncInterval () {
-        
-        timeMSK()
-        
-        var promise = await new Promise ( (resolve, reject) => {
-            setTimeout( () => {
-                timeMSK()
-                resolve("��� ������")
-            }, currentSec)
-        })
-        
-        setInterval( () => {
-            timeMSK()
-        }, 60000)
-    }
-    
-    function timeMSK (clickTrue = false) {
-        date = new Date()
-        
-        var year = date.getUTCFullYear()
-        var month = date.getUTCMonth()
-        var day = date.getUTCDate()
-        var hour = date.getUTCHours() 
-        var min = date.getUTCMinutes()
-		var sec = date.getUTCSeconds()
-		
-        var utcDate1 = new Date(Date.UTC(year, month, day, hour + 3, min, sec))
-        var dateUTC = utcDate1.toUTCString()
-		var result = dateUTC.match(/\d{2}:\d{2}/gi)
-
-		$button.textContent = result[0]
-
-        if (clickTrue) {
-            result = dateUTC.match(/\d{2}:\d{2}:\d{2}/gi)
-
-            var objDate = {
-                year: utcDate1.getUTCFullYear(),
-                month: utcDate1.getUTCMonth(),
-                day: utcDate1.getUTCDate()
-            }
-            
-            var strFullDate = divFullDateTime(objDate) 
-            var todayDay = utcDate1.getUTCDay()
-
-            if (todayDay === 5 || todayDay === 6 || todayDay === 0) {
-                return { date: strFullDate, time: result[0], redDay: true }
-            }
-            return { date: strFullDate, time: result[0], redDay: false }
-        }
-	}    
-	
-	function divFullDateTime (objArgs) {
-
-		var { year, month, day } = objArgs
-		var strMonth = ""
-
-		switch (month) {
-			case 0: strMonth = "������"; break
-			case 1: strMonth = "�������"; break
-			case 2: strMonth = "�����"; break
-			case 3: strMonth = "������"; break
-			case 4: strMonth = "���"; break
-			case 5: strMonth = "����"; break
-			case 6: strMonth = "����"; break
-			case 7: strMonth = "�������"; break
-			case 8: strMonth = "��������"; break
-			case 9: strMonth = "�������"; break
-			case 10: strMonth = "������"; break
-			case 11: strMonth = "�������"; break
-			default: break
-		}
-		return `${day} ${strMonth} ${year}` 
-	}
-
-	function everySecondsUpdate () {
-		var { date, time, redDay } = timeMSK(true)
-
-		$div.innerHTML = `<p>${time}</p>
-		<p id="dateRed">${date}</p>`
-
-		if (redDay) return document.getElementById("dateRed").style.color = "red"
-
-		document.getElementById("dateRed").style.color = ""
-		return 
-	}
-
-	var intervalClear
-    var timeoutClear 
-
-    $button.addEventListener("mouseover", function (event) {    
-
-        timeoutClear = setTimeout( () => {
-
-            $div.hidden = false
-			var $trTop = $button.parentElement.parentElement.parentElement.parentElement.parentElement.offsetTop
-			var $tdLeft = document.getElementById("tdDate").offsetLeft
-				
-			$div.style.top = `${$trTop - ($button.offsetHeight * 2)}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)
-    })
-</script>
-
-<?
-if($u->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 '<script>chat.sendMsg(["new","'.time().'","6","","'.$u->info['login'].'","<small>�� ��� �������� ���� <b>'.$u->info['mail'].'</b> ���������� ������ � ����������� �� ��������� ��������. (������ ������� � ������� 15 �����, � ���-�� ��������� ������ &quot;����&quot;)</small>","Black","1","1","0"]);</script>';
-		//$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('<script>top.location = "https://'.$c[$u->info['city']].'/bk";</script>');
-		}
-	}
-	*/
-}
-?>
-<script>
-startEngine();
-chat.testTimer(false);
-//setTimeout('chat.nozpros=0;',20);
-<? if( $u->info['design'] == 1 ) { ?>
-/*
-top.add_cb(1,'���',1,'ch1','<br>');
-top.add_cb(5,'���',1,'ch5','<br>');
-top.add_cb(3,'���',1,'ch3','<br><div id="battle_logg"></div>');
-top.add_cb(4,'��������� ���������',1,'ch4','<br>');
-*/
-
-<? } ?>
-</script>
-</body>
-</html>
-<?
-unset($db);
-?>
\ No newline at end of file
diff --git a/hmonitor.php b/hmonitor.php
index 6a608e8e..38a84cac 100644
--- a/hmonitor.php
+++ b/hmonitor.php
@@ -1,194 +1,204 @@
-<?
-define('GAME',true);
+<?php
+const GAME = true;
+if (!defined('GAME_VERSION')) {
+    require_once '_incl_data/autoload.php';
+}
 include('_incl_data/__config.php');
-include('_incl_data/class/__db_connect.php');
-include('_incl_data/class/__user.php');
+//include('_incl_data/class/__db_connect.php');
+
+Core\Database::init();
+$c = (new \Core\Config())->get();
+$u = User::start();
 ?>
 
-<!DOCTYPE HTML5>
+<!DOCTYPE HTML>
 <html>
 <head>
-<meta charset = "windows-1251">
-<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
-<meta http-equiv=Cache-Control Content=no-cache>
-<meta http-equiv=PRAGMA content=NO-CACHE>
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
-<title>������� ���������</title>
+    <meta charset="windows-1251">
+    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
+    <meta http-equiv=Cache-Control Content=no-cache>
+    <meta http-equiv=PRAGMA content=NO-CACHE>
+    <link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
+    <title>������� ���������</title>
 </head>
 <body style="padding-top:0px; margin-top:7px; height:100%; background-color:#dedede;">
 <script type="text/javascript" src="js/jquery.js"></script>
-<center><strong>������������� ��������: </strong><?=$u->microLogin($u->info['id'],1)?></center>
+<center><strong>������������� ��������: </strong><?= $u->microLogin($u->info['id'], 1) ?></center>
 <hr>
-<INPUT style="float:right" class="btn btn-success" TYPE=button value="��������" style='width: 100px' onClick="location.href='monitoring'"></div>
-<h3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;������ �� ����������� ��������</h3>
-<?
-$html = ''; $i = 0;
+<INPUT style="float:right" class="btn btn-success" TYPE=button value="��������" style='width: 100px'
+       onClick="location.href='monitoring'"></div>
+<h3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;������
+    �� ����������� ��������</h3>
+<?php
+$html = '';
+$i = 0;
 $sp = mysql_query('SELECT * FROM `zayvki` WHERE `razdel` = 5 AND `cancel` = 0 AND `btl_id` = 0 ORDER BY `id` ASC');
-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 = '<i><font color=grey><small>���� ��� ���� ����� ������!</small></font></i>';
-	}else{
-		$users = rtrim($users,',');
-	}
-	//
-	$html .= $i . '. <span class="date">'.date('H:i',$pl['time']).'</span> ';
-	$html .= ' <img title="'.$u->city_name[$pl['city']].'" src="https://img.new-combats.com/i/city_ico/'.$pl['city'].'.gif">';
-	$html .= ' ('.$users.') ('.$pl['min_lvl_1'].'-'.$pl['max_lvl_1'].') ��� ���: <img src="https://img.new-combats.com/i/fighttype'.$pl['type'].'.gif"> ';
-	if( $pl['noinc'] > 0 ) {
-		$html .= '<img src="https://img.new-combats.com/closefight.gif" title="� �������� ������ ���������">';
-	}
-	if( $pl['fastfight'] > 0 ) {
-		$html .= '<img src="https://img.new-combats.com/fastfight.gif" title="��� ������ �������� ��������� ������� ���� ����������">';
-	}
-	if( $pl['arand'] > 0 ) {
-		$html .= '<img src="https://img.new-combats.com/arand.gif" title="������� ������� �� ��� ������ ������� (������ �� ����������, �� �� �� ��������)">';
-	}
-	$html .= '<font color="grey">��� �������� ����� <b>'.$u->timeOut($pl['time']+$pl['time_start']-time()).'</b>, ������� '.$u->timeOut($pl['timeout']).'</font>';
-	if( $pl['priz'] > 0 ) {
-		$html .= '<a href="https://new-combats.com/n/567/" target="_blank"><span style="color:#e65700;" title="��������� ������� �� 5-�� �������� ������,�������������� �� ������ ��� ���������,� ��� �� ���������� ����� 5% ���� �� ��������� ������ ������ "><b>(����������� ��������)</b></span></a></font></i>';
-	}
-	$html .= '<br>';
+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 = '<i><font color=grey><small>���� ��� ���� ����� ������!</small></font></i>';
+    } else {
+        $users = rtrim($users, ',');
+    }
+    //
+    $html .= $i . '. <span class="date">' . date('H:i', $pl['time']) . '</span> ';
+    $html .= ' <img title="' . $u->city_name[$pl['city']] . '" src="https://img.new-combats.com/i/city_ico/' . $pl['city'] . '.gif">';
+    $html .= ' (' . $users . ') (' . $pl['min_lvl_1'] . '-' . $pl['max_lvl_1'] . ') ��� ���: <img src="https://img.new-combats.com/i/fighttype' . $pl['type'] . '.gif"> ';
+    if ($pl['noinc'] > 0) {
+        $html .= '<img src="https://img.new-combats.com/closefight.gif" title="� �������� ������ ���������">';
+    }
+    if ($pl['fastfight'] > 0) {
+        $html .= '<img src="https://img.new-combats.com/fastfight.gif" title="��� ������ �������� ��������� ������� ���� ����������">';
+    }
+    if ($pl['arand'] > 0) {
+        $html .= '<img src="https://img.new-combats.com/arand.gif" title="������� ������� �� ��� ������ ������� (������ �� ����������, �� �� �� ��������)">';
+    }
+    $html .= '<font color="grey">��� �������� ����� <b>' . $u->timeOut(
+            $pl['time'] + $pl['time_start'] - time()
+        ) . '</b>, ������� ' . $u->timeOut($pl['timeout']) . '</font>';
+    if ($pl['priz'] > 0) {
+        $html .= '<a href="https://new-combats.com/n/567/" target="_blank"><span style="color:#e65700;" title="��������� ������� �� 5-�� �������� ������,�������������� �� ������ ��� ���������,� ��� �� ���������� ����� 5% ���� �� ��������� ������ ������ "><b>(����������� ��������)</b></span></a></font></i>';
+    }
+    $html .= '<br>';
 }
-if( $html == '' ) {
-	$html = '<center>(������ ����)</center>';
+if ($html == '') {
+    $html = '<center>(������ ����)</center>';
 }
-echo $html; $html = '';
+echo $html;
+$html = '';
 ?>
 <h3>������� ���</h3>
-<?
+<?php
 $i = 0;
 $sp = mysql_query('SELECT * FROM `battle` WHERE `team_win` = -1');
-while( $pl = mysql_fetch_array($sp) ) {
-	//
-	$users = '';
-	$usersa = array();
-	$userst = array();
-	//
-	$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 .= ' &nbsp;<b><font color=red><small>������</small></font></b>&nbsp; ';
-			}
-			$users .= $usersa[$userst[$j]];
-			$users = rtrim($users,',');
-			$j++;
-		}
-		//
-		$i++;
-		//
-		
-		$html .= $i . '. <span class="date">'.date('d.m.Y H:i',$pl['time_start']).'</span> ';
-		$html .= ' <img title="'.$u->city_name[$pl['city']].'" src="https://img.new-combats.com/i/city_ico/'.$pl['city'].'.gif">';
-		$html .= ' ('.$users.') ��� ���: <img src="https://img.new-combats.com/i/fighttype'.$pl['type'].'.gif"> ';
-		if( $pl['noinc'] > 0 ) {
-			$html .= '<img src="https://img.new-combats.com/closefight.gif" title="� �������� ������ ���������">';
-		}
-		if( $pl['fastfight'] > 0 ) {
-			$html .= '<img src="https://img.new-combats.com/fastfight.gif" title="��� ������ �������� ��������� ������� ���� ����������">';
-		}
-		if( $pl['arand'] > 0 ) {
-			$html .= '<img src="https://img.new-combats.com/arand.gif" title="������� ������� �� ��� ������ ������� (������ �� ����������, �� �� �� ��������)">';
-		}
-		$html .= '<font color="grey">, ������� '.$u->timeOut($pl['timeout']).'</font>';
-		if( $pl['priz'] > 0 ) {
-			$html .= '<a href="https://new-combats.com/n/567/" target="_blank"><span style="color:#e65700;" title="��������� �������� �� 5-�� �������� ������, � ��� ��, �� ������� ������� �������� ������� 5% ���� �� ��������� ������������� ������ ������ "><b>(����������� ��������)</b></span></a></font></i>';
-		}
-		$html .= ' <a href="/logs.php?log='.$pl['id'].'" target="_blank">&raquo;&raquo;</a> ';
-		$html .= '<br>';
-	}
-	//
+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 .= ' &nbsp;<b><font color=red><small>������</small></font></b>&nbsp; ';
+            }
+            $users .= $usersa[$userst[$j]];
+            $users = rtrim($users, ',');
+            $j++;
+        }
+        //
+        $i++;
+        //
+
+        $html .= $i . '. <span class="date">' . date('d.m.Y H:i', $pl['time_start']) . '</span> ';
+        $html .= ' <img title="' . $u->city_name[$pl['city']] . '" src="https://img.new-combats.com/i/city_ico/' . $pl['city'] . '.gif">';
+        $html .= ' (' . $users . ') ��� ���: <img src="https://img.new-combats.com/i/fighttype' . $pl['type'] . '.gif"> ';
+        if ($pl['noinc'] > 0) {
+            $html .= '<img src="https://img.new-combats.com/closefight.gif" title="� �������� ������ ���������">';
+        }
+        if ($pl['fastfight'] > 0) {
+            $html .= '<img src="https://img.new-combats.com/fastfight.gif" title="��� ������ �������� ��������� ������� ���� ����������">';
+        }
+        if ($pl['arand'] > 0) {
+            $html .= '<img src="https://img.new-combats.com/arand.gif" title="������� ������� �� ��� ������ ������� (������ �� ����������, �� �� �� ��������)">';
+        }
+        $html .= '<font color="grey">, ������� ' . $u->timeOut($pl['timeout']) . '</font>';
+        if ($pl['priz'] > 0) {
+            $html .= '<a href="https://new-combats.com/n/567/" target="_blank"><span style="color:#e65700;" title="��������� �������� �� 5-�� �������� ������, � ��� ��, �� ������� ������� �������� ������� 5% ���� �� ��������� ������������� ������ ������ "><b>(����������� ��������)</b></span></a></font></i>';
+        }
+        $html .= ' <a href="/logs.php?log=' . $pl['id'] . '" target="_blank">&raquo;&raquo;</a> ';
+        $html .= '<br>';
+    }
+    //
 }
-if( $html == '' ) {
-	$html = '<center>(������ ����)</center>';
+if ($html == '') {
+    $html = '<center>(������ ����)</center>';
 }
-echo $html; $html = '';
+echo $html;
+$html = '';
 ?>
 <h3>����� ������</h3>
-<?
+<?php
 $sp = mysql_query('SELECT * FROM `bs_turnirs`');
 $i = 0;
-while( $pl = mysql_fetch_array($sp) ) {
-	$i++;
-	//
-	$html .= $i.'. <img title="'.$u->city_name[$pl['city']].'" src="https://img.new-combats.com/i/city_ico/'.$pl['city'].'.gif">';
-	//
-	$html .= ' ['.$pl['level'].']';
-	if( $pl['status'] == 0 ) {
-		//������� ������ ������ �������
-		$html .= ' ������ ������� � "����� ������" : <span class="date">'.date('d.m.Y H:i',$pl['time_start']).'</span> (<small> <font color=grey>�������� ����� <b>'.$u->timeOut($pl['time_start']-time()).'</b></font></small>) �������� ���� �� ������� ������: <b>'.round(($pl['money']/100*85),2).'</b> ��. ����� ������ ������: <b>'.$pl['users'].'</b>';
-	}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 .= ' <span title="['.$pl['status'].']">������ ����� ������ ��� ����.</span>';
-		$html .= ' ���������: '.$users.', ��� �������: <a href="/towerlog.php?towerid='.$pl['id'].'&id='.$pl['count'].'" target="_blank">&raquo;&raquo;</a>';
-	}
-	//
-	$html .= '<br>';
-	//
+while ($pl = mysql_fetch_array($sp)) {
+    $i++;
+    //
+    $html .= $i . '. <img title="' . $u->city_name[$pl['city']] . '" src="https://img.new-combats.com/i/city_ico/' . $pl['city'] . '.gif">';
+    //
+    $html .= ' [' . $pl['level'] . ']';
+    if ($pl['status'] == 0) {
+        //������� ������ ������ �������
+        $html .= ' ������ ������� � "����� ������" : <span class="date">' . date(
+                'd.m.Y H:i', $pl['time_start']
+            ) . '</span> (<small> <font color=grey>�������� ����� <b>' . $u->timeOut(
+                $pl['time_start'] - time()
+            ) . '</b></font></small>) �������� ���� �� ������� ������: <b>' . round(
+                ($pl['money'] / 100 * 85), 2
+            ) . '</b> ��. ����� ������ ������: <b>' . $pl['users'] . '</b>';
+    } 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 .= ' <span title="[' . $pl['status'] . ']">������ ����� ������ ��� ����.</span>';
+        $html .= ' ���������: ' . $users . ', ��� �������: <a href="/towerlog.php?towerid=' . $pl['id'] . '&id=' . $pl['count'] . '" target="_blank">&raquo;&raquo;</a>';
+    }
+    //
+    $html .= '<br>';
+    //
 }
-if( $html == '' ) {
-	$html = '<center>(������ ����)</center>';
+if ($html == '') {
+    $html = '<center>(������ ����)</center>';
 }
-echo $html; $html = '';
+echo $html;
+$html = '';
 ?>
 
 <h3>����� ������</h3>
-<?
-if( $html == '' ) {
-	$html = '<center>(������ ����)</center>';
+<?php
+if ($html == '') {
+    $html = '<center>(������ ����)</center>';
 }
-echo $html; $html = '';
+echo $html;
+$html = '';
 ?>
 
 <h3>������� ������� ��������</h3>
-<?
-if( $html == '' ) {
-	$html = '<center>(������ ����)</center>';
+<?php
+if ($html == '') {
+    $html = '<center>(������ ����)</center>';
 }
-echo $html; $html = '';
+echo $html;
+$html = '';
 ?>
 
-<div align="right"><font style="color:#999;" size="1" face="verdana" color="black"><hr style="border-color:#CCC;">���������� ���� v2.1 &copy; <?=date('Y')?>, �www.new-combats.com�� &nbsp; &nbsp; </font></div>
-<br /><br />
+<div align="right"><font style="color:#999;" size="1" face="verdana" color="black">
+        <hr style="border-color:#CCC;">
+        ���������� ���� v2.1 &copy; <?= date('Y') ?>, �www.new-combats.com�� &nbsp; &nbsp; </font></div>
+<br/><br/>
 
-<div align="right"><div style="display:none"><!--LiveInternet counter--><script type="text/javascript"><!--
-        document.write("<a href='//www.liveinternet.ru/click' "+
-        "target=_blank><img style='display:inline-block; vertical-align:bottom;' src='//counter.yadro.ru/hit?t25.10;r"+
-        escape(document.referrer)+((typeof(screen)=="undefined")?"":
-        ";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?
-        screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+
-        ";"+Math.random()+
-        "' alt='' title='LiveInternet: �������� ����� ����������� ��"+
-        " �������' "+
-        "border='0' width='88' height='15'><\/a>")
-        //--></script><!--/LiveInternet-->
-        <!-- Rating@Mail.ru counter -->
-
-        <!-- //Rating@Mail.ru counter -->
-        <!-- Rating@Mail.ru logo -->
-
-        <!-- //Rating@Mail.ru logo --></div></div></body>
+</body>
 </html>
diff --git a/html/library.php b/html/library.php
index 9e625ee5..ca50a3a9 100644
--- a/html/library.php
+++ b/html/library.php
@@ -49,7 +49,7 @@ if( $url[2] == 'upload' && $u->info['admin'] > 0 ) {
 	}else{
 		
 		 if( isset($_FILES['filename']) && $u->info['admin'] > 0 ) {
-			 include('class.upload.php');
+			 require_once('class.upload.php');
 			 $handle = new upload($_FILES['filename']);
 			 $count = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `uid` = "'.$u->info['id'].'" AND `time` > '.(time()-60).' LIMIT 1'));
 			 if( $count > 3 && $u->info['admin'] == 0 ) {
diff --git a/index.php b/index.php
index 90010a9d..9ecd5369 100644
--- a/index.php
+++ b/index.php
@@ -1,218 +1,237 @@
-<?
+<?php
 
-if(isset($_GET['time'])) {
-	echo time().'<br>'.date('d.m.Y H:i:s',(int)$_GET['time']);
-	die();
+if (isset($_GET['time'])) {
+    echo time() . '<br>' . date('d.m.Y H:i:s', (int)$_GET['time']);
+    die();
 }
 ?>
 <!DOCTYPE html>
-<html lang="ru-RU">
- <head>
-  <meta charset="windows-1251">
-  <title>����� ����������� ���� - ����������� ���������� ������ ����</title>
-  <meta name="description" content="���������� ���� ������ ��. ������ ���������� ����. ����� ���������� ����."/>
-  <meta name="keywords" content="���������� ���� ������, ���������� ����, Combats.com, ������ ���������� ����, ���� ���������� ����, ������ � �������, �������, ���������� ������ ����, Acombats, ������ ��, ������ � ������ ��, oldcombats, ������ ���, ���, likebk, Comabts, legbk, acomabts.com, ���� ����, ���� ������, ���� ����, ���� ����"/>
-  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0"/>
-  <meta http-equiv="Cache-Control" content="max-age=3600"/>
-  <meta name="msapplication-config" content="browserconfig.xml"/>
-  <link type="text/css" rel="stylesheet" href="stylen.css" />
-    <!-- capcha google counter -->
- </head>
- <body>
-	<div class="page-background"><img class="img1" src="werhr.jpg" alt="������ ���������� ���� ������ � �������� ������ � ���� new-combats.com">
-		<form  action="/enter.php" method="post">
-			   <label for="first-name">��� �������</label><br><input type="text" id="first-name" name="login" /><br>
-			   <label for="last-name">��� ������</label><br><input type="password" id="last-name" name="psw" />
-			   <p><!--<a onclick="submit();" style="cursor: pointer;">����</a>-->
-			   <!--style="transform:scale(0.54);transform-origin:0 0;"-->
-			   	<div align="center" class="g-recaptcha" data-theme="dark" data-sitekey="6Lf3EjsaAAAAAF8SSkT2m6OU0k9XEpg61NbL3kJ8"></div>
-         <input type="submit" value="����� � ����" class="btn btn-default" style="background-color: #dadada;" />
-         <br /><br>
-            <a href='/news' target="_blank">������� �������</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-            <a href='/repass'>�������������� ������</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-            <a href='/register'>����������� � ����</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-            <a href='/forum' target="_blank">����� �������</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-            <a href="/rating_pers" target="_blank">������� ����������</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-            <a href="/rating_clans" target="_blank">������� ������</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-         	<br>
-			<br>
-            <br>
-         		<h1>����� ���������� ����</h1>
-				<small class="megatext">
+<html>
+<head>
+    <title>Новый «Бойцовский Клуб» - легендарная браузерная онлайн игра</title>
+    <meta name="description" content="Захватывающая многопользовательская онлайн-игра «New Combats» ждет героев меча и магии на поле боя. Окунись в мир полюбившегося миллионам игроков БК (RPG Олд Комбатс)."/>
+    <meta name="keywords"
+          content="Бойцовский клуб играть, бойцовский клуб, Combats.com, старый бойцовский клуб, игра бойцовский клуб, играть в комбатс, комбатс, браузерная онлайн игра, Acombats, старый БК, играть в старый БК, oldcombats, онлайн мир, маг, likebk, Comabts, legbk, acomabts.com, гайд крит, гайд уворот, гайд танк, гайд крит"/>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0"/>
+    <meta http-equiv="Cache-Control" content="max-age=3600"/>
+    <meta name="msapplication-config" content="browserconfig.xml"/>
+    <link type="text/css" rel="stylesheet" href="stylen.css"/>
+    <link rel="canonical" href="https://new-combats.com/">
+</head>
+<body>
+<div class="page-background"><img class="img1" src="werhr.jpg" alt="Старый бойцовский клуб играть и общаться вместе с нами new-combats.com">
+    <form action="/enter.php" method="post">
+        <label for="first-name">Ваш Никнейм</label><br><input type="text" id="first-name" name="login"/><br>
+        <label for="last-name">Ваш Пароль</label><br><input type="password" id="last-name" name="psw"/>
+        <p>
+        <div align="center" class="g-recaptcha" data-theme="dark" data-sitekey="6Lf3EjsaAAAAAF8SSkT2m6OU0k9XEpg61NbL3kJ8"></div>
+        <input type="submit" value="Войти в игру" class="btn btn-default" style="background-color: #dadada;"/>
+        <br/><br>
+        <a href='/news' target="_blank">Новости проекта</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+        <a href='/repass'>Восстановление пароля</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+        <a href='/register'>Регистрация в игре</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+        <a href='/forum' target="_blank">Форум проекта</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+        <a href="/rating_pers" target="_blank">Рейтинг персонажей</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+        <a href="/rating_clans" target="_blank">Рейтинг кланов</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+        <br>
+        <br>
+        <br>
+        <h1>Новый Бойцовский Клуб</h1>
+        <small class="megatext">
 
-                    <p align="center"><strong>����� ���������� ����</strong> � ��� ������, ��������������� ����������� ��������� � ������� ��� <strong> ������� ������������ �����</strong>. <strong>���������� ���� �combats.com� </strong> � ��� ���������� ���������� ����, ������� �������� ����� �� ��������������� ����� BBMMORPG. � <strong>����������� ���� �������</strong> �� ������� ���� ���� ������ � ���������,  ��������� ����� ��� �������.
-				 
-    �� ������ ����� ������ ������ ���� <strong>�combats.com�</strong> �� 2006-2009 ����. �� ����������� ��������� ��� ������ �������� ������ ������ ����������� ����� � �������� ����� ����� ���������� � ������������. ��� � � ������ ������ ���� <strong>����������� ����</strong>, ��� ��� ����� ��������� �������� ����� ��������, �������, ������������.  � ����������� �� ������ ������ �������� ����� ����� ������������ ����������, ������� ������� ������� ������� ������ ���������.
+            <p align="center"><strong>Новый Бойцовский Клуб</strong> — это проект, предоставляющий возможность окунуться в игровой мир <strong> старого «Бойцовского Клуба»</strong>. <strong>Бойцовский клуб «combats.com» </strong> — это бесплатная
+                браузерная игра, которая является одним из родоначальников жанра BBMMORPG. В <strong>«Бойцовский клуб играть»</strong> Вы сможете лишь имея доступ к интернету, используя любой веб браузер.
 
-    � �������� ���� ��� ���� ����� ����������� ������� � ���� � ������� ��������, ����� ����, �� ������ ������������ ��������� ���������, ����� ��������� ������� ������������ � �������� � �������� � ������ �������� ����������� �����. � ����������� �� ������� ������������ ������ ����� ������ �������� � ��������� ������� ����� ��� �� ������� ���� �����������, ���� ������ �����.
+                За основу взята старая версия игры <strong>«combats.com»</strong> за 2006-2009 года. Мы постарались сохранить все лучшие традиции старой версии бойцовского клуба и добавили массу новых обновлений и нововведений. Как и в старой доброй
+                игре <strong>«Бойцовский Клуб»</strong>, Вас ждёт масса эпических сражений между игроками, кланами, склонностями. В зависимости от Вашего выбора персонаж будет иметь определенную склонность, которые отлично помогут усилить вашего
+                персонажа.
 
-                     ��� ������� ����� � ������� ��������� � ����������� ������������  ������������ ������� ������� ������� � ������, � ��� �� ���������� ������� �������, ������� �� ������� ������� �� ������ �� �����, �������� ��������, ���������� ����������� ���������. �� � ���� � ��� ��������� ��������� � �����, ������ ��������� ������ ������ ��� ������ � �������� �� ���� ������� �������, �� � ���� � ��� �� ������� - <strong>����� �� ������ �������</strong> ������ ������� �� ������ � ��������� ���, ��� ��������� ����������� ������ ���������.
+                В процессе игры Вас ждет масса интересного общения в чате с другими игроками, более того, Вы можете использовать голосовые сообщения, чтобы облегчить процесс коммуникации с игроками и вникания в проект «Старого Бойцовского Клуба». В
+                зависимости от игровых предпочтений каждый игрок сможет вступать в различные игровые кланы или же создать свой собственный, став главой клана.
 
-    ������ ��� ����� � ��������� ��������� � <strong> ������� ������� ����������� �����</strong>.
-				
-				</small><br>
-				<h2>������� ��� ����������� ����</h2>
-				<small class="megatext">
-				
-				<p align="center">������� ������� �������� � ����� <strong>������� ����������� ����� �oldbk�</strong>. ��� �������� ��������� � <strong>���� ����� ���������� ����</strong>. ��� �������� ��������� ��� ���� ����� ���� <strong>������ �� ������� ����� ( �������, ����, ���� ��� ����� ) ��� �� ������ �� ���� ������ ( ��������, ������, ����, �����, ����������� )</strong>. � ����� ���� ��� ���� ����� �������, ��� �� ������� ������������ ������ ������, �������� ����������, ����������� ������ �����.  ���� ��������� ����� � ���� ������� �� ������ ������ ������ ��������� � ����� ���� ��� ������ � �������� �������.
+                Для каждого клана и каждого персонажа в отдельности предусмотрен динамический игровой рейтинг игроков и кланов, а так же ежедневные игровые события, которые не оставят игроков со скукой на едине, клановых сражений, проведения
+                хаотических поединков. Ну а если у Вас возникнут трудности с игрой, служба поддержки всегда готова Вам помочь и ответить на ваши игровые вопросы, ну а если и это не поможет - <strong>гайды на форуме проекта</strong> всегда прийдут на
+                помощь и подскажут Вам, как правильно прокачивать вашего персонажа.
 
-	������� �������� �������� �������� ����������� ��������, � ��� �� ������� ���������� ��������, ������� �� ������������� � ������� �����������. ������ ��� ����������� � ������ ������� � ����������� � �������������� �������. ��� ������ ��������� �� ���������, ��� ������� ���������� ��������. ������ ��������, �� ����������� ������� �� ���������� ��������� ��� ����� ������� �������.
+                Желаем Вам побед и преданных союзников в <strong> проекте «Нового Бойцовского Клуба»</strong>.
 
-	����� ��� �������� ����� � ��������� <strong>������� ����������� ����� �combats.com�</strong>. ������� � �������� ��������� �� ��������� �� ������ �������. 
+        </small><br>
+        <h2>Игровой мир «Бойцовский клуб»</h2>
+        <small class="megatext">
 
-	����� ��� ���� ������������� ������ � ������, � ������ ���������, �������, ������ ����, ���������� ����, ������ ������ ���������, ����� ���������, ���� �������, �������� ������, �������� ��� �����������, �� � � ���������� � ��� ����� ����������� ��������� ������ ����� � ������ �����.
-				
-				</small><br>
-				<h3>���������� ������������ ���� ����������� ����.</h3>
-				<small class="megatext">
-				
-    <p align="center"><strong>����� ���������� ����</strong> - ��� ����, ������� �������� ������ ������ ������������� ������ � 2004 � 2009 �����. <strong>�combats.com�</strong> ������ 2, ��������� ������ ������ ���� �� ��� ������ � MMORPG. ����� �� �������� ������������ ���� <strong>����������� ����</strong>, ������ ������������� ����, ����� �������� ���������� ������������.
+            <p align="center">Игровой процесс сохранен в жанре <strong>старого бойцовского клуба «oldbk»</strong>. Ваш персонаж создается в <strong>мире Новый Бойцовский Клуб</strong>. При создании персонажа Вас ждет выбор пути <strong>Одного из
+                    четырех магов ( Воздуха, Воды, Огня или Земли ) или же Одного из пяти воинов ( Критовик, Уворот, Танк, Топор, Критоуворот )</strong>. В самой игре Вас ждет масса локаций, где Вы сможете обмениваться боевым опытом, повышать
+                мастерство, прокачивать своего героя. Если возникнут какие — либо вопросы на помощь всегда придут подсказки в общем чате или статьи в новостях проекта.
 
-    � �������� ���� ������ ����� ���� ����������� �������� � ������� �������� � �����, �������� ��� ��������� ����. ������������ ������, �������� ������ ����������� ��� ������ ������ ��������� �����. ��� ���������� ���������� ����� � ��� ������ � ��� ���� ������������ �������� ��� ������ ���������� �������� <strong>����������� �����</strong>.
+                Основой игрового процесса являются хаотические поединки, а так же обычные физические поединки, которые вы осуществляете с другими персонажами. Каждый бой заключается в обмене ударами с противником с использованием приемов. Чем больше
+                поединков Вы проводите, тем сильнее становится персонаж. Каждые выходные, мы увеличиваем награду за проведение поединков для наших любимых игроков.
 
-        � �������<strong>����� ���������� ����</strong> ����� �������� ����� ������� <strong>�������� ����������� �����, � ��� �� ��������� ���������� � ����� ���� ��� ���� � ���������� �������� � <strong>��������� ���������</strong>></strong>.
-				</small><br>
-				<h4>������ ������� ����������� �����, ������� ���������� ��� ��������� ���� �combats.com� , �old-combats.com�, �likebk.com� � ������ ������ ������� �� ���� ����������� ����</h4><br></p>
-<small style="color: #d7d7d7; width: 100%;" class="megatext copy"></small>
- 	<div style="width:100%; text-align:center;">
-<a href="https://freekassa.ru" target="_blank" rel="noopener noreferrer"> <img src="https://cdn.freekassa.ru/banners/small-white-1.png" title="����� �������� �� �����"></a>
-        <!-- Rating@Mail.ru logo -->
+                Стиль боя сохранен также в традициях <strong>старого бойцовского клуба «combats.com»</strong>. Тактику и развитие персонажа Вы выбираете по своему желанию.
+
+                Также Вас ждут захватывающие походы в пещеры, а именно Катакомбы, Бездная, Пещера Мглы, Потерянный Вход, Пещера Тысячи Проклятий, Тропа Инвизиции, Гора Легиона, Туманные Низины, Грибница или Канализация, ну а в дополнение у Вас будет
+                возможность проверить своего бойца в Изломе Хаоса.
+
+        </small><br>
+        <h3>Социальная составляющая игры «Бойцовский клуб».</h3>
+        <small class="megatext">
+
+            <p align="center"><strong>Новый Бойцовский клуб</strong> - это игра, которая покорила сердца многих пользователей рунета в 2004 — 2009 годах. <strong>«combats.com»</strong> версии 2, отличался особым жанром игры на тот момент — MMORPG.
+                Одной из основных особенностей игры <strong>«Бойцовский Клуб»</strong>, помимо захватывающих боев, также являлась социальная составляющая.
+
+                В процессе игры каждый игрок имел возможность общаться с другими игроками в общем, клановом или приватном чате. Обмениваться опытом, делиться важной информацией или просто весело проводить время. При отсутствии социальных сетей в тот
+                момент — это было немаловажным фактором для выбора подходящих проектов <strong>«Браузерной Игры»</strong>.
+
+                В проекте <strong>Новый Бойцовский Клуб</strong> также сохранен стиль общения <strong>«Старого Бойцовского Клуба»</strong>, а так же добавлена уникальная в своем роде функция: <strong>Голосовые Сообщения</strong>.
+        </small><br>
+        <h4>Проект Старого Бойцовского клуба, который использует как основание игру «combats.com» , «old-combats.com», «likebk.com» и многие другие проекты по типу «Бойцовский Клуб»</h4><br></p>
+        <small style="color: #d7d7d7; width: 100%;" class="megatext copy"></small>
+        <div style="width:100%; text-align:center;">
+            <a href="https://freekassa.ru" target="_blank" rel="noopener noreferrer">
+                <img src="https://cdn.freekassa.ru/banners/big-white-1.png" title="Прием платежей на сайте">
+            </a>
+            <!-- Rating@Mail.ru logo -->
+            <script>
+                var topRPGc = "<img src='https://s02.rpgtop.su/cgi-bin-mod/iv.cgi?a=ins&id=26677&rnd=" + Math.random();
+                topRPGc += "&r=" + escape(document.referrer) + "' width='1' height='1' border='0'><a href='https://rpgtop.su/26677' title='Рейтинг Ролевых Ресурсов - RPG TOP' target='_blank'>" +
+                    "<img src='//img.rpgtop.su/88x31x11x2.gif' alt='Рейтинг Ролевых Ресурсов - RPG TOP' border='0' width='88' height='31'></a> ";
+            </script>
+            <!-- //Rating@Mail.ru logo -->
+        </div>
+        <!-- Top.Roleplay.Ru -->
+        <a href="https://rpgtop.su/26677" title="Рейтинг Ролевых Ресурсов - RPG TOP" target="_blank">
+            <img src="//img.rpgtop.su/88x31x11x7.gif" alt="Рейтинг Ролевых Ресурсов - RPG TOP" border="0" width="88" height="31"></a>
+        <!-- /Top.Roleplay.Ru -->
+        <!-- Yandex.Metrika counter -->
+        <script type="text/javascript">
+            (function (m, e, t, r, i, k, a) {
+                m[i] = m[i] || function () {
+                    (m[i].a = m[i].a || []).push(arguments)
+                };
+                m[i].l = 1 * new Date();
+                k = e.createElement(t), a = e.getElementsByTagName(t)[0], k.async = 1, k.src = r, a.parentNode.insertBefore(k, a)
+            })
+            (window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
+
+            ym(88861153, "init", {
+                clickmap: true,
+                trackLinks: true,
+                accurateTrackBounce: true
+            });
+        </script>
+        <noscript>
+            <div><img src="https://mc.yandex.ru/watch/88861153" style="position:absolute; left:-9999px;" alt=""/></div>
+        </noscript>
+        <!-- /Yandex.Metrika counter -->
+    </form>
+</div>
+<div align="center">
+    <a href="/encicl/law2.html" target="_blank">Пользовательское Соглашение</a> &nbsp;&nbsp;&nbsp;
+    <a href="/encicl/law3.html" target="_blank">Политика Конфиеденцальности</a>&nbsp;&nbsp;&nbsp;
+    <a href="/encicl/law4.html" target="_blank">Публичный договор оферты</a>&nbsp;&nbsp;&nbsp;
+    <a href="/support/index.php" target="_blank">Поддержка</a> &nbsp;&nbsp;&nbsp;
+    <a href="/contacts.html" target="_blank">Контакты</a> &nbsp;&nbsp;&nbsp;
+</div>
+<!-- capcha google counter -->
 <script>
-var topRPGc="<img src='https://s02.rpgtop.su/cgi-bin-mod/iv.cgi?a=ins&id=26677&rnd=" + Math.random();
-topRPGc += "&r="+escape(document.referrer)+"' width='1' height='1' border='0'><a href='https://rpgtop.su/26677' title='������� ������� �������� - RPG TOP' target='_blank'>"+
-"<img src='//img.rpgtop.su/88x31x11x2.gif' alt='������� ������� �������� - RPG TOP' border='0' width='88' height='31'></a> ";
-</script>
-        <!-- //Rating@Mail.ru logo -->
-    </div>
-<!-- Top.Roleplay.Ru -->
-<a href="https://rpgtop.su/26677" title="������� ������� �������� - RPG TOP" target="_blank">
-<img src="//img.rpgtop.su/88x31x11x7.gif" alt="������� ������� �������� - RPG TOP" border="0" width="88" height="31"></a>
-<!-- /Top.Roleplay.Ru -->
-<!-- Yandex.Metrika counter -->
-<script type="text/javascript" >
-   (function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
-   m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
-   (window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
+    jQuery(document).ready(function () {
+        // For all the inputs that are text inputs
+        jQuery('input').each(function () {
+            var $this = jQuery(this);
+            // get the label
+            var label = jQuery('label[for=' + this.id + ']');
+            // If no label, then return to avoid errors
+            if (label.size() == 0) {
+                return;
+            }
+            // create wrapper element
+            var wrapper = jQuery('<div class="compactlabel-wrapper"></div>');
+            $this.wrap(wrapper);
+            // move the label to before the the input
+            $this.before(label);
+            // create label backing
+            var backing = jQuery('<div class="compactlabel-label-backing"></div>')
+                .insertBefore($this)
+                .height(label.height())
+                .width(label.width());
+            // basic style information
+            var labelOffset = label.position(), inputOffset = $this.position(), labelHeight = label.outerHeight();
+            // flag for if on or off
+            var isHover = false, isFocus = false;
+            // a jQuery object of the backing and label to animate both together
+            var animatedElements = jQuery(backing.get()).add(label.get());
+            // common functionality for hover on and focus on
+            var on = function (event) {
+                $this.parent().addClass('compactlabel-wrapper-on');
+                animatedElements.stop().animate({"top": '-' + (labelHeight - inputOffset.top) + 'px'});
+            };
+            // common functionality for hover off and focus off
+            var off = function (event) {
+                if (isHover || isFocus) {
+                    return;
+                }
+                if (inputEmpty) {
+                    label.removeClass('compactlabel-hide');
+                } else {
+                    label.addClass('compactlabel-hide');
+                }
+                if (!inputEmptyChange) {
+                    animatedElements.stop();
+                }
+                animatedElements.animate(
+                    {"top": labelOffset.top + 'px'},
+                    function () {
+                        $this.parent().removeClass('compactlabel-wrapper-on')
+                    });
+            };
+            var onHover = function (event) {
+                isHover = true;
+                on(event);
+            };
+            var offHover = function (event) {
+                isHover = false;
+                off(event);
+            };
+            var onFocus = function (event) {
+                isFocus = true;
+                on(event);
+            };
+            var offFocus = function (event) {
+                isFocus = false;
+                off(event);
+            };
+            // The pieces for keeping track if the value of the input is empty
+            var inputEmpty = false, inputEmptyStart = false, inputEmptyChange = false;
+            var checkInputEmpty = function () {
+                inputEmpty = $this.val() == '';
+            };
+            checkInputEmpty();
+            // ID for setTimeout for checkInputEmpty
+            var checkInputEmptyFnID = null;
+            if (!inputEmpty) {
+                label.addClass('compactlabel-hide');
+            }
+            // add the events
+            // events to track if the value changed empty state
+            $this.focus(function () {
+                inputEmptyStart = inputEmpty;
+                inputEmptyChange = false;
+                checkInputEmptyFnID = setInterval(checkInputEmpty, 50);
+            });
+            $this.blur(function () {
+                clearInterval(checkInputEmptyFnID);
+                checkInputEmpty();
+                inputEmptyChange = inputEmptyStart != inputEmpty;
+            });
+            // animation events
+            $this.focus(onFocus);
+            $this.blur(offFocus);
+            $this.hover(onHover, offHover);
+            label.hover(onHover, offHover);
 
-   ym(88861153, "init", {
-        clickmap:true,
-        trackLinks:true,
-        accurateTrackBounce:true
-   });
+        });
+    });
 </script>
-<noscript><div><img src="https://mc.yandex.ru/watch/88861153" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
-<!-- /Yandex.Metrika counter -->
-		</form>
-	</div>
-	<div align="center">
-			<a href="/encicl/law2.html" target="_blank">���������������� ����������</a> &nbsp;&nbsp;&nbsp;
-			<a href="/encicl/law3.html" target="_blank">�������� ������������������</a>&nbsp;&nbsp;&nbsp;
-			<a href="/encicl/law4.html" target="_blank">��������� ������� ������</a>&nbsp;&nbsp;&nbsp;
-			<a href="/support/index.php" target="_blank">���������</a> &nbsp;&nbsp;&nbsp;
-			<a href="/contacts.html" target="_blank">��������</a> &nbsp;&nbsp;&nbsp;
-	</div>
-    <!-- capcha google counter -->
-		<script>
-	jQuery( document ).ready( function( ){
-		// For all the inputs that are text inputs
-		jQuery( 'input' ).each( function( ){
-			var $this = jQuery( this );
-			// get the label
-			var label = jQuery( 'label[for='+this.id+']' );
-			// If no label, then return to avoid errors
-			if( label.size( ) == 0 ){
-				return;
-			}
-			// create wrapper element
-			var wrapper = jQuery( '<div class="compactlabel-wrapper"></div>' );
-			$this.wrap( wrapper );
-			// move the label to before the the input
-			$this.before( label );
-			// create label backing
-			var backing = jQuery( '<div class="compactlabel-label-backing"></div>' )
-				.insertBefore( $this )
-				.height( label.height( ) )
-				.width( label.width( ) );
-			// basic style information
-			var labelOffset = label.position( ), inputOffset = $this.position( ), labelHeight = label.outerHeight( );
-			// flag for if on or off
-			var isHover = false, isFocus = false;
-			// a jQuery object of the backing and label to animate both together
-			var animatedElements = jQuery( backing.get( ) ).add( label.get( ) );
-			// common functionality for hover on and focus on
-			var on = function( event ){
-				$this.parent( ).addClass( 'compactlabel-wrapper-on' );
-				animatedElements.stop( ).animate( { "top": '-'+(labelHeight - inputOffset.top)+'px' } );
-			};
-			// common functionality for hover off and focus off
-			var off = function( event ){
-				if( isHover || isFocus ){
-					return;
-				}
-				if( inputEmpty ){
-					label.removeClass( 'compactlabel-hide' );
-				} else {
-					label.addClass( 'compactlabel-hide' );
-				}
-				if( !inputEmptyChange ){
-					animatedElements.stop( );
-				}
-				animatedElements.animate(
-					{ "top": labelOffset.top + 'px' },
-					function( ){
-						$this.parent( ).removeClass( 'compactlabel-wrapper-on' )
-					} );
-			};
-			var onHover = function( event ){
-				isHover = true;
-				on( event );
-			};
-			var offHover = function( event ){
-				isHover = false;
-				off( event );
-			};
-			var onFocus = function( event ){
-				isFocus = true;
-				on( event );
-			};
-			var offFocus = function( event ){
-				isFocus = false;
-				off( event );
-			};
-			// The pieces for keeping track if the value of the input is empty
-			var inputEmpty = false, inputEmptyStart = false, inputEmptyChange = false;
-			var checkInputEmpty = function( ){
-				inputEmpty = $this.val( ) == '';
-			};
-			checkInputEmpty( );
-			// ID for setTimeout for checkInputEmpty
-			var checkInputEmptyFnID = null;
-			if( !inputEmpty ){
-				label.addClass( 'compactlabel-hide' );
-			}
-			// add the events
-			// events to track if the value changed empty state
-			$this.focus( function( ){
-				inputEmptyStart = inputEmpty;
-				inputEmptyChange = false;
-				checkInputEmptyFnID = setInterval( checkInputEmpty, 50 );
-			} );
-			$this.blur( function( ){
-				clearInterval( checkInputEmptyFnID );
-				checkInputEmpty( );
-				inputEmptyChange = inputEmptyStart != inputEmpty;
-			} );
-			// animation events
-			$this.focus( onFocus );
-			$this.blur( offFocus );
-			$this.hover( onHover, offHover );
-			label.hover( onHover, offHover );
-
-		} );	
-	} );
-	</script>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.js"></script>
-    <!-- capcha google counter -->
-<!-- <script src='https://www.google.com/recaptcha/api.js'></script> -->
-  </body>
+
+</body>
 </html>
diff --git a/index2.php b/index2.php
deleted file mode 100644
index cada02b0..00000000
--- a/index2.php
+++ /dev/null
@@ -1 +0,0 @@
-����
\ No newline at end of file
diff --git a/inf.php b/inf.php
index 4ee7f69f..55118618 100644
--- a/inf.php
+++ b/inf.php
@@ -1,150 +1,195 @@
 <?php
-if(isset($_GET['md5'])) {
-	die(md5($_GET['md5']));	
+if (isset($_GET['md5'])) {
+    die(md5($_GET['md5']));
 }
 header('Content-Type: text/html; charset=cp1251');
 include_once('_incl_data/__config.php');
 $c['inf'] = true;
 const GAME = true;
 include_once('_incl_data/class/__db_connect.php');
-include_once('_incl_data/class/__user.php');
+$u = User::start();
 
 const LOWERCASE = 3;
 const UPPERCASE = 1;
 
-$uplogin = explode('&',$_SERVER['QUERY_STRING']);
+$uplogin = explode('&', $_SERVER['QUERY_STRING']);
 $uplogin = $uplogin[0];
-$uplogin = preg_replace('/%20/'," ",$uplogin);
+$uplogin = preg_replace('/%20/', " ", $uplogin);
 
-function utf8_win($s) {
-	$s=str_replace("%D0%B0","�",$s); $s=str_replace("%D0%90","�",$s);
-	$s=str_replace("%D0%B1","�",$s); $s=str_replace("%D0%91","�",$s);
-	$s=str_replace("%D0%B2","�",$s); $s=str_replace("%D0%92","�",$s);
-	$s=str_replace("%D0%B3","�",$s); $s=str_replace("%D0%93","�",$s);
-	$s=str_replace("%D0%B4","�",$s); $s=str_replace("%D0%94","�",$s);
-	$s=str_replace("%D0%B5","�",$s); $s=str_replace("%D0%95","�",$s);
-	$s=str_replace("%D1%91","�",$s); $s=str_replace("%D0%81","�",$s);
-	$s=str_replace("%D0%B6","�",$s); $s=str_replace("%D0%96","�",$s);
-	$s=str_replace("%D0%B7","�",$s); $s=str_replace("%D0%97","�",$s);
-	$s=str_replace("%D0%B8","�",$s); $s=str_replace("%D0%98","�",$s);
-	$s=str_replace("%D0%B9","�",$s); $s=str_replace("%D0%99","�",$s);
-	$s=str_replace("%D0%BA","�",$s); $s=str_replace("%D0%9A","�",$s);
-	$s=str_replace("%D0%BB","�",$s); $s=str_replace("%D0%9B","�",$s);
-	$s=str_replace("%D0%BC","�",$s); $s=str_replace("%D0%9C","�",$s);
-	$s=str_replace("%D0%BD","�",$s); $s=str_replace("%D0%9D","�",$s);
-	$s=str_replace("%D0%BE","�",$s); $s=str_replace("%D0%9E","�",$s);
-	$s=str_replace("%D0%BF","�",$s); $s=str_replace("%D0%9F","�",$s);
-	$s=str_replace("%D1%80","�",$s); $s=str_replace("%D0%A0","�",$s);
-	$s=str_replace("%D1%81","�",$s); $s=str_replace("%D0%A1","�",$s);
-	$s=str_replace("%D1%82","�",$s); $s=str_replace("%D0%A2","�",$s);
-	$s=str_replace("%D1%83","�",$s); $s=str_replace("%D0%A3","�",$s);
-	$s=str_replace("%D1%84","�",$s); $s=str_replace("%D0%A4","�",$s);
-	$s=str_replace("%D1%85","�",$s); $s=str_replace("%D0%A5","�",$s);
-	$s=str_replace("%D1%86","�",$s); $s=str_replace("%D0%A6","�",$s);
-	$s=str_replace("%D1%87","�",$s); $s=str_replace("%D0%A7","�",$s);
-	$s=str_replace("%D1%88","�",$s); $s=str_replace("%D0%A8","�",$s);
-	$s=str_replace("%D1%89","�",$s); $s=str_replace("%D0%A9","�",$s);
-	$s=str_replace("%D1%8A","�",$s); $s=str_replace("%D0%AA","�",$s);
-	$s=str_replace("%D1%8B","�",$s); $s=str_replace("%D0%AB","�",$s);
-	$s=str_replace("%D1%8C","�",$s); $s=str_replace("%D0%AC","�",$s);
-	$s=str_replace("%D1%8D","�",$s); $s=str_replace("%D0%AD","�",$s);
-	$s=str_replace("%D1%8E","�",$s); $s=str_replace("%D0%AE","�",$s);
-	$s=str_replace("%D1%8F","�",$s); $s=str_replace("%D0%AF","�",$s);
-	return $s;
+function utf8_win($s)
+{
+    $s = str_replace("%D0%B0", "�", $s);
+    $s = str_replace("%D0%90", "�", $s);
+    $s = str_replace("%D0%B1", "�", $s);
+    $s = str_replace("%D0%91", "�", $s);
+    $s = str_replace("%D0%B2", "�", $s);
+    $s = str_replace("%D0%92", "�", $s);
+    $s = str_replace("%D0%B3", "�", $s);
+    $s = str_replace("%D0%93", "�", $s);
+    $s = str_replace("%D0%B4", "�", $s);
+    $s = str_replace("%D0%94", "�", $s);
+    $s = str_replace("%D0%B5", "�", $s);
+    $s = str_replace("%D0%95", "�", $s);
+    $s = str_replace("%D1%91", "�", $s);
+    $s = str_replace("%D0%81", "�", $s);
+    $s = str_replace("%D0%B6", "�", $s);
+    $s = str_replace("%D0%96", "�", $s);
+    $s = str_replace("%D0%B7", "�", $s);
+    $s = str_replace("%D0%97", "�", $s);
+    $s = str_replace("%D0%B8", "�", $s);
+    $s = str_replace("%D0%98", "�", $s);
+    $s = str_replace("%D0%B9", "�", $s);
+    $s = str_replace("%D0%99", "�", $s);
+    $s = str_replace("%D0%BA", "�", $s);
+    $s = str_replace("%D0%9A", "�", $s);
+    $s = str_replace("%D0%BB", "�", $s);
+    $s = str_replace("%D0%9B", "�", $s);
+    $s = str_replace("%D0%BC", "�", $s);
+    $s = str_replace("%D0%9C", "�", $s);
+    $s = str_replace("%D0%BD", "�", $s);
+    $s = str_replace("%D0%9D", "�", $s);
+    $s = str_replace("%D0%BE", "�", $s);
+    $s = str_replace("%D0%9E", "�", $s);
+    $s = str_replace("%D0%BF", "�", $s);
+    $s = str_replace("%D0%9F", "�", $s);
+    $s = str_replace("%D1%80", "�", $s);
+    $s = str_replace("%D0%A0", "�", $s);
+    $s = str_replace("%D1%81", "�", $s);
+    $s = str_replace("%D0%A1", "�", $s);
+    $s = str_replace("%D1%82", "�", $s);
+    $s = str_replace("%D0%A2", "�", $s);
+    $s = str_replace("%D1%83", "�", $s);
+    $s = str_replace("%D0%A3", "�", $s);
+    $s = str_replace("%D1%84", "�", $s);
+    $s = str_replace("%D0%A4", "�", $s);
+    $s = str_replace("%D1%85", "�", $s);
+    $s = str_replace("%D0%A5", "�", $s);
+    $s = str_replace("%D1%86", "�", $s);
+    $s = str_replace("%D0%A6", "�", $s);
+    $s = str_replace("%D1%87", "�", $s);
+    $s = str_replace("%D0%A7", "�", $s);
+    $s = str_replace("%D1%88", "�", $s);
+    $s = str_replace("%D0%A8", "�", $s);
+    $s = str_replace("%D1%89", "�", $s);
+    $s = str_replace("%D0%A9", "�", $s);
+    $s = str_replace("%D1%8A", "�", $s);
+    $s = str_replace("%D0%AA", "�", $s);
+    $s = str_replace("%D1%8B", "�", $s);
+    $s = str_replace("%D0%AB", "�", $s);
+    $s = str_replace("%D1%8C", "�", $s);
+    $s = str_replace("%D0%AC", "�", $s);
+    $s = str_replace("%D1%8D", "�", $s);
+    $s = str_replace("%D0%AD", "�", $s);
+    $s = str_replace("%D1%8E", "�", $s);
+    $s = str_replace("%D0%AE", "�", $s);
+    $s = str_replace("%D1%8F", "�", $s);
+    $s = str_replace("%D0%AF", "�", $s);
+    return $s;
 }
 
 $uplogin = utf8_win($uplogin);
 
-if(!isset($_GET['id']))
-{
-	$_GET['id'] = 0;
+if (!isset($_GET['id'])) {
+    $_GET['id'] = 0;
 }
 
-if(!isset($_GET['login']))
-{
-	$_GET['login'] = NULL;
+if (!isset($_GET['login'])) {
+    $_GET['login'] = null;
 }
 
-if(!isset($upLogin)){ $upLogin = ''; }
+if (!isset($upLogin)) {
+    $upLogin = '';
+}
 
 $utf8Login = '';
 $utf8Login2 = '';
 
 
-$utf8Login  = iconv("UTF-8", "windows-1251",$uplogin);
+$utf8Login = iconv("UTF-8", "windows-1251", $uplogin);
 
-$utf8Login2 = iconv("UTF-8", "windows-1251",$_GET['login']);
+$utf8Login2 = iconv("UTF-8", "windows-1251", $_GET['login']);
 
-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 ($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($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 = '����� ������������� ������ �������<br>';
-			}else{
-				$uer = '������ ������...<br>';
-			}
-		}
-	}
-	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 = '��� ������ �������...<br>';
-			}else{
-				$uer = '������...<br>';
-			}
-		}
-	}
+    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 = '����� ������������� ������ �������<br>';
+            } else {
+                $uer = '������ ������...<br>';
+            }
+        }
+    }
+    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 = '��� ������ �������...<br>';
+            } else {
+                $uer = '������...<br>';
+            }
+        }
+    }
 }
 
-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('<html><head>
+
+if (!isset($inf['id'])) {
+    die('������. �������� �� ������.');
+    die(
+        '<html><head>
 	<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
 	<meta http-equiv="Content-Language" content="ru">
 	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
@@ -152,2112 +197,2537 @@ if(!isset($inf['id']))
 	��������� ������: <pre>��������� �������� �� ������...</pre>
 	<b><p><a href = "javascript:window.history.go(-1);">�����</b></a>
 	<HR>
-	<p align="right">&copy; <a href="https://new-combats.com/">'.$c['title'].'</a></p>
-	'.$c['counters'].'
-	</body></html>');
+	<p align="right">&copy; <a href="https://new-combats.com/">' . $c['title'] . '</a></p>
+	' . $c['counters'] . '
+	</body></html>'
+    );
 }
 
-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 '<b style="color:'.$cl[$si].'">'.$st[$s].'</b> <small>('.$st2[$s].' '.$s1.' '.abs($st[$s]-$st2[$s]).')</small>';
-	}else{
-		echo '<b>'.$st[$s].'</b>';
-	}
+    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 '<b style="color:' . $cl[$si] . '">' . $st[$s] . '</b> <small>(' . $st2[$s] . ' ' . $s1 . ' ' . abs(
+                $st[$s] - $st2[$s]
+            ) . ')</small>';
+    } else {
+        echo '<b>' . $st[$s] . '</b>';
+    }
 }
 
-$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 ($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'];
+        }
+    }
 }
 
 ?>
 <!DOCTYPE html>
 <html>
 <head>
-<meta charset="windows-1251"/>
-<title>���������� � <? echo $inf['login']; ?></title>
-<meta "description" name content="�������������� ���������� � ������� ���������� ���������� ���� ���������� ����.������� � ����� ������ ������� ���������� ���� combats.com ������ 2."/>
-<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes"/>
-<script type="text/javascript" src="/js/jquery.js"></script>
-<script type="text/javascript" src="/js/jquery.zclip.js"></script>
-<script type="text/javascript" src="/js/jquery.cookie.js"></script>
-<script type="text/javascript" src="/js/title.js"></script>
-<script type="text/javascript" src="/js/hpregen.js"></script>
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css"/>
-<style>
-body { background-color:#dedede; margin:5px;  }
-hr { height:1px; }
-img {border:0px;}
-button	{ border: solid 1pt #B0B0B0; font-family: MS Sans Serif; font-size: 11px; color: #191970; padding:2px 7px 2px 7px;}
-button:active { padding:3px 6px 1px 8px; }
-.ttl_css{	
-position:absolute;	
-	text-shadow: 0 0 2px #fff;
-	padding: 4px 8px;
-	border: 1px solid rgba(255,255,255,0.25);
-	background-color: #cfcfcf;	
-	border-radius: 3px;
-	-webkit-border-radius: 3px;
-	-moz-border-radius: 3px;
-	box-shadow: 0 0 3px #000000;
-	-webkit-box-shadow: 0 0 3px #000000;
-	-moz-box-shadow: 0 0 3px #000000;
+    <meta charset="windows-1251"/>
+    <title>���������� � <?php echo $inf['login']; ?></title>
+    <meta
+    "description" name content="�������������� ���������� � ������� ���������� ���������� ���� ���������� ����.������� �
+    ����� ������ ������� ���������� ���� combats.com ������ 2."/>
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes"/>
+    <script type="text/javascript" src="/js/jquery.js"></script>
+    <script type="text/javascript" src="/js/jquery.zclip.js"></script>
+    <script type="text/javascript" src="/js/jquery.cookie.js"></script>
+    <script type="text/javascript" src="/js/title.js"></script>
+    <script type="text/javascript" src="/js/hpregen.js"></script>
+    <link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css"/>
+    <style>
+        body {
+            background-color: #dedede;
+            margin: 5px;
+        }
 
-}
-.findlg {
-	filter: alpha(opacity=37);
-    opacity:0.37;
-    -moz-opacity:0.37;
-    -khtml-opacity:0.37;
-	margin-bottom:10px;
-}
-.findlg:hover {
-	filter: alpha(opacity=100);
-    opacity:1.00;
-    -moz-opacity:1.00;
-    -khtml-opacity:1.00;
-}
-.gifin {
-	position:absolute;
-	left: 112px;
-	top: 428px;
-	padding:5px;
-	background-color:#fcfef3;
-	border:1px solid #6e6960;
-	font-size:12px;
-	max-width:300px;
-	min-height:100px;
-	min-width:150px;
-}
-.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;
-}
+        hr {
+            height: 1px;
+        }
 
-.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);
+        img {
+            border: 0px;
+        }
 
-    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);
+        button {
+            border: solid 1pt #B0B0B0;
+            font-family: MS Sans Serif;
+            font-size: 11px;
+            color: #191970;
+            padding: 2px 7px 2px 7px;
+        }
 
-    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);
+        button:active {
+            padding: 3px 6px 1px 8px;
+        }
 
-    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);
+        .ttl_css {
+            position: absolute;
+            text-shadow: 0 0 2px #fff;
+            padding: 4px 8px;
+            border: 1px solid rgba(255, 255, 255, 0.25);
+            background-color: #cfcfcf;
+            border-radius: 3px;
+            -webkit-border-radius: 3px;
+            -moz-border-radius: 3px;
+            box-shadow: 0 0 3px #000000;
+            -webkit-box-shadow: 0 0 3px #000000;
+            -moz-box-shadow: 0 0 3px #000000;
 
-    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);
+        .findlg {
+            filter: alpha(opacity=37);
+            opacity: 0.37;
+            -moz-opacity: 0.37;
+            -khtml-opacity: 0.37;
+            margin-bottom: 10px;
+        }
 
-    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;
-}
-</style>
-<script type="text/javascript" language="javascript">
-var lafstReg = {};
-function lookGift(e,id,nm,img,txt,from) {
-  if(from == 1) {
-	 from = '<i>���������</i>'; 
-  }
-  if(!e) { e = window.event; }
-  var body2 = document.body;
-  mX = e.x;
-  mY = e.y+(body2 && body2.scrollTop || 0); 	
-  var gf = document.getElementById('gi');
-  if(gf != undefined) {
-		gf.style.top = mY+'px';
-		gf.style.left = mX+'px';
-		if( from == '<i>�������</i>' ) {
-			from = '</a><i>�������</i><a>';
-		}
-		gf.innerHTML = `<b><span style="float:left;">${nm}</span> <span style="float:right;">&nbsp; <a href="javascript:void(0);" onClick="closeGift();">X</a></span></b><br><div align="center" style="padding:5px;background-color:#dcdedc;"><img src="https://img.new-combats.com/i/items/${img}"></div>${txt}<div>������� �� <a target="_blank" href="/info/${from}">${from}</a></div>`;
-		gf.innerHTML = `<small>${gf.innerHTML}</small>`;
-		gf.style.display = '';
-	}
-}
+        .findlg:hover {
+            filter: alpha(opacity=100);
+            opacity: 1.00;
+            -moz-opacity: 1.00;
+            -khtml-opacity: 1.00;
+        }
 
-function closeGift() {
-  var gf = document.getElementById('gi');
-  if(gf!=undefined) {
-	gf.innerHTML = '';
-	gf.style.display = 'none';
-  }
-}
-function tstlgnthm() {
-	if( window.opener && ( window.opener.textmsg != undefined || window.opener.parent.textmsg != undefined ) ) {
-		if( window.opener.textmsg != undefined ) {
-			$('#lgnthm').html( '<img onclick="window.opener.chat.addto(\'<?=$inf['login']?>\',\'private\');" style="cursor:pointer" title="�������� ���������" src="https://img.new-combats.com/i/lock3.gif" width="20" height="15">' + $('#lgnthm').html() );
-			return
-		}
-		$('#lgnthm').html( '<img onclick="window.opener.parent.chat.addto(\'<?=$inf['login']?>\',\'private\');" style="cursor:pointer" title="�������� ���������" src="https://img.new-combats.com/i/lock3.gif" width="20" height="15">' + $('#lgnthm').html() );
-		return
-	}
+        .gifin {
+            position: absolute;
+            left: 112px;
+            top: 428px;
+            padding: 5px;
+            background-color: #fcfef3;
+            border: 1px solid #6e6960;
+            font-size: 12px;
+            max-width: 300px;
+            min-height: 100px;
+            min-width: 150px;
+        }
 
-}
-</script>
+        .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;
+        }
+    </style>
+    <script type="text/javascript" language="javascript">
+        var lafstReg = {};
+
+        function lookGift(e, id, nm, img, txt, from) {
+            if (from == 1) {
+                from = '<i>���������</i>';
+            }
+            if (!e) {
+                e = window.event;
+            }
+            var body2 = document.body;
+            mX = e.x;
+            mY = e.y + (body2 && body2.scrollTop || 0);
+            var gf = document.getElementById('gi');
+            if (gf != undefined) {
+                gf.style.top = mY + 'px';
+                gf.style.left = mX + 'px';
+                if (from == '<i>�������</i>') {
+                    from = '</a><i>�������</i><a>';
+                }
+                gf.innerHTML = `<b><span style="float:left;">${nm}</span> <span style="float:right;">&nbsp; <a href="javascript:void(0);" onClick="closeGift();">X</a></span></b><br><div align="center" style="padding:5px;background-color:#dcdedc;"><img src="https://img.new-combats.com/i/items/${img}"></div>${txt}<div>������� �� <a target="_blank" href="/info/${from}">${from}</a></div>`;
+                gf.innerHTML = `<small>${gf.innerHTML}</small>`;
+                gf.style.display = '';
+            }
+        }
+
+        function closeGift() {
+            var gf = document.getElementById('gi');
+            if (gf != undefined) {
+                gf.innerHTML = '';
+                gf.style.display = 'none';
+            }
+        }
+
+        function tstlgnthm() {
+            if (window.opener && (window.opener.textmsg != undefined || window.opener.parent.textmsg != undefined)) {
+                if (window.opener.textmsg != undefined) {
+                    $('#lgnthm').html('<img onclick="window.opener.chat.addto(\'<?=$inf['login']?>\',\'private\');" style="cursor:pointer" title="�������� ���������" src="https://img.new-combats.com/i/lock3.gif" width="20" height="15">' + $('#lgnthm').html());
+                    return
+                }
+                $('#lgnthm').html('<img onclick="window.opener.parent.chat.addto(\'<?=$inf['login']?>\',\'private\');" style="cursor:pointer" title="�������� ���������" src="https://img.new-combats.com/i/lock3.gif" width="20" height="15">' + $('#lgnthm').html());
+                return
+            }
+
+        }
+    </script>
 </head>
 <body style="padding-top:0px; margin-top:7px; height:100%; background-color:#E2E0E1;">
-<div id="ttl" class="ttl_css" style="display:none;z-index:1111;" /></div>
+<div id="ttl" class="ttl_css" style="display:none;z-index:1111;"/>
+</div>
 <div id="gi" class="gifin" style="display:none;z-index:1110;"></div>
-<?
-if(isset($uer)){ echo '<div align="left"><font color=\'red\'>'.$uer.'</font></div><br>'; } ?>
+<?php
+if (isset($uer)) {
+    echo '<div align="left"><font color=\'red\'>' . $uer . '</font></div><br>';
+} ?>
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
-  <tr>
-    <td>
-    <table width="100%" border="0" cellspacing="0" cellpadding="0">
-      <tr>
-        <td width="255" valign="top">
-        <div align="center" style="margin-left:11px;"><?
-		$st = array(); $st2 = array(); $st = $u->getStats($inf['id'],1,0,true); $st2 = $st[1]; $st = $st[0]; 
-		
-		$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] = '<div align="center" style="width:255px;height300px;"><br><br><br><br><br><br><br><br>���������� ������,<br>�� � ������ ��������.<br><br><br><br><br><br><br></div>'; } if($us!=false){ echo $us[0]; }else{ echo 'information is lost.'; } ?></div>
-        <!-- pos2 -->
-        <div align="left"></div><div align="left"></div><script>tstlgnthm();lafstReg[<? echo $inf['id']; ?>] = 1;
-		<?
-		if ($inf['align']==9){
-			$st['hpNow'] = $st['hpNow']/($st['hpAll']/100); 
-			$st['hpAll'] = '100%';
-			$rgd[0] = '0.28';
-		}
-		?>
-		startHpRegen(<? echo '"top",'.$inf['id'].','.(0+$st['hpNow']).','.(0+$st['hpAll']).','.(0+$st['mpNow']).','.(0+$st['mpAll']).','.(time()-$inf['regHP']).','.(time()-$inf['regMP']).','.(0+$rgd[0]).','.(0+$rgd[1]).''; ?>,1);</script>
-<?
-$kp = array(
-	0 => 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
-);
+    <tr>
+        <td>
+            <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                <tr>
+                    <td width="255" valign="top">
+                        <div align="center" style="margin-left:11px;"><?php
+                            $st = [];
+                            $st2 = [];
+                            $st = $u->getStats($inf['id'], 1, 0, true);
+                            $st2 = $st[1];
+                            $st = $st[0];
 
-?>
-<!-- pos1 -->
-<?
-		//�������� ������
-		if( $inf['admin'] > 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 '<center><small><br>�������� ������ � <a target="_blank" href="/logs.php?log='.$btl3['id'].'">��������</a></small></center>';
-				}
-			}
-		}elseif( $inf['room'] != 303 ) {
-			echo '<center style="padding-top:3px;"><!-- <b>'.$u->city_name[$inf['city']].'</b><br> --><small>';
-			 
-			
-			if($inf['online']>time()-520 && $inf['banned']==0 && $inf['invis']!=1 && $inf['invis'] < time())
-			{
-				echo '�������� ������ ��������� � �����.<br><b>"'.$room['name'].'"</b>';
-			}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 ', �� ��� ���:<br>'.date('d.m.Y H:i',$inf['online']).'<img title="����� �������" src="https://img.new-combats.com/i/clok3_2.png">';
-						$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 '<br>('.$out.' �����)';
-					}
-				}elseif($inf['admin']>0)
-				{
-					echo '�������� �� � �����.';
-				}
-			}
-			if($inf['inUser']>0 AND $inf['id']!=12059 )
-			{
-				echo '<br>�������� �������� � <a target="_blank" href="/info/'.$inf['inUser'].'">����</a>';
-			}
-			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 '<br>�������� ������ � <a target="_blank" href="/logs.php?log='.$btl3['id'].'">��������</a>';
-				}
-			}
-			echo '</small></center>';
-		}else{
-			if( $inf['res_x']-time() > 0 ) {
-				echo '<center style="padding-top:3px;">�������� ����� <b>'.($u->timeOut(($inf['res_x']-time()))).'</b><br><small></center>';
-			}else{
-				echo '<center style="padding-top:3px;">�������� � ��������� �����...<br><small></center>';
-			}
-		}
-		//������ �����
-		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('<script>top.location.href="/info/'.$inf['id'].'"</script>');
-			}
-			
-			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 .= '<img onDblClick="location.href=\'/info/'.$pl['uid'].'&cancel_eff='.$pl['id'].'\'" style="padding:1px;" title="'.$pl['name'].'" src="https://img.new-combats.com/i/eff/'.$pl['img2'].'" width="40" height="25">';
-				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 '<br><small style="display:block;text-align:center;">������� �� ���������:<br>'.$eff_adm.'</small>';
-			}
-		}
-		if($u->info['admin'] > 0) {
-		?>
-        <br>
-        <script>
-		function mf_admin_statsfx() {
-			if($('#mf_admin_stats').css('display') == 'none') {
-				$('#mf_admin_stats').css('display','');
-				$('#mf_admin_statstxt').html('������');
-				return
-			}
-			$('#mf_admin_stats').css('display','none');
-			$('#mf_admin_statstxt').html('��������');
-			return
-		}
-		</script>
-<div id="mf_admin_stats" style="display:none;">
-	<div style="height:1px; width:240px; background-color:#999999; margin:3px;" align="center"></div>
-	<div style="padding:5px;">
-    <small>
-    	<?
-		$pr = $u->items['add']; 
-		$i = 0;
-		$apbr = array(
-			'������ �� �����'=>1,
-			'����'=>1,
-			'���������� �������� �������'=>1,
-			'���������� �������� ������ ����'=>1,
-			'������� ����� (HP)'=>1,
-			'��. ������������ ����� (%)'=>1,
-			'��. �������� ����� ����'=>1,
-			'����������� �������� (%)'=>1,
-			'��. �������� �����'=>1
-		);
-		while($i < count($pr)) {
-			if($st[$pr[$i]] != 0 && $u->is[$pr[$i]] != '') {
-				$vls = $st[$pr[$i]];
-				if($vls > 0) {
-					$vls = '+'.$vls;
-				}
-				if($apbr[$u->is[$pr[$i]]] == 1) {
-					echo '<div style="height:1px; width:230px; background-color:#999999; margin:3px;" align="center"></div>';
-				}
-				echo '&bull; '.$u->is[$pr[$i]].': '.$vls.' <br>';
-			}
-			$i++;
-		}
-		?>
-    </small>
-    </div>
-</div>
-<div style="height:1px; width:240px; background-color:#999999; margin:3px;" align="center">
-<div onClick="mf_admin_statsfx();" style="border:1px solid #999999; cursor:pointer; background-color:#EAEAEA; width:150px;" align="center"><small><span id="mf_admin_statstxt">��������</span> ������������</small></div>
-</div>
-		<?  
-        }
-        ?>
-        </td>
-        <td valign="top"><table style="margin-top:18px;" cellspacing="0" cellpadding="0" width="100%">
-          <TD valign=top><?
-          if( $u->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 .= '<div>'.$u->microLogin($pl['id'],1);
-					 if( $nodell['inUser'] != $pl['id'] && $pl['id'] != $nodell['id'] ) {
-						 $nolog .= ' (��������� ����� <a href="?'.$inf['id'].'&del_copy='.$pl['id'].'">�������</a>)';
-					 }
-					 if( $pl['id'] == $nodell['id'] ) {
-						 $nolog .= ' (�������� ��������)';
-					 }
-					 $nolog .= '</div>'; 
-				 }
-			  }			  
-			  if( $nolog != '' ) {
-				  $nolog = '<small><b>����� ���������:</b>'.$nolog.'</small>';
-				  echo $nolog;
-			  }
-			    
-		  }
-		  ?><div style="padding:5px;">����: <? echo statInfo('s1'); ?><BR>
-                              <SPAN title=''>��������: <? statInfo('s2'); ?></SPAN><BR>
-                              <SPAN title=''>��������: <? statInfo('s3'); ?></SPAN><BR>
-                              <SPAN title=''>������������: <? statInfo('s4'); ?></SPAN><BR>
-                              <? if($inf['level']>3 || $st['s5']!=0){ ?><SPAN title=''>���������: <? statInfo('s5'); ?></SPAN><BR><? } ?>
-                              <? if($inf['level']>6 || $st['s6']!=0){ ?><SPAN title=''>��������: <? statInfo('s6'); ?></SPAN><BR><? } ?>
-                              <? if($inf['level']>9 || $st['s7']!=0){ ?><SPAN title=''>����������: <? statInfo('s7'); ?></SPAN><BR><? } ?>
-                              <? if($inf['level']>11 || $st['s8']!=0){ ?><SPAN title=''>����: <? statInfo('s8'); ?></SPAN><BR><? } ?>
-                              <? if($inf['level']>14 || $st['s9']!=0){ ?><SPAN title=''>������� ����: <? statInfo('s9'); ?></SPAN><BR><? } ?>
-                              <? if($inf['level']>19 || $st['s10']!=0){ ?><SPAN title=''>��������������: <? statInfo('s10'); ?></SPAN><BR><? } ?>
-                              <? if($st['s11'] > 0 ) { ?>
-                              <SPAN title=''>�������: <? statInfo('s11'); ?></SPAN><BR>
-                              <? } ?>
-							  <SPAN title=''>������� �������: <b><? echo $inf['repexp']; ?></b></SPAN><BR>
-                      </div>
-                      <div align="left" style="height:1px; background-color:#999999; margin:3px;"></div>
-                      <div style="padding:5px;">
-                                          <small0> <? if( $inf['pass'] == 'saintlucia' && $u->info['admin'] > 0 ) { echo '<b>�������:</b>';  }else{ echo '�������:'; } ?> <? echo $inf['level']; ?><BR>
-                                <? if( $inf['no_ip'] != 'trupojor' && $inf['admin'] == 0 ) { ?>
-                                �����: <? if($inf['level']<0){ echo number_format($inf['win'], 0, ",", " "); }else{ echo '<a title="�������� ���������� � ��������" href="https://new-combats.com/rating_pers/id'.$inf['id'].'#'.$inf['id'].'" target="_blank">'.number_format($inf['win'], 0, ",", " ").'</a>'; } ?><BR>
-                                ���������: <? echo number_format($inf['lose'], 0, ",", " "); ?><BR>
-                                ������: <? echo number_format($inf['nich'], 0, ",", " "); ?><BR> 
-                                <? }
-								$inf['mod_zvanie']  = htmlspecialchars($inf['mod_zvanie'],NULL,'cp1251');
-								?>
-                                        
-                                <? if($inf['align']==50){ echo '<b>����� ���������</b>'; if($inf['mod_zvanie']!=''){ echo ' - '.$inf['mod_zvanie']; } echo '<br>'; } ?>
-                                <? if($inf['align']==10.2){ echo '<b>����� ���������� ��������</b>'; if($inf['mod_zvanie']!=''){ echo ' - '.$inf['mod_zvanie']; } echo '<br>'; } ?>
-                                <?
-								
+                            $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] = '<div align="center" style="width:255px;height300px;"><br><br><br><br><br><br><br><br>���������� ������,<br>�� � ������ ��������.<br><br><br><br><br><br><br></div>';
+                            }
+                            if ($us != false) {
+                                echo $us[0];
+                            } else {
+                                echo 'information is lost.';
+                            } ?></div>
+                        <!-- pos2 -->
+                        <div align="left"></div>
+                        <div align="left"></div>
+                        <script>tstlgnthm();
+                            lafstReg[<?php echo $inf['id']; ?>] = 1;
+                            <?php
+                            if ($inf['align'] == 9) {
+                                $st['hpNow'] = $st['hpNow'] / ($st['hpAll'] / 100);
+                                $st['hpAll'] = '100%';
+                                $rgd[0] = '0.28';
+                            }
+                            ?>
+                            startHpRegen(<?php echo '"top",' . $inf['id'] . ',' . (0 + $st['hpNow']) . ',' . (0 + $st['hpAll']) . ',' . (0 + $st['mpNow']) . ',' . (0 + $st['mpAll']) . ',' . (time(
+                                    ) - $inf['regHP']) . ',' . (time(
+                                    ) - $inf['regMP']) . ',' . (0 + $rgd[0]) . ',' . (0 + $rgd[1]) . ''; ?>, 1);</script>
+                        <?php
+                        $kp = [
+                            0 => 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'] = '- <font color="#008080"><b>����� �����</b></font>';
-                                        }elseif($inf['mod_zvanie']!='')
-                                        {
-                                            $inf['mod_zvanie'] = '- '.htmlspecialchars($inf['mod_zvanie'],NULL,'cp1251');	
-											$inf['mod_zvanie'] = str_replace('&lt;b&gt;','<b>',$inf['mod_zvanie']);
-											$inf['mod_zvanie'] = str_replace('&lt;/b&gt;','</b>',$inf['mod_zvanie']);
-											$inf['mod_zvanie'] = str_replace('&lt;u&gt;','<u>',$inf['mod_zvanie']);
-											$inf['mod_zvanie'] = str_replace('&lt;/u&gt;','</u>',$inf['mod_zvanie']);
-											$inf['mod_zvanie'] = str_replace('&lt;i&gt;','<i>',$inf['mod_zvanie']);
-											$inf['mod_zvanie'] = str_replace('&lt;/i&gt;','</i>',$inf['mod_zvanie']);
+                        ?>
+                        <!-- pos1 -->
+                        <?php
+                        //�������� ������
+                        if ($inf['admin'] > 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 '<center><small><br>�������� ������ � <a target="_blank" href="/logs.php?log=' . $btl3['id'] . '">��������</a></small></center>';
+                                }
+                            }
+                        } elseif ($inf['room'] != 303) {
+                            echo '<center style="padding-top:3px;"><!-- <b>' . $u->city_name[$inf['city']] . '</b><br> --><small>';
+
+
+                            if ($inf['online'] > time(
+                                ) - 520 && $inf['banned'] == 0 && $inf['invis'] != 1 && $inf['invis'] < time()) {
+                                echo '�������� ������ ��������� � �����.<br><b>"' . $room['name'] . '"</b>';
+                            } 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 ', �� ��� ���:<br>' . date(
+                                                'd.m.Y H:i', $inf['online']
+                                            ) . '<img title="����� �������" src="https://img.new-combats.com/i/clok3_2.png">';
+                                        $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 '����: <a href="/clan/'.$pc['id'].'" target="_blank">'.$pc['name'].'</a> '.$inf['mod_zvanie'].'<br>';
+                                        $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 '<br>(' . $out . ' �����)';
                                     }
+                                } elseif ($inf['admin'] > 0) {
+                                    echo '�������� �� � �����.';
                                 }
-								
-								if( $inf['admin'] == 0 && ( ($inf['align'] > 1 && $inf['align'] < 2) || ($inf['align'] > 3 && $inf['align'] < 4) ) ) {
-									echo '<b><font color="green">����� �����������</font></b><br>';
-								}
-								?>
-                                <? if( $inf['admin'] == 0 ) { ?>
-                                <? if($inf['city2']!='') { echo '������ �����������: <b>'.$u->city_name[$inf['city2']].'</b><br />'; } ?>
-                                ���� �������� ���������: <? if($inf['timereg']==0 || $inf['timereg'] < 1430772917){ echo '�� ������ ������...'; }else{ echo date('d.m.Y H:i',$inf['timereg']); } ?> <br>
-                                <? if( $inf['palpro'] > time() ) { ?>
-                                �������� ���� ����� �������: �� <?=date('d.m.Y H:i',$inf['palpro'])?><br>
-                                <? }
-								}else{
-									echo '<b><font color="green">�������������</font></b><br>';
-								}
-								if($inf['redirect'] != '0' && ($u->info['admin'] > 0 || $u->info['id'] == $inf['id'])) {
-									echo '��������: <small><a target="_blank" href="'.str_replace('"','&quot;',$inf['redirect']).'">'.htmlspecialchars($inf['redirect']).'</a></small><br>';	
-								}
-								if( $u->info['admin'] > 0 ) {
-									echo '<hr><small>���� ���������: '.(0+$st['prckr']).' ��.</small><br>';
-									echo '<small>���� ���������: '.(0+$st['preckr']).' e��.</small><br>';
-									echo '<small>������� ����������: '.(0+$st['pbe']).'</small><br>';
-								}
-								?>
-                                <?
-								$twk = '';
-								$sp = mysql_query('SELECT * FROM `users_twink` WHERE `uid` = "'.$inf['id'].'"');
-								while( $pl = mysql_fetch_array($sp) ) {
-									if( $pl['twink'] != 0 ) {
-										if( $twk != '' ) { $twk .= ', '; }
-										if( $inf['twink'] == $pl['twink'] ) {
-											$twk .= '<b style="color:#ff9900;">'.$pl['login'].' ['.$pl['level'].']</b>';
-										}else{
-											$twk .= ''.$pl['login'].' ['.$pl['level'].']';
-										}
-									}
-								}								
-								if( $twk != '' ) {
-									echo '������ ������: '.$twk.'<br>';
-								}
-								?>
-								<?
-								//������� ����
-                                $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 .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ';
+                            }
+                            if ($inf['inUser'] > 0 and $inf['id'] != 12059) {
+                                echo '<br>�������� �������� � <a target="_blank" href="/info/' . $inf['inUser'] . '">����</a>';
+                            }
+                            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 '<br>�������� ������ � <a target="_blank" href="/logs.php?log=' . $btl3['id'] . '">��������</a>';
+                                }
+                            }
+                            echo '</small></center>';
+                        } else {
+                            if ($inf['res_x'] - time() > 0) {
+                                echo '<center style="padding-top:3px;">�������� ����� <b>' . ($u->timeOut(
+                                        ($inf['res_x'] - time())
+                                    )) . '</b><br><small></center>';
+                            } else {
+                                echo '<center style="padding-top:3px;">�������� � ��������� �����...<br><small></center>';
+                            }
+                        }
+                        //������ �����
+                        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('<script>top.location.href="/info/' . $inf['id'] . '"</script>');
+                            }
+
+                            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 .= '<img onDblClick="location.href=\'/info/' . $pl['uid'] . '&cancel_eff=' . $pl['id'] . '\'" style="padding:1px;" title="' . $pl['name'] . '" src="https://img.new-combats.com/i/eff/' . $pl['img2'] . '" width="40" height="25">';
+                                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 '<br><small style="display:block;text-align:center;">������� �� ���������:<br>' . $eff_adm . '</small>';
+                            }
+                        }
+                        if ($u->info['admin'] > 0) {
+                            ?>
+                            <br>
+                            <script>
+                                function mf_admin_statsfx() {
+                                    if ($('#mf_admin_stats').css('display') == 'none') {
+                                        $('#mf_admin_stats').css('display', '');
+                                        $('#mf_admin_statstxt').html('������');
+                                        return
                                     }
-                                    $names .= '\''.$pl['login'].'\' �� '.date('d.m.Y H:i',$pl['time']).'<br>';
-                                    $i++;
+                                    $('#mf_admin_stats').css('display', 'none');
+                                    $('#mf_admin_statstxt').html('��������');
+                                    return
                                 }
-                                if($names!='')
-                                {
-                                    echo '������� ����: '.$names.'';
+                            </script>
+                            <div id="mf_admin_stats" style="display:none;">
+                                <div style="height:1px; width:240px; background-color:#999999; margin:3px;"
+                                     align="center"></div>
+                                <div style="padding:5px;">
+                                    <small>
+                                        <?php
+                                        $pr = $u->items['add'];
+                                        $i = 0;
+                                        $apbr = [
+                                            '������ �� �����' => 1,
+                                            '����' => 1,
+                                            '���������� �������� �������' => 1,
+                                            '���������� �������� ������ ����' => 1,
+                                            '������� ����� (HP)' => 1,
+                                            '��. ������������ ����� (%)' => 1,
+                                            '��. �������� ����� ����' => 1,
+                                            '����������� �������� (%)' => 1,
+                                            '��. �������� �����' => 1,
+                                        ];
+                                        while ($i < count($pr)) {
+                                            if ($st[$pr[$i]] != 0 && $u->is[$pr[$i]] != '') {
+                                                $vls = $st[$pr[$i]];
+                                                if ($vls > 0) {
+                                                    $vls = '+' . $vls;
+                                                }
+                                                if ($apbr[$u->is[$pr[$i]]] == 1) {
+                                                    echo '<div style="height:1px; width:230px; background-color:#999999; margin:3px;" align="center"></div>';
+                                                }
+                                                echo '&bull; ' . $u->is[$pr[$i]] . ': ' . $vls . ' <br>';
+                                            }
+                                            $i++;
+                                        }
+                                        ?>
+                                    </small>
+                                </div>
+                            </div>
+                            <div style="height:1px; width:240px; background-color:#999999; margin:3px;" align="center">
+                                <div onClick="mf_admin_statsfx();"
+                                     style="border:1px solid #999999; cursor:pointer; background-color:#EAEAEA; width:150px;"
+                                     align="center"><small><span id="mf_admin_statstxt">��������</span>
+                                        ������������</small></div>
+                            </div>
+                            <?php
+                        }
+                        ?>
+                    </td>
+                    <td valign="top">
+                        <table style="margin-top:18px;" cellspacing="0" cellpadding="0" width="100%">
+                            <TD valign=top><?php
+                                if ($u->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 .= '<div>' . $u->microLogin($pl['id'], 1);
+                                            if ($nodell['inUser'] != $pl['id'] && $pl['id'] != $nodell['id']) {
+                                                $nolog .= ' (��������� ����� <a href="?' . $inf['id'] . '&del_copy=' . $pl['id'] . '">�������</a>)';
+                                            }
+                                            if ($pl['id'] == $nodell['id']) {
+                                                $nolog .= ' (�������� ��������)';
+                                            }
+                                            $nolog .= '</div>';
+                                        }
+                                    }
+                                    if ($nolog != '') {
+                                        $nolog = '<small><b>����� ���������:</b>' . $nolog . '</small>';
+                                        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 '<div>��������� �������: ����';
-										if( $algnt['delete'] > 0 ) {
-											echo ' (�� '.date('d.m.Y H:i',$algnt['delete']).')';
-										}
-										echo '</div>';
-									}elseif($algnt['align'] == 3) {
-										echo '<div>��������� �������: ����';
-										if( $algnt['delete'] > 0 ) {
-											echo ' (�� '.date('d.m.Y H:i',$algnt['delete']).')';
-										}
-										echo '</div>';
-									}elseif($algnt['align'] == 7) {
-										echo '<div>��������� �������: �������';
-										if( $algnt['delete'] > 0 ) {
-											echo ' (�� '.date('d.m.Y H:i',$algnt['delete']).')';
-										}
-										echo '</div>';
-									}
-								}
-								if( $st['silver'] > 0 ) {
-									echo '<div>';
-									echo '�������������� �������: <a href="https://new-combats.com/benediction/" target="_blank"><img title="�������������� ������� '.$st['silver'].' ������" src="https://img.new-combats.com/blago/'.$st['silver'].'.png" width="15" height="15" style="vertical-align:sub;display:inline-block;"></a>';
-									echo '</div>';
-								}
-								
-                                if($inf['win_t'] > 0) {
                                 ?>
-                                <div align="left" style="height:1px; width:300px; background-color:#999999; margin:3px;"></div>
-                                ����� � ��������: <?= number_format(round($inf['win_t']), 0, ",", " ") ?><BR>
-                                ��������� � ��������: <?= number_format(round($inf['lose_t']), 0, ",", " ") ?><BR>
-                                <? }?>
-            </div>  
-                             <?
-							  if( $u->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 .= '<br><div style="display:inline-block;padding:5px;border-bottom:1px solid #AEAEAE;">';
-										}else{
-											$bnk .= '<br><div style="display:inline-block;padding:5px;border-bottom:1px solid #AEAEAE">';
-										}
-										$bnk .= '&nbsp; &bull; <span style="display:inline-block;width:75px;"><small>�</small> '.$pl['id'].'</span>';
-										$bnk .= '</div>';
-									}
-									if($bnk != '') {
-										echo '<br><b>���������� �����:</b> &nbsp;'.$bnk.'<br>';
-									}
-									echo '</div>';
-							  }
-							  ?>
-                      <div align="left" style="height:1px; background-color:#999999; margin:3px; margin-bottom:7px;"></div>
-            <!-- ������ --></td>
-          </tr>
-        </table>
-              <?
-			     if($inf['align2']==50)
-				 {
-					  $abnk = mysql_fetch_array(mysql_query('SELECT * FROM `bank_alh` WHERE `uid` = "'.$inf['id'].'" LIMIT 1'));
-					  ?>
-					  <img src="https://img.new-combats.com/alchemy1.gif" onMouseOver="top.hi(this,'<center><b>����������� �����.</b><Br>����� ����� ��������� ������� ������ ���</b></center>',event,0,0,1,0,'');" onMouseOut="top.hic();" onMouseDown="top.hic();">
-					  <?
-				 }
-				
-				 $ico = [];
-				
-				 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] .= '<a href="/info/'.$marry['id'].'"><img src="https://img.new-combats.com/i/i_marry.gif" onMouseOver="top.hi(this,\''.$mrtxt.' <b>'.$marry['login'].'</b>\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					}
-				 }
-				 				 
-				 $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 = ' <img '.$stlico.' src="https://img.new-combats.com/'.$pl['img'].'" onMouseOver="top.hi(this,\''.$pl['text'].'\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();">';
-					 
-					 if( $pl['href'] != '#' && $pl['href'] != '' ) {
-					 	$ico[$pl['type']] .= '<a target="_blank" href="'.$pl['href'].'">'.$icon.'</a>';
-					 }else{
-						 $ico[$pl['type']] .= $icon;
-					 }
-				 }
-				 unset($icon);
-				 
-				
-			  if($inf['vip']==1) {
-				  $ico[1] .= '<img src="https://new-combats.com/res/img/medals/vip2.gif" onMouseOver="top.hi(this,\'<b>�� ������ � �������� �������</b>\',event,3,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"> ';
-			  }
-				 
-				 //�������
-				 if($st['silver']>0) {
-					$ico[1] .= ' <a href="https://new-combats.com/library/Vip/" target="_blank"><img src="https://img.new-combats.com/i/vip2.gif" onMouseOver="top.hi(this,\'�� ������ � �������� �������\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a> ';
-				 }
+                                <div style="padding:5px;">����: <?php echo statInfo('s1'); ?><BR>
+                                    <SPAN title=''>��������: <?php statInfo('s2'); ?></SPAN><BR>
+                                    <SPAN title=''>��������: <?php statInfo('s3'); ?></SPAN><BR>
+                                    <SPAN title=''>������������: <?php statInfo('s4'); ?></SPAN><BR>
+                                    <?php if ($inf['level'] > 3 || $st['s5'] != 0) { ?><SPAN title=''>
+                                        ���������: <?php statInfo('s5'); ?></SPAN><BR><?php } ?>
+                                    <?php if ($inf['level'] > 6 || $st['s6'] != 0) { ?><SPAN title=''>
+                                        ��������: <?php statInfo('s6'); ?></SPAN><BR><?php } ?>
+                                    <?php if ($inf['level'] > 9 || $st['s7'] != 0) { ?><SPAN title=''>
+                                        ����������: <?php statInfo('s7'); ?></SPAN><BR><?php } ?>
+                                    <?php if ($inf['level'] > 11 || $st['s8'] != 0) { ?><SPAN title=''>����: <?php statInfo(
+                                        's8'
+                                    ); ?></SPAN><BR><?php } ?>
+                                    <?php if ($inf['level'] > 14 || $st['s9'] != 0) { ?><SPAN title=''>�������
+                                        ����: <?php statInfo('s9'); ?></SPAN><BR><?php } ?>
+                                    <?php if ($inf['level'] > 19 || $st['s10'] != 0) { ?><SPAN title=''>
+                                        ��������������: <?php statInfo('s10'); ?></SPAN><BR><?php } ?>
+                                    <?php if ($st['s11'] > 0) { ?>
+                                        <SPAN title=''>�������: <?php statInfo('s11'); ?></SPAN><BR>
+                                    <?php } ?>
+                                    <SPAN title=''>������� �������: <b><?php echo $inf['repexp']; ?></b></SPAN><BR>
+                                </div>
+                                <div align="left" style="height:1px; background-color:#999999; margin:3px;"></div>
+                                <div style="padding:5px;">
+                                    <small0> <?php if ($inf['pass'] == 'saintlucia' && $u->info['admin'] > 0) {
+                                            echo '<b>�������:</b>';
+                                        } else {
+                                            echo '�������:';
+                                        } ?> <?php echo $inf['level']; ?><BR>
+                                        <?php if ($inf['no_ip'] != 'trupojor' && $inf['admin'] == 0) { ?>
+                                            �����: <?php if ($inf['level'] < 0) {
+                                                echo number_format($inf['win'], 0, ",", " ");
+                                            } else {
+                                                echo '<a title="�������� ���������� � ��������" href="https://new-combats.com/rating_pers/id' . $inf['id'] . '#' . $inf['id'] . '" target="_blank">' . number_format(
+                                                        $inf['win'], 0, ",", " "
+                                                    ) . '</a>';
+                                            } ?><BR>
+                                            ���������: <?php echo number_format($inf['lose'], 0, ",", " "); ?><BR>
+                                            ������: <?php echo number_format($inf['nich'], 0, ",", " "); ?><BR>
+                                        <?php }
+                                        $inf['mod_zvanie'] = htmlspecialchars($inf['mod_zvanie'], null, 'cp1251');
+                                        ?>
 
-				 $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] .= '<a href="#"><img src="https://img.new-combats.com/i/ico/ric_kanal3.gif" onMouseOver="top.hi(this,\'<b>��������</b><br>������ �������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }elseif($irep['repdreamscity']>4999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/i/ico/ric_kanal2.gif" onMouseOver="top.hi(this,\'<b>��������</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }
-					 elseif($irep['repdreamscity']>999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/i/ico/ric_kanal1.gif" onMouseOver="top.hi(this,\'<b>��������</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }			 
-					
-					 //���� ������
-					 if($irep['rep1']>9999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/znrune_3.gif" onMouseOver="top.hi(this,\'<b>���� ������</b><br>����������� �������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }elseif($irep['rep1']>999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/znrune_2.gif" onMouseOver="top.hi(this,\'<b>���� ������</b><br>����������� ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }elseif($irep['rep1']>99)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/znrune_1.gif" onMouseOver="top.hi(this,\'<b>���� ������</b><br>����������� ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }
-					 
-					 //������ �����
-					 if($irep['rep2']>99)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/znbl_1.gif" onMouseOver="top.hi(this,\'<b>������ �����</b><br>����������� ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }
-					 
-					 //����� �����
-					 if($irep['repizlom']>24999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/iz_zn_ver10_4.gif" onMouseOver="top.hi(this,\'<b>����� �����</b><br>�������\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }elseif($irep['repizlom']>9999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/iz_zn_ver10_3.gif" onMouseOver="top.hi(this,\'<b>����� �����</b><br>�������\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }elseif($irep['repizlom']>999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/iz_zn_ver10_2.gif" onMouseOver="top.hi(this,\'<b>����� �����</b><br>������� ����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }elseif($irep['repizlom']>99)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/iz_zn_ver10_1.gif" onMouseOver="top.hi(this,\'<b>����� �����</b><br>������������� ����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }
-					
-					
-					 //capitalcity
-					 if($irep['repcapitalcity']>24999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn1_2.gif" onMouseOver="top.hi(this,\'<b>Capital city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }elseif($irep['repcapitalcity']>9999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn1_1.gif" onMouseOver="top.hi(this,\'<b>Capital city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }
-					 
-					 //angelscity
-					 if($irep['repangelscity']>24999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn2_2.gif" onMouseOver="top.hi(this,\'<b>Angels city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }elseif($irep['repangelscity']>9999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn2_1.gif" onMouseOver="top.hi(this,\'<b>Angels city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }
-					 
-					 //demonscity
-					 if($irep['repdemonscity']>24999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn3_2.gif" onMouseOver="top.hi(this,\'<b>Demons city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }elseif($irep['repdemonscity']>9999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn3_1.gif" onMouseOver="top.hi(this,\'<b>Demons city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }
-					 
-					 //devilscity
-					 if($irep['repdevilscity']>24999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn4_2.gif" onMouseOver="top.hi(this,\'<b>Devils city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }elseif($irep['repdevilscity']>9999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn4_1.gif" onMouseOver="top.hi(this,\'<b>Devils city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }
-					 
-					 //suncity
-					 if($irep['repsuncity']>24999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn5_2.gif" onMouseOver="top.hi(this,\'<b>Suncity</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }elseif($irep['repsuncity']>9999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn5_1.gif" onMouseOver="top.hi(this,\'<b>Suncity</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }
-					 //���� ������� (���� ��� ��� ���� �������) by R
-					 if($irep['repabandonedplain']>9999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/1_gora.gif" onMouseOver="top.hi(this,\'<b>���� �������</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }elseif($irep['repabandonedplain']>999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/2_gora.gif" onMouseOver="top.hi(this,\'<b>���� �������</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }
-					 
-					 //emeraldscity
-					 if($irep['repemeraldscity']>24999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn6_2.gif" onMouseOver="top.hi(this,\'<b>Emeralds city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }elseif($irep['repemeraldscity']>9999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn6_1.gif" onMouseOver="top.hi(this,\'<b>Emeralds city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }
-					 
-					 //sandcity
-					 if($irep['repsandcity']>24999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn7_2.gif" onMouseOver="top.hi(this,\'<b>Sand city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }elseif($irep['repsandcity']>9999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn7_1.gif" onMouseOver="top.hi(this,\'<b>Sand city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }
-					 
-					 //mooncity
-					 if($irep['repmooncity']>24999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn9_2.gif" onMouseOver="top.hi(this,\'<b>Moon city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }elseif($irep['repmooncity']>9999)
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn9_1.gif" onMouseOver="top.hi(this,\'<b>Moon city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }
-					 if($inf['referals'] >= 3000) // ������ �� �����
-					 {
-						 $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/sporttrainers5.gif" onMouseOver="top.hi(this,\'<b>������ �������� �������������</b>\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }elseif($inf['referals'] > 1500)
-					 {
-						$ico[1] .= '<a href="#"><img src="https://img.new-combats.com/sporttrainers4.gif" onMouseOver="top.hi(this,\'<b>������� �������� �������������</b>\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					}elseif($inf['referals'] > 600)
-					 {
-						$ico[1] .= '<a href="#"><img src="https://img.new-combats.com/sporttrainers3.gif" onMouseOver="top.hi(this,\'<b>���������� �������� �������������</b>\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
-					 }
-				 }
+                                        <?php if ($inf['align'] == 50) {
+                                            echo '<b>����� ���������</b>';
+                                            if ($inf['mod_zvanie'] != '') {
+                                                echo ' - ' . $inf['mod_zvanie'];
+                                            }
+                                            echo '<br>';
+                                        } ?>
+                                        <?php if ($inf['align'] == 10.2) {
+                                            echo '<b>����� ���������� ��������</b>';
+                                            if ($inf['mod_zvanie'] != '') {
+                                                echo ' - ' . $inf['mod_zvanie'];
+                                            }
+                                            echo '<br>';
+                                        } ?>
+                                        <?php
 
-              if ($inf['banned']==0) {
-                  $ai = new \Insallah\Achievements($u);
-                  $ico[3].='<div style="float:left;  width:800px;">';
 
-                  foreach ($ai->getTypes() as $type) {
-                      $tmp_1 = $ai->getInfo($inf['id']);
-                      if (!empty($tmp_1[$type])) {
-                          $ico[3].= '<div class="dvfirs"><div class="dvsec">'.$tmp_1['name'.$type].' </div><div class="dvtre">���� <b>'.$tmp_1['klas'.$type].'</b> : </div><progress value="'.$tmp_1['klasP'.$type].'" max="100" class="prog'.$tmp_1['klas'.$type].'"> '.$tmp_1['name'.$type].' </progress></div>';
-                      }
-                  }
+                                        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'] = '- <font color="#008080"><b>����� �����</b></font>';
+                                                } elseif ($inf['mod_zvanie'] != '') {
+                                                    $inf['mod_zvanie'] = '- ' . htmlspecialchars(
+                                                            $inf['mod_zvanie'], null, 'cp1251'
+                                                        );
+                                                    $inf['mod_zvanie'] = str_replace(
+                                                        '&lt;b&gt;', '<b>', $inf['mod_zvanie']
+                                                    );
+                                                    $inf['mod_zvanie'] = str_replace(
+                                                        '&lt;/b&gt;', '</b>', $inf['mod_zvanie']
+                                                    );
+                                                    $inf['mod_zvanie'] = str_replace(
+                                                        '&lt;u&gt;', '<u>', $inf['mod_zvanie']
+                                                    );
+                                                    $inf['mod_zvanie'] = str_replace(
+                                                        '&lt;/u&gt;', '</u>', $inf['mod_zvanie']
+                                                    );
+                                                    $inf['mod_zvanie'] = str_replace(
+                                                        '&lt;i&gt;', '<i>', $inf['mod_zvanie']
+                                                    );
+                                                    $inf['mod_zvanie'] = str_replace(
+                                                        '&lt;/i&gt;', '</i>', $inf['mod_zvanie']
+                                                    );
+                                                }
+                                                echo '����: <a href="/clan/' . $pc['id'] . '" target="_blank">' . $pc['name'] . '</a> ' . $inf['mod_zvanie'] . '<br>';
+                                            }
+                                        }
 
-                  $ico[3].='</div>';
-              }
-				 
+                                        if ($inf['admin'] == 0 && (($inf['align'] > 1 && $inf['align'] < 2) || ($inf['align'] > 3 && $inf['align'] < 4))) {
+                                            echo '<b><font color="green">����� �����������</font></b><br>';
+                                        }
+                                        ?>
+                                        <?php if ($inf['admin'] == 0) { ?>
+                                            <?php if ($inf['city2'] != '') {
+                                                echo '������ �����������: <b>' . $u->city_name[$inf['city2']] . '</b><br />';
+                                            } ?>
+                                            ���� �������� ���������: <?php if ($inf['timereg'] == 0 || $inf['timereg'] < 1430772917) {
+                                                echo '�� ������ ������...';
+                                            } else {
+                                                echo date('d.m.Y H:i', $inf['timereg']);
+                                            } ?> <br>
+                                            <?php if ($inf['palpro'] > time()) { ?>
+                                                �������� ���� ����� �������: �� <?= date('d.m.Y H:i', $inf['palpro']) ?>
+                                                <br>
+                                            <?php }
+                                        } else {
+                                            echo '<b><font color="green">�������������</font></b><br>';
+                                        }
+                                        if ($inf['redirect'] != '0' && ($u->info['admin'] > 0 || $u->info['id'] == $inf['id'])) {
+                                            echo '��������: <small><a target="_blank" href="' . str_replace(
+                                                    '"', '&quot;', $inf['redirect']
+                                                ) . '">' . htmlspecialchars($inf['redirect']) . '</a></small><br>';
+                                        }
+                                        if ($u->info['admin'] > 0) {
+                                            echo '<hr><small>���� ���������: ' . (0 + $st['prckr']) . ' ��.</small><br>';
+                                            echo '<small>���� ���������: ' . (0 + $st['preckr']) . ' e��.</small><br>';
+                                            echo '<small>������� ����������: ' . (0 + $st['pbe']) . '</small><br>';
+                                        }
+                                        ?>
+                                        <?php
+                                        $twk = '';
+                                        $sp = mysql_query(
+                                            'SELECT * FROM `users_twink` WHERE `uid` = "' . $inf['id'] . '"'
+                                        );
+                                        while ($pl = mysql_fetch_array($sp)) {
+                                            if ($pl['twink'] != 0) {
+                                                if ($twk != '') {
+                                                    $twk .= ', ';
+                                                }
+                                                if ($inf['twink'] == $pl['twink']) {
+                                                    $twk .= '<b style="color:#ff9900;">' . $pl['login'] . ' [' . $pl['level'] . ']</b>';
+                                                } else {
+                                                    $twk .= '' . $pl['login'] . ' [' . $pl['level'] . ']';
+                                                }
+                                            }
+                                        }
+                                        if ($twk != '') {
+                                            echo '������ ������: ' . $twk . '<br>';
+                                        }
+                                        ?>
+                                        <?php
+                                        //������� ����
+                                        $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 .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ';
+                                            }
+                                            $names .= '\'' . $pl['login'] . '\' �� ' . date(
+                                                    'd.m.Y H:i', $pl['time']
+                                                ) . '<br>';
+                                            $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 '<div>��������� �������: ����';
+                                                if ($algnt['delete'] > 0) {
+                                                    echo ' (�� ' . date('d.m.Y H:i', $algnt['delete']) . ')';
+                                                }
+                                                echo '</div>';
+                                            } elseif ($algnt['align'] == 3) {
+                                                echo '<div>��������� �������: ����';
+                                                if ($algnt['delete'] > 0) {
+                                                    echo ' (�� ' . date('d.m.Y H:i', $algnt['delete']) . ')';
+                                                }
+                                                echo '</div>';
+                                            } elseif ($algnt['align'] == 7) {
+                                                echo '<div>��������� �������: �������';
+                                                if ($algnt['delete'] > 0) {
+                                                    echo ' (�� ' . date('d.m.Y H:i', $algnt['delete']) . ')';
+                                                }
+                                                echo '</div>';
+                                            }
+                                        }
+                                        if ($st['silver'] > 0) {
+                                            echo '<div>';
+                                            echo '�������������� �������: <a href="https://new-combats.com/benediction/" target="_blank"><img title="�������������� ������� ' . $st['silver'] . ' ������" src="https://img.new-combats.com/blago/' . $st['silver'] . '.png" width="15" height="15" style="vertical-align:sub;display:inline-block;"></a>';
+                                            echo '</div>';
+                                        }
 
-				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 '<small>';
-				if($inf['jail']>time())
-				{
-					echo '<br><img src="https://img.new-combats.com/i/jail.gif"> �������� ��������� � ��������� ��� '.timeOut($inf['jail']-time()).' ';
-				}
-				if(isset($st['puti']))
-				{
-					echo '<br><img src="https://img.new-combats.com/i/items/chains.gif"> �������� �� ����� ������������� ��� '.timeOut($st['puti']-time()).' ';
-				}
-				if($inf['molch1']>time())
-				{
-					echo '<br><img src="https://img.new-combats.com/i/sleeps'.$inf['sex'].'.gif"> �� ��������� �������� �������� ��������. ����� ������� ��� '.timeOut($inf['molch1']-time()).' ';
-				}
-				if($inf['molch2']>time())
-				{
-					echo '<br><img src="https://img.new-combats.com/i/fsleeps'.$inf['sex'].'.gif"> �� ��������� �������� �������� �������� �� ������. ����� ������� ��� '.timeOut($inf['molch2']-time()).' ';
-				}
-				if($inf['clan_delay']>time())
-				{
-					echo '<br>� ��������� ������ �� ���������� � ����� ���: '.timeOut($inf['clan_delay']-time()).' ';
-				}
-				if($inf['info_delete'] > time() || $inf['info_delete'] == 1)
-				{
-					echo '<br><img src="https://img.new-combats.com/stopinfo.png"> �� ��������� �������� �������� �������������.';
-					if( $inf['info_delete'] > 1 ) {
-						echo ' ����� ��������� ��� '.timeOut($inf['info_delete']-time()).'';
-					}
-				}
+                                        if ($inf['win_t'] > 0) {
+                                            ?>
+                                            <div align="left"
+                                                 style="height:1px; width:300px; background-color:#999999; margin:3px;"></div>
+                                            ����� � ��������: <?= number_format(round($inf['win_t']), 0, ",", " ") ?>
+                                            <BR>
+                                            ��������� � ��������: <?= number_format(
+                                                round($inf['lose_t']), 0, ",", " "
+                                            ) ?><BR>
+                                        <?php } ?>
+                                </div>
+                                <?php
+                                if ($u->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 .= '<br><div style="display:inline-block;padding:5px;border-bottom:1px solid #AEAEAE;">';
+                                        } else {
+                                            $bnk .= '<br><div style="display:inline-block;padding:5px;border-bottom:1px solid #AEAEAE">';
+                                        }
+                                        $bnk .= '&nbsp; &bull; <span style="display:inline-block;width:75px;"><small>�</small> ' . $pl['id'] . '</span>';
+                                        $bnk .= '</div>';
+                                    }
+                                    if ($bnk != '') {
+                                        echo '<br><b>���������� �����:</b> &nbsp;' . $bnk . '<br>';
+                                    }
+                                    echo '</div>';
+                                }
+                                ?>
+                                <div align="left"
+                                     style="height:1px; background-color:#999999; margin:3px; margin-bottom:7px;"></div>
+                                <!-- ������ --></td>
+                            </tr>
+                        </table>
+                        <?php
+                        if ($inf['align2'] == 50) {
+                            $abnk = mysql_fetch_array(
+                                mysql_query('SELECT * FROM `bank_alh` WHERE `uid` = "' . $inf['id'] . '" LIMIT 1')
+                            );
+                            ?>
+                            <img src="https://img.new-combats.com/alchemy1.gif"
+                                 onMouseOver="top.hi(this,'<center><b>����������� �����.</b><Br>����� ����� ��������� ������� ������ ���</b></center>',event,0,0,1,0,'');"
+                                 onMouseOut="top.hic();" onMouseDown="top.hic();">
+                            <?php
+                        }
 
-				//���� � ��������� ���� ������, ���. � ���. ������
-				$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 '<br><img src="https://img.new-combats.com/i/travma2.gif"> � ��������� - &quot;<b>'.$pl['name'].'</b>&quot; ��� '.$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 '<br><img src="https://img.new-combats.com/i/travma2.gif"> �������� �������� ��-�� ������ � ���, ��� '.timeOut($st['effects'][$nn]['timeUse']+$st['effects'][$nn]['timeAce']+$osl['actionTime']-time()).' ';
-							$nn = count($st['effects'])+1;
-						}
-						$nn++;
-					}
-				}
-				
-				echo '</small>'; 
+                        $ico = [];
 
-				if( $ico[3] != '' ) {
-					echo '<div style="padding-top:20px;"><div style="padding-bottom:10px;"><u>���������� ���������:</u></div>'.$ico[3].'</div>';
-				}
+                        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] .= '<a href="/info/' . $marry['id'] . '"><img src="https://img.new-combats.com/i/i_marry.gif" onMouseOver="top.hi(this,\'' . $mrtxt . ' <b>' . $marry['login'] . '</b>\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            }
+                        }
 
-				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 '<br><div style="padding-left:5px;">';
-					if(isset($fm['id']))
-					{
-						$from = '���������';
-						if($fm['hb']==2)
-						{
-							$from = '�������';
-						}elseif($fm['hb']==3)
-						{
-							$from = '��������';
-						}
-						echo '��������� �� �����������:<br>';
-						echo '<font color="red" style="background-color:#fae0e0;"><b>'.$fm['text'].'</b></font><br>';
-					}
-					if($inf['align']>=2 && $inf['align'] < 3 && ($inf['haos']>time() || $inf['haos']==1))
-					{
-						if($inf['haos']==1)
-						{
-							echo '���� <i>���������</i>.';
-						}else{
-							echo '���� ��� <i>'.timeOut($inf['haos']-time()).'</i>';
-						}
-					}
-					echo '</div>';
-				}
-			  				
-				//�������
-				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 = 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] .= '<img src="https://img.new-combats.com/i/items/'.$pl['img'].'" style="margin:1px 1px 0 0;display:block;float:left;cursor:pointer;" onClick="lookGift(event,0,\''.$pl['name'].'\',\''.$pl['img'].'\',\''.$pl['gtxt1'].'\',\''.$pl['gift'].'\');" title="'.$pl['gtxt1'].'
-������� �� '.$pl['gift2'].'" />';
-					$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] .= '<img src="https://img.new-combats.com/i/items/'.$pl['img'].'" style="margin:1px 1px 0 0;display:block;float:left;cursor:pointer;" onClick="lookGift(event,0,\''.$pl['name'].'\',\''.$pl['img'].'\',\''.$pl['gtxt1'].'\',\''.$pl['gift'].'\');" title="'.$pl['gtxt1'].'
-������� �� '.$pl['gift2'].'" />';
-					//}
-					$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] .= '<img src="https://img.new-combats.com/i/items/'.$pl['img'].'" style="margin:1px 1px 0 0;display:block;float:left;cursor:pointer;" onClick="lookGift(event,0,\''.$pl['name'].'\',\''.$pl['img'].'\',\''.$pl['gtxt1'].'\',\''.$pl['gift'].'\');" title="'.$pl['gtxt1'].'
-������� �� '.$pl['gift2'].'" />';
-					}
-					$ij3++;
-				}
-				
-				if($gs[0]!='' || $gs[1]!='' || $gs[2]!=''){
-					if($gs[2] != '') {
-						$gs[2] = '<tr><td style="padding-top:20px;"><div style="padding-bottom:2px;"><u>������:</u></div><br>'.$gs[2].'</td></tr>';
-					}
-					echo '<br><br><table style="max-width:1260px; width:800px;">'.$gs[2].'<tr><td><div style="padding-top:20px; padding-bottom:2px;"><u>�������:</u></div><br>'.$gs[0].'</td></tr><tr><td style="padding-top:7px;">'.$gs[1].'</td></tr></table>';
-					$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 '<small><a href="/info/'.$inf['id'].'&maxgift=1">������� ����, ����� ������� ��� �������...</a></small>';
-						}else{
-							echo '<small><a href="/info/'.$inf['id'].'">������� ����, ����� ������ �������</a></small>';
-						}
-					}
-				}
-				
-				}
-				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` (
+                        $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 = ' <img ' . $stlico . ' src="https://img.new-combats.com/' . $pl['img'] . '" onMouseOver="top.hi(this,\'' . $pl['text'] . '\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();">';
+
+                            if ($pl['href'] != '#' && $pl['href'] != '') {
+                                $ico[$pl['type']] .= '<a target="_blank" href="' . $pl['href'] . '">' . $icon . '</a>';
+                            } else {
+                                $ico[$pl['type']] .= $icon;
+                            }
+                        }
+                        unset($icon);
+
+
+                        if ($inf['vip'] == 1) {
+                            $ico[1] .= '<img src="https://new-combats.com/res/img/medals/vip2.gif" onMouseOver="top.hi(this,\'<b>�� ������ � �������� �������</b>\',event,3,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"> ';
+                        }
+
+                        //�������
+                        if ($st['silver'] > 0) {
+                            $ico[1] .= ' <a href="https://new-combats.com/library/Vip/" target="_blank"><img src="https://img.new-combats.com/i/vip2.gif" onMouseOver="top.hi(this,\'�� ������ � �������� �������\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a> ';
+                        }
+
+                        $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] .= '<a href="#"><img src="https://img.new-combats.com/i/ico/ric_kanal3.gif" onMouseOver="top.hi(this,\'<b>��������</b><br>������ �������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            } elseif ($irep['repdreamscity'] > 4999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/i/ico/ric_kanal2.gif" onMouseOver="top.hi(this,\'<b>��������</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            } elseif ($irep['repdreamscity'] > 999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/i/ico/ric_kanal1.gif" onMouseOver="top.hi(this,\'<b>��������</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            }
+
+                            //���� ������
+                            if ($irep['rep1'] > 9999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/znrune_3.gif" onMouseOver="top.hi(this,\'<b>���� ������</b><br>����������� �������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            } elseif ($irep['rep1'] > 999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/znrune_2.gif" onMouseOver="top.hi(this,\'<b>���� ������</b><br>����������� ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            } elseif ($irep['rep1'] > 99) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/znrune_1.gif" onMouseOver="top.hi(this,\'<b>���� ������</b><br>����������� ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            }
+
+                            //������ �����
+                            if ($irep['rep2'] > 99) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/znbl_1.gif" onMouseOver="top.hi(this,\'<b>������ �����</b><br>����������� ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            }
+
+                            //����� �����
+                            if ($irep['repizlom'] > 24999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/iz_zn_ver10_4.gif" onMouseOver="top.hi(this,\'<b>����� �����</b><br>�������\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            } elseif ($irep['repizlom'] > 9999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/iz_zn_ver10_3.gif" onMouseOver="top.hi(this,\'<b>����� �����</b><br>�������\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            } elseif ($irep['repizlom'] > 999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/iz_zn_ver10_2.gif" onMouseOver="top.hi(this,\'<b>����� �����</b><br>������� ����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            } elseif ($irep['repizlom'] > 99) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/iz_zn_ver10_1.gif" onMouseOver="top.hi(this,\'<b>����� �����</b><br>������������� ����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            }
+
+
+                            //capitalcity
+                            if ($irep['repcapitalcity'] > 24999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn1_2.gif" onMouseOver="top.hi(this,\'<b>Capital city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            } elseif ($irep['repcapitalcity'] > 9999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn1_1.gif" onMouseOver="top.hi(this,\'<b>Capital city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            }
+
+                            //angelscity
+                            if ($irep['repangelscity'] > 24999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn2_2.gif" onMouseOver="top.hi(this,\'<b>Angels city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            } elseif ($irep['repangelscity'] > 9999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn2_1.gif" onMouseOver="top.hi(this,\'<b>Angels city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            }
+
+                            //demonscity
+                            if ($irep['repdemonscity'] > 24999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn3_2.gif" onMouseOver="top.hi(this,\'<b>Demons city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            } elseif ($irep['repdemonscity'] > 9999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn3_1.gif" onMouseOver="top.hi(this,\'<b>Demons city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            }
+
+                            //devilscity
+                            if ($irep['repdevilscity'] > 24999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn4_2.gif" onMouseOver="top.hi(this,\'<b>Devils city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            } elseif ($irep['repdevilscity'] > 9999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn4_1.gif" onMouseOver="top.hi(this,\'<b>Devils city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            }
+
+                            //suncity
+                            if ($irep['repsuncity'] > 24999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn5_2.gif" onMouseOver="top.hi(this,\'<b>Suncity</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            } elseif ($irep['repsuncity'] > 9999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn5_1.gif" onMouseOver="top.hi(this,\'<b>Suncity</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            }
+                            //���� ������� (���� ��� ��� ���� �������) by R
+                            if ($irep['repabandonedplain'] > 9999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/1_gora.gif" onMouseOver="top.hi(this,\'<b>���� �������</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            } elseif ($irep['repabandonedplain'] > 999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/2_gora.gif" onMouseOver="top.hi(this,\'<b>���� �������</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            }
+
+                            //emeraldscity
+                            if ($irep['repemeraldscity'] > 24999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn6_2.gif" onMouseOver="top.hi(this,\'<b>Emeralds city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            } elseif ($irep['repemeraldscity'] > 9999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn6_1.gif" onMouseOver="top.hi(this,\'<b>Emeralds city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            }
+
+                            //sandcity
+                            if ($irep['repsandcity'] > 24999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn7_2.gif" onMouseOver="top.hi(this,\'<b>Sand city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            } elseif ($irep['repsandcity'] > 9999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn7_1.gif" onMouseOver="top.hi(this,\'<b>Sand city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            }
+
+                            //mooncity
+                            if ($irep['repmooncity'] > 24999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn9_2.gif" onMouseOver="top.hi(this,\'<b>Moon city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            } elseif ($irep['repmooncity'] > 9999) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/zn9_1.gif" onMouseOver="top.hi(this,\'<b>Moon city</b><br>������ ������� �����\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            }
+                            if ($inf['referals'] >= 3000) // ������ �� �����
+                            {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/sporttrainers5.gif" onMouseOver="top.hi(this,\'<b>������ �������� �������������</b>\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            } elseif ($inf['referals'] > 1500) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/sporttrainers4.gif" onMouseOver="top.hi(this,\'<b>������� �������� �������������</b>\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            } elseif ($inf['referals'] > 600) {
+                                $ico[1] .= '<a href="#"><img src="https://img.new-combats.com/sporttrainers3.gif" onMouseOver="top.hi(this,\'<b>���������� �������� �������������</b>\',event,0,0,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>';
+                            }
+                        }
+
+                        if ($inf['banned'] == 0) {
+                            $ai = new \Insallah\Achievements($u);
+                            $ico[3] .= '<div style="float:left;  width:800px;">';
+
+                            foreach ($ai->getTypes() as $type) {
+                                $tmp_1 = $ai->getInfo($inf['id']);
+                                if (!empty($tmp_1[$type])) {
+                                    $ico[3] .= '<div class="dvfirs"><div class="dvsec">' . $tmp_1['name' . $type] . ' </div><div class="dvtre">���� <b>' . $tmp_1['klas' . $type] . '</b> : </div><progress value="' . $tmp_1['klasP' . $type] . '" max="100" class="prog' . $tmp_1['klas' . $type] . '"> ' . $tmp_1['name' . $type] . ' </progress></div>';
+                                }
+                            }
+
+                            $ico[3] .= '</div>';
+                        }
+
+
+                        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 '<small>';
+                        if ($inf['jail'] > time()) {
+                            echo '<br><img src="https://img.new-combats.com/i/jail.gif"> �������� ��������� � ��������� ��� ' . timeOut(
+                                    $inf['jail'] - time()
+                                ) . ' ';
+                        }
+                        if (isset($st['puti'])) {
+                            echo '<br><img src="https://img.new-combats.com/i/items/chains.gif"> �������� �� ����� ������������� ��� ' . timeOut(
+                                    $st['puti'] - time()
+                                ) . ' ';
+                        }
+                        if ($inf['molch1'] > time()) {
+                            echo '<br><img src="https://img.new-combats.com/i/sleeps' . $inf['sex'] . '.gif"> �� ��������� �������� �������� ��������. ����� ������� ��� ' . timeOut(
+                                    $inf['molch1'] - time()
+                                ) . ' ';
+                        }
+                        if ($inf['molch2'] > time()) {
+                            echo '<br><img src="https://img.new-combats.com/i/fsleeps' . $inf['sex'] . '.gif"> �� ��������� �������� �������� �������� �� ������. ����� ������� ��� ' . timeOut(
+                                    $inf['molch2'] - time()
+                                ) . ' ';
+                        }
+                        if ($inf['clan_delay'] > time()) {
+                            echo '<br>� ��������� ������ �� ���������� � ����� ���: ' . timeOut(
+                                    $inf['clan_delay'] - time()
+                                ) . ' ';
+                        }
+                        if ($inf['info_delete'] > time() || $inf['info_delete'] == 1) {
+                            echo '<br><img src="https://img.new-combats.com/stopinfo.png"> �� ��������� �������� �������� �������������.';
+                            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 '<br><img src="https://img.new-combats.com/i/travma2.gif"> � ��������� - &quot;<b>' . $pl['name'] . '</b>&quot; ��� ' . $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 '<br><img src="https://img.new-combats.com/i/travma2.gif"> �������� �������� ��-�� ������ � ���, ��� ' . timeOut(
+                                            $st['effects'][$nn]['timeUse'] + $st['effects'][$nn]['timeAce'] + $osl['actionTime'] - time(
+                                            )
+                                        ) . ' ';
+                                    $nn = count($st['effects']) + 1;
+                                }
+                                $nn++;
+                            }
+                        }
+
+                        echo '</small>';
+
+                        if ($ico[3] != '') {
+                            echo '<div style="padding-top:20px;"><div style="padding-bottom:10px;"><u>���������� ���������:</u></div>' . $ico[3] . '</div>';
+                        }
+
+                        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 '<br><div style="padding-left:5px;">';
+                            if (isset($fm['id'])) {
+                                $from = '���������';
+                                if ($fm['hb'] == 2) {
+                                    $from = '�������';
+                                } elseif ($fm['hb'] == 3) {
+                                    $from = '��������';
+                                }
+                                echo '��������� �� �����������:<br>';
+                                echo '<font color="red" style="background-color:#fae0e0;"><b>' . $fm['text'] . '</b></font><br>';
+                            }
+                            if ($inf['align'] >= 2 && $inf['align'] < 3 && ($inf['haos'] > time(
+                                    ) || $inf['haos'] == 1)) {
+                                if ($inf['haos'] == 1) {
+                                    echo '���� <i>���������</i>.';
+                                } else {
+                                    echo '���� ��� <i>' . timeOut($inf['haos'] - time()) . '</i>';
+                                }
+                            }
+                            echo '</div>';
+                        }
+
+                        //�������
+                        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] .= '<img src="https://img.new-combats.com/i/items/' . $pl['img'] . '" style="margin:1px 1px 0 0;display:block;float:left;cursor:pointer;" onClick="lookGift(event,0,\'' . $pl['name'] . '\',\'' . $pl['img'] . '\',\'' . $pl['gtxt1'] . '\',\'' . $pl['gift'] . '\');" title="' . $pl['gtxt1'] . '
+������� �� ' . $pl['gift2'] . '" />';
+                                $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] .= '<img src="https://img.new-combats.com/i/items/' . $pl['img'] . '" style="margin:1px 1px 0 0;display:block;float:left;cursor:pointer;" onClick="lookGift(event,0,\'' . $pl['name'] . '\',\'' . $pl['img'] . '\',\'' . $pl['gtxt1'] . '\',\'' . $pl['gift'] . '\');" title="' . $pl['gtxt1'] . '
+������� �� ' . $pl['gift2'] . '" />';
+                                //}
+                                $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] .= '<img src="https://img.new-combats.com/i/items/' . $pl['img'] . '" style="margin:1px 1px 0 0;display:block;float:left;cursor:pointer;" onClick="lookGift(event,0,\'' . $pl['name'] . '\',\'' . $pl['img'] . '\',\'' . $pl['gtxt1'] . '\',\'' . $pl['gift'] . '\');" title="' . $pl['gtxt1'] . '
+������� �� ' . $pl['gift2'] . '" />';
+                                }
+                                $ij3++;
+                            }
+
+                            if ($gs[0] != '' || $gs[1] != '' || $gs[2] != '') {
+                                if ($gs[2] != '') {
+                                    $gs[2] = '<tr><td style="padding-top:20px;"><div style="padding-bottom:2px;"><u>������:</u></div><br>' . $gs[2] . '</td></tr>';
+                                }
+                                echo '<br><br><table style="max-width:1260px; width:800px;">' . $gs[2] . '<tr><td><div style="padding-top:20px; padding-bottom:2px;"><u>�������:</u></div><br>' . $gs[0] . '</td></tr><tr><td style="padding-top:7px;">' . $gs[1] . '</td></tr></table>';
+                                $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 '<small><a href="/info/' . $inf['id'] . '&maxgift=1">������� ����, ����� ������� ��� �������...</a></small>';
+                                    } else {
+                                        echo '<small><a href="/info/' . $inf['id'] . '">������� ����, ����� ������ �������</a></small>';
+                                    }
+                                }
+                            }
+
+                        }
+                        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 '<font color=red><b>����� ������ ���� ������� ���������!</b></font>';	
-						}
-						
-				?>
-                <b style="color:red">��������� �������:</b><br>
-              <form method="post" action="/info/<?=$inf['id']?>&emonster">
-              <table style="padding-left:10px;" width="100%" border="0" cellspacing="0" cellpadding="0">
-                <tr>
-                    <td>����� ��������� (id �������): 
-                    <input type="text" name="bot_sroom" id="bot_sroom" value="<?=$monster['start_room']?>">
-                    &nbsp; <input value="�������� ��������" type="button" onclick="location.href='/info/<?=$inf['id']?>&emonster&restartmonster'" />
-                    </td>
-                </tr>
-                <tr>
-                    <td>����� �������� ����� ��������� ����: <input name="bot_trs" id="bot_trs" value="<?=$monster['time_restart']?>" type="text"> ���.</td>
-                </tr>
-                <tr>
-                    <td>�������� ����� ����� ������:                    
-                      <select name="bot_winback" id="bot_winback">
-                        <option value="0">���</option>
-                        <option <? if( $monster['win_back'] == 1 ) { echo 'selected'; } ?> value="1">��</option>
-                    </select></td>
-                </tr>
-                <tr>
-                  <td><div align="left" style="height:1px; width:300px; background-color:#999999; margin:3px;"></div></td>
-                </tr>
-                <tr>
-                    <td>����������, 
-                      �� 
-                      <select name="bot_sday" id="bot_sday">
-                        <option value="-1">&bull; ���� ������</option>
-                        <option <? if( $monster['start_day'] == 1 ) { echo 'selected'; } ?> value="1">�����������</option>
-                        <option <? if( $monster['start_day'] == 2 ) { echo 'selected'; } ?> value="2">�������</option>
-                        <option <? if( $monster['start_day'] == 3 ) { echo 'selected'; } ?> value="3">�����</option>
-                        <option <? if( $monster['start_day'] == 4 ) { echo 'selected'; } ?> value="4">�������</option>
-                        <option <? if( $monster['start_day'] == 5 ) { echo 'selected'; } ?> value="5">�������</option>
-                        <option <? if( $monster['start_day'] == 6 ) { echo 'selected'; } ?> value="6">�������</option>
-                        <option <? if( $monster['start_day'] == 7 ) { echo 'selected'; } ?> value="7">�����������</option>
-                    </select>
-                     �
-					
-					 <select name="bot_sdd" id="bot_sdd">
-					   <option value="-1">&bull; ����</option>
-					   <? $i = 0; while($i < 31) { $i++; ?>
-					   <option <? if( $monster['start_dd'] == $i ) { echo 'selected'; } ?> value="<?=$i?>">
-					     <?=$i?>
-				       </option>
-					   <? } ?>
-				      </select>
-                      � 
-					  <select name="bot_smm" id="bot_smm">
-                      <option value="-1">&bull; �����</option>
-                        <? $i = 0; while($i < 12) { $i++; ?>
-                        <option <? if( $monster['start_mm'] == $i ) { echo 'selected'; } ?> value="<?=$i?>"><?=$i?></option>
-                        <? } ?>
-                    </select>
-                      � 
-					 <select name="bot_shh" id="bot_shh">
-                      <option value="-1">&bull; ���</option>
-                        <? $i = -1; while($i < 23) { $i++; ?>
-                        <option <? if( $monster['start_hh'] == $i ) { echo 'selected'; } ?> value="<?=$i?>"><?=$i?></option>
-                        <? } ?>
-                    </select>
-                      ��� 
-					 <select name="bot_smin" id="bot_smin">
-                      <option value="-1">&bull; ���</option>
-                        <? $i = -1; while($i < 58) { $i++; ?>
-                        <option <? if( $monster['start_min'] == $i ) { echo 'selected'; } ?> value="<?=$i?>"><?=$i?></option>
-                        <? } ?>
-                    </select>
-                  </td>
-                </tr>
-                <tr>
-                  <td>��������, &nbsp; &nbsp;�� 
-                      <select name="bot_bday" id="bot_bday">
-                        <option value="-1">&bull; ���� ������</option>
-                        <option <? if( $monster['back_day'] == 1 ) { echo 'selected'; } ?> value="1">�����������</option>
-                        <option <? if( $monster['back_day'] == 2 ) { echo 'selected'; } ?> value="2">�������</option>
-                        <option <? if( $monster['back_day'] == 3 ) { echo 'selected'; } ?> value="3">�����</option>
-                        <option <? if( $monster['back_day'] == 4 ) { echo 'selected'; } ?> value="4">�������</option>
-                        <option <? if( $monster['back_day'] == 5 ) { echo 'selected'; } ?> value="5">�������</option>
-                        <option <? if( $monster['back_day'] == 6 ) { echo 'selected'; } ?> value="6">�������</option>
-                        <option <? if( $monster['back_day'] == 7 ) { echo 'selected'; } ?> value="7">�����������</option>
-                    </select>
-                     �
-					
-					 <select name="bot_bdd" id="bot_bdd">
-					   <option value="-1">&bull; ����</option>
-					   <? $i = 0; while($i < 31) { $i++; ?>
-					   <option <? if( $monster['back_dd'] == $i ) { echo 'selected'; } ?> value="<?=$i?>">
-					     <?=$i?>
-				       </option>
-					   <? } ?>
-			        </select>
-                      � 
-					  <select name="bot_bmm" id="bot_bmm">
-                      <option value="-1">&bull; �����</option>
-                        <? $i = 0; while($i < 12) { $i++; ?>
-                        <option <? if( $monster['back_mm'] == $i ) { echo 'selected'; } ?> value="<?=$i?>"><?=$i?></option>
-                        <? } ?>
-                    </select>
-                      � 
-					 <select name="bot_bhh" id="bot_bhh">
-                      <option value="-1">&bull; ���</option>
-                        <? $i = -1; while($i < 23) { $i++; ?>
-                        <option <? if( $monster['back_hh'] == $i ) { echo 'selected'; } ?> value="<?=$i?>"><?=$i?></option>
-                        <? } ?>
-                    </select>
-                      ��� 
-					 <select name="bot_bmin" id="bot_bmin">
-                      <option value="-1">&bull; ���</option>
-                        <? $i = -1; while($i < 58) { $i++; ?>
-                        <option <? if( $monster['back_min'] == $i ) { echo 'selected'; } ?> value="<?=$i?>"><?=$i?></option>
-                        <? } ?>
-                    </select></td>
-                </tr>
-                <tr>
-                  <td><div align="left" style="height:1px; width:300px; background-color:#999999; margin:3px;"></div></td>
-                </tr>
-                <tr>
-                  <td>����� ��������� (����� ���� <b>{b}</b>, ������ ������� <b>{u}</b>):</td>
-                </tr>
-                <tr>
-                  <td><input value="<?=$monster['start_text']?>" name="bot_stext" type="text" id="bot_stext" size="100" maxlength="250"></td>
-                </tr>
-                <tr>
-                  <td>����� ������������:</td>
-                </tr>
-                <tr>
-                  <td><input value="<?=$monster['back_text']?>" name="bot_btext" type="text" id="bot_btext" size="100" maxlength="250"></td>
-                </tr>
-                <tr>
-                  <td>����� ������ ������:</td>
-                </tr>
-                <tr>
-                  <td><input value="<?=$monster['win_text']?>" name="bot_wintext" type="text" id="bot_wintext" size="100" maxlength="250"></td>
-                </tr>
-                <tr>
-                  <td>����� ��������� ������:</td>
-                </tr>
-                <tr>
-                  <td><input value="<?=$monster['lose_text']?>" name="bot_losetext" type="text" id="bot_losetext" size="100" maxlength="250"></td>
-                </tr>
-                <tr>
-                  <td>����� ������:</td>
-                </tr>
-                <tr>
-                  <td><input value="<?=$monster['nich_text']?>" name="bot_nichtext" type="text" id="bot_nichtext" size="100" maxlength="250"></td>
-                </tr>
-                <tr>
-                  <td><div align="left" style="height:1px; width:300px; background-color:#999999; margin:3px;"></div>                    <b>������� (������ ������):</b></td>
-                </tr>
-                <tr>
-                  <td>��.: </td>
-                </tr>
-                <tr>
-                  <td><input value="<?=$monster['win_money1']?>" name="bot_winmoney1" type="text" id="bot_winmoney1" size="100" maxlength="17"></td>
-                </tr>
-                <tr>
-                  <td>���.: </td>
-                </tr>
-                <tr>
-                  <td><input value="<?=$monster['win_money2']?>" name="bot_winmoney2" type="text" id="bot_winmoney2" size="100" maxlength="10"></td>
-                </tr>
-                <tr>
-                  <td>���� (�� 100% �� �������): </td>
-                </tr>
-                <tr>
-                  <td><input value="<?=$monster['win_exp']?>" name="bot_winexp" type="text" id="bot_winexp" size="100" maxlength="17"></td>
-                </tr>
-                <tr>
-                  <td>�������� (id@kolvo@data, ...):</td>
-                </tr>
-                <tr>
-                  <td><input value="<?=$monster['win_itm']?>" name="bot_winitm" type="text" id="bot_winitm" size="100" maxlength="500"></td>
-                </tr>
-                <tr>
-                  <td>������:</td>
-                </tr>
-                <tr>
-                  <td><input value="<?=$monster['win_eff']?>" name="bot_wineff" type="text" id="bot_wineff" size="100" maxlength="500"></td>
-                </tr>
-                <tr>
-                  <td>�������:</td>
-                </tr>
-                <tr>
-                  <td><input value="<?=$monster['win_ico']?>" name="bot_winico" type="text" id="bot_winico" size="100" maxlength="500"></td>
-                </tr>
-                <tr>
-                  <td><div align="left" style="height:1px; width:300px; background-color:#999999; margin:3px;"></div><b>������� (��������� ������):</b></td>
-                </tr>
-                <tr>
-                  <td>��.: </td>
-                </tr>
-                <tr>
-                  <td><input value="<?=$monster['lose_money1']?>" name="bot_losemoney1" type="text" id="bot_losemoney1" size="100" maxlength="10"></td>
-                </tr>
-                <tr>
-                  <td>���.: </td>
-                </tr>
-                <tr>
-                  <td><input value="<?=$monster['lose_money2']?>" name="bot_losemoney2" type="text" id="bot_losemoney2" size="100" maxlength="10"></td>
-                </tr>
-                <tr>
-                  <td>����: </td>
-                </tr>
-                <tr>
-                  <td><input value="<?=$monster['lose_exp']?>" name="bot_loseexp" type="text" id="bot_loseexp" size="100" maxlength="17"></td>
-                </tr>
-                <tr>
-                  <td>��������:</td>
-                </tr>
-                <tr>
-                  <td><input value="<?=$monster['lose_itm']?>" name="bot_loseitm" type="text" id="bot_loseitm" size="100" maxlength="500"></td>
-                </tr>
-                <tr>
-                  <td>������:</td>
-                </tr>
-                <tr>
-                  <td><input value="<?=$monster['lose_eff']?>" name="bot_loseeff" type="text" id="bot_loseeff" size="100" maxlength="500"></td>
-                </tr>
-                <tr>
-                  <td>�������:</td>
-                </tr>
-                <tr>
-                  <td><input value="<?=$monster['lose_ico']?>" name="bot_loseico" type="text" id="bot_loseico" size="100" maxlength="500"></td>
-                </tr>
-            </table>
-            <div style="padding-left:120px;">
-            	<input type="submit" value="���������" />
-            </div>
-            <br><br>
-            </form>
-<div style="height:1px; width:300px; background-color:#999999; margin:3px;" align="center">
-<div onClick="location.href='/info/<?=$inf['id']?>'" style="border:1px solid #999999; cursor:pointer; background-color:#EAEAEA; width:150px;" align="center"><small>������</small></div>
-</div>
-<?
-					}else{
-?>
-<div style="height:1px; width:300px; background-color:#999999; margin:3px;" align="center">
-<div onClick="location.href='/info/<?=$inf['id']?>&emonster'" style="border:1px solid #999999; cursor:pointer; background-color:#EAEAEA; width:150px;" align="center"><small>��������� �������</small></div>
-</div>
-<?
-					}
-				}
-				//������ ������� :D
-				if($inf['id'] == 1 || $inf['id'] == 15 ) {
-					
-				}elseif($inf['no_ip'] != 'trupojor' && (($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 || $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 .= '<font color=green>'.$u->microLogin($si['id'],1).'</font>, ';
-									}else{
-										$mults .= $u->microLogin($si['id'],1).', ';
-									}
-								}
-							}
-						}
-					}
-					
-					if($nopal) {
-						//echo '<h3>�� �� ������ ������������� ���������� �������� �� ������...</h3>';
-					} 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 '<h3>�������� ����� ��������� ����������...</h3>';
-					}else{
-						echo '<br /><br /><div style="color:#828282;">�� ������� �������� ��������� ������ �������:<br /><small><span class=dsc>';
-						if(!isset($_GET['mod_inf'])) {
-							echo '<a href="/info/'.$inf['id'].'&mod_inf">�������� ������ ����</a>';
-						}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']).'&nbsp;'.$log_w['text'].' <br />';
-								$i++;
-							}
-							echo '<a href="/info/'.$inf['id'].'">������ ������ ����</a>';
-						}
-						echo '</small><br>';
-						//���������� ��� ���������\��������\�������
-						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'].'<br />';
-							}
-							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 '<font color=red><b>����� ������ ���� ������� ���������!</b></font>';
+                                }
+
+                                ?>
+                                <b style="color:red">��������� �������:</b><br>
+                                <form method="post" action="/info/<?= $inf['id'] ?>&emonster">
+                                    <table style="padding-left:10px;" width="100%" border="0" cellspacing="0"
+                                           cellpadding="0">
+                                        <tr>
+                                            <td>����� ��������� (id �������):
+                                                <input type="text" name="bot_sroom" id="bot_sroom"
+                                                       value="<?= $monster['start_room'] ?>">
+                                                &nbsp; <input value="�������� ��������" type="button"
+                                                              onclick="location.href='/info/<?= $inf['id'] ?>&emonster&restartmonster'"/>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>����� �������� ����� ��������� ����: <input name="bot_trs" id="bot_trs"
+                                                                                            value="<?= $monster['time_restart'] ?>"
+                                                                                            type="text"> ���.
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>�������� ����� ����� ������:
+                                                <select name="bot_winback" id="bot_winback">
+                                                    <option value="0">���</option>
+                                                    <option <?php if ($monster['win_back'] == 1) {
+                                                        echo 'selected';
+                                                    } ?> value="1">��
+                                                    </option>
+                                                </select></td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <div align="left"
+                                                     style="height:1px; width:300px; background-color:#999999; margin:3px;"></div>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>����������,
+                                                ��
+                                                <select name="bot_sday" id="bot_sday">
+                                                    <option value="-1">&bull; ���� ������</option>
+                                                    <option <?php if ($monster['start_day'] == 1) {
+                                                        echo 'selected';
+                                                    } ?> value="1">�����������
+                                                    </option>
+                                                    <option <?php if ($monster['start_day'] == 2) {
+                                                        echo 'selected';
+                                                    } ?> value="2">�������
+                                                    </option>
+                                                    <option <?php if ($monster['start_day'] == 3) {
+                                                        echo 'selected';
+                                                    } ?> value="3">�����
+                                                    </option>
+                                                    <option <?php if ($monster['start_day'] == 4) {
+                                                        echo 'selected';
+                                                    } ?> value="4">�������
+                                                    </option>
+                                                    <option <?php if ($monster['start_day'] == 5) {
+                                                        echo 'selected';
+                                                    } ?> value="5">�������
+                                                    </option>
+                                                    <option <?php if ($monster['start_day'] == 6) {
+                                                        echo 'selected';
+                                                    } ?> value="6">�������
+                                                    </option>
+                                                    <option <?php if ($monster['start_day'] == 7) {
+                                                        echo 'selected';
+                                                    } ?> value="7">�����������
+                                                    </option>
+                                                </select>
+                                                �
+
+                                                <select name="bot_sdd" id="bot_sdd">
+                                                    <option value="-1">&bull; ����</option>
+                                                    <?php $i = 0;
+                                                    while ($i < 31) {
+                                                        $i++; ?>
+                                                        <option <?php if ($monster['start_dd'] == $i) {
+                                                            echo 'selected';
+                                                        } ?> value="<?= $i ?>">
+                                                            <?= $i ?>
+                                                        </option>
+                                                    <?php } ?>
+                                                </select>
+                                                �
+                                                <select name="bot_smm" id="bot_smm">
+                                                    <option value="-1">&bull; �����</option>
+                                                    <?php $i = 0;
+                                                    while ($i < 12) {
+                                                        $i++; ?>
+                                                        <option <?php if ($monster['start_mm'] == $i) {
+                                                            echo 'selected';
+                                                        } ?> value="<?= $i ?>"><?= $i ?></option>
+                                                    <?php } ?>
+                                                </select>
+                                                �
+                                                <select name="bot_shh" id="bot_shh">
+                                                    <option value="-1">&bull; ���</option>
+                                                    <?php $i = -1;
+                                                    while ($i < 23) {
+                                                        $i++; ?>
+                                                        <option <?php if ($monster['start_hh'] == $i) {
+                                                            echo 'selected';
+                                                        } ?> value="<?= $i ?>"><?= $i ?></option>
+                                                    <?php } ?>
+                                                </select>
+                                                ���
+                                                <select name="bot_smin" id="bot_smin">
+                                                    <option value="-1">&bull; ���</option>
+                                                    <?php $i = -1;
+                                                    while ($i < 58) {
+                                                        $i++; ?>
+                                                        <option <?php if ($monster['start_min'] == $i) {
+                                                            echo 'selected';
+                                                        } ?> value="<?= $i ?>"><?= $i ?></option>
+                                                    <?php } ?>
+                                                </select>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>��������, &nbsp; &nbsp;��
+                                                <select name="bot_bday" id="bot_bday">
+                                                    <option value="-1">&bull; ���� ������</option>
+                                                    <option <?php if ($monster['back_day'] == 1) {
+                                                        echo 'selected';
+                                                    } ?> value="1">�����������
+                                                    </option>
+                                                    <option <?php if ($monster['back_day'] == 2) {
+                                                        echo 'selected';
+                                                    } ?> value="2">�������
+                                                    </option>
+                                                    <option <?php if ($monster['back_day'] == 3) {
+                                                        echo 'selected';
+                                                    } ?> value="3">�����
+                                                    </option>
+                                                    <option <?php if ($monster['back_day'] == 4) {
+                                                        echo 'selected';
+                                                    } ?> value="4">�������
+                                                    </option>
+                                                    <option <?php if ($monster['back_day'] == 5) {
+                                                        echo 'selected';
+                                                    } ?> value="5">�������
+                                                    </option>
+                                                    <option <?php if ($monster['back_day'] == 6) {
+                                                        echo 'selected';
+                                                    } ?> value="6">�������
+                                                    </option>
+                                                    <option <?php if ($monster['back_day'] == 7) {
+                                                        echo 'selected';
+                                                    } ?> value="7">�����������
+                                                    </option>
+                                                </select>
+                                                �
+
+                                                <select name="bot_bdd" id="bot_bdd">
+                                                    <option value="-1">&bull; ����</option>
+                                                    <?php $i = 0;
+                                                    while ($i < 31) {
+                                                        $i++; ?>
+                                                        <option <?php if ($monster['back_dd'] == $i) {
+                                                            echo 'selected';
+                                                        } ?> value="<?= $i ?>">
+                                                            <?= $i ?>
+                                                        </option>
+                                                    <?php } ?>
+                                                </select>
+                                                �
+                                                <select name="bot_bmm" id="bot_bmm">
+                                                    <option value="-1">&bull; �����</option>
+                                                    <?php $i = 0;
+                                                    while ($i < 12) {
+                                                        $i++; ?>
+                                                        <option <?php if ($monster['back_mm'] == $i) {
+                                                            echo 'selected';
+                                                        } ?> value="<?= $i ?>"><?= $i ?></option>
+                                                    <?php } ?>
+                                                </select>
+                                                �
+                                                <select name="bot_bhh" id="bot_bhh">
+                                                    <option value="-1">&bull; ���</option>
+                                                    <?php $i = -1;
+                                                    while ($i < 23) {
+                                                        $i++; ?>
+                                                        <option <?php if ($monster['back_hh'] == $i) {
+                                                            echo 'selected';
+                                                        } ?> value="<?= $i ?>"><?= $i ?></option>
+                                                    <?php } ?>
+                                                </select>
+                                                ���
+                                                <select name="bot_bmin" id="bot_bmin">
+                                                    <option value="-1">&bull; ���</option>
+                                                    <?php $i = -1;
+                                                    while ($i < 58) {
+                                                        $i++; ?>
+                                                        <option <?php if ($monster['back_min'] == $i) {
+                                                            echo 'selected';
+                                                        } ?> value="<?= $i ?>"><?= $i ?></option>
+                                                    <?php } ?>
+                                                </select></td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <div align="left"
+                                                     style="height:1px; width:300px; background-color:#999999; margin:3px;"></div>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>����� ��������� (����� ���� <b>{b}</b>, ������ ������� <b>{u}</b>):</td>
+                                        </tr>
+                                        <tr>
+                                            <td><input value="<?= $monster['start_text'] ?>" name="bot_stext"
+                                                       type="text" id="bot_stext" size="100" maxlength="250"></td>
+                                        </tr>
+                                        <tr>
+                                            <td>����� ������������:</td>
+                                        </tr>
+                                        <tr>
+                                            <td><input value="<?= $monster['back_text'] ?>" name="bot_btext" type="text"
+                                                       id="bot_btext" size="100" maxlength="250"></td>
+                                        </tr>
+                                        <tr>
+                                            <td>����� ������ ������:</td>
+                                        </tr>
+                                        <tr>
+                                            <td><input value="<?= $monster['win_text'] ?>" name="bot_wintext"
+                                                       type="text" id="bot_wintext" size="100" maxlength="250"></td>
+                                        </tr>
+                                        <tr>
+                                            <td>����� ��������� ������:</td>
+                                        </tr>
+                                        <tr>
+                                            <td><input value="<?= $monster['lose_text'] ?>" name="bot_losetext"
+                                                       type="text" id="bot_losetext" size="100" maxlength="250"></td>
+                                        </tr>
+                                        <tr>
+                                            <td>����� ������:</td>
+                                        </tr>
+                                        <tr>
+                                            <td><input value="<?= $monster['nich_text'] ?>" name="bot_nichtext"
+                                                       type="text" id="bot_nichtext" size="100" maxlength="250"></td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <div align="left"
+                                                     style="height:1px; width:300px; background-color:#999999; margin:3px;"></div>
+                                                <b>������� (������ ������):</b></td>
+                                        </tr>
+                                        <tr>
+                                            <td>��.:</td>
+                                        </tr>
+                                        <tr>
+                                            <td><input value="<?= $monster['win_money1'] ?>" name="bot_winmoney1"
+                                                       type="text" id="bot_winmoney1" size="100" maxlength="17"></td>
+                                        </tr>
+                                        <tr>
+                                            <td>���.:</td>
+                                        </tr>
+                                        <tr>
+                                            <td><input value="<?= $monster['win_money2'] ?>" name="bot_winmoney2"
+                                                       type="text" id="bot_winmoney2" size="100" maxlength="10"></td>
+                                        </tr>
+                                        <tr>
+                                            <td>���� (�� 100% �� �������):</td>
+                                        </tr>
+                                        <tr>
+                                            <td><input value="<?= $monster['win_exp'] ?>" name="bot_winexp" type="text"
+                                                       id="bot_winexp" size="100" maxlength="17"></td>
+                                        </tr>
+                                        <tr>
+                                            <td>�������� (id@kolvo@data, ...):</td>
+                                        </tr>
+                                        <tr>
+                                            <td><input value="<?= $monster['win_itm'] ?>" name="bot_winitm" type="text"
+                                                       id="bot_winitm" size="100" maxlength="500"></td>
+                                        </tr>
+                                        <tr>
+                                            <td>������:</td>
+                                        </tr>
+                                        <tr>
+                                            <td><input value="<?= $monster['win_eff'] ?>" name="bot_wineff" type="text"
+                                                       id="bot_wineff" size="100" maxlength="500"></td>
+                                        </tr>
+                                        <tr>
+                                            <td>�������:</td>
+                                        </tr>
+                                        <tr>
+                                            <td><input value="<?= $monster['win_ico'] ?>" name="bot_winico" type="text"
+                                                       id="bot_winico" size="100" maxlength="500"></td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <div align="left"
+                                                     style="height:1px; width:300px; background-color:#999999; margin:3px;"></div>
+                                                <b>������� (��������� ������):</b></td>
+                                        </tr>
+                                        <tr>
+                                            <td>��.:</td>
+                                        </tr>
+                                        <tr>
+                                            <td><input value="<?= $monster['lose_money1'] ?>" name="bot_losemoney1"
+                                                       type="text" id="bot_losemoney1" size="100" maxlength="10"></td>
+                                        </tr>
+                                        <tr>
+                                            <td>���.:</td>
+                                        </tr>
+                                        <tr>
+                                            <td><input value="<?= $monster['lose_money2'] ?>" name="bot_losemoney2"
+                                                       type="text" id="bot_losemoney2" size="100" maxlength="10"></td>
+                                        </tr>
+                                        <tr>
+                                            <td>����:</td>
+                                        </tr>
+                                        <tr>
+                                            <td><input value="<?= $monster['lose_exp'] ?>" name="bot_loseexp"
+                                                       type="text" id="bot_loseexp" size="100" maxlength="17"></td>
+                                        </tr>
+                                        <tr>
+                                            <td>��������:</td>
+                                        </tr>
+                                        <tr>
+                                            <td><input value="<?= $monster['lose_itm'] ?>" name="bot_loseitm"
+                                                       type="text" id="bot_loseitm" size="100" maxlength="500"></td>
+                                        </tr>
+                                        <tr>
+                                            <td>������:</td>
+                                        </tr>
+                                        <tr>
+                                            <td><input value="<?= $monster['lose_eff'] ?>" name="bot_loseeff"
+                                                       type="text" id="bot_loseeff" size="100" maxlength="500"></td>
+                                        </tr>
+                                        <tr>
+                                            <td>�������:</td>
+                                        </tr>
+                                        <tr>
+                                            <td><input value="<?= $monster['lose_ico'] ?>" name="bot_loseico"
+                                                       type="text" id="bot_loseico" size="100" maxlength="500"></td>
+                                        </tr>
+                                    </table>
+                                    <div style="padding-left:120px;">
+                                        <input type="submit" value="���������"/>
+                                    </div>
+                                    <br><br>
+                                </form>
+                                <div style="height:1px; width:300px; background-color:#999999; margin:3px;"
+                                     align="center">
+                                    <div onClick="location.href='/info/<?= $inf['id'] ?>'"
+                                         style="border:1px solid #999999; cursor:pointer; background-color:#EAEAEA; width:150px;"
+                                         align="center"><small>������</small></div>
+                                </div>
+                                <?php
+                            } else {
+                                ?>
+                                <div style="height:1px; width:300px; background-color:#999999; margin:3px;"
+                                     align="center">
+                                    <div onClick="location.href='/info/<?= $inf['id'] ?>&emonster'"
+                                         style="border:1px solid #999999; cursor:pointer; background-color:#EAEAEA; width:150px;"
+                                         align="center"><small>��������� �������</small></div>
+                                </div>
+                                <?php
+                            }
+                        }
+                        //������ ������� :D
+                        if ($inf['id'] == 1 || $inf['id'] == 15) {
+
+                        } elseif ($inf['no_ip'] != 'trupojor' && (($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 || $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 .= '<font color=green>' . $u->microLogin(
+                                                        $si['id'], 1
+                                                    ) . '</font>, ';
+                                            } else {
+                                                $mults .= $u->microLogin($si['id'], 1) . ', ';
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+
+                            if ($nopal) {
+                                //echo '<h3>�� �� ������ ������������� ���������� �������� �� ������...</h3>';
+                            } 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 '<h3>�������� ����� ��������� ����������...</h3>';
+                            } else {
+                                echo '<br /><br /><div style="color:#828282;">�� ������� �������� ��������� ������ �������:<br /><small><span class=dsc>';
+                                if (!isset($_GET['mod_inf'])) {
+                                    echo '<a href="/info/' . $inf['id'] . '&mod_inf">�������� ������ ����</a>';
+                                } 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']
+                                            ) . '&nbsp;' . $log_w['text'] . ' <br />';
+                                        $i++;
+                                    }
+                                    echo '<a href="/info/' . $inf['id'] . '">������ ������ ����</a>';
+                                }
+                                echo '</small><br>';
+                                //���������� ��� ���������\��������\�������
+                                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'] . '<br />';
+                                    }
+                                    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 '
 							<br />
-							<b style="color:red"><u>������ ��� '.$rang.'</u></b><br />
-							<i>���� ��������: '.$inf['bithday'].'<br />';
-							
-							if($inf['vip']==1) {
-								echo '<font color=red><b>VIP ��������</font></b><br>';
-							}
-							
-							if($u->info['admin'] > 0) {
-								  if( $inf['activ'] == 0 ) {
-									 echo '<font color=green><b>'; 
-								  }
-								  
-								  $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 '<u>E-mail: '.$inf['mail'].'</u> (��������)'; 
-								  }else{
-									 echo 'E-mail: '.$inf['mail'].'';
-								  }
-								  if( $inf['activ'] == 0 ) {
-									  echo ' &nbsp; & &nbsp; '.$inf['send'].'<br />';
-									 echo '</b></font>'; 
-								  }else{
-									 echo '<br />'; 
-								  }
-							}else{
-								  if( $inf['activ'] == 0 ) {
-									 echo '<font color=green><b>�������� �����������</b></font>';  
-								  }else{
-									 echo '<font color=red><b>�������� �� �����������</b></font>'; 
-								  }
-								  echo '<br>';
-							}
-							if( $inf['no_ip'] != 0 ) {
-								$inf['ipReg'] = $inf['no_ip'];
-								$inf['ip'] = $inf['no_ip'];
-							}
-							echo '��������� ����������: '.$inf['ref'].'<br />
-							��������� ��� ������� � ����: '.date('d.m.Y H:i',$inf['online']).'<br />
-							'.$pr['login'].'IP ��� �����������: '.$inf['ipReg'].'<br />';
-							if($inf['no_ip'] == '' || $u->info['admin']>0) {
-								echo 'IP ���������: <b>'.$inf['ip'].'</b>';
-								$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 '<br />'.$auth_w['ip'].' <small><b>('.date('d.m.Y H:i',$auth_w['time']).')</b></small>';
-								}
-							}else{
-								echo 'IP ���������: <b>'.$inf['no_ip'].'</b>';
-							}
-							
-							
-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'
+							<b style="color:red"><u>������ ��� ' . $rang . '</u></b><br />
+							<i>���� ��������: ' . $inf['bithday'] . '<br />';
+
+                                    if ($inf['vip'] == 1) {
+                                        echo '<font color=red><b>VIP ��������</font></b><br>';
+                                    }
+
+                                    if ($u->info['admin'] > 0) {
+                                        if ($inf['activ'] == 0) {
+                                            echo '<font color=green><b>';
+                                        }
+
+                                        $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 '<u>E-mail: ' . $inf['mail'] . '</u> (��������)';
+                                        } else {
+                                            echo 'E-mail: ' . $inf['mail'] . '';
+                                        }
+                                        if ($inf['activ'] == 0) {
+                                            echo ' &nbsp; & &nbsp; ' . $inf['send'] . '<br />';
+                                            echo '</b></font>';
+                                        } else {
+                                            echo '<br />';
+                                        }
+                                    } else {
+                                        if ($inf['activ'] == 0) {
+                                            echo '<font color=green><b>�������� �����������</b></font>';
+                                        } else {
+                                            echo '<font color=red><b>�������� �� �����������</b></font>';
+                                        }
+                                        echo '<br>';
+                                    }
+                                    if ($inf['no_ip'] != 0) {
+                                        $inf['ipReg'] = $inf['no_ip'];
+                                        $inf['ip'] = $inf['no_ip'];
+                                    }
+                                    echo '��������� ����������: ' . $inf['ref'] . '<br />
+							��������� ��� ������� � ����: ' . date('d.m.Y H:i', $inf['online']) . '<br />
+							' . $pr['login'] . 'IP ��� �����������: ' . $inf['ipReg'] . '<br />';
+                                    if ($inf['no_ip'] == '' || $u->info['admin'] > 0) {
+                                        echo 'IP ���������: <b>' . $inf['ip'] . '</b>';
+                                        $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 '<br />' . $auth_w['ip'] . ' <small><b>(' . date(
+                                                    'd.m.Y H:i', $auth_w['time']
+                                                ) . ')</b></small>';
+                                        }
+                                    } else {
+                                        echo 'IP ���������: <b>' . $inf['no_ip'] . '</b>';
+                                    }
+
+
+                                    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 '
 							<br />
-							�������: <b style="color:#0E0F0E">'.user_browser($inf['dateEnter']).'</b><br />
+							�������: <b style="color:#0E0F0E">' . user_browser($inf['dateEnter']) . '</b><br />
 							';
-														
-							if($inf['no_ip'] == '' || $u->info['admin']>0) {
-								if($mults!='' && $inf['admin']==0){
-									$mults = trim($mults,', ');
-									echo '������ ���� ����� �����:  '.$mults.'<br />';
-								}
-							}
-							
-							$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 .= '<br>���� ���.: '.date('d.m.Y H:i',$pl['timereg']).' / ��� ���: '.date('d.m.Y H:i',$pl['online']).' &nbsp; '.$u->microLogin($pl['id'],1).' <small>( '.$pl['ip'].' , '.$pl['ipreg'].' )</small>';
-								$rfs++;
-							}
-							
-							if( $referalos == '' ) {
-								$referalos = '<i>�����������</i>';
-							}
-							echo '<hr><b>�������� �����:</b>'.$referalos.'<hr>';
-							if($u->info['admin']>0)
-							{
-								echo '���. �����������: <small><a href="/info/'.$inf['id'].'&wipe&sd4='.$u->info['nextAct'].'">�������� ��������������</a></small><br>';
-								$on1 = mysql_fetch_array(mysql_query('SELECT `time_all`,`time_today` FROM `online` WHERE `uid` = "'.$inf['id'].'" LIMIT 1'));
-								echo '����� � ������� (�����): '.timeOut($on1['time_all']).'<br>����� � ������� (�������): '.timeOut($on1['time_today']).'<br>';
-							}	
-							if($inf['molch3']<time() && $inf['molch1'] > time())
-							{
-								echo '<small><a href="/info/'.$inf['id'].'&molchMax&sd4='.$u->info['nextAct'].'">��������� ��������� ���������� ��������� � ���������</a></small><br>';
-							}
-							
-							echo'	
-							����: '.$inf['exp'].' <br />
-							����� ���������������� UP-��: '.$inf['ability'].' <br />
-							<b>��������:</b> '.$inf['money'].'<br><b>������������:</b> '.$inf['money2'].'<br><b>�����:</b> <small>'.$u->zuby($inf['money4']).'</small>';
-							$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 .= '<div style="padding:5px;border-bottom:1px solid #AEAEAE;background-color:#efefef;">';
-								}else{
-									$bnk .= '<div style="padding:5px;border-bottom:1px solid #AEAEAE">';
-								}
-								$bnk .= '&nbsp; &bull; <span style="display:inline-block;width:75px;"><small>�</small> '.$pl['id'].'</span>';
-								$bnk .= '<span style="display:inline-block;width:100px;"><small>'.$pl['money1'].' ��.</small></span>';
-								$bnk .= '<span style="display:inline-block;width:100px;"><small>'.$pl['money2'].' ���.</small></span>';
-								if($u->info['admin'] > 0) {
-									$bnk .= '<span style="display:inline-block;"><small>������: '.htmlspecialchars($pl['pass'],NULL,'cp1251').'</small></span>';
-								}
-								if($pl['moneyBuy'] > 0) {
-								  $ds = '<b><i><u>�������� ������� �����������</u></i></b>&nbsp;&nbsp;����� : '.$pl['moneyBuy'].'<br />';
-								}
-								$bmn1 += $pl['money1'];
-								$bmn2 += $pl['money2'];
-								$bnk .= '</div>';
-							}
-							$pk = mysql_fetch_array(mysql_query('SELECT SUM(`ekr`) FROM `pay_operation` WHERE `uid` = "'.$inf['id'].'" AND `good` > 0 LIMIT 1'));
-							echo '<br><b><i><u>�������� ������� �����������</u></i></b>&nbsp;&nbsp;����� : '.$pk[0].' ���<br />';
-							if($bnk != '') {
-								echo '<br><b>���������� �����:</b>'.$bnk.' &nbsp; <small><b>������ (����� � �����):</b> &nbsp; '.$bmn1.' ��. &nbsp; &nbsp; '.$bmn2.' ���.</small><br/>'.$ds;
-							}
-							if($u->info['admin']>0 && $inf['admin']>0) {
-								echo '<br><small>admin: '.$inf['admin'].'</small>';
-							}
-							if($inf['active']!=''){
-							echo '<br><font color=red>��������!���� �������� �� �������� ������ � ���������� �������� ��� ������ �������.</red>';
-							echo '<br><input type=text value="'.$inf['mail'].'">';
-							echo "<br><textarea cols=60 rows=5>������������! �� ����� ���� ������ ��������� � ����� ����! \r\n ��� ��������: ".$inf['login']."  \r\n ������ ��� ���������: https://capitalcity.new-combats.com/bk?active=".$inf['active'].".\r\n\r\n� ���������, �������������!</textarea><br>";
-							}
-							echo '</div>';
-						}
-					}
-				}
-			  ?>
-        <td width="111" align=right valign=top >        
-        <div style="float:right">
-        <table cellspacing=0 cellpadding=0>
-          <tr>
-            <td width="111" style='text-align: center; padding-bottom: 18; '><!-- ������ -->
-                  <img width="100" height="99" title="<? echo $name_zodiak; ?>" style="margin-bottom: 25; padding:5px;" src='https://img.new-combats.com/i/zodiac/<? echo $id_zodiak; ?>.gif' border=0><BR>
-                  <BR>
-              	  
-                    <? if($inf['id'] >= 0) { ?>
-                    
-                    <? }elseif($inf['align']>1 && $inf['align']<2) { ?>
-                  <A href='https://paladins.<? echo $c['host']; ?>/' target='_blank'><img width="100" height="97" style="padding:5px;" src='https://img.new-combats.com/i/flag_light.gif' border=0></A><BR>
-                  <A href='https://paladins.<? echo $c['host']; ?>/' target='_blank'><small>����� �����</small></A>
-                    <? }elseif($inf['align']>=3.01 && $inf['align']<=3.99) { ?>
-                  <A target='_blank' href='https://tarmans.<? echo $c['host']; ?>/'><img width="100" height="97" style="padding:5px;" src='https://img.new-combats.com/i/flag_dark.gif' border=0></A><BR>
-                  <A href='https://tarmans.<? echo $c['host']; ?>/' target='_blank'><small>������</small></A>
-                    <? }elseif($inf['align']>=2 && $inf['align']<3) { ?>
-                  <A target='_blank' href='https://chaos.<? echo $c['host']; ?>/'><img width="100" height="97" style="padding:5px;" src='https://img.new-combats.com/i/flag_haos.gif' border=0></A><BR>
-                  <A href='https://chaos.<? echo $c['host']; ?>/' target='_blank'><small>�������� �����</small></A>
-                    <? }else{ ?>
-                  <A target='_blank' href='https://new-combats.com/news/'> <img width="100" height="97" style="padding:5px;" src='https://img.new-combats.com/i/flag_gray.gif'></a><BR>
-                  <A href='https://new-combats.com/news/' target='_blank'><small>�������</small></A><br>
-                    <? } ?>
-            </td>
-          </tr>
-        </table></div></td>
-      </table>
-      </td>
-  </tr>
+
+                                    if ($inf['no_ip'] == '' || $u->info['admin'] > 0) {
+                                        if ($mults != '' && $inf['admin'] == 0) {
+                                            $mults = trim($mults, ', ');
+                                            echo '������ ���� ����� �����:  ' . $mults . '<br />';
+                                        }
+                                    }
+
+                                    $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 .= '<br>���� ���.: ' . date(
+                                                'd.m.Y H:i', $pl['timereg']
+                                            ) . ' / ��� ���: ' . date(
+                                                'd.m.Y H:i', $pl['online']
+                                            ) . ' &nbsp; ' . $u->microLogin(
+                                                $pl['id'], 1
+                                            ) . ' <small>( ' . $pl['ip'] . ' , ' . $pl['ipreg'] . ' )</small>';
+                                        $rfs++;
+                                    }
+
+                                    if ($referalos == '') {
+                                        $referalos = '<i>�����������</i>';
+                                    }
+                                    echo '<hr><b>�������� �����:</b>' . $referalos . '<hr>';
+                                    if ($u->info['admin'] > 0) {
+                                        echo '���. �����������: <small><a href="/info/' . $inf['id'] . '&wipe&sd4=' . $u->info['nextAct'] . '">�������� ��������������</a></small><br>';
+                                        $on1 = mysql_fetch_array(
+                                            mysql_query(
+                                                'SELECT `time_all`,`time_today` FROM `online` WHERE `uid` = "' . $inf['id'] . '" LIMIT 1'
+                                            )
+                                        );
+                                        echo '����� � ������� (�����): ' . timeOut(
+                                                $on1['time_all']
+                                            ) . '<br>����� � ������� (�������): ' . timeOut(
+                                                $on1['time_today']
+                                            ) . '<br>';
+                                    }
+                                    if ($inf['molch3'] < time() && $inf['molch1'] > time()) {
+                                        echo '<small><a href="/info/' . $inf['id'] . '&molchMax&sd4=' . $u->info['nextAct'] . '">��������� ��������� ���������� ��������� � ���������</a></small><br>';
+                                    }
+
+                                    echo '	
+							����: ' . $inf['exp'] . ' <br />
+							����� ���������������� UP-��: ' . $inf['ability'] . ' <br />
+							<b>��������:</b> ' . $inf['money'] . '<br><b>������������:</b> ' . $inf['money2'] . '<br><b>�����:</b> <small>' . $u->zuby(
+                                            $inf['money4']
+                                        ) . '</small>';
+                                    $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 .= '<div style="padding:5px;border-bottom:1px solid #AEAEAE;background-color:#efefef;">';
+                                        } else {
+                                            $bnk .= '<div style="padding:5px;border-bottom:1px solid #AEAEAE">';
+                                        }
+                                        $bnk .= '&nbsp; &bull; <span style="display:inline-block;width:75px;"><small>�</small> ' . $pl['id'] . '</span>';
+                                        $bnk .= '<span style="display:inline-block;width:100px;"><small>' . $pl['money1'] . ' ��.</small></span>';
+                                        $bnk .= '<span style="display:inline-block;width:100px;"><small>' . $pl['money2'] . ' ���.</small></span>';
+                                        if ($u->info['admin'] > 0) {
+                                            $bnk .= '<span style="display:inline-block;"><small>������: ' . htmlspecialchars(
+                                                    $pl['pass'], null, 'cp1251'
+                                                ) . '</small></span>';
+                                        }
+                                        if ($pl['moneyBuy'] > 0) {
+                                            $ds = '<b><i><u>�������� ������� �����������</u></i></b>&nbsp;&nbsp;����� : ' . $pl['moneyBuy'] . '<br />';
+                                        }
+                                        $bmn1 += $pl['money1'];
+                                        $bmn2 += $pl['money2'];
+                                        $bnk .= '</div>';
+                                    }
+                                    $pk = mysql_fetch_array(
+                                        mysql_query(
+                                            'SELECT SUM(`ekr`) FROM `pay_operation` WHERE `uid` = "' . $inf['id'] . '" AND `good` > 0 LIMIT 1'
+                                        )
+                                    );
+                                    echo '<br><b><i><u>�������� ������� �����������</u></i></b>&nbsp;&nbsp;����� : ' . $pk[0] . ' ���<br />';
+                                    if ($bnk != '') {
+                                        echo '<br><b>���������� �����:</b>' . $bnk . ' &nbsp; <small><b>������ (����� � �����):</b> &nbsp; ' . $bmn1 . ' ��. &nbsp; &nbsp; ' . $bmn2 . ' ���.</small><br/>' . $ds;
+                                    }
+                                    if ($u->info['admin'] > 0 && $inf['admin'] > 0) {
+                                        echo '<br><small>admin: ' . $inf['admin'] . '</small>';
+                                    }
+                                    if ($inf['active'] != '') {
+                                        echo '<br><font color=red>��������!���� �������� �� �������� ������ � ���������� �������� ��� ������ �������.</red>';
+                                        echo '<br><input type=text value="' . $inf['mail'] . '">';
+                                        echo "<br><textarea cols=60 rows=5>������������! �� ����� ���� ������ ��������� � ����� ����! \r\n ��� ��������: " . $inf['login'] . "  \r\n ������ ��� ���������: https://capitalcity.new-combats.com/bk?active=" . $inf['active'] . ".\r\n\r\n� ���������, �������������!</textarea><br>";
+                                    }
+                                    echo '</div>';
+                                }
+                            }
+                        }
+                        ?>
+                    <td width="111" align=right valign=top>
+                        <div style="float:right">
+                            <table cellspacing=0 cellpadding=0>
+                                <tr>
+                                    <td width="111" style='text-align: center; padding-bottom: 18; '><!-- ������ -->
+                                        <img width="100" height="99" title="<?php echo $name_zodiak; ?>"
+                                             style="margin-bottom: 25; padding:5px;"
+                                             src='https://img.new-combats.com/i/zodiac/<?php echo $id_zodiak; ?>.gif'
+                                             border=0><BR>
+                                        <BR>
+
+                                        <?php if ($inf['id'] >= 0) { ?>
+
+                                        <?php } elseif ($inf['align'] > 1 && $inf['align'] < 2) { ?>
+                                            <A href='https://paladins.<?php echo $c['host']; ?>/' target='_blank'><img
+                                                        width="100" height="97" style="padding:5px;"
+                                                        src='https://img.new-combats.com/i/flag_light.gif' border=0></A>
+                                            <BR>
+                                            <A href='https://paladins.<?php echo $c['host']; ?>/' target='_blank'><small>�����
+                                                    �����</small></A>
+                                        <?php } elseif ($inf['align'] >= 3.01 && $inf['align'] <= 3.99) { ?>
+                                            <A target='_blank' href='https://tarmans.<?php echo $c['host']; ?>/'><img
+                                                        width="100" height="97" style="padding:5px;"
+                                                        src='https://img.new-combats.com/i/flag_dark.gif' border=0></A>
+                                            <BR>
+                                            <A href='https://tarmans.<?php echo $c['host']; ?>/' target='_blank'><small>������</small></A>
+                                        <?php } elseif ($inf['align'] >= 2 && $inf['align'] < 3) { ?>
+                                            <A target='_blank' href='https://chaos.<?php echo $c['host']; ?>/'><img
+                                                        width="100" height="97" style="padding:5px;"
+                                                        src='https://img.new-combats.com/i/flag_haos.gif' border=0></A>
+                                            <BR>
+                                            <A href='https://chaos.<?php echo $c['host']; ?>/' target='_blank'><small>��������
+                                                    �����</small></A>
+                                        <?php } else { ?>
+                                            <A target='_blank' href='https://new-combats.com/news/'> <img width="100"
+                                                                                                          height="97"
+                                                                                                          style="padding:5px;"
+                                                                                                          src='https://img.new-combats.com/i/flag_gray.gif'></a>
+                                            <BR>
+                                            <A href='https://new-combats.com/news/'
+                                               target='_blank'><small>�������</small></A><br>
+                                        <?php } ?>
+                                    </td>
+                                </tr>
+                            </table>
+                        </div>
+                    </td>
+            </table>
+        </td>
+    </tr>
 </table>
-<?
+<?php
 $moder = 0;
-if( $u->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) {
-?>
-<hr>
-<H3 align="center" style="color:#8f0000">��������� �� ���������� 8 ������</H3>
-<?
-$inf['info_delete'] = time()+86400;
-}elseif($inf['info_delete']!=0)
+if ($inf['level'] < 8 && $inf['admin'] == 0 && $u->info['admin'] == 0 && $moder == 0) {
+    ?>
+    <hr>
+    <H3 align="center" style="color:#8f0000">��������� �� ���������� 8 ������</H3>
+    <?php
+    $inf['info_delete'] = time() + 86400;
+} elseif ($inf['info_delete'] != 0) {
+    ?>
+    <H3 align="center" style="color:#8f0000">�������� ��������� <?php if ($inf['info_delete'] > 1) {
+            echo '�� ' . date('d.m.Y H:i', $inf['info_delete']) . '.';
+        } else {
+            echo '.';
+        } ?></H3>
+    <?php
+    if ($u->info['align'] > 1 && $u->info['align'] < 2 || $u->info['align'] > 3 && $u->info['align'] < 4 || $u->info['admin'] > 0) {
+        echo '<br><small style="color:grey;">';
+    }
+}
+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))
 {
 ?>
-<H3 align="center" style="color:#8f0000">�������� ��������� <? if($inf['info_delete']>1){ echo '�� '.date('d.m.Y H:i',$inf['info_delete']).'.'; }else{ echo '.'; } ?></H3>
-<?
-	if($u->info['align']>1 && $u->info['align']<2 || $u->info['align']>3 && $u->info['align']<4 || $u->info['admin']>0)
-	{
-		echo '<br><small style="color:grey;">';
-	}
-}
-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))
-{
-?> 
-<div style="line-height:11pt;"> 
-<hr style="border-color:#999999;">
-<? if($inf['info_delete']==0){ ?><H3 align="center" style="color:#8f0000">�������� ������</H3><? } ?>
-<?
-if($inf['name'] != '') {
-?>
-<b style="color:#444">���:</b> <? echo $inf['name']; ?><BR><? } ?>
-<b style="color:#444">���:</b>
-<? $sex[0] = '�������'; $sex[1] = '�������'; echo $sex[$inf['sex']]; ?><BR>
-<? if($inf['city_real']!=''){ ?>
-<b style="color:#444">�����:</b> <? echo $inf['city_real']; ?><BR><? } ?>
-<? if($inf['icq']>0 && $inf['icq_hide']==0){ echo '<b>ICQ:</b> '.$inf['icq'].'<br>'; } ?>
-<? if($inf['skype']!='' && $inf['skype_hide']==0){ echo '<b>Skype:</b> '.$inf['skype'].'<br>'; } ?>
-<? if(isset($inf['homepage']) && $inf['homepage']!='' && $inf['level']>4) { 
-$url = ((substr($inf['homepage'],0,4)=='https'?"":"https://").$inf['homepage']);
-?>
-<b style="color:#444">�������� ��������:</b> <A HREF="<? echo $url; ?>" target="_blank"><? echo $url; ?></A><BR> <? } ?>
-<? if($inf['deviz']!=''){ ?>
-<b style="color:#444">�����:</b> <code><? echo $inf['deviz']; ?></code><BR>  <? } ?>
-<? if($inf['hobby']!=''){ ?>  
-<b style="color:#444">��������� / �����:</b><BR>
-<? 
-		echo str_replace("\n",'<br>',$inf['hobby']); 
-	}
-	if($inf['info_delete']!=0)
-	{
-		echo '</small>';
-	}
-}
-echo '<br><br><div align="right">'.$c['counters_noFrm'].'</div>';
-?>
+<div style="line-height:11pt;">
+    <hr style="border-color:#999999;">
+    <?php if ($inf['info_delete'] == 0) { ?><H3 align="center" style="color:#8f0000">�������� ������</H3><?php } ?>
+    <?php
+    if ($inf['name'] != '') {
+        ?>
+        <b style="color:#444">���:</b> <?php echo $inf['name']; ?><BR><?php } ?>
+    <b style="color:#444">���:</b>
+    <?php $sex[0] = '�������';
+    $sex[1] = '�������';
+    echo $sex[$inf['sex']]; ?><BR>
+    <?php if ($inf['city_real'] != '') { ?>
+        <b style="color:#444">�����:</b> <?php echo $inf['city_real']; ?><BR><?php } ?>
+    <?php if ($inf['icq'] > 0 && $inf['icq_hide'] == 0) {
+        echo '<b>ICQ:</b> ' . $inf['icq'] . '<br>';
+    } ?>
+    <?php if ($inf['skype'] != '' && $inf['skype_hide'] == 0) {
+        echo '<b>Skype:</b> ' . $inf['skype'] . '<br>';
+    } ?>
+    <?php if (isset($inf['homepage']) && $inf['homepage'] != '' && $inf['level'] > 4) {
+        $url = ((substr($inf['homepage'], 0, 4) == 'https' ? "" : "https://") . $inf['homepage']);
+        ?>
+        <b style="color:#444">�������� ��������:</b> <A HREF="<?php echo $url; ?>" target="_blank"><?php echo $url; ?></A>
+        <BR> <?php } ?>
+    <?php if ($inf['deviz'] != '') { ?>
+        <b style="color:#444">�����:</b> <code><?php echo $inf['deviz']; ?></code><BR>  <?php } ?>
+    <?php if ($inf['hobby'] != '') { ?>
+        <b style="color:#444">��������� / �����:</b><BR>
+        <?php
+        echo str_replace("\n", '<br>', $inf['hobby']);
+    }
+    if ($inf['info_delete'] != 0) {
+        echo '</small>';
+    }
+    }
+    echo '<br><br><div align="right">' . $c['counters_noFrm'] . '</div>';
+    ?>
 </div>
 <div align="right"><br>
-<!-- ����� &copy; <?=date('Y')?>, �www.new-combats.com� &nbsp; &nbsp; --></div>
-<br /><br />
+    <!-- ����� &copy; <?= date('Y') ?>, �www.new-combats.com� &nbsp; &nbsp; --></div>
+<br/><br/>
 </body>
 </html>
diff --git a/info.php b/info.php
deleted file mode 100644
index 9c2c6a98..00000000
--- a/info.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<meta charset="UTF-8">
-
-<?
-phpinfo(); 
-?>
-
diff --git a/infoPHP.php b/infoPHP.php
deleted file mode 100644
index eb31727b..00000000
--- a/infoPHP.php
+++ /dev/null
@@ -1 +0,0 @@
-<?phpinfo();?>
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 @@
 <?php
+# Admin Only Area
 /*
 
 	���� ��� ��������� ������.
@@ -6,25 +7,27 @@
 
 */
 
-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/bot.logic.php');
+$u = User::start();
 
-if( $u->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('<script>window.close();</script>');
-		}
-		echo '<form method="post" action="item_edit_data.php?edit_item_data='.$itm['items_id'].'"><b>����� ��������: '.$itm['items_id'].'</b><br><textarea name="newdata" rows="20" cols="100">'.$itm['data'].'</textarea><br><input type="submit" value="���������"></form>';
-	}
-}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('<script>window.close();</script>');
+    }
+    echo '<form method="post" action="item_edit_data.php?edit_item_data=' . $itm['items_id'] . '"><b>����� ��������: ' . $itm['items_id'] . '</b><br><textarea name="newdata" rows="20" cols="100">' . $itm['data'] . '</textarea><br><input type="submit" value="���������"></form>';
 }
-	
-?>
\ 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 @@
 <?php
+# Admin Only Area
 /*
 
 	���� ��� ��������� ������.
@@ -6,458 +7,469 @@
 
 */
 
-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();
 
 
-if( $u->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('<font color=red><b>'.$error.'</b></font>');
+			"' . 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('<font color=red><b>' . $error . '</b></font>');
 }
 
 
-	//�������� ���������
+//�������� ���������
 ?>
 <!DOCTYPE html>
-<html xmlns="https://www.w3.org/1999/xhtml"><head>
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
-<title>�������� ���������</title>
-<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
-<script>
-var et = {
-	is_par:[
-	<?
-	$html = ''; $html2 = '';
-	$i = 0;
-	$is_key = array_keys($u->is);
-	while( $i < count($is_key) ) {
-		$html  .= ',"'.$is_key[$i].'"';
-		$html2 .= ',"'.$is_key[$i].'":"'.$u->is[$is_key[$i]].'"';
-		$i++;
-	}
-	echo ltrim($html,',');	
-	?>
-	],	is_name:{
-	<?=ltrim($html2,',')?>
-	},
-	data:{
-		img:'w/w10.gif',
-		name:'�������� ������ ��������'
-	},
-	complData:function() {
-		var html = '';
-		
-		//�������
-		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++;
-			}
-		}
+<html xmlns="https://www.w3.org/1999/xhtml">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"/>
+    <title>�������� ���������</title>
+    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
+    <script>
+        var et = {
+            is_par: [
+                <?
+                $html = ''; $html2 = '';
+                $i = 0;
+                $is_key = array_keys($u->is);
+                while ($i < count($is_key)) {
+                    $html .= ',"' . $is_key[$i] . '"';
+                    $html2 .= ',"' . $is_key[$i] . '":"' . $u->is[$is_key[$i]] . '"';
+                    $i++;
+                }
+                echo ltrim($html, ',');
+                ?>
+            ], is_name: {
+                <?=ltrim($html2, ',')?>
+            },
+            data: {
+                img: 'w/w10.gif',
+                name: '�������� ������ ��������'
+            },
+            complData: function () {
+                var html = '';
 
-		$('#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 += '<select id="par_'+id+'_'+this.it_data_pr[id]+'" name="par_'+id+'_'+this.it_data_pr[id]+'">';
-		var i = 0;
-		while( i <= this.is_par.length ) {
-			if( this.is_par[i] != undefined ) {
-				html += '<option value="'+this.is_par[i]+'">'+this.is_name[this.is_par[i]]+'</option>';
-			}
-			i++;
-		}
-		html += '</select><input id="val_'+id+'_'+this.it_data_pr[id]+'" name="val_'+id+'_'+this.it_data_pr[id]+'" type="text" value="" >';
-		
-		html = '<div id="new_par_'+id+'_'+this.it_data_pr[id]+'"> &nbsp; <a href="javascript:et.delpar(\''+id+'\','+this.it_data_pr[id]+')">&nbsp; x &nbsp;</a> &nbsp; ' + html + '</div>';
-		$('#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 += '<img src="https://img.new-combats.com/i/items/' + this.data.img + '">';
-		
-		//������ �����
-		html_r = '<a href="#">' + this.data.name + '</a>';
-		
-		//��������
-		html = '<table style="border:#A5A5A5 1px solid;" width="100%" border="0" cellspacing="0" cellpadding="0">'+
-					'<tr>'+
-						'<td valign="top">' + 
-						'<table width="100%" border="0" cellspacing="0" cellpadding="0">'+
-						  '<tr>'+
-							'<td width="20%" align="center" style="border-right:#A5A5A5 1px solid; padding:5px;">'+html_l+'</td>'+
-							'<td valign="top" align="left" style="padding-left:3px; padding-bottom:3px; padding-top:7px;">'+html_r+'</td>'+
-						  '</tr>'+
-						'</table>'+
-						'</td>'+
-					'</tr>'+
-				'</table>';
-		
-		$('#etitm').html( html );
-	}
-};
-</script>
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
+                //�������
+                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 += '<select id="par_' + id + '_' + this.it_data_pr[id] + '" name="par_' + id + '_' + this.it_data_pr[id] + '">';
+                var i = 0;
+                while (i <= this.is_par.length) {
+                    if (this.is_par[i] != undefined) {
+                        html += '<option value="' + this.is_par[i] + '">' + this.is_name[this.is_par[i]] + '</option>';
+                    }
+                    i++;
+                }
+                html += '</select><input id="val_' + id + '_' + this.it_data_pr[id] + '" name="val_' + id + '_' + this.it_data_pr[id] + '" type="text" value="" >';
+
+                html = '<div id="new_par_' + id + '_' + this.it_data_pr[id] + '"> &nbsp; <a href="javascript:et.delpar(\'' + id + '\',' + this.it_data_pr[id] + ')">&nbsp; x &nbsp;</a> &nbsp; ' + html + '</div>';
+                $('#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 += '<img src="https://img.new-combats.com/i/items/' + this.data.img + '">';
+
+                //������ �����
+                html_r = '<a href="#">' + this.data.name + '</a>';
+
+                //��������
+                html = '<table style="border:#A5A5A5 1px solid;" width="100%" border="0" cellspacing="0" cellpadding="0">' +
+                    '<tr>' +
+                    '<td valign="top">' +
+                    '<table width="100%" border="0" cellspacing="0" cellpadding="0">' +
+                    '<tr>' +
+                    '<td width="20%" align="center" style="border-right:#A5A5A5 1px solid; padding:5px;">' + html_l + '</td>' +
+                    '<td valign="top" align="left" style="padding-left:3px; padding-bottom:3px; padding-top:7px;">' + html_r + '</td>' +
+                    '</tr>' +
+                    '</table>' +
+                    '</td>' +
+                    '</tr>' +
+                    '</table>';
+
+                $('#etitm').html(html);
+            }
+        };
+    </script>
+    <link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
 </head>
 
 <body>
 <table width="100%" border="0" cellspacing="0" cellpadding="10">
-  <tr>
-    <td width="50%">
-    <!-- loading img -->
-    <table width="100%" border="0" cellspacing="0" cellpadding="10">
-      <tr>
-        <td width="50" align="center" valign="top">&nbsp;
-        
+    <tr>
+        <td width="50%">
+            <!-- loading img -->
+            <table width="100%" border="0" cellspacing="0" cellpadding="10">
+                <tr>
+                    <td width="50" align="center" valign="top">&nbsp;
+
+                    </td>
+                    <td valign="top">
+                        <form method="post" action="items_editor.php" target="F2">
+                            <table width="100%" border="0" cellspacing="0" cellpadding="5">
+                                <tr>
+                                    <td width="200" bgcolor="#FFCCCC">��������</td>
+                                    <td bgcolor="#FFCCCC"><input style="width:100%" type="text" name="it_name"
+                                                                 id="it_name"></td>
+                                </tr>
+                                <tr>
+                                    <td>�����������</td>
+                                    <td><input style="width:100%" type="text" name="it_img" id="it_img"></td>
+                                </tr>
+                                <tr>
+                                    <td bgcolor="#FFCCCC">���</td>
+                                    <td bgcolor="#FFCCCC"><label for="it_type"></label>
+                                        <select name="it_type" id="it_type">
+                                            <option value="0">�������� ���</option>
+                                            <option value="1">����</option>
+                                            <option value="2">�����</option>
+                                            <option value="3">������</option>
+                                            <option value="4">�������</option>
+                                            <option value="5">������ �����</option>
+                                            <option value="6">������� �����</option>
+                                            <option value="7">����</option>
+                                            <option value="8">����</option>
+                                            <option value="9">������</option>
+                                            <option value="10">������</option>
+                                            <option value="11">������</option>
+                                            <option value="12">��������</option>
+                                            <option value="13">���</option>
+                                            <option value="14">������</option>
+                                            <option value="15">�������</option>
+                                            <option value="16">������� ��� ��������</option>
+                                            <option value="17">������� ��� �����</option>
+                                            <option value="18">��� \ ������</option>
+                                            <option value="19">����� \ ������</option>
+                                            <option value="20">����� \ ������</option>
+                                            <option value="21">��� \ ������</option>
+                                            <option value="22">���������� �����</option>
+                                            <option value="23">���</option>
+                                            <option value="24">�������</option>
+                                            <option value="25">���������� \ �������</option>
+                                            <option value="26">�������</option>
+                                            <option value="27">����������� ������</option>
+                                            <option value="28">����� \ ������ \ ����</option>
+                                            <option value="29">��������</option>
+                                            <option value="30">�������</option>
+                                            <option value="31">����</option>
+                                            <option value="32">������</option>
+                                            <option value="33">�����</option>
+                                            <option value="34">������</option>
+                                            <!--<option value="35">�����</option>-->
+                                            <option value="36">��������</option>
+                                            <option value="37">��������</option>
+                                            <option value="38">�������</option>
+                                            <option value="39">������� (������� ��������)</option>
+                                            <option value="40">������� �����</option>
+                                            <option value="41">�����������</option>
+                                            <option value="42">�����</option>
+                                            <option value="43">���� �����</option>
+                                            <option value="44">��������� (� �������)</option>
+                                            <option value="45">�����</option>
+                                            <option value="46">�������</option>
+                                            <option value="47">�������� 1</option>
+                                            <option value="48">�������� 2 (���������)</option>
+                                            <option value="49">���� ��� ���������</option>
+                                            <option value="60">������</option>
+                                            <option value="61">���</option>
+                                            <option value="62">�����</option>
+                                            <option value="63">��������</option>
+                                        </select></td>
+                                </tr>
+                                <tr>
+                                    <td>�����</td>
+                                    <td><input style="width:100%" type="text" name="it_massa" id="it_massa"></td>
+                                </tr>
+                                <tr>
+                                    <td>������</td>
+                                    <td><input name="it_sudba" type="checkbox" id="it_sudba" value="1"></td>
+                                </tr>
+                                <tr>
+                                    <td>��������</td>
+                                    <td><input name="it_art2" type="checkbox" id="it_art3" value="1"></td>
+                                </tr>
+                                <tr>
+                                    <td>���������</td>
+                                    <td><input name="it_2h" type="checkbox" id="it_art4" value="1"></td>
+                                </tr>
+                                <tr>
+                                    <td>� ��� ����</td>
+                                    <td><input name="it_2too2" type="checkbox" id="it_2too3" value="1"></td>
+                                </tr>
+                                <tr>
+                                    <td>���� (��)</td>
+                                    <td><input style="width:100%" type="text" name="it_price1" id="it_price1"></td>
+                                </tr>
+                                <tr>
+                                    <td>���� (���)</td>
+                                    <td><input style="width:100%" type="text" name="it_price2" id="it_price2"></td>
+                                </tr>
+                                <tr>
+                                    <td>�������������</td>
+                                    <td><input style="width:100%" type="text" name="it_iznos" id="it_iznos"></td>
+                                </tr>
+                                <tr>
+                                    <td bgcolor="#FFCCCC">����</td>
+                                    <td bgcolor="#FFCCCC"><select name="it_slot" id="it_slot">
+                                            <option value="0">�� ����������</option>
+                                            <option value="1">����</option>
+                                            <option value="2">������</option>
+                                            <option value="3">������ (������ ����)</option>
+                                            <option value="4">������</option>
+                                            <option value="5">�����</option>
+                                            <option value="6">����</option>
+                                            <option value="7">����</option>
+                                            <option value="8">������</option>
+                                            <option value="9">������</option>
+                                            <option value="10">������</option>
+                                            <option value="13">��������</option>
+                                            <option value="14">������ \ ��� (����� ����)</option>
+                                            <option value="16">������</option>
+                                            <option value="17">�������</option>
+                                            <option value="18">����</option>
+                                            <option value="40">��������</option>
+                                            <option value="51">�����</option>
+                                            <option value="52">�����</option>
+                                            <option value="53">������</option>
+                                            <option value="55">����������� ������</option>
+                                            <option value="56">����� ������</option>
+                                            <option value="59">���� �����</option>
+                                        </select></td>
+                                </tr>
+                                <tr>
+                                    <td>������ ���������</td>
+                                    <td><select name="it_inRazdel" id="it_inRazdel">
+                                            <option value="1">��������������</option>
+                                            <option value="2">��������</option>
+                                            <option value="3">��������</option>
+                                            <option value="6">����</option>
+                                            <option value="4">������</option>
+                                        </select></td>
+                                </tr>
+                                <tr>
+                                    <td>����������</td>
+                                    <td><input style="width:100%" type="text" name="it_info" id="it_info"></td>
+                                </tr>
+                                <tr>
+                                    <td bgcolor="#FFCCCC">�����������</td>
+                                    <td bgcolor="#FFCCCC"><input style="width:100%" type="text" name="it_group_max"
+                                                                 id="it_group_max"></td>
+                                </tr>
+                                <tr>
+                                    <td>���������</td>
+                                    <td><input style="width:100%" type="text" name="it_geni" id="it_geni"></td>
+                                </tr>
+                                <tr>
+                                    <td>���� �������� (���.)</td>
+                                    <td><input style="width:100%" type="text" name="it_srok" id="it_srok"></td>
+                                </tr>
+                                <tr>
+                                    <td>����. ����� (��������)</td>
+                                    <td><input style="width:100%" type="text" name="it_max_text" id="it_max_text"></td>
+                                </tr>
+                                <tr>
+                                    <td bgcolor="#FFFFCC">���.����</td>
+                                    <td bgcolor="#FFFFCC"><input style="width:100%" type="text" name="it_ndata"
+                                                                 id="it_ndata"></td>
+                                </tr>
+                                <tr>
+                                    <td align="center" valign="middle">ITEMS_MAIN_DATA:</td>
+                                    <td><textarea name="it_data_value" cols="100" rows="10"
+                                                  id="it_data_value"></textarea></td>
+                                </tr>
+                                <tr>
+                                    <td>
+                                        <iframe id="F2" width="200" height="30" name="F2" frameborder="0"
+                                                marginheight="0" marginwidth="0"></iframe>
+                                    </td>
+                                    <td><input type="submit" name="button" id="button"
+                                               value=" ��������� ������� � ���� "></td>
+                                </tr>
+                                <tr>
+                                    <td>&nbsp;</td>
+                                    <td>&nbsp;</td>
+                                </tr>
+                            </table>
+                        </form>
+                    </td>
+                </tr>
+            </table>
+            <!-- loading img -->
         </td>
-        <td valign="top">
-        <form method="post" action="items_editor.php" target="F2">
-        <table width="100%" border="0" cellspacing="0" cellpadding="5">
-          <tr>
-            <td width="200" bgcolor="#FFCCCC">��������</td>
-            <td bgcolor="#FFCCCC"><input style="width:100%" type="text" name="it_name" id="it_name"></td>
-          </tr>
-          <tr>
-            <td>�����������</td>
-            <td><input style="width:100%" type="text" name="it_img" id="it_img"></td>
-          </tr>
-          <tr>
-            <td bgcolor="#FFCCCC">���</td>
-            <td bgcolor="#FFCCCC"><label for="it_type"></label>
-              <select name="it_type" id="it_type">
-                <option value="0">�������� ���</option>
-                <option value="1">����</option>
-                <option value="2">�����</option>
-                <option value="3">������</option>
-                <option value="4">�������</option>
-                <option value="5">������ �����</option>
-                <option value="6">������� �����</option>
-                <option value="7">����</option>
-                <option value="8">����</option>
-                <option value="9">������</option>
-                <option value="10">������</option>
-                <option value="11">������</option>
-                <option value="12">��������</option>
-                <option value="13">���</option>
-                <option value="14">������</option>
-                <option value="15">�������</option>
-                <option value="16">������� ��� ��������</option>
-                <option value="17">������� ��� �����</option>
-                <option value="18">��� \ ������</option>
-                <option value="19">����� \ ������</option>
-                <option value="20">����� \ ������</option>
-                <option value="21">��� \ ������</option>
-                <option value="22">���������� �����</option>
-                <option value="23">���</option>
-                <option value="24">�������</option>
-                <option value="25">���������� \ �������</option>
-                <option value="26">�������</option>
-                <option value="27">����������� ������</option>
-                <option value="28">����� \ ������ \ ����</option>
-                <option value="29">��������</option>
-                <option value="30">�������</option>
-                <option value="31">����</option>
-                <option value="32">������</option>
-                <option value="33">�����</option>
-                <option value="34">������</option>
-                <!--<option value="35">�����</option>-->
-                <option value="36">��������</option>
-                <option value="37">��������</option>
-                <option value="38">�������</option>
-                <option value="39">������� (������� ��������)</option>
-                <option value="40">������� �����</option>
-                <option value="41">�����������</option>
-                <option value="42">�����</option>
-                <option value="43">���� �����</option>
-                <option value="44">��������� (� �������)</option>
-                <option value="45">�����</option>
-                <option value="46">�������</option>
-                <option value="47">�������� 1</option>
-                <option value="48">�������� 2 (���������)</option>
-                <option value="49">���� ��� ���������</option>
-                <option value="60">������</option>
-                <option value="61">���</option>
-                <option value="62">�����</option>
-                <option value="63">��������</option>
-              </select></td>
-          </tr>
-          <tr>
-            <td>�����</td>
-            <td><input style="width:100%" type="text" name="it_massa" id="it_massa"></td>
-          </tr>
-          <tr>
-            <td>������</td>
-            <td><input name="it_sudba" type="checkbox" id="it_sudba" value="1"></td>
-          </tr>
-          <tr>
-            <td>��������</td>
-            <td><input name="it_art2" type="checkbox" id="it_art3" value="1"></td>
-          </tr>
-          <tr>
-            <td>���������</td>
-            <td><input name="it_2h" type="checkbox" id="it_art4" value="1"></td>
-          </tr>
-          <tr>
-            <td>� ��� ����</td>
-            <td><input name="it_2too2" type="checkbox" id="it_2too3" value="1"></td>
-          </tr>
-          <tr>
-            <td>���� (��)</td>
-            <td><input style="width:100%" type="text" name="it_price1" id="it_price1"></td>
-          </tr>
-          <tr>
-            <td>���� (���)</td>
-            <td><input style="width:100%" type="text" name="it_price2" id="it_price2"></td>
-          </tr>
-          <tr>
-            <td>�������������</td>
-            <td><input style="width:100%" type="text" name="it_iznos" id="it_iznos"></td>
-          </tr>
-          <tr>
-            <td bgcolor="#FFCCCC">����</td>
-            <td bgcolor="#FFCCCC"><select name="it_slot" id="it_slot">
-              <option value="0">�� ����������</option>
-              <option value="1">����</option>
-              <option value="2">������</option>
-              <option value="3">������ (������ ����)</option>
-              <option value="4">������</option>
-              <option value="5">�����</option>
-              <option value="6">����</option>
-              <option value="7">����</option>
-              <option value="8">������</option>
-              <option value="9">������</option>
-              <option value="10">������</option>
-              <option value="13">��������</option>
-              <option value="14">������ \ ��� (����� ����)</option>
-              <option value="16">������</option>
-              <option value="17">�������</option>
-              <option value="18">����</option>
-              <option value="40">��������</option>
-              <option value="51">�����</option>
-              <option value="52">�����</option>
-              <option value="53">������</option>
-              <option value="55">����������� ������</option>
-              <option value="56">����� ������</option>
-              <option value="59">���� �����</option>
-			  </select></td>
-          </tr>
-          <tr>
-            <td>������ ���������</td>
-            <td><select name="it_inRazdel" id="it_inRazdel">
-              <option value="1">��������������</option>
-              <option value="2">��������</option>
-              <option value="3">��������</option>
-              <option value="6">����</option>
-              <option value="4">������</option>
-            </select></td>
-          </tr>
-          <tr>
-            <td>����������</td>
-            <td><input style="width:100%" type="text" name="it_info" id="it_info"></td>
-          </tr>
-          <tr>
-            <td bgcolor="#FFCCCC">�����������</td>
-            <td bgcolor="#FFCCCC"><input style="width:100%" type="text" name="it_group_max" id="it_group_max"></td>
-          </tr>
-          <tr>
-            <td>���������</td>
-            <td><input style="width:100%" type="text" name="it_geni" id="it_geni"></td>
-          </tr>
-          <tr>
-            <td>���� �������� (���.)</td>
-            <td><input style="width:100%" type="text" name="it_srok" id="it_srok"></td>
-          </tr>
-          <tr>
-            <td>����. ����� (��������)</td>
-            <td><input style="width:100%" type="text" name="it_max_text" id="it_max_text"></td>
-          </tr>
-          <tr>
-            <td bgcolor="#FFFFCC">���.����</td>
-            <td bgcolor="#FFFFCC"><input style="width:100%" type="text" name="it_ndata" id="it_ndata"></td>
-          </tr>
-          <tr>
-            <td align="center" valign="middle">ITEMS_MAIN_DATA:</td>
-            <td><textarea name="it_data_value" cols="100" rows="10" id="it_data_value"></textarea></td>
-          </tr>
-          <tr>
-            <td>
-            <iframe id="F2" width="200" height="30" name="F2" frameborder="0" marginheight="0" marginwidth="0"></iframe>
-            </td>
-            <td><input type="submit" name="button" id="button" value=" ��������� ������� � ���� "></td>
-          </tr>
-          <tr>
-            <td>&nbsp;</td>
-            <td>&nbsp;</td>
-          </tr>
-        </table>
-        </form>
+        <td valign="top" bgcolor="#C8C8C8">
+            <button onClick="et.complData()">������� ����</button>
+            <hr>
+
+            <b>����������: <a href="javascript:et.newpar('tr')">[+]</a></b>
+            <div id="it_data_tr">
+
+            </div>
+
+            <b>��������� ��: <a href="javascript:et.newpar('add')">[+]</a></b>
+            <div id="it_data_add">
+
+            </div>
+
+            <b>��������: <a href="javascript:et.newpar('sv')">[+]</a></b>
+            <div id="it_data_sv">
+
+            </div>
+
+            <b>���������: <a href="javascript:et.newpar('all')">[+]</a></b>
+            <div id="it_data_all">
+
+            </div>
+
+            <hr>
+            &nbsp;
+            <div id="etitm"></div>
         </td>
-      </tr>
-    </table>
-    <!-- loading img -->
-    </td>
-    <td valign="top" bgcolor="#C8C8C8">
-    <button onClick="et.complData()">������� ����</button>
-    <hr>
-    
-    <b>����������: <a href="javascript:et.newpar('tr')">[+]</a></b>
-    <div id="it_data_tr">
-    
-    </div>
-    
-    <b>��������� ��: <a href="javascript:et.newpar('add')">[+]</a></b>
-    <div id="it_data_add">
-    
-    </div>
-    
-    <b>��������: <a href="javascript:et.newpar('sv')">[+]</a></b>
-    <div id="it_data_sv">
-    
-    </div>
-    
-    <b>���������: <a href="javascript:et.newpar('all')">[+]</a></b>
-    <div id="it_data_all">
-    
-    </div>
-    
-    <hr>
-    &nbsp;
-    <div id="etitm"></div>
-    </td>
-  </tr>
-  </table>
+    </tr>
+</table>
 </body>
 </html>
\ No newline at end of file
diff --git a/items_info.php b/items_info.php
index 971fe933..174428e5 100644
--- a/items_info.php
+++ b/items_info.php
@@ -1,10 +1,15 @@
 <?php
-
 define('GAME', time());
 
 require_once('_incl_data/class/__db_connect.php');
 if (isset($_COOKIE['login'])) {
-    $u = mysql_fetch_array(mysql_query('SELECT `id`,`admin` FROM `users` WHERE `login` = "' . mysql_real_escape_string($_COOKIE['login']) . '" AND `pass` = "' . mysql_real_escape_string($_COOKIE['pass']) . '" LIMIT 1'));
+    $u = mysql_fetch_array(
+        mysql_query(
+            'SELECT `id`,`admin` 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['admin'] == 0) {
         $admin = 0;
     } else {
@@ -53,7 +58,7 @@ $rz = [
     ['ring', '������'],                        // 25
     ['necklace', '��������'],                // 26
     ['earring', '������'],                    // 27
-    ['other', '������']                    // 28
+    ['other', '������'],                    // 28
 ];
 
 // ���������� 3� �����������? True - ���������� � ����� ������, False - ������ ���� ����������.
@@ -95,15 +100,23 @@ $rt = [
     62 => 22,
     67 => 28,    // 67 ������
     32 => 22,    // 32 �����������, ���.��������
-    34 => 28    // 34 �����, ������
+    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'));
+    $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)
@@ -162,6 +175,7 @@ function timeOut($ttm)
 
 function lookStats($m)
 {
+    if (empty($m)) return [];
     $ist = [];
     $di = explode('|', $m);
     $i = 0;
@@ -180,436 +194,28 @@ function lookStats($m)
 }
 
 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'));
+    $itd = mysql_fetch_array(
+        mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = ' . mysql_real_escape_string($_GET['id']))
+    );
     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 = mysql_fetch_array(mysql_query('SELECT * FROM `items_main_data` WHERE `items_id` = ' . $itm['id']));
     $itd = lookStats($itd['data']);
 }
 
 $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',
-    ],
+    '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' => '��. ������ �������� ����. �����',
-];
+$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) {
+if (!file_exists('img.new-combats.com/i/encicl/pict_' . $rz[$rt[$itm['type']]][0] . '.jpg')) {
     //subject
     $rz[$rt[$itm['type']]][0] = 'subject';
 }
@@ -623,9 +229,8 @@ if (!isset($rz[$rt[$itm['type']]][1])) {
 <html>
 <head>
     <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
-    <title>���������� ���� | ���������� <?
-        if (isset($itm['id'])) { ?> | <?= $rz[$rt[$itm['type']]][1] ?> | <?= $itm['name'] ?><?
-        } ?></title>
+    <title>���������� ���� |
+        ���������� <? if (isset($itm['id'])) { ?> | <?= $rz[$rt[$itm['type']]][1] ?> | <?= $itm['name'] ?><? } ?></title>
     <link href="/main1.css" rel="stylesheet" type="text/css">
     <style type="text/css">
         .style6 {
@@ -687,8 +292,7 @@ if (!isset($rz[$rt[$itm['type']]][1])) {
         </td>
     </tr>
 </table>
-<?
-if (isset($itm['id'])) { ?>
+<? if (isset($itm['id'])) { ?>
     <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor='#3D3D3B'>
         <tr valign=top>
             <td></td>
@@ -713,9 +317,11 @@ if (isset($itm['id'])) { ?>
                 <h2><?= $itm['name'] ?></h2>
                 <img src="https://img.new-combats.com/i/encicl/ln3.jpg" width="400" height="1">
                 </p>
-                <?
-                if ($img3dShow == false && (file_exists('img.new-combats.com/i/big/3d' . str_replace('.gif', '',
-                                str_replace('.png', '', $itm['img'])) . '.jpg') == true) or $img3dShow == true) { ?>
+                <? if ($img3dShow == false && (file_exists(
+                            'img.new-combats.com/i/big/3d' . str_replace(
+                                '.gif', '', str_replace('.png', '', $itm['img'])
+                            ) . '.jpg'
+                        ) == true) or $img3dShow == true) { ?>
                     <div align="center">
                         <table width="504" border="0" cellspacing="0" cellpadding="0">
                             <tr>
@@ -731,13 +337,18 @@ if (isset($itm['id'])) { ?>
                                 <td width="12" background="https://img.new-combats.com/i/encicl/line_left_13.gif">
                                     &nbsp;
                                 </td>
-                                <td width="480"><img style="display:block" src="<?
-                                    if (file_exists('img.new-combats.com/i/big/3d' . str_replace('.gif', '',
-                                                str_replace('.png', '',
-                                                    $itm['img'])) . '.jpg') == true) { ?>https://img.new-combats.com/i/big/3d<?= str_replace('.gif',
-                                        '', str_replace('.png', '', $itm['img'])) ?>.jpg<?
-                                    } else { ?>https://img.new-combats.com/i/big/back.jpg<?
-                                    } ?>" alt="" width="480" height="360" border=1 id="bigim"></td>
+                                <td width="480"><img style="display:block" src="<? if (file_exists(
+                                            'img.new-combats.com/i/big/3d' . str_replace(
+                                                '.gif', '', str_replace(
+                                                '.png', '', $itm['img']
+                                            )
+                                            ) . '.jpg'
+                                        ) == true) { ?>https://img.new-combats.com/i/big/3d<?= str_replace(
+                                        '.gif', '', str_replace(
+                                        '.png', '', $itm['img']
+                                    )
+                                    ) ?>.jpg<? } else { ?>https://img.new-combats.com/i/big/back.jpg<? } ?>" alt=""
+                                                     width="480" height="360" border=1 id="bigim"></td>
                                 <td width="12" background="https://img.new-combats.com/i/encicl/line_right_13.gif">
                                     &nbsp;
                                 </td>
@@ -754,8 +365,7 @@ if (isset($itm['id'])) { ?>
                             </tr>
                         </table>
                     </div>
-                    <?
-                } ?>
+                <? } ?>
                 <p align="center">&nbsp;</p>
                 <BR>
                 <table width="504" border="0" align=center cellpadding="0" cellspacing="0">
@@ -767,8 +377,7 @@ if (isset($itm['id'])) { ?>
                                     <td width="100%">
                                         <A HREF="?id=<?= $itm['id'] ?>"><?= $itm['name'] ?></A>
                                         <IMG SRC="https://img.new-combats.com/i/align/align0.gif" WIDTH=12 HEIGHT=15>
-                                        <?
-                                        $crd = '';
+                                        <? $crd = '';
                                         if ($admin == 1) {
                                             $crd = '<small><a href="javascript:window.open(\'https://new-combats.com/item_edit_data.php?edit_item_data=' . $itm['id'] . '\',\'winEdi1\',\'width=850,height=400,top=400,left=500,resizable=no,scrollbars=yes,status=no\');">������������� �������</a> </small> &nbsp; &nbsp;';
                                             echo $crd;
@@ -810,7 +419,11 @@ if (isset($itm['id'])) { ?>
 
                                         //����������������� �������� �����:
                                         if ((int)$itm['magic_inci'] > 0) {
-                                            $efi = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . ((int)$itm['magic_inci']) . '" LIMIT 1'));
+                                            $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 '<br>����������������� ��������: ' . timeOut($efi['actionTime']);
                                             }
@@ -1004,7 +617,9 @@ if (isset($itm['id'])) { ?>
                                         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');
+                                            $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'] .= '&nbsp; &nbsp; &bull; <font color="green">' . $itmc['x'] . '</font>: ';
@@ -1070,8 +685,7 @@ if (isset($itm['id'])) { ?>
                                         <BR>
 
 
-                                        <?
-                                        /*
+                                        <? /*
 
 <B>��������� �����������:</B><BR>&bull; �������: 4<BR>&bull; ������������: 16<BR>&bull; ����: 16<BR>
 <B>��������� ��:</B><BR>&bull; ��. ����������� (%): +30<BR>&bull; ��������: +3<BR>&bull; ����: +5<BR>
@@ -1113,8 +727,8 @@ if (isset($itm['id'])) { ?>
             <td width="23" valign=top background="https://new-combats.com/forum_script/img/rightground.jpg">&nbsp;</td>
         </tr>
     </table>
-    <?
-} else {
+<? } else {
+
     $rv = explode('i', $url[2]);
     $rv = (int)$rv[1];
     //
@@ -1122,6 +736,7 @@ if (isset($itm['id'])) { ?>
     $html = '';
     //
     if ($rv >= 0) {
+
         if ($rv == 1) {
             //�������
             $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 26');
@@ -1213,6 +828,7 @@ if (isset($itm['id'])) { ?>
             //������
             $sp = mysql_query('SELECT * FROM `items_main` WHERE `type` = 9');
         }
+
     }
 
 
@@ -1241,9 +857,17 @@ if (isset($itm['id'])) { ?>
                 if ($rv == 0) {
                     echo '�������� ���� �� �������� �����, ����� ���������� ��������<br>';
                 } else {
-                    while ($itm = mysql_fetch_array($sp)) {
+                    if (isset($sp) && is_array($sp)) {
+                        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 = 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']);
 
                         ?><br>
@@ -1298,9 +922,15 @@ if (isset($itm['id'])) { ?>
 
                                                 //����������������� �������� �����:
                                                 if ((int)$itm['magic_inci'] > 0) {
-                                                    $efi = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . ((int)$itm['magic_inci']) . '" LIMIT 1'));
+                                                    $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 '<br>����������������� ��������: ' . timeOut($efi['actionTime']);
+                                                        echo '<br>����������������� ��������: ' . timeOut(
+                                                                $efi['actionTime']
+                                                            );
                                                     }
                                                 }
 
@@ -1492,7 +1122,9 @@ if (isset($itm['id'])) { ?>
                                                 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');
+                                                    $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'] .= '&nbsp; &nbsp; &bull; <font color="green">' . $itmc['x'] . '</font>: ';
@@ -1556,21 +1188,7 @@ if (isset($itm['id'])) { ?>
 
                                                 ?>
                                                 <BR>
-                                                <?
-                                                /*
-
-<B>��������� �����������:</B><BR>&bull; �������: 4<BR>&bull; ������������: 16<BR>&bull; ����: 16<BR>
-<B>��������� ��:</B><BR>&bull; ��. ����������� (%): +30<BR>&bull; ��������: +3<BR>&bull; ����: +5<BR>
-<B>�������� ��������:</B><BR>&bull; ����: 8 - 18<BR>&bull; ��. ������ ����������� (%): 30<BR>&bull; ��. ������������ ����� (%): 50<BR>&bull; ���������� �������� ������: 2<BR>&bull; ���� ������������: +<BR>
-
-<B>�����������:</B><BR>&bull; ������� �����: ����<BR>&bull; ������� �����: ���������<BR>&bull; �������� �����: �����<BR>&bull; ������� �����: ����<BR>
-
-
-
-<small>�������� �������� �� 10�� ������</small><BR>
-
-*/
-                                                ?></td>
+                                                </td>
                                             <td align="center" valign="top" style='padding: 0,2,0,5'><a
                                                         title="<?= $itm['name'] ?>" href="/item/<?= $itm['id'] ?>"><SPAN
                                                             style='background-color: #E0E0E0'><img
@@ -1583,6 +1201,7 @@ if (isset($itm['id'])) { ?>
                         </table>
                         <?
                     }
+                    }
                 }
                 ?>
                 <p align="center">&nbsp;</p>
@@ -1657,8 +1276,7 @@ if (isset($itm['id'])) { ?>
             <td width="23" valign=top background="https://new-combats.com/forum_script/img/rightground.jpg">&nbsp;</td>
         </tr>
     </table>
-    <?
-} ?>
+<? } ?>
 </td>
 <td></td>
 </tr>
diff --git a/js/btl_info.js b/js/btl_info.js
index 38a9f306..16754eeb 100644
--- a/js/btl_info.js
+++ b/js/btl_info.js
@@ -15,7 +15,7 @@ function info_reflesh(id_info,uid,up_info,obraz,hp,hpAll,mp,mpAll,invis,sex,eff,
 		var cmp = 'hp_mp';
 		if(whp<1) chp = 'hp_none';	
 		if(whp>0) chp = 'hp_1'; 
-		if(whp>32) chp = 'hp_2';
+		if(whp>32) chp = 'hp_2'; 
 		if(whp>65) chp = 'hp_3';
 		if(wmp<=0) cmp = 'hp_none';
 		if (mpAll > 0) {
diff --git a/js/gameEngine.js b/js/gameEngine.js
index d7de28d1..45c91bde 100644
--- a/js/gameEngine.js
+++ b/js/gameEngine.js
@@ -19,18 +19,18 @@ var sml = new Array("p001", 18, 18, "p002", 15, 15, "p003", 22, 15, "p004", 15,
     "p115", 43, 35, "p116", 45, 23, "p117", 36, 24, "p118", 51, 35, "p119", 41, 31, "p120", 29, 29,
     "p121", 32, 26, "p122", 40, 25, "p123", 37, 22, "p124", 40, 36, "p125", 38, 33, "p126", 23, 23, "p127", 33, 24, "p128", 30, 20);
 
-var cb_id = 1,cb_date = {},cb_rdate = {},cb_ndate = {},cb_select = 1,ed_select = -1,cb_conf = {1:'100000001110',2:'200010100001',3:'211101010001'};
+var cb_id = 1,cb_date = {},cb_rdate = {},cb_ndate = {},cb_select = 1,ed_select = -1,cb_conf = {1:'100000001110',2:'200010100001',3:'211101010001'}; 
 var nasta = null;
 
 function winframe(id,title,w,h,url) {
     win.add(`${id}winframe`,`${title} &nbsp;`,'',{'d':`<iframe width="${w}" height="${h}" frameborder="0" src="${url}"></iframe>`},0,1,'');
 }   
 
-//������� �����
+//������� ����� 
 var petsel = '';
-function petbuy() {
+function petbuy() { 
 var act = '';
-
+  
 // var r = '';
 
 var r = `<img onclick="petbuySet(1);" id="apet1" title="���. ��������� ��������� ��������" style="cursor:pointer;padding:3px;" src="https://img.new-combats.com/i/items/summon_pet_cat.gif">
diff --git a/js/online.js.new.js b/js/online.js.new.js
index 089fdbe9..63eff17e 100644
--- a/js/online.js.new.js
+++ b/js/online.js.new.js
@@ -12,191 +12,191 @@ NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {
 }
 
 var chat = {
-	key:'',
-	room:'',
-	count:0,
-	time:0,
-	t:null, //timer
-	t2:null, //timer 2
-	t_all:{}, //time molch
-	r:0,
-	g:0,
-	rtime:37,
-	ct:{ '-1':0, '1':15, '2':30, '3':60, '4':300},
-	saveData:null,
-	msg_id:0,
-	nrg:0,
-	nozpros:0,
-	newmsg:0,
-	sound:0,
-	translit:0,
-	filter:0,
-	globalMsg:0,
-	ignoreList:{x:0,nms:[]},
-	citySys:0,
-	inObj:null,
-	efftxt:function(id,txt) {
-		var r = txt;
-		/*if( id == 'fire' ) {
-			r = '<svg viewBox="0 0 600 300"><pattern id="p-fire" viewBox="10 100 186 200" patternUnits="userSpaceOnUse" width="216" height="200" x="-70" y="35"><image xlink:href="img/fire.gif" width="256" height="300"/></pattern><text text-anchor="middle" x="50%" y="50%" dy=".35em" class="text">';
-			r += txt;
-			r += '</text></svg>';
-		}*/
-		return r;
-	},
-	ignore:function(login)
-	{
-		if(this.ignoreList[login]!=undefined)
-		{
-			if($('#ignr_alu').attr('id')!=undefined)
-			{
-				$('#ignr_u_'+this.ignoreList[login]).remove();
-			}
-			delete this.ignoreList.nms[this.ignoreList[login]];
-			delete this.ignoreList[login];	
-			//msg
-			
-		}else{ 
-			this.ignoreList.x++;
-			this.ignoreList[login] = this.ignoreList.x;
-			this.ignoreList.nms[this.ignoreList.x] = login;
-			if($('#ignr_alu').attr('id')!=undefined)
-			{
-				$('#ignr_alu').html($('#ignr_alu').html()+'<div id="ignr_u_'+this.ignoreList.x+'">    <b>'+login+'</b> <a target="_blank" href="https://new-combats.com/info/'+login+'"><img src="https://'+top.c.img+'/i/inf_capitalcity.gif" onMouseOver="top.hi(this,\'<b>���. � '+login+'</b>\',event,5,-2,2,2,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>   <small><a href="javascript:void(0)" onclick="chat.ignorUn('+this.ignoreList.x+')">Clear</a></small>  </div>');
-			}
-			//msg
-			
-		}
-	},
-	getRandom:function(a, b){
-	 
-		return a + ( (b-a) * Math.random() );
-	 
-	},
-	feerverk_id:0,
-	feerverk:function(name) {
-		if( name == 'fw04' ) {
-			var frc = {
-				'name':'fw04',
-				'x':19,
-				'top':this.getRandom(1,35),
-				'left':this.getRandom(0,365),
-				'width':135,
-				'sound':this.getRandom(8,10),
-				'height':99,
-				'zad':3	
-			};
-			frc.left -= 35;
-		}
-		
-		if( frc.name != undefined ) {
-			this.sendSound( frc.sound );
-			var obj = top.frames.main.document.getElementById('frvrks');
-			if( obj != undefined ) {
-				var newhtml = '';
-				var i = 1;
-				while( i <= frc.x ) {
-					newhtml += `<img style="display:none" id="frvanim_${this.feerverk_id}_img${i}" width="${frc.width}" height="${frc.height}" src="https://img.new-combats.com/fw/${frc.name}/${i}.gif">`;
+    key:'',
+    room:'',
+    count:0,
+    time:0,
+    t:null, //timer
+    t2:null, //timer 2
+    t_all:{}, //time molch
+    r:0,
+    g:0,
+    rtime:37,
+    ct:{ '-1':0, '1':15, '2':30, '3':60, '4':300},
+    saveData:null,
+    msg_id:0,
+    nrg:0,
+    nozpros:0,
+    newmsg:0,
+    sound:0,
+    translit:0,
+    filter:0,
+    globalMsg:0,
+    ignoreList:{x:0,nms:[]},
+    citySys:0,
+    inObj:null,
+    efftxt:function(id,txt) {
+        var r = txt;
+        /*if( id == 'fire' ) {
+            r = '<svg viewBox="0 0 600 300"><pattern id="p-fire" viewBox="10 100 186 200" patternUnits="userSpaceOnUse" width="216" height="200" x="-70" y="35"><image xlink:href="img/fire.gif" width="256" height="300"/></pattern><text text-anchor="middle" x="50%" y="50%" dy=".35em" class="text">';
+            r += txt;
+            r += '</text></svg>';
+        }*/
+        return r;
+    },
+    ignore:function(login)
+    {
+        if(this.ignoreList[login]!=undefined)
+        {
+            if($('#ignr_alu').attr('id')!=undefined)
+            {
+                $('#ignr_u_'+this.ignoreList[login]).remove();
+            }
+            delete this.ignoreList.nms[this.ignoreList[login]];
+            delete this.ignoreList[login];
+            //msg
+
+        }else{
+            this.ignoreList.x++;
+            this.ignoreList[login] = this.ignoreList.x;
+            this.ignoreList.nms[this.ignoreList.x] = login;
+            if($('#ignr_alu').attr('id')!=undefined)
+            {
+                $('#ignr_alu').html($('#ignr_alu').html()+'<div id="ignr_u_'+this.ignoreList.x+'">    <b>'+login+'</b> <a target="_blank" href="https://new-combats.com/info/'+login+'"><img src="https://'+top.c.img+'/i/inf_capitalcity.gif" onMouseOver="top.hi(this,\'<b>���. � '+login+'</b>\',event,5,-2,2,2,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>   <small><a href="javascript:void(0)" onclick="chat.ignorUn('+this.ignoreList.x+')">Clear</a></small>  </div>');
+            }
+            //msg
+
+        }
+    },
+    getRandom:function(a, b){
+
+        return a + ( (b-a) * Math.random() );
+
+    },
+    feerverk_id:0,
+    feerverk:function(name) {
+        if( name == 'fw04' ) {
+            var frc = {
+                'name':'fw04',
+                'x':19,
+                'top':this.getRandom(1,35),
+                'left':this.getRandom(0,365),
+                'width':135,
+                'sound':this.getRandom(8,10),
+                'height':99,
+                'zad':3
+            };
+            frc.left -= 35;
+        }
+
+        if( frc.name != undefined ) {
+            this.sendSound( frc.sound );
+            var obj = top.frames.main.document.getElementById('frvrks');
+            if( obj != undefined ) {
+                var newhtml = '';
+                var i = 1;
+                while( i <= frc.x ) {
+                    newhtml += `<img style="display:none" id="frvanim_${this.feerverk_id}_img${i}" width="${frc.width}" height="${frc.height}" src="https://img.new-combats.com/fw/${frc.name}/${i}.gif">`;
                     i++;
-				}
-				newhtml = `<div id="frvanim_${this.feerverk_id}" style="z-index:5000;position:absolute;width:${frc.width}px;height:${frc.height}px;left:${frc.left}px;top:${frc.top}px;">${newhtml}</div>`;
-				$(obj).append(newhtml);
-				this.feerverk_go( this.feerverk_id , frc.x-1 , frc.name , frc.x , frc.zad );
-				this.feerverk_id++;
-			}
-		}else{
-			//alert('������ �� �������!');
-		}
-	},
-	feerverk_go:function(id,time_back,img,x,zad) {
-		if( zad > 0 ) {
-			setTimeout(`chat.feerverk_go(${id},${time_back},"${img}",${x},0);`,500*zad);
-		}else{
-			time_back--;
-			var obj = top.frames.main.document.getElementById(`frvanim_${id}`);
-			if( time_back > 0 ) {
+                }
+                newhtml = `<div id="frvanim_${this.feerverk_id}" style="z-index:5000;position:absolute;width:${frc.width}px;height:${frc.height}px;left:${frc.left}px;top:${frc.top}px;">${newhtml}</div>`;
+                $(obj).append(newhtml);
+                this.feerverk_go( this.feerverk_id , frc.x-1 , frc.name , frc.x , frc.zad );
+                this.feerverk_id++;
+            }
+        }else{
+            //alert('������ �� �������!');
+        }
+    },
+    feerverk_go:function(id,time_back,img,x,zad) {
+        if( zad > 0 ) {
+            setTimeout(`chat.feerverk_go(${id},${time_back},"${img}",${x},0);`,500*zad);
+        }else{
+            time_back--;
+            var obj = top.frames.main.document.getElementById(`frvanim_${id}`);
+            if( time_back > 0 ) {
                 var img1 = top.frames.main.document.getElementById(`frvanim_${id}_img${(x-time_back+1)}`); //�������
-				if( img1 != undefined ) img1.style.display = 'none';
+                if( img1 != undefined ) img1.style.display = 'none';
                 var img1 = top.frames.main.document.getElementById(`frvanim_${id}_img${(x-time_back+2)}`); //�������
-				if( img2 != undefined ) img2.style.display = '';
+                if( img2 != undefined ) img2.style.display = '';
                 setTimeout(`chat.feerverk_go(${id},${time_back},"${img}",${x},0);`,50);
-			} else top.frames.main.document.getElementById(`frvanim_${id}`).remove();
-		}
-	},
-	ignorUn:function(x)
-	{
-		$('#ignr_u_'+x).remove();
-		this.ignore(this.ignoreList.nms[x]);
-	},
-	ignorListOpen:function()
-	{
-		var date = '',i = 0;
-		var j = 1;
-		while(j<=this.ignoreList.x)
-		{
-			if(this.ignoreList[this.ignoreList.nms[j]]!=undefined)
-			{
-				date += `<div id="ignr_u_${j}">    <b>${this.ignoreList.nms[j]}</b> <a target="_blank" href="https://new-combats.com/info/${this.ignoreList.nms[j]}"><img src="https://${top.c.img}/i/inf_capitalcity.gif" onMouseOver="top.hi(this,\'<b>���. � ${this.ignoreList.nms[j]}</b>\',event,5,-2,2,2,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>   <small><a href="javascript:void(0)" onclick="chat.ignorUn(${j})">Clear</a></small>  </div>`;
-			}
-			j++;
-		}
-		win.add('ignorListWin','������ ������������',`<div id="ignr_alu">${date}</div>`,{},0,1,'min-width:200px;');
-		delete date;
-	},
-	addSmile:function(id)
-	{
-		$('#textmsg').val($('#textmsg').val()+' :'+id+': ');
-		$('#textmsg').focus();
-	},
-	lookSmiles:function()
-	{
-		if($('#chbtn8').attr('class')=='db cp chatBtn8_1')
-		{
-			$('#ttSmiles').css('display','');
-			$('#chbtn8').attr('class','db cp chatBtn8_2');
-		}else{
-			$('#ttSmiles').css('display','none');
-			$('#chbtn8').attr('class','db cp chatBtn8_1');
-		}
-	},
-	filterMsg:function()
-	{
-		if($('#chbtn1').attr('class')=='db cp chatBtn1_1')
-		{
-			$('#chbtn1').attr('class','db cp chatBtn1_2'); this.filter = 1;
-		}else{
-			$('#chbtn1').attr('class','db cp chatBtn1_1'); this.filter = 0;
-		}
-	},
-	systemMsg:function()
-	{
-		if($('#chbtn4').attr('class')=='db cp chatBtn4_1')
-		{
-			$('#chbtn4').attr('class','db cp chatBtn4_2'); this.citySys = 1; $.cookie('citySys',1);
-		}else{
-			$('#chbtn4').attr('class','db cp chatBtn4_1'); this.citySys = 0; $.cookie('citySys',0);
-		}
-	},
-	soundChat:function()
-	{
-		if($('#chbtn7').attr('class')=='db cp chatBtn7_1')
-		{
-			$('#chbtn7').attr('class','db cp chatBtn7_2'); this.sound = 1;
-		}else if($('#chbtn7').attr('class')=='db cp chatBtn7_2'){
-			$('#chbtn7').attr('class','db cp chatBtn7_3'); this.sound = 2;
-		}else{
-			$('#chbtn7').attr('class','db cp chatBtn7_1'); this.sound = 0;
-		}
-	},
-	translitChat:function()
-	{
-		if($('#chbtn6').attr('class')=='db cp chatBtn6_1')
-		{
-			$('#chbtn6').attr('class','db cp chatBtn6_2'); this.translit = 1;
-		}else{
-			$('#chbtn6').attr('class','db cp chatBtn6_1'); this.translit = 0;
-		}
-	},subValSend:'',
+            } else top.frames.main.document.getElementById(`frvanim_${id}`).remove();
+        }
+    },
+    ignorUn:function(x)
+    {
+        $('#ignr_u_'+x).remove();
+        this.ignore(this.ignoreList.nms[x]);
+    },
+    ignorListOpen:function()
+    {
+        var date = '',i = 0;
+        var j = 1;
+        while(j<=this.ignoreList.x)
+        {
+            if(this.ignoreList[this.ignoreList.nms[j]]!=undefined)
+            {
+                date += `<div id="ignr_u_${j}">    <b>${this.ignoreList.nms[j]}</b> <a target="_blank" href="https://new-combats.com/info/${this.ignoreList.nms[j]}"><img src="https://${top.c.img}/i/inf_capitalcity.gif" onMouseOver="top.hi(this,\'<b>���. � ${this.ignoreList.nms[j]}</b>\',event,5,-2,2,2,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a>   <small><a href="javascript:void(0)" onclick="chat.ignorUn(${j})">Clear</a></small>  </div>`;
+            }
+            j++;
+        }
+        win.add('ignorListWin','������ ������������',`<div id="ignr_alu">${date}</div>`,{},0,1,'min-width:200px;');
+        delete date;
+    },
+    addSmile:function(id)
+    {
+        $('#textmsg').val($('#textmsg').val()+' :'+id+': ');
+        $('#textmsg').focus();
+    },
+    lookSmiles:function()
+    {
+        if($('#chbtn8').attr('class')=='db cp chatBtn8_1')
+        {
+            $('#ttSmiles').css('display','');
+            $('#chbtn8').attr('class','db cp chatBtn8_2');
+        }else{
+            $('#ttSmiles').css('display','none');
+            $('#chbtn8').attr('class','db cp chatBtn8_1');
+        }
+    },
+    filterMsg:function()
+    {
+        if($('#chbtn1').attr('class')=='db cp chatBtn1_1')
+        {
+            $('#chbtn1').attr('class','db cp chatBtn1_2'); this.filter = 1;
+        }else{
+            $('#chbtn1').attr('class','db cp chatBtn1_1'); this.filter = 0;
+        }
+    },
+    systemMsg:function()
+    {
+        if($('#chbtn4').attr('class')=='db cp chatBtn4_1')
+        {
+            $('#chbtn4').attr('class','db cp chatBtn4_2'); this.citySys = 1; $.cookie('citySys',1);
+        }else{
+            $('#chbtn4').attr('class','db cp chatBtn4_1'); this.citySys = 0; $.cookie('citySys',0);
+        }
+    },
+    soundChat:function()
+    {
+        if($('#chbtn7').attr('class')=='db cp chatBtn7_1')
+        {
+            $('#chbtn7').attr('class','db cp chatBtn7_2'); this.sound = 1;
+        }else if($('#chbtn7').attr('class')=='db cp chatBtn7_2'){
+            $('#chbtn7').attr('class','db cp chatBtn7_3'); this.sound = 2;
+        }else{
+            $('#chbtn7').attr('class','db cp chatBtn7_1'); this.sound = 0;
+        }
+    },
+    translitChat:function()
+    {
+        if($('#chbtn6').attr('class')=='db cp chatBtn6_1')
+        {
+            $('#chbtn6').attr('class','db cp chatBtn6_2'); this.translit = 1;
+        }else{
+            $('#chbtn6').attr('class','db cp chatBtn6_1'); this.translit = 0;
+        }
+    },subValSend:'',
     subSend: function () {
         if ($('#textmsg').val() != '') {
             if ($('#textmsg').val() != this.subValSend) {
@@ -225,88 +225,88 @@ var chat = {
             }
         }
     },
-	addto:function(login, type2) {
-		var loginaddT = login;
-		var s = '';
-		if($('#'+$(this.inObj).attr('id')).attr('id') == undefined) {		
-			$('#textmsg').focus();
-			s = $('#textmsg').val();
-		} else $(this.inObj).focus();
-		var reg555 = new RegExp("private\\s*\\[(.*?)\\]","");
-		var reg551 = new RegExp("to\\s*\\[(.*?)\\]","");
-		var test1 = s.match(reg555);
-		if(s.match(reg555) == null) type = "to";
+    addto:function(login, type2) {
+        var loginaddT = login;
+        var s = '';
+        if($('#'+$(this.inObj).attr('id')).attr('id') == undefined) {
+            $('#textmsg').focus();
+            s = $('#textmsg').val();
+        } else $(this.inObj).focus();
+        var reg555 = new RegExp("private\\s*\\[(.*?)\\]","");
+        var reg551 = new RegExp("to\\s*\\[(.*?)\\]","");
+        var test1 = s.match(reg555);
+        if(s.match(reg555) == null) type = "to";
         else if(s.match(reg551) == null) type = "private";
-		
-		
-		var type3 = 'to';	
-        var reg2 = new RegExp(`${type}(\\s*)\\[(.*?)\\]`,"");
-		var cs = s.replace(reg2,`${type}$1[,$2,]`);
-		var slogin = login.replace(/([\^.*{}$%?\[\]+|\/\(\)])/g,"\\$1");
-		var reg = new RegExp(`${type}\\s*\\[.*,\\s*${slogin}\\s*,.*\\]`,"");
-		var result = '';
-        var reg3 = new RegExp(`${type}\\s*\\[(.*?)\\]`,"");					
-		while(res = s.match(reg3)) {
-			result += `${res[1]},`;
-			s = s.replace(reg3,'');
-		}
-		result = result.replace(/,$/,'');
-		var prar = result.split(',');
-		for(i = 0; i < prar.length; i++) {
-			prar[i] = prar[i].replace(/^\s+/,'');
-			prar[i] = prar[i].replace(/\s+$/,'');
-		}
-		var str = prar.join(', ');
-		if(str) login += ', ';
-		space = '';
-		if (!s.match(/^\s+/)) space = ' ';
-		var prob = '';
-		if(!$('#'+$(this.inObj).attr('id')).attr('id') && (!this.inObj || !$('#main').contents().find('#'+this.inObj.id).attr('id')))
-		{
-			if (!cs.match(reg))
-			{
-				if (type2 == 'to') {
-				    if (test1 != null) type2 = 'private'
-				}
-				
-				if(loginaddT == 'klan' && type2=='private')
-				{
-					if (login == 'klan, ')
-					{
-						s = `${type2} [klan] to [${prob}${str}${prob}]${space}${s}`;
-					}
-					else {s = `${type2} [klan]${space}${s}`;}
-				
-				}
-				else {s = `${type2} [${prob}${login}${str}${prob}]${space}${s}`}
-			} else {				
-				
-				if (type3 == 'to') type3 = "private";
-				
-				s = `${type3} [${prob} ${str} ${prob}]${space}${s}`;
 
-			}
-		} else s = login+str;
-		
-		if(this.inObj != null && $('#main').contents().find('#'+this.inObj.id).attr('id') != undefined) {
-			$('#main').contents().find('#'+this.inObj.id).val(s);
-		} else if($('#'+$(this.inObj).attr('id')).attr('id') == undefined) {		
-			$('#textmsg').val(s);
-		} else $(this.inObj).val(s);
-	},
-	clearText:function()
-	{
-		$('#textmsg').val('');
-	},
-	reflesh:function()
-	{
-		this.time = 0;
-		this.testTimer(true);
-	},
-	reMoney:function()
-	{
-		$('#moneyGM').html(top.c.money+' ��.');
-	},
+
+        var type3 = 'to';
+        var reg2 = new RegExp(`${type}(\\s*)\\[(.*?)\\]`,"");
+        var cs = s.replace(reg2,`${type}$1[,$2,]`);
+        var slogin = login.replace(/([\^.*{}$%?\[\]+|\/\(\)])/g,"\\$1");
+        var reg = new RegExp(`${type}\\s*\\[.*,\\s*${slogin}\\s*,.*\\]`,"");
+        var result = '';
+        var reg3 = new RegExp(`${type}\\s*\\[(.*?)\\]`,"");
+        while(res = s.match(reg3)) {
+            result += `${res[1]},`;
+            s = s.replace(reg3,'');
+        }
+        result = result.replace(/,$/,'');
+        var prar = result.split(',');
+        for(i = 0; i < prar.length; i++) {
+            prar[i] = prar[i].replace(/^\s+/,'');
+            prar[i] = prar[i].replace(/\s+$/,'');
+        }
+        var str = prar.join(', ');
+        if(str) login += ', ';
+        space = '';
+        if (!s.match(/^\s+/)) space = ' ';
+        var prob = '';
+        if(!$('#'+$(this.inObj).attr('id')).attr('id') && (!this.inObj || !$('#main').contents().find('#'+this.inObj.id).attr('id')))
+        {
+            if (!cs.match(reg))
+            {
+                if (type2 == 'to') {
+                    if (test1 != null) type2 = 'private'
+                }
+
+                if(loginaddT == 'klan' && type2=='private')
+                {
+                    if (login == 'klan, ')
+                    {
+                        s = `${type2} [klan] to [${prob}${str}${prob}]${space}${s}`;
+                    }
+                    else {s = `${type2} [klan]${space}${s}`;}
+
+                }
+                else {s = `${type2} [${prob}${login}${str}${prob}]${space}${s}`}
+            } else {
+
+                if (type3 == 'to') type3 = "private";
+
+                s = `${type3} [${prob} ${str} ${prob}]${space}${s}`;
+
+            }
+        } else s = login+str;
+
+        if(this.inObj != null && $('#main').contents().find('#'+this.inObj.id).attr('id') != undefined) {
+            $('#main').contents().find('#'+this.inObj.id).val(s);
+        } else if($('#'+$(this.inObj).attr('id')).attr('id') == undefined) {
+            $('#textmsg').val(s);
+        } else $(this.inObj).val(s);
+    },
+    clearText:function()
+    {
+        $('#textmsg').val('');
+    },
+    reflesh:function()
+    {
+        this.time = 0;
+        this.testTimer(true);
+    },
+    reMoney:function()
+    {
+        $('#moneyGM').html(top.c.money+' ��.');
+    },
     testTimer: function (n) {
         clearTimeout(this.t);
 
@@ -316,8 +316,8 @@ var chat = {
                 this.sendSound(2);
                 if (top.frames['main'].smnpty != undefined) {
 
-				} 
-				else top.frames['main'].location.href = "main.php";
+                }
+                else top.frames['main'].location.href = "main.php";
             }
             this.btl = $.cookie('btl');
         }
@@ -339,7 +339,7 @@ var chat = {
                     aot[0] = 1;
                 }
                 if (this.nozpros == 0) {
-                    
+
                     if (typeof window.online_jqxhr == "undefined" || window.online_jqxhr.readyState === 4) {
                         window.online_jqxhr = $.getJSON('online.php?r' + c.rnd + '&cas' + ((new Date().getTime()) + Math.random()), {key: this.key, mid: this.msg_id, r1: aot[0], r2: aot[1], r3: aot[2], rndo: c.rnd}, function (data) {
                             if (data.rnd != null) {
@@ -360,631 +360,631 @@ var chat = {
         }
     },
 
-	gUser:function(data,ol)
-	{
-		var rt = '';
-		if(data[1]!=undefined)
-		{
-			rt = data[1];
-			if( rt == '�������������' ) {
-				rt = this.efftxt('fire',rt);
-			}
-			if(ol==true)
-			{
-				rt = `<a href="javascript:void(0)" onClick="chat.addto(\'${data[1]}\',\'to\')">${rt}</a>`;
-			}
-			else rt = `<b>${rt}</b>`;
-			if(data[13]!=0) rt = `<span class="uCss${data[13]}">${rt}</span>`;
-			
-			if(data[10]>0)
-			{
-				rt = `<s onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'�������� ��� ������������\',event,3,1,1,2,\'\')">${rt}</s>`;
-			}
-			
-			if(data[8]!=0)
-			{				
-				data[8] = this.replaceAll(data[8],"\\",'\\\\');
-				data[8] = this.replaceAll(data[8],"[s1;]",'"');
-				data[8] = this.replaceAll(data[8],"[s2;]",'`');
-				data[8] = this.replaceAll(data[8],"[s3;]",'');
-				data[8] = this.replaceAll(data[8],"[s4;]",'');
-				data[8] = this.replaceAll(data[8],"<",'');
-				data[8] = this.replaceAll(data[8],">",'');
-				//rt = ' <small onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\' '+data[8]+' \',event,3,1,1,2,\'\')"><b>afk</b></small> '+rt;
-			}else if(data[9]!=0)
-			{
-				data[9] = this.replaceAll(data[9],"\\",'\\\\');
-				data[9] = this.replaceAll(data[9],"[s1;]",'"');
-				data[9] = this.replaceAll(data[9],"[s2;]",'`');
-				data[9] = this.replaceAll(data[9],"[s3;]",'');
-				data[9] = this.replaceAll(data[9],"[s4;]",'');
-				data[9] = this.replaceAll(data[9],"<",'');
-				data[9] = this.replaceAll(data[9],">",'');
-				//rt = ' <small onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\' '+data[9]+' \',event,3,1,1,2,\'\')"><b>dnd</b></small> '+rt;
-			}
+    gUser:function(data,ol)
+    {
+        var rt = '';
+        if(data[1]!=undefined)
+        {
+            rt = data[1];
+            if( rt == '�������������' ) {
+                rt = this.efftxt('fire',rt);
+            }
+            if(ol==true)
+            {
+                rt = `<a href="javascript:void(0)" onClick="chat.addto(\'${data[1]}\',\'to\')">${rt}</a>`;
+            }
+            else rt = `<b>${rt}</b>`;
+            if(data[13]!=0) rt = `<span class="uCss${data[13]}">${rt}</span>`;
 
-			// ���
-			function rtData (count) {
-				return rt = `<img height="15" src="https://${top.c.img}/i/align/align${data[count]}.gif">${rt}`;
-			}
+            if(data[10]>0)
+            {
+                rt = `<s onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'�������� ��� ������������\',event,3,1,1,2,\'\')">${rt}</s>`;
+            }
 
-			if(data[4]!=0)
-			{
-				rt = `<a href="/clan/${data[4]}" title="${data[4]}" target="_blank"><img width="24" height="15" src="https://${c.img}/i/clan/${data[4]}.gif"></a>${rt}`;
-			}
-			
-			if( data[16] > 0 ) rtData(16) 
-			
-			rtData(3)
-						
-			if(c.lvl>-1)
-			{
-				if(c.city==data[6])
-				{
-					if(data[12]>0)
-					{
-						rt = `<a href="javascript:void(0)" onClick="chat.addto(\'${data[1]}\',\'private\')"><img title="�������� ���������" src="https://${c.img}/i/lock1.gif" width="20" height="15"></a>${rt}`;	
-					}else{
-						rt = `<a href="javascript:void(0)" onClick="chat.addto(\'${data[1]}\',\'private\')"><img src="https://${c.img}/i/lock.gif" width="20" height="15"></a>${rt}`;	
-					}
-				}else{
-					rt = `<img style="padding-right:3px;" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'�������� ������ � ${data[6]}\',event,3,1,1,2,\'\')" src="https://${c.img}/i/city_ico/${data[6]}'.gif" width="17" height="15">${rt}`;
-				}
-			}
-			rt += `[${data[2]}]<a href="https://${c.url}/info/${data[0]}" target="_blank"><img style="vertical-align:baseline" width="12" height="11" src="https://${top.c.img}/i/inf_${data[5]}.gif" title="���. � ${data[1]}" /></a>`;
-			if(data[11]>top.c.time)
-			{
-				rt +=  ` <img id="img_molch${data[1]}" width="24" height="15" style="cursor:help" src="https://${c.img}/i/sleep2.gif" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'�� ��������� �������� �������� ��������.<br>����� ������� ��� <span id=\\\'molch${data[0]}\\\'>${this.timeOut(data[11])}</span>\',event,3,1,1,2,\'\');chat.justRefMolch(${data[0]})">`;
-				this.addRefMolch(data[0],data[11]);
-			}
-			if(data[14]!="")
-			{
-				rt +=  ` <img width="24" height="15" style="cursor:help" src="https://${c.img}/i/travma2.gif" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'� ��������� ${data[14]}\',event,3,1,1,2,\'\');">`;
-			}
-			if(data[13] > 0)
-			{
-				if( data[13] == 2 ) {
-					rt += ` <a target="main" href="/main.php?atak_user=${data[0]}" title="�������� ��������� �� ${data[1]}"><img width="13" height="13" src="https://${c.img}/i/clear.gif"></a>`;
-				}else{
-					rt += ` <a target="main" href="/main.php?atak_user=${data[0]}" title="������� �� ${data[1]}"><img width="13" height="13" src="https://${c.img}/i/curse_attack.gif"></a>`;
-				}
-			}
-			if( data[15] == 1 ) rt = `<span class=woman >${rt}</span>`
-			else{
-				//rt = ' M';
-			}
-		} else rt = '<i>���������</i>[??]'
-		return rt;
-	},mlch:{},
-	justRefMolch: function (id) {
-		$('#molch' + id).html(this.timeOut(this.mlch[id]));
-	},
-	addRefMolch:function(id,tm)
-	{
-		this.t_all[id] = setTimeout(`chat.refMolch(${id})`, 1000);
-		this.mlch[id] = tm;
-	},
-	refMolch:function(id)
-	{		
-		clearTimeout(this.t_all[id]);
-		if (this.mlch[id] > 0) {
-			$('#molch' + id).html(this.timeOut(this.mlch[id]));
-			this.t_all[id] = setTimeout(`chat.refMolch(${id})`, 1000);
-		} else {
-			$('#img_molch' + id).remove();
-			delete this.mlch[id], this.t_all;
-		}
-	},
-	fc:function()
-	{
-		$('#textmsg').focus();
-	},
-	timeOut:function(v)
-	{
-        		
-		msPerDay = '';
-		
-		dt = new Date(); 
-   		dt.setTime((v-c.time)*1000); 
-    	
-		m1   = dt.getUTCMonth();
-		d1   = dt.getUTCDay();
-		h1   = dt.getUTCHours();
-		min1 = dt.getUTCMinutes();
-		sec  = dt.getUTCSeconds();
+            if(data[8]!=0)
+            {
+                data[8] = this.replaceAll(data[8],"\\",'\\\\');
+                data[8] = this.replaceAll(data[8],"[s1;]",'"');
+                data[8] = this.replaceAll(data[8],"[s2;]",'`');
+                data[8] = this.replaceAll(data[8],"[s3;]",'');
+                data[8] = this.replaceAll(data[8],"[s4;]",'');
+                data[8] = this.replaceAll(data[8],"<",'');
+                data[8] = this.replaceAll(data[8],">",'');
+                //rt = ' <small onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\' '+data[8]+' \',event,3,1,1,2,\'\')"><b>afk</b></small> '+rt;
+            }else if(data[9]!=0)
+            {
+                data[9] = this.replaceAll(data[9],"\\",'\\\\');
+                data[9] = this.replaceAll(data[9],"[s1;]",'"');
+                data[9] = this.replaceAll(data[9],"[s2;]",'`');
+                data[9] = this.replaceAll(data[9],"[s3;]",'');
+                data[9] = this.replaceAll(data[9],"[s4;]",'');
+                data[9] = this.replaceAll(data[9],"<",'');
+                data[9] = this.replaceAll(data[9],">",'');
+                //rt = ' <small onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\' '+data[9]+' \',event,3,1,1,2,\'\')"><b>dnd</b></small> '+rt;
+            }
 
-		if (m1>0) msPerDay = `${m1} ���. `;
-		if (d1>0 && Math.floor((v-c.time)/(60*60*24)) == d1) msPerDay = `${d1} �. `;
-		if (h1>0) msPerDay += `${h1} �. `;
-		if (min1>0) msPerDay += `${min1} ���. `;
-		if (sec>0 && msPerDay != '') msPerDay += `${sec} ���. `;
-		if (msPerDay == '') msPerDay = '������ ������.';
-		
-		delete m1, d1, h1, min1, sec;
-		return msPerDay;
-	},
-	deleteMessage:function(id,fc)
-	{
-		//$('#msg_'+id).hide('slow'); setTimeout("$('#msg_'+id).remove();",1000);
-		if(fc == 1) top.msgdeleted(id)
-		else{
-			$('#msg_'+id).remove();
-			$('#msg_'+id+'_sys').remove();
-			if(top.c.admin>0)
-			{
-				$.post('online.php?jack='+c.rnd+'&cas'+((new Date().getTime()) + Math.random()),{delMsg:id});
-			}
-		}
-	},
-	clear:function()
-	{
-		if($('#textmsg').val()=='')
-		{
-			if(confirm('�������� ���� ����?'))
-			{
-				//if(top.cb_date[top.cb_select] == 4 || top.cb_date[top.cb_select] == 5) {
-				if( top.des == 1 ) {
-					$('#canal'+top.cb_date[top.cb_select]).html('');
-					$('#textmsg').focus();
-				}
-				$('#canal5').html('');
-				$('#textmsg').focus();
-				return
-			}
-		}else $('#textmsg').val('');
-	},
-	scrollNow:function(id)
-	{
-		if(top.des == 0 || top.cb_date[top.cb_select] == 5 || top.cb_date[top.cb_select] == 4) {
-			//alert(id);
-			$('#chat_list').stop();
-			$('#chat_list').animate({ scrollTop: $('#chat_list')[0].scrollHeight }, 1000);
-			//console.log(`${document.getElementById("chat_list").scrollTop}px`)
-			//console.log(`${document.getElementById("chat_list").clientHeight}px`)
-			var $chat_list = document.getElementById("chat_list")
-			console.log(($chat_list.scrollHeight - $chat_list.scrollTop))
+            // ���
+            function rtData (count) {
+                return rt = `<img height="15" src="https://${top.c.img}/i/align/align${data[count]}.gif">${rt}`;
+            }
 
-			if (($chat_list.scrollHeight - $chat_list.scrollTop) < 358) {
-					console.log((`������ � ������ ${$chat_list.scrollHeight - $chat_list.scrollTop}`))
-				return $chat_list.scrollBy(0, $chat_list.scrollHeight)
-			} else console.log("�� ������")
-			//$('#chat_list').scrollTop();
-		}
-	},
-	msgcount:0,
-	sendMsg:function(data)
-	{
-		var msg_see = 1;
-		var global_type = 0;
-		
-		if( data[5] != undefined ) {
-			if( data[5].substring(0,7) == 'global:' ) {
-				global_type = 1;
-				data[5] = data[5].substring(7);
-			}
-		}
-		if (data[0] == 'new') {
-		    data[0] = `new_msg_ ${this.newmsg}`;
-		    this.newmsg++;
-		}
+            if(data[4]!=0)
+            {
+                rt = `<a href="/clan/${data[4]}" title="${data[4]}" target="_blank"><img width="24" height="15" src="https://${c.img}/i/clan/${data[4]}.gif"></a>${rt}`;
+            }
+
+            if( data[16] > 0 ) rtData(16)
+
+            rtData(3)
+
+            if(c.lvl>-1)
+            {
+                if(c.city==data[6])
+                {
+                    if(data[12]>0)
+                    {
+                        rt = `<a href="javascript:void(0)" onClick="chat.addto(\'${data[1]}\',\'private\')"><img title="�������� ���������" src="https://${c.img}/i/lock1.gif" width="20" height="15"></a>${rt}`;
+                    }else{
+                        rt = `<a href="javascript:void(0)" onClick="chat.addto(\'${data[1]}\',\'private\')"><img src="https://${c.img}/i/lock.gif" width="20" height="15"></a>${rt}`;
+                    }
+                }else{
+                    rt = `<img style="padding-right:3px;" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'�������� ������ � ${data[6]}\',event,3,1,1,2,\'\')" src="https://${c.img}/i/city_ico/${data[6]}'.gif" width="17" height="15">${rt}`;
+                }
+            }
+            rt += `[${data[2]}]<a href="https://${c.url}/info/${data[0]}" target="_blank"><img style="vertical-align:baseline" width="12" height="11" src="https://${top.c.img}/i/inf_${data[5]}.gif" title="���. � ${data[1]}" /></a>`;
+            if(data[11]>top.c.time)
+            {
+                rt +=  ` <img id="img_molch${data[1]}" width="24" height="15" style="cursor:help" src="https://${c.img}/i/sleep2.gif" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'�� ��������� �������� �������� ��������.<br>����� ������� ��� <span id=\\\'molch${data[0]}\\\'>${this.timeOut(data[11])}</span>\',event,3,1,1,2,\'\');chat.justRefMolch(${data[0]})">`;
+                this.addRefMolch(data[0],data[11]);
+            }
+            if(data[14]!="")
+            {
+                rt +=  ` <img width="24" height="15" style="cursor:help" src="https://${c.img}/i/travma2.gif" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'� ��������� ${data[14]}\',event,3,1,1,2,\'\');">`;
+            }
+            if(data[13] > 0)
+            {
+                if( data[13] == 2 ) {
+                    rt += ` <a target="main" href="/main.php?atak_user=${data[0]}" title="�������� ��������� �� ${data[1]}"><img width="13" height="13" src="https://${c.img}/i/clear.gif"></a>`;
+                }else{
+                    rt += ` <a target="main" href="/main.php?atak_user=${data[0]}" title="������� �� ${data[1]}"><img width="13" height="13" src="https://${c.img}/i/curse_attack.gif"></a>`;
+                }
+            }
+            if( data[15] == 1 ) rt = `<span class=woman >${rt}</span>`
+            else{
+                //rt = ' M';
+            }
+        } else rt = '<i>���������</i>[??]'
+        return rt;
+    },mlch:{},
+    justRefMolch: function (id) {
+        $('#molch' + id).html(this.timeOut(this.mlch[id]));
+    },
+    addRefMolch:function(id,tm)
+    {
+        this.t_all[id] = setTimeout(`chat.refMolch(${id})`, 1000);
+        this.mlch[id] = tm;
+    },
+    refMolch:function(id)
+    {
+        clearTimeout(this.t_all[id]);
+        if (this.mlch[id] > 0) {
+            $('#molch' + id).html(this.timeOut(this.mlch[id]));
+            this.t_all[id] = setTimeout(`chat.refMolch(${id})`, 1000);
+        } else {
+            $('#img_molch' + id).remove();
+            delete this.mlch[id], this.t_all;
+        }
+    },
+    fc:function()
+    {
+        $('#textmsg').focus();
+    },
+    timeOut:function(v)
+    {
+
+        msPerDay = '';
+
+        dt = new Date();
+        dt.setTime((v-c.time)*1000);
+
+        m1   = dt.getUTCMonth();
+        d1   = dt.getUTCDay();
+        h1   = dt.getUTCHours();
+        min1 = dt.getUTCMinutes();
+        sec  = dt.getUTCSeconds();
+
+        if (m1>0) msPerDay = `${m1} ���. `;
+        if (d1>0 && Math.floor((v-c.time)/(60*60*24)) == d1) msPerDay = `${d1} �. `;
+        if (h1>0) msPerDay += `${h1} �. `;
+        if (min1>0) msPerDay += `${min1} ���. `;
+        if (sec>0 && msPerDay != '') msPerDay += `${sec} ���. `;
+        if (msPerDay == '') msPerDay = '������ ������.';
+
+        delete m1, d1, h1, min1, sec;
+        return msPerDay;
+    },
+    deleteMessage:function(id,fc)
+    {
+        //$('#msg_'+id).hide('slow'); setTimeout("$('#msg_'+id).remove();",1000);
+        if(fc == 1) top.msgdeleted(id)
+        else{
+            $('#msg_'+id).remove();
+            $('#msg_'+id+'_sys').remove();
+            if(top.c.admin>0)
+            {
+                $.post('online.php?jack='+c.rnd+'&cas'+((new Date().getTime()) + Math.random()),{delMsg:id});
+            }
+        }
+    },
+    clear:function()
+    {
+        if($('#textmsg').val()=='')
+        {
+            if(confirm('�������� ���� ����?'))
+            {
+                //if(top.cb_date[top.cb_select] == 4 || top.cb_date[top.cb_select] == 5) {
+                if( top.des == 1 ) {
+                    $('#canal'+top.cb_date[top.cb_select]).html('');
+                    $('#textmsg').focus();
+                }
+                $('#canal5').html('');
+                $('#textmsg').focus();
+                return
+            }
+        }else $('#textmsg').val('');
+    },
+    scrollNow:function(id)
+    {
+        if(top.des == 0 || top.cb_date[top.cb_select] == 5 || top.cb_date[top.cb_select] == 4) {
+            //alert(id);
+            $('#chat_list').stop();
+            $('#chat_list').animate({ scrollTop: $('#chat_list')[0].scrollHeight }, 1000);
+            //console.log(`${document.getElementById("chat_list").scrollTop}px`)
+            //console.log(`${document.getElementById("chat_list").clientHeight}px`)
+            var $chat_list = document.getElementById("chat_list")
+            console.log(($chat_list.scrollHeight - $chat_list.scrollTop))
+
+            if (($chat_list.scrollHeight - $chat_list.scrollTop) < 358) {
+                console.log((`������ � ������ ${$chat_list.scrollHeight - $chat_list.scrollTop}`))
+                return $chat_list.scrollBy(0, $chat_list.scrollHeight)
+            } else console.log("�� ������")
+            //$('#chat_list').scrollTop();
+        }
+    },
+    msgcount:0,
+    sendMsg:function(data)
+    {
+        var msg_see = 1;
+        var global_type = 0;
+
+        if( data[5] != undefined ) {
+            if( data[5].substring(0,7) == 'global:' ) {
+                global_type = 1;
+                data[5] = data[5].substring(7);
+            }
+        }
+        if (data[0] == 'new') {
+            data[0] = `new_msg_ ${this.newmsg}`;
+            this.newmsg++;
+        }
         if (data[2] == 'delete') this.deleteMessage(data[0]);
         else if (data['d'] > 0) this.deleteMessage(data['d']);
-		else if (data['s'] > 0) this.deleteMessage(data['s']);
-		else if(data[0]!=undefined && top.document.getElementById(`msg_${data[0]}`) == undefined)
-		{
-			var msg  = '';
-				if(data[0]!=0)
-				{
-					if(top.c.admin > 0) {
-						if(data[12] == 1) {
-							msg += '<small style="color:red;text-decoration:blink"> <b>un</b>active </small>';
-						}
-					}
-					if(data[3]!='')
-					{
-						if(data[16] > 0) {
-							msg += `[<a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'���������\',event,\'chat\'); return false;" onClick="chat.addto(\'���������\',\'to\')">${data[3]}</a>]`;
-						}else{
-							msg += `[<a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'${data[3]}\',event,\'chat\'); return false;" onClick="chat.addto(\'${data[3]}\',\'to\')">${data[3]}</a>]`;
-						}
-						if(chat.ignoreList[data[3]]!=undefined) msg_see = 0;
-					}
-					if(data[4]!='')
-					{
-						var forYou = 0;
-						//��� ��� �����
-						
-						//���� ��������, ������ �������
-						if(data[4]!='')
-						{
-							var to = '',to2 = '',arr = data[4].split(','),i = 0,vl = '';								
-							//��� ���� ������
-							while(i!=-1)
-							{
-								if(arr[i]!=undefined)
-								{
-									vl = this.trim(arr[i]);
-									if(vl.toLowerCase() == top.c.login.toLowerCase())
-									{
-										forYou++;
-									}
-									if(vl.toLowerCase() == top.c.login.toLowerCase())
-									{
-										vl = this.trim(data[3]);
-									}
-									if(i>0)
-									{
-										to += ', ';
-										to2 += ', ';
-									}
-									if(data[3]!='')
-									{
-										to += `<span style="cursor:pointer" onclick="chat.addto(\'${vl}\',\'private\');" oncontextmenu="top.infoMenu(\'${this.trim(arr[i])}\',event,\'chat\'); return false;">${this.trim(arr[i])}</span>`;
+        else if (data['s'] > 0) this.deleteMessage(data['s']);
+        else if(data[0]!=undefined && top.document.getElementById(`msg_${data[0]}`) == undefined)
+        {
+            var msg  = '';
+            if(data[0]!=0)
+            {
+                if(top.c.admin > 0) {
+                    if(data[12] == 1) {
+                        msg += '<small style="color:red;text-decoration:blink"> <b>un</b>active </small>';
+                    }
+                }
+                if(data[3]!='')
+                {
+                    if(data[16] > 0) {
+                        msg += `[<a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'���������\',event,\'chat\'); return false;" onClick="chat.addto(\'���������\',\'to\')">${data[3]}</a>]`;
+                    }else{
+                        msg += `[<a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'${data[3]}\',event,\'chat\'); return false;" onClick="chat.addto(\'${data[3]}\',\'to\')">${data[3]}</a>]`;
+                    }
+                    if(chat.ignoreList[data[3]]!=undefined) msg_see = 0;
+                }
+                if(data[4]!='')
+                {
+                    var forYou = 0;
+                    //��� ��� �����
 
-										if(this.trim(arr[i].toLowerCase()) != top.c.login.toLowerCase())
-										{
-											to2 += this.trim(arr[i]);
-										} else {
-											if (data[2] == 2) to2 += this.trim(arr[i]);
-											else to2 += this.trim(vl);
-										}
-									}
-								} else i = -2;
-								i++;
-							}
-						}
-						
-						if(data[2] == 6 || data[2] == 8) {
-							var zmlogin = new RegExp("\\[login:(.*?)\\]","");	
-							var reflcd = new RegExp("\\[reflesh_main_zv_priem:(.*?)\\]","");	
-							if(data[5].match(zmlogin)!=null)
-							{
-								zmlogin = data[5].match(zmlogin)[1];
-								data[5] = data[5].replace(`[login:${zmlogin}]`,`<a onMouseDown="top.loginGo(\'${zmlogin}\',event);" oncontextmenu="top.infoMenu(\'${zmlogin}\',event,\'chat\'); return false;" title="${zmlogin}" style="cursor:pointer;" onClick="chat.multiAddto(\'${zmlogin}\',\'to\');">${zmlogin}</a>`);
-							}
-							if(data[5].match(reflcd)!=null)
-							{
-								reflcd = data[5].match(reflcd)[1];
-								data[5] = data[5].replace(`[reflesh_main_zv_priem:${reflcd}]`,'');
-							}	
-						}
-						
-						//�������� ������ ���� ���������� ���������
-						if(data[2]==6)
-						{
-							//������ ��������, ��������
-							msg += ' <span style="color:red">��������!</span> ';
-						}else if(data[2]==2)
-						{
-							if(forYou>0)
-							{
-								msg += ` <span style="color:${data[6]}"><b>to [${to2}]</b></span>`;
-							}else{
-								msg += ` <span style="color:${data[6]}">to [${to2}]</span>`;
-							}
-						}else if(data[2]==3)
-						{
-							if(this.trim(data[3].toLowerCase()) == top.c.login.toLowerCase())
-							{
-								forYou++;
-							}
-							if(data[3]!='')
-							{
-								if(data[4]=='klan' && data[2]==3)
-								{
-									msg += ' <span class="klan"><span style="cursor:pointer" onclick="chat.multiaddto(\'klan\',\'private\');">private [klan]</span></span>';
-								}else{
-									msg += ` <span class="private"><span style="cursor:pointer" onclick="chat.multiaddto(\'${to2}\',\'private\');">private [ </span>${to}<span style="cursor:pointer" onclick="chat.multiAddto(\'${to2}\',\'private\');"> ]</span></span>`;
-								}
-							}
-						}						
-					}
-					msg += ' ';
-				} 
-				
-				data[5] = this.replaceAll(data[5],"[s1;]",'"');
-				data[5] = this.replaceAll(data[5],"[s2;]",'\'');
-				data[5] = this.replaceAll(data[5],"[s3;]",'<');
-				data[5] = this.replaceAll(data[5],"[s4;]",'>');
-				
-				//data[5] = this.replaceAll(data[5],"[s4;]",'>');
-				
-				//var matches = data[5].match(/\[img\[(.*?)\]\]/);
-				//var a = matches[1];
-				//var b = matches[2];
-				
-				//console.log(matches);
-				
-				
-				if($.cookie('chatCfg2')!=0)
-				{
-					data[5] = chat.testSmile(data[5]);
-				}
-				
-				if(data[6]!='Black' && data[6]!='')
-				{
-					msg += `<font color="${data[6]}">${data[5]}</font>`;
-				} else msg += data[5];
-				
-				if(data[2] == 21) {						
-					//e text
-					var text = `[loginfrom] ${data[5]}`;
-					var ftps = `<i><a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'${data[3]}\',event,\'chat\'); return false;" onClick="chat.addto(\'${data[3]}\',\'to\')">${data[3]}</a></i>`;
-					var mblogin = new RegExp("\\[login:(.*?)\\]","");
-					text = text.replace('[loginfrom]',ftps);
-					if(text.match(mblogin)!=null)
-					{
-						mblogin = text.match(mblogin)[1];
-						text = text.replace(`[login:${mblogin}]`,`<i><a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'${mblogin}\',event,\'chat\'); return false;" onClick="chat.addto(\'${mblogin}\',\'to\')">${mblogin}</a></i>`);
-					}
-					msg = `<i>${text}</i>`;			
-				}
-				if(data[1]>0)
-				{
-					var td = new Date((parseInt(data[1]))*1000);
-					td = [td,null,null,null];
-					td[1] = td[0].getHours();
-					td[2] = td[0].getMinutes();
-					td[3] = td[0].getSeconds(); 
-					td[4] = td[0].getDay(); 
-					td[5] = td[0].getMonth();
-					td[6] = td[0].getYear();
-					var j = 1;
-					while (j < 6) {
-						if (td[j] < 10) {
-							td[j] = `0${td[j]}`;
-						}
-						j++;
-					}
-					
-					var cls = forYou > 0 ? 'date2' : 'date'
-					if(data[11]>0)
-					{
-						msg = `<font style="cursor:help" color="red" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'����������� ������� �� ��������� ������ �������<br>��������� ����������� �������� ��������� ����� � ���������� ����.\',event,3,1,1,3,\'\')"> <b>!</b> </font>${msg}`;
-					}
-					if(data[10]>0)
-					{
-						msg = `<font style="cursor:help" color="green" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'��� ���������� ���������, ��� ����� ���� ���������� �� ����� �������<br>��������� ����������� �������� ��������� ����� � ���������� ����.\',event,3,1,1,3,\'\')"> <b>G</b> </font>${msg}`;
-					}
-					var msg22  = '<span ';
-					if(top.c.admin > 0) {
-						msg22 += `oncontextmenu="chat.deleteMessage(${data[0]});
+                    //���� ��������, ������ �������
+                    if(data[4]!='')
+                    {
+                        var to = '',to2 = '',arr = data[4].split(','),i = 0,vl = '';
+                        //��� ���� ������
+                        while(i!=-1)
+                        {
+                            if(arr[i]!=undefined)
+                            {
+                                vl = this.trim(arr[i]);
+                                if(vl.toLowerCase() == top.c.login.toLowerCase())
+                                {
+                                    forYou++;
+                                }
+                                if(vl.toLowerCase() == top.c.login.toLowerCase())
+                                {
+                                    vl = this.trim(data[3]);
+                                }
+                                if(i>0)
+                                {
+                                    to += ', ';
+                                    to2 += ', ';
+                                }
+                                if(data[3]!='')
+                                {
+                                    to += `<span style="cursor:pointer" onclick="chat.addto(\'${vl}\',\'private\');" oncontextmenu="top.infoMenu(\'${this.trim(arr[i])}\',event,\'chat\'); return false;">${this.trim(arr[i])}</span>`;
+
+                                    if(this.trim(arr[i].toLowerCase()) != top.c.login.toLowerCase())
+                                    {
+                                        to2 += this.trim(arr[i]);
+                                    } else {
+                                        if (data[2] == 2) to2 += this.trim(arr[i]);
+                                        else to2 += this.trim(vl);
+                                    }
+                                }
+                            } else i = -2;
+                            i++;
+                        }
+                    }
+
+                    if(data[2] == 6 || data[2] == 8) {
+                        var zmlogin = new RegExp("\\[login:(.*?)\\]","");
+                        var reflcd = new RegExp("\\[reflesh_main_zv_priem:(.*?)\\]","");
+                        if(data[5].match(zmlogin)!=null)
+                        {
+                            zmlogin = data[5].match(zmlogin)[1];
+                            data[5] = data[5].replace(`[login:${zmlogin}]`,`<a onMouseDown="top.loginGo(\'${zmlogin}\',event);" oncontextmenu="top.infoMenu(\'${zmlogin}\',event,\'chat\'); return false;" title="${zmlogin}" style="cursor:pointer;" onClick="chat.multiAddto(\'${zmlogin}\',\'to\');">${zmlogin}</a>`);
+                        }
+                        if(data[5].match(reflcd)!=null)
+                        {
+                            reflcd = data[5].match(reflcd)[1];
+                            data[5] = data[5].replace(`[reflesh_main_zv_priem:${reflcd}]`,'');
+                        }
+                    }
+
+                    //�������� ������ ���� ���������� ���������
+                    if(data[2]==6)
+                    {
+                        //������ ��������, ��������
+                        msg += ' <span style="color:red">��������!</span> ';
+                    }else if(data[2]==2)
+                    {
+                        if(forYou>0)
+                        {
+                            msg += ` <span style="color:${data[6]}"><b>to [${to2}]</b></span>`;
+                        }else{
+                            msg += ` <span style="color:${data[6]}">to [${to2}]</span>`;
+                        }
+                    }else if(data[2]==3)
+                    {
+                        if(this.trim(data[3].toLowerCase()) == top.c.login.toLowerCase())
+                        {
+                            forYou++;
+                        }
+                        if(data[3]!='')
+                        {
+                            if(data[4]=='klan' && data[2]==3)
+                            {
+                                msg += ' <span class="klan"><span style="cursor:pointer" onclick="chat.multiaddto(\'klan\',\'private\');">private [klan]</span></span>';
+                            }else{
+                                msg += ` <span class="private"><span style="cursor:pointer" onclick="chat.multiaddto(\'${to2}\',\'private\');">private [ </span>${to}<span style="cursor:pointer" onclick="chat.multiAddto(\'${to2}\',\'private\');"> ]</span></span>`;
+                            }
+                        }
+                    }
+                }
+                msg += ' ';
+            }
+
+            data[5] = this.replaceAll(data[5],"[s1;]",'"');
+            data[5] = this.replaceAll(data[5],"[s2;]",'\'');
+            data[5] = this.replaceAll(data[5],"[s3;]",'<');
+            data[5] = this.replaceAll(data[5],"[s4;]",'>');
+
+            //data[5] = this.replaceAll(data[5],"[s4;]",'>');
+
+            //var matches = data[5].match(/\[img\[(.*?)\]\]/);
+            //var a = matches[1];
+            //var b = matches[2];
+
+            //console.log(matches);
+
+
+            if($.cookie('chatCfg2')!=0)
+            {
+                data[5] = chat.testSmile(data[5]);
+            }
+
+            if(data[6]!='Black' && data[6]!='')
+            {
+                msg += `<font color="${data[6]}">${data[5]}</font>`;
+            } else msg += data[5];
+
+            if(data[2] == 21) {
+                //e text
+                var text = `[loginfrom] ${data[5]}`;
+                var ftps = `<i><a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'${data[3]}\',event,\'chat\'); return false;" onClick="chat.addto(\'${data[3]}\',\'to\')">${data[3]}</a></i>`;
+                var mblogin = new RegExp("\\[login:(.*?)\\]","");
+                text = text.replace('[loginfrom]',ftps);
+                if(text.match(mblogin)!=null)
+                {
+                    mblogin = text.match(mblogin)[1];
+                    text = text.replace(`[login:${mblogin}]`,`<i><a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'${mblogin}\',event,\'chat\'); return false;" onClick="chat.addto(\'${mblogin}\',\'to\')">${mblogin}</a></i>`);
+                }
+                msg = `<i>${text}</i>`;
+            }
+            if(data[1]>0)
+            {
+                var td = new Date((parseInt(data[1]))*1000);
+                td = [td,null,null,null];
+                td[1] = td[0].getHours();
+                td[2] = td[0].getMinutes();
+                td[3] = td[0].getSeconds();
+                td[4] = td[0].getDay();
+                td[5] = td[0].getMonth();
+                td[6] = td[0].getYear();
+                var j = 1;
+                while (j < 6) {
+                    if (td[j] < 10) {
+                        td[j] = `0${td[j]}`;
+                    }
+                    j++;
+                }
+
+                var cls = forYou > 0 ? 'date2' : 'date'
+                if(data[11]>0)
+                {
+                    msg = `<font style="cursor:help" color="red" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'����������� ������� �� ��������� ������ �������<br>��������� ����������� �������� ��������� ����� � ���������� ����.\',event,3,1,1,3,\'\')"> <b>!</b> </font>${msg}`;
+                }
+                if(data[10]>0)
+                {
+                    msg = `<font style="cursor:help" color="green" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'��� ���������� ���������, ��� ����� ���� ���������� �� ����� �������<br>��������� ����������� �������� ��������� ����� � ���������� ����.\',event,3,1,1,3,\'\')"> <b>G</b> </font>${msg}`;
+                }
+                var msg22  = '<span ';
+                if(top.c.admin > 0) {
+                    msg22 += `oncontextmenu="chat.deleteMessage(${data[0]});
 						return false;" `;
-					}
-					if( data[8] == 2 ) {
-						//msg22 += 'class="'+cls+'">'+td[4]+'.'+td[5]+'.'+(td[6]+1900)+' '+td[1]+':'+td[2]+'</span> ';
-						if( data[14] == undefined ) {
-							data[14] = '--:--';
-						}
-						if( data[14] == '--:--' && data[1] > 0 ) {
-							data[14] = data[1];
-							var date14 = new Date(data[14]*1000);
-							data[14] = `${date14.getHours()}:${date14.getMinutes()}`;
-						}
-						msg22 += `class="${cls}">${data[14]}</span> `;
-					}else{
-						if( data[13] == undefined ) {
-							data[13] = '--:--';
-						}
-						if( data[13] == '--:--' && data[1] > 0 ) {
-							data[13] = data[1];
-							var date13 = new Date(data[13]*1000);
-							data[13] = `${date13.getHours()}:${date13.getMinutes()}`;
-						}
-						msg22 += `class="${cls}">${data[13]}</span> `;
-					}
-					msg = msg22+msg;
-				}
-			this.msgcount++;
-				
-			msg = `<span class="m0c1" id="msg_${data[0]}">${msg}<br></span>`;
-			
-			if(forYou > 0 && this.sound > 0 && this.trim(data[3].toLowerCase()) != top.c.login.toLowerCase())
-			{
-				this.sendSound(1);
-			}
-			
-			if(msg_see == 1)
-			{
-				if(this.trim(data[3].toLowerCase()) == top.c.login.toLowerCase() || forYou == 1 || this.filter == 0)
-				{
-					if( data[9] > 0 ) {
-						this.sendSound(data[9]);
-					}
-					if( data[15] != undefined && data[15] != 0 ) {
-						this.feerverk( data[15] );
-						this.feerverk( data[15] );
-					}
-					
-					if( top.des == 1 ) {
-						if( data[2] < 4 || global_type == 1 ) {
-							//������� ���
-							$('#canal5').html($('#canal5').html()+''+msg);
-							top.blueTextSee(5);
-							if( global_type == 1 ) {
-								//��������� ���
-								$('#canal4').html($('#canal4').html()+''+msg);
-								top.blueTextSee(4);
-							}
-						}else{
-							//��������� ���
-							$('#canal4').html($('#canal4').html()+''+msg);
-							top.blueTextSee(4);
-							$('#canal5').html($('#canal5').html()+''+msg);
-							top.blueTextSee(5);
-						}
-					}else{
-						$('#canal5').html($('#canal5').html()+''+msg);
-					}
-					
-					/*
-					if(data[2] == 6 || data[2] == 5) {
-						//��������� ���������
-						$('#canal5').html($('#canal5').html()+''+msg);
-						//$('#canal4').html($('#canal4').html()+'<span id="msg_'+data[0]+'_sys">'+msg+'</span>');
-						//if(top.cb_rdate[top.cb_select] != 4) {
-							//top.blueTextSee(5);
-						//}
-					}else if(data[2] == 7){
-						//��������� ��������� (������)
-						//$('#canal'+top.cb_select).html($('#canal'+top.cb_select).html()+''+msg);
-						//$('#canal4').html($('#canal4').html()+'<span id="msg_'+data[0]+'_sys">'+msg+'</span>');
-						//top.blueTextSee(4);
-					}else if(data[2] == 8){
-						//��������� ��������� (������ ���)
-						//$('#canal'+top.cb_select).html($('#canal'+top.cb_select).html()+''+msg);
-						//$('#canal6').html($('#canal6').html()+'<span id="msg_'+data[0]+'_tap">'+msg+'</span>');
-						//top.blueTextSee(6);
-					}else{
-						//������� ���������
-						if( data[2] == 1 && data[4] == 'trade' ) {
-							$('#canal6').html($('#canal6').html()+''+msg);
-						}else{
-							$('#canal5').html($('#canal5').html()+''+msg);
-						}
-						//top.blueTextSee(5);
-					}*/
-				}
-			}
-			
-			
+                }
+                if( data[8] == 2 ) {
+                    //msg22 += 'class="'+cls+'">'+td[4]+'.'+td[5]+'.'+(td[6]+1900)+' '+td[1]+':'+td[2]+'</span> ';
+                    if( data[14] == undefined ) {
+                        data[14] = '--:--';
+                    }
+                    if( data[14] == '--:--' && data[1] > 0 ) {
+                        data[14] = data[1];
+                        var date14 = new Date(data[14]*1000);
+                        data[14] = `${date14.getHours()}:${date14.getMinutes()}`;
+                    }
+                    msg22 += `class="${cls}">${data[14]}</span> `;
+                }else{
+                    if( data[13] == undefined ) {
+                        data[13] = '--:--';
+                    }
+                    if( data[13] == '--:--' && data[1] > 0 ) {
+                        data[13] = data[1];
+                        var date13 = new Date(data[13]*1000);
+                        data[13] = `${date13.getHours()}:${date13.getMinutes()}`;
+                    }
+                    msg22 += `class="${cls}">${data[13]}</span> `;
+                }
+                msg = msg22+msg;
+            }
+            this.msgcount++;
 
-			// document.getElementById("chat_list").addEventListener("scroll", function (event) {
-			// 	console.log(`${pageYOffset}px`)
-			// });
+            msg = `<span class="m0c1" id="msg_${data[0]}">${msg}<br></span>`;
 
-			this.scrollNow(this.msgcount);
-			delete forYou, cls, msg_see, msg, arr;
-		}
-	},
-	testKey: function (m, v) {
-		var i = 0,
-			r = v;
-		v = false;
-		while (i != -1) {
-			if (m[i] != undefined) {
-				if (m[i] == r) {
-					v = i;
-					i = -2;
-				}
-			} else {
-				i = -2;
-			}
-			i++;
-		}
-		delete r, m;
-		return v;
-	},
-	isNumber:function(s)
-	{
-		return s = !isNaN(s) ? true : false
-	},
-	testSmile:function(txt)
-	{
-		/*if(top.c.admin < 1) {
-			txr = txt.split(':');
-			var i = 1, j = 0, smid = 0;
-			while(i!=-1)
-			{
-				if(txr[i]!=undefined && j < 3)
-				{				
-					smid = this.testKey(top.sml,txr[i].toLowerCase());
-					if(smid!=false && this.isNumber(txr[i]) != true)
-					{				
-						if(smid!=false)
-						{
-							txt = txt.replace("\:"+txr[i]+"\:",'<img src="https://'+top.c.img+'/i/smile/'+(txr[i].toLowerCase())+'.gif" style="cursor:pointer" width="'+top.sml[smid+1]+'" height="'+top.sml[smid+2]+'" onclick="chat.addSmile(\''+(txr[i].toLowerCase())+'\')">');
-						}
-						j++;
-					}
-				}else{
-					i = -3;
-				}
-				i += 2;
-			}
-			delete smid;
-			delete j;
-			delete txr;
-		}else{*/
-			txr = txt.split(':');
-			var i = 1, j = 0, smid = 0;
-			while(i <= txr.length) {
-				if( txr[i] != undefined) {
-					smid = this.testKey(top.sml,txr[i]);
-					imsml = txr[i].split('-');
-					if(((smid != false || smid == 0) && this.isNumber(txr[i]) != true) || (imsml != undefined && imsml[0] == '%usersmile%')) {
-						if(j < 3 && this.isNumber(top.sml[smid]) != true && (top.sml[smid] != undefined || imsml[0] == '%usersmile%')) {
-							// ���
-							if(imsml[0] == '%usersmile%') {
-								txt = txt.replace(`\:%usersmile%-${imsml[1]}\:`,`<img src="https://${top.c.img}/i/smile/${(imsml[1].toLowerCase())}.gif" title="������� �������">`);
-							}else{
-								txt = txt.replace(`\:${txr[i]}\:`,`<img src="https://${top.c.img}/i/smile/${(txr[i].toLowerCase())}.gif" style="cursor:pointer" width="${top.sml[smid+1]}" height="${top.sml[smid+2]}" onclick="chat.addSmile(\'${(txr[i].toLowerCase())}\')">`);
-							}
-							j++;
-						}
-					}
-				}
-				i++;
-			}
-		//}
-		return txt;
-	},
-	trmb: function () {
-		if (this.translit == 1) {
-			$('#textmsg').val(this.convert2($('#textmsg').val()));
-		}
-	},
-	replaceAll:function(t,v,s)
-	{
-		return t.split(v).join(s);
-	},
-	convert2:function(txt)
-	{
-		var trn = new Array();
-		trn = txt.split(' ');
-		for(var i=0;i<trn.length;i++) {
-			if(trn[i].indexOf("https://") < 0 && trn[i].indexOf('@') < 0 && trn[i].indexOf("www.") < 0 && !(trn[i].charAt(0)==":" && trn[i].charAt(trn[i].length-1)==":")) {
-				if ((i<trn.length-1)&&(trn[i]=="to" || trn[i]=="private")&&(trn[i+1].charAt(0)=="[")) {
-					while ( (i<trn.length-1) && (trn[i].charAt(trn[i].length-1)!="]") ) i++;
-				} else { trn[i] = this.convert(trn[i]); }
-			}
-		}
-		return trn.join(' ');
-	},
-	map_en:Array('s`h','S`h','S`H','s`�','sh`','Sh`','SH`',"'o",'yo',"'O",'Yo','YO','zh','w','Zh','ZH','W','ch','Ch','CH','sh','Sh','SH','e`','E`',"'u",'yu',"'U",'Yu',"YU","'a",'ya',"'A",'Ya','YA','a','A','b','B','v','V','g','G','d','D','e','E','z','Z','i','I','j','J','k','K','l','L','m','M','n','N','o','O','p','P','r','R','s','S','t','T','u','U','f','F','h','H','c','C','`','y','Y',"'"),
-	map_ru:Array('��','��','��','��','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�'),
-	addSm:function(i)
-	{
-		$('#textmsg').focus();
-		top.document.textmsg.value += ` :${i}: `;
-	},
-	convert:function(str)
-	{	
-		var p1 = new RegExp("private\\s*\\[(.*?)\\]","");
-		var t1 = new RegExp("to\\s*\\[(.*?)\\]","");
-		var newstr = '';
-		if(str.match(p1)!=null)
-		{
-			newstr = str.match(p1)[0];
-			str = str.replace(str.match(p1)[0],'');
-		}else if(str.match(t1)!=null)
-		{
-			newstr = str.match(t1)[0];
-			str = str.replace(str.match(t1)[0],'');
-		}
-		
-		for(var i=0;i<this.map_en.length;++i) while(str.indexOf(this.map_en[i])>=0) str = str.replace(this.map_en[i],this.map_ru[i]);
-		newstr += str;
-		return newstr;
-	},
+            if(forYou > 0 && this.sound > 0 && this.trim(data[3].toLowerCase()) != top.c.login.toLowerCase())
+            {
+                this.sendSound(1);
+            }
+
+            if(msg_see == 1)
+            {
+                if(this.trim(data[3].toLowerCase()) == top.c.login.toLowerCase() || forYou == 1 || this.filter == 0)
+                {
+                    if( data[9] > 0 ) {
+                        this.sendSound(data[9]);
+                    }
+                    if( data[15] != undefined && data[15] != 0 ) {
+                        this.feerverk( data[15] );
+                        this.feerverk( data[15] );
+                    }
+
+                    if( top.des == 1 ) {
+                        if( data[2] < 4 || global_type == 1 ) {
+                            //������� ���
+                            $('#canal5').html($('#canal5').html()+''+msg);
+                            top.blueTextSee(5);
+                            if( global_type == 1 ) {
+                                //��������� ���
+                                $('#canal4').html($('#canal4').html()+''+msg);
+                                top.blueTextSee(4);
+                            }
+                        }else{
+                            //��������� ���
+                            $('#canal4').html($('#canal4').html()+''+msg);
+                            top.blueTextSee(4);
+                            $('#canal5').html($('#canal5').html()+''+msg);
+                            top.blueTextSee(5);
+                        }
+                    }else{
+                        $('#canal5').html($('#canal5').html()+''+msg);
+                    }
+
+                    /*
+                    if(data[2] == 6 || data[2] == 5) {
+                        //��������� ���������
+                        $('#canal5').html($('#canal5').html()+''+msg);
+                        //$('#canal4').html($('#canal4').html()+'<span id="msg_'+data[0]+'_sys">'+msg+'</span>');
+                        //if(top.cb_rdate[top.cb_select] != 4) {
+                            //top.blueTextSee(5);
+                        //}
+                    }else if(data[2] == 7){
+                        //��������� ��������� (������)
+                        //$('#canal'+top.cb_select).html($('#canal'+top.cb_select).html()+''+msg);
+                        //$('#canal4').html($('#canal4').html()+'<span id="msg_'+data[0]+'_sys">'+msg+'</span>');
+                        //top.blueTextSee(4);
+                    }else if(data[2] == 8){
+                        //��������� ��������� (������ ���)
+                        //$('#canal'+top.cb_select).html($('#canal'+top.cb_select).html()+''+msg);
+                        //$('#canal6').html($('#canal6').html()+'<span id="msg_'+data[0]+'_tap">'+msg+'</span>');
+                        //top.blueTextSee(6);
+                    }else{
+                        //������� ���������
+                        if( data[2] == 1 && data[4] == 'trade' ) {
+                            $('#canal6').html($('#canal6').html()+''+msg);
+                        }else{
+                            $('#canal5').html($('#canal5').html()+''+msg);
+                        }
+                        //top.blueTextSee(5);
+                    }*/
+                }
+            }
+
+
+
+            // document.getElementById("chat_list").addEventListener("scroll", function (event) {
+            // 	console.log(`${pageYOffset}px`)
+            // });
+
+            this.scrollNow(this.msgcount);
+            delete forYou, cls, msg_see, msg, arr;
+        }
+    },
+    testKey: function (m, v) {
+        var i = 0,
+            r = v;
+        v = false;
+        while (i != -1) {
+            if (m[i] != undefined) {
+                if (m[i] == r) {
+                    v = i;
+                    i = -2;
+                }
+            } else {
+                i = -2;
+            }
+            i++;
+        }
+        delete r, m;
+        return v;
+    },
+    isNumber:function(s)
+    {
+        return s = !isNaN(s) ? true : false
+    },
+    testSmile:function(txt)
+    {
+        /*if(top.c.admin < 1) {
+            txr = txt.split(':');
+            var i = 1, j = 0, smid = 0;
+            while(i!=-1)
+            {
+                if(txr[i]!=undefined && j < 3)
+                {
+                    smid = this.testKey(top.sml,txr[i].toLowerCase());
+                    if(smid!=false && this.isNumber(txr[i]) != true)
+                    {
+                        if(smid!=false)
+                        {
+                            txt = txt.replace("\:"+txr[i]+"\:",'<img src="https://'+top.c.img+'/i/smile/'+(txr[i].toLowerCase())+'.gif" style="cursor:pointer" width="'+top.sml[smid+1]+'" height="'+top.sml[smid+2]+'" onclick="chat.addSmile(\''+(txr[i].toLowerCase())+'\')">');
+                        }
+                        j++;
+                    }
+                }else{
+                    i = -3;
+                }
+                i += 2;
+            }
+            delete smid;
+            delete j;
+            delete txr;
+        }else{*/
+        txr = txt.split(':');
+        var i = 1, j = 0, smid = 0;
+        while(i <= txr.length) {
+            if( txr[i] != undefined) {
+                smid = this.testKey(top.sml,txr[i]);
+                imsml = txr[i].split('-');
+                if(((smid != false || smid == 0) && this.isNumber(txr[i]) != true) || (imsml != undefined && imsml[0] == '%usersmile%')) {
+                    if(j < 3 && this.isNumber(top.sml[smid]) != true && (top.sml[smid] != undefined || imsml[0] == '%usersmile%')) {
+                        // ���
+                        if(imsml[0] == '%usersmile%') {
+                            txt = txt.replace(`\:%usersmile%-${imsml[1]}\:`,`<img src="https://${top.c.img}/i/smile/${(imsml[1].toLowerCase())}.gif" title="������� �������">`);
+                        }else{
+                            txt = txt.replace(`\:${txr[i]}\:`,`<img src="https://${top.c.img}/i/smile/${(txr[i].toLowerCase())}.gif" style="cursor:pointer" width="${top.sml[smid+1]}" height="${top.sml[smid+2]}" onclick="chat.addSmile(\'${(txr[i].toLowerCase())}\')">`);
+                        }
+                        j++;
+                    }
+                }
+            }
+            i++;
+        }
+        //}
+        return txt;
+    },
+    trmb: function () {
+        if (this.translit == 1) {
+            $('#textmsg').val(this.convert2($('#textmsg').val()));
+        }
+    },
+    replaceAll:function(t,v,s)
+    {
+        return t.split(v).join(s);
+    },
+    convert2:function(txt)
+    {
+        var trn = new Array();
+        trn = txt.split(' ');
+        for(var i=0;i<trn.length;i++) {
+            if(trn[i].indexOf("https://") < 0 && trn[i].indexOf('@') < 0 && trn[i].indexOf("www.") < 0 && !(trn[i].charAt(0)==":" && trn[i].charAt(trn[i].length-1)==":")) {
+                if ((i<trn.length-1)&&(trn[i]=="to" || trn[i]=="private")&&(trn[i+1].charAt(0)=="[")) {
+                    while ( (i<trn.length-1) && (trn[i].charAt(trn[i].length-1)!="]") ) i++;
+                } else { trn[i] = this.convert(trn[i]); }
+            }
+        }
+        return trn.join(' ');
+    },
+    map_en:Array('s`h','S`h','S`H','s`�','sh`','Sh`','SH`',"'o",'yo',"'O",'Yo','YO','zh','w','Zh','ZH','W','ch','Ch','CH','sh','Sh','SH','e`','E`',"'u",'yu',"'U",'Yu',"YU","'a",'ya',"'A",'Ya','YA','a','A','b','B','v','V','g','G','d','D','e','E','z','Z','i','I','j','J','k','K','l','L','m','M','n','N','o','O','p','P','r','R','s','S','t','T','u','U','f','F','h','H','c','C','`','y','Y',"'"),
+    map_ru:Array('��','��','��','��','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�'),
+    addSm:function(i)
+    {
+        $('#textmsg').focus();
+        top.document.textmsg.value += ` :${i}: `;
+    },
+    convert:function(str)
+    {
+        var p1 = new RegExp("private\\s*\\[(.*?)\\]","");
+        var t1 = new RegExp("to\\s*\\[(.*?)\\]","");
+        var newstr = '';
+        if(str.match(p1)!=null)
+        {
+            newstr = str.match(p1)[0];
+            str = str.replace(str.match(p1)[0],'');
+        }else if(str.match(t1)!=null)
+        {
+            newstr = str.match(t1)[0];
+            str = str.replace(str.match(t1)[0],'');
+        }
+
+        for(var i=0;i<this.map_en.length;++i) while(str.indexOf(this.map_en[i])>=0) str = str.replace(this.map_en[i],this.map_ru[i]);
+        newstr += str;
+        return newstr;
+    },
     sendSound: function (s) {
-		var svolm = 100;
-		if (this.sound == 0) svolm = 0
-		else if (this.sound == 1) svolm = 25;
+        var svolm = 100;
+        if (this.sound == 0) svolm = 0
+        else if (this.sound == 1) svolm = 25;
         else if (this.sound == 2) svolm = 100;
 
         var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
-        
+
         if (isInternetExplorer && window.document["Sound"] && typeof window.document["Sound"].SetVariable !== "undefined") {
             window.document["Sound"].SetVariable("Volume", svolm);
             window.document["Sound"].SetVariable("Sndplay", s);
@@ -992,119 +992,119 @@ var chat = {
             document.getElementById('Sound2').SetVariable("Volume", svolm);
             document.getElementById('Sound2').SetVariable("Sndplay", s);
         }
-        
+
     },
-	getSwf:function(val) {
-		var M$ =  navigator.appName.indexOf("Microsoft")!=-1
-		return (M$ ? window : document)[val]
-	},
-	trim:function(s)
-	{
-		return this.rtrim(this.ltrim(s));
-	},	
-	ltrim:function(s)
-	{
-		return s.replace(/^\s+/, ''); 
-	},	
-	rtrim:function(s)
-	{
-		return s.replace(/\s+$/, ''); 
-	},
-	multiaddto: function (users, tp) {
-		var arr = users.split(',');
-		var i = arr.length;
-		while (i >= 0) {
-			if (arr[i] != undefined) {
-				this.addto(arr[i], tp);
-			}
-			i--;
-		}
-	},
-	osize:function(obj) {
-		var size = 0, key;
-		for (key in obj) {
-			if (obj.hasOwnProperty(key)) size++;
-		}
-		return size;
-	},
-	//���������� ������
-	genchatData:function(data,prs)
-	{
-		if(prs == 1) {
-			data = $.parseJSON(data);
-		}
-		if(data == null && this.saveData!=null)
-		{
-			data = this.saveData;
-			data.js = '';
-			data.rn = undefined;
-			data.key = undefined;
-		}
-		//�������� ���������
-		if(data.msg!=undefined)
-		{
-			var ms = $.parseJSON(data.msg);
-			if(ms['ld']>this.msg_id) this.msg_id = ms['ld'];
-			var i = 0;
-			//while(i <= this.osize(ms.length)+10)
-			while(i <= ms['id'])
-			{
-				
-				if(ms[`m${i}`]!=undefined) this.sendMsg(ms[`m${i}`]);
-				i++;
-			}
-		}
-		//���� ���� JS
-		if(data.js!='')
-		{
-			eval(data.js);
-		}
-		if(data.rnd!=undefined){ c.rnd = data.rnd; }
-		if(data.rn!=undefined){	if($('#chcf10').attr('checked')==true){ $('#roomName').html(data.rn+'<br><small>����� ������: '+data.xu+'</small>'); }else{ $('#roomName').html(data.rn+' ('+data.xu+')'); } }
-		if(data.key!=undefined){	this.key = data.key;	}
-		if(data.list!=undefined)
-		{
-			var i = 0, ji = $.parseJSON(data.list), onll = '', fSort = {}, flSort = {},flSortSee = '"������ ���������"';
-			//��������� ������
-			while(i<=data.xu)
-			{
-				if(ji[i]!=undefined)
-				{
-					/*if($.cookie('chatCfg8')==1)
-					{
-						jj = '['+(ji[i][2]*0.01)+']'+i; //�� ������
-					}else if($.cookie('chatCfg8')==2)
-					{
-						jj = '['+ji[i][3]+']'+i; //�� ����������
-					}else if($.cookie('chatCfg8')==3)
-					{
-						jj = '['+ji[i][4]+']'+i; //�� �����
-					}else{
-						jj = ji[i][1]; //�� ������
-					}*/
-					jj = ji[i][1].toLowerCase(); //�� ������
-					fSort[jj] = i;
-					flSort[i] = jj;
-					flSortSee += `,"${flSort[i]}"`;
-				}
-				i++;
-			}
-			flSortSee = eval(`[${flSortSee}]`);
-			if($.cookie('chatCfg9')==1){flSortSee.sort(game.sort2);}else{flSortSee.sort(game.sort1);}
-			//������� ������
-			i = 0;
-			var onll_alh = '';
-			while (i <= data.xu) {
-				if (fSort[flSortSee[i]] != undefined) {
-					if (ji[fSort[flSortSee[i]]][3] == 50) {
-						onll_alh += `<span class="m0c1">${this.gUser(ji[fSort[flSortSee[i]]],true)}</span>`;
-					} else {
-						onll += `<span class="m0c2">${this.gUser(ji[fSort[flSortSee[i]]],true)}</span>`;
-					}
-				}
-				i++;
-			}
-			$('#onlist').html(onll_alh + '' + onll);
-		}
-	}
+    getSwf:function(val) {
+        var M$ =  navigator.appName.indexOf("Microsoft")!=-1
+        return (M$ ? window : document)[val]
+    },
+    trim:function(s)
+    {
+        return this.rtrim(this.ltrim(s));
+    },
+    ltrim:function(s)
+    {
+        return s.replace(/^\s+/, '');
+    },
+    rtrim:function(s)
+    {
+        return s.replace(/\s+$/, '');
+    },
+    multiaddto: function (users, tp) {
+        var arr = users.split(',');
+        var i = arr.length;
+        while (i >= 0) {
+            if (arr[i] != undefined) {
+                this.addto(arr[i], tp);
+            }
+            i--;
+        }
+    },
+    osize:function(obj) {
+        var size = 0, key;
+        for (key in obj) {
+            if (obj.hasOwnProperty(key)) size++;
+        }
+        return size;
+    },
+    //���������� ������
+    genchatData:function(data,prs)
+    {
+        if(prs == 1) {
+            data = $.parseJSON(data);
+        }
+        if(data == null && this.saveData!=null)
+        {
+            data = this.saveData;
+            data.js = '';
+            data.rn = undefined;
+            data.key = undefined;
+        }
+        //�������� ���������
+        if(data.msg!=undefined)
+        {
+            var ms = $.parseJSON(data.msg);
+            if(ms['ld']>this.msg_id) this.msg_id = ms['ld'];
+            var i = 0;
+            //while(i <= this.osize(ms.length)+10)
+            while(i <= ms['id'])
+            {
+
+                if(ms[`m${i}`]!=undefined) this.sendMsg(ms[`m${i}`]);
+                i++;
+            }
+        }
+        //���� ���� JS
+        if(data.js!='')
+        {
+            eval(data.js);
+        }
+        if(data.rnd!=undefined){ c.rnd = data.rnd; }
+        if(data.rn!=undefined){	if($('#chcf10').attr('checked')==true){ $('#roomName').html(data.rn+'<br><small>����� ������: '+data.xu+'</small>'); }else{ $('#roomName').html(data.rn+' ('+data.xu+')'); } }
+        if(data.key!=undefined){	this.key = data.key;	}
+        if(data.list!=undefined)
+        {
+            var i = 0, ji = $.parseJSON(data.list), onll = '', fSort = {}, flSort = {},flSortSee = '"������ ���������"';
+            //��������� ������
+            while(i<=data.xu)
+            {
+                if(ji[i]!=undefined)
+                {
+                    /*if($.cookie('chatCfg8')==1)
+                    {
+                        jj = '['+(ji[i][2]*0.01)+']'+i; //�� ������
+                    }else if($.cookie('chatCfg8')==2)
+                    {
+                        jj = '['+ji[i][3]+']'+i; //�� ����������
+                    }else if($.cookie('chatCfg8')==3)
+                    {
+                        jj = '['+ji[i][4]+']'+i; //�� �����
+                    }else{
+                        jj = ji[i][1]; //�� ������
+                    }*/
+                    jj = ji[i][1].toLowerCase(); //�� ������
+                    fSort[jj] = i;
+                    flSort[i] = jj;
+                    flSortSee += `,"${flSort[i]}"`;
+                }
+                i++;
+            }
+            flSortSee = eval(`[${flSortSee}]`);
+            if($.cookie('chatCfg9')==1){flSortSee.sort(game.sort2);}else{flSortSee.sort(game.sort1);}
+            //������� ������
+            i = 0;
+            var onll_alh = '';
+            while (i <= data.xu) {
+                if (fSort[flSortSee[i]] != undefined) {
+                    if (ji[fSort[flSortSee[i]]][3] == 50) {
+                        onll_alh += `<span class="m0c1">${this.gUser(ji[fSort[flSortSee[i]]],true)}</span>`;
+                    } else {
+                        onll += `<span class="m0c2">${this.gUser(ji[fSort[flSortSee[i]]],true)}</span>`;
+                    }
+                }
+                i++;
+            }
+            $('#onlist').html(onll_alh + '' + onll);
+        }
+    }
 }
\ No newline at end of file
diff --git a/js/onlineList.js b/js/onlineList.js
index 732b40db..4580aaa1 100644
--- a/js/onlineList.js
+++ b/js/onlineList.js
@@ -8,14 +8,14 @@ var flagVoice = false
 var chunksVoice = []
 
 Element.prototype.remove = function() {
-    this.parentElement.removeChild(this);
+	this.parentElement.removeChild(this);
 }
 NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {
-    for(var i = 0, len = this.length; i < len; i++) {
-        if(this[i] && this[i].parentElement) {
-            this[i].parentElement.removeChild(this[i]);
-        }
-    }
+	for(var i = 0, len = this.length; i < len; i++) {
+		if(this[i] && this[i].parentElement) {
+			this[i].parentElement.removeChild(this[i]);
+		}
+	}
 }
 
 var chat = {
@@ -57,8 +57,8 @@ var chat = {
 			delete this.ignoreList[login];
 			return
 			//msg
-		} 
-		
+		}
+
 		this.ignoreList.x++;
 		this.ignoreList[login] = this.ignoreList.x;
 		this.ignoreList.nms[this.ignoreList.x] = login;
@@ -82,11 +82,11 @@ var chat = {
 				'width':135,
 				'sound':this.getRandom(8,10),
 				'height':99,
-				'zad':3	
+				'zad':3
 			};
 			frc.left -= 35;
 		}
-		
+
 		if( frc.name != undefined ) {
 			this.sendSound( frc.sound );
 			var obj = top.frames.main.document.getElementById('frvrks');
@@ -95,7 +95,7 @@ var chat = {
 				var i = 1;
 				while( i <= frc.x ) {
 					newhtml += `<img style="display:none" id="frvanim_${this.feerverk_id}_img${i}" width="${frc.width}" height="${frc.height}" src="https://img.new-combats.com/fw/${frc.name}/${i}.gif">`;
-                    i++;
+					i++;
 				}
 				newhtml = `<div id="frvanim_${this.feerverk_id}" style="z-index:5000;position:absolute;width:${frc.width}px;height:${frc.height}px;left:${frc.left}px;top:${frc.top}px;">${newhtml}</div>`;
 				$(obj).append(newhtml);
@@ -145,7 +145,7 @@ var chat = {
 	lookSmiles: function () {
 		if ($('#chbtn8').attr('class') == 'db cp chatBtn8_1') {
 			return this.lookSmilesWork('', 'chatBtn8_2')
-		}  
+		}
 		return this.lookSmilesWork('none', 'chatBtn8_1')
 	},
 	lookSmilesWork: function (display, className) {
@@ -158,13 +158,13 @@ var chat = {
 		$(elemId).attr('class', `db cp ${className}`);
 		this[method] = count;
 	},
-	
+
 	// ������ �����
 	// 1
 	filterMsg: function () {
 		if ($('#chbtn1').attr('class') == 'db cp chatBtn1_1') {
 			return this.greyButton_work('#chbtn1', 'chatBtn1_2', "filter", 1)
-		} 
+		}
 		return this.greyButton_work('#chbtn1', 'chatBtn1_1', "filter", 0)
 	},
 
@@ -180,7 +180,7 @@ var chat = {
 		$.cookie('citySys', 0);
 		return
 	},
-	
+
 	// ������ ��������������
 	// 3
 	soundChat: function () {
@@ -188,7 +188,7 @@ var chat = {
 			return this.greyButton_work('#chbtn7', 'chatBtn7_2', "sound", 1)
 		} else if ($('#chbtn7').attr('class') == 'db cp chatBtn7_2') {
 			return this.greyButton_work('#chbtn7', 'chatBtn7_3', "sound", 2)
-		} 
+		}
 		return this.greyButton_work('#chbtn7', 'chatBtn7_1', "sound", 0)
 	},
 
@@ -197,48 +197,48 @@ var chat = {
 	translitChat: function () {
 		if ($('#chbtn6').attr('class') == 'db cp chatBtn6_1') {
 			return this.greyButton_work('#chbtn6', 'chatBtn6_2', "translit", 1)
-		} 
+		}
 		return this.greyButton_work('#chbtn6', 'chatBtn6_1', "translit", 0)
-	}, 
+	},
 
 	subValSend: '',
-    subSend: async function () {
-        if ($('#textmsg').val() != '') {
-            if ($('#textmsg').val() != this.subValSend) {
-                if (this.nozpros == 0) {
+	subSend: async function () {
+		if ($('#textmsg').val() != '') {
+			if ($('#textmsg').val() != this.subValSend) {
+				if (this.nozpros == 0) {
 					this.trmb();
 					var textmsg = $('#textmsg').val();
 
-                    if (cb_date[cb_select] == 7 && (textmsg.match(/to *\[(.*?)\].*/i) || textmsg.match(/private *\[(.*?)\].*/i))) {
-                        for (var cb in cb_date) {
-                            if (cb_date[cb] == 5) {
+					if (cb_date[cb_select] == 7 && (textmsg.match(/to *\[(.*?)\].*/i) || textmsg.match(/private *\[(.*?)\].*/i))) {
+						for (var cb in cb_date) {
+							if (cb_date[cb] == 5) {
 								open_cb(cb, null);
-                            }
-                        }
-                    }
-                    if (typeof window.online_send_jqxhr == "undefined" || window.online_jqxhr.readyState === 4) {
-                        window.online_send_jqxhr = $.post('online.php?r' + c.rnd + '&cas' + ((new Date().getTime()) + Math.random()), {
-                        	msg: textmsg,
-                        	key: this.key,
-                        	mid: this.msg_id,
-                        	rndo: c.rnd,
-                        	cb: cb_date[cb_select]
-                        }, function (data) {
-                        	chat.clearText();
-                        	chat.fc();
+							}
+						}
+					}
+					if (typeof window.online_send_jqxhr == "undefined" || window.online_jqxhr.readyState === 4) {
+						window.online_send_jqxhr = $.post('online.php?r' + c.rnd + '&cas' + ((new Date().getTime()) + Math.random()), {
+							msg: textmsg,
+							key: this.key,
+							mid: this.msg_id,
+							rndo: c.rnd,
+							cb: cb_date[cb_select]
+						}, function (data) {
+							chat.clearText();
+							chat.fc();
 							chat.genchatData(data, 1);
 							chat.scrollNow(true)
 							document.getElementById("textmsg").value = ''
-                        });
-                    }
-                }
-            }
-        }
-    },
+						});
+					}
+				}
+			}
+		}
+	},
 	addto:function(login, type2) {
 		var loginaddT = login;
 		var s = '';
-		if($('#'+$(this.inObj).attr('id')).attr('id') == undefined) {		
+		if($('#'+$(this.inObj).attr('id')).attr('id') == undefined) {
 			$('#textmsg').focus();
 			s = $('#textmsg').val();
 		} else $(this.inObj).focus();
@@ -250,13 +250,13 @@ var chat = {
 		} else if(s.match(reg551) == null) {
 			type = "private";
 		}
-		var type3 = 'to';	
+		var type3 = 'to';
 		var reg2 = new RegExp(""+type+"(\\s*)\\[(.*?)\\]","");
 		var cs = s.replace(reg2,""+type+"$1[,$2,]");
 		var slogin = login.replace(/([\^.*{}$%?\[\]+|\/\(\)])/g,"\\$1");
 		var reg = new RegExp(""+type+"\\s*\\[.*,\\s*"+slogin+"\\s*,.*\\]","");
 		var result = '';
-		var reg3 = new RegExp(""+type+"\\s*\\[(.*?)\\]","");				
+		var reg3 = new RegExp(""+type+"\\s*\\[(.*?)\\]","");
 		while(res = s.match(reg3)) {
 			result += `${res[1]},`;
 			s = s.replace(reg3,'');
@@ -279,7 +279,7 @@ var chat = {
 				if (type2 == 'to') {
 					if (test1 != null) type2 = 'private';
 				}
-				
+
 				if (loginaddT == 'klan' && type2 == 'private') {
 					if (login == 'klan, ') {
 						s = type2 + ' [klan] to [' + prob + '' + str + '' + prob + ']' + space + s;
@@ -288,12 +288,12 @@ var chat = {
 					}
 				}
 				else {s = type2+' ['+prob+''+login+str+''+prob+']'+space+s;}
-			} else {				
+			} else {
 				if(type3 == 'to') type3 = "private";
 				s = type3+' ['+prob+''+str+''+prob+']'+space+s;
 			}
 		} else s = login+str;
-		
+
 		if (this.inObj != null && $('#main').contents().find(`#${this.inObj.id}`).attr('id') != undefined) {
 			$('#main').contents().find(`#${this.inObj.id}`).val(s);
 		} else if ($('#' + $(this.inObj).attr('id')).attr('id') == undefined) {
@@ -310,53 +310,53 @@ var chat = {
 	reMoney: function () {
 		$('#moneyGM').html(`${top.c.money} ��.`);
 	},
-    testTimer: function (n) {
-        clearTimeout(this.t);
-        if ($.cookie('btl') != this.btl) {
-            if ($.cookie('btl') > 0) {
-                this.sendSound(2);
-                if (top.frames['main'].smnpty == undefined) {
+	testTimer: function (n) {
+		clearTimeout(this.t);
+		if ($.cookie('btl') != this.btl) {
+			if ($.cookie('btl') > 0) {
+				this.sendSound(2);
+				if (top.frames['main'].smnpty == undefined) {
 					top.frames['main'].location.href = "main.php";
-				} 
-            }
-            this.btl = $.cookie('btl');
-        }
-        if (this.rtime != this.ct[$.cookie('chatCfg0')] && this.ct[$.cookie('chatCfg0')] != undefined) {
-            this.rtime = this.ct[$.cookie('chatCfg0')];
-            if (this.time > this.rtime) this.time = this.rtime;
-        }
-        if (this.rtime >= 5 || this.r == 0) //was >- 30 lakris fix
-        {
-            if (this.time < 1) {
-                var aot = {
-                	0: 0,
-                	1: 1,
-                	2: 0
-                };
-                if ($('#chcf10').attr('checked') == true) aot[2] = 1;
-                if ($('#autoRefOnline').attr('checked') == true || this.r == 0 || n != false) {
-                    aot[0] = 1;
-                }
-                if (this.nozpros == 0) {
-                    
-                    if (typeof window.online_jqxhr == "undefined" || window.online_jqxhr.readyState === 4) {
-                        window.online_jqxhr = $.getJSON(`online.php?r${c.rnd}&cas${((new Date().getTime()) + Math.random())}`, {key: this.key, mid: this.msg_id, r1: aot[0], r2: aot[1], r3: aot[2], rndo: c.rnd}, function (data) {
-                            if (data.rnd != null) {
-                                chat.genchatData(data);
-                                if (data.key != undefined) chat.saveData = data;
-                                this.g++;
-                                c.rnd = data.rnd;
-                            }
-                        });
-                    }
-                }
-                this.time = 5;
-                this.r++;
-            } else this.time--;
-            this.t = setTimeout('chat.testTimer(false);clearTimeout(this.t);', 1000);
-        }
-    },
-	
+				}
+			}
+			this.btl = $.cookie('btl');
+		}
+		if (this.rtime != this.ct[$.cookie('chatCfg0')] && this.ct[$.cookie('chatCfg0')] != undefined) {
+			this.rtime = this.ct[$.cookie('chatCfg0')];
+			if (this.time > this.rtime) this.time = this.rtime;
+		}
+		if (this.rtime >= 5 || this.r == 0) //was >- 30 lakris fix
+		{
+			if (this.time < 1) {
+				var aot = {
+					0: 0,
+					1: 1,
+					2: 0
+				};
+				if ($('#chcf10').attr('checked') == true) aot[2] = 1;
+				if ($('#autoRefOnline').attr('checked') == true || this.r == 0 || n != false) {
+					aot[0] = 1;
+				}
+				if (this.nozpros == 0) {
+
+					if (typeof window.online_jqxhr == "undefined" || window.online_jqxhr.readyState === 4) {
+						window.online_jqxhr = $.getJSON(`online.php?r${c.rnd}&cas${((new Date().getTime()) + Math.random())}`, {key: this.key, mid: this.msg_id, r1: aot[0], r2: aot[1], r3: aot[2], rndo: c.rnd}, function (data) {
+							if (data.rnd != null) {
+								chat.genchatData(data);
+								if (data.key != undefined) chat.saveData = data;
+								this.g++;
+								c.rnd = data.rnd;
+							}
+						});
+					}
+				}
+				this.time = 5;
+				this.r++;
+			} else this.time--;
+			this.t = setTimeout('chat.testTimer(false);clearTimeout(this.t);', 1000);
+		}
+	},
+
 	gUser:function(data,ol) {
 		var rt = '';
 
@@ -379,11 +379,11 @@ var chat = {
 			}
 			else rt = `<b>${rt}</b>`;
 			if(data[13]!=0) rt = `<span class="uCss${data[13]}">${rt}</span>`;
-			
+
 			if (data[10] > 0) {
 				rt = `<s onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'�������� ��� ������������\',event,3,1,1,2,\'\')">${rt}</s>`;
 			}
-			
+
 			if (data[8] != 0)  data_work(8)
 			else if (data[9] != 0) data_work(9)
 
@@ -396,11 +396,11 @@ var chat = {
 			{
 				rt = `<a href="/clan/${data[4]}" title="${data[4]}" target="_blank"><img width="24" height="15" src="https://${c.img}/i/clan/${data[4]}.gif"></a>${rt}`;
 			}
-			
-			if( data[16] > 0 ) rtData(16) 
-			
+
+			if( data[16] > 0 ) rtData(16)
+
 			rtData(3)
-						
+
 			if(c.lvl>-1)
 			{
 				if(c.city==data[6])
@@ -451,7 +451,7 @@ var chat = {
 			$(`#molch${id}`).html(this.timeOut(this.mlch[id]));
 			this.t_all[id] = setTimeout(`chat.refMolch(${id})`, 1000);
 			return
-		} 
+		}
 		$(`#img_molch${id}`).remove();
 		return delete this.mlch[id], this.t_all;
 	},
@@ -459,7 +459,7 @@ var chat = {
 	fc: function () {
 		$('#textmsg').focus();
 	},
-	
+
 	timeOut: function (v) {
 
 		msPerDay = '';
@@ -508,7 +508,7 @@ var chat = {
 				$('#textmsg').focus();
 				return
 			}
-		} 
+		}
 		return $('#textmsg').val('');
 	},
 	scrollNow: function (userTrue) {
@@ -521,7 +521,7 @@ var chat = {
 		if (userTrue) return $chat_list.scrollBy(0, $chat_list.scrollHeight)
 	},
 	msgcount:0,
-	sendMsg: function(data) {	
+	sendMsg: function(data) {
 
 
 		// ���� ��������� ��������� �� ���� - ����� ������� === 10
@@ -548,7 +548,7 @@ var chat = {
 
 		var msg_see = 1;
 		var global_type = 0;
-		
+
 		if( data[5] != undefined ) {
 			if( data[5].substring(0,7) == 'global:' ) {
 				global_type = 1;
@@ -556,254 +556,254 @@ var chat = {
 			}
 		}
 		if (data[0] == 'new') {
-		    data[0] = `new_msg_ ${this.newmsg++}`;
+			data[0] = `new_msg_ ${this.newmsg++}`;
 		}
-        if (data[2] == 'delete') this.deleteMessage(data[0]);
-        else if (data['d'] > 0) this.deleteMessage(data['d']);
+		if (data[2] == 'delete') this.deleteMessage(data[0]);
+		else if (data['d'] > 0) this.deleteMessage(data['d']);
 		else if (data['s'] > 0) this.deleteMessage(data['s']);
 		else if (data[0] != undefined && top.document.getElementById(`msg_${data[0]}`) == undefined) {
 			var msg  = '';
-				if (data[0] != 0) {
-					if (top.c.admin > 0) {
-						if (data[12] == 1) {
-							msg += '<small style="color:red;text-decoration:blink"> <b>un</b>active </small>';
-						}
+			if (data[0] != 0) {
+				if (top.c.admin > 0) {
+					if (data[12] == 1) {
+						msg += '<small style="color:red;text-decoration:blink"> <b>un</b>active </small>';
 					}
-					if (data[3] != '') {
-						if (data[16] > 0) {
-							msg += `[<a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'���������\',event,\'chat\'); return false;" onClick="chat.addto(\'���������\',\'to\')">${data[3]}</a>]`;
-						} else {
-							msg += `[<a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'${data[3]}\',event,\'chat\'); return false;" onClick="chat.addto(\'${data[3]}\',\'to\')">${data[3]}</a>]`;
-						}
-						if (chat.ignoreList[data[3]] != undefined) msg_see = 0;
-					}
-					if (data[4] != '') {
-						var forYou = 0;
-						//��� ��� �����
-						
-						//���� ��������, ������ �������
-						if (data[4] != '') {
-							var to = '',to2 = '',arr = data[4].split(','),i = 0,vl = '';								
-							//��� ���� ������
-							while (i != -1) {
-								if (arr[i] != undefined) {
-									vl = this.trim(arr[i]);
-									if (vl.toLowerCase() == top.c.login.toLowerCase()) {
-										forYou++;
-									}
-									if (vl.toLowerCase() == top.c.login.toLowerCase()) {
-										vl = this.trim(data[3]);
-									}
-									if (i > 0) {
-										to += ', ';
-										to2 += ', ';
-									}
-									if (data[3] != '') {
-										to += `<span style="cursor:pointer" onclick="chat.addto(\'${vl}\',\'private\');" oncontextmenu="top.infoMenu(\'${this.trim(arr[i])}\',event,\'chat\'); return false;">${this.trim(arr[i])}</span>`;
-
-										if (this.trim(arr[i].toLowerCase()) != top.c.login.toLowerCase()) {
-											to2 += this.trim(arr[i]);
-										} else {
-											if (data[2] == 2) to2 += this.trim(arr[i]);
-											else to2 += this.trim(vl);
-										}
-									}
-								} else i = -2;
-								i++;
-							}
-						}
-						
-						if(data[2] == 6 || data[2] == 8) {
-							var zmlogin = new RegExp("\\[login:(.*?)\\]","");	
-							var reflcd = new RegExp("\\[reflesh_main_zv_priem:(.*?)\\]","");	
-							if (data[5].match(zmlogin) != null) {
-								zmlogin = data[5].match(zmlogin)[1];
-								data[5] = data[5].replace(`[login:${zmlogin}]`, `<a onMouseDown="top.loginGo(\'${zmlogin}\',event);" oncontextmenu="top.infoMenu(\'${zmlogin}\',event,\'chat\'); return false;" title="${zmlogin}" style="cursor:pointer;" onClick="chat.multiAddto(\'${zmlogin}\',\'to\');">${zmlogin}</a>`);
-							}
-							if (data[5].match(reflcd) != null) {
-								reflcd = data[5].match(reflcd)[1];
-								data[5] = data[5].replace(`[reflesh_main_zv_priem:${reflcd}]`, '');
-							}
-						}
-						
-						//�������� ������ ���� ���������� ���������
-						if (data[2] == 6) {
-							//������ ��������, ��������
-							msg += ' <span style="color:red">��������!</span> ';
-						} else if (data[2] == 2) {
-							if (forYou > 0) {
-								msg += ` <span style="color:${data[6]}"><b>to [${to2}]</b></span>`;
-							} else {
-								msg += ` <span style="color:${data[6]}">to [${to2}]</span>`;
-							}
-						} else if (data[2] == 3) {
-							if (this.trim(data[3].toLowerCase()) == top.c.login.toLowerCase()) {
-								forYou++;
-							}
-							if (data[3] != '') {
-								if (data[4] == 'klan' && data[2] == 3) {
-									msg += ' <span class="klan"><span style="cursor:pointer" onclick="chat.multiaddto(\'klan\',\'private\');">private [klan]</span></span>';
-								} else if (data[4] == 'paladins' && data[2] == 3) {
-									msg += ' <span class="klan"><span style="cursor:pointer" onclick="chat.multiaddto(\'paladins\',\'private\');">private [paladins]</span></span>';
-								} else if (data[4] == 'tarmans' && data[2] == 3) {
-									msg += ' <span class="klan"><span style="cursor:pointer" onclick="chat.multiaddto(\'tarmans\',\'private\');">private [tarmans]</span></span>';
-								} else {
-									msg += ` <span class="private"><span style="cursor:pointer" onclick="chat.multiaddto(\'${to2}\',\'private\');">private [ </span>${to}<span style="cursor:pointer" onclick="chat.multiAddto(\'${to2}\',\'private\');"> ]</span></span>`;
-								}
-							}
-						}						
-					}
-					msg += ' ';
-				} 
-				
-				data[5] = this.replaceAll(data[5],"[s1;]",'"');
-				data[5] = this.replaceAll(data[5],"[s2;]",'\'');
-				data[5] = this.replaceAll(data[5],"[s3;]",'<');
-				data[5] = this.replaceAll(data[5],"[s4;]",'>');
-				
-				if ($.cookie('chatCfg2') != 0) {
-					data[5] = chat.testSmile(data[5]);
 				}
-				
-				if (data[6] != 'Black' && data[6] != '') {
+				if (data[3] != '') {
+					if (data[16] > 0) {
+						msg += `[<a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'���������\',event,\'chat\'); return false;" onClick="chat.addto(\'���������\',\'to\')">${data[3]}</a>]`;
+					} else {
+						msg += `[<a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'${data[3]}\',event,\'chat\'); return false;" onClick="chat.addto(\'${data[3]}\',\'to\')">${data[3]}</a>]`;
+					}
+					if (chat.ignoreList[data[3]] != undefined) msg_see = 0;
+				}
+				if (data[4] != '') {
+					var forYou = 0;
+					//��� ��� �����
 
-					var voiceMessageReg = data[5].match(/audio_[0-9]{10}[.]mp3/g)
-					if (voiceMessageReg !== null) {
-						msg += `<font color="${data[6]}">
+					//���� ��������, ������ �������
+					if (data[4] != '') {
+						var to = '',to2 = '',arr = data[4].split(','),i = 0,vl = '';
+						//��� ���� ������
+						while (i != -1) {
+							if (arr[i] != undefined) {
+								vl = this.trim(arr[i]);
+								if (vl.toLowerCase() == top.c.login.toLowerCase()) {
+									forYou++;
+								}
+								if (vl.toLowerCase() == top.c.login.toLowerCase()) {
+									vl = this.trim(data[3]);
+								}
+								if (i > 0) {
+									to += ', ';
+									to2 += ', ';
+								}
+								if (data[3] != '') {
+									to += `<span style="cursor:pointer" onclick="chat.addto(\'${vl}\',\'private\');" oncontextmenu="top.infoMenu(\'${this.trim(arr[i])}\',event,\'chat\'); return false;">${this.trim(arr[i])}</span>`;
+
+									if (this.trim(arr[i].toLowerCase()) != top.c.login.toLowerCase()) {
+										to2 += this.trim(arr[i]);
+									} else {
+										if (data[2] == 2) to2 += this.trim(arr[i]);
+										else to2 += this.trim(vl);
+									}
+								}
+							} else i = -2;
+							i++;
+						}
+					}
+
+					if(data[2] == 6 || data[2] == 8) {
+						var zmlogin = new RegExp("\\[login:(.*?)\\]","");
+						var reflcd = new RegExp("\\[reflesh_main_zv_priem:(.*?)\\]","");
+						if (data[5].match(zmlogin) != null) {
+							zmlogin = data[5].match(zmlogin)[1];
+							data[5] = data[5].replace(`[login:${zmlogin}]`, `<a onMouseDown="top.loginGo(\'${zmlogin}\',event);" oncontextmenu="top.infoMenu(\'${zmlogin}\',event,\'chat\'); return false;" title="${zmlogin}" style="cursor:pointer;" onClick="chat.multiAddto(\'${zmlogin}\',\'to\');">${zmlogin}</a>`);
+						}
+						if (data[5].match(reflcd) != null) {
+							reflcd = data[5].match(reflcd)[1];
+							data[5] = data[5].replace(`[reflesh_main_zv_priem:${reflcd}]`, '');
+						}
+					}
+
+					//�������� ������ ���� ���������� ���������
+					if (data[2] == 6) {
+						//������ ��������, ��������
+						msg += ' <span style="color:red">��������!</span> ';
+					} else if (data[2] == 2) {
+						if (forYou > 0) {
+							msg += ` <span style="color:${data[6]}"><b>to [${to2}]</b></span>`;
+						} else {
+							msg += ` <span style="color:${data[6]}">to [${to2}]</span>`;
+						}
+					} else if (data[2] == 3) {
+						if (this.trim(data[3].toLowerCase()) == top.c.login.toLowerCase()) {
+							forYou++;
+						}
+						if (data[3] != '') {
+							if (data[4] == 'klan' && data[2] == 3) {
+								msg += ' <span class="klan"><span style="cursor:pointer" onclick="chat.multiaddto(\'klan\',\'private\');">private [klan]</span></span>';
+							} else if (data[4] == 'paladins' && data[2] == 3) {
+								msg += ' <span class="klan"><span style="cursor:pointer" onclick="chat.multiaddto(\'paladins\',\'private\');">private [paladins]</span></span>';
+							} else if (data[4] == 'tarmans' && data[2] == 3) {
+								msg += ' <span class="klan"><span style="cursor:pointer" onclick="chat.multiaddto(\'tarmans\',\'private\');">private [tarmans]</span></span>';
+							} else {
+								msg += ` <span class="private"><span style="cursor:pointer" onclick="chat.multiaddto(\'${to2}\',\'private\');">private [ </span>${to}<span style="cursor:pointer" onclick="chat.multiAddto(\'${to2}\',\'private\');"> ]</span></span>`;
+							}
+						}
+					}
+				}
+				msg += ' ';
+			}
+
+			data[5] = this.replaceAll(data[5],"[s1;]",'"');
+			data[5] = this.replaceAll(data[5],"[s2;]",'\'');
+			data[5] = this.replaceAll(data[5],"[s3;]",'<');
+			data[5] = this.replaceAll(data[5],"[s4;]",'>');
+
+			if ($.cookie('chatCfg2') != 0) {
+				data[5] = chat.testSmile(data[5]);
+			}
+
+			if (data[6] != 'Black' && data[6] != '') {
+
+				var voiceMessageReg = data[5].match(/audio_[0-9]{10}[.]mp3/g)
+				if (voiceMessageReg !== null) {
+					msg += `<font color="${data[6]}">
 							<audio id="audioPlayerChat" controls style="width:300px;max-width:400px;" height="20px";>
 								<source src="/audio/${voiceMessageReg[0]}" type="audio/mp3">
 							</audio>
 						</font>`;
-						voiceMessageReg = ""
-					} 
+					voiceMessageReg = ""
+				}
+				else {
+
+					if (data.length === 10) {
+						msg += `<font color="${data[6]}">${data[5]}</font>`;
+					}
 					else {
 
-						if (data.length === 10) {
-							msg += `<font color="${data[6]}">${data[5]}</font>`;
-						}
-						else {
+						// https://img.new-combats.com/i/inf_capitalcity.gif
+						// inf.php?89489
 
-							// https://img.new-combats.com/i/inf_capitalcity.gif
-							// inf.php?89489
-
-
-							// console.log(chat.regexpURL_true(data[5]))
-							
-							// console.log(`������: ${data[6]}   �����: ${data[5]}` )
-							msg += `<font color="${data[6]}">${chat.regexpURL_true(data[5])}</font>`
-							// console.log("�������, ������� ���������")
-						}
-
-						// msg += `<font color="${data[6]}">${data[5]}</font>`;
-
-
-						// https://new-combats.com/n/1070/ 		- ������ 
-						// https://new-combats.com/inf.php?903093 	- ���� �����
-						// https://img.new-combats.com/i/inf_capitalcity.gif" - ���� �����
 
 						// console.log(chat.regexpURL_true(data[5]))
-						// msg += `<font color="${data[6]}">${chat.regexpURL_true(data[5])}</font>`
+
+						// console.log(`������: ${data[6]}   �����: ${data[5]}` )
+						msg += `<font color="${data[6]}">${chat.regexpURL_true(data[5])}</font>`
+						// console.log("�������, ������� ���������")
 					}
 
-				} else {
+					// msg += `<font color="${data[6]}">${data[5]}</font>`;
 
-					
-					
-					// var regexpURL = /[-a-zA-Z0-9@:%_\+.~#?&\/=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&\/=]*)?/gi
-					// var adressURL = data[5].match(regexpURL)
 
-					// if (adressURL !== null) { 
-					// 	msg += `<a href="${adressURL}">${adressURL}</a>`
-					// }
+					// https://new-combats.com/n/1070/ 		- ������
+					// https://new-combats.com/inf.php?903093 	- ���� �����
+					// https://img.new-combats.com/i/inf_capitalcity.gif" - ���� �����
 
-					var voiceMessageReg = data[5].match(/audio_[0-9]{10}[.]mp3/g)
-					if (voiceMessageReg !== null) {
-						msg += `<audio id="audioPlayerChat" controls style="width:300px;max-width:400px;" height="20px";>
+					// console.log(chat.regexpURL_true(data[5]))
+					// msg += `<font color="${data[6]}">${chat.regexpURL_true(data[5])}</font>`
+				}
+
+			} else {
+
+
+
+				// var regexpURL = /[-a-zA-Z0-9@:%_\+.~#?&\/=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&\/=]*)?/gi
+				// var adressURL = data[5].match(regexpURL)
+
+				// if (adressURL !== null) {
+				// 	msg += `<a href="${adressURL}">${adressURL}</a>`
+				// }
+
+				var voiceMessageReg = data[5].match(/audio_[0-9]{10}[.]mp3/g)
+				if (voiceMessageReg !== null) {
+					msg += `<audio id="audioPlayerChat" controls style="width:300px;max-width:400px;" height="20px";>
 							<source src="/audio/${voiceMessageReg[0]}" type="audio/mp3">
 						</audio>`
-						voiceMessageReg = ""
-					}
-					else {
-						msg += chat.regexpURL_true(data[5])
-						// msg += data[5];
-					}
+					voiceMessageReg = ""
+				}
+				else {
+					msg += chat.regexpURL_true(data[5])
+					// msg += data[5];
+				}
 
-				}
-				
-				if(data[2] == 21) {						
-					//e text
-					var text = `[loginfrom] ${data[5]}`;
-					var ftps = `<i><a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'${data[3]}\',event,\'chat\'); return false;" onClick="chat.addto(\'${data[3]}\',\'to\')">${data[3]}</a></i>`;
-					var mblogin = new RegExp("\\[login:(.*?)\\]","");
-					text = text.replace('[loginfrom]',ftps);
-					if(text.match(mblogin)!=null)
-					{
-						mblogin = text.match(mblogin)[1];
-						text = text.replace(`[login:${mblogin}]`,`<i><a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'${mblogin}\',event,\'chat\'); return false;" onClick="chat.addto(\'${mblogin}\',\'to\')">${mblogin}</a></i>`);
-					}
-					msg = `<i>${text}</i>`;			
-				}
-				if(data[1]>0)
+			}
+
+			if(data[2] == 21) {
+				//e text
+				var text = `[loginfrom] ${data[5]}`;
+				var ftps = `<i><a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'${data[3]}\',event,\'chat\'); return false;" onClick="chat.addto(\'${data[3]}\',\'to\')">${data[3]}</a></i>`;
+				var mblogin = new RegExp("\\[login:(.*?)\\]","");
+				text = text.replace('[loginfrom]',ftps);
+				if(text.match(mblogin)!=null)
 				{
-					var td = new Date((parseInt(data[1]))*1000);
-					td = [td,null,null,null];
-					td[1] = td[0].getHours();
-					td[2] = td[0].getMinutes();
-					td[3] = td[0].getSeconds(); 
-					td[4] = td[0].getDay(); 
-					td[5] = td[0].getMonth();
-					td[6] = td[0].getYear();
-					var j = 1;
-					while (j < 6) {
-						if (td[j] < 10) td[j] = `0${td[j]}`;
-						j++;
-					}
-					
-					var cls = forYou > 0 ? 'date2' : 'date'
-					if (data[11] > 0) {
-						msg = `<font style="cursor:help" color="red" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'����������� ������� �� ��������� ������ �������<br>��������� ����������� �������� ��������� ����� � ���������� ����.\',event,3,1,1,3,\'\')"> <b>!</b> </font>${msg}`;
-					}
-					if (data[10] > 0) {
-						msg = `<font style="cursor:help" color="green" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'��� ���������� ���������, ��� ����� ���� ���������� �� ����� �������<br>��������� ����������� �������� ��������� ����� � ���������� ����.\',event,3,1,1,3,\'\')"> <b>G</b> </font>${msg}`;
-					}
-					var msg22  = '<span ';
-					if(top.c.admin > 0) {
-						msg22 += `oncontextmenu="chat.deleteMessage(${data[0]});
-						return false;" `;
-					}
-
-					// �����������!!!
-					if (data[8] == 2) {
-						if (data[14] == undefined) {
-							data[14] = '--:--';
-						}
-						if (data[14] == '--:--' && data[1] > 0) {
-							data[14] = data[1];
-							var date14 = new Date(data[14] * 1000);
-							data[14] = `${date14.getHours()}:${date14.getMinutes()}`;
-						}
-						msg22 += `class="${cls}">${data[14]}</span> `;
-					} else {
-						if (data[13] == undefined) {
-							data[13] = '--:--';
-						}
-						if (data[13] == '--:--' && data[1] > 0) {
-							data[13] = data[1];
-							var date13 = new Date(data[13] * 1000);
-							data[13] = `${date13.getHours()}:${date13.getMinutes()}`;
-						}
-						msg22 += `class="${cls}">${data[13]}</span> `;
-					}
-					msg = msg22+msg;
+					mblogin = text.match(mblogin)[1];
+					text = text.replace(`[login:${mblogin}]`,`<i><a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'${mblogin}\',event,\'chat\'); return false;" onClick="chat.addto(\'${mblogin}\',\'to\')">${mblogin}</a></i>`);
 				}
-				this.msgcount++;
-				
+				msg = `<i>${text}</i>`;
+			}
+			if(data[1]>0)
+			{
+				var td = new Date((parseInt(data[1]))*1000);
+				td = [td,null,null,null];
+				td[1] = td[0].getHours();
+				td[2] = td[0].getMinutes();
+				td[3] = td[0].getSeconds();
+				td[4] = td[0].getDay();
+				td[5] = td[0].getMonth();
+				td[6] = td[0].getYear();
+				var j = 1;
+				while (j < 6) {
+					if (td[j] < 10) td[j] = `0${td[j]}`;
+					j++;
+				}
+
+				var cls = forYou > 0 ? 'date2' : 'date'
+				if (data[11] > 0) {
+					msg = `<font style="cursor:help" color="red" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'����������� ������� �� ��������� ������ �������<br>��������� ����������� �������� ��������� ����� � ���������� ����.\',event,3,1,1,3,\'\')"> <b>!</b> </font>${msg}`;
+				}
+				if (data[10] > 0) {
+					msg = `<font style="cursor:help" color="green" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'��� ���������� ���������, ��� ����� ���� ���������� �� ����� �������<br>��������� ����������� �������� ��������� ����� � ���������� ����.\',event,3,1,1,3,\'\')"> <b>G</b> </font>${msg}`;
+				}
+				var msg22  = '<span ';
+				if(top.c.admin > 0) {
+					msg22 += `oncontextmenu="chat.deleteMessage(${data[0]});
+						return false;" `;
+				}
+
+				// �����������!!!
+				if (data[8] == 2) {
+					if (data[14] == undefined) {
+						data[14] = '--:--';
+					}
+					if (data[14] == '--:--' && data[1] > 0) {
+						data[14] = data[1];
+						var date14 = new Date(data[14] * 1000);
+						data[14] = `${date14.getHours()}:${date14.getMinutes()}`;
+					}
+					msg22 += `class="${cls}">${data[14]}</span> `;
+				} else {
+					if (data[13] == undefined) {
+						data[13] = '--:--';
+					}
+					if (data[13] == '--:--' && data[1] > 0) {
+						data[13] = data[1];
+						var date13 = new Date(data[13] * 1000);
+						data[13] = `${date13.getHours()}:${date13.getMinutes()}`;
+					}
+					msg22 += `class="${cls}">${data[13]}</span> `;
+				}
+				msg = msg22+msg;
+			}
+			this.msgcount++;
+
 			msg = `<span class="m0c1" id="msg_${data[0]}">${msg}<br></span>`;
-			
+
 			if (forYou > 0 && this.sound > 0 && this.trim(data[3].toLowerCase()) != top.c.login.toLowerCase()) {
 				this.sendSound(1);
 			}
-			
+
 			if(msg_see == 1)
 			{
 				if(this.trim(data[3].toLowerCase()) == top.c.login.toLowerCase() || forYou == 1 || this.filter == 0)
@@ -813,7 +813,7 @@ var chat = {
 						this.feerverk( data[15] );
 						this.feerverk( data[15] );
 					}
-					
+
 					if( top.des == 1 ) {
 						if( data[2] < 4 || global_type == 1 ) {
 							//������� ���
@@ -831,7 +831,7 @@ var chat = {
 					else {
 						// var $htmlElementsMessage = new DOMParser().parseFromString(messg, "text/html").getElementsByTagName("span")[0]
 						// document.getElementById('canal5').append($htmlElementsMessage)
-						$('#canal5').html(`${$('#canal5').html()}${msg}`); 
+						$('#canal5').html(`${$('#canal5').html()}${msg}`);
 					}
 				}
 			}
@@ -858,7 +858,7 @@ var chat = {
 					v = i;
 					i = -2;
 				}
-			} 
+			}
 			else i = -2;
 			i++;
 		}
@@ -915,7 +915,7 @@ var chat = {
 		if (domainsEN) for (var key of domainsEN) {
 			if (!key.match(/^[a-zA-z�-��-�0-9]+$/i)) allURL.add(key)
 		}
-		
+
 		if (domainsRUS) for (var key of domainsRUS) {
 			if (!key.match(/^[a-zA-z�-��-�0-9]+$/i)) allURL.add(key)
 		}
@@ -925,14 +925,14 @@ var chat = {
 		var trueURL = []
 		var falseURL = false
 
-	
+
 		for (var key of allURL) {
 			if (key.match(/vk\.com/i)) trueURL.push(key)
 			else if (key.match(/youtube\.com/i)) trueURL.push(key)
 			else if (key.match(/youtu\.be/i)) trueURL.push(key)
 			else if (key.match(/twitch\.tv/i)) trueURL.push(key)
 			else if (key.match(/new-combats\.com/i)) trueURL.push(key)
-			else if (key.match(/https:\/\/rpgtop\.su\/vote\/25443/i)) trueURL.push(key)
+			else if (key.match(/https:\/\/rpgtop\.su\/vote\/26677/i)) trueURL.push(key)
 			else if (key.match(/inf\.php/i)) trueURL.push(key)
 			else  falseURL = true
 		}
@@ -942,22 +942,22 @@ var chat = {
 		finallyStr = finallyStr.replace(
 			/(<img src=")?(https?:\/\/)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z()]{1,6}\b([-a-zA-Z0-9()@:%_;\+.~#?&\/\/=]*)/gi,
 			(match) => {
-			  if (/^(<img src=")/.test(match)) {
-				  return match
-			  }
-			  else if (match.match(/new-combats\.com/i)) return match
-			  else if (match.match(/inf\.php/i)) return match
-			  else if (/^(https?:\/\/)/.test(match)) {
-				return `<a class="URL-a" href="${match}" target="_blank">${match}</a>`
-			  }
-			  else {
-				return `<a class="URL-a" href="http://${match}" target="_blank">${match}</a>`
-			  }
+				if (/^(<img src=")/.test(match)) {
+					return match
+				}
+				else if (match.match(/new-combats\.com/i)) return match
+				else if (match.match(/inf\.php/i)) return match
+				else if (/^(https?:\/\/)/.test(match)) {
+					return `<a class="URL-a" href="${match}" target="_blank">${match}</a>`
+				}
+				else {
+					return `<a class="URL-a" href="https://${match}" target="_blank">${match}</a>`
+				}
 			}
-		  )
-		
-		  finallyStr = finallyStr.replace(regexpForbiddenWords, () => "")
-		
+		)
+
+		finallyStr = finallyStr.replace(regexpForbiddenWords, () => "")
+
 		return finallyStr
 	},
 	convert2:function(txt)
@@ -989,7 +989,7 @@ var chat = {
 		var p1 = new RegExp("private\\s*\\[(.*?)\\]", "");
 		var t1 = new RegExp("to\\s*\\[(.*?)\\]", "");
 		var newstr = '';
-		
+
 		if (str.match(p1) != null) this.convert_work(p1)
 		else if (str.match(t1) != null) this.convert_work(t1)
 
@@ -998,24 +998,24 @@ var chat = {
 		newstr += str;
 		return newstr;
 	},
-    sendSound: function (s) {
+	sendSound: function (s) {
 		var svolm = 100;
 		if (this.sound == 0) svolm = 0
 		else if (this.sound == 1) svolm = 25;
-        else if (this.sound == 2) svolm = 100;
+		else if (this.sound == 2) svolm = 100;
 
-        var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
-        
-        if (isInternetExplorer && window.document["Sound"] && typeof window.document["Sound"].SetVariable !== "undefined") {
-            window.document["Sound"].SetVariable("Volume", svolm);
-            window.document["Sound"].SetVariable("Sndplay", s);
-		} 
+		var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
+
+		if (isInternetExplorer && window.document["Sound"] && typeof window.document["Sound"].SetVariable !== "undefined") {
+			window.document["Sound"].SetVariable("Volume", svolm);
+			window.document["Sound"].SetVariable("Sndplay", s);
+		}
 		else if(document.getElementById('Sound2') && typeof document.getElementById('Sound2').SetVariable !== "undefined") {
-            document.getElementById('Sound2').SetVariable("Volume", svolm);
-            document.getElementById('Sound2').SetVariable("Sndplay", s);
-        }
-        
-    },
+			document.getElementById('Sound2').SetVariable("Volume", svolm);
+			document.getElementById('Sound2').SetVariable("Sndplay", s);
+		}
+
+	},
 	getSwf:function(val) {
 		var M$ =  navigator.appName.indexOf("Microsoft")!=-1
 		return (M$ ? window : document)[val]
@@ -1066,7 +1066,7 @@ var chat = {
 			if (ms['ld'] > this.msg_id) this.msg_id = ms['ld'];
 			var i = 0;
 			while (i <= ms['id']) {
-				
+
 				if (ms[`m${i}`] != undefined) {
 					// console.group(ms[`m${i}`])
 					this.sendMsg(ms[`m${i}`]);
@@ -1076,11 +1076,11 @@ var chat = {
 		}
 		//���� ���� JS
 		if (data.js != '') eval(data.js);
-		if(data.rnd!=undefined) c.rnd = data.rnd; 
+		if(data.rnd!=undefined) c.rnd = data.rnd;
 		if (data.rn != undefined) {
 			if ($('#chcf10').attr('checked') == true) {
 				$('#roomName').html(`${data.rn}<br><small>����� ������: ${data.xu}</small>`);
-			} 
+			}
 			else $('#roomName').html(`${data.rn} (${data.xu})`);
 		}
 		if(data.key!=undefined)	this.key = data.key;
@@ -1117,9 +1117,9 @@ var chat = {
 		}
 	},
 	voiceMessage: function () {
-		flagVoice = !flagVoice 
+		flagVoice = !flagVoice
 		if (flagVoice) return chat.startRecording(flagVoice)
-        return chat.startRecording(flagVoice)
+		return chat.startRecording(flagVoice)
 	},
 	startRecording: function (flag) {
 
@@ -1127,11 +1127,11 @@ var chat = {
 			if (navigator.mediaDevices.getUserMedia) {
 				var $pVoiceMessages = document.getElementById("timerVoiceMess")
 				$pVoiceMessages.hidden = false
-				
+
 				var constraints = {
 					audio: true
 				}
-				
+
 				var onSuccess = function (stream) {
 					mediaRecorder = new MediaRecorder(stream);
 
@@ -1144,7 +1144,7 @@ var chat = {
 					setIntervalSound = setTimeout(function tickMlsec() {
 						if (timerSecMessage === 60) {
 							flagVoice = !flagVoice
-							
+
 							chat.styleRecordButton({
 								textButt: "������",
 								color: "",
@@ -1161,7 +1161,7 @@ var chat = {
 
 						if (++timerMlSecMessage > 9) {
 							timerMlSecMessage = 0
-								++timerSecMessage
+							++timerSecMessage
 						}
 
 						setIntervalSound = setTimeout(tickMlsec, 100)
@@ -1215,7 +1215,7 @@ var chat = {
 
 		if (allSetting) {
 			clearInterval(setIntervalSound)
-			
+
 			$pVoiceMessages.textContent = "00:00,0"
 			$buttonVoiceMess.textContent = textButt
 			$buttonVoiceMess.style.color = color
@@ -1233,12 +1233,12 @@ var chat = {
 			})
 			return
 		}
-		
+
 		var $footerTop = document.getElementsByClassName("allChat")[1].offsetTop
 		var $tdLeft =  $buttonVoiceMess.parentElement.offsetLeft
 		var $VoiceWidth = $buttonVoiceMess.clientWidth
-		var $pVoiceWidth = $pVoiceMessages.clientWidth	
-		
+		var $pVoiceWidth = $pVoiceMessages.clientWidth
+
 		$pVoiceMessages.style.top = `${$footerTop - 30}px`
 		$pVoiceMessages.style.left = `${($tdLeft + 9) + (($VoiceWidth - $pVoiceWidth) / 2)}px`
 
@@ -1249,7 +1249,7 @@ var chat = {
 		return
 	},
 	mediaRecorderStop: function () {
-	
+
 		if (timerSecMessage < 2) {
 			chunksVoice.pop()
 			return
diff --git a/jx/battle/log_text.php b/jx/battle/log_text.php
index 0ea2fb1c..91c22808 100644
--- a/jx/battle/log_text.php
+++ b/jx/battle/log_text.php
@@ -1,7 +1,7 @@
 <?php
 
-$log_text    = [];
-$log_text[0] = []; //��� ���.
+$log_text    = array();
+$log_text[0] = array(); //��� ���.
 //R1
 $log_text[0][1][0] = '�������� ���-�� ������';
 $log_text[0][1][1] = '�����������';
@@ -291,6 +291,21 @@ $log_text[1][7][10] = '
 $log_text[1][7][11] = '���� ����� ������';
 $log_text[1][7][12] = '����������� ����';
 $log_text[1][7][13] = '����';
+/*
+$log_text[1][7][0] = '�����';
+$log_text[1][7][1] = '������� ����';
+$log_text[1][7][2] = '����������� ����';
+$log_text[1][7][3] = '����������� ����';
+$log_text[1][7][4] = '���������� ����';
+$log_text[1][7][5] = '���� ��������������';
+$log_text[1][7][6] = '�������������� ����';
+$log_text[1][7][7] = '���� ������ �����';
+$log_text[1][7][8] = '���� ������� ������';
+$log_text[1][7][9] = '���� ����� ������';
+$log_text[1][7][10] = '���� ����� ������';
+$log_text[1][7][11] = '����������� ����';
+$log_text[1][7][12] = '����';
+*/
 
 //R8
 $log_text[1][8][0] = '�� �������������� ��������';
@@ -355,6 +370,12 @@ $log_text[1][15][1] = '
 $log_text[0][15][2] = '�������� ���� ��� �� �����';
 $log_text[1][15][2] = '��������� ���� ��� �� �����';
 
+
+
+
+
+
+
 //������ / ������
 $log_text[0][16][0] = '�����������';
 $log_text[1][16][0] = '������������';
@@ -434,3 +455,5 @@ $log_text[1][21][3] = '{u1} 
 $log_text[1][21][4] = '{u1} � ������ ����������, ������ ��������� �� ��, �������� &quot;{pr}&quot;';
 $log_text[1][21][5] = '{u1} ����� � ����� � ������ ��������� �������� &quot;{pr}&quot;';
 $log_text[1][21][6] = '{u1} �������� �� ���������, � �������� �������� &quot;{pr}&quot;';
+
+?>
\ 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') . ' (����������� ������): <b>' . mysql_real_escape_string($t) . '</b>","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'
+        ) . ' (����������� ������): <b>' . mysql_real_escape_string($t) . '</b>","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 '<script>document.getElementById(\'teams\').style.display=\'none\';var battleFinishData = "' . $u->info['battle_text'] . '";</script>';
-                $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 '<script>alert("�������� ��� ��� ����������.");location.href="main.php?finish=1";</script>';
-            }
-        }
-
-        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 '<script>location="main.php";</script>';
-                }
-            } else {
-                mysql_query('UPDATE `users` SET `battle` = "0" WHERE `battle` = "' . $u->info['battle'] . '" LIMIT 100');
-                if (!isset($CRON_CORE)) {
-                    die('<script>location="main.php";</script>');
-                }
-            }
-        } else {
-            //�������� ������ � �������� � ���
-            $btl->teamsTake();
-
-            if (isset($_POST['useitem']) && $btl->testUsersLive() == true) {
-                $magic->useItems((int)$_POST['useitem']);
-                if ($u->error != '') {
-                    echo '<font color=red><center><b>' . $u->error . '</b></center></font>';
-                }
-            }
-
-            //������� �����,������,������� � �.�.
-            //����
-            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 '<font color=red><center><b>' . $rsm . '</b></center></font>';
-                    }
-                    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 '<font color="red"><center><b>' . $btl->e . '</b></center></font>';
-                }
-                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 .= '<script type="text/javascript">eatk=' . $atk1 . ';
-			$("#nabito").html("' . (floor($btl->users[$btl->uids[$u->info['id']]]['battle_yron'])) . $dtxtn . '");
-			$("#expmaybe").html("' . (floor($btl->users[$btl->uids[$u->info['id']]]['battle_exp'])) . '");
-			$("#timer_out").html("' . $tmr . '");
-			$(\'#pers_magic\').html("' . $u->btlMagicList() . '");
-			g_iCount = 30;
-			noconnect = 15;
-			connect = 1;
-			$("#go_btn").show();
-			$("#reflesh_btn").show();
-			za = ' . (0 + $btl->stats[$btl->uids[$u->info['id']]]['zona']) . '; genZoneAtack();
-			zb = ' . (0 + $btl->testZonbVis()) . '; genZoneBlock();
-			refleshPoints();
-			tactic(1,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic1']) . ');
-			tactic(2,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic2']) . ');
-			tactic(3,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic3']) . ');
-			tactic(4,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic4']) . ');
-			tactic(5,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic5']) . ');
-			tactic(6,' . (0 + floor($btl->users[$btl->uids[$u->info['id']]]['tactic6'])) . ');
-			smnpty=' . (0 + $u->info['smena']) . ';
-			mainstatus(' . $btl->mainStatus . ');
-			tactic(7,"' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic7']) . '");
-			smena_alls = "0";
-			ggcode="' . $code . '";
-			' . $js . '
-			</script>';
-
-                echo($rehtml);
-
-                if ($btl->cached == true) {
-                    $btl->clear_cache_start();
-                }
-
-                unset($atk1);
-            }
-            echo '<script>ggcode="' . $code . '";if(t057!=null){clearTimeout(t057);}</script>';
+    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 '<script>document.getElementById(\'teams\').style.display=\'none\';var battleFinishData = "' . $u->info['battle_text'] . '";</script>';
+            $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 '<script>alert("�������� ��� ��� ����������.");location.href="main.php?finish=1";</script>';
         }
     }
+
+    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 '<script>location="main.php";</script>';
+            }
+        } else {
+            mysql_query('UPDATE `users` SET `battle` = "0" WHERE `battle` = "' . $u->info['battle'] . '" LIMIT 100');
+            if (!isset($CRON_CORE)) {
+                die('<script>location="main.php";</script>');
+            }
+        }
+    } else {
+        //�������� ������ � �������� � ���
+        $btl->teamsTake();
+
+        if (isset($_POST['useitem']) && $btl->testUsersLive()) {
+            $magic->useItems((int)$_POST['useitem']);
+            if ($u->error != '') {
+                echo '<div style="color: red; font-weight: bold; text-align: center">' . $u->error . '</div>';
+            }
+        }
+
+        //������� �����,������,������� � �.�.
+        //����
+        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 '<font color=red><center><b>' . $rsm . '</b></center></font>';
+                }
+                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 '<font color="red"><center><b>' . $btl->e . '</b></center></font>';
+            }
+            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 .= '<script type="text/javascript">eatk=' . $atk1 . ';
+        $("#nabito").html("' . (floor($btl->users[$btl->uids[$u->info['id']]]['battle_yron'])) . $dtxtn . '");
+        $("#expmaybe").html("' . (floor($btl->users[$btl->uids[$u->info['id']]]['battle_exp'])) . '");
+        $("#timer_out").html("' . $tmr . '");
+        $(\'#pers_magic\').html("' . $u->btlMagicList() . '");
+        g_iCount = 30;
+        noconnect = 15;
+        connect = 1;
+        $("#go_btn").show();
+        $("#reflesh_btn").show();
+        za = ' . (0 + $btl->stats[$btl->uids[$u->info['id']]]['zona']) . '; genZoneAtack();
+        zb = ' . (0 + $btl->testZonbVis()) . '; genZoneBlock();
+        refleshPoints();
+        tactic(1,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic1']) . ');
+        tactic(2,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic2']) . ');
+        tactic(3,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic3']) . ');
+        tactic(4,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic4']) . ');
+        tactic(5,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic5']) . ');
+        tactic(6,' . (0 + floor($btl->users[$btl->uids[$u->info['id']]]['tactic6'])) . ');
+        smnpty=' . (0 + $u->info['smena']) . ';
+        mainstatus(' . $btl->mainStatus . ');
+        tactic(7,"' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic7']) . '");
+        smena_alls = "0";
+        ggcode="' . $code . '";
+        ' . $js . '
+        </script>';
+
+            echo($rehtml);
+
+            if ($btl->cached) {
+                $btl->clear_cache_start();
+            }
+
+            unset($atk1);
+        }
+        echo '<script>ggcode="' . $code . '";if(t057!=null){clearTimeout(t057);}</script>';
+
+    }
 }
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 @@
 <?php
 
 # �������� 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().'<br>'.$_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').' (����������� ������): <b>'.mysql_real_escape_string($t).'</b>","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('<script>ggcode="'.$code.'";if(t057!=null){clearTimeout(t057);}</script>');
-			}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']<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 '<script>location="main.php";</script>';
-				}
-			}else{
-				mysql_query('UPDATE `users` SET `battle` = "0" WHERE `battle` = "'.$u->info['battle'].'" LIMIT 100');
-				if(!isset($CRON_CORE)) {
-					die('<script>location="main.php";</script>');
-				}
-			}
-		}else{
-			//�������� ������ � �������� � ���
-				$btl->teamsTake();
-				
-			if(isset($_POST['useitem'])) {
-				$magic->useItems((int)$_POST['useitem']);
-				if($u->error!='') {
-					echo '<font color=red><center><b>'.$u->error.'</b></center></font>';
-				}
-			}
-				
-			//������� �����,������,������� � �.�.
-				//����
-					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 '<font color=red><center><b>'.$rsm.'</b></center></font>';
-						}
-						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 '<font color="red"><center><b>'.$btl->e.'</b></center></font>';
-				}
-				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 '<script>ggcode="'.$code.'";if(t057!=null){clearTimeout(t057);}</script>';
-		*/
-		}
-	}
+    mysql_query(
+        'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #' . date('d.m.Y') . ' %' . date(
+            'H:i:s'
+        ) . ' (����������� ������): <b>' . mysql_real_escape_string(
+            $t
+        ) . '</b>","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('<script>ggcode="' . $code . '";if(t057!=null){clearTimeout(t057);}</script>');
+        } 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 '<script>location="main.php";</script>';
+            }
+        } else {
+            mysql_query(
+                'UPDATE `users` SET `battle` = "0" WHERE `battle` = "' . $u->info['battle'] . '" LIMIT 100'
+            );
+            if (!isset($CRON_CORE)) {
+                die('<script>location="main.php";</script>');
+            }
+        }
+    } else {
+        //�������� ������ � �������� � ���
+        $btl->teamsTake();
+
+        if (isset($_POST['useitem'])) {
+            $magic->useItems((int)$_POST['useitem']);
+            if ($u->error != '') {
+                echo '<font color=red><center><b>' . $u->error . '</b></center></font>';
+            }
+        }
+
+        //������� �����,������,������� � �.�.
+        //����
+        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 '<font color=red><center><b>' . $rsm . '</b></center></font>';
+                }
+                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 '<font color="red"><center><b>' . $btl->e . '</b></center></font>';
+            }
+            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').' (����������� ������): <b>'.mysql_real_escape_string($t).'</b>","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('<b><center><font color=red>�� ������� ��������� ������, ��������� ������� �����...</font></center></b>');
-	}*/
-}
-
-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('<script>ggcode="'.$code.'";if(t057!=null){clearTimeout(t057);}</script>');
-			}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' => '<br />', 
-				'\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']<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 '<script>location="main.php";</script>';
-				}
-			}else{
-				mysql_query('UPDATE `users` SET `battle` = "0" WHERE `battle` = "'.$u->info['battle'].'" LIMIT 100');
-				if(!isset($CRON_CORE)) {
-					die('<script>location="main.php";</script>');
-				}
-			}
-		}else{
-			//�������� ������ � �������� � ���
-				$btl->teamsTake();
-				
-			if(isset($_POST['useitem'])) {
-				$magic->useItems((int)$_POST['useitem']);
-				if($u->error!='') {
-					echo '<font color=red><center><b>'.$u->error.'</b></center></font>';
-				}
-			}
-				
-			//������� �����,������,������� � �.�.
-				//����
-					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 '<font color=red><center><b>'.$rsm.'</b></center></font>';
-						}
-						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 '<font color="red"><center><b>'.$btl->e.'</b></center></font>';
-				}
-				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 .= '<script type="text/javascript">eatk='.$atk1.';
+    mysql_query(
+        'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #' . date('d.m.Y') . ' %' . date(
+            'H:i:s'
+        ) . ' (����������� ������): <b>' . mysql_real_escape_string($t) . '</b>","capitalcity","INFINITY","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';
+        }
+        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');
+}
+
+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']);
+        }
+        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('<script>ggcode="' . $code . '";if(t057!=null){clearTimeout(t057);}</script>');
+            } 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 '<script>location="main.php";</script>';
+                }
+            } else {
+                mysql_query(
+                    'UPDATE `users` SET `battle` = "0" WHERE `battle` = "' . $u->info['battle'] . '" LIMIT 100'
+                );
+                if (!isset($CRON_CORE)) {
+                    die('<script>location="main.php";</script>');
+                }
+            }
+        } else {
+            //�������� ������ � �������� � ���
+            $btl->teamsTake();
+
+            if (isset($_POST['useitem'])) {
+                $magic->useItems((int)$_POST['useitem']);
+                if ($u->error != '') {
+                    echo '<font color=red><center><b>' . $u->error . '</b></center></font>';
+                }
+            }
+
+            //������� �����,������,������� � �.�.
+            //����
+            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 '<font color=red><center><b>' . $rsm . '</b></center></font>';
+                    }
+                    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 '<font color="red"><center><b>' . $btl->e . '</b></center></font>';
+                }
+                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 .= '<script type="text/javascript">eatk=' . $atk1 . ';
 			if(document.getElementById("nabito")!=undefined)
 			{
-				document.getElementById("nabito").innerHTML = "'.(floor($btl->users[$btl->uids[$u->info['id']]]['battle_yron'])).'";
+				document.getElementById("nabito").innerHTML = "' . (floor(
+                        $btl->users[$btl->uids[$u->info['id']]]['battle_yron']
+                    )) . '";
 			}
 			if(document.getElementById("expmaybe")!=undefined)
 			{
-				document.getElementById("expmaybe").innerHTML = "'.(floor($btl->users[$btl->uids[$u->info['id']]]['battle_exp'])).'";
+				document.getElementById("expmaybe").innerHTML = "' . (floor(
+                        $btl->users[$btl->uids[$u->info['id']]]['battle_exp']
+                    )) . '";
 			}
 			if(document.getElementById("timer_out")!=undefined)
 			{
-				document.getElementById("timer_out").innerHTML = "'.round(($btl->info['timeout']/60),2).'";
+				document.getElementById("timer_out").innerHTML = "' . round(($btl->info['timeout'] / 60), 2) . '";
 			}
-			$(\'#pers_magic\').html("'.$u->btlMagicList().'");
+			$(\'#pers_magic\').html("' . $u->btlMagicList() . '");
 			g_iCount = 30;
 			noconnect = 15;
 			connect = 1;
@@ -316,34 +270,34 @@ if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' || isset($CRON_CORE))
 			{
 				document.getElementById("reflesh_btn").disabled = "";
 			}
-			za = '.(0+$btl->stats[$btl->uids[$u->info['id']]]['zona']).'; genZoneAtack();
-			zb = '.(0+$btl->testZonbVis()).'; genZoneBlock();
+			za = ' . (0 + $btl->stats[$btl->uids[$u->info['id']]]['zona']) . '; genZoneAtack();
+			zb = ' . (0 + $btl->testZonbVis()) . '; genZoneBlock();
 			refleshPoints();
-			tactic(1,'.(0+$btl->users[$btl->uids[$u->info['id']]]['tactic1']).');
-			tactic(2,'.(0+$btl->users[$btl->uids[$u->info['id']]]['tactic2']).');
-			tactic(3,'.(0+$btl->users[$btl->uids[$u->info['id']]]['tactic3']).');
-			tactic(4,'.(0+$btl->users[$btl->uids[$u->info['id']]]['tactic4']).');
-			tactic(5,'.(0+$btl->users[$btl->uids[$u->info['id']]]['tactic5']).');
-			tactic(6,'.(0+floor($btl->users[$btl->uids[$u->info['id']]]['tactic6'])).');
-			smnpty='.(0+$u->info['smena']).';
-			mainstatus('.$btl->mainStatus.');
-			tactic(7,"'.(0+$btl->users[$btl->uids[$u->info['id']]]['tactic7']).'");
+			tactic(1,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic1']) . ');
+			tactic(2,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic2']) . ');
+			tactic(3,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic3']) . ');
+			tactic(4,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic4']) . ');
+			tactic(5,' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic5']) . ');
+			tactic(6,' . (0 + floor($btl->users[$btl->uids[$u->info['id']]]['tactic6'])) . ');
+			smnpty=' . (0 + $u->info['smena']) . ';
+			mainstatus(' . $btl->mainStatus . ');
+			tactic(7,"' . (0 + $btl->users[$btl->uids[$u->info['id']]]['tactic7']) . '");
 			smena_alls = "0";
-			ggcode="'.$code.'";
-			'.$js.'
+			ggcode="' . $code . '";
+			' . $js . '
 			</script>';
-			
-			echo ($rehtml);
-			
-			if( $btl->cached == true ) {
-				$btl->clear_cache_start();
-			}
-			
-			unset($atk1);
-		}
-		echo '<script>ggcode="'.$code.'";if(t057!=null){clearTimeout(t057);}</script>';
-		}
-	}
+
+                echo($rehtml);
+
+                if ($btl->cached == true) {
+                    $btl->clear_cache_start();
+                }
+
+                unset($atk1);
+            }
+            echo '<script>ggcode="' . $code . '";if(t057!=null){clearTimeout(t057);}</script>';
+        }
+    }
 }
 //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 @@
 <?php
 header('Content-Type: text/html; charset=windows-1251');
-if($_SERVER['HTTP_X_REQUESTED_WITH']=='XMLHttpRequest')
-{
-   if(isset($_POST['id']))
-   {
-		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($_POST['gox']) && isset($_POST['goy']))
-		{
-			echo '��������� ��: X = '.$_POST['gox'].', Y = '.$_POST['goy'].'<script>top.xxx='.((int)$_POST['gox']).';top.yyy='.((int)$_POST['goy']).';top.xn='.((int)$_POST['gox']).';top.yn='.((int)$_POST['goy']).';</script>';
-			$_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($k<count($vrs))
-			{
-				$ex = explode('=',$vrs[$k]);
-				$vr[$ex[0]] = $ex[1];
-				$k++;
-			}
-		}
-				
-		$md5 = 0;		
-		$map = '';
-		$obj = '';
-		$objd = '';
-		$usr = '';
-		$js  = '';
-		$gg  = 0;
-		
-		$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']))
-		{
-		
-		}elseif($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  = 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'] . '<script>top.xxx=' . ((int)$_POST['gox']) . ';top.yyy=' . ((int)$_POST['goy']) . ';top.xn=' . ((int)$_POST['gox']) . ';top.yn=' . ((int)$_POST['goy']) . ';</script>';
+        $_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 .= '<a href=\\"#\\" onClick=\\"takeItem('.$pl['id'].'); return false;\\"><img style=\\"margin:3px;\\" src=\\"https://img.new-combats.com/i/items/'.$itm['img'].'\\" title=\\"��������� &quot;'.$itm['name'].'&quot;\\" \></a>';
-				$fmd5 .= $pl['id'].'=';
-			}
-		}
-		
-		if($itms!='')
-		{
-			$itms = '<Br><b style=\\"color:#8f0000;\\">�������� � �������:</b><br><br>'.$itms;
-			$js .= 'document.getElementById(\'items\').innerHTML = "'.$itms.'";';
-		}else{
-			$js .= 'document.getElementById(\'items\').innerHTML = "";';
-		}
-		
-		$fmd5 = md5($fmd5);
-		if($fmd5!=$_POST['mdf'])
-		{
-			//��������� ������			
-			echo '<script> ';
-			echo $js;
-			echo ' users = "'.$mus.'";';
-			echo ' obj = "'.$objd.'";';
-			echo ' mapNew = "'.$map.'";';
-			echo ' md = "'.$fmd5.'";';
-			echo ' xn = '.$u->info['x'].'; yn = '.$u->info['y'].'; refleshMapDate();';
-            echo '</script>';
-		}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 .= '<a href=\\"#\\" onClick=\\"takeItem(' . $pl['id'] . '); return false;\\"><img style=\\"margin:3px;\\" src=\\"https://img.new-combats.com/i/items/' . $itm['img'] . '\\" title=\\"��������� &quot;' . $itm['name'] . '&quot;\\" \></a>';
+            $fmd5 .= $pl['id'] . '=';
+        }
+    }
+
+    if ($itms != '') {
+        $itms = '<Br><b style=\\"color:#8f0000;\\">�������� � �������:</b><br><br>' . $itms;
+        $js .= 'document.getElementById(\'items\').innerHTML = "' . $itms . '";';
+    } else {
+        $js .= 'document.getElementById(\'items\').innerHTML = "";';
+    }
+
+    $fmd5 = md5($fmd5);
+    if ($fmd5 != $_POST['mdf']) {
+        //��������� ������
+        echo '<script> ';
+        echo $js;
+        echo ' users = "' . $mus . '";';
+        echo ' obj = "' . $objd . '";';
+        echo ' mapNew = "' . $map . '";';
+        echo ' md = "' . $fmd5 . '";';
+        echo ' xn = ' . $u->info['x'] . '; yn = ' . $u->info['y'] . '; refleshMapDate();';
+        echo '</script>';
+    }
 }
-?>
\ 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 @@
 <?php
 header('Content-Type: text/html; charset=windows-1251');
-if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')
-{
-	define('GAME',true);
-	include_once('../_incl_data/__config.php');
-	include_once('../_incl_data/class/__db_connect.php');
-	include('../_incl_data/class/__telegram.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('<script>top.location = \'https://'.$c['host'].'/\';</script>');
-	}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('<script>top.location = \'https://' . $c['host'] . '/\';</script>');
+    } 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 b74662d6..787e5d39 100644
--- a/logs.php
+++ b/logs.php
@@ -3,450 +3,471 @@
 const GAME = true;
 include('_incl_data/__config.php');
 include('_incl_data/class/__db_connect.php');
-include('_incl_data/class/__user.php');
-$btl = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "'.mysql_real_escape_string((int)$_GET['log']).'" LIMIT 1'));
+$u = User::start();
+$btl = mysql_fetch_array(
+    mysql_query('SELECT * FROM `battle` WHERE `id` = "' . mysql_real_escape_string((int)$_GET['log']) . '" LIMIT 1')
+);
 
-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 = 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;
-	}
-	$allprice = typeBattle($allprice);
-	if ($btl['smert'] == 1)
-	{
-		$allprice = array(150,150,'����������� ��������','����������� ��������');
-	}
-    if( $btl['type'] == 99 ) {
-		$allprice = '<font color=red>'.str_replace(' ','&nbsp;',$allprice[3]).'</font>';
-	}else{
-		$allprice = str_replace(' ','&nbsp;',$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 = '<font color=red>' . str_replace(' ', '&nbsp;', $allprice[3]) . '</font>';
+    } else {
+        $allprice = str_replace(' ', '&nbsp;', $allprice[2]);
+    }
 }
 
 $fil = '<span style="margin-left: 25px;">����� : <form id="line_filter" style="display: inline;" onsubmit="return false;"> <input type="text" id="line_filter_input" autocomplete="off" style="padding:5px;" /> <input type="submit" id="line_filter_input_submit" class="btn" value="������" onclick="return false" /> <input type="button" id="line_filter_glow" class="btn" value="���������" /></form></span>';
-$r = ''; $p = ''; $b = '<table width="100%" cellpadding="0" cellspacing="0" border="0">
+$r = '';
+$p = '';
+$b = '<table width="100%" cellpadding="0" cellspacing="0" border="0">
   <tbody>
     <tr valign="top">
       <td valign="bottom" title="">
 	  <input onClick="location=location;" type="submit" name="analiz2" class="btn" value="��������">'; //nowrap=""
 
-if($btl['team_win'] != -1) {
-	if(!isset($_GET['analiz'])) {
-		$b .= ' <input onClick="location=\'logs.php?log='.((int)$_GET['log']).'&analiz=1\';" type="submit" name="analiz3" class="btn btn-success" value="����������">';
-	    $b .= $fil;
-	}else{
-		$b .= ' <input onClick="location=\'logs.php?log='.((int)$_GET['log']).'\';" type="submit" name="analiz3" class="btn btn-danger" value="��� ���">';
-	}
+if ($btl['team_win'] != -1) {
+    if (!isset($_GET['analiz'])) {
+        $b .= ' <input onClick="location=\'logs.php?log=' . ((int)$_GET['log']) . '&analiz=1\';" type="submit" name="analiz3" class="btn btn-success" value="����������">';
+        $b .= $fil;
+    } else {
+        $b .= ' <input onClick="location=\'logs.php?log=' . ((int)$_GET['log']) . '\';" type="submit" name="analiz3" class="btn btn-danger" value="��� ���">';
+    }
 }
 $b .= '</td>
     </tr>	
   </tbody>
 </table>';
-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 = '<img src="https://img.new-combats.com/i/fighttype'.$btl['type'].'.gif">';
-	if( $btl['invis'] > 0 ) {
-		$tbtl .= '<img src="https://img.new-combats.com/i/fighttypehidden0.gif">';
-	}
-	if($btl['type'] == 0) {
-		$tbtl = '��� ���: '.$tbtl.' (���������� ��������) &nbsp; &nbsp; ';
-	}elseif($btl['type'] == 1) {
-		$tbtl = '��� ���: '.$tbtl.' (�������� ��������) &nbsp; &nbsp; ';
-	}else{
-		$tbtl = '��� ���: '.$tbtl.' (���������� ��������) &nbsp; &nbsp; ';
-	}
-	
-	if( $btl['izlom'] > 0 ) {
-		$tbtl .= '�����: '.$btl['izlomRoundSee'].' &nbsp; &nbsp; ';
-	}
-	
-	$tbtl .= '����������������� ���: '.$tmStart.' ���.<br>';
-	
-	$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 .= '<img src="https://img.new-combats.com/i/align/align'.$us['align'].'.gif" width="12" height="15">';
-		}
-		if( $us['clan'] > 0 ) {
-			$r .= '<a href="clans_info/'.$us['clan'].'" target="_blank"><img src="https://img.new-combats.com/i/clan/'.$us['clan'].'.gif" width="24" height="15"></a>';
-		}
-		$r .= '<b class="CSSteam'.$us['team'].'">'.$us['login'].' ['.$us['level'].']</b>';
-		$r .= '<a href="info/'.$us['uid'].'" target="_blank"><img src="https://img.new-combats.com/i/inf_capitalcity.gif" width="12" height="11"></a>';
-		return $r;
-	}
-	
-	//�������� ����
-	$tpas = array(
-		1 => 'X',
-		2 => '<font color=#AAAAEE>&bull;</font>',
-		3 => '<b>&bull;</b>',
-		4 => '<font color=#FF0000>&curren;</font>',
-		5 => '<font color=#FF0000>X</font>',
-		6 => '<font color=#AAAAEE>&bull;</font>',
-		7 => '<font color=777777><B>&bull;</B></font>',
-		8 => '<font color=#AAAAEE>&bull;</font>'
-	);
-	/*$tpbs = array(
-		0 => 'X',
-		1 => 'X',
-		2 => '<font color=#AAAAAA><B>&bull;</B></font>',
-		3 => '<font color=#AAAAEE><B>&bull;</B></font>',
-		4 => 'X',
-		5 => '<font color=#FF0000><B>&bull;</B></font>',
-		6 => '<font color=#AAAAEE><B>&bull;</B></font>',
-		7 => '<font color=#777777><B>&bull;</B></font>',
-		8 => '<font color=#AAAAAA><B>&bull;</B></font>'
-	);*/
-	$tpbs = array(
-		0 => '',
-		1 => '<B>&bull;</B>',
-		2 => '<font color=#AAAAAA><B>&bull;</B></font>',
-		3 => 'X',
-		4 => '<font color=#FFEEEE><B>X</B></font>',
-		5 => '<font color=#FFEEEE><B>&bull;</B></font>',
-		6 => '<font color=#AAAAEE><B>&bull;</B></font>',
-		7 => '<font color=#777777><B>&bull;</B></font>',
-		8 => '<font color=#AAAAAA><B>&bull;</B></font>'
-	);
-	$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 .= ' &nbsp; <b>������</b> &nbsp; ';
-		}
-		$i++;
-	}
-	//
-	$usr = '<H4>��������� ��������</H4>'.$usr.'<br><br>';
-	//
-	$r = '';
-	//
-	$r .= '<H4>������������������ ������</H4>';	
-	$r .= '<TABLE border=1 cellspacing=0 cellpadding=4>
-<TR><TD align=center>�����</TD><TD>���� �</TD><TD>������������������ ������</TD></TR>';	
-	$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 .= '<br>'.$us['value']['sa'][2].'';
-				$rh .= '<br>'.$us['value']['sa'][3].'';
-				$rh .= '<br>'.$us['value']['sa'][4].'';
-				$rh .= '<br>'.$us['value']['sa'][5].'';
-				$r .= '<TR><TD align=center nowrap>'.con_login($us).'</TD><TD nowrap align="right"><pre>������<br>�����<br>�����<br>����<br>����</pre></TD><TD style="font-size:16px" nowrap><pre>'.$rh.'</pre></TD></TR>';
-			}
-			unset($us);
-			$j++;
-		}
-				
-		$i++;
-	}
-	$r .= '</TABLE>';
-	$r .= '(<b>X</b>&nbsp;-&nbsp;�������&nbsp;����, <font color=red><B>&curren;</b></font> - ����������� ���� ������ ���� , <font color=red><B>X</B></font>&nbsp;-&nbsp;�����������&nbsp;����, <font color=red><B><code>&Xi;</code></B></font>&nbsp;-&nbsp;���� + ������������, <font color=006600><B>X</B></font>&nbsp;-&nbsp;���.&nbsp;����������&nbsp;����,<BR>
+    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 = '<img src="https://img.new-combats.com/i/fighttype' . $btl['type'] . '.gif">';
+    if ($btl['invis'] > 0) {
+        $tbtl .= '<img src="https://img.new-combats.com/i/fighttypehidden0.gif">';
+    }
+    if ($btl['type'] == 0) {
+        $tbtl = '��� ���: ' . $tbtl . ' (���������� ��������) &nbsp; &nbsp; ';
+    } elseif ($btl['type'] == 1) {
+        $tbtl = '��� ���: ' . $tbtl . ' (�������� ��������) &nbsp; &nbsp; ';
+    } else {
+        $tbtl = '��� ���: ' . $tbtl . ' (���������� ��������) &nbsp; &nbsp; ';
+    }
+
+    if ($btl['izlom'] > 0) {
+        $tbtl .= '�����: ' . $btl['izlomRoundSee'] . ' &nbsp; &nbsp; ';
+    }
+
+    $tbtl .= '����������������� ���: ' . $tmStart . ' ���.<br>';
+
+    $users = [
+
+    ];
+
+    $uids = [
+
+    ];
+
+    function con_login($us)
+    {
+        $r = '';
+        if ($us['align'] > 0) {
+            $r .= '<img src="https://img.new-combats.com/i/align/align' . $us['align'] . '.gif" width="12" height="15">';
+        }
+        if ($us['clan'] > 0) {
+            $r .= '<a href="clans_info/' . $us['clan'] . '" target="_blank"><img src="https://img.new-combats.com/i/clan/' . $us['clan'] . '.gif" width="24" height="15"></a>';
+        }
+        $r .= '<b class="CSSteam' . $us['team'] . '">' . $us['login'] . ' [' . $us['level'] . ']</b>';
+        $r .= '<a href="info/' . $us['uid'] . '" target="_blank"><img src="https://img.new-combats.com/i/inf_capitalcity.gif" width="12" height="11"></a>';
+        return $r;
+    }
+
+    //�������� ����
+    $tpas = [
+        1 => 'X',
+        2 => '<font color=#AAAAEE>&bull;</font>',
+        3 => '<b>&bull;</b>',
+        4 => '<font color=#FF0000>&curren;</font>',
+        5 => '<font color=#FF0000>X</font>',
+        6 => '<font color=#AAAAEE>&bull;</font>',
+        7 => '<font color=777777><B>&bull;</B></font>',
+        8 => '<font color=#AAAAEE>&bull;</font>',
+    ];
+    /*$tpbs = array(
+        0 => 'X',
+        1 => 'X',
+        2 => '<font color=#AAAAAA><B>&bull;</B></font>',
+        3 => '<font color=#AAAAEE><B>&bull;</B></font>',
+        4 => 'X',
+        5 => '<font color=#FF0000><B>&bull;</B></font>',
+        6 => '<font color=#AAAAEE><B>&bull;</B></font>',
+        7 => '<font color=#777777><B>&bull;</B></font>',
+        8 => '<font color=#AAAAAA><B>&bull;</B></font>'
+    );*/
+    $tpbs = [
+        0 => '',
+        1 => '<B>&bull;</B>',
+        2 => '<font color=#AAAAAA><B>&bull;</B></font>',
+        3 => 'X',
+        4 => '<font color=#FFEEEE><B>X</B></font>',
+        5 => '<font color=#FFEEEE><B>&bull;</B></font>',
+        6 => '<font color=#AAAAEE><B>&bull;</B></font>',
+        7 => '<font color=#777777><B>&bull;</B></font>',
+        8 => '<font color=#AAAAAA><B>&bull;</B></font>',
+    ];
+    $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 .= ' &nbsp; <b>������</b> &nbsp; ';
+        }
+        $i++;
+    }
+    //
+    $usr = '<H4>��������� ��������</H4>' . $usr . '<br><br>';
+    //
+    $r = '';
+    //
+    $r .= '<H4>������������������ ������</H4>';
+    $r .= '<TABLE border=1 cellspacing=0 cellpadding=4>
+<TR><TD align=center>�����</TD><TD>���� �</TD><TD>������������������ ������</TD></TR>';
+    $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 .= '<br>' . $us['value']['sa'][2] . '';
+                $rh .= '<br>' . $us['value']['sa'][3] . '';
+                $rh .= '<br>' . $us['value']['sa'][4] . '';
+                $rh .= '<br>' . $us['value']['sa'][5] . '';
+                $r .= '<TR><TD align=center nowrap>' . con_login(
+                        $us
+                    ) . '</TD><TD nowrap align="right"><pre>������<br>�����<br>�����<br>����<br>����</pre></TD><TD style="font-size:16px" nowrap><pre>' . $rh . '</pre></TD></TR>';
+            }
+            unset($us);
+            $j++;
+        }
+
+        $i++;
+    }
+    $r .= '</TABLE>';
+    $r .= '(<b>X</b>&nbsp;-&nbsp;�������&nbsp;����, <font color=red><B>&curren;</b></font> - ����������� ���� ������ ���� , <font color=red><B>X</B></font>&nbsp;-&nbsp;�����������&nbsp;����, <font color=red><B><code>&Xi;</code></B></font>&nbsp;-&nbsp;���� + ������������, <font color=006600><B>X</B></font>&nbsp;-&nbsp;���.&nbsp;����������&nbsp;����,<BR>
 &nbsp;<B>&bull;</B>&nbsp;-&nbsp;���������&nbsp;����������&nbsp;����, <font color=AAAAAA><B>&bull;</B></font>&nbsp;-&nbsp;���������, <font color=AAAAEE><B>&bull;</B></font>&nbsp;-&nbsp;���������, <font color=777777><B>&bull;</B></font>&nbsp;-&nbsp;����� ���� �����)';
-	//
-	$r .= '<H4>������������������ ������</H4>';
-	$r .= '<TABLE border=1 cellspacing=0 cellpadding=4>
-<TR><TD align=center>�����</TD><TD>����</TD><TD>������������������ ������</TD></TR>';	
-	$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 .= '<br>'.$us['value']['sb'][2].'';
-				$rh .= '<br>'.$us['value']['sb'][3].'';
-				$rh .= '<br>'.$us['value']['sb'][4].'';
-				$rh .= '<br>'.$us['value']['sb'][5].'';
-				$r .= '<TR><TD align=center nowrap>'.con_login($us).'</TD><TD nowrap align="right"><pre>������<br>�����<br>�����<br>����<br>����</pre></TD><TD style="font-size:16px" nowrap><pre>'.$rh.'</pre></TD></TR>';
-			}
-			unset($us);
-			$j++;
-		}
-				
-		$i++;
-	}
-	$r .= '</TABLE>';
-	$r .= '(<b>X</b>&nbsp;-&nbsp;������� ����, <b><FONT COLOR=red>X</FONT></b>&nbsp;-&nbsp;������� ���� ������, <B>&bull;</B>&nbsp;-&nbsp;��������� ����,
+    //
+    $r .= '<H4>������������������ ������</H4>';
+    $r .= '<TABLE border=1 cellspacing=0 cellpadding=4>
+<TR><TD align=center>�����</TD><TD>����</TD><TD>������������������ ������</TD></TR>';
+    $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 .= '<br>' . $us['value']['sb'][2] . '';
+                $rh .= '<br>' . $us['value']['sb'][3] . '';
+                $rh .= '<br>' . $us['value']['sb'][4] . '';
+                $rh .= '<br>' . $us['value']['sb'][5] . '';
+                $r .= '<TR><TD align=center nowrap>' . con_login(
+                        $us
+                    ) . '</TD><TD nowrap align="right"><pre>������<br>�����<br>�����<br>����<br>����</pre></TD><TD style="font-size:16px" nowrap><pre>' . $rh . '</pre></TD></TR>';
+            }
+            unset($us);
+            $j++;
+        }
+
+        $i++;
+    }
+    $r .= '</TABLE>';
+    $r .= '(<b>X</b>&nbsp;-&nbsp;������� ����, <b><FONT COLOR=red>X</FONT></b>&nbsp;-&nbsp;������� ���� ������, <B>&bull;</B>&nbsp;-&nbsp;��������� ����,
 <font color=#AAAAAA><B>&bull;</B></font>&nbsp;-&nbsp;���������, 
 <font color=#AAAAEE><B>&bull;</B></font>&nbsp;-&nbsp;���������, 
 <font color=#777777><B>&bull;</B></font>&nbsp;-&nbsp;����� �����)';
-	//
-	$r .= '<H4>��������</H4>';	
-	$r .= '<TABLE border=1 cellspacing=0 cellpadding=4>
+    //
+    $r .= '<H4>��������</H4>';
+    $r .= '<TABLE border=1 cellspacing=0 cellpadding=4>
 <TR><TD align=center>&nbsp;</TD><TD align=center>�����</TD><TD>�����</TD><TD>�����</TD><TD>���������</TD><TD>������</TD><TD>����</TD><TD>������</TD><TD>��������</TD></TR>';
-	//<TR><TD align=right>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD align=center>&nbsp;</TD><TD align=center>&nbsp;</TD><TD align=center>&nbsp;</TD><TD align=center>&nbsp;</TD><TD align=center>&nbsp;</TD></TR>
-	$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'] = '<font color=red>0</font>';
-					$winw = '<img title="�����" width="7" height="7" src="https://img.new-combats.com/i/ico/looses.gif">';
-				}else{
-					$winw = '<img title="�����" width="7" height="7" src="https://img.new-combats.com/i/ico/wins.gif">';
-				}
-				$r .= '<TR><TD valign=middle align=center>'.$winw.'</TD><TD align=right>'.con_login($us).' ['.$us['hp'].'/'.$us['hpAll'].']</TD><TD>'.(0+$us['zona'][1]).'/'.(0+$us['zona'][2]).'/'.(0+$us['zona'][3]).'/'.(0+$us['zona'][4]).'/'.(0+$us['zona'][5]).'</TD><TD>'.(0+$us['zonb'][1]).'/'.(0+$us['zonb'][2]).'/'.(0+$us['zonb'][3]).'/'.(0+$us['zonb'][4]).'/'.(0+$us['zonb'][5]).'</TD><TD align=center>'.(0+$us['ga']).'(<font color=red>'.(0+$us['gak']).'</font>)/'.($us['gaa']).'</TD><TD align=center>'.$us['value']['b'].'/'.$us['value']['y'].'/'.$us['value']['p'].'</TD><TD align=center>'.$us['yrn'].'/<font color=red>'.$us['yrn_krit'].'</font></TD><TD align=center>'.(-$us['_yrn']).'</TD><TD align=center>'.$us['heal'].'</TD></TR>';
-			}
-			unset($us);
-			$j++;
-		}
-		if( $team_data['g'] == true ) {
-			$winw = '--';
-			if( $team_data['hp'] < 1 ) {
-				$team_data['hp'] = '0';
-			}else{
-				$winw = '<img src="https://img.new-combats.com/i/flag.gif" width="20" height="20" title="����������">';
-			}
-			$r .= '<TR bgcolor=d2d0d0><TD align=center>'.$winw.'</TD><TD align=right><b class="CSSteam'.$tm_v[$i].'">����� ['.$team_data['hp'].'/'.$team_data['hpAll'].']</b></TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD align=center>'.(0+$team_data['ga']).'(<font color=red>'.(0+$team_data['gak']).'</font>)/'.($team_data['gaa']).'</TD><TD align=center>'.$team_data['val_b'].'/'.$team_data['val_y'].'/'.$team_data['val_p'].'</TD><TD align=center>'.$team_data['yrn'].'/<font color=red>'.$team_data['yrn_krit'].'</font></TD><TD align=center>'.(-$team_data['_yrn']).'</TD><TD align=center>'.$team_data['heal'].'</TD></TR>';
-		}
-		
-		$i++;
-	}
-	$r .= '</TABLE>';
-	//
-	$r .= '
+    //<TR><TD align=right>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD align=center>&nbsp;</TD><TD align=center>&nbsp;</TD><TD align=center>&nbsp;</TD><TD align=center>&nbsp;</TD><TD align=center>&nbsp;</TD></TR>
+    $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'] = '<font color=red>0</font>';
+                    $winw = '<img title="�����" width="7" height="7" src="https://img.new-combats.com/i/ico/looses.gif">';
+                } else {
+                    $winw = '<img title="�����" width="7" height="7" src="https://img.new-combats.com/i/ico/wins.gif">';
+                }
+                $r .= '<TR><TD valign=middle align=center>' . $winw . '</TD><TD align=right>' . con_login(
+                        $us
+                    ) . ' [' . $us['hp'] . '/' . $us['hpAll'] . ']</TD><TD>' . (0 + $us['zona'][1]) . '/' . (0 + $us['zona'][2]) . '/' . (0 + $us['zona'][3]) . '/' . (0 + $us['zona'][4]) . '/' . (0 + $us['zona'][5]) . '</TD><TD>' . (0 + $us['zonb'][1]) . '/' . (0 + $us['zonb'][2]) . '/' . (0 + $us['zonb'][3]) . '/' . (0 + $us['zonb'][4]) . '/' . (0 + $us['zonb'][5]) . '</TD><TD align=center>' . (0 + $us['ga']) . '(<font color=red>' . (0 + $us['gak']) . '</font>)/' . ($us['gaa']) . '</TD><TD align=center>' . $us['value']['b'] . '/' . $us['value']['y'] . '/' . $us['value']['p'] . '</TD><TD align=center>' . $us['yrn'] . '/<font color=red>' . $us['yrn_krit'] . '</font></TD><TD align=center>' . (-$us['_yrn']) . '</TD><TD align=center>' . $us['heal'] . '</TD></TR>';
+            }
+            unset($us);
+            $j++;
+        }
+        if ($team_data['g'] == true) {
+            $winw = '--';
+            if ($team_data['hp'] < 1) {
+                $team_data['hp'] = '0';
+            } else {
+                $winw = '<img src="https://img.new-combats.com/i/flag.gif" width="20" height="20" title="����������">';
+            }
+            $r .= '<TR bgcolor=d2d0d0><TD align=center>' . $winw . '</TD><TD align=right><b class="CSSteam' . $tm_v[$i] . '">����� [' . $team_data['hp'] . '/' . $team_data['hpAll'] . ']</b></TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD align=center>' . (0 + $team_data['ga']) . '(<font color=red>' . (0 + $team_data['gak']) . '</font>)/' . ($team_data['gaa']) . '</TD><TD align=center>' . $team_data['val_b'] . '/' . $team_data['val_y'] . '/' . $team_data['val_p'] . '</TD><TD align=center>' . $team_data['yrn'] . '/<font color=red>' . $team_data['yrn_krit'] . '</font></TD><TD align=center>' . (-$team_data['_yrn']) . '</TD><TD align=center>' . $team_data['heal'] . '</TD></TR>';
+        }
+
+        $i++;
+    }
+    $r .= '</TABLE>';
+    //
+    $r .= '
 ����� - ��� ��������� � ������� �����: [������/�����]<br>
 ����� - ���������� ������ �� ��������: ������/�����/�����/����/����<br>
 ����� - ���������� ������ �� ��������: ������/�����/�����/����/����<br>
@@ -455,390 +476,467 @@ if(isset($btl['id']) && $btl['team_win'] != -1 && isset($_GET['analiz'])) {
 ���� - ������ HP �� ����������� / �� ��� <font color=red>�������</font><br>
 ������ - �������� ����������� <br>
 �������� - ������������� HP<br>';
-	
-	$r = '<div>'.$b.'</div><div><span style="float:left;">'.$tbtl.$p.'</span><span style="float:right;">������ �����: <i>'.$allprice.'</i></span></div><br><br>'.$usr.$r.'<div align="left">'.$p.'</div>';
-	//header('location: main.php');
-}elseif(!isset($btl['id']))
-{
-	$r = '<br><br><center>������ ����� ���������� ����� ������� ��������� � ��������� ���� ...</center>';
-}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<count($dt))
-			{
-				$r = explode('=',$dt[$i]);
-				if($r[0]!='')
-				{
-					$d[$r[0]] = $r[1];
-				}
-				$i++;
-			}
-			//������� ����
-			$rt = $pl['text'];
-			//�������� ������
-			$rt = str_replace('{u1}','<span onClick="top.addTo(\''.$d['login1'].'\',\'to\'); return false;" oncontextmenu="top.infoMenu(\''.$d['login1'].'\',event,\'chat\'); return false;" class="CSSteam'.$d['t1'].'">'.$d['login1'].'</span>',$rt);
-			$rt = str_replace('{u2}','<span onClick="top.addTo(\''.$d['login2'].'\',\'to\'); return false;" oncontextmenu="top.infoMenu(\''.$d['login2'].'\',event,\'chat\'); return false;" class="CSSteam'.$d['t2'].'">'.$d['login2'].'</span>',$rt);
-			$rt = str_replace('{pr}','<b>'.$d['prm'].'</b>',$rt);
-			$rt = str_replace('^^^^','=',$rt);
-			$rt = str_replace('{tm1}','<span class="date">'.date('H:i',$d['time1']).'</span>',$rt);
-			$rt = str_replace('{tm2}','<span class="date">'.date('H:i',$d['time2']).'</span>',$rt);
-			$rt = str_replace('{tm3}','<span class="date">'.date('d.m.y H:i',$d['time1']).'</span>',$rt);
-			$rt = str_replace('{tm4}','<span class="date">'.date('d.m.y H:i',$d['time2']).'</span>',$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 .= '<img src="https://img.new-combats.com/i/zones/'.$d['t1'].'/'.$d['t2'].''.$zab1.'.gif">';
-					$zns02 .= '<img src="https://img.new-combats.com/i/zones/'.$d['t2'].'/'.$d['t1'].''.$zab2.'.gif">';
-					$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}','<span onClick="top.addTo(\''.$d['login1'].'\',\'to\'); return false;" oncontextmenu="top.infoMenu(\''.$d['login1'].'\',event,\'chat\'); return false;" class="CSSteam'.$d['t1'].'">'.$d['login1'].'</span>',$rt);
-			$rt = str_replace('{u2}','<span onClick="top.addTo(\''.$d['login2'].'\',\'to\'); return false;" oncontextmenu="top.infoMenu(\''.$d['login2'].'\',event,\'chat\'); return false;" class="CSSteam'.$d['t2'].'">'.$d['login2'].'</span>',$rt);
-			$rt = str_replace('{pr}','<b>'.$d['prm'].'</b>',$rt);
-			$rt = str_replace('^^^^','=',$rt);
-			$rt = str_replace('{tm1}','<span class="date">'.date('H:i',$d['time1']).'</span>',$rt);
-			$rt = str_replace('{tm2}','<span class="date">'.date('H:i',$d['time2']).'</span>',$rt);
-			$rt = str_replace('{tm3}','<span class="date">'.date('d.m.y H:i',$d['time1']).'</span>',$rt);
-			$rt = str_replace('{tm4}','<span class="date">'.date('d.m.y H:i',$d['time2']).'</span>',$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 .= ' <a style="color:maroon" href="?log='.$btl['id'].'&p='.$i.'&rnd='.$code.'">'.$i.'</a> ';
-		}else{
-			$p .= ' <a href="?log='.$btl['id'].'&p='.$i.'&rnd='.$code.'">'.$i.'</a> ';	
-		}
-		$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 .= '<table cellspacing="1" width="100%"><tbody><tr><td height="1" bgcolor="#b0b0b0"></td></tr></tbody></table>';
-			}
-			$h = $pl['id_hod'];
-		}else{
-			//$r .= '<br>';	
-		}
-		$r .= '<div class="logs_php_line" style="background-color:#'.$clr.';'.$cclr.'padding:1px;">'.$pl['text'].'</div>';	
-		$cclr = '';
-	}
-	//�������� ��������
-	$p = '��������: '.$p;
-	$usr = '';
-	if($btl['team_win'] == -1) {
-		$sp = mysql_query('SELECT 
+    $r = '<div>' . $b . '</div><div><span style="float:left;">' . $tbtl . $p . '</span><span style="float:right;">������ �����: <i>' . $allprice . '</i></span></div><br><br>' . $usr . $r . '<div align="left">' . $p . '</div>';
+    //header('location: main.php');
+} elseif (!isset($btl['id'])) {
+    $r = '<br><br><center>������ ����� ���������� ����� ������� ��������� � ��������� ���� ...</center>';
+} 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}',
+                '<span onClick="top.addTo(\'' . $d['login1'] . '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' . $d['login1'] . '\',event,\'chat\'); return false;" class="CSSteam' . $d['t1'] . '">' . $d['login1'] . '</span>',
+                $rt
+            );
+            $rt = str_replace(
+                '{u2}',
+                '<span onClick="top.addTo(\'' . $d['login2'] . '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' . $d['login2'] . '\',event,\'chat\'); return false;" class="CSSteam' . $d['t2'] . '">' . $d['login2'] . '</span>',
+                $rt
+            );
+            $d['time1'] = intval($d['time1']);
+            $d['time2'] = intval($d['time2']);
+            $rt = str_replace('{pr}', '<b>' . $d['prm'] . '</b>', $rt);
+            $rt = str_replace('^^^^', '=', $rt);
+            $rt = str_replace('{tm1}', '<span class="date">' . date('H:i', $d['time1']) . '</span>', $rt);
+            $rt = str_replace('{tm2}', '<span class="date">' . date('H:i', $d['time2']) . '</span>', $rt);
+            $rt = str_replace('{tm3}', '<span class="date">' . date('d.m.y H:i', $d['time1']) . '</span>', $rt);
+            $rt = str_replace('{tm4}', '<span class="date">' . date('d.m.y H:i', $d['time2']) . '</span>', $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 .= '<img src="https://img.new-combats.com/i/zones/' . $d['t1'] . '/' . $d['t2'] . '' . $zab1 . '.gif">';
+                    $zns02 .= '<img src="https://img.new-combats.com/i/zones/' . $d['t2'] . '/' . $d['t1'] . '' . $zab2 . '.gif">';
+                    $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;
+                if (is_array($r)) {
+                    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;
+                if (is_array($r)) {
+                    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}',
+                '<span onClick="top.addTo(\'' . $d['login1'] . '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' . $d['login1'] . '\',event,\'chat\'); return false;" class="CSSteam' . $d['t1'] . '">' . $d['login1'] . '</span>',
+                $rt
+            );
+            $rt = str_replace(
+                '{u2}',
+                '<span onClick="top.addTo(\'' . $d['login2'] . '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' . $d['login2'] . '\',event,\'chat\'); return false;" class="CSSteam' . $d['t2'] . '">' . $d['login2'] . '</span>',
+                $rt
+            );
+            $rt = str_replace('{pr}', '<b>' . $d['prm'] . '</b>', $rt);
+            $rt = str_replace('^^^^', '=', $rt);
+            $rt = str_replace('{tm1}', '<span class="date">' . date('H:i', $d['time1']) . '</span>', $rt);
+            $rt = str_replace('{tm2}', '<span class="date">' . date('H:i', $d['time2']) . '</span>', $rt);
+            $rt = str_replace('{tm3}', '<span class="date">' . date('d.m.y H:i', $d['time1']) . '</span>', $rt);
+            $rt = str_replace('{tm4}', '<span class="date">' . date('d.m.y H:i', $d['time2']) . '</span>', $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 .= ' <a style="color:maroon" href="?log=' . $btl['id'] . '&p=' . $i . '&rnd=' . $code . '">' . $i . '</a> ';
+        } else {
+            $p .= ' <a href="?log=' . $btl['id'] . '&p=' . $i . '&rnd=' . $code . '">' . $i . '</a> ';
+        }
+        $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 .= '<table cellspacing="1" width="100%"><tbody><tr><td height="1" bgcolor="#b0b0b0"></td></tr></tbody></table>';
+            }
+            $h = $pl['id_hod'];
+        } else {
+            //$r .= '<br>';
+        }
+        $r .= '<div class="logs_php_line" style="background-color:#' . $clr . ';' . $cclr . 'padding:1px;">' . $pl['text'] . '</div>';
+        $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']] .= '<img src="https://img.new-combats.com/i/align/align'.$pl['align'].'.gif" width="12" height="15">';
-			}
-			if($pl['clan'] > 0) {
-				$usrs[$pl['team']] .= '<img src="https://img.new-combats.com/i/clan/'.$pl['clan'].'.gif" width="24" height="15">';
-			}
-			$pl['stats_r'] = $u->getStats($pl['id']);
-			$usrs[$pl['team']] .= '<b class="CSSteam'.$pl['team'].'">'.$pl['login'].'</b> ['.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 .= ' &nbsp; <b><font color=black>������</font></b> &nbsp; ';
-				}
-				$i++;
-			}
-		}
-		
-		if($usr != '') {
-			$usr = '<div align="center">'.$usr.'</div><hr>';
-		}
-	}
-	$tbtl = '<img src="https://img.new-combats.com/i/fighttype'.$btl['type'].'.gif" />';
-	if( $btl['invis'] > 0 ) {
-		$tbtl .= '<img src="https://img.new-combats.com/i/fighttypehidden0.gif" />';
-	}
-	if($btl['type'] == 0) {
-		$tbtl = '��� ���: '.$tbtl.' (���������� ��������) &nbsp; &nbsp; ';
-	}elseif($btl['type'] == 1) {
-		$tbtl = '��� ���: '.$tbtl.' (�������� ��������) &nbsp; &nbsp; ';
-	}elseif($btl['type'] == 250) {
-		$tbtl = '<img src="https://img.new-combats.com/i/fighttype50.gif" />';
-		$tbtl = '��� ���: '.$tbtl.' (����� ������) &nbsp; &nbsp; ';
-	}elseif($btl['smert'] == 1) {
-		$tbtl = '<img src="https://img.new-combats.com/i/fighttype9.gif" />';
-		$tbtl = '��� ���: '.$tbtl.' (����������� ��������) &nbsp; &nbsp; ';
-	}else{
-		$tbtl = '��� ���: '.$tbtl.' (���������� ��������) &nbsp; &nbsp; ';
-	}
-	
-	if( $btl['izlom'] > 0 ) {
-		$tbtl .= '�����: '.$btl['izlomRoundSee'].' &nbsp; &nbsp; ';
-	}
-	
-	$r = '<div>'.$b.'</div><div><span style="float:left;">'.$tbtl.$p.'</span><span style="float:right;">������ �����: <i>'.$allprice.'</i></span></div><br><hr>'.$r.'<div id="not_found" style="display: none;"><i><center>������ �� �������. ������ �� �������...</center></i></div><hr>'.$usr.'<div align="left">'.$p.'</div>';
-	
-	}
+		 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']] .= '<img src="https://img.new-combats.com/i/align/align' . $pl['align'] . '.gif" width="12" height="15">';
+            }
+            if ($pl['clan'] > 0) {
+                $usrs[$pl['team']] .= '<img src="https://img.new-combats.com/i/clan/' . $pl['clan'] . '.gif" width="24" height="15">';
+            }
+            $pl['stats_r'] = $u->getStats($pl['id']);
+            $usrs[$pl['team']] .= '<b class="CSSteam' . $pl['team'] . '">' . $pl['login'] . '</b> [' . 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 .= ' &nbsp; <b><font color=black>������</font></b> &nbsp; ';
+                }
+                $i++;
+            }
+        }
+
+        if ($usr != '') {
+            $usr = '<div align="center">' . $usr . '</div><hr>';
+        }
+    }
+    $tbtl = '<img src="https://img.new-combats.com/i/fighttype' . $btl['type'] . '.gif" />';
+    if ($btl['invis'] > 0) {
+        $tbtl .= '<img src="https://img.new-combats.com/i/fighttypehidden0.gif" />';
+    }
+    if ($btl['type'] == 0) {
+        $tbtl = '��� ���: ' . $tbtl . ' (���������� ��������) &nbsp; &nbsp; ';
+    } elseif ($btl['type'] == 1) {
+        $tbtl = '��� ���: ' . $tbtl . ' (�������� ��������) &nbsp; &nbsp; ';
+    } elseif ($btl['type'] == 250) {
+        $tbtl = '<img src="https://img.new-combats.com/i/fighttype50.gif" />';
+        $tbtl = '��� ���: ' . $tbtl . ' (����� ������) &nbsp; &nbsp; ';
+    } elseif ($btl['smert'] == 1) {
+        $tbtl = '<img src="https://img.new-combats.com/i/fighttype9.gif" />';
+        $tbtl = '��� ���: ' . $tbtl . ' (����������� ��������) &nbsp; &nbsp; ';
+    } else {
+        $tbtl = '��� ���: ' . $tbtl . ' (���������� ��������) &nbsp; &nbsp; ';
+    }
+
+    if ($btl['izlom'] > 0) {
+        $tbtl .= '�����: ' . $btl['izlomRoundSee'] . ' &nbsp; &nbsp; ';
+    }
+
+    $r = '<div>' . $b . '</div><div><span style="float:left;">' . $tbtl . $p . '</span><span style="float:right;">������ �����: <i>' . $allprice . '</i></span></div><br><hr>' . $r . '<div id="not_found" style="display: none;"><i><center>������ �� �������. ������ �� �������...</center></i></div><hr>' . $usr . '<div align="left">' . $p . '</div>';
+
+}
 ?>
 <!DOCTYPE html>
 <html>
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
-<title>�����: ��������</title>
-<script type="text/javascript" src="js/jquery.js"></script>
-<script type="text/javascript" src="js/jqueryrotate.js"></script>
-<script type="text/javascript" src="js/jquery.zclip.js"></script>
-<script type="text/javascript" src="js/jquery.cookie.js"></script>
-<script type="text/javascript" src="js/title.js"></script>
-<script src="https://img.new-combats.com/js/gameEngine.js" type="text/javascript"></script>
-<script>
-hi_no_fm = 1;
-function maginfo(z,p,m,obj) {
-	var r = '';
-	r += '<b>'+$(obj).attr('magelogin')+'</b><br><br>';
-	r += '����: '+m+', ';
-	r += '������: '+z+', ';
-	r += '����������: '+p+'';
-	return r;	
-}
-</script>
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
-<style type="text/css">
-body {
-	background: 
-				
-				url(https://new-combats.com/i/battle_log_04.jpg) right 0 repeat-x,
-				url(https://new-combats.com/i/battle_log_16.jpg) left bottom repeat-x,
-				url(https://new-combats.com/i/battle_log_08.jpg) left 0 repeat-y,
-				url(https://new-combats.com/i/battle_log_11.jpg) right 0 repeat-y,
-				#f2e5e0;
-	min-height:100vh;
-	min-width:400px;
-				
-				
-		
-}
-h3 {
-	text-align: center;
-}
-.ttl_css
-{
-	position: absolute;
-	padding-left: 3px;
-	padding-right: 3px;
-	padding-top: 2px;
-	padding-bottom: 2px;
-	background-color: #ffffcc;
-	border: 1px solid #6F6B5E;
-}
-.CSSteam	{ font-weight: bold; cursor:pointer; }
-.CSSteam0	{ font-weight: bold; cursor:pointer; }
-.CSSteam1	{ font-weight: bold; color: #6666CC; cursor:pointer; }
-.CSSteam2	{ font-weight: bold; color: #B06A00; cursor:pointer; }
-.CSSteam3 	{ font-weight: bold; color: #269088; cursor:pointer; }
-.CSSteam4 	{ font-weight: bold; color: #A0AF20; cursor:pointer; }
-.CSSteam5 	{ font-weight: bold; color: #0F79D3; cursor:pointer; }
-.CSSteam6 	{ font-weight: bold; color: #D85E23; cursor:pointer; }
-.CSSteam7 	{ font-weight: bold; color: #5C832F; cursor:pointer; }
-.CSSteam8 	{ font-weight: bold; color: #842B61; cursor:pointer; }
-.CSSteam9 	{ font-weight: bold; color: navy; cursor:pointer; }
-.CSSvs 		{ font-weight: bold; }
-</style>
+    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"/>
+    <title>�����: ��������</title>
+    <script type="text/javascript" src="js/jquery.js"></script>
+    <script type="text/javascript" src="js/jqueryrotate.js"></script>
+    <script type="text/javascript" src="js/jquery.zclip.js"></script>
+    <script type="text/javascript" src="js/jquery.cookie.js"></script>
+    <script type="text/javascript" src="js/title.js"></script>
+    <script src="https://img.new-combats.com/js/gameEngine.js" type="text/javascript"></script>
+    <script>
+        hi_no_fm = 1;
+
+        function maginfo(z, p, m, obj) {
+            var r = '';
+            r += '<b>' + $(obj).attr('magelogin') + '</b><br><br>';
+            r += '����: ' + m + ', ';
+            r += '������: ' + z + ', ';
+            r += '����������: ' + p + '';
+            return r;
+        }
+    </script>
+    <link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
+    <style type="text/css">
+        body {
+            background: url(https://new-combats.com/i/battle_log_04.jpg) right 0 repeat-x,
+            url(https://new-combats.com/i/battle_log_16.jpg) left bottom repeat-x,
+            url(https://new-combats.com/i/battle_log_08.jpg) left 0 repeat-y,
+            url(https://new-combats.com/i/battle_log_11.jpg) right 0 repeat-y,
+            #f2e5e0;
+            min-height: 100vh;
+            min-width: 400px;
+
+
+        }
+
+        h3 {
+            text-align: center;
+        }
+
+        .ttl_css {
+            position: absolute;
+            padding-left: 3px;
+            padding-right: 3px;
+            padding-top: 2px;
+            padding-bottom: 2px;
+            background-color: #ffffcc;
+            border: 1px solid #6F6B5E;
+        }
+
+        .CSSteam {
+            font-weight: bold;
+            cursor: pointer;
+        }
+
+        .CSSteam0 {
+            font-weight: bold;
+            cursor: pointer;
+        }
+
+        .CSSteam1 {
+            font-weight: bold;
+            color: #6666CC;
+            cursor: pointer;
+        }
+
+        .CSSteam2 {
+            font-weight: bold;
+            color: #B06A00;
+            cursor: pointer;
+        }
+
+        .CSSteam3 {
+            font-weight: bold;
+            color: #269088;
+            cursor: pointer;
+        }
+
+        .CSSteam4 {
+            font-weight: bold;
+            color: #A0AF20;
+            cursor: pointer;
+        }
+
+        .CSSteam5 {
+            font-weight: bold;
+            color: #0F79D3;
+            cursor: pointer;
+        }
+
+        .CSSteam6 {
+            font-weight: bold;
+            color: #D85E23;
+            cursor: pointer;
+        }
+
+        .CSSteam7 {
+            font-weight: bold;
+            color: #5C832F;
+            cursor: pointer;
+        }
+
+        .CSSteam8 {
+            font-weight: bold;
+            color: #842B61;
+            cursor: pointer;
+        }
+
+        .CSSteam9 {
+            font-weight: bold;
+            color: navy;
+            cursor: pointer;
+        }
+
+        .CSSvs {
+            font-weight: bold;
+        }
+    </style>
 </head>
 
-<body > <!--#E2E0E0 -->
+<body> <!--#E2E0E0 -->
 <div style="max-width:95%; min-height: 100%; margin:0 auto;">
-<br><br>
-<div id="ttl" class="ttl_css" style="display:none;z-index:1111;" /></div>
+    <br><br>
+    <div id="ttl" class="ttl_css" style="display:none;z-index:1111;"/>
+</div>
 <div id="gi" class="gifin" style="display:none;z-index:1110;"></div>
-<H3><IMG SRC="https://img.new-combats.com/i/fighttype2.gif" WIDTH=20 HEIGHT=20> ���������� ����<? if( $based != 'battle_logs' ) { echo ' (����� ���������)'; } ?> &nbsp; <a href="https://www.new-combats.com/">www.new-combats.com</a> <IMG SRC="https://img.new-combats.com/i/fighttype2.gif" WIDTH=20 HEIGHT=20></H3>
+<H3><IMG SRC="https://img.new-combats.com/i/fighttype2.gif" WIDTH=20 HEIGHT=20> ����������
+    ����<? if ($based != 'battle_logs') {
+        echo ' (����� ���������)';
+    } ?> &nbsp; <a href="https://www.new-combats.com/">www.new-combats.com</a> <IMG
+            SRC="https://img.new-combats.com/i/fighttype2.gif" WIDTH=20 HEIGHT=20></H3>
 <? echo $r; ?>
 <br><br><br>
 </div>
 <script language="JavaScript">
-$('#line_filter').submit(function () {
-  $('#line_filter_input_submit').trigger('click');
-});
+    $('#line_filter').submit(function () {
+        $('#line_filter_input_submit').trigger('click');
+    });
 
-$('#line_filter_glow').click(function () {
-  var val = $('#line_filter_input').val();
-  $(".logs_php_line").stop().css('background-color', '').show();
-  $('#not_found').css('display', 'none');
-  if(val != '') {
-    $(".logs_php_line:contains('" + val + "')").css('background-color', '#f8f8ef'); //##f8f8ef ffff80
-  }
-});
+    $('#line_filter_glow').click(function () {
+        var val = $('#line_filter_input').val();
+        $(".logs_php_line").stop().css('background-color', '').show();
+        $('#not_found').css('display', 'none');
+        if (val != '') {
+            $(".logs_php_line:contains('" + val + "')").css('background-color', '#f8f8ef'); //##f8f8ef ffff80
+        }
+    });
 
-$('#line_filter_input_submit').click(function () {
-  $("#not_found").slideUp();
-  var val = $('#line_filter_input').val();
-  if(val == '') {
-     $(".logs_php_line").stop().css('background-color', '').show();
-  } else {
-   if($.browser.msie || !1) {
-     $(".logs_php_line").stop().css('background-color', '').hide();
-     if (val != '') $(".logs_php_line:contains('" + val + "')").stop().show();
-   } else {
-     $(".logs_php_line").stop().css('background-color', '').slideUp();
-      $(".logs_php_line:contains('" + val + "')").stop().slideDown();
-   }
-   setInterval('if ($(".logs_php_line:visible").length == 0) $("#not_found").slideDown();', 300);
- }
- return false;
-});
+    $('#line_filter_input_submit').click(function () {
+        $("#not_found").slideUp();
+        var val = $('#line_filter_input').val();
+        if (val == '') {
+            $(".logs_php_line").stop().css('background-color', '').show();
+        } else {
+            if ($.browser.msie || !1) {
+                $(".logs_php_line").stop().css('background-color', '').hide();
+                if (val != '') $(".logs_php_line:contains('" + val + "')").stop().show();
+            } else {
+                $(".logs_php_line").stop().css('background-color', '').slideUp();
+                $(".logs_php_line:contains('" + val + "')").stop().slideDown();
+            }
+            setInterval('if ($(".logs_php_line:visible").length == 0) $("#not_found").slideDown();', 300);
+        }
+        return false;
+    });
 
-$('#line_filter_input').keyup(function () {
-  if($('#line_filter_input').val() == '') {
-    $('#line_filter_input_submit').trigger('click');
-  }
-});
+    $('#line_filter_input').keyup(function () {
+        if ($('#line_filter_input').val() == '') {
+            $('#line_filter_input_submit').trigger('click');
+        }
+    });
 
-jQuery.expr[":"].contains = function (elem, i, match, array) {
-  return (elem.textContent || elem.innerText || jQuery.text(elem) || "").toLowerCase().indexOf(match[3].toLowerCase()) >= 0;
-}
+    jQuery.expr[":"].contains = function (elem, i, match, array) {
+        return (elem.textContent || elem.innerText || jQuery.text(elem) || "").toLowerCase().indexOf(match[3].toLowerCase()) >= 0;
+    }
 </script>
 </body>
 </html>
\ 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 @@
 <?php
-ini_set("display_errors","1");
-ini_set("display_startup_errors","1");
-ini_set('error_reporting', E_ALL);
-ini_set("log_errors","1");
-ini_set("error_log","php-errors.log");
 
-/*function getIP() {
-   if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
-   return $_SERVER['REMOTE_ADDR'];
-}
-
-if(getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1') 
-	{
-	
-		die(getIP().'<br>'.$_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 ("<font color=#000000>����� <b>'.$user['login'].'</b> ������� � ���������� ������� <b>'.$inf['name'].'</b>!</font>","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 ("<font color=#000000>����� <b>' . $user['login'] . '</b> ������� � ���������� ������� <b>' . $inf['name'] . '</b>!</font>","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 @@
 <?php
-ini_set("display_errors","1");
-ini_set("display_startup_errors","1");
-ini_set('error_reporting', E_ALL);
-ini_set("log_errors","1");
-ini_set("error_log","php-errors.log");
 
-/*function getIP() {
-   if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
-   return $_SERVER['REMOTE_ADDR'];
-}
-
-if(getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1') 
-	{
-	
-		die(getIP().'<br>'.$_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 ("<font color=#000000>����� <b>'.$user['login'].'</b> ������� � ������� ������� <b>'.$inf['name'].'</b>!</font>","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 ("<font color=#000000>����� <b>' . $user['login'] . '</b> ������� � ������� ������� <b>' . $inf['name'] . '</b>!</font>","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/mail.php b/mail.php
index 354b0c31..1b79cf0f 100644
--- a/mail.php
+++ b/mail.php
@@ -1,173 +1,202 @@
-<?
-function GetRealIp(){
-	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'];
-}
+<?php
+const GAME = true;
+require_once('_incl_data/__config.php');
+require_once('_incl_data/class/__db_connect.php');
+define('IP', UserIp::get());
+$u = User::start();
 
-define('IP',GetRealIp());
-include('_incl_data/__config.php');
-define('GAME',true);
-include('_incl_data/class/__db_connect.php');
-include('_incl_data/class/__users.php');
+if (isset($_GET['list']) && $_GET['list'] == 2015) {
+
+    $mail = [];
+    $yes = [];
+    $sp = mysql_query('SELECT * FROM `aaa_send_count`');
+    while ($pl = mysql_fetch_array($sp)) {
+        if (!isset($yes[$pl['mail']])) {
+            $yes[$pl['mail']] = true;
+            $mail[] = $pl['mail'];
+        }
+    }
+    $mail[] = 'support@new-combats.com';
+    $sp = mysql_query('SELECT * FROM `users` WHERE `real` > 0');
+    while ($pl = mysql_fetch_array($sp)) {
+        if (!isset($yes[$pl['mail']])) {
+            $yes[$pl['mail']] = true;
+            $mail[] = $pl['mail'];
+        }
+    }
+    $mail[] = 'support@new-combats.com';
+    $sp = mysql_query('SELECT * FROM `users_kill`');
+    while ($pl = mysql_fetch_array($sp)) {
+        if (!isset($yes[$pl['mail']])) {
+            $yes[$pl['mail']] = true;
+            $mail[] = $pl['mail'];
+        }
+    }
+    $sp = mysql_query('SELECT * FROM `beta_testers`');
+    while ($pl = mysql_fetch_array($sp)) {
+        if (!isset($yes[$pl['mail']])) {
+            $yes[$pl['mail']] = true;
+            $mail[] = $pl['mail'];
+        }
+    }
+    $sp = mysql_query('SELECT * FROM `users_rbk`');
+    while ($pl = mysql_fetch_array($sp)) {
+        if (!isset($yes[$pl['email']])) {
+            $yes[$pl['email']] = true;
+            $mail[] = $pl['email'];
+        }
+    }
+
+    $e = explode(',', 'mails');
+    $i = 0;
+    while ($i < count($e)) {
+        if (!isset($yes[$e[$i]])) {
+            $yes[$yes[$e[$i]]] = true;
+            $mail[] = $e[$i];
+        }
+        $i++;
+    }
+
+    $i = 0;
+    while ($i < count($mail)) {
+        echo $mail[$i] . '<br>';
+        $i++;
+    }
 
-if( isset($_GET['list']) && $_GET['list'] == 2015 ) {
-	
-	$mail = array();
-	$yes = array();
-	$sp = mysql_query('SELECT * FROM `aaa_send_count`');
-	while( $pl = mysql_fetch_array($sp) ) {
-		if(!isset($yes[$pl['mail']])) {
-			$yes[$pl['mail']] = true;
-			$mail[] = $pl['mail'];
-		}
-	}
-	$mail[] = 'support@new-combats.com';
-	$sp = mysql_query('SELECT * FROM `users` WHERE `real` > 0');
-	while( $pl = mysql_fetch_array($sp) ) {
-		if(!isset($yes[$pl['mail']])) {
-			$yes[$pl['mail']] = true;
-			$mail[] = $pl['mail'];
-		}
-	}
-	$mail[] = 'support@new-combats.com';
-	$sp = mysql_query('SELECT * FROM `users_kill`');
-	while( $pl = mysql_fetch_array($sp) ) {
-		if(!isset($yes[$pl['mail']])) {
-			$yes[$pl['mail']] = true;
-			$mail[] = $pl['mail'];
-		}
-	}
-	$sp = mysql_query('SELECT * FROM `beta_testers`');
-	while( $pl = mysql_fetch_array($sp) ) {
-		if(!isset($yes[$pl['mail']])) {
-			$yes[$pl['mail']] = true;
-			$mail[] = $pl['mail'];
-		}
-	}
-	$sp = mysql_query('SELECT * FROM `users_rbk`');
-	while( $pl = mysql_fetch_array($sp) ) {
-		if(!isset($yes[$pl['email']])) {
-			$yes[$pl['email']] = true;
-			$mail[] = $pl['email'];
-		}
-	}
-	
-	$e = explode(',','mails');	
-	$i = 0;
-	while( $i < count($e) ) {
-		if(!isset($yes[$e[$i]])) {
-			$yes[$yes[$e[$i]]] = true;
-			$mail[] = $e[$i];
-		}
-		$i++;
-	}
-	
-	$i = 0;
-	while( $i < count($mail) ) {
-		echo $mail[$i] . '<br>';
-		$i++;
-	}
-	
 }
 
 $keymd5 = '$����$����$';
 
-if(isset($_GET['count'])) {
-	if( md5($keymd5.'+'.$_GET['count']) == $_GET['sd4'] ) {
-		$mail = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_send_count` WHERE `mail` = "'.mysql_real_escape_string($_GET['count']).'" LIMIT 1'));
-		if(isset($mail['id'])) {
-			mysql_query('UPDATE `aaa_send_count` SET `time` = "'.time().'",`ip` = "'.mysql_real_escape_string(IP).'" WHERE `id` = "'.$mail['id'].'" LIMIT 1');
-		}else{
-			mysql_query('INSERT INTO `aaa_send_count` (`mail`,`time`,`ip`) VALUES (
-				"'.mysql_real_escape_string($_GET['count']).'","'.time().'","'.mysql_real_escape_string(IP).'"
-			)');
-		}
-		echo '[SD4]';
-	}else{
-		echo '[ERROR_SD4_KEY]';
-	}
-	die('[IMG]');
-}elseif(isset($_GET['uncancel'])) {
-	$mail = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_send_count` WHERE `mail` = "'.mysql_real_escape_string($_GET['uncancel']).'" LIMIT 1'));
-	if(isset($mail['id'])) {
-		mysql_query('UPDATE `aaa_send_count` SET `cancel` = "0",`time` = "'.time().'",`ip` = "'.mysql_real_escape_string(IP).'" WHERE `id` = "'.$mail['id'].'" LIMIT 1');
-		echo '��.����� <b>'.htmlspecialchars($_GET['uncancel']).'</b> ������� �������� �� ���� �������!';
-	}else{
-		echo '��.����� <b>'.htmlspecialchars($_GET['uncancel']).'</b> �� ������ � ����.';
-	}
-	die();
-}elseif(isset($_GET['cancel'])) {
-	if( md5($keymd5.'+'.$_GET['cancel']) == $_GET['sd4'] ) {
-		$mail = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_send_count` WHERE `mail` = "'.mysql_real_escape_string($_GET['cancel']).'" LIMIT 1'));
-		if(isset($mail['id'])) {
-			if($mail['cancel'] > 0) {
-				echo '�� ���������� �� ��������: <b>'.date('d.m.Y H:i:s',$mail['cancel']).'</b>, ������ ����������� �����? <a href="https://new-combats.com/mail.php?uncancel='.$mail['mail'].'">����������� �� �������� �����</a></b>';
-			}else{
-				mysql_query('UPDATE `aaa_send_count` SET `cancel` = "'.time().'",`time` = "'.time().'",`ip` = "'.mysql_real_escape_string(IP).'" WHERE `id` = "'.$mail['id'].'" LIMIT 1');
-				echo '��.����� <b>'.htmlspecialchars($_GET['cancel']).'</b> ������� �������� �� ����� ��������!';
-			}
-		}else{
-			echo '��.����� <b>'.htmlspecialchars($_GET['cancel']).'</b> �� ��������� �� ���� ��������.';
-		}
-	}else{
-		echo '�� �� ���������� �.�. SD4 ���� �� �������� � ��.����� <b>'.htmlspecialchars($_GET['cancel']).'.</b>. ��������� �� ������ ��������� � ������, ���� �������� ��� � ������ ��������� support@new-combats.com';
-	}
-	die();
+if (isset($_GET['count'])) {
+    if (md5($keymd5 . '+' . $_GET['count']) == $_GET['sd4']) {
+        $mail = mysql_fetch_array(
+            mysql_query(
+                'SELECT * FROM `aaa_send_count` WHERE `mail` = "' . mysql_real_escape_string(
+                    $_GET['count']
+                ) . '" LIMIT 1'
+            )
+        );
+        if (isset($mail['id'])) {
+            mysql_query(
+                'UPDATE `aaa_send_count` SET `time` = "' . time() . '",`ip` = "' . mysql_real_escape_string(
+                    IP
+                ) . '" WHERE `id` = "' . $mail['id'] . '" LIMIT 1'
+            );
+        } else {
+            mysql_query(
+                'INSERT INTO `aaa_send_count` (`mail`,`time`,`ip`) VALUES (
+				"' . mysql_real_escape_string($_GET['count']) . '","' . time() . '","' . mysql_real_escape_string(IP) . '"
+			)'
+            );
+        }
+        echo '[SD4]';
+    } else {
+        echo '[ERROR_SD4_KEY]';
+    }
+    die('[IMG]');
+} elseif (isset($_GET['uncancel'])) {
+    $mail = mysql_fetch_array(
+        mysql_query(
+            'SELECT * FROM `aaa_send_count` WHERE `mail` = "' . mysql_real_escape_string(
+                $_GET['uncancel']
+            ) . '" LIMIT 1'
+        )
+    );
+    if (isset($mail['id'])) {
+        mysql_query(
+            'UPDATE `aaa_send_count` SET `cancel` = "0",`time` = "' . time() . '",`ip` = "' . mysql_real_escape_string(
+                IP
+            ) . '" WHERE `id` = "' . $mail['id'] . '" LIMIT 1'
+        );
+        echo '��.����� <b>' . htmlspecialchars($_GET['uncancel']) . '</b> ������� �������� �� ���� �������!';
+    } else {
+        echo '��.����� <b>' . htmlspecialchars($_GET['uncancel']) . '</b> �� ������ � ����.';
+    }
+    die();
+} elseif (isset($_GET['cancel'])) {
+    if (md5($keymd5 . '+' . $_GET['cancel']) == $_GET['sd4']) {
+        $mail = mysql_fetch_array(
+            mysql_query(
+                'SELECT * FROM `aaa_send_count` WHERE `mail` = "' . mysql_real_escape_string(
+                    $_GET['cancel']
+                ) . '" LIMIT 1'
+            )
+        );
+        if (isset($mail['id'])) {
+            if ($mail['cancel'] > 0) {
+                echo '�� ���������� �� ��������: <b>' . date(
+                        'd.m.Y H:i:s', $mail['cancel']
+                    ) . '</b>, ������ ����������� �����? <a href="https://new-combats.com/mail.php?uncancel=' . $mail['mail'] . '">����������� �� �������� �����</a></b>';
+            } else {
+                mysql_query(
+                    'UPDATE `aaa_send_count` SET `cancel` = "' . time() . '",`time` = "' . time(
+                    ) . '",`ip` = "' . mysql_real_escape_string(IP) . '" WHERE `id` = "' . $mail['id'] . '" LIMIT 1'
+                );
+                echo '��.����� <b>' . htmlspecialchars($_GET['cancel']) . '</b> ������� �������� �� ����� ��������!';
+            }
+        } else {
+            echo '��.����� <b>' . htmlspecialchars($_GET['cancel']) . '</b> �� ��������� �� ���� ��������.';
+        }
+    } else {
+        echo '�� �� ���������� �.�. SD4 ���� �� �������� � ��.����� <b>' . htmlspecialchars(
+                $_GET['cancel']
+            ) . '.</b>. ��������� �� ������ ��������� � ������, ���� �������� ��� � ������ ��������� support@new-combats.com';
+    }
+    die();
 }
 
-if(isset($_GET['send6102'])) {
-	// specify your email below and that's all ;)	
-	$message = '����� ���������!';	
-	//	***************************************
-	
-	function sendmail($mail,$login) {
-		global $message, $keymd5;
-		//
-		$md5mail = md5($keymd5.'+'.$mail);
-		$message = str_replace('{mail}',$mail,$message);
-		$message = str_replace('{login}',$login,$message);
-		$message = str_replace('{md5mail}',$md5mail,$message);
-		//
-		$headers  = "MIME-Version: 1.0\r\n";
-		$headers .= "Content-type: text/html; charset=windows-1251\r\n";	
-		$headers .= "From: support@new-combats.com\r\n";
-		//
-		$to = $mail;
-		//
-		$subject = '���������� ����';
-		$message = '����������� ��� e-mail ��� <b>'.$mail['name'].'</b>.<br><br>� ���������,<br>�������������';
-		//
-		if (mail($to, $subject, $message, $headers) == true) {
-			//return true;
-			echo '[Yes]';
-		}else{
-			//return false;
-			echo '[No]';
-		}
-	}	
+if (isset($_GET['send6102'])) {
+    // specify your email below and that's all ;)
+    $message = '����� ���������!';
+    //	***************************************
 
-	$mail = mysql_fetch_array(mysql_query('SELECT * FROM `users_rbk` WHERE `email` != "" AND `send` != 3 AND `email` NOT LIKE "%@1%" LIMIT 1'));
-	$x = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users_rbk` WHERE `email` != "" AND `send` != 3 AND `email` NOT LIKE "%@1%" LIMIT 1'));
-	$x = 0+$x[0];
-	if(isset($mail['email'])) {
-		//$mail['email'] = 'difree@gmail.com';
-		
-		sendmail($mail['email'],$mail['login']);
-		mysql_query('UPDATE `users_rbk` SET `send` = 3 WHERE `email` = "'.$mail['email'].'"');
-		echo '['.$mail['email'].']<hr>����������� ��� e-mail ��� <b>'.$mail['name'].'</b>.<br><br>� ���������,<br>�������������<hr>';
-		echo '[+]<script>setTimeout("top.location = top.location",1000);</script>';
-	}else{
-		echo '[-]';
-		echo '['.$mail['email'].']';
-		/*echo '[-]<script>setTimeout("top.location = top.location",100);</script>';*/
-	}
-	die('<br>����������: '.$x);
-	if( $k > 0 ) {
-		echo '<script>setTimeout(\'location.href="mail.php?send=1&i='.$j.'";\',1500);</script>';		
-	}
-	echo '������� ����������: '.$k.' / 100 �����. ����� ������ ��������: '.(count($mails)-$k).'.<br><a href="mail.php?send=1&i='.$j.'">��������� 50 ������!</a>';
+    function sendmail($mail, $login)
+    {
+        global $message, $keymd5;
+        //
+        $md5mail = md5($keymd5 . '+' . $mail);
+        $message = str_replace('{mail}', $mail, $message);
+        $message = str_replace('{login}', $login, $message);
+        $message = str_replace('{md5mail}', $md5mail, $message);
+        //
+        $headers = "MIME-Version: 1.0\r\n";
+        $headers .= "Content-type: text/html; charset=windows-1251\r\n";
+        $headers .= "From: support@new-combats.com\r\n";
+        //
+        $to = $mail;
+        //
+        $subject = '���������� ����';
+        $message = '����������� ��� e-mail ��� <b>' . $mail['name'] . '</b>.<br><br>� ���������,<br>�������������';
+        //
+        if (mail($to, $subject, $message, $headers) == true) {
+            //return true;
+            echo '[Yes]';
+        } else {
+            //return false;
+            echo '[No]';
+        }
+    }
+
+    $mail = mysql_fetch_array(
+        mysql_query('SELECT * FROM `users_rbk` WHERE `email` != "" AND `send` != 3 AND `email` NOT LIKE "%@1%" LIMIT 1')
+    );
+    $x = mysql_fetch_array(
+        mysql_query(
+            'SELECT COUNT(*) FROM `users_rbk` WHERE `email` != "" AND `send` != 3 AND `email` NOT LIKE "%@1%" LIMIT 1'
+        )
+    );
+    $x = 0 + $x[0];
+    if (isset($mail['email'])) {
+        //$mail['email'] = 'difree@gmail.com';
+
+        sendmail($mail['email'], $mail['login']);
+        mysql_query('UPDATE `users_rbk` SET `send` = 3 WHERE `email` = "' . $mail['email'] . '"');
+        echo '[' . $mail['email'] . ']<hr>����������� ��� e-mail ��� <b>' . $mail['name'] . '</b>.<br><br>� ���������,<br>�������������<hr>';
+        echo '[+]<script>setTimeout("top.location = top.location",1000);</script>';
+    } else {
+        echo '[-]';
+        echo '[' . $mail['email'] . ']';
+
+    }
+    die('<br>����������: ' . $x);
 }
-?>
\ No newline at end of file
diff --git a/mailconf.php b/mailconf.php
index 638bb057..acb973a0 100644
--- a/mailconf.php
+++ b/mailconf.php
@@ -1,50 +1,42 @@
-<?
-function GetRealIp(){
-	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'];
-}
+<?php
 
-define('IP',GetRealIp());
-include('_incl_data/__config.php');
-define('GAME',true);
-include('_incl_data/class/__db_connect.php');
+use Insallah\Db;
 
-if(isset($_GET['mail'])) {
-	$key = md5('mailconf*15+'.$_GET['mail']);
-	if($_GET['key'] != $key) {
-		echo '���� �� ���������, �������� ������������� �� E-mail: admin@new-combats.com';
-	}elseif(isset($_GET['cancel'])) {
-		//����� �� ��������
-		echo '�� ���������� �� �������� �� ��.�����: <b>'.$_GET['mail'].'</b>.';
-	}else{
-		//
-		$mcf = mysql_fetch_array(mysql_query('SELECT * FROM `mini_actions` WHERE `var` = "'.mysql_real_escape_string($_GET['mail']).'" LIMIT 1'));
-		$user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$mcf['uid'].'" LIMIT 1'));
-		//���������� �� ��������
-		if(!isset($user['id'])) {
-			echo '����������������� ����� ��������� ��.����� <b>'.$_GET['mail'].'</b> � ���������.';
-		}else{
-			$bank = mysql_fetch_array(mysql_query('SELECT * FROM `bank` WHERE `uid` = "'.$mcf['uid'].'" ORDER BY `id` DESC LIMIT 1'));
-			if($mcf['ok'] > 0) {
-				echo '�� ��� ������������ ���� E-mail �����! <b>'.date('d.m.Y H:i:s',$mcf['ok']).'</b>';
-			}elseif(!isset($bank['id'])) {
-				echo '������� �������� ���� � ������� �����, ����� �� ������ ��������� ���� 1 ���.';
-			}else{
-				//
-				mysql_query('UPDATE `mini_actions` SET `ok` = "'.time().'" WHERE `id` = "'.$mcf['id'].'" LIMIT 1');
-				mysql_query('UPDATE `bank` SET `money2` = `money2` + 1 WHERE `id` = "'.$bank['id'].'" LIMIT 1');
-				//
-				echo '�� ������� ����������� �� �������� �������� ��� ��.����� <b>'.$_GET['mail'].'</b>, �� ���� ��������� <b>'.$user['login'].'</b> �������� 1 ���.';
-			}
-		}
-	}
-}else{
-	echo 'E-mail �� ������.';
+const GAME = true;
+require_once('_incl_data/__config.php');
+require_once('_incl_data/class/__db_connect.php');
+define('IP', UserIp::get());
+
+if (isset($_GET['mail'])) {
+    $key = md5('mailconf*15+' . $_GET['mail']);
+    if ($_GET['key'] != $key) {
+        echo '���� �� ���������, �������� ������������� �� E-mail: admin@new-combats.com';
+    } elseif (isset($_GET['cancel'])) {
+        //����� �� ��������
+        echo '�� ���������� �� �������� �� ��.�����: <b>' . $_GET['mail'] . '</b>.';
+    } else {
+        //
+        $mcf = Db::getRow('select * from mini_actions where var = ?', [$_GET['mail']]);
+        $user = Db::getRow('select * from users where id = ?', [$mcf['uid']]);
+        //���������� �� ��������
+        if (!isset($user['id'])) {
+            echo '����������������� ����� ��������� ��.����� <b>' . $_GET['mail'] . '</b> � ���������.';
+        } else {
+            $bank = Db::getRow('select * from bank where uid = (select uid from mini_actions where var = ?) order by id desc limit 1', [$_GET['mail']]);
+            if ($mcf['ok'] > 0) {
+                echo '�� ��� ������������ ���� E-mail �����! <b>' . date('d.m.Y H:i:s', $mcf['ok']) . '</b>';
+            } elseif (!isset($bank['id'])) {
+                echo '������� �������� ���� � ������� �����, ����� �� ������ ��������� ���� 1 ���.';
+            } else {
+                Db::sql('update mini_actions set ok = unix_timestamp() where id = ?', [$mcf['id']]);
+                Db::sql('update bank set money2 = money2 + 1 where id = ?', [$bank['id']]);
+                echo '�� ������� ����������� �� �������� �������� ��� ��.����� <b>' . $_GET['mail'] . '</b>, �� ���� ��������� <b>' . $user['login'] . '</b> �������� 1 ���.';
+            }
+        }
+    }
+} else {
+    echo 'E-mail �� ������.';
 }
 
 echo '<br><br>- - - - - - -<br><br>� ���������,<br>������������� &copy; <a href="https://new-combats.com/">new-combats.com</a>';
 
-?>
\ No newline at end of file
diff --git a/main.php b/main.php
index 5e2e1042..9e8adecc 100644
--- a/main.php
+++ b/main.php
@@ -24,47 +24,43 @@
     }
 
 </style>
+<link href="/img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
 <div class="se-pre-con" id="se-pre-con"></div>
 
 <?php
 
 use Insallah\Db;
 
-function GetRealIp()
-{
-    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'];
-}
-
 function var_info($vars, $d = false)
 {
     echo "<pre style='border: 1px solid gray;border-radius: 5px;padding: 3px 6px;background: #cecece;color: black;font-family: Arial;font-size: 12px;'>\n";
     var_dump($vars);
     echo "</pre>\n";
-    if ($d) exit();
+    if ($d) {
+        exit();
+    }
 }
 
-define('IP', GetRealIp());
-
+const GAME = true;
 require_once('_incl_data/__config.php');
-define('GAME', true);
-require_once('_incl_data/class/__db_connect.php');
+//require_once('_incl_data/class/__db_connect.php');
+$pdo = \Core\Database::init();
+define('IP', UserIp::get());
 date_default_timezone_set('Europe/Moscow');
 
-require_once('_incl_data/class/__magic.php');
-require_once('_incl_data/class/__user.php');
-require_once('_incl_data/class/__filter_class.php');
-require_once('_incl_data/class/__quest.php');
+$magic = new Magic();
+$u = User::start();
+$filter = new Filter();
+$q = new Quests;
 
 /** ��������������� ���� �����, ������� �� � ��� �������� �� ���������. */
-Db::exec('update stats set 
+Db::exec(
+    'update stats set 
                  hpNow = hpAll, 
                  mpNow = mpAll 
              where 
-                 id in (select id from users where bot = 2 and battle = 0)');
+                 id in (select id from users where bot = 2 and battle = 0)'
+);
 
 if ($u->info['banned'] > 0) {
     header('location: /index.php');
@@ -93,37 +89,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 '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
-<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
-<meta http-equiv=Cache-Control Content=no-cache>
-<meta http-equiv=PRAGMA content=NO-CACHE>
-<meta http-equiv=Expires Content=0>
-<meta name="msapplication-config" content="browserconfig.xml" />
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
-</head>
-<body style="padding-top:0px; margin-top:7px; height:100%; background-color:#e2e0e1;">';
+if (!isset($_GET['mAjax']) && !isset($_GET['ajaxHostel'])) {
+    echo '<!DOCTYPE html>
+<div style="padding-top:0; margin-top:7px; height:100%; background-color:#e2e0e1;">';
+}
 $act = -2;
 $act2 = 0;
 $u->stats = $u->getStats($u->info['id'], 0);
@@ -141,10 +135,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'];
@@ -152,10 +156,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) {
@@ -173,7 +196,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;
                 }
@@ -201,9 +228,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]] &quot;' . $u->info['login'] . '&quot; ��������' . $sx . ' �������� ��������� �� ����� �� ��������� &quot;' . $ua['login'] . '&quot;.';
@@ -212,7 +243,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');
@@ -238,24 +272,19 @@ if ($ul == 1) {
     $act = 1;
 }
 if ($u->info['repass'] > 0) {
-    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', UserIp::get());
 
-    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('<font color="red"><b>��������!</b> ����� ������ ��������� � ip %' . $u->info['ip'] . '.<br>��� �������������� �������� ������� � ������� IP, ���� ���������� � ������������� ������� ����� ������ ���������. �������� ��������� �� ����������!</font>');
@@ -268,7 +297,8 @@ if ($u->info['repass'] > 0) {
                 echo '<font color="red"><b>��������!</b>������ �� ���������.</font>';
             }
         }
-        die('<br><br><br><font color="red"><b>������� ���������� ������ �� ���������!</b><br>������ ����� ��������, ���� ������ �� ������� ����� 2 �������.</font><br><br><hr>
+        die(
+        '<br><br><br><font color="red"><b>������� ���������� ������ �� ���������!</b><br>������ ����� ��������, ���� ������ �� ������� ����� 2 �������.</font><br><br><hr>
 			<form action="main.php" method="post">
 		<fieldset>
 		<legend><b>������� ������</b></legend>
@@ -278,13 +308,18 @@ if ($u->info['repass'] > 0) {
 			<tr><td align=right><input type=submit value="������� ������" name="changepsw"></td><td></td></tr>
 		</table>
 		</fieldset>
-		</font>');
+		</font>'
+        );
     }
 }
 
 /*-----------------------*/
 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) {
     require_once('modules_data/btl_.php');
@@ -329,7 +364,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 '<script>setTimeout(function(){alert("��� ��������� ������� �������� �� ' . date('d.m.y H:i', $u->info['allLock']) . '")},250);</script>';
+                echo '<script>setTimeout(function(){alert("��� ��������� ������� �������� �� ' . date(
+                        'd.m.y H:i', $u->info['allLock']
+                    ) . '")},250);</script>';
             }
         } elseif (isset($_GET['unstack']) && isset($_GET['inv']) && $u->newAct($_GET['sd4'])) {
             $u->unstack(intval($_GET['unstack']), intval($_GET['unstackCount']));
@@ -365,9 +402,7 @@ if ($act != -2) {
 }
 
 /*-----------------------*/
-if (isset($_GET['worklist']) && $u->info['admin'] > 0) {
-    require_once('modules_data/worklist.php');
-} elseif (isset($_GET['security']) && !isset($u->tfer['id']) && $trololo == 1) {
+if (isset($_GET['security']) && !isset($u->tfer['id']) && $trololo == 1) {
     require_once('modules_data/_changepass.php');
 } elseif ($u->info['level'] >= 0 && isset($_GET['friends']) && !isset($u->tfer['id'])) {
     require_once('modules_data/_friends.php');
@@ -417,7 +452,7 @@ if (isset($_GET['worklist']) && $u->info['admin'] > 0) {
         die();
     }
     require_once('modules_data/_alhp.php');
-//������ ���������
+    //������ ���������
 } elseif (isset($_GET['bukmeker']) && $u->info['level'] > 0 && !isset($u->tfer['id'])) {
     require_once('modules_data/_bukmeker.php');
     //������ ��������
@@ -445,7 +480,8 @@ if (isset($_GET['worklist']) && $u->info['admin'] > 0) {
 				</script>
 				";
         if ($u->info['dnow'] > 0) {
-            require_once('_incl_data/class/__dungeon.php');
+            $d = new Dungeon;
+            $d->start();
         }
         require_once('modules_data/_dialog.php');
     } elseif (isset($_GET['inv']) && !isset($u->tfer['id']) && $trololo == 1) {
@@ -461,7 +497,9 @@ if (isset($_GET['worklist']) && $u->info['admin'] > 0) {
     } 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()) {
             require_once('modules_data/_locations.php');
-            echo '<script>setTimeout(function(){alert("��� ��������� �������� �� ' . date('d.m.y H:i', $u->info['allLock']) . '")},250);</script>';
+            echo '<script>setTimeout(function(){alert("��� ��������� �������� �� ' . date(
+                    'd.m.y H:i', $u->info['allLock']
+                ) . '")},250);</script>';
         } else {
             require_once('modules_data/_transfers.php');
         }
@@ -478,30 +516,19 @@ if (isset($_GET['worklist']) && $u->info['admin'] > 0) {
     }
 }
 
-/**
- * �������� ������ ��� ��� ������� ������ ������ ���.
- * 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'])) {
@@ -527,20 +554,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 = '�� ������� ������� ������� &quot;' . $itmo['name'] . '&quot; � ������� &quot;' . $u->room['name'] . '&quot;.';
-                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']
+                    );
                 }
             }
         }
@@ -548,8 +585,7 @@ while ($pl = mysql_fetch_array($sp)) {
             if ($tk == 1 && $pl['tr_login'] == '0') {
                 $tk = 2;
             }
-            $iloc .= '<a class="tolobf' . $tk . '" href="main.php?take_loc_item=' . $pl['id'] . '" target="main"><div class="outer"><div class="middle"><div class="inner">' .
-                '<img title="������� &quot;' . $itmo['name'] . '&quot;';
+            $iloc .= '<a class="tolobf' . $tk . '" href="main.php?take_loc_item=' . $pl['id'] . '" target="main"><div class="outer"><div class="middle"><div class="inner">' . '<img title="������� &quot;' . $itmo['name'] . '&quot;';
             if ($pl['tr_login']) {
                 $iloc .= '\n' . '������� ��� ������ &quot;' . $pl['tr_login'] . '&quot;';
             } elseif ($pl['tr_sex'] == 0) {
@@ -559,8 +595,7 @@ while ($pl = mysql_fetch_array($sp)) {
             } else {
                 $iloc .= '\n' . '������� ����� ��������� ������';
             }
-            $iloc .= '" src="https://img.new-combats.com/i/items/' . $itmo['img'] . '">' .
-                '</div></div></div></a> ';
+            $iloc .= '" src="https://img.new-combats.com/i/items/' . $itmo['img'] . '">' . '</div></div></div></a> ';
         }
     } else {
         echo '[!]';
@@ -572,10 +607,7 @@ if ($iloc != '') {
     if ($iloce != '') {
         $iloc = '<div style="padding:10px;"><font color=red>' . $iloce . '</font></div>' . $iloc;
     }
-    $iloc = '<style>' .
-        '.tolobf0 { display:inline-block; width:80px; height:80px; background-color:#e5e5e5; text-align:center; }.tolobf0:hover { background-color:#d5d5d5; text-align:center; }.tolobf2 { display:inline-block; width:80px; height:80px; background-color:#FFD700; text-align:center; }.tolobf2:hover { background-color:#DAA520; text-align:center; }.tolobf1 { display:inline-block; width:80px; height:80px; background-color:#d5d5e5; text-align:center; }.tolobf1:hover { background-color:#d5d5d5; text-align:center; }.outer {    display: table;    position: absolute;    height: 80px;    width: 80px;}.middle {    display: table-cell;    vertical-align: middle;}.inner {  margin-left: auto; margin-right: auto; width: 80px; }' .
-        '</style>' .
-        '<h3>� ������� ���������� ��������</h3>' . $iloc;
+    $iloc = '<style>' . '.tolobf0 { display:inline-block; width:80px; height:80px; background-color:#e5e5e5; text-align:center; }.tolobf0:hover { background-color:#d5d5d5; text-align:center; }.tolobf2 { display:inline-block; width:80px; height:80px; background-color:#FFD700; text-align:center; }.tolobf2:hover { background-color:#DAA520; text-align:center; }.tolobf1 { display:inline-block; width:80px; height:80px; background-color:#d5d5e5; text-align:center; }.tolobf1:hover { background-color:#d5d5d5; text-align:center; }.outer {    display: table;    position: absolute;    height: 80px;    width: 80px;}.middle {    display: table-cell;    vertical-align: middle;}.inner {  margin-left: auto; margin-right: auto; width: 80px; }' . '</style>' . '<h3>� ������� ���������� ��������</h3>' . $iloc;
     $tjs .= 'top.frames[\'main\'].locitems=1;parent.$(\'#canal1\').html( \'' . $iloc . '\' );';
 } else {
     $tjs .= 'top.frames[\'main\'].locitems=1;parent.$(\'#canal1\').html( \'\' );';
@@ -583,7 +615,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 '<script>top.myexpLineTop27(' . $u->info['exp'] . ',' . $spl . ');' . $tjs . 'top.ctest("' . $u->info['city'] . '");top.sd4key="' . $u->info['nextAct'] . '"; var battle = ' . (0 + $u->info['battle']) . '; top.hic();</script></body>
 </html>';
diff --git a/main_bot.php b/main_bot.php
index 0e028ffc..57bb3bfe 100644
--- a/main_bot.php
+++ b/main_bot.php
@@ -1,483 +1,247 @@
-<?
+<?php
 
 # �������� IP
-function getIPblock() {
-   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(getIPblock() != $_SERVER['SERVER_ADDR'] && getIPblock() != '127.0.0.1' && getIPblock() != '' && getIPblock() != '91.228.152.24') {
-	die(getIPblock().'<br>'.$_SERVER['SERVER_ADDR']);
-}
-
+use Insallah\Db;
 
+const GAME = true;
 include('_incl_data/__config.php');
-define('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').' (����������� ������): <b>'.mysql_real_escape_string($t).'</b>","capitalcity","TABU","6","1","-1")');
+if (!in_array(UserIp::get(), ['', '127.0.0.1', '91.228.152.24', $_SERVER['SERVER_ADDR']])) {
+    die(UserIp::get() . '<br>' . $_SERVER['SERVER_ADDR']);
 }
 
-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'];
-			}			
-		}		
-	}
+function e($t)
+{
+    mysql_query(
+        'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("core #' . date('d.m.Y') . ' %' . date(
+            'H:i:s'
+        ) . ' (����������� ������): <b>' . mysql_real_escape_string($t) . '</b>","capitalcity","TABU","6","1","-1")'
+    );
 }
 
-if(!isset($uzr['id'])) {
-	header('location: main.php');
-	die();
+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` = ' . $id['id'] . ' AND `pass` = "' . mysql_real_escape_string($id['pass']) . '"'));
+        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();
 }
 
 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('��� ���������� ������������ ���������.<br>��������������� � ������� ��������.');
+if ($u->info['activ'] > 0) {
+    die('��� ���������� ������������ ���������.<br>��������������� � ������� ��������.');
 }
 
 $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']);
 }
-if($u->room['file']=="objaga" || $u->room['file']=="post"){$trololo=0;}else{$trololo=1;}
+
+$trololo = $u->room['file'] == "objaga" || $u->room['file'] == "post" ? 0 : 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']);
+    Db::sql('update users set online = unix_timestamp(), timeMain = unix_timestamp() where id = ?', [$u->info['id']]);
+} elseif ($u->info['timeMain'] < time() - 60) {
+    Db::sql('update users set online = unix_timestamp(), timeMain = unix_timestamp() where id = ?', [$u->info['id']]);
 }
 
-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]] &quot;'.$u->info['login'].'&quot; ��������'.$sx.' ��������� �� ����� �� ��������� &quot;'.$ua['login'].'&quot;.';
-				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 = Db::getValue('select clan from users where id = ?', [$_GET['atak_user']]);
+        $cruw = Db::getValue(
+            'select id from clan_wars where ((clan1 = ? and clan2 = ?) or (clan1 = ? and clan2 = ?)) and time_finish > unix_timestamp() limit 1',
+            [
+                $ua, $u->info['clan'], $u->info['clan'], $ua,
+            ]
+        );
+        unset($ua);
+        if (isset($cruw)) {
+            $cruw = 1;
+        }
+
+        $ua = Db::getRow(
+            'select * from stats left join users on stats.id = users.id where (atack > unix_timestamp() or atack = 1 or 1 = ?) and stats.id = ?',
+            [$cruw, $_GET['atak_user']]
+        );
+
+        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]] &quot;' . $u->info['login'] . '&quot; ��������' . $sx . ' ��������� �� ����� �� ��������� &quot;' . $ua['login'] . '&quot;.';
+                Db::sql(
+                    'insert into chat (new, type, typeTime, time, city, room, text) values (1,6,1,unix_timestamp(),?,?,?)',
+                    [
+                        $u->info['city'],
+                        $u->info['room'],
+                        $rtxt,
+                    ]
+                );
+
+                header('location: main.php');
+                die();
+            } else {
+                $u->error = $ua['room'] != $u->info['room'] ?
+                    '�������� ��������� � ������ �������' :
+                    '�������� ����� ������� ����� ������� ������.';
+            }
+        } else {
+            //�� ��������� ������ �������
+            $u->error = '�������� �� � ����, ���� �� ��� ��� �����';
+        }
+    }
+    $u->error = '��� ����������� ��������� ��� ����������...';
 }
 
-//mysql_query('START TRANSACTION');
+if ($u->info['battle_text'] != '') {
+    //���������� �������� � ������� ������
+    if ($u->info['last_b'] > 0) {
+        Db::sql(
+            'insert into battle_last (battle_id, uid, time, act, align, clan, exp)  values (?,?,unix_timestamp(),?,?,?,?)',
+            [
+                $u->info['last_b'],
+                $u->info['id'],
+                $u->info['last_a'],
+                $u->info['align'],
+                $u->info['clan'],
+                $u->info['exp'],
+            ]
+        );
 
-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');
+    }
+    Db::sql('update stats set battle_text = ?, last_b = 0 where id = ?', ['', $u->info['id']]);
 }
 
-/*echo '
-<!DOCTYPE html>
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
-<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
-<meta http-equiv=Cache-Control Content=no-cache>
-<meta http-equiv=PRAGMA content=NO-CACHE>
-<meta http-equiv=Expires Content=0>
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
-</head>
-<body style="padding-top:0px; margin-top:7px; background-color:#e2e0e0;">';
-*/
-/*-----------------------*/
-$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) {
 
-}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'] != '') {
+        Db::sql('update stats set battle_text = ?, last_b = 0 where id = ?', ['', $u->info['id']]);
+    }
+
+    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 '<script>'.$tjs.'top.ctest("'.$u->info['city'].'");top.sd4key="'.$u->info['nextAct'].'"; var battle = '.(0+$u->info['battle']).'; top.hic();</script></body>
-</html>';*/
-
-//unlink($lock_file);
 
 mysql_query('UNLOCK TABLES');
-?>
diff --git a/map.php b/map.php
index 951fdb79..5896d77c 100644
--- a/map.php
+++ b/map.php
@@ -1,68 +1,63 @@
 <?php
-function GetRealIp(){
-	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'];
-}
-define('IP',GetRealIp());
+const GAME = true;
 include('_incl_data/__config.php');
-define('GAME',true);
 include('_incl_data/class/__db_connect.php');
-include('_incl_data/class/__user.php');
+define('IP', UserIp::get());
+$u = User::start();
 
-if($u->info['banned'] > 0 || !isset($u->info['id'])) {
-	header('location: /index.php');
-	die();
+if ($u->info['banned'] || !isset($u->info['id'])) {
+    header('location: /index.php');
+    die();
 }
 ?>
 <!DOCTYPE HTML>
-<html>
+<html lang="ru">
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
-<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
-<meta http-equiv=Cache-Control Content=no-cache>
-<meta http-equiv=PRAGMA content=NO-CACHE>
-<meta http-equiv=Expires Content=0>
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
+    <title></title>
+    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"/>
+    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
+    <link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
 </head>
 <body style="padding-top:0px; margin-top:7px; height:100%; background-color:#dedede; background-image:url(/i/bgmain.jpg);">
 <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
-  <tr>
-    <td>&nbsp;</td>
-    <td align="center" valign="middle">
-    <!-- -->
-    <br><br>
-    <h3>�������� �������</h3>
-    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800" height="400" id="FlashID" title="test_map">
-      <param name="movie" value="map/main.swf">
-      <param name="quality" value="high">
-      <param name="wmode" value="opaque">
-      <param name="swfversion" value="15.0.0.0">
-      <!-- ���� ��� param ���������� ������������� Flash Player 6.0 r65 � ����� ������� ������ ��������� ��������� ������ Flash Player. ������� ���, ���� �� ������, ����� ������������ ������ ������. -->
-      <param name="expressinstall" value="../../Scripts/expressInstall.swf">
-      <!-- ��������� ��� object �� �������������� ��������� Internet Explorer. ������� ������� ��� �� Internet Explorer ��� ������ IECC. -->
-      <!--[if !IE]>-->
-      <object type="application/x-shockwave-flash" data="map/main.swf" width="800" height="400">
-        <!--<![endif]-->
-        <param name="quality" value="high">
-        <param name="wmode" value="opaque">
-        <param name="swfversion" value="15.0.0.0">
-        <param name="expressinstall" value="../../Scripts/expressInstall.swf">
-        <!-- ������� ���������� ��������� �������������� ���������� ��� ������������� Flash Player 6.0 � ����� ������ ������. -->
-        <div>
-          <h4>��� ����������� ���� �������� ��������� ����� ����� ������ Adobe Flash Player.</h4>
-          <p><a href="https://www.adobe.com/go/getflashplayer"><img src="https://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="�������� ������������� Adobe Flash Player" width="112" height="33" /></a></p>
-        </div>
-        <!--[if !IE]>-->
-      </object>
-      <!--<![endif]-->
-    </object>
-    <!-- -->
-    </td>
-    <td>&nbsp;</td>
-  </tr>
+    <tr>
+        <td>&nbsp;</td>
+        <td align="center" valign="middle">
+            <!-- -->
+            <br><br>
+            <h3>�������� �������</h3>
+            <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800" height="400" id="FlashID"
+                    title="test_map">
+                <param name="movie" value="map/main.swf">
+                <param name="quality" value="high">
+                <param name="wmode" value="opaque">
+                <param name="swfversion" value="15.0.0.0">
+                <!-- ���� ��� param ���������� ������������� Flash Player 6.0 r65 � ����� ������� ������ ��������� ��������� ������ Flash Player. ������� ���, ���� �� ������, ����� ������������ ������ ������. -->
+                <param name="expressinstall" value="../../Scripts/expressInstall.swf">
+                <!-- ��������� ��� object �� �������������� ��������� Internet Explorer. ������� ������� ��� �� Internet Explorer ��� ������ IECC. -->
+                <!--[if !IE]>-->
+                <object type="application/x-shockwave-flash" data="map/main.swf" width="800" height="400">
+                    <!--<![endif]-->
+                    <param name="quality" value="high">
+                    <param name="wmode" value="opaque">
+                    <param name="swfversion" value="15.0.0.0">
+                    <param name="expressinstall" value="../../Scripts/expressInstall.swf">
+                    <!-- ������� ���������� ��������� �������������� ���������� ��� ������������� Flash Player 6.0 � ����� ������ ������. -->
+                    <div>
+                        <h4>��� ����������� ���� �������� ��������� ����� ����� ������ Adobe Flash Player.</h4>
+                        <p><a href="https://www.adobe.com/go/getflashplayer"><img
+                                        src="https://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
+                                        alt="�������� ������������� Adobe Flash Player" width="112" height="33"/></a>
+                        </p>
+                    </div>
+                    <!--[if !IE]>-->
+                </object>
+                <!--<![endif]-->
+            </object>
+            <!-- -->
+        </td>
+        <td>&nbsp;</td>
+    </tr>
 </table>
 </body>
 </html>
\ No newline at end of file
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/_alhp.php b/modules_data/_alhp.php
index c7979ba4..f3216f24 100644
--- a/modules_data/_alhp.php
+++ b/modules_data/_alhp.php
@@ -299,10 +299,10 @@ $srok = array(15=>'15 
 	{
 		if(isset($_POST['usem1']))
 		{
-			include('moder/usem1.php');					
+			require_once('moder/usem1.php');					
 		}elseif(isset($_POST['teleport']))
 		{
-			//include('moder/teleport.php');
+			//require_once('moder/teleport.php');
 		}
 	}
 if(isset($_POST['tologin'],$_POST['message'])) {
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 @@
-<?
-				echo "
-				<script language='JavaScript'>
-				var elem = document.getElementById('se-pre-con');
-				elem.parentNode.removeChild(elem);
-				</script>
-				";
-if(!defined('GAME'))
-{
-	die();
+<?php
+if (!defined('GAME') || !$u->info['bukmeker'] && !$u->info['admin']) {
+    die();
 }
-if($u->info['bukmeker']<>1 && $u->info['admin']<>1){
-    die('<center><h4>�� ����� ��� ������!</h4></center>');
-}
-?>
-<script type="text/javascript" language="javascript" src='https://img.new-combats.com/js/commoninf.js'></script>
-<style>
-.modpow {
-	background-color:#ddd5bf;
-}
-.mt {
-	background-color:#b1a993;
-	padding-left:10px;
-	padding-right:10px;
-	padding-top:5px;
-	padding-bottom:5px;
-}
-.md {
-	padding:10px;
-}
-</style>
-<table align=left><tr><td></td></tr></table><table align=right><tr><td><INPUT TYPE="button" onclick="location.href='main.php?bukmeker=1';" value="��������" class="btn" title="��������"> <INPUT TYPE="button" onclick="location.href='main.php';" class="btn" value="���������" title="���������"></table>
-<center><h4><i>����� ���������� � ������ ���������, �������� <?=$u->info['login']?></h4></i></center>
-<?
 $pl = mysql_fetch_array(mysql_query('SELECT * FROM `bank_table` ORDER BY `time` DESC LIMIT 1'));
-$ba = mysql_fetch_array(mysql_query("SELECT * FROM `bank_alh` WHERE `uid` = '".mysql_real_escape_string($u->info['id'])."' LIMIT 1"));
-if(isset($ba['id'])) {
+$ba = mysql_fetch_array(mysql_query("SELECT * FROM `bank_alh` WHERE `uid` = " . $u->info['id']));
 ?>
-<table width=320>
-    <tr>
-        <td>
-        	<h4>��������</h4>
-            <b><?=$ba['cr']?></b> ��.    
-            <hr />
-            <form method="post" action="main.php?bukmeker=1">
-            <?
-			if(isset($_POST['buy_cr'])) {
-				$uba = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `login` = "'.mysql_real_escape_string($_POST['buy_cr']).'" LIMIT 1'));
-				if(isset($uba['login'])) {
-					echo '��������� �� ���������: '.$u->microLogin($uba['id'],1).'<br>';
-				}else{
-					echo '<font color=red>���������� ���� ������������, ���� �� ������.</font><hr>';
-					unset($_POST['buy_cr']);
-				}
-				echo '<hr>';
-				if(isset($uba['login'])) {
-					$_POST['buk_cr'] = round($_POST['buk_cr'],2);
-					if(isset($_POST['buk_cr']) && $_POST['buk_cr'] < 1) {
-						echo '<font color=red>����������� ����� ��������: 1 ��.</font><hr>';
-						unset($_POST['buk_cr']);
-					}elseif($_POST['buk_cr'] > $ba['cr']) {
-						echo '<font color=red>������������ ������� �� �����</font><hr>';
-						unset($_POST['buk_cr']);
-					}
-					if(isset($_POST['buygoodluck'])) { 
-						echo '<script>alert("��������� '.$_POST['buk_cr'].' ��!");location.href="main.php?bukmeker=1";</script>';
-						$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 '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <input name="buk_cr" style="width:50px;" value="0.00" /> <input class="btn btn-success" value="�����" type="submit" /><br>';
-						}else{
-							echo ' <b>'.round((int)$_POST['buk_cr'],2).'</b> ��.<input name="buk_cr" type="hidden" value="'.$_POST['buk_cr'].'" />';
-							echo ' &nbsp; <input type="submit" name="buygoodluck" class="btn btn-danger" value="��������� ��">';
-						}
-					}
-				}
-			}			
-			
-             if(isset($_POST['buy_cr'])){ ?><input name="buy_cr" type="hidden" value="<?=$_POST['buy_cr']?>" /> <? }else{ ?>��������� �� ���������: <input name="buy_cr" style="width:50px;" value="<?=$_POST['buy_cr']?>" /> <input class="btn btn-success" value="�����" type="submit" /><? } ?>
-        	</form>
-        </td>
-    </tr>
-</table>
-<?
-}
-if($u->info['bukmeker']=1 || $u->info['admin']==1){
-    if (isset($_POST['systemM']) && !empty($_POST['systemM'])){
-
-        $r = "<b>��������:</b>";
-        $r .='<font color=darkgreen><b> '.$_POST['sysMes'].'</b><b></font> [������������ �������]</b>';
-        mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','capitalcity','','','','".$r."','".time()."','6','0')");
-
-        echo "<br><font color=red><b>��������� ��������� �����������</b></font>";
+<script>
+    let elem = document.getElementById('se-pre-con');
+    elem.parentNode.removeChild(elem);
+</script>
+<script type="text/javascript" src='https://img.new-combats.com/js/commoninf.js'></script>
+<style>
+    .modpow {
+        background-color: #ddd5bf;
     }
 
-   echo "<br>�������� � ���:<BR>";
-    echo " <form action='#' method='POST'>";
-    echo "<input type='textarea' class='inps' name='sysMes' size='275'>";
-    echo "<input type='submit' name='systemM' class='btn' value='���������'>";
-    echo "</form>";
+    .mt {
+        background-color: #b1a993;
+        padding-left: 10px;
+        padding-right: 10px;
+        padding-top: 5px;
+        padding-bottom: 5px;
+    }
+
+    .md {
+        padding: 10px;
+    }
+</style>
+<h4>������ ���������</h4>
+<div style="float: right">
+    ������, <?= $u->info['login'] ?>.
+    <INPUT TYPE="button" onclick="location.href='main.php?bukmeker=1';" value="��������" class="btn"
+           title="��������">
+    <INPUT TYPE="button" onclick="location.href='main.php';" class="btn" value="���������" title="���������">
+</div>
 
 
-}  
-?>
\ No newline at end of file
+<?php
+if (isset($ba['id'])): ?>
+    <table width=320>
+        <tr>
+            <td>
+                <h4>��������</h4>
+                <b><?= $ba['cr'] ?></b> ��.
+                <hr/>
+                <form method="post" action="main.php?bukmeker=1">
+                    <?
+                    if (isset($_POST['buy_cr'])) {
+                        $uba = mysql_fetch_array(
+                            mysql_query(
+                                'SELECT * FROM `users` WHERE `login` = "' . mysql_real_escape_string(
+                                    $_POST['buy_cr']
+                                ) . '" LIMIT 1'
+                            )
+                        );
+                        if (isset($uba['login'])) {
+                            echo '��������� �� ���������: ' . $u->microLogin($uba['id'], 1) . '<br>';
+                        } else {
+                            echo '<font color=red>���������� ���� ������������, ���� �� ������.</font><hr>';
+                            unset($_POST['buy_cr']);
+                        }
+                        echo '<hr>';
+                        if (isset($uba['login'])) {
+                            $_POST['buk_cr'] = round($_POST['buk_cr'], 2);
+                            if (isset($_POST['buk_cr']) && $_POST['buk_cr'] < 1) {
+                                echo '<font color=red>����������� ����� ��������: 1 ��.</font><hr>';
+                                unset($_POST['buk_cr']);
+                            } elseif ($_POST['buk_cr'] > $ba['cr']) {
+                                echo '<font color=red>������������ ������� �� �����</font><hr>';
+                                unset($_POST['buk_cr']);
+                            }
+                            if (isset($_POST['buygoodluck'])) {
+                                echo '<script>alert("��������� ' . $_POST['buk_cr'] . ' ��!");location.href="main.php?bukmeker=1";</script>';
+                                $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 '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <input name="buk_cr" style="width:50px;" value="0.00" /> <input class="btn btn-success" value="�����" type="submit" /><br>';
+                                } else {
+                                    echo ' <b>' . round(
+                                            (int)$_POST['buk_cr'], 2
+                                        ) . '</b> ��.<input name="buk_cr" type="hidden" value="' . $_POST['buk_cr'] . '" />';
+                                    echo ' &nbsp; <input type="submit" name="buygoodluck" class="btn btn-danger" value="��������� ��">';
+                                }
+                            }
+                        }
+                    }
+
+                    if (isset($_POST['buy_cr'])) { ?><input name="buy_cr" type="hidden"
+                                                            value="<?= $_POST['buy_cr'] ?>" /> <?
+                    } else { ?>��������� �� ���������: <input name="buy_cr" style="width:50px;"
+                                                              value="<?= $_POST['buy_cr'] ?>"/> <input
+                            class="btn btn-success" value="�����" type="submit"/><?
+                    } ?>
+                </form>
+            </td>
+        </tr>
+    </table>
+<?php
+endif;
+
+if (!$u->info['bukmeker'] && !$u->info['admin']) {
+    return;
+}
+if (!empty($_POST['systemM'])) {
+    $r = "<strong>��������: <span style='color: darkgreen;'>{$_POST['sysMes']}</span> [������������ �������]</strong>";
+    mysql_query("INSERT INTO `chat` (`new`,`text`,`time`,`type`) VALUES ('1','" . $r . "', unix_timestamp(),'6')");
+    echo "<br><b style='color: red;'>��������� ��������� ����������.</b>";
+}
+?>
+<div style="width: 500px;">
+    <form method='POST'>
+        <label>�������� � ���: <br>
+            <textarea name="sysMes" rows="4" cols="80"></textarea>
+        </label>
+        <br>
+        <input type='submit' name='systemM' class='btn' value='���������'>
+    </form>
+</div>
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 @@
-<?
-if(!defined('GAME')) { die(); }
-
-$res = mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id` = '".mysql_real_escape_string($u->info['clan'])."' LIMIT 1"));
-$cpr = explode('|', $u->info['clan_prava']);
-
-if(!isset($res['id'])) {
-  die('���� ��� �������������.');
+<?php
+if (!defined('GAME')) {
+    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;
+$res = mysql_fetch_array(
+    mysql_query("SELECT * FROM `clan` WHERE `id` = '" . mysql_real_escape_string($u->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],
+]
 
 ?>
 <script type="text/javascript" src="js/jquery.js"></script>
 <style>
 
-body { background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_44.jpg);}
-.a {text-decoration:none; color:#333333; font-size:10px;}
-.a:hover{text-decoration:none; color:#333333; font-size:10px;}
- 
-.clanimg { padding-right:5px; margin-bottom:-2px;}
-.infimg {margin-left:2px; margin-bottom:-1px;}
+    body {
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_44.jpg);
+    }
 
-#clanpanel {width:100%; height:32px; color:#333333; font-weight:bold; font-size:11px; min-width:1250px;}
-#clanpanel .head{ float:left; width:75px; height:18px; font-size:11px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_03.jpg); background-repeat:no-repeat;}
-#clanpanel .panel{ float:left; width:100%; height:32px; font-size:11px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_08.jpg); background-repeat:repeat-x;}
-#clanpanel .foot{ float:left; width:75px; height:12px; font-size:11px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_27.jpg); background-repeat:no-repeat;}
+    .a {
+        text-decoration: none;
+        color: #333333;
+        font-size: 10px;
+    }
 
-.tabs ul {list-style:none; float:left; margin:0px; padding:0px;}
+    .a:hover {
+        text-decoration: none;
+        color: #333333;
+        font-size: 10px;
+    }
 
-.name{ float:left; color:#990000; height:32px; padding-left:85px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_s3r3_07.jpg); background-repeat:no-repeat;  line-height:32px; padding-right:15px;}
- .clanicon{ padding-right:10px; margin-bottom:-2px;}
+    .clanimg {
+        padding-right: 5px;
+        margin-bottom: -2px;
+    }
 
-.tabs .events{ float:left; height:32px; padding-left:60px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_09.jpg); background-repeat:no-repeat;  line-height:32px; padding-right:20px;}
-.tabs .control{ float:left; height:32px; padding-left:60px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_11.jpg); background-repeat:no-repeat;  line-height:32px; padding-right:20px;}
+    .infimg {
+        margin-left: 2px;
+        margin-bottom: -1px;
+    }
 
-.tabs .deposit{ float:left; height:32px; padding-left:60px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_13.jpg); background-repeat:no-repeat;  line-height:32px; padding-right:20px;}
+    #clanpanel {
+        width: 100%;
+        height: 32px;
+        color: #333333;
+        font-weight: bold;
+        font-size: 11px;
+        min-width: 1250px;
+    }
 
-.tabs .clanart{ float:left; height:32px; padding-left:60px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_17.jpg); background-repeat:no-repeat;  line-height:32px; padding-right:20px;}
+    #clanpanel .head {
+        float: left;
+        width: 75px;
+        height: 18px;
+        font-size: 11px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_03.jpg);
+        background-repeat: no-repeat;
+    }
 
-.tabs .rules{ float:left; height:32px; padding-left:60px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_19.jpg); background-repeat:no-repeat;  line-height:32px; padding-right:20px;}
+    #clanpanel .panel {
+        float: left;
+        width: 100%;
+        height: 32px;
+        font-size: 11px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_08.jpg);
+        background-repeat: repeat-x;
+    }
 
-.tabs .info{ float:left; height:32px; padding-left:60px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_21.jpg); background-repeat:no-repeat;  line-height:32px; padding-right:20px;}
+    #clanpanel .foot {
+        float: left;
+        width: 75px;
+        height: 12px;
+        font-size: 11px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_27.jpg);
+        background-repeat: no-repeat;
+    }
 
-.tabs .members{ float:left; height:32px; padding-left:60px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_23.jpg); background-repeat:no-repeat;  line-height:32px; padding-right:20px;}
+    .tabs ul {
+        list-style: none;
+        float: left;
+        margin: 0px;
+        padding: 0px;
+    }
 
-.tabs .last{ float:right; width:15px; height:32px;background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_25.jpg); background-repeat:no-repeat;}
+    .name {
+        float: left;
+        color: #990000;
+        height: 32px;
+        padding-left: 85px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_s3r3_07.jpg);
+        background-repeat: no-repeat;
+        line-height: 32px;
+        padding-right: 15px;
+    }
+
+    .clanicon {
+        padding-right: 10px;
+        margin-bottom: -2px;
+    }
+
+    .tabs .events {
+        float: left;
+        height: 32px;
+        padding-left: 60px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_09.jpg);
+        background-repeat: no-repeat;
+        line-height: 32px;
+        padding-right: 20px;
+    }
+
+    .tabs .control {
+        float: left;
+        height: 32px;
+        padding-left: 60px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_11.jpg);
+        background-repeat: no-repeat;
+        line-height: 32px;
+        padding-right: 20px;
+    }
+
+    .tabs .deposit {
+        float: left;
+        height: 32px;
+        padding-left: 60px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_13.jpg);
+        background-repeat: no-repeat;
+        line-height: 32px;
+        padding-right: 20px;
+    }
+
+    .tabs .clanart {
+        float: left;
+        height: 32px;
+        padding-left: 60px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_17.jpg);
+        background-repeat: no-repeat;
+        line-height: 32px;
+        padding-right: 20px;
+    }
+
+    .tabs .rules {
+        float: left;
+        height: 32px;
+        padding-left: 60px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_19.jpg);
+        background-repeat: no-repeat;
+        line-height: 32px;
+        padding-right: 20px;
+    }
+
+    .tabs .info {
+        float: left;
+        height: 32px;
+        padding-left: 60px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_21.jpg);
+        background-repeat: no-repeat;
+        line-height: 32px;
+        padding-right: 20px;
+    }
+
+    .tabs .members {
+        float: left;
+        height: 32px;
+        padding-left: 60px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_23.jpg);
+        background-repeat: no-repeat;
+        line-height: 32px;
+        padding-right: 20px;
+    }
+
+    .tabs .last {
+        float: right;
+        width: 15px;
+        height: 32px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_25.jpg);
+        background-repeat: no-repeat;
+    }
 
 
-#clancontent {width:100%; float:left; padding-top:25px; }
-.eventsblock {}
+    #clancontent {
+        width: 100%;
+        float: left;
+        padding-top: 25px;
+    }
+
+    .eventsblock {
+    }
 
 
+    .legtitle {
+        font-weight: bold;
+        padding: 0px 5px 0px 5px;
+        color: #990000;
+    }
 
-.legtitle   {font-weight:bold; padding:0px 5px 0px 5px; color:#990000;}
-.legcontent {padding:0px 5px 0px 5px;}
+    .legcontent {
+        padding: 0px 5px 0px 5px;
+    }
 
-.section {
-	width: 100%;
+    .section {
+        width: 100%;
 
-	margin: 0 0 30px;
-}
-ul.tabs {
-	height: 28px;
-	line-height: 25px;
-	list-style: none;
-	margin:0px; padding:0px;
-	font-size:10px;
-	color:#666;
-}
-.tabs li {
-	float: left;
-	position: relative;
-	cursor:pointer;
-	font-size:10px;
-}
+        margin: 0 0 30px;
+    }
 
-.tabs li a{
-	color:#666;
-	font-size:10px;
-}
-.tabs li:hover,
-.vertical .tabs li:hover {
+    ul.tabs {
+        height: 28px;
+        line-height: 25px;
+        list-style: none;
+        margin: 0px;
+        padding: 0px;
+        font-size: 10px;
+        color: #666;
+    }
 
-}
-li.current a{
-	color:#333333;
-	font-size:10px;
+    .tabs li {
+        float: left;
+        position: relative;
+        cursor: pointer;
+        font-size: 10px;
+    }
 
-}
+    .tabs li a {
+        color: #666;
+        font-size: 10px;
+    }
+
+    .tabs li:hover,
+    .vertical .tabs li:hover {
+
+    }
+
+    li.current a {
+        color: #333333;
+        font-size: 10px;
+
+    }
 
 
-.box {
-width:100%;
-float:left;
-display: none;
-padding-top:25px;
+    .box {
+        width: 100%;
+        float: left;
+        display: none;
+        padding-top: 25px;
 
 
-}
-.box.visible {
-	display: block;
-}
-.modpow {
+    }
 
-background-color:#ddd5bf;
+    .box.visible {
+        display: block;
+    }
 
-}
+    .modpow {
 
-.mt {
+        background-color: #ddd5bf;
 
-background-color:#b1a993;
+    }
 
-padding-left:10px;
+    .mt {
 
-padding-right:10px;
+        background-color: #b1a993;
 
-padding-top:5px;
+        padding-left: 10px;
 
-padding-bottom:5px;
+        padding-right: 10px;
 
-}
+        padding-top: 5px;
 
-.md {
+        padding-bottom: 5px;
 
-padding:10px;
+    }
 
-}
+    .md {
+
+        padding: 10px;
+
+    }
 </style>
 
 <script>
 
-function openMod(title, dat) {
-  var d = document.getElementById('useMagic');
-  if(d != undefined) {
-    document.getElementById('modtitle').innerHTML = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top">'+title+'</td><td width="30" valign="top"><div align="right"><a title="�������" onClick="closeMod(); return false;" href="#">x</a></div></td></tr></table>';
-    document.getElementById('moddata').innerHTML = dat;
-    d.style.display = '';
-  }
-}
+    function openMod(title, dat) {
+        var d = document.getElementById('useMagic');
+        if (d != undefined) {
+            document.getElementById('modtitle').innerHTML = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top">' + title + '</td><td width="30" valign="top"><div align="right"><a title="�������" onClick="closeMod(); return false;" href="#">x</a></div></td></tr></table>';
+            document.getElementById('moddata').innerHTML = dat;
+            d.style.display = '';
+        }
+    }
 
 
+    function closeMod() {
+        var d = document.getElementById('useMagic');
+        if (d != undefined) {
+            document.getElementById('modtitle').innerHTML = '';
+            document.getElementById('moddata').innerHTML = '';
+            d.style.display = 'none';
+        }
+    }
 
-function closeMod() {
-  var d = document.getElementById('useMagic');
-  if(d != undefined) {
-    document.getElementById('modtitle').innerHTML = '';
-    document.getElementById('moddata').innerHTML = '';
-    d.style.display = 'none';
-  }
-}
+    function addNewEvent() {
+        openMod('�������� �������',
+            '<form method="post" action="main.php?clan&events&add=<?=$code?>">���������: <input name="titleadd" value="" style="width:335px;" type="text"><br><textarea name="textadd" style="width:412px;" rows="5"></textarea><br><div align="right"><input type="submit" value="�������� �������"></div></form>');
+    }
 
-function addNewEvent() {
-  openMod('�������� �������',
-	'<form method="post" action="main.php?clan&events&add=<?=$code?>">���������: <input name="titleadd" value="" style="width:335px;" type="text"><br><textarea name="textadd" style="width:412px;" rows="5"></textarea><br><div align="right"><input type="submit" value="�������� �������"></div></form>');
-}
-
-function addNewTitul() {
-  openMod('�������� �����',
-	'<form method="post" action="main.php?clan&titul&add=<?=$code?>">�������� ������: <input name="tituladd" value="" style="width:235px;" type="text"><br><small style="float:left">(�� ����� 30-�� ��������)</small><input style="float:right" type="submit" value="�������� �����"></div></form>');
-}
+    function addNewTitul() {
+        openMod('�������� �����',
+            '<form method="post" action="main.php?clan&titul&add=<?=$code?>">�������� ������: <input name="tituladd" value="" style="width:235px;" type="text"><br><small style="float:left">(�� ����� 30-�� ��������)</small><input style="float:right" type="submit" value="�������� �����"></div></form>');
+    }
 
 </script>
 
-<div id="useMagic" style="display:none; position:absolute; border:solid 1px #776f59; left: 50px; top: 186px;" class="modpow">
- <div class="mt" id="modtitle"></div>
- <div class="md" id="moddata"></div>
+<div id="useMagic" style="display:none; position:absolute; border:solid 1px #776f59; left: 50px; top: 186px;"
+     class="modpow">
+    <div class="mt" id="modtitle"></div>
+    <div class="md" id="moddata"></div>
 </div>
 <input style="float:right;margin:1px" type="button" value="���������" onClick="document.location='main.php'">
-<input style="float:right;margin:1px" type="button" value="��������" onClick="document.location='<?=$_SERVER['REQUEST_URI']?>'">
-<?
-if($u->info['clan_prava'] != 'glava') {
-  if(isset($_GET['clan_exit']) && $u->newAct($_GET['sd4']) == true) {
-    if($u->info['money'] >= 50) {
-	  $txt = '����� <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$u->info['login'].'</a>['.$u->info['level'].']<a target="_blank" title="���. � '.$u->info['login'].'" href="info/'.$u->info['id'].'"><img src="https://img.new-combats.com/i/inf_'.$u->info['cityreg'].'.gif"></a> ������� ����. (50 ��.)';
-	  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", "�������������", "�������� ���������", "'.mysql_real_escape_string($txt).'")');
-	  if ($usr['level'] < 10) 
-		{
-			mysql_query('UPDATE `users` SET `palpro` = 0, `clan` = 0, `clan_zv` = 0, `align` = 0, `clan_prava` = "0|0|0|0", `money` = `money` - 50 , `clan_delay` = "0" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
-		}
-	  else
-		{
-			mysql_query('UPDATE `users` SET `palpro` = 0, `clan` = 0, `clan_zv` = 0, `align` = 0, `clan_prava` = "0|0|0|0", `money` = `money` - 50 , `clan_delay` = "'.time().'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
-		}
-	  $ar = $u->rem_itm_cl($u->info, $res['id'], 7);
-    } else {
-	  echo '<script>setTimeout("alert(\'��� ������ �� ����� ��������� ������� 50 ��.\');",500)</script>';
-	}
-  }
-?>
-<input style="float:right;margin:1px;margin-right:50px;color:red;" type="button" value="�������� ���� (50 ��.)" onClick="document.location='main.php?clan&clan_exit=1&sd4=<?=$u->info['nextAct']?>'">
-<? } ?>
+<input style="float:right;margin:1px" type="button" value="��������"
+       onClick="document.location='<?= $_SERVER['REQUEST_URI'] ?>'">
+<?php
+if ($u->info['clan_prava'] != 'glava') {
+    if (isset($_GET['clan_exit']) && $u->newAct($_GET['sd4']) == true) {
+        if ($u->info['money'] >= 50) {
+            $txt = '����� <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $u->info['login'] . '</a>[' . $u->info['level'] . ']<a target="_blank" title="���. � ' . $u->info['login'] . '" href="info/' . $u->info['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $u->info['cityreg'] . '.gif"></a> ������� ����. (50 ��.)';
+            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", "�������������", "�������� ���������", "' . mysql_real_escape_string(
+                    $txt
+                ) . '")'
+            );
+            if ($usr['level'] < 10) {
+                mysql_query(
+                    'UPDATE `users` SET `palpro` = 0, `clan` = 0, `clan_zv` = 0, `align` = 0, `clan_prava` = "0|0|0|0", `money` = `money` - 50 , `clan_delay` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+                );
+            } else {
+                mysql_query(
+                    'UPDATE `users` SET `palpro` = 0, `clan` = 0, `clan_zv` = 0, `align` = 0, `clan_prava` = "0|0|0|0", `money` = `money` - 50 , `clan_delay` = "' . time(
+                    ) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+                );
+            }
+            $ar = $u->rem_itm_cl($u->info, $res['id'], 7);
+        } else {
+            echo '<script>setTimeout("alert(\'��� ������ �� ����� ��������� ������� 50 ��.\');",500)</script>';
+        }
+    }
+    ?>
+    <input style="float:right;margin:1px;margin-right:50px;color:red;" type="button" value="�������� ���� (50 ��.)"
+           onClick="document.location='main.php?clan&clan_exit=1&sd4=<?= $u->info['nextAct'] ?>'">
+<?php } ?>
 <br>
 <div class="section">
-<div id="clanpanel">
-  <div class="head" style="position:relative"><img src="https://img.new-combats.com/i/align/align<?=$res['align'];?>.gif" style="position:absolute;top:23px;left:40px;" /></div>
-    <div class="panel" style="white-space:nowrap;min-width:1000px;">
-      <div class="name" onclick='location.href="main.php?clan&events"' title="������� �����" style="cursor:pointer"><img class="clanicon" src="https://img.new-combats.com/i/clan/<?=$res['name_mini'];?>.gif"><?=$res['name'];?></div>
-      <ul class="tabs">
-      <!--<li class="events"><a href="main.php?clan&events">�������</a></li>-->
-      <? if($tt[11][0] == 1) { ?><li class="control"><a href="main.php?clan&control">����������</a></li><? } ?>
-      <? if($tt[3][0] == 1) { ?><li class="deposit"><a href="main.php?clan&deposit">���������</a></li><? } ?>
-      <? if($tt[11][0] > 0) { ?><li class="clanart"><a href="main.php?clan&titul">������</a></li><? } ?>
-      <li class="rules"><a href="main.php?clan&rules">�����</a></li>
-      <li class="info"><a href="main.php?clan&info">� �����</a></li>
-      <li class="members"><a href="main.php?clan&members">����������</a></li>
-      <? if($tt[12][0] == 1) { ?>
-      <li class="rules"><a href="main.php?clan&diplom">����������</a></li>
-      <? } ?>
-      <li class="last"></li>
-      </ul>
-    </div>
- <div class="foot"></div>
-</div><? if(isset($_GET['events'])) { ?>
-   <div class="box visible">
-   <style>
-   .leftimg {
-    float:left; /* ������������ �� ������ ���� */
-    margin: 17px 17px 17px 7px; /* ������� ������ �������� */
-   }
-   .rightimg  {
-    float: right; /* ������������ �� ������� ����  */ 
-    margin: 17px 7px 17px 17px; /* ������� ������ �������� */
-   }
-   .dnbx {
-	   width:25px;
-	   height:22px;
-	   background-color:#ecece4;
-	   vertical-align:middle;
-	   text-align:center;  
-	   display:inline-block;
-	   margin:1px;
-	   padding-top:3px;
-	   cursor:default;
-   }
-   .dnbx1 {
-	   width:25px;
-	   height:22px;
-	   background-color:#ecece4;
-	   vertical-align:middle;
-	   text-align:center;  
-	   display:inline-block;
-	   margin:1px;
-	   padding-top:3px;
-	   cursor:default;
-   }
-   .dnbx5 {
-	   height:22px;
-	   background-color:#ecece4;
-	   vertical-align:middle;
-	   text-align:center;  
-	   display:inline-block;
-	   margin:1px;
-	   padding-top:3px;
-	   cursor:default;
-   }
-   .dnbx:hover {
-	   width:25px;
-	   height:22px;
-	   background-color:#dbdad5;
-	   vertical-align:middle;
-	   text-align:center;  
-	   display:inline-block;
-	   margin:1px;
-	   padding-top:3px;
-	   cursor:default;
-   }
-   .dnbx2 {
-	   width:25px;
-	   height:22px;
-	   background-color:#b5b4b1;
-	   color:#ecebe6;
-	   vertical-align:middle;
-	   text-align:center;  
-	   display:inline-block;
-	   margin:1px;
-	   padding-top:3px;
-	   cursor:default;
-   }
-   </style>
-        <? if($tt[7][0] > 0 && $u->info['room'] != 263) { ?>
-    <fieldset>
-     <!-- <legend><span class="legtitle">��������</span><small>(����� ������� ������� ������ ������� �� ��� �����������)</small></legend>-->
-<?
-/*$p['m1'] = 1;
-$srok = array(15=>'15 �����',30=>'30 �����',60=>'���� ���',180=>'��� ����',360=>'����� �����',720=>'���������� �����',1440=>'���� �����',4320=>'���� �����');
-		
-if(isset($_GET['usemod']))
-{
-	if(isset($_POST['usem1']))
-	{
-		include('moder/usem1.php');					
-	}elseif(isset($_POST['teleport']))
-	{
-		//include('moder/teleport.php');
-	}
-}*/
-?>
-<!--<table>-->
-<!--
-<a href="#" onClick="openMod('<b>�������� ��������</b>','<form action=\'main.php?<? echo 'clan=1&control&usemod='.$code; ?>\' method=\'post\'>����� ���������: <input type=\'text\' style=\'width:144px;\' id=\'logingo\' name=\'logingo\'><br>����� ��������: &nbsp; <select style=\'margin-left:2px;\' name=\'time\'><option value=\'5\'>5 �����</option><option value=\'30\'>30 �����</option><option value=\'60\'>1 ���</option><option value=\'4320\'>3 �����</option></select> <input type=\'submit\' name=\'usem1\' value=\'���-��\'></form>');"><img src="https://img.new-combats.com/i/items/silence30.gif" title="�������� ��������" /></a>
-&nbsp;
-<a onClick="openMod('<b>������������</b>','<form action=\'main.php?<? echo 'clan=1&control&usemod='.$code; ?>\' method=\'post\'>����� ���������: <input type=\'text\' style=\'width:144px;\' id=\'logingo\' name=\'logingo\' value=\'<? echo $u->info['login']; ?>\'><br>�����: &nbsp; <select style=\'margin-left:2px;\' name=\'city\'><option value=\'capitalcity\'>capitalcity</option><option value=\'angelscity\'>angelscity</option><option value=\'demonscity\'>demonscity</option><option value=\'devilscity\'>devilscity</option><option value=\'suncity\'>suncity</option><option value=\'emeraldscity\'>emeraldscity</option><option value=\'sandcity\'>sandcity</option><option value=\'mooncity\'>mooncity</option><option value=\'eastcity\'>eastcity</option><option value=\'abandonedplain\'>abandonedplain</option><option value=\'dreamscity\'>dreamscity</option><option value=\'lowcity\'>devilscity</option><option value=\'oldcity\'>devilscity</option><option value=\'newcapitalcity\'>newcapital</option></select> <input type=\'submit\' name=\'teleport\' value=\'���-��\'></form>');" href="#"><img src="https://img.new-combats.com/i/items/teleport.gif" title="������������" /></a>
--->
-<?
-/*
-if ($r1['pos'] == 1 || $u->info['admin'] == 1)
-	{
-	 $item_clan = array
-		(
-		"" => array
-		(
-			array(865,3,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1), //��������� 865
-			array(2391,3,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1), //�������� ��������� 2391
-			array(4943,3,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1), //����� �� ��� 4943
-			array(2545,3,0,0,0,'useOnLogin=1|musor=1|noremont=1|magic_hpNow=600|srok=86400|nosale=1|sudba=1',1), //�������������� �� 600 2545
-			array(3043,5,0,0,0,'useOnLogin=1|musor=1|noremont=1|magic_hpNow=120|srok=86400|nosale=1|sudba=1',1), //�������������� �� 120 3043
-			array(4781,3,0,0,0,'useOnLogin=1|musor=1|noremont=1|magic_mpNow=750|srok=86400|nosale=1|sudba=1',1), //�������������� �� 750 4781
-			array(4779,5,0,0,0,'useOnLogin=1|musor=1|noremont=1|magic_mpNow=250|srok=86400|nosale=1|sudba=1',1), //�������������� �� 250 4779
-			array(3102,3,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1), //��5 3102
-			array(1001,3,0,0,0,'onlyOne=1|musor=1|noremont=1|tr_lvl=8|oneType=71|sudba='.$u->info['login'].'|srok=86400|nosale=1|lvl=0|tr_s1=0|tr_s2=0|tr_s3=0|tr_s4=0',1), // ������ �� ������ 1001
-			array(4941,3,0,0,0,'onlyOne=1|musor=1|noremont=1|tr_lvl=8|oneType=71|sudba='.$u->info['login'].'|srok=86400|nosale=1|lvl=0|tr_s1=0|tr_s2=0|tr_s3=0|tr_s4=0',1), // ������ ����� 4941
-			array(994,3,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1),  // ���������� 994
-			array(4942,3,0,0,0,'|useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1),  // ��� ������ 4942
-			array(4412,5,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1),
-			array(4413,5,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1),
-			array(4414,5,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1)
-		),
-		);
-	}
-	elseif ($r1['pos'] == 2)
-	{
-	 $item_clan = array
-		(
-		"" => array
-		(
-			array(865,2,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1), //��������� 865
-			array(2391,2,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1), //�������� ��������� 2391
-			array(4943,2,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1), //����� �� ��� 4943
-			array(2545,2,0,0,0,'useOnLogin=1|musor=1|noremont=1|magic_hpNow=600|srok=86400|nosale=1|sudba=1',1), //�������������� �� 600 2545
-			array(3043,3,0,0,0,'useOnLogin=1|musor=1|noremont=1|magic_hpNow=120|srok=86400|nosale=1|sudba=1',1), //�������������� �� 120 3043
-			array(4781,2,0,0,0,'useOnLogin=1|musor=1|noremont=1|magic_mpNow=750|srok=86400|nosale=1|sudba=1',1), //�������������� �� 750 4781
-			array(4779,3,0,0,0,'useOnLogin=1|musor=1|noremont=1|magic_mpNow=250|srok=86400|nosale=1|sudba=1',1), //�������������� �� 250 4779
-			array(3102,2,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1), //��5 3102
-			array(1001,2,0,0,0,'onlyOne=1|musor=1|noremont=1|tr_lvl=8|oneType=71|sudba='.$u->info['login'].'|srok=86400|nosale=1|lvl=0|tr_s1=0|tr_s2=0|tr_s3=0|tr_s4=0',1), // ������ �� ������ 1001
-			array(4941,2,0,0,0,'onlyOne=1|musor=1|noremont=1|tr_lvl=8|oneType=71|sudba='.$u->info['login'].'|srok=86400|nosale=1|lvl=0|tr_s1=0|tr_s2=0|tr_s3=0|tr_s4=0',1), // ������ ����� 4941
-			array(994,2,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1),  // ���������� 994
-			array(4942,2,0,0,0,'|useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1),  // ��� ������ 4942
-			array(4412,3,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1),
-			array(4413,3,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1),
-			array(4414,3,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1)
-			),
-		);
-	}
-	elseif ($r1['pos'] == 3)
-	{
-	 $item_clan = array
-		(
-		"" => array
-		(
-			array(865,1,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1), //��������� 865
-			array(2391,1,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1), //�������� ��������� 2391
-			array(4943,1,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1), //����� �� ��� 4943
-			array(2545,1,0,0,0,'useOnLogin=1|musor=1|noremont=1|magic_hpNow=600|srok=86400|nosale=1|sudba=1',1), //�������������� �� 600 2545
-			array(3043,2,0,0,0,'useOnLogin=1|musor=1|noremont=1|magic_hpNow=120|srok=86400|nosale=1|sudba=1',1), //�������������� �� 120 3043
-			array(4781,1,0,0,0,'useOnLogin=1|musor=1|noremont=1|magic_mpNow=750|srok=86400|nosale=1|sudba=1',1), //�������������� �� 750 4781
-			array(4779,2,0,0,0,'useOnLogin=1|musor=1|noremont=1|magic_mpNow=250|srok=86400|nosale=1|sudba=1',1), //�������������� �� 250 4779
-			array(3102,1,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1), //��5 3102
-			array(1001,1,0,0,0,'onlyOne=1|musor=1|noremont=1|tr_lvl=8|oneType=71|sudba='.$u->info['login'].'|srok=86400|nosale=1|lvl=0|tr_s1=0|tr_s2=0|tr_s3=0|tr_s4=0',1), // ������ �� ������ 1001
-			array(4941,1,0,0,0,'onlyOne=1|musor=1|noremont=1|tr_lvl=8|oneType=71|sudba='.$u->info['login'].'|srok=86400|nosale=1|lvl=0|tr_s1=0|tr_s2=0|tr_s3=0|tr_s4=0',1), // ������ ����� 4941
-			array(994,1,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1),  // ���������� 994
-			array(4942,1,0,0,0,'|useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1),  // ��� ������ 4942
-			array(4412,2,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1),
-			array(4413,2,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1),
-			array(4414,2,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1)
-		),
-		);
-	}
-	else
-	{
-		$item_clan = array
-		(
-		"" => array
-		(
+    <div id="clanpanel">
+        <div class="head" style="position:relative"><img
+                    src="https://img.new-combats.com/i/align/align<?= $res['align']; ?>.gif"
+                    style="position:absolute;top:23px;left:40px;"/></div>
+        <div class="panel" style="white-space:nowrap;min-width:1000px;">
+            <div class="name" onclick='location.href="main.php?clan&events"' title="������� �����"
+                 style="cursor:pointer"><img class="clanicon"
+                                             src="https://img.new-combats.com/i/clan/<?= $res['name_mini']; ?>.gif"><?= $res['name']; ?>
+            </div>
+            <ul class="tabs">
+                <!--<li class="events"><a href="main.php?clan&events">�������</a></li>-->
+                <?php if ($tt[11][0] == 1) { ?>
+                    <li class="control"><a href="main.php?clan&control">����������</a></li><?php } ?>
+                <?php if ($tt[3][0] == 1) { ?>
+                    <li class="deposit"><a href="main.php?clan&deposit">���������</a></li><?php } ?>
+                <?php if ($tt[11][0] > 0) { ?>
+                    <li class="clanart"><a href="main.php?clan&titul">������</a></li><?php } ?>
+                <li class="rules"><a href="main.php?clan&rules">�����</a></li>
+                <li class="info"><a href="main.php?clan&info">� �����</a></li>
+                <li class="members"><a href="main.php?clan&members">����������</a></li>
+                <?php if ($tt[12][0] == 1) { ?>
+                    <li class="rules"><a href="main.php?clan&diplom">����������</a></li>
+                <?php } ?>
+                <li class="last"></li>
+            </ul>
+        </div>
+        <div class="foot"></div>
+    </div><?php if (isset($_GET['events'])) { ?>
+        <div class="box visible">
+            <style>
+                .leftimg {
+                    float: left; /* ������������ �� ������ ���� */
+                    margin: 17px 17px 17px 7px; /* ������� ������ �������� */
+                }
 
-			//array(4941,3,0,0,0,'onlyOne=1|musor=1|noremont=1|tr_lvl=8|oneType=71|sudba='.$u->info['login'].'|srok=86400|nosale=1|lvl=0|tr_s1=0|tr_s2=0|tr_s3=0|tr_s4=0',1), // ������ ����� 4941
-			//array(1001,1,0,0,0,'onlyOne=1|musor=1|noremont=1|tr_lvl=8|oneType=71|sudba='.$u->info['login'].'|srok=86400|nosale=1|lvl=0|tr_s1=0|tr_s2=0|tr_s3=0|tr_s4=0',1), // ������ �� ������ 1001
-			array(3043,1,0,0,0,'useOnLogin=1|musor=1|noremont=1|magic_hpNow=120|srok=86400|nosale=1|sudba=1',1), //�������������� �� 120 3043
-			array(4779,1,0,0,0,'useOnLogin=1|musor=1|noremont=1|magic_mpNow=250|srok=86400|nosale=1|sudba=1',1), //�������������� �� 250 4779
-			array(4412,1,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1),
-			array(4413,1,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1),
-			array(4414,1,0,0,0,'useOnLogin=1|musor=1|noremont=1|srok=86400|nosale=1|sudba=1',1)
-			//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(
-);
-?><p><?	
-$i = 0; $seet = '';
-                $vnr = array(0 => '�� �������',1 => ' �����');
-                while($i < count($item_clan[$clan_panel])) 
-				{
-                    if($item_clan[$clan_panel][$i][1]>0) 
-					{
-                        $itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$item_clan[$clan_panel][$i][0].'" LIMIT 1'));
-                        if(isset($itm['id'])) 
-						{
-                            $vix = 0;
-                            if($item_clan[$clan_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];
+                .rightimg {
+                    float: right; /* ������������ �� ������� ����  */
+                    margin: 17px 7px 17px 17px; /* ������� ������ �������� */
+                }
+
+                .dnbx {
+                    width: 25px;
+                    height: 22px;
+                    background-color: #ecece4;
+                    vertical-align: middle;
+                    text-align: center;
+                    display: inline-block;
+                    margin: 1px;
+                    padding-top: 3px;
+                    cursor: default;
+                }
+
+                .dnbx1 {
+                    width: 25px;
+                    height: 22px;
+                    background-color: #ecece4;
+                    vertical-align: middle;
+                    text-align: center;
+                    display: inline-block;
+                    margin: 1px;
+                    padding-top: 3px;
+                    cursor: default;
+                }
+
+                .dnbx5 {
+                    height: 22px;
+                    background-color: #ecece4;
+                    vertical-align: middle;
+                    text-align: center;
+                    display: inline-block;
+                    margin: 1px;
+                    padding-top: 3px;
+                    cursor: default;
+                }
+
+                .dnbx:hover {
+                    width: 25px;
+                    height: 22px;
+                    background-color: #dbdad5;
+                    vertical-align: middle;
+                    text-align: center;
+                    display: inline-block;
+                    margin: 1px;
+                    padding-top: 3px;
+                    cursor: default;
+                }
+
+                .dnbx2 {
+                    width: 25px;
+                    height: 22px;
+                    background-color: #b5b4b1;
+                    color: #ecebe6;
+                    vertical-align: middle;
+                    text-align: center;
+                    display: inline-block;
+                    margin: 1px;
+                    padding-top: 3px;
+                    cursor: default;
+                }
+            </style>
+            <?php if ($tt[7][0] > 0 && $u->info['room'] != 263) { ?>
+            <fieldset>
+                <?php
+                } ?>
+
+                <fieldset style="border:1px dashed #eeeeee">
+                    <legend><span class="legtitle">�������</span></legend>
+                    <?php
+
+                    $c_r = '';
+                    $c_c = '';
+                    $c_p = '';
+
+                    if (isset($_GET['add'], $_POST['textadd']) && $tt[2][0] == 1) {
+                        $lmsg = mysql_fetch_array(
+                            mysql_query(
+                                'SELECT `id` FROM `clan_news` WHERE `uid` = "' . $u->info['id'] . '" AND `time` > ' . (time(
+                                    ) - 10) . ' LIMIT 1'
+                            )
+                        );
+                        if (isset($lmsg['id'])) {
+                            $c_r .= '<font color="#FF0000"><b>������ ��������� ��������� ���� ������ ���� � 10 ������</b></font><br>';
+                        } else {
+                            $tadd = htmlspecialchars($_POST['textadd'], null, 'cp1251');
+                            $ttadd = htmlspecialchars($_POST['titleadd'], null, 'cp1251');
+                            if (str_replace(' ', '', str_replace('	', '', $tadd)) == '') {
+                                $c_r .= '<font color="#FF0000"><b>������ ���������� ������ �������</b></font><br>';
+                            } elseif (str_replace(' ', '', str_replace('	', '', $ttadd)) == '') {
+                                $c_r .= '<font color="#FF0000"><b>������ ���������� ������ ���������</b></font><br>';
+                            } else {
+                                $tadd = str_replace("\n", '<br>', $tadd);
+                                mysql_query(
+                                    'INSERT INTO `clan_news` (`clan`,`time`,`ddmmyyyy`,`uid`,`ip`,`login`,`title`,`text`) VALUES (
+				"' . $res['id'] . '","' . time() . '","' . date(
+                                        'd.m.Y'
+                                    ) . '","' . $u->info['id'] . '","' . $u->info['ip'] . '","' . $u->info['login'] . '","' . mysql_real_escape_string(
+                                        $ttadd
+                                    ) . '","' . mysql_real_escape_string($tadd) . '"
+				)'
+                                );
+                                $c_r .= '<font color="#FF0000"><b>������� ���� ������� ���������</b></font><br>';
                             }
-                            if($item_clan[$clan_panel][$i][1]-$vix > 0) {
-                                if(isset($_GET['take_item_clan_panel']) && $_GET['take_item_clan_panel'] == $itm['id']) {
-                                    $nitm = $u->addItem($itm['id'],$u->info['id'],$item_clan[$clan_panel][$i][5]);
-                                    if($item_clan[$clan_panel][6]>0) {
+                        }
+                    } elseif (isset($_GET['delete']) && $tt[2][0] == 1) {
+                        $upd = mysql_query(
+                            'UPDATE `clan_news` SET `delete` = "' . $u->info['id'] . '" WHERE `clan` = "' . $res['id'] . '" AND `delete` = "0" AND `uid` != "0" AND `id` = "' . mysql_real_escape_string(
+                                $_GET['delete']
+                            ) . '" LIMIT 1'
+                        );
+                        if ($upd) {
+                            $c_r .= '<font color="#FF0000"><b>������� ���� ������� �������</b></font><br>';
+                        } else {
+                            $c_r .= '<font color="#FF0000"><b>������� �� �������</b></font><br>';
+                        }
+                    }
+
+                    $dd = date('d');
+                    $mm = date('m');
+                    $yy = date('Y');
+
+                    if (isset($_GET['mm'])) {
+                        $mm = ceil((int)$_GET['mm']);
+                    }
+                    if (isset($_GET['dd'])) {
+                        $dd = ceil((int)$_GET['dd']);
+                    }
+                    if (isset($_GET['yy'])) {
+                        $yy = ceil((int)$_GET['yy']);
+                    }
+
+                    $mml = ceil($mm) - 1;
+                    $mmr = ceil($mm) + 1;
+                    $yyl = $yy;
+                    $yyr = $yy;
+                    if ($mml < 1) {
+                        $yyl--;
+                        $mml = 12;
+                    }
+                    if ($mmr > 12) {
+                        $yyr++;
+                        $mmr = 1;
+                    }
+                    $dds = ['', '��', '��', '��', '��', '��', '<font color="#981115">��</font>', '<font color="#981115">��</font>'];
+                    $mms = ['', '������', '�������', '����', '������', '���', '����', '����', '������', '��������', '�������', '������', '�������'];
+                    $num = 0;
+                    $lday = 0;
+                    for ($i = 0; $i < 7; $i++) {
+                        $dayofweek = date('w', mktime(0, 0, 0, $mm, $day_count, $yy));
+                        $dayofweek = $dayofweek - 1;
+                        if ($dayofweek == -1) {
+                            $dayofweek = 6;
+                        }
+
+                        if ($dayofweek == $i) {
+                            $week[$num][$i] = $day_count;
+                            $lday = $day_count;
+                            $day_count++;
+                        } else {
+                            $week[$num][$i] = "";
+                        }
+                    }
+
+                    function freenews($d, $m, $y)
+                    {
+                        global $res;
+                        $r = $d;
+                        if ($d < 9) {
+                            $d = '0' . $d;
+                        }
+                        if ($m < 9) {
+                            $m = '0' . ((int)$m);
+                        }
+                        $n = mysql_fetch_array(
+                            mysql_query(
+                                'SELECT `id` FROM `clan_news` WHERE `clan` = "' . $res['id'] . '" AND `delete` = "0" AND `ddmmyyyy` = "' . $d . '.' . $m . '.' . $y . '" LIMIT 1'
+                            )
+                        );
+                        if (isset($n['id'])) {
+                            $r = '<a style="text-decoration:underline;" href="?clan&events&ftr=1&mm=' . $m . '&yy=' . $y . '&dd=' . $d . '">' . $r . '</a>';
+                        }
+                        return $r;
+                    }
+
+                    $i = 1;
+                    $c_c .= '<div style="width:260px;border:1px solid #9d9d9d;padding:10px;background-color:#ecebe7">';
+                    if ($tt[2][0] > 0) {
+                        $c_c .= '<center><input type="button" value="�������� �������" onClick="addNewEvent();"></center><br>';
+                    }
+                    $c_c .= '<div><span style="float:left" class="dnbx" title="' . $mms[$mml] . ' ' . $yyl . '" onclick="location=\'?clan&events&mm=' . $mml . '&yy=' . $yyl . '\'">&lt;</span><span style="float:right" class="dnbx" onclick="location=\'?clan&events&mm=' . $mmr . '&yy=' . $yyr . '\'" title="' . $mms[$mmr] . ' ' . $yyr . '">&gt;</span><center class="dnbx5">' . $yy . ' ' . $mms[ceil(
+                            $mm
+                        )] . '</center></div><br>';
+                    while ($i <= 49) {
+                        if ($i <= 7) {
+                            $c_c .= '<small class="dnbx1"><b>' . $dds[$i] . '</b></small>';
+                        } else {
+                            if ($i - 7 > 7) {
+                                $lday++;
+                                if (date('d', mktime(0, 0, 0, $mm, $lday)) == $lday) {
+                                    if ($lday == date('d') && $mm == ceil(date('m')) && $yy == date('Y')) {
+                                        $c_c .= '<span class="dnbx2">' . freenews($lday, $mm, $yy) . '</span>';
+                                    } else {
+                                        $c_c .= '<span class="dnbx">' . freenews($lday, $mm, $yy) . '</span>';
                                     }
-                                    $u->addAction(time(),'dark_itm'.$itm['id'],'');
-                                    echo '<font color="red">������� &quot;<b>'.$itm['name'].'</b>&quot; ��������� � ��� � ���������!</font><br><br>';
+                                } else {
+                                    $c_c .= '<span class="dnbx1">&nbsp;</span>';
+                                }
+                            } else {
+                                if ($week[0][$i - 8] > 0) {
+                                    if ($week[0][$i - 8] == date('d') && $mm == ceil(date('m')) && $yy == date('Y')) {
+                                        $c_c .= '<span class="dnbx2">' . freenews(
+                                                $week[0][$i - 8], $mm, $yy
+                                            ) . '</span>';
+                                    } else {
+                                        $c_c .= '<span class="dnbx"">' . freenews(
+                                                $week[0][$i - 8], $mm, $yy
+                                            ) . '</span>';
+                                    }
+                                } elseif ($lday > 0) {
+                                    $c_c .= '<span class="dnbx1">&nbsp;</span>';
                                 }
                             }
-                            $seet0 = '';
-							//����� ���������
-                            $seet0 .= '<img '.$vix.' title="'.$itm['name'].'
-(�������� '.$vnr[$item_clan[$i][4]].': '.($item_clan[$clan_panel][$i][1]-$vix).' ��.)" src="https://'.$c['img'].'/i/items/'.$itm['img'].'"> ';
-                            if($item_clan[$clan_panel][$i][1]-$vix > 0) {
-                                $seet0 = '<a href="main.php?clan=1&take_item_clan_panel='.$itm['id'].'">'.$seet0.'</a>';
-                            }else{
-                                $seet0 = '<span style="filter: alpha(opacity=20); -moz-opacity: 0.20; -khtml-opacity: 0.20; opacity: 0.20;">'.$seet0.'</span>';
-                            }
-                            $seet .= $seet0;
                         }
+                        if ($i == 7 || $i == 14 || $i == 21 || $i == 28 || $i == 35 || $i == 42) {
+                            if ($lday > 0 || $i != 14) {
+                                $c_c .= '<br>';
+                            }
+                        }
+                        $i++;
+                    }
+                    $c_c .= '</div>';
+
+                    if ($tt[1][0] == 1) {
+                        $cnftr = '';
+                        if (isset($_GET['ftr'])) {
+                            if ($_GET['ftr'] == 1) {
+                                $dd1 = $dd;
+                                $mm1 = $mm;
+                                $yy1 = $yy;
+                                if ($dd1 < 9) {
+                                    $dd1 = '0' . $dd1;
+                                }
+                                if ($mm1 < 9) {
+                                    $mm1 = '0' . $mm1;
+                                }
+                                $cnftr = ' AND `ddmmyyyy` = "' . mysql_real_escape_string(
+                                        $dd1 . '.' . $mm1 . '.' . $yy1
+                                    ) . '"';
+                            }
+                        }
+                        $pg = round((int)$_GET['pg']);
+                        if ($pg < 1) {
+                            $pg = 1;
+                        }
+                        $pgssee = ceil(($pg - 1) * 5);
+
+                        $pgs = mysql_fetch_array(
+                            mysql_query(
+                                'SELECT COUNT(`id`) FROM `clan_news` WHERE `clan` = "' . $res['id'] . '" AND `delete` = "0"' . $cnftr
+                            )
+                        );
+                        $pgs = $pgs[0];
+                        $pga = ceil($pgs / 5);
+
+                        $i = 1;
+                        while ($i <= $pga) {
+                            if ($pg == $i) {
+                                $c_p .= ' <b>' . $i . '</b> ';
+                            } else {
+                                if (isset($_GET['ftr'])) {
+                                    $c_p .= ' <a href="?clan&events&dd=' . $dd . '&mm=' . $mm . '&yy=' . $yy . '&ftr=' . $_GET['ftr'] . '&pg=' . $i . '">' . $i . '</a> ';
+                                } else {
+                                    $c_p .= ' <a href="?clan&events&pg=' . $i . '">' . $i . '</a> ';
+                                }
+                            }
+                            $i++;
+                        }
+
+                        if ($c_p != '') {
+                            $c_p = '�������: ' . $c_p;
+                        }
+
+                        $sp = mysql_query(
+                            'SELECT * FROM `clan_news` WHERE `clan` = "' . $res['id'] . '" AND `delete` < 1' . $cnftr . ' ORDER BY `id` DESC LIMIT ' . mysql_real_escape_string(
+                                $pgssee
+                            ) . ',5'
+                        );
+                        while ($pl = mysql_fetch_array($sp)) {
+                            if ($pl['uid'] > 0) {
+                                $login = $u->microLogin($pl['uid'], 1);
+                                if ($tt[2][0] == 1) {
+                                    $pl['text'] = '<img src="https://img.new-combats.com/i/clear.gif" width="13" height="13" title="������� �������" class="leftimg" style="cursor:pointer" onclick="location=\'main.php?clan&events&pg=' . ceil(
+                                            $pg
+                                        ) . '&delete=' . $pl['id'] . '\'">' . $pl['text'];
+                                }
+                            } else {
+                                $login = '';
+                            }
+
+                            $c_r .= '
+	<table width="100%" border="0" style="border:1px solid #aeaeae" cellspacing="0" cellpadding="5">
+	  <tr>
+		<td bgcolor="#c4c3c1"><div style="float:left"><i>' . date(
+                                    'd.m.Y H:i', $pl['time']
+                                ) . '</i> &nbsp; &nbsp; &nbsp; <a class="a" href="javascript:void(0)">' . $pl['title'] . '</a></div><div style="float:right">' . $login . '</div></td>
+	  </tr>
+	  <tr>
+		<td>' . $pl['text'] . '</td>
+	  </tr>
+	</table><br>';
+                        }
+                    }
+                    if ($c_r == '') {
+                        $c_r .= '<br><br><br><br><br><br><br><br><center><b>������� ���� ��� ��� ����� ����� �� ����������� ��� � ��� ������</b></center>';
+                    }
+
+                    ?>
+                    <table width="100%" border="0" cellspacing="0" cellpadding="10">
+                        <tr>
+                            <td align="left" valign="top"><?= $c_r ?></td>
+                            <td width="300" align="center" valign="top"><?= $c_c ?></td>
+                        </tr>
+                        <tr>
+                            <td align="right" valign="top"><?= $c_p ?></td>
+                            <td align="left" valign="top">&nbsp;</td>
+                        </tr>
+                    </table>
+                </fieldset>
+        </div>
+    <?php }elseif (isset($_GET['control'])) { ?>
+    <script>
+        function changeLogin(selObj) {
+            selid = selObj.options[selObj.selectedIndex].value;
+            $('#sn_titul').val($('#slg' + selid).attr('vtitul'));
+            $('#sn_zvanie').val($('#slg' + selid).attr('vzvanie'));
+            $('#sn_canals').val($('#slg' + selid).attr('vcanals'));
+
+            if ($('#slg' + selid).attr('vtitul') == '����� �����') {
+                $('#rp_titul').attr({'disabled': 'disabled'});
+                $('#sn_zvanie').attr({'disabled': 'disabled'});
+                $('#sn_canals').attr({'disabled': 'disabled'});
+                $('#rp_save').attr({'disabled': 'disabled'});
+            } else {
+                $('#rp_titul').attr({'disabled': false});
+                $('#sn_zvanie').attr({'disabled': false});
+                $('#sn_canals').attr({'disabled': false});
+                $('#rp_save').attr({'disabled': false});
+            }
+        }
+    </script>
+    <div class="box visible">
+        <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+            ��� ���������� ������: <a
+                    href="javascript:void(0)"><?php if ($res['politic'] == 1) { ?>���������<?php } else { ?>����������<?php } ?></a>
+        </div>
+        <?php
+        $c_pr = [
+            100, //�������
+            50, //�������
+            100 //������� �����
+        ];
+
+        if (isset($_POST['svb_canals']) && $tt[11][0] == 1) {
+            echo '<font color="#FF0000"><b>������ ���� ���������</b></font><br>';
+            $res['canals'] = $_POST['svb_canals'];
+            $rce = explode();
+            $i = 1;
+            while ($i <= 9) {
+
+                $i++;
+            }
+            mysql_query(
+                'UPDATE `clan` SET `canals` = "' . mysql_real_escape_string(
+                    $res['canals']
+                ) . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+            );
+        } elseif (isset($_POST['svb_site']) && $tt[11][0] == 1) {
+            echo '<font color="#FF0000"><b>�������� ���� ��������</b></font><br>';
+            $res['site'] = $_POST['svb_site'];
+            $rce = explode();
+            $i = 1;
+            while ($i <= 9) {
+
+                $i++;
+            }
+            mysql_query(
+                'UPDATE `clan` SET `site` = "' . mysql_real_escape_string(
+                    $res['site']
+                ) . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+            );
+
+        } elseif (isset($_POST['svb_give_money']) && $tt[7][0] == 1) {
+            $mn = round((int)$_POST['svb_give_money'], 2);
+            if ($mn >= 0.01) {
+                if ($res['money1'] < $mn) {
+                    echo '<font color="#FF0000"><b>� ����� ������������ �������</b></font><br>';
+                } else {
+                    $res['money1'] -= $mn;
+                    $u->info['money'] += $mn;
+                    echo '<font color="#FF0000"><b>�� ������� ����� � ����� ����� ' . $mn . ' ��.</b></font><br>';
+                    mysql_query(
+                        'UPDATE `clan` SET `money1` = "' . mysql_real_escape_string(
+                            $res['money1']
+                        ) . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                    );
+                    mysql_query(
+                        'UPDATE `users` SET `money` = "' . mysql_real_escape_string(
+                            $u->info['money']
+                        ) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+                    );
+                    mysql_query(
+                        'INSERT INTO `clan_operations` (`clan`,`time`,`type`,`text`,`val`,`uid`) VALUES ("' . $res['id'] . '","' . time(
+                        ) . '","1","' . $u->info['login'] . '","' . mysql_real_escape_string(
+                            $mn
+                        ) . '","' . $u->info['id'] . '")'
+                    );
+                }
+            }
+        } elseif (isset($_POST['svb_give_money2']) && $u->info['clan_prava'] == 'glava') {
+            $mn = round((int)$_POST['svb_give_money2'], 2);
+            if ($mn >= 0.01) {
+                if ($res['money2'] < $mn) {
+                    echo '<font color="#FF0000"><b>� ����� ������������ ���.</b></font><br>';
+                } else {
+
+                    $res['money2'] -= $mn;
+                    $u->info['money2'] += $mn;
+                    echo '<font color="#FF0000"><b>�� ������� ����� � ����� ����� ' . $mn . ' ���.</b></font><br>';
+                    mysql_query(
+                        'UPDATE `clan` SET `money2` = "' . mysql_real_escape_string(
+                            $res['money2']
+                        ) . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                    );
+                    mysql_query(
+                        'UPDATE `users` SET `money2` = "' . mysql_real_escape_string(
+                            $u->info['money2']
+                        ) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+                    );
+                    mysql_query(
+                        'INSERT INTO `clan_operations` (`clan`,`time`,`type`,`text`,`val`,`uid`) VALUES ("' . $res['id'] . '","' . time(
+                        ) . '","3","' . $u->info['login'] . '","' . (mysql_real_escape_string(
+                                $mn
+                            ) * -1) . '","' . $u->info['id'] . '")'
+                    );
+
+                }
+            }
+        } elseif (isset($_POST['svb_take_money']) && $tt[6][0] == 1) {
+            $mn = round((int)$_POST['svb_take_money'], 2);
+            if ($mn >= 0.01) {
+                if ($u->info['money'] < $mn) {
+                    echo '<font color="#FF0000"><b>� ��� ������������ �������</b></font><br>';
+                } elseif ($res['money1'] + $mn > 99999) {
+                    echo '<font color="#FF0000"><b>� ����� ����� �� ����� ���� ������ 99999��.</b></font><br>';
+                } else {
+                    $res['money1'] += $mn;
+                    $u->info['money'] -= $mn;
+                    echo '<font color="#FF0000"><b>�� ������� �������� � ����� ����� ' . $mn . ' ��.</b></font><br>';
+                    mysql_query(
+                        'UPDATE `clan` SET `money1` = "' . mysql_real_escape_string(
+                            $res['money1']
+                        ) . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                    );
+                    mysql_query(
+                        'UPDATE `users` SET `money` = "' . mysql_real_escape_string(
+                            $u->info['money']
+                        ) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+                    );
+                    mysql_query(
+                        'INSERT INTO `clan_operations` (`clan`,`time`,`type`,`text`,`val`,`uid`) VALUES ("' . $res['id'] . '","' . time(
+                        ) . '","2","' . $u->info['login'] . '","' . mysql_real_escape_string(
+                            $mn
+                        ) . '","' . $u->info['id'] . '")'
+                    );
+                }
+            }
+        } elseif (isset($_POST['svb_take_money2']) && $tt[6][0] == 1) {
+            $mn = round((int)$_POST['svb_take_money2'], 2);
+            if ($mn >= 0.01) {
+                if ($u->info['money2'] < $mn) {
+                    echo '<font color="#FF0000"><b>� ��� ������������ ���.</b></font><br>';
+                } else {
+                    $maxs = mysql_fetch_array(
+                        mysql_query(
+                            'SELECT SUM(`val`) AS val FROM `clan_operations` WHERE `uid` = "' . $u->info['id'] . '" AND `clan` = "' . $res['id'] . '" AND `type` = 3'
+                        )
+                    );
+                    if (!isset($maxs['val'])) {
+                        $maxs['val'] = 0;
+                    }
+                    if ($maxs['val'] + $mn > 100) {
+                        echo '<font color="#FF0000"><b>������������ ����� ������: 100 ���. ������ �������� ���: ' . (100 - $maxs['val']) . ' ���.</b></font><br>';
+                    } else {
+                        $res['money2'] += $mn;
+                        $u->info['money2'] -= $mn;
+                        echo '<font color="#FF0000"><b>�� ������� �������� � ����� ����� ' . $mn . ' ���.</b></font><br>';
+                        mysql_query(
+                            'UPDATE `clan` SET `money2` = "' . mysql_real_escape_string(
+                                $res['money2']
+                            ) . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                        );
+                        mysql_query(
+                            'UPDATE `users` SET `money2` = "' . mysql_real_escape_string(
+                                $u->info['money2']
+                            ) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+                        );
+                        mysql_query(
+                            'INSERT INTO `clan_operations` (`clan`,`time`,`type`,`text`,`val`,`uid`) VALUES ("' . $res['id'] . '","' . time(
+                            ) . '","3","' . $u->info['login'] . '","' . mysql_real_escape_string(
+                                $mn
+                            ) . '","' . $u->info['id'] . '")'
+                        );
+                    }
+                }
+            }
+        } elseif (isset($_POST['invite']) && ($_POST['invite'] == '�������' || $_POST['invite'] == '�������' || $_POST['invite'] == '���������') && $tt[11][0] == 1) {
+            if ($_POST['invite'] == "�������" && $tt[10][0] == 1) {
+                $usr = mysql_fetch_array(
+                    mysql_query(
+                        'SELECT * FROM `users` WHERE `login` = "' . mysql_real_escape_string(
+                            $_POST['logingo']
+                        ) . '" AND `clan` = "' . $res['id'] . '" LIMIT 1'
+                    )
+                );
+                //$ttus = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = "'.$usr['clan_prava'].'" LIMIT 1'));
+                if (!isset($usr['id'])) {
+                    echo '<font color="#FF0000"><b>����� �� ������ � �����</b></font><br>';
+                } elseif ($tt['prioritet'] >= $utitl['prioritet']) {
+                    echo '<font color="#FF0000"><b>����� ������ ��� �� ������, ���� ������ ���������</b></font><br>';
+                } elseif ($u->info['money'] < $c_pr[1]) {
+                    echo '<font color="#FF0000"><b>� ��� �� ���������� ��. ��� ���������� ������ �� ����� (���������: ' . $c_pr[1] . ' ��.)</b></font><br>';
+                } elseif ($usr['clan_prava'] == 'galva' && $u->info['clan_prava'] != 'glava') {
+                    echo '<font color="#FF0000"><b>����� ������ ��� �� ������, ���� ������ ���������</b></font><br>';
+                } else {
+                    $ar = $u->rem_itm_cl($usr, $res['id'], 8);
+                    if ($usr['level'] < 10) {
+                        mysql_query(
+                            'UPDATE `users` SET `palpro` = 0, `clan_prava` = 0, `clan` = 0, `clan_zv` = 0, `mod_zvanie` = "", `align` = 0, `clan_delay` = "0" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
+                        );
+                    } else {
+                        mysql_query(
+                            'UPDATE `users` SET `palpro` = 0, `clan_prava` = 0, `clan` = 0, `clan_zv` = 0, `mod_zvanie` = "", `align` = 0, `clan_delay` = "' . time(
+                            ) . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
+                        );
+                    }
+                    $u->info['money'] -= $c_pr[1];
+                    mysql_query(
+                        'UPDATE `users` SET `money` = "' . $u->info['money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+                    );
+                    $c_r .= '<font color="#FF0000"><b>����� &quot;' . $usr['login'] . '&quot; ��� �������� �� ����� �� ' . $c_pr[1] . ' ��.</b></font><br>';
+                    $txt = '����� <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $u->info['login'] . '</a>[' . $u->info['level'] . ']<a target="_blank" title="���. � ' . $u->info['login'] . '" href="info/' . $u->info['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $u->info['cityreg'] . '.gif"></a> �������� �� ����� ������ <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $usr['login'] . '</a>[' . $usr['level'] . ']<a target="_blank" title="���. � ' . $usr['login'] . '" href="info/' . $usr['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $usr['cityreg'] . '.gif"></a>';
+                    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","�������������","�������� ���������","' . mysql_real_escape_string(
+                            $txt
+                        ) . '"
+				)'
+                    );
+                }
+            } elseif ($_POST['invite'] == "���������" && $u->info['clan_prava'] == 'glava') {
+                $usr = mysql_fetch_array(
+                    mysql_query(
+                        'SELECT * FROM `users` WHERE `login` = "' . mysql_real_escape_string(
+                            $_POST['logingo']
+                        ) . '" AND `clan` = "' . $res['id'] . '" AND `banned` = "0" LIMIT 1'
+                    )
+                );
+                if (!isset($usr['id'])) {
+                    echo '<font color="#FF0000"><b>����� �� ������ � �����</b></font><br>';
+                } elseif ($u->info['money'] < $c_pr[2]) {
+                    echo '<font color="#FF0000"><b>� ��� �� ���������� ��. ��� ���������� ������ �� ���� ����� ����� (���������: ' . $c_pr[2] . ' ��.)</b></font><br>';
+                } elseif ($usr['clan_prava'] == 'galva') {
+                    echo '<font color="#FF0000"><b>����� ��� �������� ������ �����</b></font><br>';
+                } else {
+                    mysql_query(
+                        'UPDATE `users` SET `clan_prava` = "glava", `clan` = "' . $res['id'] . '", `mod_zvanie` = "����� �����", `align` = "' . $res['align'] . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
+                    );
+                    $u->info['money'] -= $c_pr[2];
+                    mysql_query(
+                        'UPDATE `users` SET `clan_prava` = "2", `mod_zvanie` = "�������", `money` = "' . $u->info['money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+                    );
+                    $c_r .= '<font color="#FF0000"><b>����� &quot;' . $usr['login'] . '&quot; ��� �������� ������ ���� �� ' . $c_pr[0] . ' ��.</b></font><br>';
+                    $txt = '����� <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $u->info['login'] . '</a>[' . $u->info['level'] . ']<a target="_blank" title="���. � ' . $u->info['login'] . '" href="info/' . $u->info['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $u->info['cityreg'] . '.gif"></a> �������� ������ <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $usr['login'] . '</a>[' . $usr['level'] . ']<a target="_blank" title="���. � ' . $usr['login'] . '" href="info/' . $usr['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $usr['cityreg'] . '.gif"></a> �� ��������� <b>����� �����</b>';
+                    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","�������������","�������� ���������","' . mysql_real_escape_string(
+                            $txt
+                        ) . '"
+				)'
+                    );
+                }
+            } elseif ($_POST['invite'] == "�������" && $tt[9][0] == 1) {
+                $is_cl = mysql_fetch_row(
+                    mysql_query("SELECT COUNT(*) FROM `users` WHERE `clan` = '" . $res['id'] . "'")
+                );
+                $usr = mysql_fetch_array(
+                    mysql_query(
+                        'SELECT * FROM `users` WHERE `login` = "' . mysql_real_escape_string(
+                            $_POST['logingo']
+                        ) . '" AND `clan` != "' . $res['id'] . '" AND `clan_zv` = "' . $res['id'] . '" LIMIT 1'
+                    )
+                );
+                if (!isset($usr['id'])) {
+                    echo '<font color="#FF0000"><b>���������� ����� �� ������ ��� �� ����� ������ � ��� ����.</b></font><br>';
+                } elseif ($usr['clan_prava'] == 'galva') {
+                    echo '<font color="#FF0000"><b>����� ��� �������� ������ �����</b></font><br>';
+                    // }elseif($usr['palpro'] < time()) {
+                    // echo '<font color="#FF0000"><b>����� ������ ������ �������� � ���������</b></font><br>';
+                } elseif ($usr['clan_delay'] + 10 * 24 * 60 * 60 > time()) {
+                    echo '<font color="#FF0000"><b>� ������ �������� �� ���������� � ���� �� ' . date(
+                            'd.m.Y H:i', $usr['clan_delay'] + 10 * 24 * 60 * 60
+                        ) . '</b></font><br>';
+                } elseif ($u->info['money'] < $c_pr[0]) {
+                    echo '<font color="#FF0000"><b>� ��� �� ���������� ��. ��� ������ ������ � ���� (���������: ' . $c_pr[0] . ' ��.)</b></font><br>';
+                } elseif ($usr['clan'] != '0' || $usr['align'] != '0') {
+                    echo '<font color="#FF0000"><b>�������� ��� ��������� � �����, ���� ����� ����������</b></font><br>';
+                } elseif ($is_cl[0] >= $lvl_prava[$res['level']][0]) {
+                    echo '<font color="#FF0000"><b>��������� ����� �����������. ������� ������� �����.</b></font><br>';
+                } else {
+                    // `palpro` = "'.(time()+86400*7).'",
+                    mysql_query(
+                        'UPDATE `users` SET `clan_prava` = "2",`clan` = "' . $res['id'] . '",`mod_zvanie` = "",`align` = "' . $res['align'] . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
+                    );
+                    $u->info['money'] -= $c_pr[0];
+                    mysql_query(
+                        'UPDATE `users` SET `money` = "' . $u->info['money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+                    );
+                    echo '<font color="#FF0000"><b>����� &quot;' . $usr['login'] . '&quot; ��� ������ � ���� �� ' . $c_pr[0] . ' ��.</b></font><br>';
+                    $txt = '����� <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $u->info['login'] . '</a>[' . $u->info['level'] . ']<a target="_blank" title="���. � ' . $u->info['login'] . '" href="info/' . $u->info['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $u->info['cityreg'] . '.gif"></a> ������ � ���� ������ <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $usr['login'] . '</a>[' . $usr['level'] . ']<a target="_blank" title="���. � ' . $usr['login'] . '" href="info/' . $usr['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $usr['cityreg'] . '.gif"></a>';
+                    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","�������������","�������� ���������","' . mysql_real_escape_string(
+                            $txt
+                        ) . '"
+				)'
+                    );
+                }
+            }
+        }
+        ?>
+        <?php if ($tt[9][0] > 0) { ?>
+            <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                <input style="width:144px;" value="���������� � ����"
+                       onClick="openMod('<b>���������� ������ � ����</b>','<form action=\'main.php?clan&control&priem\' method=\'post\'>�����: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');"
+                       type="button"/>
+                (��� ��� ��������� � <?= $c_pr[0] ?><b> ��.</b>)<br/>
+                (��� ������ � ���� �������� ������ ������ ������ ����� ������������ ������)<br/>
+                ������ �������� ������:
+                <?php
+
+                $spnew = mysql_query('SELECT * FROM `users` WHERE `clan_zv`="' . $res['id'] . '" AND `clan`= 0');
+                while ($plnew = mysql_fetch_array($spnew)) {
+                    echo '<b>' . $plnew['login'] . '[' . $plnew['level'] . ']</b><a href="/info/' . $plnew['id'] . '" target="_blank"><img src="https://img.new-combats.com/i/inf_capitalcity.gif"></a>';
+                }
+
+                ?>
+                <br/>
+            </div>
+        <?php } ?>
+        <?php if ($tt[10][0] > 0) { ?>
+            <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                <input type="button" style="width:144px;" value="������� �� �����"
+                       onClick="openMod('<b>������� ������ �� �����</b>','<form action=\'main.php?clan&control&unpriem\' method=\'post\'>�����: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');">
+                (��� ��� ��������� � <?= $c_pr[1] ?><b> ��.</b>)<br/>
+            </div>
+        <?php } ?>
+        <?php if ($u->info['clan_prava'] == 'glava') { ?>
+        <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+            <input style="width:144px;" value="������� ����� �����"
+                   onClick="openMod('<b>��������� ����� �����</b>','<form action=\'main.php?clan&control&newglava\' method=\'post\'>�����: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'���������\'></form>');"
+                   type="button"/> (����� ����� ������ ������� � ���� ����������, �������� ������ ����� �������
+            ���������)<br/>
+            <br>
+            <form method="post" enctype="multipart/form-data" action="?clan&control&save_canals">
+                <div style="display:inline-block;width:150px;">���� ����:</div>
+                <input style="width:211px;" id="svb_canals" value="<?= $res['site'] ?>" name="svb_site" type="text"/>
+                <input name="���������" type="submit" id="rp_save" value="���������"/><br/>
+        </div>
+        </form>
+
+        <!-- ��� -->
+    </div>
+<?php } ?>
+    <?php if ($tt[11][0] > 0) { ?>
+        <fieldset>
+            <legend><span class="legtitle">�������������� ������� ���������</span></legend>
+            <?php
+            if (isset($_GET['saveuser']) && $tt[11][0] == 1) {
+                //[rp_login] => 0 [rp_titul] => 0 [rp_zvanie] => [rp_canals] =>
+                $c_r = '';
+                $usr = mysql_fetch_array(
+                    mysql_query(
+                        'SELECT * FROM `users` WHERE `id` = "' . mysql_real_escape_string(
+                            $_POST['rp_login']
+                        ) . '" AND `clan` = "' . $res['id'] . '" LIMIT 1'
+                    )
+                );
+                if (isset($usr['id'])) {
+                    if ($usr['clan_prava'] != 'glava') {
+                        $tt = mysql_fetch_array(
+                            mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = "' . $usr['clan_prava'] . '" LIMIT 1')
+                        );
+                        if ($tt['prioritet'] < $utitl['prioritet']) {
+                            //����� �����
+                            if ((int)$_POST['rp_titul'] > 0) {
+                                $tt_new = mysql_fetch_array(
+                                    mysql_query(
+                                        'SELECT * FROM `clan_tituls` WHERE `id` = "' . mysql_real_escape_string(
+                                            $_POST['rp_titul']
+                                        ) . '" AND `clan` = "' . $res['id'] . '" LIMIT 1'
+                                    )
+                                );
+                                if (isset($tt_new['id'])) {
+                                    if ($tt_new['prioritet'] < $utitl['prioritet']) {
+                                        mysql_query(
+                                            'UPDATE `users` SET `clan_prava` = "' . $tt_new['id'] . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
+                                        );
+                                        $c_r .= '<font color="#FF0000"><b>������ &quot;' . $usr['login'] . '&quot; ��� �������� ����� &quot;' . $tt_new['name'] . '&quot;</b></font><br>';
+                                        if ($tt_new['prioritet'] < $tt['prioritet']) {
+                                            //�������
+                                            $txt = '����� <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $u->info['login'] . '</a>[' . $u->info['level'] . ']<a target="_blank" title="���. � ' . $u->info['login'] . '" href="info/' . $u->info['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $u->info['cityreg'] . '.gif"></a> ������� ����� ������ <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $usr['login'] . '</a>[' . $usr['level'] . ']<a target="_blank" title="���. � ' . $usr['login'] . '" href="info/' . $usr['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $usr['cityreg'] . '.gif"></a> �� &quot;<b>' . $tt_new['name'] . '</b>&quot;';
+                                        } else {
+                                            //��������
+                                            $txt = '����� <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $u->info['login'] . '</a>[' . $u->info['level'] . ']<a target="_blank" title="���. � ' . $u->info['login'] . '" href="info/' . $u->info['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $u->info['cityreg'] . '.gif"></a> �������� ����� &quot;<b>' . $tt_new['name'] . '</b>&quot; ������ <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $usr['login'] . '</a>[' . $usr['level'] . ']<a target="_blank" title="���. � ' . $usr['login'] . '" href="info/' . $usr['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $usr['cityreg'] . '.gif"></a>';
+                                        }
+
+                                        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","�������������","�������� ���������","' . mysql_real_escape_string(
+                                                $txt
+                                            ) . '"
+								)'
+                                        );
+
+                                    } else {
+                                        $c_r .= '<font color="#FF0000"><b>�� �� ������ ��������� ����� ������ ������ ������</b></font><br>';
+                                    }
+                                }
+                            }
+                            mysql_query(
+                                'UPDATE `users` SET `mod_zvanie` = "' . mysql_real_escape_string(
+                                    $_POST['rp_zvanie']
+                                ) . '",`ccanals` = "' . mysql_real_escape_string(
+                                    $_POST['rp_canals']
+                                ) . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
+                            );
+                            $c_r .= '<font color="#FF0000"><b>���������� ������� ���������</b></font><br>';
+
+                        } else {
+                            $c_r .= '<font color="#FF0000"><b>����� ������ ��� �� ������, ���� ������ ���������</b></font><br>'; // ���
+                        }
+                    } else {
+                        $c_r .= '<font color="#FF0000"><b>����� ������ ��� �� ������, ���� ������ ���������</b></font><br>';
+                    }
+                } else {
+                    $c_r .= '<font color="#FF0000"><b>����� �� ������� � ����� ' . $res['name'] . '</b></font><br>';
+                }
+            }
+            echo $c_r;
+            ?>
+            <form method="post" action="main.php?clan&control&saveuser">
+                <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                    <div style="display:inline-block;width:150px;">�����:</div>
+                    <select onchange="changeLogin(this);" style="width:211px;" name="rp_login">
+                        <option value="0" style="color:#CCCCCC">�������� �����</option>
+                        <?php
+                        $sp = mysql_query(
+                            'SELECT `id`,`login`,`clan_prava`,`ccanals`,`mod_zvanie` FROM `users` WHERE `clan` = "' . $res['id'] . '"'
+                        );
+                        while ($pl = mysql_fetch_array($sp)) {
+                            $cp = mysql_fetch_array(
+                                mysql_query(
+                                    'SELECT * FROM `clan_tituls` WHERE `id` = "' . mysql_real_escape_string(
+                                        $pl['clan_prava']
+                                    ) . '" LIMIT 1'
+                                )
+                            );
+                            if ($pl['clan_prava'] == 'glava') {
+                                $cp['name'] = '����� �����';
+                            }
+                            echo '<option id="slg' . $pl['id'] . '" value="' . $pl['id'] . '" vtitul="' . $cp['name'] . '" vzvanie="' . $pl['mod_zvanie'] . '" vcanals="' . $pl['ccanals'] . '">' . $pl['login'] . '</option>';
+                        }
+                        ?></select>
+                </div>
+                <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                    <div style="display:inline-block;width:150px;">�����:</div>
+                    <input id="sn_titul" style="width:211px;" disabled="disabled" name="rp_canals" type="text"/>
+                </div>
+                <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                    <div style="display:inline-block;width:150px;">��������� �����:</div>
+                    <select style="width:211px;" id="rp_titul" name="rp_titul">
+                        <option value="0" style="color:#CCCCCC">�� ������</option>
+                        <?php
+                        $sp = mysql_query(
+                            'SELECT * FROM `clan_tituls` WHERE `clan` = "' . $res['id'] . '" AND `delete` = "0" LIMIT 25'
+                        );
+                        while ($pl = mysql_fetch_array($sp)) {
+                            echo '<option value="' . $pl['id'] . '">' . $pl['name'] . '</option>';
+                        }
+                        ?></select>
+                </div>
+                <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                    <div style="display:inline-block;width:150px;">�������</div>
+                </div>
+                <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                    <div style="display:inline-block;width:150px;">������ � �����:</div>
+                    <input style="width:211px;" id="sn_zvanie" name="rp_zvanie" type="text"/>
+                </div>
+                <div>
+                    <div style="display:inline-block;width:150px;">������ ����:</div>
+                    <input style="width:211px;" id="sn_canals" name="rp_canals" type="text"/><br/>
+                    <small>(���������� ����� ������� ������ ��������� �������. ��������: 1,3,7. ��������� ������:
+                        1-9)</small> <input name="���������" type="submit" id="rp_save" value="���������"/>
+                </div>
+            </form>
+        </fieldset>
+        <form method="post" enctype="multipart/form-data" action="?clan&control&save_canals">
+            <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-top:10px;padding-bottom:5px;">
+                <div style="display:inline-block;width:150px;">������ ����:</div>
+                <input style="width:211px;" id="svb_canals" value="<?= $res['canals'] ?>" name="svb_canals"
+                       type="text"/> <input name="���������" type="submit" id="rp_save" value="���������"/><br/>
+                <small>(���������� ����� ������� ������ �������� �������. ��������: 2,4,8. ��������� ������:
+                    1-9)</small>
+            </div>
+        </form>
+    <?php } ?>
+    <?php if ($tt[5][0] == 1) { ?>
+        <?php if ($tt[7][0] > 0 && $res['money2'] > 0 && $u->info['admin'] > 0) { ?>
+            <fieldset>
+                <legend><span class="legtitle">�������� �����������</span></legend>
+                <form action="?clan&control&buy_imgae" method="post" enctype="multipart/form-data">
+                    <?php
+                    /* ��������� ����������� � ������ */
+
+                    if (isset($_GET['gdload'])) {
+                        echo '<b style="color:red">����������� ���� ������� ��������� �� ������! ��������������� �� �������� � ���������, � ������� &quot;�������&quot;.</b><br>';
+                    } elseif (isset($_POST['img_load1type'])) {
+                        $data = [
+                            'obraz' => $_FILES['load_image1'],
+                            'sex' => round((int)$_POST['img_load3type']),
+                            'w' => '',
+                            'h' => '',
+                            'type' => round((int)$_POST['img_load1type']),
+                            'animation' => round((int)$_POST['img_load2type']),
+                        ];
+
+                        $ers = '';
+
+                        if ($data['sex'] != 0 && $data['sex'] != 1) {
+                            $ers = '������! �� �� ������� ��� ���� ����� �������� �����������!';
+                        } elseif ($data['animation'] != 0 && $data['animation'] != 1) {
+                            $ers = '������! �� �� ������� ��� �����������: �������������, �� �������������!';
+                        } elseif ($data['type'] < 1 || $data['type'] > 18) {
+                            $ers = '������! �� �� ������� ��� ����� ��������� �����������!';
+                        }
+
+                        $types = [
+                            1 => ['�����', 120, 220, 100],
+                            2 => ['�������� (�����)', 120, 40, 15],
+                            3 => ['�������� (������)', 120, 20, 5],
+                            4 => ['����', 60, 60, 25],
+                            5 => ['������', 60, 40, 25],
+                            6 => ['����� ����', 60, 60, 25],
+                            7 => ['������ ����', 60, 60, 25],
+                            8 => ['�����', 60, 80, 25],
+                            9 => ['����', 60, 40, 25],
+                            10 => ['�������', 60, 40, 25],
+                            11 => ['������', 60, 80, 25],
+                            12 => ['��������', 60, 40, 25],
+                            13 => ['������ �1', 20, 20, 10],
+                            14 => ['�����', 60, 20, 25],
+                            15 => ['������', 60, 20, 25],
+                            16 => ['�������� ��� ���������� � ���������', 244, 287, 5],
+                            17 => ['������ �2', 20, 20, 10],
+                            18 => ['������ �3', 20, 20, 10],
+                        ];
+
+                        $data['price'] = $types[$data['type']][3];
+
+
+                        if ($data['price'] > $res['money2']) {
+                            $ers = '������! � ����� ����� ������������ ����-�������� ��� ������������ ������� �����������.';
+                        }
+
+                        if ($ers != '') {
+                            echo '<b style="color:red">' . $ers . '</b><br>';
+                        } else {
+                            /* ��������� ����������� */
+                            $imgname = md5(rand(0, 1000000000000) . '&' . rand(0, 10000000) . '&' . microtime());
+                            $upload = new Uploader('load_image1', $imgname);
+                            $upload->setMaxFileSize(.35);
+                            $upload->setSavePath('clan_prw/');
+                            $upload->setDimensions($types[$data['type']][1], $types[$data['type']][2]);
+                            $file = $upload->saveimg();
+
+                            if ($file) {
+                                $size = getimagesize(
+                                    "https://new-combats.com/clan_prw/" . htmlspecialchars($file[1], null, 'cp1251')
+                                );
+
+                                $bag = 0;
+
+                                if ($types[$data['type']][1] != $size[0] || $types[$data['type']][2] != $size[1]) {
+                                    $bag = 1;
+                                }
+
+                                mysql_query(
+                                    'INSERT INTO `reimage` (`login`,`uid`,`time`,`src`,`clan`,`type`,`sex`,`animation`,`w`,`h`,`bag`) VALUES (
+						"' . $u->info['login'] . '",
+						"' . $u->info['id'] . '","' . time() . '",
+						"' . mysql_real_escape_string(htmlspecialchars($file[1], null, 'cp1251')) . '",
+						"' . $u->info['clan'] . '",
+						"' . mysql_real_escape_string($data['type']) . '",
+						"' . mysql_real_escape_string($data['sex']) . '",
+						"' . mysql_real_escape_string($data['animation']) . '",
+						"' . mysql_real_escape_string((int)$size[0]) . '",
+						"' . mysql_real_escape_string((int)$size[1]) . '",
+						"' . $bag . '"
+					)'
+                                );
+
+                                $res['money2'] -= $data['price'];
+
+                                mysql_query(
+                                    'UPDATE `clan` SET `money2` = "' . $res['money2'] . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                                );
+                                die('<meta http-equiv="refresh" content="0; URL=/main.php?clan&control&gdload">');
+                            } else {
+
+                                echo '<b style="color:red">' . Uploader::$error . '</b><br>';
+                            }
+                        }
+                    }
+
+                    ?>
+                    <select name="img_load1type">
+                        <option value="0"><b>�������� ��� �����������</b></option>
+                        <option value="0"><b>�����</b></option>
+                        <option value="1">- ����� [������: 120x220] (100 ���.)</option>
+                        <option value="2">- �������� (�����) [������: 120x40] (15 ���.)</option>
+                        <option value="3">- �������� (������) [������: 120x20] (5 ���.)</option>
+                        <option value="0"><b>����� ��� ��������������</b></option>
+                        <option value="4">- ���� [������: 60x60] (25 ���.)</option>
+                        <option value="5">- ������ [������: 60x40] (25 ���.)</option>
+                        <option value="6">- ����� ���� [������: 60x60] (25 ���.)</option>
+                        <option value="7">- ������ ���� [������: 60x60] (25 ���.)</option>
+                        <option value="8">- ����� [������: 60x80] (25 ���.)</option>
+                        <option value="9">- ���� [������: 60x40] (25 ���.)</option>
+                        <option value="10">- ������� [������: 60x40] (25 ���.)</option>
+                        <option value="11">- ������ [������: 60x80] (25 ���.)</option>
+                        <option value="12">- �������� [������: 60x40] (25 ���.)</option>
+                        <option value="13">- ������ �1 [������: 20x20] (10 ���.)</option>
+                        <option value="17">- ������ �2 [������: 20x20] (10 ���.)</option>
+                        <option value="18">- ������ �3 [������: 20x20] (10 ���.)</option>
+                        <option value="14">- ����� [������: 60x20] (25 ���.)</option>
+                        <option value="15">- ������ [������: 60x20] (25 ���.)</option>
+                        <option value="16">�������� ��� ���������� � ��������� [������: 244x287] (5 ���.)</option>
+                    </select><br/>
+                    <select name="img_load2type" id="img_load2type">
+                        <option value="0">�������� (���������)</option>
+                        <option>�������� (��������)(��������� ����������� �����������)</option>
+                    </select><br/>
+                    <select name="img_load3type" id="img_load3type">
+                        <option value="-1">�������� ���</option>
+                        <option value="0">��� ������</option>
+                        <option value="1">��� ������</option>
+                    </select><br/>
+                    <small style="color:red;">������ ����������� �� ������ ��������� 350 ��!</small>
+                    <br/>
+                    <input type="file" name="load_image1" id="load_image1"/>
+                    <button type="submit">���������</button>
+                    <br/>
+                    <small style="color:red;">��������!</small>
+                    <small> ����������� ���������� ������� ����, <a href="#">������� ���������� �����������</a>, ����
+                        ���������� �������� ������������ ����������� ������ ����� ����� ������������� ��� �����������
+                        �������� ������� � ��� ����������� ������ ����������� �� �����.</small>
+                </form>
+            </fieldset>
+        <?php }
+        ?>
+        <fieldset>
+            <legend><span class="legtitle">����� �����</span></legend>
+            <form method="post" action="?clan&control&give_money">
+                ��. � ����� �����: <?= $res['money1'] ?>
+                <br/>
+                <?php if ($tt[7][0] > 0) { ?>
+                    ������� �� ����� ��: <input id="svb_give_money" name="svb_give_money" value="0" type="text"/> <input
+                            type="submit" value=">>"/>
+                    <?php
+                }
+                ?>
+            </form>
+            <?php if ($tt[6][0] > 0) { ?>
+                <form method="post" action="?clan&control&take_money">
+                    <div style="border-top:1px solid #cac9c7;margin-top:5px;padding-top:5px;">
+                        �������� �� � �����: <input id="svb_take_money" name="svb_take_money" value="0" type="text"/>
+                        <input type="submit" value=">>"/>
+                        <small>(��� ����: <?= $u->info['money'] ?>��.)</small>
+                    </div>
+                </form>
+            <?php } ?>
+
+            <hr>
+            <form method="post" action="?clan&control&give_money">
+                ���. � ����� �����: <?= $res['money2'] ?>. <br/>
+                <input type="button" value="������ ��������"/><br/>
+                <?php if ($u->info['clan_prava'] == 'glava') { ?>
+                    <br>
+                    ������� �� ����� ���: <input id="svb_give_money2" name="svb_give_money2" value="0" type="text"/>
+                    <input type="submit" value=">>"/>
+                    <?php
+
+                }
+                ?>
+            </form>
+
+
+            <?php if ($tt[6][0] > 0) { ?>
+                <form method="post" action="?clan&control&take_money">
+                    <div style="border-top:1px solid #cac9c7;margin-top:5px;padding-top:5px;">
+                        �������� ��� � �����: <input id="svb_take_money2" name="svb_take_money2" value="0" type="text"/>
+                        <input type="submit" value=">>"/>
+                        <small>(��� ����: <?= $u->info['money2'] ?>��.)</small>
+                    </div>
+                </form>
+
+                <?php
+            }
+            ?>
+        </fieldset>
+    <?php } ?>
+    <?php if ($tt[11][0] > 0 && $tt[3][0] == 1) { ?>
+        <form method="post" action="?clan&control&vipiska">
+            <div style="margin-top:5px;padding-top:5px;">
+                �������� ������� ��� ���������: <small>(������ ����� 1��.)</small> <input id="svb_vipiska"
+                                                                                          name="svb_vipiska"
+                                                                                          value="<?= date('d.m.Y') ?>"
+                                                                                          type="text"/> <input
+                        type="submit" value="��������"/>
+            </div>
+        </form>
+    <?php } ?>
+</div>
+<?php
+} elseif (isset($_GET['diplom']) && $tt[12][0] == 1) {
+
+    if ($tt[14][0] == 1) {
+        if (isset($_GET['clanwars'])) {
+            //RadioGroup1
+            $cln = mysql_fetch_array(
+                mysql_query(
+                    'SELECT * FROM `clan` WHERE `name` = "' . mysql_real_escape_string($_POST['logingo']) . '" LIMIT 1'
+                )
+            );
+            if (isset($cln['id'])) {
+                $clntn = mysql_fetch_array(
+                    mysql_query(
+                        'SELECT * FROM `aaa_clan_reting_list` WHERE `clan` = "' . $res['id'] . '" ORDER BY `id` DESC LIMIT 1 '
+                    )
+                );
+                $clnta = mysql_fetch_array(
+                    mysql_query(
+                        'SELECT * FROM `aaa_clan_reting_list` WHERE `clan` = "' . $cln['id'] . '" ORDER BY `id` DESC LIMIT 1 '
+                    )
+                );
+                if ($cln['id'] == $res['id']) {
+
+                    $rn = [
+                        '<font color="#FF0000"><b>���������, �� ����� ��� ������ ������ :-)</b></font><br>',
+                        '<font color="#FF0000"><b>��� ����� ����� ������ �������, ���� ������� ������!</b></font><br>',
+                        '<font color="#FF0000"><b>�� ������������� �����������, ��������� �������� ������ �����!</b></font><br>'];
+                    echo $rn[rand(0, 2)];
+                } elseif ($clnta['global'] < $clntn['global'] / 2) {
+                    echo '<font color="#FF0000"><b>��������� ������� ����</b></font><br>';
+                } elseif ($cln['join1'] == $res['join1'] && $res['join1'] > 0) {
+                    echo '<font color="#FF0000"><b>�� �������� � ����� � ���� ������</b></font><br>';
+                } elseif ($cln['join2'] == $res['join2'] && $res['join2'] > 0) {
+                    echo '<font color="#FF0000"><b>�� �������� � ������� � ���� ������</b></font><br>';
+                } else {
+                    $lwar = mysql_fetch_array(
+                        mysql_query(
+                            'SELECT * FROM `clan_wars` WHERE `time_finish` > ' . time(
+                            ) . ' AND ((`clan1` = "' . $cln['id'] . '" AND `clan2` = "' . $res['id'] . '") OR (`clan2` = "' . $cln['id'] . '" AND `clan1` = "' . $res['id'] . '")) LIMIT 1 '
+                        )
+                    );
+                    if (!isset($lwar['id'])) {
+                        $mkr = 10;
+                        $tpcw = 1;
+                        if ($_POST['RadioGroup1'] == 2) {
+                            $mkr = 20;
+                            $tpcw = 2;
+                        }
+                        if (isset($lwar['id'])) {  // ���� true == true
+                            echo '<font color="#FF0000"><b>������ �������� ����� ����� ������</b></font><br>';
+                        } elseif ($mkr > $res['money2']) {
+                            echo '<font color="#FF0000"><b>� ����� ����� �� ���������� �������</b></font><br>';
+                        } else {
+                            mysql_query(
+                                'UPDATE `clan` SET `money2` = `money2` - ' . $mkr . ' WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                            );
+                            mysql_query(
+                                'INSERT INTO `clan_wars` (`clan1`,`clan2`,`time_start`,`time_finish`,`type`,`text`) VALUES ("' . $res['id'] . '","' . $cln['id'] . '","' . time(
+                                ) . '","' . (time() + 60 * 60 * 24) . '","' . $tpcw . '","�����!")'
+                            );
+                            mysql_query(
+                                'INSERT INTO `clan_operations` (`clan`,`time`,`type`,`text`,`val`,`uid`) VALUES ("' . $res['id'] . '","' . time(
+                                ) . '","4","' . $u->info['login'] . '","clanwar_' . $mkr . '_' . $cln['id'] . '","' . $u->info['id'] . '")'
+                            );
+                            echo '<font color="#FF0000"><b>�� ������� �������� ����� ����� &quot;' . $cln['name'] . '&quot; �� ' . $mkr . ' ���.</b></font><br>';
+                        }
+                    } else {
+                        echo '<font color="#FF0000"><b>�� ��� ������ ����� � ������ ������</b></font><br>';
+                    }
+                }
+            } else {
+                echo '<font color="#FF0000"><b>���� � ����� ��������� �� ������</b></font><br>';
+            }
+        }
+    }
+
+    ?>
+    <br/><br/>
+    <fieldset>
+        <legend><span class="legtitle">�������� �����</span></legend>
+        <?php
+        $warc = mysql_fetch_array(
+            mysql_query(
+                'SELECT COUNT(`id`) FROM `clan_wars` WHERE (`clan1` = "' . $res['id'] . '" OR `clan2` = "' . $res['id'] . '") AND `time_finish` > "' . time(
+                ) . '" LIMIT 1'
+            )
+        );
+        $warc = $warc[0];
+        if ($tt[14][0] == 1) {
+            if ($warc < 3) {
+                ?>
+                <input onClick="openMod('<b>�������� ����� �����</b>','<form action=\'main.php?clan&diplom&clanwars\' method=\'post\'>�������� �����: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br><label><input type=\'radio\' name=\'RadioGroup1\' value=\'1\' id=\'RadioGroup1_0\'>������� ����� (10 ���.)</label><br><span style=\'float:left\'><label><input type=\'radio\' name=\'RadioGroup1\' value=\'2\' id=\'RadioGroup1_1\'>�������� ����� (20 ���.)</label></span><input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');"
+                       type="submit" name="button" id="button" value="������ �����"/>
+                <?php
+                echo '<font color="#FF0000"><b>�������������� �����: ' . $warc . ' ��.</b></font><br>';
+            } else {
+                echo '<font color="#FF0000"><b>� ������ ����� ��� 3 � ����� ����</b></font><br>';
+            }
+
+        }
+        ?>
+        <br/>
+        <div style="border:1px solid #CECECE;padding:10px;">
+            <?php
+            $ms = '';
+            $sp = mysql_query(
+                'SELECT * FROM `clan_wars` WHERE (`clan1` = "' . $res['id'] . '" OR `clan2` = "' . $res['id'] . '") AND `time_finish` > "' . time(
+                ) . '"'
+            );
+            while ($pl = mysql_fetch_array($sp)) {
+                $cln1 = mysql_fetch_array(
+                    mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $pl['clan1'] . '" LIMIT 1')
+                );
+                $cln2 = mysql_fetch_array(
+                    mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $pl['clan2'] . '" LIMIT 1')
+                );
+                $ms .= '<div style="border:1px solid #CECECE;padding:10px;">����� ����� ������� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $cln1['name_mini'] . '.gif">' . $cln1['name'] . '</b> � <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $cln2['name_mini'] . '.gif">' . $cln2['name'] . '</b>.<br>';
+                if ($pl['text'] != '') {
+                    $ms .= '������� �����: <i>' . $pl['text'] . '</i><br>';
+                }
+                $ms .= '����� �����: ' . date('d.m.Y H:i', $pl['time_start']) . ' - ' . date(
+                        'd.m.Y H:i', $pl['time_finish']
+                    ) . '</div>';
+            }
+            if ($ms == '') {
+                ?>
+                � ������ ������ ��� ���� �� ����� ����.
+                <?php
+            } else {
+                echo $ms;
+            }
+            ?>
+        </div>
+    </fieldset>
+    <fieldset>
+        <legend><span class="legtitle">����� � �������</span></legend>
+        <?php if ($tt[13][0] == 1) {
+            if (isset($_GET['joint']) && $tt[13][0] == 1) {
+                if ($_GET['joint'] == 1) {
+                    //���������� � ����
+                    $nm = htmlspecialchars($_POST['logingo'], null, 'cp1251');
+                    $cnm = mysql_fetch_array(
+                        mysql_query(
+                            'SELECT * FROM `clan_joint` WHERE `name` = "' . mysql_real_escape_string(
+                                $nm
+                            ) . '" AND `type` = "1" LIMIT 1'
+                        )
+                    );
+                    if (isset($cnm['id'])) {
+                        $cnmz = mysql_fetch_array(
+                            mysql_query(
+                                'SELECT * FROM `clan_join` WHERE `alians` = "' . $cnm['id'] . '" AND `clan` = "' . $res['id'] . '" AND `time_end` = "0" AND `time_start` = "0" AND `type` = "1" LIMIT 1'
+                            )
+                        );
+                        if (isset($cnmz['id'])) {
+                            echo '<font color="#FF0000"><b>��� ���� ��� ����� ������ � ������ ����</b></font><br>';
+                        } elseif ($res['join1'] > 0) {
+                            echo '<font color="#FF0000"><b>��� ���� ��� ��������� � �����</b></font><br>';
+                        } else {
+                            mysql_query(
+                                'UPDATE `clan` SET `join1` = "' . $cnm['id'] . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                            );
+                            echo '<font color="#FF0000"><b>�� ������� ������ ������ � ���� &quot;' . $cnm['name'] . '&quot;</b></font><br>';
+                            mysql_query(
+                                'INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`) VALUES ("' . $res['id'] . '","' . $cnm['id'] . '","' . time(
+                                ) . '","1")'
+                            );
+                        }
+                    } else {
+                        echo '<font color="#FF0000"><b>������ ��� ���� � ������ ��������� �� ����������</b></font><br>';
+                    }
+                } else {
+                    //���������� � ������
+                    $nm = htmlspecialchars($_POST['logingo'], null, 'cp1251');
+                    $cnm = mysql_fetch_array(
+                        mysql_query(
+                            'SELECT * FROM `clan_joint` WHERE `name` = "' . mysql_real_escape_string(
+                                $nm
+                            ) . '" AND `type` = "2" LIMIT 1'
+                        )
+                    );
+                    if (isset($cnm['id'])) {
+                        $cnmz = mysql_fetch_array(
+                            mysql_query(
+                                'SELECT * FROM `clan_join` WHERE `alians` = "' . $cnm['id'] . '" AND `clan` = "' . $res['id'] . '" AND `time_end` = "0" AND `time_start` = "0" AND `type` = "2" LIMIT 1'
+                            )
+                        );
+                        if (isset($cnmz['id'])) {
+                            echo '<font color="#FF0000"><b>��� ���� ��� ����� ������ � ������ ������</b></font><br>';
+                        } elseif ($res['join1'] == 0) {
+                            echo '<font color="#FF0000"><b>��� ���������� � ������ ��������� �������� � ����</b></font><br>';
+                        } elseif ($res['join2'] > 0) {
+                            echo '<font color="#FF0000"><b>��� ���� ��� ��������� � �������</b></font><br>';
+                        } else {
+                            mysql_query(
+                                'UPDATE `clan` SET `join1` = "' . $cnm['id'] . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                            );
+                            echo '<font color="#FF0000"><b>�� ������� ������ ������ � ������ &quot;' . $cnm['name'] . '&quot;</b></font><br>';
+                            mysql_query(
+                                'INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`) VALUES ("' . $res['id'] . '","' . $cnm['id'] . '","' . time(
+                                ) . '","2")'
+                            );
+                        }
+                    } else {
+                        echo '<font color="#FF0000"><b>������ ��� ���� � ������ ��������� �� ����������</b></font><br>';
+                    }
+                }
+            } elseif (isset($_GET['newjoint']) && $tt[13][0] == 1) {
+                if ($_GET['newjoint'] == 1) {
+                    //�����
+                    if ($res['join1'] > 0) {
+                        echo '<font color="#FF0000"><b>��� ���� ��� ������� � �����</b></font><br>';
+                    } else {
+                        $nm = htmlspecialchars($_POST['logingo'], null, 'cp1251');
+                        if (str_replace(' ', '', str_replace('	', '', $nm)) == '') {
+                            echo '<font color="#FF0000"><b>������� �������� �����</b></font><br>';
+                        } else {
+                            $cnm = mysql_fetch_array(
+                                mysql_query(
+                                    'SELECT `id` FROM `clan_joint` WHERE `name` = "' . mysql_real_escape_string(
+                                        $nm
+                                    ) . '" LIMIT 1'
+                                )
+                            );
+                            if (!isset($cnm['id'])) {
+                                mysql_query(
+                                    'INSERT INTO `clan_joint` (`time_open`,`name`,`type`,`clan_open`,`clan_glava`) VALUES ("' . time(
+                                    ) . '","' . mysql_real_escape_string(
+                                        $nm
+                                    ) . '","1","' . $res['id'] . '","' . $res['id'] . '")'
+                                );
+                                $id = mysql_insert_id();
+                                $res['join1'] = $id;
+                                mysql_query(
+                                    'INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`,`time_start`) VALUES ("' . $res['id'] . '","' . $id . '","' . time(
+                                    ) . '","1","' . time() . '")'
+                                );
+                                mysql_query(
+                                    'UPDATE `clan` SET `join1` = "' . $id . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                                );
+                                echo '<font color="#FF0000"><b>�� ������� ������� ���� &quot;' . $nm . '&quot;</b></font><br>';
+                            } else {
+                                echo '<font color="#FF0000"><b>������ ��� ���� � ������ ��������� ��� ����������</b></font><br>';
+                            }
+                        }
+                    }
+                } else {
+                    //�������
+                    if ($res['join1'] == 0) {
+                        echo '<font color="#FF0000"><b>��� ���� ������ �������� � �����</b></font><br>';
+                    } elseif ($res['join2'] > 0) {
+                        echo '<font color="#FF0000"><b>��� ���� ��� ������� � �������</b></font><br>';
+                    } else {
+                        $nm = htmlspecialchars($_POST['logingo'], null, 'cp1251');
+                        if (str_replace(' ', '', str_replace('	', '', $nm)) == '') {
+                            echo '<font color="#FF0000"><b>������� �������� �������</b></font><br>';
+                        } else {
+                            $cnm = mysql_fetch_array(
+                                mysql_query(
+                                    'SELECT `id` FROM `clan_joint` WHERE `name` = "' . mysql_real_escape_string(
+                                        $nm
+                                    ) . '" LIMIT 1'
+                                )
+                            );
+                            if (!isset($cnm['id'])) {
+                                mysql_query(
+                                    'INSERT INTO `clan_joint` (`time_open`,`name`,`type`,`clan_open`,`clan_glava`) VALUES ("' . time(
+                                    ) . '","' . mysql_real_escape_string(
+                                        $nm
+                                    ) . '","2","' . $res['id'] . '","' . $res['id'] . '")'
+                                );
+                                $id = mysql_insert_id();
+                                $res['join2'] = $id;
+                                mysql_query(
+                                    'INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`,`time_start`) VALUES ("' . $res['id'] . '","' . $id . '","' . time(
+                                    ) . '","2","' . time() . '")'
+                                );
+                                mysql_query(
+                                    'UPDATE `clan` SET `join2` = "' . $id . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                                );
+                                echo '<font color="#FF0000"><b>�� ������� ������� ������ &quot;' . $nm . '&quot;</b></font><br>';
+                            } else {
+                                echo '<font color="#FF0000"><b>������ ��� ���� � ������ ��������� ��� ����������</b></font><br>';
+                            }
+                        }
+                    }
+                }
+            } elseif (isset($_GET['cancel']) && $tt[13][0] == 1) {
+                $zvn = mysql_fetch_array(
+                    mysql_query(
+                        'SELECT * FROM `clan_join` WHERE `id` = "' . mysql_real_escape_string(
+                            $_GET['cancel']
+                        ) . '" AND `time_start` = "0" AND `time_end` = "0" LIMIT 1'
+                    )
+                );
+                if (!isset($zvn['id'])) {
+                    echo '<font color="#FF0000"><b>������ �� ���������� �� �������</b></font><br>';
+                } else {
+                    $rzv = '';
+                    if ($zvn['clan'] == $res['id']) {
+                        //������ �������������
+                        $szu = mysql_fetch_array(
+                            mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "' . $zvn['alians'] . '" LIMIT 1')
+                        );
+                        if ($szu['type'] == 1) {
+                            $rzv = '���� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $res['name_mini'] . '.gif">' . $res['name'] . '</b> ��������� �� ������������� � ����� <b>' . $szu['name'] . '</b>.';
+                        } else {
+                            $rzv = '���� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $res['name_mini'] . '.gif">' . $res['name'] . '</b> ��������� �� ������������� � ������� <b>' . $szu['name'] . '</b>.';
+                        }
+                    } elseif ($zvn['alians'] == $res['join1']) {
+                        //����� � ������������� � �����
+                        $szu = mysql_fetch_array(
+                            mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "' . $zvn['alians'] . '" LIMIT 1')
+                        );
+                        $zvy = mysql_fetch_array(
+                            mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $zvn['clan'] . '" LIMIT 1')
+                        );
+                        $rzv = '���� <b>' . $szu['name'] . '</b> ������� ����� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $zvy['name_mini'] . '.gif">' . $zvy['name'] . '</b> � �������������.';
+                    } elseif ($zvn['alians'] == $res['join2']) {
+                        //����� � ������������� � �������
+                        $szu = mysql_fetch_array(
+                            mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "' . $zvn['alians'] . '" LIMIT 1')
+                        );
+                        $zvy = mysql_fetch_array(
+                            mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $zvn['clan'] . '" LIMIT 1')
+                        );
+                        $rzv = '������ <b>' . $szu['name'] . '</b> ������� ����� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $zvy['name_mini'] . '.gif">' . $zvy['name'] . '</b> � �������������.';
+                    }
+                    if ($rzv != '') {
+                        echo '<font color="#FF0000"><b>' . $rzv . '</b></font><br>';
+                        mysql_query(
+                            'UPDATE `clan_join` SET `time_end` = "' . time() . '" WHERE `id` = "' . $zvn['id'] . '"'
+                        );
+                    }
+                }
+            } elseif (isset($_GET['ok']) && $tt[13][0] == 1) {
+                $zvn = mysql_fetch_array(
+                    mysql_query(
+                        'SELECT * FROM `clan_join` WHERE `id` = "' . mysql_real_escape_string(
+                            $_GET['ok']
+                        ) . '" AND `time_start` = "0" AND `time_end` = "0" LIMIT 1'
+                    )
+                );
+                if (!isset($zvn['id'])) {
+                    echo '<font color="#FF0000"><b>������ �� ���������� �� �������</b></font><br>';
+                } else {
+                    $rzv = '';
+                    if ($zvn['alians'] == $res['join1']) {
+                        //������������� � �����
+                        $szu = mysql_fetch_array(
+                            mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "' . $zvn['alians'] . '" LIMIT 1')
+                        );
+                        $zvy = mysql_fetch_array(
+                            mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $zvn['clan'] . '" LIMIT 1')
+                        );
+                        $rzv = '���� <b>' . $szu['name'] . '</b> ������ ���� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $zvy['name_mini'] . '.gif">' . $zvy['name'] . '</b>.';
+                        mysql_query(
+                            'UPDATE `clan_join` SET `time_end` = "' . time(
+                            ) . '" WHERE `id` != "' . $zvn['id'] . '" AND `clan` = "' . $szu['clan'] . '" AND `type` = "1"'
+                        );
+                        //mysql_query('INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`) VALUES ("'.$res['id'].'","'.$szu['id'].'","'.time().'","1")');
+                        mysql_query(
+                            'UPDATE `clan` SET `join1` = "' . $zvn['alians'] . '" WHERE `id` = "' . $szu['id'] . '"'
+                        );
+                    } elseif ($zvn['alians'] == $res['join2']) {
+                        //������������� � �������
+                        $szu = mysql_fetch_array(
+                            mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "' . $zvn['alians'] . '" LIMIT 1')
+                        );
+                        $zvy = mysql_fetch_array(
+                            mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $zvn['clan'] . '" LIMIT 1')
+                        );
+                        $rzv = '������ <b>' . $szu['name'] . '</b> ������ ���� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $zvy['name_mini'] . '.gif">' . $zvy['name'] . '</b>.';
+                        mysql_query(
+                            'UPDATE `clan_join` SET `time_end` = "' . time(
+                            ) . '" WHERE `id` != "' . $zvn['id'] . '" AND `clan` = "' . $szu['clan'] . '" AND `type` = "2" AND `time_end` = "0"'
+                        );
+                        //mysql_query('INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`) VALUES ("'.$res['id'].'","'.$szu['id'].'","'.time().'","2")');
+                        mysql_query(
+                            'UPDATE `clan` SET `join2` = "' . $zvn['alians'] . '" WHERE `id` = "' . $szu['id'] . '"'
+                        );
+                    }
+                    if ($rzv != '') {
+                        echo '<font color="#FF0000"><b>' . $rzv . '</b></font><br>';
+                        mysql_query(
+                            'UPDATE `clan_join` SET `time_start` = "' . time() . '" WHERE `id` = "' . $zvn['id'] . '"'
+                        );
+                    }
+                }
+            }
+            ?>
+            <?php if ($res['join1'] == 0 && $res['level'] > 0) { ?>
+                <input type="submit" name="button" id="button" value="������� ����"
+                       onClick="openMod('<b>������� ����</b>','<form action=\'main.php?clan&diplom&newjoint=1\' method=\'post\'>��������: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');"/>
+                <input type="submit" name="button" id="button" value="�������������� � �����"
+                       onClick="openMod('<b>�������������� � �����</b>','<form action=\'main.php?clan&diplom&joint=1\' method=\'post\'>��������: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');"/>
+            <?php }
+
+            if ($res['join2'] == 0 && $res['level'] > 0) { ?>
+                <input type="submit" name="button" id="button" value="�������������� � �������"
+                       onClick="openMod('<b>�������������� � �������</b>','<form action=\'main.php?clan&diplom&joint=2\' method=\'post\'>��������: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');"/>
+                <input type="submit" name="button" id="button" value="������� ������"
+                       onClick="openMod('<b>������� ������</b>','<form action=\'main.php?clan&diplom&newjoint=2\' method=\'post\'>��������: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');"/>
+                <br/><br/><?php } ?><?php } ?>
+        <div style="border:1px solid #CECECE;padding:10px;">
+            <?php
+            $ms = '';
+
+            //����������� ����� � �������
+            if ($res['join1'] > 0) {
+                $j1 = mysql_fetch_array(
+                    mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "' . $res['join1'] . '" LIMIT 1')
+                );
+                if (isset($j1['id'])) {
+                    $ms .= '<div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">';
+                    $ms .= '�� �������� � �������� ����� <b>' . $j1['name'] . '</b>.';
+                    if ($j1['clan_glava'] != $res['id']) {
+                        $ms .= ' <a href="main.php?clan&diplom&delclanme=1"><img title="�������� ����" width="13" height="13" src="https://img.new-combats.com/i/clear.gif"></a>';
+                    }
+                    $ms .= '<Br>������ �����: ';
+                    //$ms .= '<a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif">'.$res['name'].'</a>';
+                    $i = 0;
+                    if (isset($_GET['delclanme'])) {
+                        if ($j1['clan_glava'] != $res['id'] && ($u->info['clan_prava'] == 'glava' || $u->info['admin'] > 0)) {
+                            $dels = mysql_fetch_array(
+                                mysql_query(
+                                    'SELECT * FROM `clan_join` WHERE `clan` = "' . $res['id'] . '" AND `alians` = "' . $j1['id'] . '" AND `time_end` = "0" AND `time_start` > 0 LIMIT 1'
+                                )
+                            );
+                            if (isset($dels['id'])) {
+                                mysql_query(
+                                    'UPDATE `clan` SET `join1` = "0" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                                );
+                                mysql_query(
+                                    'UPDATE `clan_join` SET `time_end` = "' . time(
+                                    ) . '" WHERE `id` = "' . $dels['id'] . '" LIMIT 1'
+                                );
+                                echo '<div><b><font color=red>�� ������� �������� ���� &quot;' . $j1['name'] . '&quot;</font></b></div>';
+                                header('location: main.php?clan&diplom');
+                            } else {
+                                echo '<div><b><font color=red>��� ���� �� ������� � ������ �����</font></b></div>';
+
+                            }
+                        } else {
+                            echo '<div><b><font color=red>�� �� ������ �������� ������ ����</font></b></div>';
+                        }
+                    } elseif ($j1['clan_glava'] == $res['id'] && ($u->info['clan_prava'] == 'glava' || $u->info['admin'] > 0)) {
+                        if (isset($_GET['delclan'])) {
+                            $delc = mysql_fetch_array(
+                                mysql_query(
+                                    'SELECT * FROM `clan` WHERE `id` = "' . mysql_real_escape_string(
+                                        $_GET['delclan']
+                                    ) . '" LIMIT 1'
+                                )
+                            );
+                            $dels = mysql_fetch_array(
+                                mysql_query(
+                                    'SELECT * FROM `clan_join` WHERE `clan` = "' . $delc['id'] . '" AND `alians` = "' . $j1['id'] . '" AND `time_end` = "0" AND `time_start` > 0 LIMIT 1'
+                                )
+                            );
+
+                            if (isset($delc['id']) && isset($dels['id'])) {
+                                if ($delc['id'] != $res['id']) {
+                                    mysql_query(
+                                        'UPDATE `clan` SET `join1` = "0" WHERE `id` = "' . $dels['id'] . '" LIMIT 1'
+                                    );
+                                    mysql_query(
+                                        'UPDATE `clan_join` SET `time_end` = "' . time(
+                                        ) . '" WHERE `id` = "' . $dels['id'] . '" LIMIT 1'
+                                    );
+                                    echo '<div><b><font color=red>���� &quot;' . $delc['name'] . '&quot; ��� �������� �� ������� �����</font></b></div>';
+                                    header('location: main.php?clan&diplom');
+                                } else {
+                                    echo '<div><b><font color=red>���� ������������� �� ���� �� ����� �������� ������ ����</font></b></div>';
+                                }
+                            } else {
+                                echo '<div><b><font color=red>���� �� ������� � ������ �����</font></b></div>';
+                            }
+                        }
+                    }
+                    $sp1 = mysql_query(
+                        'SELECT `u`.*,`s`.* FROM `clan_join` AS `u` LEFT JOIN `clan` AS `s` ON `s`.`id` = `u`.`clan` WHERE `u`.`alians` = "' . $j1['id'] . '" AND `u`.`time_end` = "0" AND `u`.`time_start` > 0'
+                    );
+                    while ($pl1 = mysql_fetch_array($sp1)) {
+                        if ($i > 0) {
+                            $ms .= ',';
+                        }
+                        $ms .= ' <a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $pl1['name_mini'] . '.gif">' . $pl1['name'] . '</a>';
+                        if ($j1['clan_glava'] == $res['id']) {
+                            if ($res['id'] != $pl1['clan']) {
+                                if ($u->info['clan_prava'] == 'glava' || $u->info['admin'] > 0) {
+                                    $ms .= ' <a title="������� �� �����" href="main.php?clan&diplom&delclan=' . $pl1['clan'] . '"><img width="13" height="13" src="https://img.new-combats.com/i/clear.gif"></a>';
+                                }
+                            }
+                        }
+                        $i++;
+                    }
+                    if ($j1['clan_glava'] == $res['id'] && ($u->info['clan_prava'] == 'glava' || $u->info['admin'] > 0)) {
+                        $ms .= '<br>�� ���������� �����, ������ ���������� ������ ����� ����:<br>';
+                        $cnls = '<i>���������</i>';
+                        //$ms .= '<form method="post" action="?clan&diplom&savecanals='.$res['id'].'"><a style="display:inline-block;width:210px;" href="javascript:void(0)"><img src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif">'.$res['name'].'</a> &nbsp; '.$cnls.' &nbsp; <input type="submit" value="���������"></form>';
+                        $sp1 = mysql_query(
+                            'SELECT `u`.*,`s`.* FROM `clan_join` AS `u` LEFT JOIN `clan` AS `s` ON `s`.`id` = `u`.`clan` WHERE `u`.`alians` = "' . $j1['id'] . '" AND `u`.`time_end` = "0" AND `u`.`time_start` > 0'
+                        );
+                        while ($pl1 = mysql_fetch_array($sp1)) {
+                            $ms .= '<form method="post" action="?clan&diplom&savecanals=' . $pl1['id'] . '"><a style="display:inline-block;width:210px;" href="javascript:void(0)"><img src="https://img.new-combats.com/i/clan/' . $pl1['name_mini'] . '.gif">' . $pl1['name'] . '</a> &nbsp; ' . $cnls . ' &nbsp; <input type="submit" value="���������"></form>';
+                        }
+                    }
+                    //����������� �������� ������ �����
+
+                    $ms .= '</div>';
+                }
+            }
+            if ($res['join2'] > 0) {
+                $j1 = mysql_fetch_array(
+                    mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "' . $res['join2'] . '" LIMIT 1')
+                );
+                if (isset($j1['id'])) {
+                    $ms .= '<div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">';
+                    $ms .= '�� �������� � �������� ������� <b>' . $j1['name'] . '</b>. ������ �������: ';
+                    //$ms .= '<a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif">'.$res['name'].'</a>';
+                    $sp1 = mysql_query(
+                        'SELECT `u`.*,`s`.* FROM `clan_join` AS `u` LEFT JOIN `clan` AS `s` ON `s`.`id` = `u`.`clan` WHERE `u`.`alians` = "' . $j1['id'] . '" AND `u`.`time_end` = "0" AND `u`.`time_start` > 0'
+                    );
+                    $i = 0;
+                    while ($pl1 = mysql_fetch_array($sp1)) {
+                        if ($i > 0) {
+                            $ms .= ', ';
+                        }
+                        $ms .= '<a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $pl1['name_mini'] . '.gif">' . $pl1['name'] . '</a>';
+                        $i++;
+                    }
+                    $ms .= '<br>�� ���������� �������.<br>';
+                    $ms .= '</div>';
+                }
+            }
+
+            //����� � ������� � ������� ������� ����
+
+
+            if ($ms == '') {
+                ?>
+                <center>� ������ ������ � ������ ����� ��� ��������������� ���������.</center>
+            <?php } else {
+                echo $ms;
+            } ?>
+        </div>
+        <?php if ($tt[13][0] == 1) { ?>
+            <br/>
+            <center>������ �� �����</center>
+            <br/>
+            <table width="100%" border="0" cellspacing="0" cellpadding="2">
+                <tr>
+                    <td width="50%" align="center" valign="top">
+                        <div style="border:1px solid #CECECE;padding:10px;">
+                            <a href="javascript:void(0)">���� ������ �� ������������ �����</a>
+                            <br/>
+                            <br/>
+                            <?php
+                            $ms = '';
+                            $sp = mysql_query(
+                                'SELECT * FROM `clan_join` WHERE `clan` = "' . mysql_real_escape_string(
+                                    $res['id']
+                                ) . '" AND `time_start` = "0" AND `time_end` = "0" AND `type` = "1"'
+                            );
+                            while ($pl = mysql_fetch_array($sp)) {
+                                $suz = mysql_fetch_array(
+                                    mysql_query(
+                                        'SELECT * FROM `clan_joint` WHERE `id` = "' . $pl['alians'] . '" LIMIT 1'
+                                    )
+                                );
+                                $ms .= '<div style="border-bottom:1px solid #cac9c7;text-align:left;margin-bottom:5px;padding-bottom:5px;">�� ������ ������ �� ���������� � ���� <b>' . $suz['name'] . '</b>.<br><div style="float:left;">����� ������ ������: ' . date(
+                                        'd.m.Y H:i', $pl['time']
+                                    ) . '</div><a style="float:right;" href="?clan&diplom&cancel=' . $pl['id'] . '">��������</a><br></div>';
+                            }
+                            if ($ms == '') {
+                                ?>
+                                � ���� ����� �� ������� ������
+                            <?php } else {
+                                echo $ms;
+                            } ?>
+                        </div>
+                    </td>
+                    <td align="center" valign="top">
+                        <div style="border:1px solid #CECECE;padding:10px;">
+                            <a href="javascript:void(0)">������ �� ������������ ����� � ����</a>
+                            <br/>
+                            <br/>
+                            <?php
+                            $ms = '';
+                            $sp = mysql_query(
+                                'SELECT * FROM `clan_join` WHERE `alians` = "' . mysql_real_escape_string(
+                                    $res['join1']
+                                ) . '" AND `time_start` = "0" AND `time_end` = "0" AND `type` = "1"'
+                            );
+                            while ($pl = mysql_fetch_array($sp)) {
+                                $suz = mysql_fetch_array(
+                                    mysql_query(
+                                        'SELECT * FROM `clan_joint` WHERE `id` = "' . $pl['alians'] . '" LIMIT 1'
+                                    )
+                                );
+                                $clz = mysql_fetch_array(
+                                    mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $pl['clan'] . '" LIMIT 1')
+                                );
+                                $ms .= '<div style="border-bottom:1px solid #cac9c7;text-align:left;margin-bottom:5px;padding-bottom:5px;">���� <a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $clz['name_mini'] . '.gif">' . $clz['name'] . '</a> ����� ������ �� ���������� � ��� ���� <b>' . $suz['name'] . '</b>.<br><div style="float:left;">����� ������ ������: ' . date(
+                                        'd.m.Y H:i', $pl['time']
+                                    ) . '</div><div style="float:right;"><a href="?clan&diplom&ok=' . $pl['id'] . '">�������</a> &nbsp; <a href="?clan&diplom&cancel=' . $pl['id'] . '">��������</a></div><br></div>';
+                            }
+                            if ($ms == '') {
+                                ?>
+                                � ���� ����� �� ������� ������
+                            <?php } else {
+                                echo $ms;
+                            } ?>
+                        </div>
+                    </td>
+                </tr>
+            </table>
+            <br/>
+            <center>������ �� �������</center>
+            <br/>
+            <table width="100%" border="0" cellspacing="0" cellpadding="2">
+                <tr>
+                    <td width="50%" align="center" valign="top">
+                        <div style="border:1px solid #CECECE;padding:10px;">
+                            <a href="javascript:void(0)">���� ������ �� ������������ �������</a>
+                            <br/>
+                            <br/>
+                            <?php
+                            $ms = '';
+                            $sp = mysql_query(
+                                'SELECT * FROM `clan_join` WHERE `clan` = "' . mysql_real_escape_string(
+                                    $res['id']
+                                ) . '" AND `time_start` = "0" AND `time_end` = "0" AND `type` = "2"'
+                            );
+                            while ($pl = mysql_fetch_array($sp)) {
+                                $suz = mysql_fetch_array(
+                                    mysql_query(
+                                        'SELECT * FROM `clan_joint` WHERE `id` = "' . $pl['alians'] . '" LIMIT 1'
+                                    )
+                                );
+                                $ms .= '<div style="border-bottom:1px solid #cac9c7;text-align:left;margin-bottom:5px;padding-bottom:5px;">�� ������ ������ �� ���������� � ������ <b>' . $suz['name'] . '</b>.<br><div style="float:left;">����� ������ ������: ' . date(
+                                        'd.m.Y H:i', $pl['time']
+                                    ) . '</div><a style="float:right;" href="?clan&diplom&cancel=' . $pl['id'] . '">��������</a><br></div>';
+                            }
+                            if ($ms == '') {
+                                ?>
+                                � ���� ����� �� ������� ������
+                            <?php } else {
+                                echo $ms;
+                            } ?>
+                        </div>
+                    </td>
+                    <td align="center" valign="top">
+                        <div style="border:1px solid #CECECE;padding:10px;">
+                            <a href="javascript:void(0)">������ �� ������������ ������� � ����</a>
+                            <br/>
+                            <br/>
+                            <?php
+                            $ms = '';
+                            $sp = mysql_query(
+                                'SELECT * FROM `clan_join` WHERE `alians` = "' . mysql_real_escape_string(
+                                    $res['join2']
+                                ) . '" AND `time_start` = "0" AND `time_end` = "0" AND `type` = "2"'
+                            );
+                            while ($pl = mysql_fetch_array($sp)) {
+                                $suz = mysql_fetch_array(
+                                    mysql_query(
+                                        'SELECT * FROM `clan_joint` WHERE `id` = "' . $pl['alians'] . '" LIMIT 1'
+                                    )
+                                );
+                                $clz = mysql_fetch_array(
+                                    mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $pl['clan'] . '" LIMIT 1')
+                                );
+                                $ms .= '<div style="border-bottom:1px solid #cac9c7;text-align:left;margin-bottom:5px;padding-bottom:5px;">���� <a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $clz['name_mini'] . '.gif">' . $clz['name'] . '</a> ����� ������ �� ���������� � ��� ������ <b>' . $suz['name'] . '</b>.<br><div style="float:left;">����� ������ ������: ' . date(
+                                        'd.m.Y H:i', $pl['time']
+                                    ) . '</div><div style="float:right;"><a href="?clan&diplom&ok=' . $pl['id'] . '">�������</a> &nbsp; <a href="?clan&diplom&cancel=' . $pl['id'] . '">��������</a></div><br></div>';
+                            }
+                            if ($ms == '') {
+                                ?>
+                                � ���� ����� �� ������� ������
+                            <?php } else {
+                                echo $ms;
+                            } ?>
+                        </div>
+                    </td>
+                </tr>
+            </table>
+        <?php } ?>
+    </fieldset>
+<?php } elseif (isset($_GET['deposit'])) {
+
+    $itmc = mysql_fetch_array(
+        mysql_query(
+            'SELECT COUNT(`id`) FROM `items_users` WHERE `uid` = "-21' . $res['id'] . '" AND `delete` = 0 LIMIT 1'
+        )
+    );
+    $itmc = $itmc[0];
+    $itms = mysql_fetch_array(
+        mysql_query(
+            'SELECT `iu`.*,`im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` >= 0 AND `iu`.`delete` = "0"
+		AND `iu`.`id` = "' . mysql_real_escape_string($_GET['ungive_itm']) . '" LIMIT 1'
+        )
+    );
+    $ps = $u->lookStats($itms['data']);
+    $ps['cl'] = explode('#', $ps['toclan']);
+    $use_s = $ps['cl'][1];
+    if (isset($_GET['ungive_itm']) && $ps['cl'][0] == $res['id'] && ($tt[14][0] == 1 || ($u->info['id'] == $use_s))) {
+        $itm = mysql_fetch_array(
+            mysql_query(
+                'SELECT `iu`.*,`im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` >= 0 AND `iu`.`delete` = "0"
+		AND `iu`.`id` = "' . mysql_real_escape_string($_GET['ungive_itm']) . '" LIMIT 1'
+            )
+        );
+        if (isset($itm['id'])) {
+            $btlud = mysql_fetch_array(
+                mysql_query('SELECT `id`,`battle` FROM `users` WHERE `id` = "' . $itm['uid'] . '" LIMIT 1')
+            );
+            if ($u->testBattle($btlud['battle']) == true) {
+                echo '<font color="#FF0000"><b>������ ������� �������� � ��������� � ���</b></font><br>';
+            } else {
+                echo $u->ungive_itm_cl($_GET['ungive_itm'], $u->info, $res['id']);
+            }
+        }
+    } elseif (isset($_GET['take_itm']) && $tt[4][0] == 1) {
+        $itm = mysql_fetch_array(
+            mysql_query(
+                'SELECT `iu`.*,`im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid`="-21' . $res['id'] . '" AND `iu`.`delete`="0"
+		AND `iu`.`id` = "' . mysql_real_escape_string($_GET['take_itm']) . '" LIMIT 1'
+            )
+        );
+        if (isset($itm['id'])) {
+            echo $u->take_itm_cl($_GET['take_itm'], $u->info, $res['id']);
+        }
+    } elseif (isset($_GET['give_itm'])) {
+        $itm = mysql_fetch_array(
+            mysql_query(
+                'SELECT `iu`.*,`im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `im`.`inslot` > 0 AND `iu`.`gift` = "" AND `iu`.`data` NOT LIKE "%frompisher=%"
+		AND `iu`.`id` = "' . mysql_real_escape_string($_GET['give_itm']) . '" LIMIT 1'
+            )
+        );
+        if ($itmc >= $lvl_prava[$res['level']][5]) {
+            echo '<font color="#FF0000"><b>��������� �����������</b></font><br>';
+        } elseif (isset($itm['id'])) {
+            echo $u->set_cl_item($_GET['give_itm'], $u->info, $res['id']);
+        }
+    }
+    if ($tt[4][0] == 1) {
+        $itm_clan = $u->genInv(
+            66,
+            '(`iu`.`uid` = "-21' . $u->info['clan'] . '" OR `iu`.`data` LIKE "%toclan=' . $u->info['clan'] . '#%") AND `iu`.`delete` = 0 AND `iu`.`inShop` = 0 ORDER BY `lastUPD` DESC'
+        );
+    } else {
+        $itm_clan[2] = '<br /><br /><center>� ��� ��� ������� � ������������� ���������</center>';
+    }
+    $itm_user = $u->genInv(
+        65,
+        '`iu`.`uid` = ' . $u->info['id'] . ' AND `iu`.`delete` = 0 AND `iu`.`inOdet` = 0 AND `iu`.`inShop` = 0 AND `im`.`inslot` > 0 AND `iu`.`gift` = "" AND `iu`.`data` NOT LIKE "%frompisher=%" ORDER BY `lastUPD` DESC'
+    );
+
+    ?>
+    <div class="box visible">
+        <table width="100%" border="0" cellspacing="0" cellpadding="0">
+            <tr>
+                <td width="50%" valign="top">
+                    <fieldset style="margin:0;padding:0">
+                        <legend><span
+                                    class="legtitle">��������� (��������� : <?= $itmc ?>/<?= $lvl_prava[$res['level']][5] ?>)</span>
+                        </legend>
+                        <?php if ($itm_clan[2] != '') { ?>
+                            <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                <?= $itm_clan[2] ?>
+                            </table>
+                        <?php } else {
+                            echo '<center><br />��������� ����� �����<br /><br /></center>';
+                        } ?>
+                    </fieldset>
+                </td>
+                <td width="50%" valign="top">
+                    <fieldset style="margin:0;padding:0">
+                        <legend><span class="legtitle">������</span></legend>
+                        <?php if ($itm_user[2] != '') { ?>
+                            <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                <?= $itm_user[2] ?>
+                            </table>
+                        <?php } else {
+                            echo '<center><br />������ ����<br /><br /></center>';
+                        } ?>
+                    </fieldset>
+                </td>
+            </tr>
+        </table>
+    </div>
+<?php } elseif (isset($_GET['titul']) && $tt[11][0] == 1) { ?>
+    <script>
+        function editTitul(id) {
+            if ($('#edpnltitul' + id).css('display') == 'none') {
+                $('#edpnltitul' + id).css({'display': ''});
+            } else {
+                $('#edpnltitul' + id).css({'display': 'none'});
+            }
+        }
+    </script>
+    <div class="box visible">
+        <?php
+        if (isset($_POST['tituladd'])) {
+            //��������� ����� �����
+            $tc = mysql_fetch_array(
+                mysql_query(
+                    'SELECT COUNT(*) FROM `clan_tituls` WHERE `clan` = "' . $res['id'] . '" AND `delete` = "0" LIMIT 25'
+                )
+            );
+            if ($tc[0] >= 20) {
+                echo '<font color="#FF0000"><b>������ ��������� ����� 25-�� �������, ��� ���������� ������ ������� ������</b></font><br>';
+            } else {
+                $nm = htmlspecialchars($_POST['tituladd'], null, 'cp1251');
+                if (str_replace(' ', '', str_replace('	', '', $nm)) == '') {
+                    echo '<font color="#FF0000"><b>�������� ������ �� ������ ���� ������</b></font><br>';
+                } else {
+                    mysql_query(
+                        'INSERT INTO `clan_tituls` (`clan`,`user_add`,`time_add`,`name`) VALUES ("' . $res['id'] . '","' . $u->info['id'] . '","' . time(
+                        ) . '","' . mysql_real_escape_string($nm) . '")'
+                    );
+                    echo '<font color="#FF0000"><b>����� ��� ������� ��������</b></font><br>';
+                }
+            }
+        } elseif (isset($_GET['save'])) {
+            //��������� �����
+            $tc = mysql_fetch_array(
+                mysql_query(
+                    'SELECT * FROM `clan_tituls` WHERE `clan` = "' . $res['id'] . '" AND `id` = "' . mysql_real_escape_string(
+                        $_GET['save']
+                    ) . '" AND `delete` = "0" LIMIT 1'
+                )
+            );
+            if (isset($tc['id'])) {
+                $tc['info'] = htmlspecialchars($_POST['t_info'], null, 'cp1251');
+                $i = 1;
+                $tc['canals'] = '';
+                while ($i <= 9) {
+                    if ($_POST['t_klan' . $i]) {
+                        $tc['canals'] .= '1';
+                    } else {
+                        $tc['canals'] .= '0';
                     }
                     $i++;
                 }
+                $i = 0;
+                $tc['prava'] = '';
+                while ($i <= 20) {
+                    if ($_POST['t_tr' . $i]) {
+                        $tc['prava'] .= '1';
+                    } else {
+                        $tc['prava'] .= '0';
+                    }
+                    $i++;
+                }
+                $_POST['colorsp'] = preg_replace('/[^a-z�-��0-9]/i', '', $_POST['colorsp']);
+                // ���
 
-                echo $seet;
-
-?>
-</p>
-</table>
-
-    </fieldset>
-    <? */} ?>
-	
-	<fieldset style="border:1px dashed #eeeeee">
-      <legend><span class="legtitle">�������</span></legend>
-      <?
-	  	  
-	  $c_r = ''; $c_c = ''; $c_p = '';	 
-	  
-	  if(isset($_GET['add'],$_POST['textadd']) && $tt[2][0] == 1) {
-		 $lmsg = mysql_fetch_array(mysql_query('SELECT `id` FROM `clan_news` WHERE `uid` = "'.$u->info['id'].'" AND `time` > '.(time()-10).' LIMIT 1'));
-		 if(isset($lmsg['id'])) {
-			 $c_r .= '<font color="#FF0000"><b>������ ��������� ��������� ���� ������ ���� � 10 ������</b></font><br>'; 
-		 }else{
-			 $tadd = htmlspecialchars($_POST['textadd'],NULL,'cp1251');
-			 $ttadd = htmlspecialchars($_POST['titleadd'],NULL,'cp1251');
-			 if(str_replace(' ','',str_replace('	','',$tadd)) == '') {
-				 $c_r .= '<font color="#FF0000"><b>������ ���������� ������ �������</b></font><br>';  
-			 }elseif(str_replace(' ','',str_replace('	','',$ttadd)) == '') {
-				 $c_r .= '<font color="#FF0000"><b>������ ���������� ������ ���������</b></font><br>';  
-			 }else{
-				$tadd = str_replace("\n",'<br>',$tadd);
-				mysql_query('INSERT INTO `clan_news` (`clan`,`time`,`ddmmyyyy`,`uid`,`ip`,`login`,`title`,`text`) VALUES (
-				"'.$res['id'].'","'.time().'","'.date('d.m.Y').'","'.$u->info['id'].'","'.$u->info['ip'].'","'.$u->info['login'].'","'.mysql_real_escape_string($ttadd).'","'.mysql_real_escape_string($tadd).'"
-				)');
-				$c_r .= '<font color="#FF0000"><b>������� ���� ������� ���������</b></font><br>'; 
-			 }
-		 }
-	  }elseif(isset($_GET['delete']) && $tt[2][0] == 1) {
-		  $upd = mysql_query('UPDATE `clan_news` SET `delete` = "'.$u->info['id'].'" WHERE `clan` = "'.$res['id'].'" AND `delete` = "0" AND `uid` != "0" AND `id` = "'.mysql_real_escape_string($_GET['delete']).'" LIMIT 1');
-		  if($upd) {
-			 $c_r .= '<font color="#FF0000"><b>������� ���� ������� �������</b></font><br>';  
-		  }else{
-			  $c_r .= '<font color="#FF0000"><b>������� �� �������</b></font><br>';  
-		  }
-	  }
-	   
-	  $dd = date('d');
-	  $mm = date('m');
-	  $yy = date('Y');	
-	  
-	  if(isset($_GET['mm'])) {
-		 $mm =  ceil((int)$_GET['mm']);
-	  }
-	  if(isset($_GET['dd'])) {
-		 $dd =  ceil((int)$_GET['dd']);
-	  }
-	  if(isset($_GET['yy'])) {
-		 $yy =  ceil((int)$_GET['yy']);
-	  }
-	    
-	  $mml = ceil($mm)-1;
-	  $mmr = ceil($mm)+1;	  
-	  $yyl = $yy;
-	  $yyr = $yy;	  
-	  if($mml < 1) {
-		$yyl--;
-		$mml = 12;  
-	  }	  
-	  if($mmr > 12) {
-		$yyr++;
-		$mmr = 1;  
-	  }	
-	  $dds = array('','��','��','��','��','��','<font color="#981115">��</font>','<font color="#981115">��</font>');
-	  $mms = array('','������','�������','����','������','���','����','����','������','��������','�������','������','�������');
-	  $num = 0; $lday = 0;
-	  for($i = 0; $i < 7; $i++)
-	  {
-		$dayofweek = date('w',mktime(0, 0, 0, $mm, $day_count, $yy));
-		$dayofweek = $dayofweek - 1;
-		if($dayofweek == -1) $dayofweek = 6;
-	
-		if($dayofweek == $i)
-		{
-		  $week[$num][$i] = $day_count;
-		  $lday = $day_count;
-		  $day_count++;
-		}else{
-		  $week[$num][$i] = "";
-		}
-	  }
-	  
-	  function freenews($d,$m,$y) {
-		  global $res;
-		  $r = $d;
-		  if($d < 9) {
-			 $d = '0'.$d; 
-		  }
-		  if($m < 9) {
-			 $m = '0'.((int)$m); 
-		  }
-		  $n = mysql_fetch_array(mysql_query('SELECT `id` FROM `clan_news` WHERE `clan` = "'.$res['id'].'" AND `delete` = "0" AND `ddmmyyyy` = "'.$d.'.'.$m.'.'.$y.'" LIMIT 1'));
-		  if(isset($n['id'])) {
-			 $r = '<a style="text-decoration:underline;" href="?clan&events&ftr=1&mm='.$m.'&yy='.$y.'&dd='.$d.'">'.$r.'</a>'; 
-		  }
-		  return $r;
-	  }
-	  
-	  $i = 1;
-	  $c_c .= '<div style="width:260px;border:1px solid #9d9d9d;padding:10px;background-color:#ecebe7">';
-	  if($tt[2][0] > 0) {
-	  	$c_c .= '<center><input type="button" value="�������� �������" onClick="addNewEvent();"></center><br>';
-	  }
-	  $c_c .= '<div><span style="float:left" class="dnbx" title="'.$mms[$mml].' '.$yyl.'" onclick="location=\'?clan&events&mm='.$mml.'&yy='.$yyl.'\'">&lt;</span><span style="float:right" class="dnbx" onclick="location=\'?clan&events&mm='.$mmr.'&yy='.$yyr.'\'" title="'.$mms[$mmr].' '.$yyr.'">&gt;</span><center class="dnbx5">'.$yy.' '.$mms[ceil($mm)].'</center></div><br>';
-	  while($i <= 49) {
-		 if($i <= 7) {
-		 	$c_c .= '<small class="dnbx1"><b>'.$dds[$i].'</b></small>';
-		 }else{
-			if($i-7 > 7) {
-				$lday++;
-				if(date('d',mktime(0, 0, 0, $mm, $lday)) == $lday) {
-					if($lday == date('d') && $mm == ceil(date('m')) && $yy == date('Y')) {
-						$c_c .= '<span class="dnbx2">'.freenews($lday,$mm,$yy).'</span>';
-					}else{
-						$c_c .= '<span class="dnbx">'.freenews($lday,$mm,$yy).'</span>';
-					}
-				}else{
-					$c_c .= '<span class="dnbx1">&nbsp;</span>';
-				}
-			}else{
-				if($week[0][$i-8] > 0) {
-					if($week[0][$i-8] == date('d') && $mm == ceil(date('m')) && $yy == date('Y')) {
-						$c_c .= '<span class="dnbx2">'.freenews($week[0][$i-8],$mm,$yy).'</span>';
-					}else{
-						$c_c .= '<span class="dnbx"">'.freenews($week[0][$i-8],$mm,$yy).'</span>';
-					}
-				}elseif($lday > 0) {
-					$c_c .= '<span class="dnbx1">&nbsp;</span>';
-				}
-			}
-		 }
-		 if($i == 7 || $i == 14 || $i == 21 || $i == 28 || $i == 35 || $i == 42) {
-			if($lday > 0 || $i != 14) {
-				$c_c .= '<br>';
-			}
-		 }
-		 $i++; 
-	  }
-	  $c_c .= '</div>';
-	  
-		if($tt[1][0] == 1) {
-		  $cnftr = '';
-		  if(isset($_GET['ftr'])) {
-			  if($_GET['ftr'] == 1) {
-				$dd1 = $dd;
-				$mm1 = $mm;
-				$yy1 = $yy;
-				if($dd1 < 9) {
-					$dd1 = '0'.$dd1;
-				}
-				if($mm1 < 9) {
-					$mm1 = '0'.$mm1;
-				}
-			  	$cnftr = ' AND `ddmmyyyy` = "'.mysql_real_escape_string($dd1.'.'.$mm1.'.'.$yy1).'"';
-			  }
-		  }
-			$pg = round((int)$_GET['pg']);
-			if($pg < 1) {
-				$pg = 1;	
-			}
-			$pgssee = ceil(($pg-1)*5);
-		  
-			$pgs = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `clan_news` WHERE `clan` = "'.$res['id'].'" AND `delete` = "0"'.$cnftr));
-			$pgs = $pgs[0];
-			$pga = ceil($pgs/5);
-	
-			$i = 1;
-			while($i <= $pga) {
-				if($pg == $i) {
-					$c_p .= ' <b>'.$i.'</b> ';
-				}else{
-					if(isset($_GET['ftr'])) {
-						$c_p .= ' <a href="?clan&events&dd='.$dd.'&mm='.$mm.'&yy='.$yy.'&ftr='.$_GET['ftr'].'&pg='.$i.'">'.$i.'</a> ';
-					}else{
-						$c_p .= ' <a href="?clan&events&pg='.$i.'">'.$i.'</a> ';
-					}
-				}
-				$i++;
-			}
-			
-			if($c_p != '') {
-				$c_p = '�������: '.$c_p;
-			}
-		  
-		  $sp = mysql_query('SELECT * FROM `clan_news` WHERE `clan` = "'.$res['id'].'" AND `delete` < 1'.$cnftr.' ORDER BY `id` DESC LIMIT '.mysql_real_escape_string($pgssee).',5');
-		  while($pl = mysql_fetch_array($sp)) {
-			  if($pl['uid'] > 0) {
-				$login = $u->microLogin($pl['uid'],1);
-				if($tt[2][0] == 1){
-					$pl['text'] = '<img src="https://img.new-combats.com/i/clear.gif" width="13" height="13" title="������� �������" class="leftimg" style="cursor:pointer" onclick="location=\'main.php?clan&events&pg='.ceil($pg).'&delete='.$pl['id'].'\'">'.$pl['text'];
-				}
-			  }else{
-				$login = '';  
-			  }
-			  
-			  $c_r .= '
-	<table width="100%" border="0" style="border:1px solid #aeaeae" cellspacing="0" cellpadding="5">
-	  <tr>
-		<td bgcolor="#c4c3c1"><div style="float:left"><i>'.date('d.m.Y H:i',$pl['time']).'</i> &nbsp; &nbsp; &nbsp; <a class="a" href="javascript:void(0)">'.$pl['title'].'</a></div><div style="float:right">'.$login.'</div></td>
-	  </tr>
-	  <tr>
-		<td>'.$pl['text'].'</td>
-	  </tr>
-	</table><br>';
-		  }	 
-	  }
-	  if($c_r == '') {
-		 $c_r .= '<br><br><br><br><br><br><br><br><center><b>������� ���� ��� ��� ����� ����� �� ����������� ��� � ��� ������</b></center>'; 
-	  }
-	   
-	  ?>
-      <table width="100%" border="0" cellspacing="0" cellpadding="10">
-      <tr>
-        <td align="left" valign="top"><?=$c_r?></td>
-        <td width="300" align="center" valign="top"><?=$c_c?></td>
-      </tr>
-      <tr>
-        <td align="right" valign="top"><?=$c_p?></td>
-        <td align="left" valign="top">&nbsp;</td>
-      </tr>
-      </table>
-    </fieldset>
-   </div>
-   <? }elseif(isset($_GET['control'])) { ?> 
-   <script>
-	function changeLogin(selObj){
-	  selid = selObj.options[selObj.selectedIndex].value;
-	  $('#sn_titul').val($('#slg'+selid).attr('vtitul'));
-	  $('#sn_zvanie').val($('#slg'+selid).attr('vzvanie'));
-	  $('#sn_canals').val($('#slg'+selid).attr('vcanals'));
-	  
-	  if($('#slg'+selid).attr('vtitul') == '����� �����') {
-		  $('#rp_titul').attr({'disabled':'disabled'});
-		  $('#sn_zvanie').attr({'disabled':'disabled'});
-		  $('#sn_canals').attr({'disabled':'disabled'});
-		  $('#rp_save').attr({'disabled':'disabled'});
-	  }else{
-		  $('#rp_titul').attr({'disabled':false});
-		  $('#sn_zvanie').attr({'disabled':false});
-		  $('#sn_canals').attr({'disabled':false});
-		  $('#rp_save').attr({'disabled':false});
-	  }
-	}
-   </script>
-   <div class="box visible">
-    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-		��� ���������� ������: <a href="javascript:void(0)"><? if($res['politic'] == 1) { ?>���������<? }else{ ?>����������<? } ?></a>
-    </div>
-    <?
-	$c_pr = array(
-		100, //�������
-		50, //�������
-		100 //������� �����
-	);
- 
-	if(isset($_POST['svb_canals']) && $tt[11][0] == 1) {
-		echo '<font color="#FF0000"><b>������ ���� ���������</b></font><br>';
-		$res['canals'] = $_POST['svb_canals'];
-		$rce = explode();
-		$i = 1;
-		while($i <= 9) {
-			
-			$i++;
-		}
-		mysql_query('UPDATE `clan` SET `canals` = "'.mysql_real_escape_string($res['canals']).'" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-	}elseif(isset($_POST['svb_site']) && $tt[11][0] == 1) {
-		echo '<font color="#FF0000"><b>�������� ���� ��������</b></font><br>';
-		$res['site'] = $_POST['svb_site'];
-		$rce = explode();
-		$i = 1;
-		while($i <= 9) {
-			
-			$i++;
-		}
-		mysql_query('UPDATE `clan` SET `site` = "'.mysql_real_escape_string($res['site']).'" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-	
-	}elseif(isset($_POST['svb_give_money']) && $tt[7][0] == 1) {
-		$mn = round((int)$_POST['svb_give_money'],2);
-		if($mn >= 0.01) {
-			if($res['money1'] < $mn) {
-				echo '<font color="#FF0000"><b>� ����� ������������ �������</b></font><br>';
-			}else{
-				$res['money1'] -= $mn;
-				$u->info['money'] += $mn;
-				echo '<font color="#FF0000"><b>�� ������� ����� � ����� ����� '.$mn.' ��.</b></font><br>';
-				mysql_query('UPDATE `clan` SET `money1` = "'.mysql_real_escape_string($res['money1']).'" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-				mysql_query('UPDATE `users` SET `money` = "'.mysql_real_escape_string($u->info['money']).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
-				mysql_query('INSERT INTO `clan_operations` (`clan`,`time`,`type`,`text`,`val`,`uid`) VALUES ("'.$res['id'].'","'.time().'","1","'.$u->info['login'].'","'.mysql_real_escape_string($mn).'","'.$u->info['id'].'")');
-			}
-		}
-	}elseif(isset($_POST['svb_give_money2']) && $u->info['clan_prava'] == 'glava') {
-		$mn = round((int)$_POST['svb_give_money2'],2);
-		if($mn >= 0.01) {
-			if($res['money2'] < $mn) {
-				echo '<font color="#FF0000"><b>� ����� ������������ ���.</b></font><br>';
-			}else{
-				
-					$res['money2'] -= $mn;
-					$u->info['money2'] += $mn;
-					echo '<font color="#FF0000"><b>�� ������� ����� � ����� ����� '.$mn.' ���.</b></font><br>';
-					mysql_query('UPDATE `clan` SET `money2` = "'.mysql_real_escape_string($res['money2']).'" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-					mysql_query('UPDATE `users` SET `money2` = "'.mysql_real_escape_string($u->info['money2']).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
-					mysql_query('INSERT INTO `clan_operations` (`clan`,`time`,`type`,`text`,`val`,`uid`) VALUES ("'.$res['id'].'","'.time().'","3","'.$u->info['login'].'","'.(mysql_real_escape_string($mn)*-1).'","'.$u->info['id'].'")');
-				
-			}
-		}
-	}elseif(isset($_POST['svb_take_money']) && $tt[6][0] == 1) {
-		$mn = round((int)$_POST['svb_take_money'],2);
-		if($mn >= 0.01) {
-			if($u->info['money'] < $mn) {
-				echo '<font color="#FF0000"><b>� ��� ������������ �������</b></font><br>';
-			}elseif($res['money1'] + $mn > 99999) {
-				echo '<font color="#FF0000"><b>� ����� ����� �� ����� ���� ������ 99999��.</b></font><br>';
-			}else{
-				$res['money1'] += $mn;
-				$u->info['money'] -= $mn;
-				echo '<font color="#FF0000"><b>�� ������� �������� � ����� ����� '.$mn.' ��.</b></font><br>';
-				mysql_query('UPDATE `clan` SET `money1` = "'.mysql_real_escape_string($res['money1']).'" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-				mysql_query('UPDATE `users` SET `money` = "'.mysql_real_escape_string($u->info['money']).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
-				mysql_query('INSERT INTO `clan_operations` (`clan`,`time`,`type`,`text`,`val`,`uid`) VALUES ("'.$res['id'].'","'.time().'","2","'.$u->info['login'].'","'.mysql_real_escape_string($mn).'","'.$u->info['id'].'")');
-			}
-		}
-	}elseif(isset($_POST['svb_take_money2']) && $tt[6][0] == 1) {
-		$mn = round((int)$_POST['svb_take_money2'],2);
-		if($mn >= 0.01) {
-			if($u->info['money2'] < $mn) {
-				echo '<font color="#FF0000"><b>� ��� ������������ ���.</b></font><br>';
-			}else{
-				$maxs=mysql_fetch_array(mysql_query('SELECT SUM(`val`) AS val FROM `clan_operations` WHERE `uid` = "'.$u->info['id'].'" AND `clan` = "'.$res['id'].'" AND `type` = 3'));
-				if (!isset($maxs['val'])){$maxs['val']=0;}
-				if ($maxs['val']+$mn > 100)
-				{
-					echo '<font color="#FF0000"><b>������������ ����� ������: 100 ���. ������ �������� ���: '.(100-$maxs['val']).' ���.</b></font><br>';
-				}
-				else
-				{
-					$res['money2'] += $mn;
-					$u->info['money2'] -= $mn;
-					echo '<font color="#FF0000"><b>�� ������� �������� � ����� ����� '.$mn.' ���.</b></font><br>';
-					mysql_query('UPDATE `clan` SET `money2` = "'.mysql_real_escape_string($res['money2']).'" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-					mysql_query('UPDATE `users` SET `money2` = "'.mysql_real_escape_string($u->info['money2']).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
-					mysql_query('INSERT INTO `clan_operations` (`clan`,`time`,`type`,`text`,`val`,`uid`) VALUES ("'.$res['id'].'","'.time().'","3","'.$u->info['login'].'","'.mysql_real_escape_string($mn).'","'.$u->info['id'].'")');
-				}
-			}
-		}
-	}elseif(isset($_POST['invite']) && ($_POST['invite'] == '�������' || $_POST['invite'] == '�������' || $_POST['invite'] == '���������') && $tt[11][0] == 1) {
-		if($_POST['invite'] == "�������" && $tt[10][0] == 1) {
-			$usr = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `login` = "'.mysql_real_escape_string($_POST['logingo']).'" AND `clan` = "'.$res['id'].'" LIMIT 1'));
-			//$ttus = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = "'.$usr['clan_prava'].'" LIMIT 1'));
-			if(!isset($usr['id'])) {
-				echo '<font color="#FF0000"><b>����� �� ������ � �����</b></font><br>';
-			} elseif($tt['prioritet'] >= $utitl['prioritet']) {
-				echo '<font color="#FF0000"><b>����� ������ ��� �� ������, ���� ������ ���������</b></font><br>';
-			} elseif($u->info['money'] < $c_pr[1]) {
-				echo '<font color="#FF0000"><b>� ��� �� ���������� ��. ��� ���������� ������ �� ����� (���������: '.$c_pr[1].' ��.)</b></font><br>';
-			} elseif($usr['clan_prava'] == 'galva' && $u->info['clan_prava'] != 'glava') {
-				echo '<font color="#FF0000"><b>����� ������ ��� �� ������, ���� ������ ���������</b></font><br>';
-			} else {
-			  $ar = $u->rem_itm_cl($usr, $res['id'], 8);
-				if ($usr['level'] < 10) 
-				{
-					mysql_query('UPDATE `users` SET `palpro` = 0, `clan_prava` = 0, `clan` = 0, `clan_zv` = 0, `mod_zvanie` = "", `align` = 0, `clan_delay` = "0" WHERE `id` = "'.$usr['id'].'" LIMIT 1');
-				}
-				else
-				{
-					mysql_query('UPDATE `users` SET `palpro` = 0, `clan_prava` = 0, `clan` = 0, `clan_zv` = 0, `mod_zvanie` = "", `align` = 0, `clan_delay` = "'.time().'" WHERE `id` = "'.$usr['id'].'" LIMIT 1');
-				}
-				$u->info['money'] -= $c_pr[1];
-				mysql_query('UPDATE `users` SET `money` = "'.$u->info['money'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
-				$c_r .= '<font color="#FF0000"><b>����� &quot;'.$usr['login'].'&quot; ��� �������� �� ����� �� '.$c_pr[1].' ��.</b></font><br>'; 
-				$txt = '����� <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$u->info['login'].'</a>['.$u->info['level'].']<a target="_blank" title="���. � '.$u->info['login'].'" href="info/'.$u->info['id'].'"><img src="https://img.new-combats.com/i/inf_'.$u->info['cityreg'].'.gif"></a> �������� �� ����� ������ <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$usr['login'].'</a>['.$usr['level'].']<a target="_blank" title="���. � '.$usr['login'].'" href="info/'.$usr['id'].'"><img src="https://img.new-combats.com/i/inf_'.$usr['cityreg'].'.gif"></a>';
-				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","�������������","�������� ���������","'.mysql_real_escape_string($txt).'"
-				)');
-			}
-		}elseif($_POST['invite'] == "���������" && $u->info['clan_prava'] == 'glava') {
-			$usr = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `login` = "'.mysql_real_escape_string($_POST['logingo']).'" AND `clan` = "'.$res['id'].'" AND `banned` = "0" LIMIT 1'));
-			if(!isset($usr['id'])) {
-				echo '<font color="#FF0000"><b>����� �� ������ � �����</b></font><br>';
-			}elseif($u->info['money'] < $c_pr[2]) {
-				echo '<font color="#FF0000"><b>� ��� �� ���������� ��. ��� ���������� ������ �� ���� ����� ����� (���������: '.$c_pr[2].' ��.)</b></font><br>';
-			}elseif($usr['clan_prava'] == 'galva') {
-				echo '<font color="#FF0000"><b>����� ��� �������� ������ �����</b></font><br>';
-			}else{
-				mysql_query('UPDATE `users` SET `clan_prava` = "glava", `clan` = "'.$res['id'].'", `mod_zvanie` = "����� �����", `align` = "'.$res['align'].'" WHERE `id` = "'.$usr['id'].'" LIMIT 1');
-				$u->info['money'] -= $c_pr[2];
-				mysql_query('UPDATE `users` SET `clan_prava` = "2", `mod_zvanie` = "�������", `money` = "'.$u->info['money'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
-				$c_r .= '<font color="#FF0000"><b>����� &quot;'.$usr['login'].'&quot; ��� �������� ������ ���� �� '.$c_pr[0].' ��.</b></font><br>'; 
-				$txt = '����� <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$u->info['login'].'</a>['.$u->info['level'].']<a target="_blank" title="���. � '.$u->info['login'].'" href="info/'.$u->info['id'].'"><img src="https://img.new-combats.com/i/inf_'.$u->info['cityreg'].'.gif"></a> �������� ������ <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$usr['login'].'</a>['.$usr['level'].']<a target="_blank" title="���. � '.$usr['login'].'" href="info/'.$usr['id'].'"><img src="https://img.new-combats.com/i/inf_'.$usr['cityreg'].'.gif"></a> �� ��������� <b>����� �����</b>';
-				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","�������������","�������� ���������","'.mysql_real_escape_string($txt).'"
-				)');
-			}
-		}elseif($_POST['invite'] == "�������" && $tt[9][0] == 1) {
-            $is_cl = mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM `users` WHERE `clan` = '".$res['id']."'"));
-            $usr = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `login` = "'.mysql_real_escape_string($_POST['logingo']).'" AND `clan` != "'.$res['id'].'" AND `clan_zv` = "'.$res['id'].'" LIMIT 1'));
-			if(!isset($usr['id'])) {
-				echo '<font color="#FF0000"><b>���������� ����� �� ������ ��� �� ����� ������ � ��� ����.</b></font><br>';
-			}elseif($usr['clan_prava'] == 'galva') {
-				echo '<font color="#FF0000"><b>����� ��� �������� ������ �����</b></font><br>';
-			// }elseif($usr['palpro'] < time()) {
-				// echo '<font color="#FF0000"><b>����� ������ ������ �������� � ���������</b></font><br>';
-			}elseif($usr['clan_delay'] + 10*24*60*60 > time()) {
-				echo '<font color="#FF0000"><b>� ������ �������� �� ���������� � ���� �� '.date('d.m.Y H:i',$usr['clan_delay'] + 10*24*60*60).'</b></font><br>';
-			}elseif($u->info['money'] < $c_pr[0]) {
-				echo '<font color="#FF0000"><b>� ��� �� ���������� ��. ��� ������ ������ � ���� (���������: '.$c_pr[0].' ��.)</b></font><br>';
-			}elseif($usr['clan'] != '0' || $usr['align'] != '0') {
-				echo '<font color="#FF0000"><b>�������� ��� ��������� � �����, ���� ����� ����������</b></font><br>';
-            } elseif($is_cl[0] >= $lvl_prava[$res['level']][0]) {
-                echo '<font color="#FF0000"><b>��������� ����� �����������. ������� ������� �����.</b></font><br>';
-			}else{
-				// `palpro` = "'.(time()+86400*7).'",
-				mysql_query('UPDATE `users` SET `clan_prava` = "2",`clan` = "'.$res['id'].'",`mod_zvanie` = "",`align` = "'.$res['align'].'" WHERE `id` = "'.$usr['id'].'" LIMIT 1');
-				$u->info['money'] -= $c_pr[0];
-				mysql_query('UPDATE `users` SET `money` = "'.$u->info['money'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
-				echo '<font color="#FF0000"><b>����� &quot;'.$usr['login'].'&quot; ��� ������ � ���� �� '.$c_pr[0].' ��.</b></font><br>'; 
-				$txt = '����� <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$u->info['login'].'</a>['.$u->info['level'].']<a target="_blank" title="���. � '.$u->info['login'].'" href="info/'.$u->info['id'].'"><img src="https://img.new-combats.com/i/inf_'.$u->info['cityreg'].'.gif"></a> ������ � ���� ������ <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$usr['login'].'</a>['.$usr['level'].']<a target="_blank" title="���. � '.$usr['login'].'" href="info/'.$usr['id'].'"><img src="https://img.new-combats.com/i/inf_'.$usr['cityreg'].'.gif"></a>';
-				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","�������������","�������� ���������","'.mysql_real_escape_string($txt).'"
-				)');
-			}
-		}
-	}
-	?>
-    <? if($tt[9][0] > 0) { ?>
-    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-	<input style="width:144px;" value="���������� � ����" onClick="openMod('<b>���������� ������ � ����</b>','<form action=\'main.php?clan&control&priem\' method=\'post\'>�����: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');" type="button" /> 
-	(��� ��� ��������� � <?=$c_pr[0]?><b> ��.</b>)<br />
-    (��� ������ � ���� �������� ������ ������ ������ ����� ������������ ������)<br />
-	������ �������� ������: 
-	<? 
-	
-	$spnew = mysql_query('SELECT * FROM `users` WHERE `clan_zv`="'.$res['id'].'" AND `clan`= 0');
-			while($plnew = mysql_fetch_array($spnew)) 
-			{
-				echo '<b>'.$plnew['login'].'['.$plnew['level'].']</b><a href="/info/'.$plnew['id'].'" target="_blank"><img src="https://img.new-combats.com/i/inf_capitalcity.gif"></a>';
-			}
-	
-	?>
-	<br />
-    </div>
-    <? } ?>
-    <? if($tt[10][0] > 0) { ?>
-    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-    <input type="button" style="width:144px;" value="������� �� �����" onClick="openMod('<b>������� ������ �� �����</b>','<form action=\'main.php?clan&control&unpriem\' method=\'post\'>�����: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');"> 
-    (��� ��� ��������� � <?=$c_pr[1]?><b> ��.</b>)<br />
-    </div>
-    <? } ?>
-    <? if($u->info['clan_prava'] == 'glava') { ?>
-    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-	<input style="width:144px;" value="������� ����� �����" onClick="openMod('<b>��������� ����� �����</b>','<form action=\'main.php?clan&control&newglava\' method=\'post\'>�����: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'���������\'></form>');" type="button" /> (����� ����� ������ ������� � ���� ����������, �������� ������ ����� ������� ���������)<br />
-	<br>
-	<form method="post" enctype="multipart/form-data" action="?clan&control&save_canals">
-	<div style="display:inline-block;width:150px;">���� ����:</div><input style="width:211px;" id="svb_canals" value="<?=$res['site']?>" name="svb_site" type="text" /> <input name="���������" type="submit" id="rp_save" value="���������" /><br />
-	</div>
-	</form>
-
-	<!-- ��� -->
-	</div>
-    <? } ?>
-    <? if($tt[11][0] > 0) { ?>
-    <fieldset>
-      <legend><span class="legtitle">�������������� ������� ���������</span></legend>
-      <?
-	  if(isset($_GET['saveuser']) && $tt[11][0] == 1) {
-		 //[rp_login] => 0 [rp_titul] => 0 [rp_zvanie] => [rp_canals] => 
-		 $c_r = '';
-		 $usr = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.mysql_real_escape_string($_POST['rp_login']).'" AND `clan` = "'.$res['id'].'" LIMIT 1'));
-		 if(isset($usr['id'])) {
-			 if($usr['clan_prava'] != 'glava') {
-			 	$tt = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = "'.$usr['clan_prava'].'" LIMIT 1'));
-				if($tt['prioritet'] < $utitl['prioritet']) {
-					//����� �����
-					if((int)$_POST['rp_titul'] > 0) {
-						$tt_new = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = "'.mysql_real_escape_string($_POST['rp_titul']).'" AND `clan` = "'.$res['id'].'" LIMIT 1'));
-						if(isset($tt_new['id'])) {
-							if($tt_new['prioritet'] < $utitl['prioritet']) {
-								mysql_query('UPDATE `users` SET `clan_prava` = "'.$tt_new['id'].'" WHERE `id` = "'.$usr['id'].'" LIMIT 1');
-								$c_r .= '<font color="#FF0000"><b>������ &quot;'.$usr['login'].'&quot; ��� �������� ����� &quot;'.$tt_new['name'].'&quot;</b></font><br>'; 
-								if($tt_new['prioritet'] < $tt['prioritet']) {
-									//�������
-									$txt = '����� <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$u->info['login'].'</a>['.$u->info['level'].']<a target="_blank" title="���. � '.$u->info['login'].'" href="info/'.$u->info['id'].'"><img src="https://img.new-combats.com/i/inf_'.$u->info['cityreg'].'.gif"></a> ������� ����� ������ <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$usr['login'].'</a>['.$usr['level'].']<a target="_blank" title="���. � '.$usr['login'].'" href="info/'.$usr['id'].'"><img src="https://img.new-combats.com/i/inf_'.$usr['cityreg'].'.gif"></a> �� &quot;<b>'.$tt_new['name'].'</b>&quot;';
-								}else{
-									//��������
-									$txt = '����� <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$u->info['login'].'</a>['.$u->info['level'].']<a target="_blank" title="���. � '.$u->info['login'].'" href="info/'.$u->info['id'].'"><img src="https://img.new-combats.com/i/inf_'.$u->info['cityreg'].'.gif"></a> �������� ����� &quot;<b>'.$tt_new['name'].'</b>&quot; ������ <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$usr['login'].'</a>['.$usr['level'].']<a target="_blank" title="���. � '.$usr['login'].'" href="info/'.$usr['id'].'"><img src="https://img.new-combats.com/i/inf_'.$usr['cityreg'].'.gif"></a>';
-								}
-								
-								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","�������������","�������� ���������","'.mysql_real_escape_string($txt).'"
-								)');
-								
-							}else{
-								$c_r .= '<font color="#FF0000"><b>�� �� ������ ��������� ����� ������ ������ ������</b></font><br>'; 
-							}
-						}
-					}
-					mysql_query('UPDATE `users` SET `mod_zvanie` = "'.mysql_real_escape_string($_POST['rp_zvanie']).'",`ccanals` = "'.mysql_real_escape_string($_POST['rp_canals']).'" WHERE `id` = "'.$usr['id'].'" LIMIT 1');
-					$c_r .= '<font color="#FF0000"><b>���������� ������� ���������</b></font><br>';					
-					
-				}else{
-					$c_r .= '<font color="#FF0000"><b>����� ������ ��� �� ������, ���� ������ ���������</b></font><br>'; // ���
-				}
-			 }else{
-				$c_r .= '<font color="#FF0000"><b>����� ������ ��� �� ������, ���� ������ ���������</b></font><br>'; 
-			 }
-		 }else{
-			 $c_r .= '<font color="#FF0000"><b>����� �� ������� � ����� '.$res['name'].'</b></font><br>';  
-		 }
-	  }
-	  echo $c_r;
-	  ?>
-      <form method="post" action="main.php?clan&control&saveuser">
-      <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-      <div style="display:inline-block;width:150px;">�����:</div><select onchange="changeLogin(this);" style="width:211px;" name="rp_login">
-      <option value="0" style="color:#CCCCCC">�������� �����</option>
-	  <?
-      $sp = mysql_query('SELECT `id`,`login`,`clan_prava`,`ccanals`,`mod_zvanie` FROM `users` WHERE `clan` = "'.$res['id'].'"');
-	  while($pl = mysql_fetch_array($sp)) {
-		  $cp = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = "'.mysql_real_escape_string($pl['clan_prava']).'" LIMIT 1'));
-		  if($pl['clan_prava'] == 'glava') {
-			 $cp['name'] = '����� �����'; 
-		  }
-		  echo '<option id="slg'.$pl['id'].'" value="'.$pl['id'].'" vtitul="'.$cp['name'].'" vzvanie="'.$pl['mod_zvanie'].'" vcanals="'.$pl['ccanals'].'">'.$pl['login'].'</option>';
-	  }
-	  ?></select>
-      </div>
-      <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-      <div style="display:inline-block;width:150px;">�����:</div><input id="sn_titul" style="width:211px;" disabled="disabled" name="rp_canals" type="text" />
-      </div>
-      <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-      <div style="display:inline-block;width:150px;">��������� �����:</div><select style="width:211px;" id="rp_titul" name="rp_titul">
-	  <option value="0" style="color:#CCCCCC">�� ������</option>
-	  <?
-      $sp = mysql_query('SELECT * FROM `clan_tituls` WHERE `clan` = "'.$res['id'].'" AND `delete` = "0" LIMIT 25');
-	  while($pl = mysql_fetch_array($sp)) {
-		  echo '<option value="'.$pl['id'].'">'.$pl['name'].'</option>';
-	  }
-	  ?></select>
-      </div>
-      <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-      <div style="display:inline-block;width:150px;">�������</div>
-      </div>
-      <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-      <div style="display:inline-block;width:150px;">������ � �����:</div><input style="width:211px;" id="sn_zvanie" name="rp_zvanie" type="text" />
-      </div>
-      <div>
-      <div style="display:inline-block;width:150px;">������ ����:</div><input style="width:211px;" id="sn_canals" name="rp_canals" type="text" /><br />
-      <small>(���������� ����� ������� ������ ��������� �������. ��������: 1,3,7. ��������� ������: 1-9)</small> <input name="���������" type="submit" id="rp_save" value="���������" />
-      </div>
-      </form>
-    </fieldset>
-      <form method="post" enctype="multipart/form-data" action="?clan&control&save_canals">
-      <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-top:10px;padding-bottom:5px;">
-      <div style="display:inline-block;width:150px;">������ ����:</div><input style="width:211px;" id="svb_canals" value="<?=$res['canals']?>" name="svb_canals" type="text" /> <input name="���������" type="submit" id="rp_save" value="���������" /><br />
-      <small>(���������� ����� ������� ������ �������� �������. ��������: 2,4,8. ��������� ������: 1-9)</small>
-      </div>
-      </form>
-      <? } ?>
-    <? if($tt[5][0] == 1) { ?>
-    <? if($tt[7][0] > 0 && $res['money2'] > 0 && $u->info['admin'] > 0) { ?>
-    <fieldset>
-      <legend><span class="legtitle">�������� �����������</span></legend>
-      <form action="?clan&control&buy_imgae" method="post" enctype="multipart/form-data">
-      	<?
-		/* ��������� ����������� � ������ */
-		
-		if(isset($_GET['gdload'])) {
-			echo '<b style="color:red">����������� ���� ������� ��������� �� ������! ��������������� �� �������� � ���������, � ������� &quot;�������&quot;.</b><br>';
-		}elseif(isset($_POST['img_load1type'])) {
-			
-		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 = '') {
-			if (isset($_FILES[$name])) {
-				$f = &$_FILES[$name];
-				if (($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).'_'.$cnm.'.'.$ext[1];
-						$fn2 = uniqid('f_',true).'';
-						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 = '�������� ��� �����. ���������� ���� : <b>'.$exts.'</b>';
-					}
-				} else {
-					self::$error = '�������� ������ �����. ������������ ������ ����� <b>'.$max_mb.' ��</b>';
-				}
-			} else {
-				self::$error = '���� �� ������';
-			}
-			return false;
-		} // end saveimg
-		 
-		} // end class
-			
-			$data = array(
-				'obraz' => $_FILES['load_image1'],
-				'sex'	=> round((int)$_POST['img_load3type']),
-				'w'		=> '',
-				'h'		=> '',
-				'type'	=> round((int)$_POST['img_load1type']),
-				'animation'	=> round((int)$_POST['img_load2type'])
-			);
-			
-			$ers = '';
-			
-			if($data['sex'] != 0 && $data['sex'] != 1) {
-				$ers = '������! �� �� ������� ��� ���� ����� �������� �����������!';
-			}elseif($data['animation'] != 0 && $data['animation'] != 1) {
-				$ers = '������! �� �� ������� ��� �����������: �������������, �� �������������!';
-			}elseif($data['type'] < 1 || $data['type'] > 18) {
-				$ers = '������! �� �� ������� ��� ����� ��������� �����������!';
-			}
-			
-			if($res['id'] !=2) {
-				//$ers = 'NO!';
-			}
-			
-			$types = array(
-				1  => array('�����',120,220,100),
-				2  => array('�������� (�����)',120,40,15),
-				3  => array('�������� (������)',120,20,5),
-				4  => array('����',60,60,25),
-				5  => array('������',60,40,25),
-				6  => array('����� ����',60,60,25),
-				7  => array('������ ����',60,60,25),
-				8  => array('�����',60,80,25),
-				9  => array('����',60,40,25),
-				10 => array('�������',60,40,25),
-				11 => array('������',60,80,25),
-				12 => array('��������',60,40,25),
-				13 => array('������ �1',20,20,10),
-				14 => array('�����',60,20,25),
-				15 => array('������',60,20,25),						
-				16 => array('�������� ��� ���������� � ���������',244,287,5),						
-				17 => array('������ �2',20,20,10),
-				18 => array('������ �3',20,20,10)						
-			);
-			
-			$data['price'] = $types[$data['type']][3];
-				
-				
-			if($data['price'] > $res['money2']) {
-				$ers = '������! � ����� ����� ������������ ����-�������� ��� ������������ ������� �����������.';
-			}
-			
-			if($ers != '') {
-				echo '<b style="color:red">'.$ers.'</b><br>';
-			}else{
-				/* ��������� ����������� */
-				$imgname = md5(rand(0,1000000000000).'&'.rand(0,10000000).'&'.microtime());
-				if($file = upload::saveimg('load_image1',0.35,'jpg|png|jpeg|gif',$imgname)) {
-					$size = getimagesize ("https://new-combats.com/clan_prw/".htmlspecialchars($file[1],NULL,'cp1251')."");
-						
-					$bag = 0;
-												
-					if($types[$data['type']][1] != $size[0] || $types[$data['type']][2] != $size[1]) {
-						$bag = 1;
-					}
-										
-					mysql_query('INSERT INTO `reimage` (`login`,`uid`,`time`,`src`,`clan`,`type`,`sex`,`animation`,`w`,`h`,`bag`) VALUES (
-						"'.$u->info['login'].'",
-						"'.$u->info['id'].'","'.time().'",
-						"'.mysql_real_escape_string(htmlspecialchars($file[1],NULL,'cp1251')).'",
-						"'.$u->info['clan'].'",
-						"'.mysql_real_escape_string($data['type']).'",
-						"'.mysql_real_escape_string($data['sex']).'",
-						"'.mysql_real_escape_string($data['animation']).'",
-						"'.mysql_real_escape_string((int)$size[0]).'",
-						"'.mysql_real_escape_string((int)$size[1]).'",
-						"'.$bag.'"
-					)');
-					
-					$res['money2'] -= $data['price'];
-					
-					mysql_query('UPDATE `clan` SET `money2` = "'.$res['money2'].'" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-					die('<meta http-equiv="refresh" content="0; URL=/main.php?clan&control&gdload">');
-				}else{
-					echo '<b style="color:red">'.upload::$error.'</b><br>';
-				}
-			}
-		}
-		
-		?>
-        <select name="img_load1type">
-      	  <option value="0"><b>�������� ��� �����������</b></option>
-      	  <option value="0"><b>�����</b></option>
-      	  <option value="1">- ����� [������: 120x220] (100 ���.)</option>
-      	  <option value="2">- �������� (�����) [������: 120x40] (15 ���.)</option>
-      	  <option value="3">- �������� (������) [������: 120x20] (5 ���.)</option>
-      	  <option value="0"><b>����� ��� ��������������</b></option>
-      	  <option value="4">- ���� [������: 60x60] (25 ���.)</option>
-      	  <option value="5">- ������ [������: 60x40] (25 ���.)</option>
-      	  <option value="6">- ����� ���� [������: 60x60] (25 ���.)</option>
-      	  <option value="7">- ������ ���� [������: 60x60] (25 ���.)</option>
-      	  <option value="8">- ����� [������: 60x80] (25 ���.)</option>
-      	  <option value="9">- ���� [������: 60x40] (25 ���.)</option>
-      	  <option value="10">- ������� [������: 60x40] (25 ���.)</option>
-      	  <option value="11">- ������ [������: 60x80] (25 ���.)</option>
-      	  <option value="12">- �������� [������: 60x40] (25 ���.)</option>
-      	  <option value="13">- ������ �1 [������: 20x20] (10 ���.)</option>
-          <option value="17">- ������ �2 [������: 20x20] (10 ���.)</option>
-          <option value="18">- ������ �3 [������: 20x20] (10 ���.)</option>
-      	  <option value="14">- ����� [������: 60x20] (25 ���.)</option>
-      	  <option value="15">- ������ [������: 60x20] (25 ���.)</option>
-      	  <option value="16">�������� ��� ���������� � ��������� [������: 244x287] (5 ���.)</option>
-   	    </select><br />
-      	<select name="img_load2type" id="img_load2type">
-      	  <option value="0">�������� (���������)</option>
-      	  <option>�������� (��������)(��������� ����������� �����������)</option>
-   	    </select><br />
-      	<select name="img_load3type" id="img_load3type">
-          <option value="-1">�������� ���</option>
-      	  <option value="0">��� ������</option>
-      	  <option value="1">��� ������</option>
-   	    </select><br />
-        <small style="color:red;">������ ����������� �� ������ ��������� 350 ��!</small>
-      	<br />
-        <input type="file" name="load_image1" id="load_image1" /> <button type="submit">���������</button><br />
-        <small style="color:red;">��������!</small>
-        <small> ����������� ���������� ������� ����, <a href="#">������� ���������� �����������</a>, ���� ���������� �������� ������������ ����������� ������ ����� ����� ������������� ��� ����������� �������� ������� � ��� ����������� ������ ����������� �� �����.</small>
-      </form>      
-    </fieldset>
-    <? } 
-	?>
-    <fieldset>
-      <legend><span class="legtitle">����� �����</span></legend>
-      <form method="post" action="?clan&control&give_money">
-      ��. � ����� �����: <?=$res['money1']?>
-	  <br />
-      <? if($tt[7][0] > 0) { ?>
-      ������� �� ����� ��: <input id="svb_give_money" name="svb_give_money" value="0" type="text" /> <input type="submit" value=">>" />
-      <? 
-		} 
-	  ?>
-      </form>
-	  <? if($tt[6][0] > 0) { ?>
-      <form method="post" action="?clan&control&take_money">
-      <div style="border-top:1px solid #cac9c7;margin-top:5px;padding-top:5px;">
-      �������� �� � �����: <input id="svb_take_money" name="svb_take_money" value="0" type="text" /> <input type="submit" value=">>" />
-      <small>(��� ����: <?=$u->info['money']?>��.)</small>
-      </div>
-      </form>
-	  <?}?>
-	  
-	  <hr>
-	  <form method="post" action="?clan&control&give_money">
-      ���. � ����� �����: <?=$res['money2']?>. <br />
-      <input type="button" value="������ ��������" /><br />
-      <? if($u->info['clan_prava'] == 'glava') { ?>
-	  <br>
-	  ������� �� ����� ���: <input id="svb_give_money2" name="svb_give_money2" value="0" type="text" /> <input type="submit" value=">>" />
-	  <? 
-		
-		} 
-	  ?>
-      </form>
-	  
-
-		<? if($tt[6][0] > 0) { ?>
-		<form method="post" action="?clan&control&take_money">
-		<div style="border-top:1px solid #cac9c7;margin-top:5px;padding-top:5px;">
-		�������� ��� � �����: <input id="svb_take_money2" name="svb_take_money2" value="0" type="text" /> <input type="submit" value=">>" />
-		<small>(��� ����: <?=$u->info['money2']?>��.)</small>
-		</div>
-		</form>
-	  
-      <?
-		}
-	   ?>
-    </fieldset>
-	<? } ?>
-      <? if($tt[11][0] > 0 && $tt[3][0] == 1) { ?>
-      <form method="post" action="?clan&control&vipiska">
-      <div style="margin-top:5px;padding-top:5px;">
-      �������� ������� ��� ���������: <small>(������ ����� 1��.)</small> <input id="svb_vipiska" name="svb_vipiska" value="<?=date('d.m.Y')?>" type="text" /> <input type="submit" value="��������" />
-      </div>
-      </form>
-      <? } ?>
-   </div> 
-   <?
-   }elseif(isset($_GET['diplom']) && $tt[12][0] == 1) {
-	
-	if($tt[14][0] == 1){
-		if(isset($_GET['clanwars'])) {
-			//RadioGroup1
-			$cln = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `name` = "'.mysql_real_escape_string($_POST['logingo']).'" LIMIT 1'));
-			if(isset($cln['id'])) {
-				$clntn = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_clan_reting_list` WHERE `clan` = "'.$res['id'].'" ORDER BY `id` DESC LIMIT 1 '));
-				$clnta = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_clan_reting_list` WHERE `clan` = "'.$cln['id'].'" ORDER BY `id` DESC LIMIT 1 '));
-				if($cln['id'] == $res['id']) {
-					
-					$rn = array(
-					'<font color="#FF0000"><b>���������, �� ����� ��� ������ ������ :-)</b></font><br>',
-					'<font color="#FF0000"><b>��� ����� ����� ������ �������, ���� ������� ������!</b></font><br>',
-					'<font color="#FF0000"><b>�� ������������� �����������, ��������� �������� ������ �����!</b></font><br>');					
-					echo $rn[rand(0,2)];				
-				}elseif($clnta['global'] < $clntn['global']/2 ) {
-					echo '<font color="#FF0000"><b>��������� ������� ����</b></font><br>';
-				}elseif($cln['join1'] == $res['join1'] && $res['join1'] > 0) {
-					echo '<font color="#FF0000"><b>�� �������� � ����� � ���� ������</b></font><br>';				
-				}elseif($cln['join2'] == $res['join2'] && $res['join2'] > 0) {
-					echo '<font color="#FF0000"><b>�� �������� � ������� � ���� ������</b></font><br>';		
-				}else{
-					$lwar = mysql_fetch_array(mysql_query('SELECT * FROM `clan_wars` WHERE `time_finish` > '.time().' AND ((`clan1` = "'.$cln['id'].'" AND `clan2` = "'.$res['id'].'") OR (`clan2` = "'.$cln['id'].'" AND `clan1` = "'.$res['id'].'")) LIMIT 1 '));
-					if(!isset($lwar['id'])) {
-						$mkr = 10; $tpcw = 1;
-						if($_POST['RadioGroup1'] == 2) {
-							$mkr = 20; $tpcw = 2;
-						}
-						if(isset($lwar['id'])) {  // ���� true == true
-							echo '<font color="#FF0000"><b>������ �������� ����� ����� ������</b></font><br>';
-						}elseif($mkr > $res['money2']) {
-							echo '<font color="#FF0000"><b>� ����� ����� �� ���������� �������</b></font><br>';
-						}else{
-							mysql_query('UPDATE `clan` SET `money2` = `money2` - '.$mkr.' WHERE `id` = "'.$res['id'].'" LIMIT 1');
-							mysql_query('INSERT INTO `clan_wars` (`clan1`,`clan2`,`time_start`,`time_finish`,`type`,`text`) VALUES ("'.$res['id'].'","'.$cln['id'].'","'.time().'","'.(time()+60*60*24).'","'.$tpcw.'","�����!")');
-							mysql_query('INSERT INTO `clan_operations` (`clan`,`time`,`type`,`text`,`val`,`uid`) VALUES ("'.$res['id'].'","'.time().'","4","'.$u->info['login'].'","clanwar_'.$mkr.'_'.$cln['id'].'","'.$u->info['id'].'")');
-							echo '<font color="#FF0000"><b>�� ������� �������� ����� ����� &quot;'.$cln['name'].'&quot; �� '.$mkr.' ���.</b></font><br>';
-						}
-					}else{
-						echo '<font color="#FF0000"><b>�� ��� ������ ����� � ������ ������</b></font><br>';
-					}
-				}
-			}else{
-				echo '<font color="#FF0000"><b>���� � ����� ��������� �� ������</b></font><br>';
-			}
-		}
-	}
-	
-   ?>
-    <br /><br />
-    <fieldset>
-      <legend><span class="legtitle">�������� �����</span></legend>
-      <? 
-	  $warc = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `clan_wars` WHERE (`clan1` = "'.$res['id'].'" OR `clan2` = "'.$res['id'].'") AND `time_finish` > "'.time().'" LIMIT 1'));
-	  $warc = $warc[0];
-	  if($tt[14][0] == 1){ 
-		if ($warc<3)
-			{
-	  ?>
-				<input onClick="openMod('<b>�������� ����� �����</b>','<form action=\'main.php?clan&diplom&clanwars\' method=\'post\'>�������� �����: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br><label><input type=\'radio\' name=\'RadioGroup1\' value=\'1\' id=\'RadioGroup1_0\'>������� ����� (10 ���.)</label><br><span style=\'float:left\'><label><input type=\'radio\' name=\'RadioGroup1\' value=\'2\' id=\'RadioGroup1_1\'>�������� ����� (20 ���.)</label></span><input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');" type="submit" name="button" id="button" value="������ �����" />
-      <? 
-				echo '<font color="#FF0000"><b>�������������� �����: '.$warc.' ��.</b></font><br>';
-			}
-			else
-			{
-				echo '<font color="#FF0000"><b>� ������ ����� ��� 3 � ����� ����</b></font><br>';
-			}
-	  
-	  } 
-	  ?>
-      <br />
-      <div style="border:1px solid #CECECE;padding:10px;">
-      <?
-	  $ms = '';
-	  $sp = mysql_query('SELECT * FROM `clan_wars` WHERE (`clan1` = "'.$res['id'].'" OR `clan2` = "'.$res['id'].'") AND `time_finish` > "'.time().'"');
-	  while($pl = mysql_fetch_array($sp)) {
-		  $cln1 = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$pl['clan1'].'" LIMIT 1'));
-		  $cln2 = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$pl['clan2'].'" LIMIT 1'));
-		  $ms .= '<div style="border:1px solid #CECECE;padding:10px;">����� ����� ������� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$cln1['name_mini'].'.gif">'.$cln1['name'].'</b> � <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$cln2['name_mini'].'.gif">'.$cln2['name'].'</b>.<br>';
-		  if($pl['text'] != '') {
-			$ms .= '������� �����: <i>'.$pl['text'].'</i><br>';  
-		  }
-		  $ms .= '����� �����: '.date('d.m.Y H:i',$pl['time_start']).' - '.date('d.m.Y H:i',$pl['time_finish']).'</div>';
-	  }
-	  if($ms == '') {
-	  ?>
-      	� ������ ������ ��� ���� �� ����� ����.
-      <?
-	  }else{
-		 echo $ms; 
-	  }
-	  ?>
-      </div>
-    </fieldset>
-  <fieldset>
-    <legend><span class="legtitle">����� � �������</span></legend>
-      <? if($tt[13][0] == 1) {
-	  if(isset($_GET['joint']) && $tt[13][0] == 1) {
-		  if($_GET['joint'] == 1) {
-			 //���������� � ����
-			  $nm = htmlspecialchars($_POST['logingo'],NULL,'cp1251');
-			  $cnm = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `name` = "'.mysql_real_escape_string($nm).'" AND `type` = "1" LIMIT 1'));
-			  if(isset($cnm['id'])) {
-				$cnmz = mysql_fetch_array(mysql_query('SELECT * FROM `clan_join` WHERE `alians` = "'.$cnm['id'].'" AND `clan` = "'.$res['id'].'" AND `time_end` = "0" AND `time_start` = "0" AND `type` = "1" LIMIT 1'));
-				if(isset($cnmz['id'])) {
-					echo '<font color="#FF0000"><b>��� ���� ��� ����� ������ � ������ ����</b></font><br>';
-				}elseif($res['join1'] > 0) {
-					echo '<font color="#FF0000"><b>��� ���� ��� ��������� � �����</b></font><br>'; 
-				}else{
-					mysql_query('UPDATE `clan` SET `join1` = "'.$cnm['id'].'" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-					echo '<font color="#FF0000"><b>�� ������� ������ ������ � ���� &quot;'.$cnm['name'].'&quot;</b></font><br>';
-					mysql_query('INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`) VALUES ("'.$res['id'].'","'.$cnm['id'].'","'.time().'","1")');
-				}
-			  }else{
-				 echo '<font color="#FF0000"><b>������ ��� ���� � ������ ��������� �� ����������</b></font><br>'; 
-			  }
-		  }else{
-			 //���������� � ������
-			  $nm = htmlspecialchars($_POST['logingo'],NULL,'cp1251');
-			  $cnm = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `name` = "'.mysql_real_escape_string($nm).'" AND `type` = "2" LIMIT 1'));
-			  if(isset($cnm['id'])) {
-				$cnmz = mysql_fetch_array(mysql_query('SELECT * FROM `clan_join` WHERE `alians` = "'.$cnm['id'].'" AND `clan` = "'.$res['id'].'" AND `time_end` = "0" AND `time_start` = "0" AND `type` = "2" LIMIT 1'));
-				if(isset($cnmz['id'])) {
-					echo '<font color="#FF0000"><b>��� ���� ��� ����� ������ � ������ ������</b></font><br>';
-				}elseif($res['join1'] == 0) {
-					echo '<font color="#FF0000"><b>��� ���������� � ������ ��������� �������� � ����</b></font><br>'; 
-				}elseif($res['join2'] > 0) {
-					echo '<font color="#FF0000"><b>��� ���� ��� ��������� � �������</b></font><br>'; 
-				}else{
-					mysql_query('UPDATE `clan` SET `join1` = "'.$cnm['id'].'" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-					echo '<font color="#FF0000"><b>�� ������� ������ ������ � ������ &quot;'.$cnm['name'].'&quot;</b></font><br>';
-					mysql_query('INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`) VALUES ("'.$res['id'].'","'.$cnm['id'].'","'.time().'","2")');
-				}
-			  }else{
-				 echo '<font color="#FF0000"><b>������ ��� ���� � ������ ��������� �� ����������</b></font><br>'; 
-			  }
-		  }
-	  }elseif(isset($_GET['newjoint']) && $tt[13][0] == 1) {
-		if($_GET['newjoint'] == 1) {
-			//�����
-			if($res['join1'] > 0) {
-				echo '<font color="#FF0000"><b>��� ���� ��� ������� � �����</b></font><br>';
-			}else{
-				$nm = htmlspecialchars($_POST['logingo'],NULL,'cp1251');
-				if(str_replace(' ','',str_replace('	','',$nm)) == '') {
-					echo '<font color="#FF0000"><b>������� �������� �����</b></font><br>';
-				}else{
-					$cnm = mysql_fetch_array(mysql_query('SELECT `id` FROM `clan_joint` WHERE `name` = "'.mysql_real_escape_string($nm).'" LIMIT 1'));
-					if(!isset($cnm['id'])) {
-						mysql_query('INSERT INTO `clan_joint` (`time_open`,`name`,`type`,`clan_open`,`clan_glava`) VALUES ("'.time().'","'.mysql_real_escape_string($nm).'","1","'.$res['id'].'","'.$res['id'].'")');
-						$id = mysql_insert_id();
-						$res['join1'] = $id;
-						mysql_query('INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`,`time_start`) VALUES ("'.$res['id'].'","'.$id.'","'.time().'","1","'.time().'")');
-						mysql_query('UPDATE `clan` SET `join1` = "'.$id.'" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-						echo '<font color="#FF0000"><b>�� ������� ������� ���� &quot;'.$nm.'&quot;</b></font><br>';
-					}else{
-						echo '<font color="#FF0000"><b>������ ��� ���� � ������ ��������� ��� ����������</b></font><br>';
-					}
-				}
-			}
-		}else{
-			//�������
-			if($res['join1'] == 0) {
-				echo '<font color="#FF0000"><b>��� ���� ������ �������� � �����</b></font><br>';
-			}elseif($res['join2'] > 0) {
-				echo '<font color="#FF0000"><b>��� ���� ��� ������� � �������</b></font><br>';
-			}else{
-				$nm = htmlspecialchars($_POST['logingo'],NULL,'cp1251');
-				if(str_replace(' ','',str_replace('	','',$nm)) == '') {
-					echo '<font color="#FF0000"><b>������� �������� �������</b></font><br>';
-				}else{
-					$cnm = mysql_fetch_array(mysql_query('SELECT `id` FROM `clan_joint` WHERE `name` = "'.mysql_real_escape_string($nm).'" LIMIT 1'));
-					if(!isset($cnm['id'])) {
-						mysql_query('INSERT INTO `clan_joint` (`time_open`,`name`,`type`,`clan_open`,`clan_glava`) VALUES ("'.time().'","'.mysql_real_escape_string($nm).'","2","'.$res['id'].'","'.$res['id'].'")');
-						$id = mysql_insert_id();
-						$res['join2'] = $id;
-						mysql_query('INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`,`time_start`) VALUES ("'.$res['id'].'","'.$id.'","'.time().'","2","'.time().'")');
-						mysql_query('UPDATE `clan` SET `join2` = "'.$id.'" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-						echo '<font color="#FF0000"><b>�� ������� ������� ������ &quot;'.$nm.'&quot;</b></font><br>';
-					}else{
-						echo '<font color="#FF0000"><b>������ ��� ���� � ������ ��������� ��� ����������</b></font><br>';
-					}
-				}
-			}
-		}
-	  }elseif(isset($_GET['cancel']) && $tt[13][0] == 1) {
-		 $zvn = mysql_fetch_array(mysql_query('SELECT * FROM `clan_join` WHERE `id` = "'.mysql_real_escape_string($_GET['cancel']).'" AND `time_start` = "0" AND `time_end` = "0" LIMIT 1')); 
-		 if(!isset($zvn['id'])) {
-			 echo '<font color="#FF0000"><b>������ �� ���������� �� �������</b></font><br>';
-		 }else{
-			 $rzv = '';
-			if($zvn['clan'] == $res['id']) {
-				//������ �������������
-				$szu = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$zvn['alians'].'" LIMIT 1'));
-				if($szu['type'] == 1) {
-					$rzv = '���� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif">'.$res['name'].'</b> ��������� �� ������������� � ����� <b>'.$szu['name'].'</b>.';
-				}else{
-					$rzv = '���� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif">'.$res['name'].'</b> ��������� �� ������������� � ������� <b>'.$szu['name'].'</b>.';
-				}
-			}elseif($zvn['alians'] == $res['join1']) {
-				//����� � ������������� � �����
-				$szu = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$zvn['alians'].'" LIMIT 1'));
-				$zvy = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$zvn['clan'].'" LIMIT 1'));
-				$rzv = '���� <b>'.$szu['name'].'</b> ������� ����� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$zvy['name_mini'].'.gif">'.$zvy['name'].'</b> � �������������.';
-			}elseif($zvn['alians'] == $res['join2']) {
-				//����� � ������������� � �������
-				$szu = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$zvn['alians'].'" LIMIT 1'));
-				$zvy = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$zvn['clan'].'" LIMIT 1'));
-				$rzv = '������ <b>'.$szu['name'].'</b> ������� ����� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$zvy['name_mini'].'.gif">'.$zvy['name'].'</b> � �������������.';
-			}
-			if($rzv != '') {
-				echo '<font color="#FF0000"><b>'.$rzv.'</b></font><br>';
-				mysql_query('UPDATE `clan_join` SET `time_end` = "'.time().'" WHERE `id` = "'.$zvn['id'].'"');
-			}
-		 }
-	  }elseif(isset($_GET['ok']) && $tt[13][0] == 1) {
-		 $zvn = mysql_fetch_array(mysql_query('SELECT * FROM `clan_join` WHERE `id` = "'.mysql_real_escape_string($_GET['ok']).'" AND `time_start` = "0" AND `time_end` = "0" LIMIT 1')); 
-		 if(!isset($zvn['id'])) {
-			 echo '<font color="#FF0000"><b>������ �� ���������� �� �������</b></font><br>';
-		 }else{
-			 $rzv = '';
-			if($zvn['alians'] == $res['join1']) {
-				//������������� � �����
-				$szu = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$zvn['alians'].'" LIMIT 1'));
-				$zvy = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$zvn['clan'].'" LIMIT 1'));
-				$rzv = '���� <b>'.$szu['name'].'</b> ������ ���� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$zvy['name_mini'].'.gif">'.$zvy['name'].'</b>.';
-				mysql_query('UPDATE `clan_join` SET `time_end` = "'.time().'" WHERE `id` != "'.$zvn['id'].'" AND `clan` = "'.$szu['clan'].'" AND `type` = "1"');
-				//mysql_query('INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`) VALUES ("'.$res['id'].'","'.$szu['id'].'","'.time().'","1")');
-				mysql_query('UPDATE `clan` SET `join1` = "'.$zvn['alians'].'" WHERE `id` = "'.$szu['id'].'"');
-			}elseif($zvn['alians'] == $res['join2']) {
-				//������������� � �������
-				$szu = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$zvn['alians'].'" LIMIT 1'));
-				$zvy = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$zvn['clan'].'" LIMIT 1'));
-				$rzv = '������ <b>'.$szu['name'].'</b> ������ ���� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$zvy['name_mini'].'.gif">'.$zvy['name'].'</b>.';
-				mysql_query('UPDATE `clan_join` SET `time_end` = "'.time().'" WHERE `id` != "'.$zvn['id'].'" AND `clan` = "'.$szu['clan'].'" AND `type` = "2" AND `time_end` = "0"');
-				//mysql_query('INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`) VALUES ("'.$res['id'].'","'.$szu['id'].'","'.time().'","2")');
-				mysql_query('UPDATE `clan` SET `join2` = "'.$zvn['alians'].'" WHERE `id` = "'.$szu['id'].'"');
-			}
-			if($rzv != '') {
-				echo '<font color="#FF0000"><b>'.$rzv.'</b></font><br>';
-				mysql_query('UPDATE `clan_join` SET `time_start` = "'.time().'" WHERE `id` = "'.$zvn['id'].'"');
-			}
-		 }
-	  }
-	  ?>
-      <? if($res['join1'] == 0 && $res['level'] > 0) { ?>
-      <input type="submit" name="button" id="button" value="������� ����" onClick="openMod('<b>������� ����</b>','<form action=\'main.php?clan&diplom&newjoint=1\' method=\'post\'>��������: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');" />
-      <input type="submit" name="button" id="button" value="�������������� � �����" onClick="openMod('<b>�������������� � �����</b>','<form action=\'main.php?clan&diplom&joint=1\' method=\'post\'>��������: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');" />
-      <? }
-	  
-	  if($res['join2'] == 0 && $res['level'] > 0) { ?>
-      <input type="submit" name="button" id="button" value="�������������� � �������" onClick="openMod('<b>�������������� � �������</b>','<form action=\'main.php?clan&diplom&joint=2\' method=\'post\'>��������: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');" />
-      <input type="submit" name="button" id="button" value="������� ������" onClick="openMod('<b>������� ������</b>','<form action=\'main.php?clan&diplom&newjoint=2\' method=\'post\'>��������: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');" />      
-      <br /><br /><? } ?><? } ?>
-      <div style="border:1px solid #CECECE;padding:10px;">
-      	<? 
-		$ms = '';
-		
-		//����������� ����� � �������
-		if($res['join1'] > 0) {
-			$j1 = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$res['join1'].'" LIMIT 1'));
-			if(isset($j1['id'])) {
-				$ms .= '<div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">';
-				$ms .= '�� �������� � �������� ����� <b>'.$j1['name'].'</b>.';
-				if( $j1['clan_glava'] != $res['id'] ) { 
-					$ms .= ' <a href="main.php?clan&diplom&delclanme=1"><img title="�������� ����" width="13" height="13" src="https://img.new-combats.com/i/clear.gif"></a>';
-				}
-				$ms .= '<Br>������ �����: ';
-				//$ms .= '<a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif">'.$res['name'].'</a>';
-				$i = 0;
-				if( isset($_GET['delclanme']) ) {
-					if( $j1['clan_glava'] != $res['id'] && ($u->info['clan_prava'] == 'glava' || $u->info['admin'] > 0) ) { 
-						$dels = mysql_fetch_array(mysql_query('SELECT * FROM `clan_join` WHERE `clan` = "'.$res['id'].'" AND `alians` = "'.$j1['id'].'" AND `time_end` = "0" AND `time_start` > 0 LIMIT 1'));
-						if(isset($dels['id'])) {
-							mysql_query('UPDATE `clan` SET `join1` = "0" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-							mysql_query('UPDATE `clan_join` SET `time_end` = "'.time().'" WHERE `id` = "'.$dels['id'].'" LIMIT 1');
-							echo '<div><b><font color=red>�� ������� �������� ���� &quot;'.$j1['name'].'&quot;</font></b></div>';
-							header('location: main.php?clan&diplom');
-						}else{
-							echo '<div><b><font color=red>��� ���� �� ������� � ������ �����</font></b></div>';
-						
-						}
-					}else{
-						echo '<div><b><font color=red>�� �� ������ �������� ������ ����</font></b></div>';
-					}
-				}elseif( $j1['clan_glava'] == $res['id'] && ($u->info['clan_prava'] == 'glava' || $u->info['admin'] > 0) ) {
-					if( isset($_GET['delclan']) ) {
-						$delc = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.mysql_real_escape_string($_GET['delclan']).'" LIMIT 1'));
-						$dels = mysql_fetch_array(mysql_query('SELECT * FROM `clan_join` WHERE `clan` = "'.$delc['id'].'" AND `alians` = "'.$j1['id'].'" AND `time_end` = "0" AND `time_start` > 0 LIMIT 1'));
-						
-						if( isset($delc['id']) && isset($dels['id']) ) {
-							if( $delc['id'] != $res['id'] ) {
-								mysql_query('UPDATE `clan` SET `join1` = "0" WHERE `id` = "'.$dels['id'].'" LIMIT 1');
-								mysql_query('UPDATE `clan_join` SET `time_end` = "'.time().'" WHERE `id` = "'.$dels['id'].'" LIMIT 1');
-								echo '<div><b><font color=red>���� &quot;'.$delc['name'].'&quot; ��� �������� �� ������� �����</font></b></div>';
-								header('location: main.php?clan&diplom');
-							}else{
-								echo '<div><b><font color=red>���� ������������� �� ���� �� ����� �������� ������ ����</font></b></div>';
-							}
-						}else{
-							echo '<div><b><font color=red>���� �� ������� � ������ �����</font></b></div>';
-						}
-					}
-				}
-				$sp1 = mysql_query('SELECT `u`.*,`s`.* FROM `clan_join` AS `u` LEFT JOIN `clan` AS `s` ON `s`.`id` = `u`.`clan` WHERE `u`.`alians` = "'.$j1['id'].'" AND `u`.`time_end` = "0" AND `u`.`time_start` > 0');
-				while($pl1 = mysql_fetch_array($sp1)) {
-					if($i > 0) {
-						$ms .= ',';
-					}
-					$ms .= ' <a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$pl1['name_mini'].'.gif">'.$pl1['name'].'</a>';
-					if( $j1['clan_glava'] == $res['id'] ) {
-						if($res['id'] != $pl1['clan']) { 
-							if($u->info['clan_prava'] == 'glava' || $u->info['admin'] > 0) {
-								$ms .= ' <a title="������� �� �����" href="main.php?clan&diplom&delclan='.$pl1['clan'].'"><img width="13" height="13" src="https://img.new-combats.com/i/clear.gif"></a>';
-							}
-						}
-					}
-					$i++;
-				}
-				if( $j1['clan_glava'] == $res['id'] && ($u->info['clan_prava'] == 'glava' || $u->info['admin'] > 0) ) {
-					$ms .= '<br>�� ���������� �����, ������ ���������� ������ ����� ����:<br>';
-					$cnls = '<i>���������</i>';
-					//$ms .= '<form method="post" action="?clan&diplom&savecanals='.$res['id'].'"><a style="display:inline-block;width:210px;" href="javascript:void(0)"><img src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif">'.$res['name'].'</a> &nbsp; '.$cnls.' &nbsp; <input type="submit" value="���������"></form>';
-					$sp1 = mysql_query('SELECT `u`.*,`s`.* FROM `clan_join` AS `u` LEFT JOIN `clan` AS `s` ON `s`.`id` = `u`.`clan` WHERE `u`.`alians` = "'.$j1['id'].'" AND `u`.`time_end` = "0" AND `u`.`time_start` > 0');
-					while($pl1 = mysql_fetch_array($sp1)) {
-						$ms .= '<form method="post" action="?clan&diplom&savecanals='.$pl1['id'].'"><a style="display:inline-block;width:210px;" href="javascript:void(0)"><img src="https://img.new-combats.com/i/clan/'.$pl1['name_mini'].'.gif">'.$pl1['name'].'</a> &nbsp; '.$cnls.' &nbsp; <input type="submit" value="���������"></form>';
-					}
-				}
-				//����������� �������� ������ �����
-				
-				$ms .= '</div>';
-			}
-		}
-		if($res['join2'] > 0) {
-			$j1 = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$res['join2'].'" LIMIT 1'));
-			if(isset($j1['id'])) {
-				$ms .= '<div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">';
-				$ms .= '�� �������� � �������� ������� <b>'.$j1['name'].'</b>. ������ �������: ';
-				//$ms .= '<a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif">'.$res['name'].'</a>';
-				$sp1 = mysql_query('SELECT `u`.*,`s`.* FROM `clan_join` AS `u` LEFT JOIN `clan` AS `s` ON `s`.`id` = `u`.`clan` WHERE `u`.`alians` = "'.$j1['id'].'" AND `u`.`time_end` = "0" AND `u`.`time_start` > 0');
-				$i = 0;
-				while($pl1 = mysql_fetch_array($sp1)) {
-					if($i > 0) {
-						$ms .= ', ';	
-					}
-					$ms .= '<a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$pl1['name_mini'].'.gif">'.$pl1['name'].'</a>';
-					$i++;
-				}
-				$ms .= '<br>�� ���������� �������.<br>';				
-				$ms .= '</div>';
-			}
-		}
-		
-		//����� � ������� � ������� ������� ����
-		
-		
-		if($ms == '') {
-		?>
-        <center>� ������ ������ � ������ ����� ��� ��������������� ���������.</center>
-        <? }else{ echo $ms; } ?>
-      </div>
-      <? if($tt[13][0] == 1) { ?>
-      <br />
-      <center>������ �� �����</center>
-      <br />
-      <table width="100%" border="0" cellspacing="0" cellpadding="2">
-        <tr>
-          <td width="50%" align="center" valign="top">
-          	<div style="border:1px solid #CECECE;padding:10px;">
-            	<a href="javascript:void(0)">���� ������ �� ������������ �����</a>
-                <br />
-                <br />
-                <?
-				$ms = '';
-				$sp = mysql_query('SELECT * FROM `clan_join` WHERE `clan` = "'.mysql_real_escape_string($res['id']).'" AND `time_start` = "0" AND `time_end` = "0" AND `type` = "1"');
-				while($pl = mysql_fetch_array($sp)) {
-					$suz = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$pl['alians'].'" LIMIT 1'));
-					$ms .= '<div style="border-bottom:1px solid #cac9c7;text-align:left;margin-bottom:5px;padding-bottom:5px;">�� ������ ������ �� ���������� � ���� <b>'.$suz['name'].'</b>.<br><div style="float:left;">����� ������ ������: '.date('d.m.Y H:i',$pl['time']).'</div><a style="float:right;" href="?clan&diplom&cancel='.$pl['id'].'">��������</a><br></div>';
-				}
-				if($ms == '') {
-				?>
-                � ���� ����� �� ������� ������
-                <? }else{ echo $ms; } ?>
-            </div>
-          </td>
-          <td align="center" valign="top">
-          	<div style="border:1px solid #CECECE;padding:10px;">
-            	<a href="javascript:void(0)">������ �� ������������ ����� � ����</a>
-                <br />
-                <br />
-                <?
-				$ms = '';
-				$sp = mysql_query('SELECT * FROM `clan_join` WHERE `alians` = "'.mysql_real_escape_string($res['join1']).'" AND `time_start` = "0" AND `time_end` = "0" AND `type` = "1"');
-				while($pl = mysql_fetch_array($sp)) {
-					$suz = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$pl['alians'].'" LIMIT 1'));
-					$clz = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$pl['clan'].'" LIMIT 1'));
-					$ms .= '<div style="border-bottom:1px solid #cac9c7;text-align:left;margin-bottom:5px;padding-bottom:5px;">���� <a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$clz['name_mini'].'.gif">'.$clz['name'].'</a> ����� ������ �� ���������� � ��� ���� <b>'.$suz['name'].'</b>.<br><div style="float:left;">����� ������ ������: '.date('d.m.Y H:i',$pl['time']).'</div><div style="float:right;"><a href="?clan&diplom&ok='.$pl['id'].'">�������</a> &nbsp; <a href="?clan&diplom&cancel='.$pl['id'].'">��������</a></div><br></div>';
-				}
-				if($ms == '') {
-				?>
-                � ���� ����� �� ������� ������
-                <? }else{ echo $ms; } ?>
-            </div>
-          </td>
-        </tr>
-      </table>
-    <br />
-    <center>������ �� �������</center>     
-    <br />
-    <table width="100%" border="0" cellspacing="0" cellpadding="2">
-        <tr>
-          <td width="50%" align="center" valign="top">
-          	<div style="border:1px solid #CECECE;padding:10px;">
-            	<a href="javascript:void(0)">���� ������ �� ������������ �������</a>
-                <br />
-                <br />
-                <?
-				$ms = '';
-				$sp = mysql_query('SELECT * FROM `clan_join` WHERE `clan` = "'.mysql_real_escape_string($res['id']).'" AND `time_start` = "0" AND `time_end` = "0" AND `type` = "2"');
-				while($pl = mysql_fetch_array($sp)) {
-					$suz = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$pl['alians'].'" LIMIT 1'));
-					$ms .= '<div style="border-bottom:1px solid #cac9c7;text-align:left;margin-bottom:5px;padding-bottom:5px;">�� ������ ������ �� ���������� � ������ <b>'.$suz['name'].'</b>.<br><div style="float:left;">����� ������ ������: '.date('d.m.Y H:i',$pl['time']).'</div><a style="float:right;" href="?clan&diplom&cancel='.$pl['id'].'">��������</a><br></div>';
-				}
-				if($ms == '') {
-				?>
-                � ���� ����� �� ������� ������
-                <? }else{ echo $ms; } ?>
-            </div>
-          </td>
-          <td align="center" valign="top">
-          	<div style="border:1px solid #CECECE;padding:10px;">
-            	<a href="javascript:void(0)">������ �� ������������ ������� � ����</a>
-                <br />
-                <br />
-                <?
-				$ms = '';
-				$sp = mysql_query('SELECT * FROM `clan_join` WHERE `alians` = "'.mysql_real_escape_string($res['join2']).'" AND `time_start` = "0" AND `time_end` = "0" AND `type` = "2"');
-				while($pl = mysql_fetch_array($sp)) {
-					$suz = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$pl['alians'].'" LIMIT 1'));
-					$clz = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$pl['clan'].'" LIMIT 1'));
-					$ms .= '<div style="border-bottom:1px solid #cac9c7;text-align:left;margin-bottom:5px;padding-bottom:5px;">���� <a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$clz['name_mini'].'.gif">'.$clz['name'].'</a> ����� ������ �� ���������� � ��� ������ <b>'.$suz['name'].'</b>.<br><div style="float:left;">����� ������ ������: '.date('d.m.Y H:i',$pl['time']).'</div><div style="float:right;"><a href="?clan&diplom&ok='.$pl['id'].'">�������</a> &nbsp; <a href="?clan&diplom&cancel='.$pl['id'].'">��������</a></div><br></div>';
-				}
-				if($ms == '') {
-				?>
-                � ���� ����� �� ������� ������
-                <? }else{ echo $ms; } ?>
-            </div>
-          </td>
-        </tr>
-    </table>
-	<? } ?>
-    </fieldset>    
-   <? } elseif(isset($_GET['deposit'])) {
-	
-	$itmc = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `items_users` WHERE `uid` = "-21'.$res['id'].'" AND `delete` = 0 LIMIT 1'));
-	$itmc = $itmc[0];
-	$itms = mysql_fetch_array(mysql_query('SELECT `iu`.*,`im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` >= 0 AND `iu`.`delete` = "0"
-		AND `iu`.`id` = "'.mysql_real_escape_string($_GET['ungive_itm']).'" LIMIT 1'));
-	$ps = $u->lookStats($itms['data']);
-	$ps['cl'] = explode('#', $ps['toclan']);
-	$use_s = $ps['cl'][1];
-	if(isset($_GET['ungive_itm']) && $ps['cl'][0] == $res['id'] && ($tt[14][0] == 1 || ($u->info['id'] == $use_s))) {
-		$itm = mysql_fetch_array(mysql_query('SELECT `iu`.*,`im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` >= 0 AND `iu`.`delete` = "0"
-		AND `iu`.`id` = "'.mysql_real_escape_string($_GET['ungive_itm']).'" LIMIT 1'));
-		if(isset($itm['id'])) {
-			$btlud = mysql_fetch_array(mysql_query('SELECT `id`,`battle` FROM `users` WHERE `id` = "'.$itm['uid'].'" LIMIT 1'));
-			if( $u->testBattle($btlud['battle']) == true ) {
-				echo '<font color="#FF0000"><b>������ ������� �������� � ��������� � ���</b></font><br>';
-			}else{
-			 	echo $u->ungive_itm_cl($_GET['ungive_itm'], $u->info, $res['id']);
-			}
-		}
-	} elseif(isset($_GET['take_itm']) && $tt[4][0] == 1) {
-		$itm = mysql_fetch_array(mysql_query('SELECT `iu`.*,`im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid`="-21'.$res['id'].'" AND `iu`.`delete`="0"
-		AND `iu`.`id` = "'.mysql_real_escape_string($_GET['take_itm']).'" LIMIT 1'));
-		if(isset($itm['id'])) {
-		  echo $u->take_itm_cl($_GET['take_itm'], $u->info, $res['id']);
-	    }
-	} elseif(isset($_GET['give_itm'])) {
-      $itm = mysql_fetch_array(mysql_query('SELECT `iu`.*,`im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `im`.`inslot` > 0 AND `iu`.`gift` = "" AND `iu`.`data` NOT LIKE "%frompisher=%"
-		AND `iu`.`id` = "'.mysql_real_escape_string($_GET['give_itm']).'" LIMIT 1'));
-		if($itmc >= $lvl_prava[$res['level']][5]) {
-			echo '<font color="#FF0000"><b>��������� �����������</b></font><br>';
-		} elseif(isset($itm['id'])) {
-		  echo $u->set_cl_item($_GET['give_itm'], $u->info, $res['id']);
-		}
-	}
-	if($tt[4][0] == 1) {
-		$itm_clan = $u->genInv(66, '(`iu`.`uid` = "-21'.$u->info['clan'].'" OR `iu`.`data` LIKE "%toclan='.$u->info['clan'].'#%") AND `iu`.`delete` = 0 AND `iu`.`inShop` = 0 ORDER BY `lastUPD` DESC');
-	} else {
-		$itm_clan[2] = '<br /><br /><center>� ��� ��� ������� � ������������� ���������</center>';
-	}
-	$itm_user = $u->genInv(65, '`iu`.`uid` = '.$u->info['id'].' AND `iu`.`delete` = 0 AND `iu`.`inOdet` = 0 AND `iu`.`inShop` = 0 AND `im`.`inslot` > 0 AND `iu`.`gift` = "" AND `iu`.`data` NOT LIKE "%frompisher=%" ORDER BY `lastUPD` DESC');
-   
-   ?>
-   <div class="box visible">
-     <table width="100%" border="0" cellspacing="0" cellpadding="0">
-       <tr>
-         <td width="50%" valign="top">
-    <fieldset style="margin:0;padding:0">
-      <legend><span class="legtitle">��������� (��������� : <?=$itmc?>/<?=$lvl_prava[$res['level']][5]?>)</span></legend>
-      <? if($itm_clan[2] != '') { ?>
-      <table border="0" cellspacing="0" cellpadding="0" width="100%">
-	  <?=$itm_clan[2]?>
-      </table>
-      <? }else{ echo '<center><br />��������� ����� �����<br /><br /></center>'; } ?>
-    </fieldset>
-         </td>
-         <td width="50%" valign="top">
-    <fieldset style="margin:0;padding:0">
-      <legend><span class="legtitle">������</span></legend>
-      <? if($itm_user[2] != '') { ?>
-      <table border="0" cellspacing="0" cellpadding="0" width="100%">
-	  <?=$itm_user[2]?>
-      </table>
-      <? }else{ echo '<center><br />������ ����<br /><br /></center>'; } ?>
-    </fieldset>
-         </td>
-       </tr>
-     </table>
-   </div>
-   <? }elseif(isset($_GET['titul']) && $tt[11][0]==1) { ?>
-   <script>
-   function editTitul(id) {
-		if($('#edpnltitul'+id).css('display') == 'none') {
-			$('#edpnltitul'+id).css({'display':''});
-		}else{
-			$('#edpnltitul'+id).css({'display':'none'});
-		}
-   }
-   </script>
-   <div class="box visible">
-        <?
-		if(isset($_POST['tituladd'])) {
-			//��������� ����� �����
-			$tc = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `clan_tituls` WHERE `clan` = "'.$res['id'].'" AND `delete` = "0" LIMIT 25'));
-			if($tc[0] >= 20) {
-				echo '<font color="#FF0000"><b>������ ��������� ����� 25-�� �������, ��� ���������� ������ ������� ������</b></font><br>';
-			}else{
-				$nm = htmlspecialchars($_POST['tituladd'],NULL,'cp1251');
-				if(str_replace(' ','',str_replace('	','',$nm)) == '') {
-					echo '<font color="#FF0000"><b>�������� ������ �� ������ ���� ������</b></font><br>';
-				}else{
-					mysql_query('INSERT INTO `clan_tituls` (`clan`,`user_add`,`time_add`,`name`) VALUES ("'.$res['id'].'","'.$u->info['id'].'","'.time().'","'.mysql_real_escape_string($nm).'")');
-					echo '<font color="#FF0000"><b>����� ��� ������� ��������</b></font><br>';
-				}
-			}
-		}elseif(isset($_GET['save'])) {
-			//��������� �����
-			$tc = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `clan` = "'.$res['id'].'" AND `id` = "'.mysql_real_escape_string($_GET['save']).'" AND `delete` = "0" LIMIT 1'));
-			if(isset($tc['id'])) {
-				$tc['info'] = htmlspecialchars($_POST['t_info'],NULL,'cp1251');
-				$i = 1;
-				$tc['canals'] = '';
-				while($i <= 9) {
-					if($_POST['t_klan'.$i]) {
-						$tc['canals'] .= '1';
-					}else{
-						$tc['canals'] .= '0';
-					}
-					$i++;
-				}
-				$i = 0;
-				$tc['prava'] = '';
-				while($i <= 20) {
-					if($_POST['t_tr'.$i]) {
-						$tc['prava'] .= '1';
-					}else{
-						$tc['prava'] .= '0';
-					}
-					$i++;
-				}
-				$_POST['colorsp'] = preg_replace('/[^a-z�-��0-9]/i','',$_POST['colorsp']);
-				// ��� 
-				
-				if($tc['prava'][11] == 1)
-				{
-				mysql_query('UPDATE `clan_tituls` SET `prioritet` = 1,  `info` = "'.mysql_real_escape_string($tc['info']).'", `color` = "'.mysql_real_escape_string($_POST['colorsp']).'", `canals` = "'.$tc['canals'].'", `prava` = "'.$tc['prava'].'" WHERE `id` = "'.$tc['id'].'" LIMIT 1');
-				}
-				else
-				{
-				mysql_query('UPDATE `clan_tituls` SET `prioritet` = 0, `info` = "'.mysql_real_escape_string($tc['info']).'", `color` = "'.mysql_real_escape_string($_POST['colorsp']).'", `canals` = "'.$tc['canals'].'", `prava` = "'.$tc['prava'].'" WHERE `id` = "'.$tc['id'].'" LIMIT 1');
-				}
-				echo '<font color="#FF0000"><b>����� ��� ������� ��������</b></font><br>';
-			}else{
-				echo '<font color="#FF0000"><b>����� �� ������</b></font><br>';
-			}
-		}elseif(isset($_GET['delete'])) {
-			$tc = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `clan` = "'.$res['id'].'" AND `id` = "'.mysql_real_escape_string($_GET['delete']).'" AND `delete` = "0" LIMIT 1'));
-			if(isset($tc['id'])) {
-				mysql_query('UPDATE `clan_tituls` SET `delete` = "'.$u->info['id'].'" WHERE `id` = "'.$tc['id'].'" LIMIT 1');
-				echo '<font color="#FF0000"><b>����� ��� ������</b></font><br>';
-			}else{
-				echo '<font color="#FF0000"><b>����� �� ������</b></font><br>';
-			}
-		}
-?>
-<div id="clrttl" style="display:none">
-<br /><br />
-<center><a onclick="ssclrttl()" href="javascript:void(0)">�������� ������ - ������</a></center>
-<br /><br />
-<table width="100%" cellpadding="10" cellspacing="5">
-  <tbody>
-    <tr>
-      <td>000000</td>
-      <td>000033</td>
-      <td>000066</td>
-      <td>000099</td>
-      <td>0000cc</td>
-      <td>0000ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#000000"></td>
-      <td bgcolor="#000033"></td>
-      <td bgcolor="#000066"></td>
-      <td bgcolor="#000099"></td>
-      <td bgcolor="#0000cc"></td>
-      <td bgcolor="#0000ff"></td>
-    </tr>
-    <tr>
-      <td>003300</td>
-      <td>003333</td>
-      <td>003366</td>
-      <td>003399</td>
-      <td>0033cc</td>
-      <td>0033ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#003300"></td>
-      <td bgcolor="#003333"></td>
-      <td bgcolor="#003366"></td>
-      <td bgcolor="#003399"></td>
-      <td bgcolor="#0033cc"></td>
-      <td bgcolor="#0033ff"></td>
-    </tr>
-    <tr>
-      <td>006600</td>
-      <td>006633</td>
-      <td>006666</td>
-      <td>006699</td>
-      <td>0066cc</td>
-      <td>0066ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#006600"></td>
-      <td bgcolor="#006633"></td>
-      <td bgcolor="#006666"></td>
-      <td bgcolor="#006699"></td>
-      <td bgcolor="#0066cc"></td>
-      <td bgcolor="#0066ff"></td>
-    </tr>
-    <tr>
-      <td>009900</td>
-      <td>009933</td>
-      <td>009966</td>
-      <td>009999</td>
-      <td>0099cc</td>
-      <td>0099ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#009900"></td>
-      <td bgcolor="#009933"></td>
-      <td bgcolor="#009966"></td>
-      <td bgcolor="#009999"></td>
-      <td bgcolor="#0099cc"></td>
-      <td bgcolor="#0099ff"></td>
-    </tr>
-    <tr>
-      <td>00cc00</td>
-      <td>00cc33</td>
-      <td>00cc66</td>
-      <td>00cc99</td>
-      <td>00cccc</td>
-      <td>00ccff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#00cc00"></td>
-      <td bgcolor="#00cc33"></td>
-      <td bgcolor="#00cc66"></td>
-      <td bgcolor="#00cc99"></td>
-      <td bgcolor="#00cccc"></td>
-      <td bgcolor="#00ccff"></td>
-    </tr>
-    <tr>
-      <td>00ff00</td>
-      <td>00ff33</td>
-      <td>00ff66</td>
-      <td>00ff99</td>
-      <td>00ffcc</td>
-      <td>00ffff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#00ff00"></td>
-      <td bgcolor="#00ff33"></td>
-      <td bgcolor="#00ff66"></td>
-      <td bgcolor="#00ff99"></td>
-      <td bgcolor="#00ffcc"></td>
-      <td bgcolor="#00ffff"></td>
-    </tr>
-    <tr>
-      <td>330000</td>
-      <td>330033</td>
-      <td>330066</td>
-      <td>330099</td>
-      <td>3300cc</td>
-      <td>3300ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#330000"></td>
-      <td bgcolor="#330033"></td>
-      <td bgcolor="#330066"></td>
-      <td bgcolor="#330099"></td>
-      <td bgcolor="#3300cc"></td>
-      <td bgcolor="#3300ff"></td>
-    </tr>
-    <tr>
-      <td>333300</td>
-      <td>333333</td>
-      <td>333366</td>
-      <td>333399</td>
-      <td>3333cc</td>
-      <td>3333ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#333300"></td>
-      <td bgcolor="#333333"></td>
-      <td bgcolor="#333366"></td>
-      <td bgcolor="#333399"></td>
-      <td bgcolor="#3333cc"></td>
-      <td bgcolor="#3333ff"></td>
-    </tr>
-    <tr>
-      <td>336600</td>
-      <td>336633</td>
-      <td>336666</td>
-      <td>336699</td>
-      <td>3366cc</td>
-      <td>3366ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#336600"></td>
-      <td bgcolor="#336633"></td>
-      <td bgcolor="#336666"></td>
-      <td bgcolor="#336699"></td>
-      <td bgcolor="#3366cc"></td>
-      <td bgcolor="#3366ff"></td>
-    </tr>
-    <tr>
-      <td>339900</td>
-      <td>339933</td>
-      <td>339966</td>
-      <td>339999</td>
-      <td>3399cc</td>
-      <td>3399ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#339900"></td>
-      <td bgcolor="#339933"></td>
-      <td bgcolor="#339966"></td>
-      <td bgcolor="#339999"></td>
-      <td bgcolor="#3399cc"></td>
-      <td bgcolor="#3399ff"></td>
-    </tr>
-    <tr>
-      <td>33cc00</td>
-      <td>33cc33</td>
-      <td>33cc66</td>
-      <td>33cc99</td>
-      <td>33cccc</td>
-      <td>33ccff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#33cc00"></td>
-      <td bgcolor="#33cc33"></td>
-      <td bgcolor="#33cc66"></td>
-      <td bgcolor="#33cc99"></td>
-      <td bgcolor="#33cccc"></td>
-      <td bgcolor="#33ccff"></td>
-    </tr>
-    <tr>
-      <td>33ff00</td>
-      <td>33ff33</td>
-      <td>33ff66</td>
-      <td>33ff99</td>
-      <td>33ffcc</td>
-      <td>33ffff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#33ff00"></td>
-      <td bgcolor="#33ff33"></td>
-      <td bgcolor="#33ff66"></td>
-      <td bgcolor="#33ff99"></td>
-      <td bgcolor="#33ffcc"></td>
-      <td bgcolor="#33ffff"></td>
-    </tr>
-    <tr>
-      <td>660000</td>
-      <td>660033</td>
-      <td>660066</td>
-      <td>660099</td>
-      <td>6600cc</td>
-      <td>6600ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#660000"></td>
-      <td bgcolor="#660033"></td>
-      <td bgcolor="#660066"></td>
-      <td bgcolor="#660099"></td>
-      <td bgcolor="#6600cc"></td>
-      <td bgcolor="#6600ff"></td>
-    </tr>
-    <tr>
-      <td>663300</td>
-      <td>663333</td>
-      <td>663366</td>
-      <td>663399</td>
-      <td>6633cc</td>
-      <td>6633ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#663300"></td>
-      <td bgcolor="#663333"></td>
-      <td bgcolor="#663366"></td>
-      <td bgcolor="#663399"></td>
-      <td bgcolor="#6633cc"></td>
-      <td bgcolor="#6633ff"></td>
-    </tr>
-    <tr>
-      <td>666600</td>
-      <td>666633</td>
-      <td>666666</td>
-      <td>666699</td>
-      <td>6666cc</td>
-      <td>6666ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#666600"></td>
-      <td bgcolor="#666633"></td>
-      <td bgcolor="#666666"></td>
-      <td bgcolor="#666699"></td>
-      <td bgcolor="#6666cc"></td>
-      <td bgcolor="#6666ff"></td>
-    </tr>
-    <tr>
-      <td>669900</td>
-      <td>669933</td>
-      <td>669966</td>
-      <td>669999</td>
-      <td>6699cc</td>
-      <td>6699ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#669900"></td>
-      <td bgcolor="#669933"></td>
-      <td bgcolor="#669966"></td>
-      <td bgcolor="#669999"></td>
-      <td bgcolor="#6699cc"></td>
-      <td bgcolor="#6699ff"></td>
-    </tr>
-    <tr>
-      <td>66cc00</td>
-      <td>66cc33</td>
-      <td>66cc66</td>
-      <td>66cc99</td>
-      <td>66cccc</td>
-      <td>66ccff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#66cc00"></td>
-      <td bgcolor="#66cc33"></td>
-      <td bgcolor="#66cc66"></td>
-      <td bgcolor="#66cc99"></td>
-      <td bgcolor="#66cccc"></td>
-      <td bgcolor="#66ccff"></td>
-    </tr>
-    <tr>
-      <td>66ff00</td>
-      <td>66ff33</td>
-      <td>66ff66</td>
-      <td>66ff99</td>
-      <td>66ffcc</td>
-      <td>66ffff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#66ff00"></td>
-      <td bgcolor="#66ff33"></td>
-      <td bgcolor="#66ff66"></td>
-      <td bgcolor="#66ff99"></td>
-      <td bgcolor="#66ffcc"></td>
-      <td bgcolor="#66ffff"></td>
-    </tr>
-    <tr>
-      <td>990000</td>
-      <td>990033</td>
-      <td>990066</td>
-      <td>990099</td>
-      <td>9900cc</td>
-      <td>9900ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#990000"></td>
-      <td bgcolor="#990033"></td>
-      <td bgcolor="#990066"></td>
-      <td bgcolor="#990099"></td>
-      <td bgcolor="#9900cc"></td>
-      <td bgcolor="#9900ff"></td>
-    </tr>
-    <tr>
-      <td>993300</td>
-      <td>993333</td>
-      <td>993366</td>
-      <td>993399</td>
-      <td>9933cc</td>
-      <td>9933ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#993300"></td>
-      <td bgcolor="#993333"></td>
-      <td bgcolor="#993366"></td>
-      <td bgcolor="#993399"></td>
-      <td bgcolor="#9933cc"></td>
-      <td bgcolor="#9933ff"></td>
-    </tr>
-    <tr>
-      <td>996600</td>
-      <td>996633</td>
-      <td>996666</td>
-      <td>996699</td>
-      <td>9966cc</td>
-      <td>9966ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#996600"></td>
-      <td bgcolor="#996633"></td>
-      <td bgcolor="#996666"></td>
-      <td bgcolor="#996699"></td>
-      <td bgcolor="#9966cc"></td>
-      <td bgcolor="#9966ff"></td>
-    </tr>
-    <tr>
-      <td>999900</td>
-      <td>999933</td>
-      <td>999966</td>
-      <td>999999</td>
-      <td>9999cc</td>
-      <td>9999ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#999900"></td>
-      <td bgcolor="#999933"></td>
-      <td bgcolor="#999966"></td>
-      <td bgcolor="#999999"></td>
-      <td bgcolor="#9999cc"></td>
-      <td bgcolor="#9999ff"></td>
-    </tr>
-    <tr>
-      <td>99cc00</td>
-      <td>99cc33</td>
-      <td>99cc66</td>
-      <td>99cc99</td>
-      <td>99cccc</td>
-      <td>99ccff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#99cc00"></td>
-      <td bgcolor="#99cc33"></td>
-      <td bgcolor="#99cc66"></td>
-      <td bgcolor="#99cc99"></td>
-      <td bgcolor="#99cccc"></td>
-      <td bgcolor="#99ccff"></td>
-    </tr>
-    <tr>
-      <td>99ff00</td>
-      <td>99ff33</td>
-      <td>99ff66</td>
-      <td>99ff99</td>
-      <td>99ffcc</td>
-      <td>99ffff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#99ff00"></td>
-      <td bgcolor="#99ff33"></td>
-      <td bgcolor="#99ff66"></td>
-      <td bgcolor="#99ff99"></td>
-      <td bgcolor="#99ffcc"></td>
-      <td bgcolor="#99ffff"></td>
-    </tr>
-    <tr>
-      <td>cc0000</td>
-      <td>cc0033</td>
-      <td>cc0066</td>
-      <td>cc0099</td>
-      <td>cc00cc</td>
-      <td>cc00ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#cc0000"></td>
-      <td bgcolor="#cc0033"></td>
-      <td bgcolor="#cc0066"></td>
-      <td bgcolor="#cc0099"></td>
-      <td bgcolor="#cc00cc"></td>
-      <td bgcolor="#cc00ff"></td>
-    </tr>
-    <tr>
-      <td>cc3300</td>
-      <td>cc3333</td>
-      <td>cc3366</td>
-      <td>cc3399</td>
-      <td>cc33cc</td>
-      <td>cc33ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#cc3300"></td>
-      <td bgcolor="#cc3333"></td>
-      <td bgcolor="#cc3366"></td>
-      <td bgcolor="#cc3399"></td>
-      <td bgcolor="#cc33cc"></td>
-      <td bgcolor="#cc33ff"></td>
-    </tr>
-    <tr>
-      <td>cc6600</td>
-      <td>cc6633</td>
-      <td>cc6666</td>
-      <td>cc6699</td>
-      <td>cc66cc</td>
-      <td>cc66ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#cc6600"></td>
-      <td bgcolor="#cc6633"></td>
-      <td bgcolor="#cc6666"></td>
-      <td bgcolor="#cc6699"></td>
-      <td bgcolor="#cc66cc"></td>
-      <td bgcolor="#cc66ff"></td>
-    </tr>
-    <tr>
-      <td>cc9900</td>
-      <td>cc9933</td>
-      <td>cc9966</td>
-      <td>cc9999</td>
-      <td>cc99cc</td>
-      <td>cc99ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#cc9900"></td>
-      <td bgcolor="#cc9933"></td>
-      <td bgcolor="#cc9966"></td>
-      <td bgcolor="#cc9999"></td>
-      <td bgcolor="#cc99cc"></td>
-      <td bgcolor="#cc99ff"></td>
-    </tr>
-    <tr>
-      <td>cccc00</td>
-      <td>cccc33</td>
-      <td>cccc66</td>
-      <td>cccc99</td>
-      <td>cccccc</td>
-      <td>ccccff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#cccc00"></td>
-      <td bgcolor="#cccc33"></td>
-      <td bgcolor="#cccc66"></td>
-      <td bgcolor="#cccc99"></td>
-      <td bgcolor="#cccccc"></td>
-      <td bgcolor="#ccccff"></td>
-    </tr>
-    <tr>
-      <td>ccff00</td>
-      <td>ccff33</td>
-      <td>ccff66</td>
-      <td>ccff99</td>
-      <td>ccffcc</td>
-      <td>ccffff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#ccff00"></td>
-      <td bgcolor="#ccff33"></td>
-      <td bgcolor="#ccff66"></td>
-      <td bgcolor="#ccff99"></td>
-      <td bgcolor="#ccffcc"></td>
-      <td bgcolor="#ccffff"></td>
-    </tr>
-    <tr>
-      <td>ff0000</td>
-      <td>ff0033</td>
-      <td>ff0066</td>
-      <td>ff0099</td>
-      <td>ff00cc</td>
-      <td>ff00ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#ff0000"></td>
-      <td bgcolor="#ff0033"></td>
-      <td bgcolor="#ff0066"></td>
-      <td bgcolor="#ff0099"></td>
-      <td bgcolor="#ff00cc"></td>
-      <td bgcolor="#ff00ff"></td>
-    </tr>
-    <tr>
-      <td>ff3300</td>
-      <td>ff3333</td>
-      <td>ff3366</td>
-      <td>ff3399</td>
-      <td>ff33cc</td>
-      <td>ff33ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#ff3300"></td>
-      <td bgcolor="#ff3333"></td>
-      <td bgcolor="#ff3366"></td>
-      <td bgcolor="#ff3399"></td>
-      <td bgcolor="#ff33cc"></td>
-      <td bgcolor="#ff33ff"></td>
-    </tr>
-    <tr>
-      <td>ff6600</td>
-      <td>ff6633</td>
-      <td>ff6666</td>
-      <td>ff6699</td>
-      <td>ff66cc</td>
-      <td>ff66ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#ff6600"></td>
-      <td bgcolor="#ff6633"></td>
-      <td bgcolor="#ff6666"></td>
-      <td bgcolor="#ff6699"></td>
-      <td bgcolor="#ff66cc"></td>
-      <td bgcolor="#ff66ff"></td>
-    </tr>
-    <tr>
-      <td>ff9900</td>
-      <td>ff9933</td>
-      <td>ff9966</td>
-      <td>ff9999</td>
-      <td>ff99cc</td>
-      <td>ff99ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#ff9900"></td>
-      <td bgcolor="#ff9933"></td>
-      <td bgcolor="#ff9966"></td>
-      <td bgcolor="#ff9999"></td>
-      <td bgcolor="#ff99cc"></td>
-      <td bgcolor="#ff99ff"></td>
-    </tr>
-    <tr>
-      <td>ffcc00</td>
-      <td>ffcc33</td>
-      <td>ffcc66</td>
-      <td>ffcc99</td>
-      <td>ffcccc</td>
-      <td>ffccff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#ffcc00"></td>
-      <td bgcolor="#ffcc33"></td>
-      <td bgcolor="#ffcc66"></td>
-      <td bgcolor="#ffcc99"></td>
-      <td bgcolor="#ffcccc"></td>
-      <td bgcolor="#ffccff"></td>
-    </tr>
-    <tr>
-      <td>ffff00</td>
-      <td>ffff33</td>
-      <td>ffff66</td>
-      <td>ffff99</td>
-      <td>ffffcc</td>
-      <td>ffffff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#ffff00"></td>
-      <td bgcolor="#ffff33"></td>
-      <td bgcolor="#ffff66"></td>
-      <td bgcolor="#ffff99"></td>
-      <td bgcolor="#ffffcc"></td>
-      <td bgcolor="#ffffff"></td>
-    </tr>
-  </tbody>
-</table>
-</div>
-<script>
-function ssclrttl() {
-	if($('#clrttl').css('display') == 'none') {
-		$('#clrttl').css({'display':''});
-	}else{
-		$('#clrttl').css({'display':'none'});
-	}
-}
-</script>
-<?
-		$i = 0;
-		$sp = mysql_query('SELECT * FROM `clan_tituls` WHERE `clan` = "'.$res['id'].'" AND `delete` = "0" LIMIT 25');
-		while($pl = mysql_fetch_array($sp)) {
-		?>
-		<div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-        
-        <b style="color:#<?=$pl['color']?>">*</b> &nbsp; <a style="display:inline-block;width:250px;" onclick="editTitul(<?=$pl['id']?>)" href="javascript:void(0)"><?=$pl['name']?></a><font color="#999999"><i><?=$pl['info']?></i></font>
-        <img src="https://img.new-combats.com/i/clear.gif" title="������� �����" onclick="location='main.php?clan&titul&delete=<?=$pl['id']?>'" style="float:right;cursor:pointer;">
-        <div id="edpnltitul<?=$pl['id']?>" style="display:none;margin:10px;border:1px solid #9e9e9e;padding:10px;">
-           <form method="post" action="?clan&titul&save=<?=$pl['id']?>">
-           <span style="float:right"><a onclick="editTitul(<?=$pl['id']?>)" href="javascript:void(0)">x</a></span>
-                <center>�������������� ������ <a onclick="editTitul(<?=$pl['id']?>)" href="javascript:void(0)"><?=$pl['name']?></a></center><br>
-                ��������: <input style="width:360px;" value="<?=$pl['info']?>" type="text" name="t_info"><br>
-                <br>
-                ������ ����: 
-                <? $j = 1;
-				while($j <= 9) {
-						if($pl['canals'][$j-1] == 1) {
-							$pl['check'] = 'checked';
-						}else{
-							$pl['check'] = '';
-						}
-				?> 
-                <label for="t_klan<?=$j?>"><?=$j?></label>
-                <input <?=$pl['check']?> type="checkbox" <?=$pl['check2']?> name="t_klan<?=$j?>" id="t_klan<?=$j?>">
-                <? $j++; }
-				echo '<br><br>';
-				$j = 1;
-				while($j < count($tt)) {
-					if($tt[$j][1] != '0') {
-						if($pl['prava'][$j] == 1) {
-							$pl['check'] = 'checked';
-						}else{
-							$pl['check'] = '';
-						}
-						?>
-                <input <?=$pl['check']?> type="checkbox" name="t_tr<?=$j?>" id="t_tr<?=$j?>">
-                <label for="t_tr<?=$j?>"><?=$tt[$j][1]?></label><br>
-                        <?
-					}
-					$j++;
-				}
-				?>
-                <br>
-                ��������: *<br>
-                ����: &nbsp; &nbsp; &nbsp; <div style="cursor:pointer;display:inline-block;width:20px;height:15px;background-color:#<?=$pl['color']?>">&nbsp;</div> #<input name="colorsp" maxlength="6" type="text" value="<?=$pl['color']?>" /><br />
-                <small>(�� ������ ������������� <a onclick="ssclrttl()" href="javascript:void(0)">�������� ������ - ��������/������</a>)</small><br />
-       		 <br><br>
-                <input type="submit" value="���������">
-          </form>
-          </div>
+                if ($tc['prava'][11] == 1) {
+                    mysql_query(
+                        'UPDATE `clan_tituls` SET `prioritet` = 1,  `info` = "' . mysql_real_escape_string(
+                            $tc['info']
+                        ) . '", `color` = "' . mysql_real_escape_string(
+                            $_POST['colorsp']
+                        ) . '", `canals` = "' . $tc['canals'] . '", `prava` = "' . $tc['prava'] . '" WHERE `id` = "' . $tc['id'] . '" LIMIT 1'
+                    );
+                } else {
+                    mysql_query(
+                        'UPDATE `clan_tituls` SET `prioritet` = 0, `info` = "' . mysql_real_escape_string(
+                            $tc['info']
+                        ) . '", `color` = "' . mysql_real_escape_string(
+                            $_POST['colorsp']
+                        ) . '", `canals` = "' . $tc['canals'] . '", `prava` = "' . $tc['prava'] . '" WHERE `id` = "' . $tc['id'] . '" LIMIT 1'
+                    );
+                }
+                echo '<font color="#FF0000"><b>����� ��� ������� ��������</b></font><br>';
+            } else {
+                echo '<font color="#FF0000"><b>����� �� ������</b></font><br>';
+            }
+        } elseif (isset($_GET['delete'])) {
+            $tc = mysql_fetch_array(
+                mysql_query(
+                    'SELECT * FROM `clan_tituls` WHERE `clan` = "' . $res['id'] . '" AND `id` = "' . mysql_real_escape_string(
+                        $_GET['delete']
+                    ) . '" AND `delete` = "0" LIMIT 1'
+                )
+            );
+            if (isset($tc['id'])) {
+                mysql_query(
+                    'UPDATE `clan_tituls` SET `delete` = "' . $u->info['id'] . '" WHERE `id` = "' . $tc['id'] . '" LIMIT 1'
+                );
+                echo '<font color="#FF0000"><b>����� ��� ������</b></font><br>';
+            } else {
+                echo '<font color="#FF0000"><b>����� �� ������</b></font><br>';
+            }
+        }
+        ?>
+        <div id="clrttl" style="display:none">
+            <br/><br/>
+            <center><a onclick="ssclrttl()" href="javascript:void(0)">�������� ������ - ������</a></center>
+            <br/><br/>
+            <table width="100%" cellpadding="10" cellspacing="5">
+                <tbody>
+                <tr>
+                    <td>000000</td>
+                    <td>000033</td>
+                    <td>000066</td>
+                    <td>000099</td>
+                    <td>0000cc</td>
+                    <td>0000ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#000000"></td>
+                    <td bgcolor="#000033"></td>
+                    <td bgcolor="#000066"></td>
+                    <td bgcolor="#000099"></td>
+                    <td bgcolor="#0000cc"></td>
+                    <td bgcolor="#0000ff"></td>
+                </tr>
+                <tr>
+                    <td>003300</td>
+                    <td>003333</td>
+                    <td>003366</td>
+                    <td>003399</td>
+                    <td>0033cc</td>
+                    <td>0033ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#003300"></td>
+                    <td bgcolor="#003333"></td>
+                    <td bgcolor="#003366"></td>
+                    <td bgcolor="#003399"></td>
+                    <td bgcolor="#0033cc"></td>
+                    <td bgcolor="#0033ff"></td>
+                </tr>
+                <tr>
+                    <td>006600</td>
+                    <td>006633</td>
+                    <td>006666</td>
+                    <td>006699</td>
+                    <td>0066cc</td>
+                    <td>0066ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#006600"></td>
+                    <td bgcolor="#006633"></td>
+                    <td bgcolor="#006666"></td>
+                    <td bgcolor="#006699"></td>
+                    <td bgcolor="#0066cc"></td>
+                    <td bgcolor="#0066ff"></td>
+                </tr>
+                <tr>
+                    <td>009900</td>
+                    <td>009933</td>
+                    <td>009966</td>
+                    <td>009999</td>
+                    <td>0099cc</td>
+                    <td>0099ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#009900"></td>
+                    <td bgcolor="#009933"></td>
+                    <td bgcolor="#009966"></td>
+                    <td bgcolor="#009999"></td>
+                    <td bgcolor="#0099cc"></td>
+                    <td bgcolor="#0099ff"></td>
+                </tr>
+                <tr>
+                    <td>00cc00</td>
+                    <td>00cc33</td>
+                    <td>00cc66</td>
+                    <td>00cc99</td>
+                    <td>00cccc</td>
+                    <td>00ccff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#00cc00"></td>
+                    <td bgcolor="#00cc33"></td>
+                    <td bgcolor="#00cc66"></td>
+                    <td bgcolor="#00cc99"></td>
+                    <td bgcolor="#00cccc"></td>
+                    <td bgcolor="#00ccff"></td>
+                </tr>
+                <tr>
+                    <td>00ff00</td>
+                    <td>00ff33</td>
+                    <td>00ff66</td>
+                    <td>00ff99</td>
+                    <td>00ffcc</td>
+                    <td>00ffff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#00ff00"></td>
+                    <td bgcolor="#00ff33"></td>
+                    <td bgcolor="#00ff66"></td>
+                    <td bgcolor="#00ff99"></td>
+                    <td bgcolor="#00ffcc"></td>
+                    <td bgcolor="#00ffff"></td>
+                </tr>
+                <tr>
+                    <td>330000</td>
+                    <td>330033</td>
+                    <td>330066</td>
+                    <td>330099</td>
+                    <td>3300cc</td>
+                    <td>3300ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#330000"></td>
+                    <td bgcolor="#330033"></td>
+                    <td bgcolor="#330066"></td>
+                    <td bgcolor="#330099"></td>
+                    <td bgcolor="#3300cc"></td>
+                    <td bgcolor="#3300ff"></td>
+                </tr>
+                <tr>
+                    <td>333300</td>
+                    <td>333333</td>
+                    <td>333366</td>
+                    <td>333399</td>
+                    <td>3333cc</td>
+                    <td>3333ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#333300"></td>
+                    <td bgcolor="#333333"></td>
+                    <td bgcolor="#333366"></td>
+                    <td bgcolor="#333399"></td>
+                    <td bgcolor="#3333cc"></td>
+                    <td bgcolor="#3333ff"></td>
+                </tr>
+                <tr>
+                    <td>336600</td>
+                    <td>336633</td>
+                    <td>336666</td>
+                    <td>336699</td>
+                    <td>3366cc</td>
+                    <td>3366ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#336600"></td>
+                    <td bgcolor="#336633"></td>
+                    <td bgcolor="#336666"></td>
+                    <td bgcolor="#336699"></td>
+                    <td bgcolor="#3366cc"></td>
+                    <td bgcolor="#3366ff"></td>
+                </tr>
+                <tr>
+                    <td>339900</td>
+                    <td>339933</td>
+                    <td>339966</td>
+                    <td>339999</td>
+                    <td>3399cc</td>
+                    <td>3399ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#339900"></td>
+                    <td bgcolor="#339933"></td>
+                    <td bgcolor="#339966"></td>
+                    <td bgcolor="#339999"></td>
+                    <td bgcolor="#3399cc"></td>
+                    <td bgcolor="#3399ff"></td>
+                </tr>
+                <tr>
+                    <td>33cc00</td>
+                    <td>33cc33</td>
+                    <td>33cc66</td>
+                    <td>33cc99</td>
+                    <td>33cccc</td>
+                    <td>33ccff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#33cc00"></td>
+                    <td bgcolor="#33cc33"></td>
+                    <td bgcolor="#33cc66"></td>
+                    <td bgcolor="#33cc99"></td>
+                    <td bgcolor="#33cccc"></td>
+                    <td bgcolor="#33ccff"></td>
+                </tr>
+                <tr>
+                    <td>33ff00</td>
+                    <td>33ff33</td>
+                    <td>33ff66</td>
+                    <td>33ff99</td>
+                    <td>33ffcc</td>
+                    <td>33ffff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#33ff00"></td>
+                    <td bgcolor="#33ff33"></td>
+                    <td bgcolor="#33ff66"></td>
+                    <td bgcolor="#33ff99"></td>
+                    <td bgcolor="#33ffcc"></td>
+                    <td bgcolor="#33ffff"></td>
+                </tr>
+                <tr>
+                    <td>660000</td>
+                    <td>660033</td>
+                    <td>660066</td>
+                    <td>660099</td>
+                    <td>6600cc</td>
+                    <td>6600ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#660000"></td>
+                    <td bgcolor="#660033"></td>
+                    <td bgcolor="#660066"></td>
+                    <td bgcolor="#660099"></td>
+                    <td bgcolor="#6600cc"></td>
+                    <td bgcolor="#6600ff"></td>
+                </tr>
+                <tr>
+                    <td>663300</td>
+                    <td>663333</td>
+                    <td>663366</td>
+                    <td>663399</td>
+                    <td>6633cc</td>
+                    <td>6633ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#663300"></td>
+                    <td bgcolor="#663333"></td>
+                    <td bgcolor="#663366"></td>
+                    <td bgcolor="#663399"></td>
+                    <td bgcolor="#6633cc"></td>
+                    <td bgcolor="#6633ff"></td>
+                </tr>
+                <tr>
+                    <td>666600</td>
+                    <td>666633</td>
+                    <td>666666</td>
+                    <td>666699</td>
+                    <td>6666cc</td>
+                    <td>6666ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#666600"></td>
+                    <td bgcolor="#666633"></td>
+                    <td bgcolor="#666666"></td>
+                    <td bgcolor="#666699"></td>
+                    <td bgcolor="#6666cc"></td>
+                    <td bgcolor="#6666ff"></td>
+                </tr>
+                <tr>
+                    <td>669900</td>
+                    <td>669933</td>
+                    <td>669966</td>
+                    <td>669999</td>
+                    <td>6699cc</td>
+                    <td>6699ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#669900"></td>
+                    <td bgcolor="#669933"></td>
+                    <td bgcolor="#669966"></td>
+                    <td bgcolor="#669999"></td>
+                    <td bgcolor="#6699cc"></td>
+                    <td bgcolor="#6699ff"></td>
+                </tr>
+                <tr>
+                    <td>66cc00</td>
+                    <td>66cc33</td>
+                    <td>66cc66</td>
+                    <td>66cc99</td>
+                    <td>66cccc</td>
+                    <td>66ccff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#66cc00"></td>
+                    <td bgcolor="#66cc33"></td>
+                    <td bgcolor="#66cc66"></td>
+                    <td bgcolor="#66cc99"></td>
+                    <td bgcolor="#66cccc"></td>
+                    <td bgcolor="#66ccff"></td>
+                </tr>
+                <tr>
+                    <td>66ff00</td>
+                    <td>66ff33</td>
+                    <td>66ff66</td>
+                    <td>66ff99</td>
+                    <td>66ffcc</td>
+                    <td>66ffff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#66ff00"></td>
+                    <td bgcolor="#66ff33"></td>
+                    <td bgcolor="#66ff66"></td>
+                    <td bgcolor="#66ff99"></td>
+                    <td bgcolor="#66ffcc"></td>
+                    <td bgcolor="#66ffff"></td>
+                </tr>
+                <tr>
+                    <td>990000</td>
+                    <td>990033</td>
+                    <td>990066</td>
+                    <td>990099</td>
+                    <td>9900cc</td>
+                    <td>9900ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#990000"></td>
+                    <td bgcolor="#990033"></td>
+                    <td bgcolor="#990066"></td>
+                    <td bgcolor="#990099"></td>
+                    <td bgcolor="#9900cc"></td>
+                    <td bgcolor="#9900ff"></td>
+                </tr>
+                <tr>
+                    <td>993300</td>
+                    <td>993333</td>
+                    <td>993366</td>
+                    <td>993399</td>
+                    <td>9933cc</td>
+                    <td>9933ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#993300"></td>
+                    <td bgcolor="#993333"></td>
+                    <td bgcolor="#993366"></td>
+                    <td bgcolor="#993399"></td>
+                    <td bgcolor="#9933cc"></td>
+                    <td bgcolor="#9933ff"></td>
+                </tr>
+                <tr>
+                    <td>996600</td>
+                    <td>996633</td>
+                    <td>996666</td>
+                    <td>996699</td>
+                    <td>9966cc</td>
+                    <td>9966ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#996600"></td>
+                    <td bgcolor="#996633"></td>
+                    <td bgcolor="#996666"></td>
+                    <td bgcolor="#996699"></td>
+                    <td bgcolor="#9966cc"></td>
+                    <td bgcolor="#9966ff"></td>
+                </tr>
+                <tr>
+                    <td>999900</td>
+                    <td>999933</td>
+                    <td>999966</td>
+                    <td>999999</td>
+                    <td>9999cc</td>
+                    <td>9999ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#999900"></td>
+                    <td bgcolor="#999933"></td>
+                    <td bgcolor="#999966"></td>
+                    <td bgcolor="#999999"></td>
+                    <td bgcolor="#9999cc"></td>
+                    <td bgcolor="#9999ff"></td>
+                </tr>
+                <tr>
+                    <td>99cc00</td>
+                    <td>99cc33</td>
+                    <td>99cc66</td>
+                    <td>99cc99</td>
+                    <td>99cccc</td>
+                    <td>99ccff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#99cc00"></td>
+                    <td bgcolor="#99cc33"></td>
+                    <td bgcolor="#99cc66"></td>
+                    <td bgcolor="#99cc99"></td>
+                    <td bgcolor="#99cccc"></td>
+                    <td bgcolor="#99ccff"></td>
+                </tr>
+                <tr>
+                    <td>99ff00</td>
+                    <td>99ff33</td>
+                    <td>99ff66</td>
+                    <td>99ff99</td>
+                    <td>99ffcc</td>
+                    <td>99ffff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#99ff00"></td>
+                    <td bgcolor="#99ff33"></td>
+                    <td bgcolor="#99ff66"></td>
+                    <td bgcolor="#99ff99"></td>
+                    <td bgcolor="#99ffcc"></td>
+                    <td bgcolor="#99ffff"></td>
+                </tr>
+                <tr>
+                    <td>cc0000</td>
+                    <td>cc0033</td>
+                    <td>cc0066</td>
+                    <td>cc0099</td>
+                    <td>cc00cc</td>
+                    <td>cc00ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#cc0000"></td>
+                    <td bgcolor="#cc0033"></td>
+                    <td bgcolor="#cc0066"></td>
+                    <td bgcolor="#cc0099"></td>
+                    <td bgcolor="#cc00cc"></td>
+                    <td bgcolor="#cc00ff"></td>
+                </tr>
+                <tr>
+                    <td>cc3300</td>
+                    <td>cc3333</td>
+                    <td>cc3366</td>
+                    <td>cc3399</td>
+                    <td>cc33cc</td>
+                    <td>cc33ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#cc3300"></td>
+                    <td bgcolor="#cc3333"></td>
+                    <td bgcolor="#cc3366"></td>
+                    <td bgcolor="#cc3399"></td>
+                    <td bgcolor="#cc33cc"></td>
+                    <td bgcolor="#cc33ff"></td>
+                </tr>
+                <tr>
+                    <td>cc6600</td>
+                    <td>cc6633</td>
+                    <td>cc6666</td>
+                    <td>cc6699</td>
+                    <td>cc66cc</td>
+                    <td>cc66ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#cc6600"></td>
+                    <td bgcolor="#cc6633"></td>
+                    <td bgcolor="#cc6666"></td>
+                    <td bgcolor="#cc6699"></td>
+                    <td bgcolor="#cc66cc"></td>
+                    <td bgcolor="#cc66ff"></td>
+                </tr>
+                <tr>
+                    <td>cc9900</td>
+                    <td>cc9933</td>
+                    <td>cc9966</td>
+                    <td>cc9999</td>
+                    <td>cc99cc</td>
+                    <td>cc99ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#cc9900"></td>
+                    <td bgcolor="#cc9933"></td>
+                    <td bgcolor="#cc9966"></td>
+                    <td bgcolor="#cc9999"></td>
+                    <td bgcolor="#cc99cc"></td>
+                    <td bgcolor="#cc99ff"></td>
+                </tr>
+                <tr>
+                    <td>cccc00</td>
+                    <td>cccc33</td>
+                    <td>cccc66</td>
+                    <td>cccc99</td>
+                    <td>cccccc</td>
+                    <td>ccccff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#cccc00"></td>
+                    <td bgcolor="#cccc33"></td>
+                    <td bgcolor="#cccc66"></td>
+                    <td bgcolor="#cccc99"></td>
+                    <td bgcolor="#cccccc"></td>
+                    <td bgcolor="#ccccff"></td>
+                </tr>
+                <tr>
+                    <td>ccff00</td>
+                    <td>ccff33</td>
+                    <td>ccff66</td>
+                    <td>ccff99</td>
+                    <td>ccffcc</td>
+                    <td>ccffff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#ccff00"></td>
+                    <td bgcolor="#ccff33"></td>
+                    <td bgcolor="#ccff66"></td>
+                    <td bgcolor="#ccff99"></td>
+                    <td bgcolor="#ccffcc"></td>
+                    <td bgcolor="#ccffff"></td>
+                </tr>
+                <tr>
+                    <td>ff0000</td>
+                    <td>ff0033</td>
+                    <td>ff0066</td>
+                    <td>ff0099</td>
+                    <td>ff00cc</td>
+                    <td>ff00ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#ff0000"></td>
+                    <td bgcolor="#ff0033"></td>
+                    <td bgcolor="#ff0066"></td>
+                    <td bgcolor="#ff0099"></td>
+                    <td bgcolor="#ff00cc"></td>
+                    <td bgcolor="#ff00ff"></td>
+                </tr>
+                <tr>
+                    <td>ff3300</td>
+                    <td>ff3333</td>
+                    <td>ff3366</td>
+                    <td>ff3399</td>
+                    <td>ff33cc</td>
+                    <td>ff33ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#ff3300"></td>
+                    <td bgcolor="#ff3333"></td>
+                    <td bgcolor="#ff3366"></td>
+                    <td bgcolor="#ff3399"></td>
+                    <td bgcolor="#ff33cc"></td>
+                    <td bgcolor="#ff33ff"></td>
+                </tr>
+                <tr>
+                    <td>ff6600</td>
+                    <td>ff6633</td>
+                    <td>ff6666</td>
+                    <td>ff6699</td>
+                    <td>ff66cc</td>
+                    <td>ff66ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#ff6600"></td>
+                    <td bgcolor="#ff6633"></td>
+                    <td bgcolor="#ff6666"></td>
+                    <td bgcolor="#ff6699"></td>
+                    <td bgcolor="#ff66cc"></td>
+                    <td bgcolor="#ff66ff"></td>
+                </tr>
+                <tr>
+                    <td>ff9900</td>
+                    <td>ff9933</td>
+                    <td>ff9966</td>
+                    <td>ff9999</td>
+                    <td>ff99cc</td>
+                    <td>ff99ff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#ff9900"></td>
+                    <td bgcolor="#ff9933"></td>
+                    <td bgcolor="#ff9966"></td>
+                    <td bgcolor="#ff9999"></td>
+                    <td bgcolor="#ff99cc"></td>
+                    <td bgcolor="#ff99ff"></td>
+                </tr>
+                <tr>
+                    <td>ffcc00</td>
+                    <td>ffcc33</td>
+                    <td>ffcc66</td>
+                    <td>ffcc99</td>
+                    <td>ffcccc</td>
+                    <td>ffccff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#ffcc00"></td>
+                    <td bgcolor="#ffcc33"></td>
+                    <td bgcolor="#ffcc66"></td>
+                    <td bgcolor="#ffcc99"></td>
+                    <td bgcolor="#ffcccc"></td>
+                    <td bgcolor="#ffccff"></td>
+                </tr>
+                <tr>
+                    <td>ffff00</td>
+                    <td>ffff33</td>
+                    <td>ffff66</td>
+                    <td>ffff99</td>
+                    <td>ffffcc</td>
+                    <td>ffffff</td>
+                </tr>
+                <tr>
+                    <td bgcolor="#ffff00"></td>
+                    <td bgcolor="#ffff33"></td>
+                    <td bgcolor="#ffff66"></td>
+                    <td bgcolor="#ffff99"></td>
+                    <td bgcolor="#ffffcc"></td>
+                    <td bgcolor="#ffffff"></td>
+                </tr>
+                </tbody>
+            </table>
         </div>
-     <?
-   		$i++;
-		}
+        <script>
+            function ssclrttl() {
+                if ($('#clrttl').css('display') == 'none') {
+                    $('#clrttl').css({'display': ''});
+                } else {
+                    $('#clrttl').css({'display': 'none'});
+                }
+            }
+        </script>
+        <?php
+        $i = 0;
+        $sp = mysql_query(
+            'SELECT * FROM `clan_tituls` WHERE `clan` = "' . $res['id'] . '" AND `delete` = "0" LIMIT 25'
+        );
+        while ($pl = mysql_fetch_array($sp)) {
+            ?>
+            <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
 
-		if($i == 0) {
-			echo '� ����� ��� �� ������ ������';
-		}
-		?>
-        <input type="button" onclick="addNewTitul()" value="�������� �����">
-   </div>
-   <? }elseif(isset($_GET['rules'])) { ?>
-   <div  class="box visible">
-    <fieldset style="border:1px dashed #eeeeee">
-      <legend><span class="legtitle">����� ��������� &quot;<?=$u->info['login']?>&quot;</span></legend>
-      <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-      ������ � �����: <b><?
-      
-	  if($u->info['clan_prava'] != 'glava') {
-		echo $u->info['moder_zvanie'];  
-	  }else{
-		echo '<b style="color:#008097">����� �����</b>'; 
-	  }
-	  
-	  ?></b>
-      </div>
-      <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-      �����: <b><?=$utitl['name']?></b> &nbsp; - &nbsp; <font color="#999999"><?=$utitl['info']?></font>
-      </div>
-                <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-                ������ ����: 
-                <? $j = 1;
-				while($j <= 9) {
-					if($utitl['canals'][$j-1] == 1) {
-                		$r .= '<a href="javascript:void(0)">klan-'.$j.'</a>, ';
-					}
-               	 	$j++;
-				}
-				echo rtrim($r,', ');
-				?>
-                </div>              
-                <?
-				$j = 1;
-				while($j < count($tt)) {
-					if($tt[$j][1] != '0') {
-						if($utitl['prava'][$j] == 1) {
-							$utitl['check'] = '��';
-						}else{
-							$utitl['check'] = '���';
-						}
-						?>
-                <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-                <div style="display:inline-block;width:410px;">&bull; <?=$tt[$j][1]?></div><?=$utitl['check']?>
+                <b style="color:#<?= $pl['color'] ?>">*</b> &nbsp; <a style="display:inline-block;width:250px;"
+                                                                      onclick="editTitul(<?= $pl['id'] ?>)"
+                                                                      href="javascript:void(0)"><?= $pl['name'] ?></a><font
+                        color="#999999"><i><?= $pl['info'] ?></i></font>
+                <img src="https://img.new-combats.com/i/clear.gif" title="������� �����"
+                     onclick="location='main.php?clan&titul&delete=<?= $pl['id'] ?>'"
+                     style="float:right;cursor:pointer;">
+                <div id="edpnltitul<?= $pl['id'] ?>"
+                     style="display:none;margin:10px;border:1px solid #9e9e9e;padding:10px;">
+                    <form method="post" action="?clan&titul&save=<?= $pl['id'] ?>">
+                        <span style="float:right"><a onclick="editTitul(<?= $pl['id'] ?>)"
+                                                     href="javascript:void(0)">x</a></span>
+                        <center>�������������� ������ <a onclick="editTitul(<?= $pl['id'] ?>)"
+                                                         href="javascript:void(0)"><?= $pl['name'] ?></a></center>
+                        <br>
+                        ��������: <input style="width:360px;" value="<?= $pl['info'] ?>" type="text" name="t_info"><br>
+                        <br>
+                        ������ ����:
+                        <?php $j = 1;
+                        while ($j <= 9) {
+                            if ($pl['canals'][$j - 1] == 1) {
+                                $pl['check'] = 'checked';
+                            } else {
+                                $pl['check'] = '';
+                            }
+                            ?>
+                            <label for="t_klan<?= $j ?>"><?= $j ?></label>
+                            <input <?= $pl['check'] ?> type="checkbox" <?= $pl['check2'] ?> name="t_klan<?= $j ?>"
+                                                       id="t_klan<?= $j ?>">
+                            <?php $j++;
+                        }
+                        echo '<br><br>';
+                        $j = 1;
+                        while ($j < count($tt)) {
+                            if ($tt[$j][1] != '0') {
+                                if ($pl['prava'][$j] == 1) {
+                                    $pl['check'] = 'checked';
+                                } else {
+                                    $pl['check'] = '';
+                                }
+                                ?>
+                                <input <?= $pl['check'] ?> type="checkbox" name="t_tr<?= $j ?>" id="t_tr<?= $j ?>">
+                                <label for="t_tr<?= $j ?>"><?= $tt[$j][1] ?></label><br>
+                                <?php
+                            }
+                            $j++;
+                        }
+                        ?>
+                        <br>
+                        ��������: *<br>
+                        ����: &nbsp; &nbsp; &nbsp;
+                        <div style="cursor:pointer;display:inline-block;width:20px;height:15px;background-color:#<?= $pl['color'] ?>">
+                            &nbsp;
+                        </div>
+                        #<input name="colorsp" maxlength="6" type="text" value="<?= $pl['color'] ?>"/><br/>
+                        <small>(�� ������ ������������� <a onclick="ssclrttl()" href="javascript:void(0)">��������
+                                ������ - ��������/������</a>)</small><br/>
+                        <br><br>
+                        <input type="submit" value="���������">
+                    </form>
                 </div>
-                        <?
-					}
-					$j++;
-				}
-				?>
-                
-    </fieldset>
-   </div>
-   <? }elseif(isset($_GET['info'])) {
-	  
-	  //���������� ����
-	  $edd = mysql_fetch_array(mysql_query('SELECT SUM(`exp`) FROM `clan_exp` WHERE `clan` = "'.$res['id'].'" AND `dd` = "'.ceil(date('d')).'" AND `mm` = "'.ceil(date('m')).'" AND `yyyy` = "'.ceil(date('Y')).'"'));
-	  $eww = mysql_fetch_array(mysql_query('SELECT SUM(`exp`) FROM `clan_exp` WHERE `clan` = "'.$res['id'].'" AND `ww` = "'.ceil(date('W')).'" AND `yyyy` = "'.ceil(date('Y')).'"'));
-	  $emm = mysql_fetch_array(mysql_query('SELECT SUM(`exp`) FROM `clan_exp` WHERE `clan` = "'.$res['id'].'" AND `mm` = "'.ceil(date('m')).'" AND `yyyy` = "'.ceil(date('Y')).'"'));
-	 
-	  $edd = 0+$edd[0];
-	  $eww = 0+$eww[0];
-	  $emm = 0+$emm[0];	   
-   ?>   
-   <div class="box visible">
-    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-    �������� �����: <img src="https://img.new-combats.com/i/clan/<?=$res['name_mini']?>.gif" style="vertical-align:bottom" width="24" height="15"><a href="javascript:void(0)"><?=$res['name']?></a> (<?=$res['name_mini']?>)
+            </div>
+            <?php
+            $i++;
+        }
+
+        if ($i == 0) {
+            echo '� ����� ��� �� ������ ������';
+        }
+        ?>
+        <input type="button" onclick="addNewTitul()" value="�������� �����">
     </div>
-    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-    ������� �����: <?=$res['level']?>
+<?php } elseif (isset($_GET['rules'])) { ?>
+    <div class="box visible">
+        <fieldset style="border:1px dashed #eeeeee">
+            <legend><span class="legtitle">����� ��������� &quot;<?= $u->info['login'] ?>&quot;</span></legend>
+            <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                ������ � �����: <b><?php
+
+                    if ($u->info['clan_prava'] != 'glava') {
+                        echo $u->info['moder_zvanie'];
+                    } else {
+                        echo '<b style="color:#008097">����� �����</b>';
+                    }
+
+                    ?></b>
+            </div>
+            <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                �����: <b><?= $utitl['name'] ?></b> &nbsp; - &nbsp; <font color="#999999"><?= $utitl['info'] ?></font>
+            </div>
+            <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                ������ ����:
+                <?php $j = 1;
+                while ($j <= 9) {
+                    if ($utitl['canals'][$j - 1] == 1) {
+                        $r .= '<a href="javascript:void(0)">klan-' . $j . '</a>, ';
+                    }
+                    $j++;
+                }
+                echo rtrim($r, ', ');
+                ?>
+            </div>
+            <?php
+            $j = 1;
+            while ($j < count($tt)) {
+                if ($tt[$j][1] != '0') {
+                    if ($utitl['prava'][$j] == 1) {
+                        $utitl['check'] = '��';
+                    } else {
+                        $utitl['check'] = '���';
+                    }
+                    ?>
+                    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                        <div style="display:inline-block;width:410px;">
+                            &bull; <?= $tt[$j][1] ?></div><?= $utitl['check'] ?>
+                    </div>
+                    <?php
+                }
+                $j++;
+            }
+            ?>
+
+        </fieldset>
     </div>
-	<div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-    ������� �����: <?=$r1['pos']?>
-    </div>
-    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-    ���� �����: <?=number_format($res['exp'], 0, ",", " ")?> / <?=number_format($lvl_exp[$res['level']+1], 0, ",", " ")?>
-    <div style="width:200px;display:inline-block;border:1px solid #aeaeae">
-    	<div style="width:<?=ceil(($res['exp']-$lvl_exp[$res['level']])/$lvl_exp[$res['level']+1]*200)?>px;display:inline-block;padding-left:4px;padding-right:4px;text-align:right;background-color:#E9F7E8;color:#1B3618">
-        <b><?=ceil(($res['exp']-$lvl_exp[$res['level']])/$lvl_exp[$res['level']+1]*100)?>%</b>
+<?php } elseif (isset($_GET['info'])) {
+
+    //���������� ����
+    $edd = mysql_fetch_array(
+        mysql_query(
+            'SELECT SUM(`exp`) FROM `clan_exp` WHERE `clan` = "' . $res['id'] . '" AND `dd` = "' . ceil(
+                date('d')
+            ) . '" AND `mm` = "' . ceil(date('m')) . '" AND `yyyy` = "' . ceil(date('Y')) . '"'
+        )
+    );
+    $eww = mysql_fetch_array(
+        mysql_query(
+            'SELECT SUM(`exp`) FROM `clan_exp` WHERE `clan` = "' . $res['id'] . '" AND `ww` = "' . ceil(
+                date('W')
+            ) . '" AND `yyyy` = "' . ceil(date('Y')) . '"'
+        )
+    );
+    $emm = mysql_fetch_array(
+        mysql_query(
+            'SELECT SUM(`exp`) FROM `clan_exp` WHERE `clan` = "' . $res['id'] . '" AND `mm` = "' . ceil(
+                date('m')
+            ) . '" AND `yyyy` = "' . ceil(date('Y')) . '"'
+        )
+    );
+
+    $edd = 0 + $edd[0];
+    $eww = 0 + $eww[0];
+    $emm = 0 + $emm[0];
+    ?>
+    <div class="box visible">
+        <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+            �������� �����: <img src="https://img.new-combats.com/i/clan/<?= $res['name_mini'] ?>.gif"
+                                 style="vertical-align:bottom" width="24" height="15"><a
+                    href="javascript:void(0)"><?= $res['name'] ?></a> (<?= $res['name_mini'] ?>)
+        </div>
+        <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+            ������� �����: <?= $res['level'] ?>
+        </div>
+        <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+            ������� �����: <?= $r1['pos'] ?>
+        </div>
+        <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+            ���� �����: <?= number_format($res['exp'], 0, ",", " ") ?> / <?= number_format(
+                $lvl_exp[$res['level'] + 1], 0, ",", " "
+            ) ?>
+            <div style="width:200px;display:inline-block;border:1px solid #aeaeae">
+                <div style="width:<?= ceil(
+                    ($res['exp'] - $lvl_exp[$res['level']]) / $lvl_exp[$res['level'] + 1] * 200
+                ) ?>px;display:inline-block;padding-left:4px;padding-right:4px;text-align:right;background-color:#E9F7E8;color:#1B3618">
+                    <b><?= ceil(($res['exp'] - $lvl_exp[$res['level']]) / $lvl_exp[$res['level'] + 1] * 100) ?>%</b>
+                </div>
+            </div>
+        </div>
+        <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+            <table width="500" border="0" cellspacing="0" cellpadding="0">
+                <tr>
+                    <td width="220">���������� ��������� �����:</td>
+                    <td width="100">&bull; �� �������:</td>
+                    <td><b style="color:#0033a1"><?= $edd ?></b></td>
+                </tr>
+                <tr>
+                    <td>&nbsp;</td>
+                    <td>&bull; �� ������:</td>
+                    <td><b style="color:#0033a1"><?= $eww ?></b></td>
+                </tr>
+                <tr>
+                    <td>&nbsp;</td>
+                    <td>&bull; �� �����:</td>
+                    <td><b style="color:#0033a1"><?= $emm ?></b></td>
+                </tr>
+            </table>
+        </div>
+        <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+            <table width="100%" border="0" style="border:1px solid #232323;" cellspacing="0" cellpadding="5">
+                <tr>
+                    <td align="center" valign="middle"
+                        style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc">
+                        <strong>�������</strong></td>
+                    <td align="center" valign="middle"
+                        style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc">
+                        <strong>������</strong></td>
+                    <td align="center" valign="middle"
+                        style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc">
+                        <strong>����</strong></td>
+                    <td align="center" valign="middle"
+                        style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc">
+                        <strong>������� ����</strong></td>
+                    <td align="center" valign="middle"
+                        style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc">
+                        <strong>������</strong></td>
+                    <td align="center" valign="middle"
+                        style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc">
+                        <strong>������� ������</strong></td>
+                    <td align="center" valign="middle"
+                        style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc">
+                        <strong>���������</strong></td>
+                    <td align="center" valign="middle"
+                        style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc">
+                        <strong>������� �� ������</strong></td>
+                    <td align="center" valign="middle" style="border-bottom:1px solid #232323;" bgcolor="#cccccc">
+                        <strong>������� �����</strong></td>
+                </tr>
+                <?php
+                $i = 0;
+                $yn = ['���', '��'];
+                while ($i < count($lvl_prava)) {
+                    $bgclr = '';
+                    if ($res['level'] >= $i) {
+                        $bgclr = ' bgcolor="#8fd155"';
+                    }
+                    if ($i < count($lvl_prava) - 1) {
+                        ?>
+                        <tr<?= $bgclr ?>>
+                            <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center"
+                                valign="middle"><?= $i ?></td>
+                            <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center"
+                                valign="middle"><?= $lvl_prava[$i][0] ?></td>
+                            <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center"
+                                valign="middle"><?= $yn[$lvl_prava[$i][1]] ?></td>
+                            <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center"
+                                valign="middle"><?= $yn[$lvl_prava[$i][2]] ?></td>
+                            <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center"
+                                valign="middle"><?= $yn[$lvl_prava[$i][3]] ?></td>
+                            <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center"
+                                valign="middle"><?= $yn[$lvl_prava[$i][4]] ?></td>
+                            <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center"
+                                valign="middle"><?= $lvl_prava[$i][5] ?></td>
+                            <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center"
+                                valign="middle"><?= $lvl_prava[$i][6] ?></td>
+                            <td style="border-bottom:1px solid #232323;" align="center"
+                                valign="middle"><?= $lvl_prava[$i][7] ?></td>
+                        </tr>
+                        <?php
+                    } else {
+
+                        ?>
+                        <tr<?= $bgclr ?>>
+                            <td style="border-right:1px solid #232323;" align="center" valign="middle"><?= $i ?></td>
+                            <td style="border-right:1px solid #232323;" align="center"
+                                valign="middle"><?= $lvl_prava[$i][0] ?></td>
+                            <td style="border-right:1px solid #232323;" align="center"
+                                valign="middle"><?= $yn[$lvl_prava[$i][1]] ?></td>
+                            <td style="border-right:1px solid #232323;" align="center"
+                                valign="middle"><?= $yn[$lvl_prava[$i][2]] ?></td>
+                            <td style="border-right:1px solid #232323;" align="center"
+                                valign="middle"><?= $yn[$lvl_prava[$i][3]] ?></td>
+                            <td style="border-right:1px solid #232323;" align="center"
+                                valign="middle"><?= $yn[$lvl_prava[$i][4]] ?></td>
+                            <td style="border-right:1px solid #232323;" align="center"
+                                valign="middle"><?= $lvl_prava[$i][5] ?></td>
+                            <td style="border-right:1px solid #232323;" align="center"
+                                valign="middle"><?= $lvl_prava[$i][6] ?></td>
+                            <td align="center" valign="middle"><?= $lvl_prava[$i][7] ?></td>
+                        </tr>
+                        <?php
+                    }
+                    $i++;
+                }
+                ?>
+            </table>
         </div>
     </div>
+<?php } elseif (isset($_GET['members'])) { ?>
+    <div class="box visible">
+        <fieldset style="border:1px dashed #eeeeee">
+            <legend align="center"><span class="legtitle"><img title="��������"
+                                                               onClick="top.chat.addto('klan','private')"
+                                                               style="vertical-align:bottom;cursor:pointer;"
+                                                               src="https://img.new-combats.com/i/lock.gif" width="20"
+                                                               height="15"> ����������</span></legend>
+            <?php if (!isset($_GET['online'])) { ?>
+                <input onClick="location='main.php?clan&members&online'" type="button" value="������ online"
+                       style="float:right">
+            <?php } else { ?>
+                <input onClick="location='main.php?clan&members'" type="button" value="�������� ����"
+                       style="float:right">
+            <?php } ?>
+            <br>
+            <?php
+            $sp = mysql_query(
+                'SELECT `id`,`battle`,`login`,`clan`,`level`,`room`,`cityreg`,`align`,`clan_prava`,`mod_zvanie`,`sex`,`city`,`online`,`banned` FROM `users` WHERE `clan` = "' . $res['id'] . '"'
+            );
+            $r = '<br>';
+            $j = 0;
+            $i = 0;
+            if ($res['join1'] > 0 || $res['join2'] > 0) {
+                $r .= '<fieldset style="border:1px dashed #eeeeee;margin-top:5px;">
+      <legend align="left"><span class="legtitle">�������� ������</span></legend>';
+            }
+            while ($pl = mysql_fetch_array($sp)) {
+                if (!isset($_GET['online']) || $pl['online'] > time() - 120) {
+                    $pl['textcolor1'] = '';
+                    if ($pl['online'] > time() - 120) {
+                        $ico = '<img onClick="top.chat.addto(\'' . $pl['login'] . '\',\'private\')" src="https://img.new-combats.com/i/lock.gif" width="20" height="15" style="cursor:pointer;vertical-align:bottom">';
+                        $j++;
+                    } else {
+                        $pl['textcolor1'] = '#837f82';
+                        $ico = '<img src="https://img.new-combats.com/i/offline.gif" width="20" height="15" style="vertical-align:bottom">';
+                    }
+                    $zvn = $pl['mod_zvanie'];
+                    $zvn = str_replace('[b]', '<b>', $zvn);
+                    $zvn = str_replace('[/b]', '</b>', $zvn);
+                    $zvn = str_replace('[i]', '<i>', $zvn);
+                    $zvn = str_replace('[/i]', '</i>', $zvn);
+                    $zvn = str_replace('[u]', '<u>', $zvn);
+                    $zvn = str_replace('[/u]', '</u>', $zvn);
+                    $zvn = str_replace('[c=', '<font color="', $zvn);
+                    $zvn = str_replace('=]', '">', $zvn);
+                    $zvn = str_replace('[/c]', '</font>', $zvn);
+                    if ($pl['clan_prava'] == 'glava') {
+                        if ($zvn == '������' || $zvn == '') {
+                            $zvn = '<b style="color:#008097">����� �����</b>';
+                        }
+                        $zvn = '<img style="vertical-align:top" src="https://img.new-combats.com/i/clan/' . $res['name_mini'] . '.gif" width="24" title="����� �����">' . $zvn;
+                    }
+                    $ttl = mysql_fetch_array(
+                        mysql_query(
+                            'SELECT * FROM `clan_tituls` WHERE `clan` = "' . $res['id'] . '" AND `id` = "' . $pl['clan_prava'] . '" LIMIT 1'
+                        )
+                    );
+                    if (isset($ttl['id'])) {
+                        $zvn = '<font color="#' . $ttl['color'] . '"><b>' . $ttl['name'] . '</b></font> - ' . $zvn;
+                    }
+                    if ($pl['online'] > time() - 120) {
+                        $rm = mysql_fetch_array(
+                            mysql_query(
+                                'SELECT `id`,`name`,`city` FROM `room` WHERE `id` = "' . $pl['room'] . '" LIMIT 1'
+                            )
+                        );
+                        if (isset($rm['id'])) {
+                            $zvn .= ' - <i>' . $rm['name'] . '</i>';
+                        }
+                    } else {
+                        $zvn .= ' - <i><font color="grey">�������� ������ �� � �����</font></i>';
+                    }
+                    if ($pl['battle'] > 0) {
+                        $zvn .= ' <a href="logs.php?id=' . $pl['battle'] . '" target="_blank"><img width="20" height="20" style="vertical-align:bottom"src="https://img.new-combats.com/i/fighttype0.gif" title="������� ��� ��������"></a>';
+                    }
+                    $r .= '<div style="padding:5px;background-color:#efedee"><span style="display:inline-block;width:350px;">' . $ico . ' &nbsp;&nbsp; &nbsp; <img src="https://img.new-combats.com/i/align/align' . $pl['align'] . '.gif" width="12" height="15" style="vertical-align:bottom"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $res['name_mini'] . '.gif" width="24" height="15"><a onClick="top.chat.addto(\'' . $pl['login'] . '\',\'to\')" style="color:' . $pl['textcolor1'] . '" href="javascript:void(0)">' . $pl['login'] . '</a><font color="' . $pl['textcolor1'] . '">[' . $pl['level'] . ']<a href="https://new-combats.com/info/' . $pl['id'] . '" title="���. � ' . $pl['login'] . '" target="_blank"><img src="https://img.new-combats.com/i/inf_' . $pl['cityreg'] . '.gif" width="12" height="11"></a></font></span>' . $zvn . '</div>';
+                }
+                $i++;
+            }
+
+            if ($res['join1'] > 0 || $res['join2'] > 0) {
+                $r .= '</fieldset>';
+            }
+            $nacln = '';
+            if ($res['join1'] > 0) {
+                $clna = mysql_fetch_array(
+                    mysql_query(
+                        'SELECT * FROM `clan_joint` WHERE `id` = "' . $res['join1'] . '" AND `type` = "1" AND `time_close` = "0" LIMIT 1'
+                    )
+                );
+                $cn_sp = mysql_query(
+                    'SELECT * FROM `clan_join` WHERE `alians` = "' . $clna['id'] . '" AND `clan` != "' . $res['id'] . '" AND `time_end` = "0" AND `time_start` > 0'
+                );
+                while ($cn_pl = mysql_fetch_array($cn_sp)) {
+                    /* ----------------------------------------------------------------------------------------------------------------------------- */
+                    $nacln .= ' AND `clan` != "' . $cn_pl['clan'] . '"';
+                    $clnf = mysql_fetch_array(
+                        mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $cn_pl['clan'] . '" LIMIT 1')
+                    );
+                    $sp = mysql_query(
+                        'SELECT `id`,`battle`,`login`,`clan`,`level`,`room`,`cityreg`,`align`,`clan_prava`,`mod_zvanie`,`sex`,`city`,`online`,`banned` FROM `users` WHERE `clan` = "' . $cn_pl['clan'] . '"'
+                    );
+                    $r .= '<fieldset style="border:1px dashed #eeeeee;margin-top:5px;">
+      <legend align="left"><span class="legtitle">������ &quot;' . $clna['name'] . '&quot;</span></legend>';
+                    $j = 0;
+                    $i = 0;
+                    while ($pl = mysql_fetch_array($sp)) {
+                        if (!isset($_GET['online']) || $pl['online'] > time() - 120) {
+                            $pl['textcolor1'] = '';
+                            if ($pl['online'] > time() - 120) {
+                                $ico = '<img onClick="top.chat.addto(\'' . $pl['login'] . '\',\'private\')" src="https://img.new-combats.com/i/lock.gif" width="20" height="15" style="cursor:pointer;vertical-align:bottom">';
+                                $j++;
+                            } else {
+                                $pl['textcolor1'] = '#837f82';
+                                $ico = '<img src="https://img.new-combats.com/i/offline.gif" width="20" height="15" style="vertical-align:bottom">';
+                            }
+                            $zvn = $pl['mod_zvanie'];
+                            $zvn = str_replace('[b]', '<b>', $zvn);
+                            $zvn = str_replace('[/b]', '</b>', $zvn);
+                            $zvn = str_replace('[i]', '<i>', $zvn);
+                            $zvn = str_replace('[/i]', '</i>', $zvn);
+                            $zvn = str_replace('[u]', '<u>', $zvn);
+                            $zvn = str_replace('[/u]', '</u>', $zvn);
+                            $zvn = str_replace('[c=', '<font color="', $zvn);
+                            $zvn = str_replace('=]', '">', $zvn);
+                            $zvn = str_replace('[/c]', '</font>', $zvn);
+                            if ($pl['clan_prava'] == 'glava') {
+                                if ($zvn == '������' || $zvn == '') {
+                                    $zvn = '<b style="color:#008097">����� �����</b>';
+                                }
+                                $zvn = '<img style="vertical-align:top" src="https://img.new-combats.com/i/clan/' . $clnf['name_mini'] . '.gif" width="24" title="����� �����">' . $zvn;
+                            }
+                            $ttl = mysql_fetch_array(
+                                mysql_query(
+                                    'SELECT * FROM `clan_tituls` WHERE `clan` = "' . $clnf['id'] . '" AND `id` = "' . $pl['clan_prava'] . '" LIMIT 1'
+                                )
+                            );
+                            if (isset($ttl['id'])) {
+                                $zvn = '<font color="#' . $ttl['color'] . '"><b>' . $ttl['name'] . '</b></font> - ' . $zvn;
+                            }
+                            if ($pl['online'] > time() - 120) {
+                                $rm = mysql_fetch_array(
+                                    mysql_query(
+                                        'SELECT `id`,`name`,`city` FROM `room` WHERE `id` = "' . $pl['room'] . '" LIMIT 1'
+                                    )
+                                );
+                                if (isset($rm['id'])) {
+                                    $zvn .= ' - <i>' . $rm['name'] . '</i>';
+                                }
+                            } else {
+                                $zvn .= ' - <i><font color="grey">�������� ������ �� � �����</font></i>';
+                            }
+                            if ($pl['battle'] > 0) {
+                                $zvn .= ' <a href="logs.php?id=' . $pl['battle'] . '" target="_blank"><img width="20" height="20" style="vertical-align:bottom"src="https://img.new-combats.com/i/fighttype0.gif" title="������� ��� ��������"></a>';
+                            }
+                            $r .= '<div style="padding:5px;background-color:#efedee"><span style="display:inline-block;width:350px;">' . $ico . ' &nbsp;&nbsp; &nbsp; <img src="https://img.new-combats.com/i/align/align' . $pl['align'] . '.gif" width="12" height="15" style="vertical-align:bottom"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $clnf['name_mini'] . '.gif" width="24" height="15"><a onClick="top.chat.addto(\'' . $pl['login'] . '\',\'to\')" style="color:' . $pl['textcolor1'] . '" href="javascript:void(0)">' . $pl['login'] . '</a><font color="' . $pl['textcolor1'] . '">[' . $pl['level'] . ']<a href="https://new-combats.com/info/' . $pl['id'] . '" title="���. � ' . $pl['login'] . '" target="_blank"><img src="https://img.new-combats.com/i/inf_' . $pl['cityreg'] . '.gif" width="12" height="11"></a></font></span>' . $zvn . '</div>';
+                        }
+                        $i++;
+                    }
+                    $r .= '</fieldset>';
+                    /* ----------------------------------------------------------------------------------------------------------------------------- */
+                }
+            }
+            if ($res['join2'] > 0) {
+                $cn_sp0 = mysql_fetch_array(
+                    mysql_query(
+                        'SELECT * FROM `clan_joint` WHERE `id` = "' . $res['join2'] . '" AND `type` = "2" AND `time_close` = "0" LIMIT 1'
+                    )
+                );
+                $cn_sp = mysql_query(
+                    'SELECT * FROM `clan_join` WHERE `alians` = "' . $cn_sp0['id'] . '" AND `clan` != "' . $res['id'] . '"' . $nacln . ' AND `time_end` = "0" AND `time_start` > 0'
+                );
+                while ($cn_pl = mysql_fetch_array($cn_sp)) {
+                    /* ----------------------------------------------------------------------------------------------------------------------------- */
+                    $clnf = mysql_fetch_array(
+                        mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $cn_pl['clan'] . '" LIMIT 1')
+                    );
+                    $clna = mysql_fetch_array(
+                        mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "' . $res['join2'] . '" LIMIT 1')
+                    );
+                    $sp = mysql_query(
+                        'SELECT `id`,`battle`,`login`,`clan`,`level`,`room`,`cityreg`,`align`,`clan_prava`,`mod_zvanie`,`sex`,`city`,`online`,`banned` FROM `users` WHERE `clan` = "' . $cn_pl['clan'] . '"'
+                    );
+                    $r .= '<fieldset style="border:1px dashed #eeeeee;margin-top:5px;">
+      <legend align="left"><span class="legtitle">������ &quot;' . $clna['name'] . '&quot;</span></legend>';
+                    $j = 0;
+                    $i = 0;
+                    while ($pl = mysql_fetch_array($sp)) {
+                        if (!isset($_GET['online']) || $pl['online'] > time() - 120) {
+                            $pl['textcolor1'] = '';
+                            if ($pl['online'] > time() - 120) {
+                                $ico = '<img onClick="top.chat.addto(\'' . $pl['login'] . '\',\'private\')" src="https://img.new-combats.com/i/lock.gif" width="20" height="15" style="cursor:pointer;vertical-align:bottom">';
+                                $j++;
+                            } else {
+                                $pl['textcolor1'] = '#837f82';
+                                $ico = '<img src="https://img.new-combats.com/i/offline.gif" width="20" height="15" style="vertical-align:bottom">';
+                            }
+                            $zvn = $pl['mod_zvanie'];
+                            $zvn = str_replace('[b]', '<b>', $zvn);
+                            $zvn = str_replace('[/b]', '</b>', $zvn);
+                            $zvn = str_replace('[i]', '<i>', $zvn);
+                            $zvn = str_replace('[/i]', '</i>', $zvn);
+                            $zvn = str_replace('[u]', '<u>', $zvn);
+                            $zvn = str_replace('[/u]', '</u>', $zvn);
+                            $zvn = str_replace('[c=', '<font color="', $zvn);
+                            $zvn = str_replace('=]', '">', $zvn);
+                            $zvn = str_replace('[/c]', '</font>', $zvn);
+                            if ($pl['clan_prava'] == 'glava') {
+                                if ($zvn == '������' || $zvn == '') {
+                                    $zvn = '<b style="color:#008097">����� �����</b>';
+                                }
+                                $zvn = '<img style="vertical-align:top" src="https://img.new-combats.com/i/clan/' . $clnf['name_mini'] . '.gif" width="24" title="����� �����">' . $zvn;
+                            }
+                            $ttl = mysql_fetch_array(
+                                mysql_query(
+                                    'SELECT * FROM `clan_tituls` WHERE `clan` = "' . $clnf['id'] . '" AND `id` = "' . $pl['clan_prava'] . '" LIMIT 1'
+                                )
+                            );
+                            if (isset($ttl['id'])) {
+                                $zvn = '<font color="#' . $ttl['color'] . '"><b>' . $ttl['name'] . '</b></font> - ' . $zvn;
+                            }
+                            if ($pl['online'] > time() - 120) {
+                                $rm = mysql_fetch_array(
+                                    mysql_query(
+                                        'SELECT `id`,`name`,`city` FROM `room` WHERE `id` = "' . $pl['room'] . '" LIMIT 1'
+                                    )
+                                );
+                                if (isset($rm['id'])) {
+                                    $zvn .= ' - <i>' . $rm['name'] . '</i>';
+                                }
+                            } else {
+                                $zvn .= ' - <i><font color="grey">�������� ������ �� � �����</font></i>';
+                            }
+                            if ($pl['battle'] > 0) {
+                                $zvn .= ' <a href="logs.php?id=' . $pl['battle'] . '" target="_blank"><img width="20" height="20" style="vertical-align:bottom"src="https://img.new-combats.com/i/fighttype0.gif" title="������� ��� ��������"></a>';
+                            }
+                            $r .= '<div style="padding:5px;background-color:#efedee"><span style="display:inline-block;width:350px;">' . $ico . ' &nbsp;&nbsp; &nbsp; <img src="https://img.new-combats.com/i/align/align' . $pl['align'] . '.gif" width="12" height="15" style="vertical-align:bottom"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $clnf['name_mini'] . '.gif" width="24" height="15"><a onClick="top.chat.addto(\'' . $pl['login'] . '\',\'to\')" style="color:' . $pl['textcolor1'] . '" href="javascript:void(0)">' . $pl['login'] . '</a><font color="' . $pl['textcolor1'] . '">[' . $pl['level'] . ']<a href="https://new-combats.com/info/' . $pl['id'] . '" title="���. � ' . $pl['login'] . '" target="_blank"><img src="https://img.new-combats.com/i/inf_' . $pl['cityreg'] . '.gif" width="12" height="11"></a></font></span>' . $zvn . '</div>';
+                        }
+                        $i++;
+                    }
+                    $r .= '</fieldset>';
+                    /* ----------------------------------------------------------------------------------------------------------------------------- */
+                }
+            }
+
+            $r .= '<br>Online: <a href="main.php?clan&members&online">' . $j . '</a><br>�����: <a href="main.php?clan&members">' . $i . '</a><br><small>(������ ����������� <s>� �������</s>)</small>';
+            echo $r;
+            ?>
+        </fieldset>
     </div>
-    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-    <table width="500" border="0" cellspacing="0" cellpadding="0">
-      <tr>
-        <td width="220">���������� ��������� �����:</td>
-        <td width="100">&bull; �� �������:</td>
-        <td><b style="color:#0033a1"><?=$edd?></b></td>
-      </tr>
-      <tr>
-        <td>&nbsp;</td>
-        <td>&bull; �� ������:</td>
-        <td><b style="color:#0033a1"><?=$eww?></b></td>
-      </tr>
-      <tr>
-        <td>&nbsp;</td>
-        <td>&bull; �� �����:</td>
-        <td><b style="color:#0033a1"><?=$emm?></b></td>
-      </tr>
-    </table>
-    </div>
-    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-    <table width="100%" border="0" style="border:1px solid #232323;" cellspacing="0" cellpadding="5">
-  <tr>
-    <td align="center" valign="middle" style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc"><strong>�������</strong></td>
-    <td align="center" valign="middle" style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc"><strong>������</strong></td>
-    <td align="center" valign="middle" style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc"><strong>����</strong></td>
-    <td align="center" valign="middle" style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc"><strong>������� ����</strong></td>
-    <td align="center" valign="middle" style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc"><strong>������</strong></td>
-    <td align="center" valign="middle" style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc"><strong>������� ������</strong></td>
-    <td align="center" valign="middle" style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc"><strong>���������</strong></td>
-    <td align="center" valign="middle" style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc"><strong>������� �� ������</strong></td>
-    <td align="center" valign="middle" style="border-bottom:1px solid #232323;" bgcolor="#cccccc"><strong>������� �����</strong></td>
-  </tr>
-  <?
-  $i = 0;
-  $yn = array('���','��');
-  while($i < count($lvl_prava)) {
-	  $bgclr = '';
-	  if($res['level'] >= $i) {
-		 $bgclr = ' bgcolor="#8fd155"'; 
-	  }
-	  if($i < count($lvl_prava)-1) {
-  ?>
-  <tr<?=$bgclr?>>
-    <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center" valign="middle"><?=$i?></td>
-    <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center" valign="middle"><?=$lvl_prava[$i][0]?></td>
-    <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center" valign="middle"><?=$yn[$lvl_prava[$i][1]]?></td>
-    <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center" valign="middle"><?=$yn[$lvl_prava[$i][2]]?></td>
-    <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center" valign="middle"><?=$yn[$lvl_prava[$i][3]]?></td>
-    <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center" valign="middle"><?=$yn[$lvl_prava[$i][4]]?></td>
-    <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center" valign="middle"><?=$lvl_prava[$i][5]?></td>
-    <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center" valign="middle"><?=$lvl_prava[$i][6]?></td>
-    <td style="border-bottom:1px solid #232323;" align="center" valign="middle"><?=$lvl_prava[$i][7]?></td>
-  </tr>
-  <?
-	  }else{
-		  
-  ?>
-  <tr<?=$bgclr?>>
-    <td style="border-right:1px solid #232323;" align="center" valign="middle"><?=$i?></td>
-    <td style="border-right:1px solid #232323;" align="center" valign="middle"><?=$lvl_prava[$i][0]?></td>
-    <td style="border-right:1px solid #232323;" align="center" valign="middle"><?=$yn[$lvl_prava[$i][1]]?></td>
-    <td style="border-right:1px solid #232323;" align="center" valign="middle"><?=$yn[$lvl_prava[$i][2]]?></td>
-    <td style="border-right:1px solid #232323;" align="center" valign="middle"><?=$yn[$lvl_prava[$i][3]]?></td>
-    <td style="border-right:1px solid #232323;" align="center" valign="middle"><?=$yn[$lvl_prava[$i][4]]?></td>
-    <td style="border-right:1px solid #232323;" align="center" valign="middle"><?=$lvl_prava[$i][5]?></td>
-    <td style="border-right:1px solid #232323;" align="center" valign="middle"><?=$lvl_prava[$i][6]?></td>
-    <td align="center" valign="middle"><?=$lvl_prava[$i][7]?></td>
-  </tr>
-  <?
-	  }
-  $i++;
-  }
-  ?>
-  </table>
-    </div>
-  </div>
-   <? }elseif(isset($_GET['members'])) { ?>
-   <div  class="box visible">
-    <fieldset style="border:1px dashed #eeeeee">
-      <legend align="center"><span class="legtitle"><img title="��������" onClick="top.chat.addto('klan','private')" style="vertical-align:bottom;cursor:pointer;" src="https://img.new-combats.com/i/lock.gif" width="20" height="15"> ����������</span></legend>
-      <? if(!isset($_GET['online'])) { ?>
-      <input onClick="location='main.php?clan&members&online'" type="button" value="������ online" style="float:right">
-      <? }else{ ?>
-      <input onClick="location='main.php?clan&members'" type="button" value="�������� ����" style="float:right">
-      <? } ?>
-      <br>
-      <?
-	  $sp = mysql_query('SELECT `id`,`battle`,`login`,`clan`,`level`,`room`,`cityreg`,`align`,`clan_prava`,`mod_zvanie`,`sex`,`city`,`online`,`banned` FROM `users` WHERE `clan` = "'.$res['id'].'"');
-	  $r = '<br>'; $j = 0; $i = 0;
-	  if($res['join1'] > 0 || $res['join2'] > 0) {
-		 $r .= '<fieldset style="border:1px dashed #eeeeee;margin-top:5px;">
-      <legend align="left"><span class="legtitle">�������� ������</span></legend>'; 
-	  }
-	  while($pl = mysql_fetch_array($sp)) {
-		  if(!isset($_GET['online']) || $pl['online'] > time()-120) {
-			  $pl['textcolor1'] = '';
-			  if($pl['online'] > time()-120) {
-				 $ico = '<img onClick="top.chat.addto(\''.$pl['login'].'\',\'private\')" src="https://img.new-combats.com/i/lock.gif" width="20" height="15" style="cursor:pointer;vertical-align:bottom">'; 
-				 $j++;
-			  }else{
-				  $pl['textcolor1'] = '#837f82';
-				 $ico = '<img src="https://img.new-combats.com/i/offline.gif" width="20" height="15" style="vertical-align:bottom">'; 
-			  }		  
-			  $zvn = $pl['mod_zvanie'];
-			  $zvn = str_replace('[b]','<b>',$zvn);
-			  $zvn = str_replace('[/b]','</b>',$zvn);
-			  $zvn = str_replace('[i]','<i>',$zvn);
-			  $zvn = str_replace('[/i]','</i>',$zvn);
-			  $zvn = str_replace('[u]','<u>',$zvn);
-			  $zvn = str_replace('[/u]','</u>',$zvn);
-			  $zvn = str_replace('[c=','<font color="',$zvn);
-			  $zvn = str_replace('=]','">',$zvn);
-			  $zvn = str_replace('[/c]','</font>',$zvn);
-			  if($pl['clan_prava'] == 'glava') {
-				 if($zvn == '������' || $zvn == '') {
-					 $zvn = '<b style="color:#008097">����� �����</b>';
-				 }
-				 $zvn = '<img style="vertical-align:top" src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif" width="24" title="����� �����">'.$zvn; 
-			  }
-			  $ttl = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `clan` = "'.$res['id'].'" AND `id` = "'.$pl['clan_prava'].'" LIMIT 1'));
-			  if(isset($ttl['id'])) {
-				 $zvn = '<font color="#'.$ttl['color'].'"><b>'.$ttl['name'].'</b></font> - '.$zvn; 
-			  }
-			  if($pl['online'] > time()-120) {
-				  $rm = mysql_fetch_array(mysql_query('SELECT `id`,`name`,`city` FROM `room` WHERE `id` = "'.$pl['room'].'" LIMIT 1'));
-				  if(isset($rm['id'])) {
-					 $zvn .= ' - <i>'.$rm['name'].'</i>'; 
-				  }
-			  }else{
-				  $zvn .= ' - <i><font color="grey">�������� ������ �� � �����</font></i>';
-			  }
-			  if($pl['battle'] > 0) {
-				$zvn .= ' <a href="logs.php?id='.$pl['battle'].'" target="_blank"><img width="20" height="20" style="vertical-align:bottom"src="https://img.new-combats.com/i/fighttype0.gif" title="������� ��� ��������"></a>';  
-			  }
-			$r .= '<div style="padding:5px;background-color:#efedee"><span style="display:inline-block;width:350px;">'.$ico.' &nbsp;&nbsp; &nbsp; <img src="https://img.new-combats.com/i/align/align'.$pl['align'].'.gif" width="12" height="15" style="vertical-align:bottom"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif" width="24" height="15"><a onClick="top.chat.addto(\''.$pl['login'].'\',\'to\')" style="color:'.$pl['textcolor1'].'" href="javascript:void(0)">'.$pl['login'].'</a><font color="'.$pl['textcolor1'].'">['.$pl['level'].']<a href="https://new-combats.com/info/'.$pl['id'].'" title="���. � '.$pl['login'].'" target="_blank"><img src="https://img.new-combats.com/i/inf_'.$pl['cityreg'].'.gif" width="12" height="11"></a></font></span>'.$zvn.'</div>';
-		  }
-		  $i++;
-	  }
-	  
-	  if($res['join1'] > 0 || $res['join2'] > 0) {
-	  	$r .= '</fieldset>';
-	  }
-	  $nacln = '';	  
-	  if($res['join1'] > 0) {
-	  	$clna = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$res['join1'].'" AND `type` = "1" AND `time_close` = "0" LIMIT 1'));
-		$cn_sp = mysql_query('SELECT * FROM `clan_join` WHERE `alians` = "'.$clna['id'].'" AND `clan` != "'.$res['id'].'" AND `time_end` = "0" AND `time_start` > 0');
-		while($cn_pl = mysql_fetch_array($cn_sp)) {
-			/* ----------------------------------------------------------------------------------------------------------------------------- */
-			  $nacln .= ' AND `clan` != "'.$cn_pl['clan'].'"';
-			  $clnf = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$cn_pl['clan'].'" LIMIT 1'));
-			  $sp = mysql_query('SELECT `id`,`battle`,`login`,`clan`,`level`,`room`,`cityreg`,`align`,`clan_prava`,`mod_zvanie`,`sex`,`city`,`online`,`banned` FROM `users` WHERE `clan` = "'.$cn_pl['clan'].'"');
-			  $r .= '<fieldset style="border:1px dashed #eeeeee;margin-top:5px;">
-      <legend align="left"><span class="legtitle">������ &quot;'.$clna['name'].'&quot;</span></legend>';
-			  $j = 0; $i = 0;
-			  while($pl = mysql_fetch_array($sp)) {
-				  if(!isset($_GET['online']) || $pl['online'] > time()-120) {
-					  $pl['textcolor1'] = '';
-					  if($pl['online'] > time()-120) {
-						 $ico = '<img onClick="top.chat.addto(\''.$pl['login'].'\',\'private\')" src="https://img.new-combats.com/i/lock.gif" width="20" height="15" style="cursor:pointer;vertical-align:bottom">'; 
-						 $j++;
-					  }else{
-						  $pl['textcolor1'] = '#837f82';
-						 $ico = '<img src="https://img.new-combats.com/i/offline.gif" width="20" height="15" style="vertical-align:bottom">'; 
-					  }		  
-					  $zvn = $pl['mod_zvanie'];
-					  $zvn = str_replace('[b]','<b>',$zvn);
-					  $zvn = str_replace('[/b]','</b>',$zvn);
-					  $zvn = str_replace('[i]','<i>',$zvn);
-					  $zvn = str_replace('[/i]','</i>',$zvn);
-					  $zvn = str_replace('[u]','<u>',$zvn);
-					  $zvn = str_replace('[/u]','</u>',$zvn);
-					  $zvn = str_replace('[c=','<font color="',$zvn);
-					  $zvn = str_replace('=]','">',$zvn);
-					  $zvn = str_replace('[/c]','</font>',$zvn);
-					  if($pl['clan_prava'] == 'glava') {
-						 if($zvn == '������' || $zvn == '') {
-							 $zvn = '<b style="color:#008097">����� �����</b>';
-						 }
-						 $zvn = '<img style="vertical-align:top" src="https://img.new-combats.com/i/clan/'.$clnf['name_mini'].'.gif" width="24" title="����� �����">'.$zvn; 
-					  }
-					  $ttl = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `clan` = "'.$clnf['id'].'" AND `id` = "'.$pl['clan_prava'].'" LIMIT 1'));
-					  if(isset($ttl['id'])) {
-						 $zvn = '<font color="#'.$ttl['color'].'"><b>'.$ttl['name'].'</b></font> - '.$zvn; 
-					  }
-					  if($pl['online'] > time()-120) {
-						  $rm = mysql_fetch_array(mysql_query('SELECT `id`,`name`,`city` FROM `room` WHERE `id` = "'.$pl['room'].'" LIMIT 1'));
-						  if(isset($rm['id'])) {
-							 $zvn .= ' - <i>'.$rm['name'].'</i>'; 
-						  }
-					  }else{
-						  $zvn .= ' - <i><font color="grey">�������� ������ �� � �����</font></i>';
-					  }
-					  if($pl['battle'] > 0) {
-						$zvn .= ' <a href="logs.php?id='.$pl['battle'].'" target="_blank"><img width="20" height="20" style="vertical-align:bottom"src="https://img.new-combats.com/i/fighttype0.gif" title="������� ��� ��������"></a>';  
-					  }
-					$r .= '<div style="padding:5px;background-color:#efedee"><span style="display:inline-block;width:350px;">'.$ico.' &nbsp;&nbsp; &nbsp; <img src="https://img.new-combats.com/i/align/align'.$pl['align'].'.gif" width="12" height="15" style="vertical-align:bottom"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$clnf['name_mini'].'.gif" width="24" height="15"><a onClick="top.chat.addto(\''.$pl['login'].'\',\'to\')" style="color:'.$pl['textcolor1'].'" href="javascript:void(0)">'.$pl['login'].'</a><font color="'.$pl['textcolor1'].'">['.$pl['level'].']<a href="https://new-combats.com/info/'.$pl['id'].'" title="���. � '.$pl['login'].'" target="_blank"><img src="https://img.new-combats.com/i/inf_'.$pl['cityreg'].'.gif" width="12" height="11"></a></font></span>'.$zvn.'</div>';
-				  }
-				  $i++;
-			  }
-			  $r .= '</fieldset>';
-			/* ----------------------------------------------------------------------------------------------------------------------------- */
-		}
-	  }
-	  if($res['join2'] > 0) {
-	  	$cn_sp0 = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$res['join2'].'" AND `type` = "2" AND `time_close` = "0" LIMIT 1'));
-		$cn_sp = mysql_query('SELECT * FROM `clan_join` WHERE `alians` = "'.$cn_sp0['id'].'" AND `clan` != "'.$res['id'].'"'.$nacln.' AND `time_end` = "0" AND `time_start` > 0');
-		while($cn_pl = mysql_fetch_array($cn_sp)) {
-			/* ----------------------------------------------------------------------------------------------------------------------------- */
-			  $clnf = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$cn_pl['clan'].'" LIMIT 1'));
-			  $clna = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$res['join2'].'" LIMIT 1'));
-			  $sp = mysql_query('SELECT `id`,`battle`,`login`,`clan`,`level`,`room`,`cityreg`,`align`,`clan_prava`,`mod_zvanie`,`sex`,`city`,`online`,`banned` FROM `users` WHERE `clan` = "'.$cn_pl['clan'].'"');
-			  $r .= '<fieldset style="border:1px dashed #eeeeee;margin-top:5px;">
-      <legend align="left"><span class="legtitle">������ &quot;'.$clna['name'].'&quot;</span></legend>';
-			  $j = 0; $i = 0;
-			  while($pl = mysql_fetch_array($sp)) {
-				  if(!isset($_GET['online']) || $pl['online'] > time()-120) {
-					  $pl['textcolor1'] = '';
-					  if($pl['online'] > time()-120) {
-						 $ico = '<img onClick="top.chat.addto(\''.$pl['login'].'\',\'private\')" src="https://img.new-combats.com/i/lock.gif" width="20" height="15" style="cursor:pointer;vertical-align:bottom">'; 
-						 $j++;
-					  }else{
-						  $pl['textcolor1'] = '#837f82';
-						 $ico = '<img src="https://img.new-combats.com/i/offline.gif" width="20" height="15" style="vertical-align:bottom">'; 
-					  }		  
-					  $zvn = $pl['mod_zvanie'];
-					  $zvn = str_replace('[b]','<b>',$zvn);
-					  $zvn = str_replace('[/b]','</b>',$zvn);
-					  $zvn = str_replace('[i]','<i>',$zvn);
-					  $zvn = str_replace('[/i]','</i>',$zvn);
-					  $zvn = str_replace('[u]','<u>',$zvn);
-					  $zvn = str_replace('[/u]','</u>',$zvn);
-					  $zvn = str_replace('[c=','<font color="',$zvn);
-					  $zvn = str_replace('=]','">',$zvn);
-					  $zvn = str_replace('[/c]','</font>',$zvn);
-					  if($pl['clan_prava'] == 'glava') {
-						 if($zvn == '������' || $zvn == '') {
-							 $zvn = '<b style="color:#008097">����� �����</b>';
-						 }
-						 $zvn = '<img style="vertical-align:top" src="https://img.new-combats.com/i/clan/'.$clnf['name_mini'].'.gif" width="24" title="����� �����">'.$zvn; 
-					  }
-					  $ttl = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `clan` = "'.$clnf['id'].'" AND `id` = "'.$pl['clan_prava'].'" LIMIT 1'));
-					  if(isset($ttl['id'])) {
-						 $zvn = '<font color="#'.$ttl['color'].'"><b>'.$ttl['name'].'</b></font> - '.$zvn; 
-					  }
-					  if($pl['online'] > time()-120) {
-						  $rm = mysql_fetch_array(mysql_query('SELECT `id`,`name`,`city` FROM `room` WHERE `id` = "'.$pl['room'].'" LIMIT 1'));
-						  if(isset($rm['id'])) {
-							 $zvn .= ' - <i>'.$rm['name'].'</i>'; 
-						  }
-					  }else{
-						  $zvn .= ' - <i><font color="grey">�������� ������ �� � �����</font></i>';
-					  }
-					  if($pl['battle'] > 0) {
-						$zvn .= ' <a href="logs.php?id='.$pl['battle'].'" target="_blank"><img width="20" height="20" style="vertical-align:bottom"src="https://img.new-combats.com/i/fighttype0.gif" title="������� ��� ��������"></a>';  
-					  }
-					$r .= '<div style="padding:5px;background-color:#efedee"><span style="display:inline-block;width:350px;">'.$ico.' &nbsp;&nbsp; &nbsp; <img src="https://img.new-combats.com/i/align/align'.$pl['align'].'.gif" width="12" height="15" style="vertical-align:bottom"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$clnf['name_mini'].'.gif" width="24" height="15"><a onClick="top.chat.addto(\''.$pl['login'].'\',\'to\')" style="color:'.$pl['textcolor1'].'" href="javascript:void(0)">'.$pl['login'].'</a><font color="'.$pl['textcolor1'].'">['.$pl['level'].']<a href="https://new-combats.com/info/'.$pl['id'].'" title="���. � '.$pl['login'].'" target="_blank"><img src="https://img.new-combats.com/i/inf_'.$pl['cityreg'].'.gif" width="12" height="11"></a></font></span>'.$zvn.'</div>';
-				  }
-				  $i++;
-			  }
-			  $r .= '</fieldset>';
-			/* ----------------------------------------------------------------------------------------------------------------------------- */
-		}
-	  }
-	  
-	  $r .= '<br>Online: <a href="main.php?clan&members&online">'.$j.'</a><br>�����: <a href="main.php?clan&members">'.$i.'</a><br><small>(������ ����������� <s>� �������</s>)</small>';
-	  echo $r;
-	  ?>
-    </fieldset>
-   </div>
-  <? } ?>
+<?php } ?>
 
 
 </div><!-- .section -->
\ No newline at end of file
diff --git a/modules_data/_clan_oldversion.php b/modules_data/_clan_oldversion.php
index 1a6c6a56..b28bfdbc 100644
--- a/modules_data/_clan_oldversion.php
+++ b/modules_data/_clan_oldversion.php
@@ -1,2644 +1,3414 @@
 <?
-if(!defined('GAME')) { die(); }
-
-$res = mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id` = '".mysql_real_escape_string($u->info['clan'])."' LIMIT 1"));
-$cpr = explode('|', $u->info['clan_prava']);
-
-if(!isset($res['id'])) {
-  die('���� ��� �������������.');
+if (!defined('GAME')) {
+    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;
+$res = mysql_fetch_array(
+    mysql_query("SELECT * FROM `clan` WHERE `id` = '" . mysql_real_escape_string($u->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
-);
+$lvl_exp = [
+    0 => 0,
+    1 => 500000,
+    2 => 2000000,
+    3 => 5500000,
+    4 => 10500000,
+    5 => 20500000,
+    6 => 35500000,
+    7 => 65500000,
+];
 
-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'] . '!"
+	)'
+    );
 }
 
 //����� �����
-$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],
+]
 
 ?>
 <script type="text/javascript" src="js/jquery.js"></script>
 <style>
 
-body { background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_44.jpg);}
-.a {text-decoration:none; color:#333333; font-size:10px;}
-.a:hover{text-decoration:none; color:#333333; font-size:10px;}
- 
-.clanimg { padding-right:5px; margin-bottom:-2px;}
-.infimg {margin-left:2px; margin-bottom:-1px;}
+    body {
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_44.jpg);
+    }
 
-#clanpanel {width:100%; height:32px; color:#333333; font-weight:bold; font-size:11px; min-width:1250px;}
-#clanpanel .head{ float:left; width:75px; height:18px; font-size:11px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_03.jpg); background-repeat:no-repeat;}
-#clanpanel .panel{ float:left; width:100%; height:32px; font-size:11px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_08.jpg); background-repeat:repeat-x;}
-#clanpanel .foot{ float:left; width:75px; height:12px; font-size:11px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_27.jpg); background-repeat:no-repeat;}
+    .a {
+        text-decoration: none;
+        color: #333333;
+        font-size: 10px;
+    }
 
-.tabs ul {list-style:none; float:left; margin:0px; padding:0px;}
+    .a:hover {
+        text-decoration: none;
+        color: #333333;
+        font-size: 10px;
+    }
 
-.name{ float:left; color:#990000; height:32px; padding-left:85px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_s3r3_07.jpg); background-repeat:no-repeat;  line-height:32px; padding-right:15px;}
- .clanicon{ padding-right:10px; margin-bottom:-2px;}
+    .clanimg {
+        padding-right: 5px;
+        margin-bottom: -2px;
+    }
 
-.tabs .events{ float:left; height:32px; padding-left:60px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_09.jpg); background-repeat:no-repeat;  line-height:32px; padding-right:20px;}
-.tabs .control{ float:left; height:32px; padding-left:60px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_11.jpg); background-repeat:no-repeat;  line-height:32px; padding-right:20px;}
+    .infimg {
+        margin-left: 2px;
+        margin-bottom: -1px;
+    }
 
-.tabs .deposit{ float:left; height:32px; padding-left:60px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_13.jpg); background-repeat:no-repeat;  line-height:32px; padding-right:20px;}
+    #clanpanel {
+        width: 100%;
+        height: 32px;
+        color: #333333;
+        font-weight: bold;
+        font-size: 11px;
+        min-width: 1250px;
+    }
 
-.tabs .clanart{ float:left; height:32px; padding-left:60px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_17.jpg); background-repeat:no-repeat;  line-height:32px; padding-right:20px;}
+    #clanpanel .head {
+        float: left;
+        width: 75px;
+        height: 18px;
+        font-size: 11px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_03.jpg);
+        background-repeat: no-repeat;
+    }
 
-.tabs .rules{ float:left; height:32px; padding-left:60px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_19.jpg); background-repeat:no-repeat;  line-height:32px; padding-right:20px;}
+    #clanpanel .panel {
+        float: left;
+        width: 100%;
+        height: 32px;
+        font-size: 11px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_08.jpg);
+        background-repeat: repeat-x;
+    }
 
-.tabs .info{ float:left; height:32px; padding-left:60px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_21.jpg); background-repeat:no-repeat;  line-height:32px; padding-right:20px;}
+    #clanpanel .foot {
+        float: left;
+        width: 75px;
+        height: 12px;
+        font-size: 11px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_27.jpg);
+        background-repeat: no-repeat;
+    }
 
-.tabs .members{ float:left; height:32px; padding-left:60px; background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_23.jpg); background-repeat:no-repeat;  line-height:32px; padding-right:20px;}
+    .tabs ul {
+        list-style: none;
+        float: left;
+        margin: 0px;
+        padding: 0px;
+    }
 
-.tabs .last{ float:right; width:15px; height:32px;background-image:url(https://img.new-combats.com/i/clanpanel/klan_img_25.jpg); background-repeat:no-repeat;}
+    .name {
+        float: left;
+        color: #990000;
+        height: 32px;
+        padding-left: 85px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_s3r3_07.jpg);
+        background-repeat: no-repeat;
+        line-height: 32px;
+        padding-right: 15px;
+    }
+
+    .clanicon {
+        padding-right: 10px;
+        margin-bottom: -2px;
+    }
+
+    .tabs .events {
+        float: left;
+        height: 32px;
+        padding-left: 60px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_09.jpg);
+        background-repeat: no-repeat;
+        line-height: 32px;
+        padding-right: 20px;
+    }
+
+    .tabs .control {
+        float: left;
+        height: 32px;
+        padding-left: 60px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_11.jpg);
+        background-repeat: no-repeat;
+        line-height: 32px;
+        padding-right: 20px;
+    }
+
+    .tabs .deposit {
+        float: left;
+        height: 32px;
+        padding-left: 60px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_13.jpg);
+        background-repeat: no-repeat;
+        line-height: 32px;
+        padding-right: 20px;
+    }
+
+    .tabs .clanart {
+        float: left;
+        height: 32px;
+        padding-left: 60px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_17.jpg);
+        background-repeat: no-repeat;
+        line-height: 32px;
+        padding-right: 20px;
+    }
+
+    .tabs .rules {
+        float: left;
+        height: 32px;
+        padding-left: 60px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_19.jpg);
+        background-repeat: no-repeat;
+        line-height: 32px;
+        padding-right: 20px;
+    }
+
+    .tabs .info {
+        float: left;
+        height: 32px;
+        padding-left: 60px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_21.jpg);
+        background-repeat: no-repeat;
+        line-height: 32px;
+        padding-right: 20px;
+    }
+
+    .tabs .members {
+        float: left;
+        height: 32px;
+        padding-left: 60px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_23.jpg);
+        background-repeat: no-repeat;
+        line-height: 32px;
+        padding-right: 20px;
+    }
+
+    .tabs .last {
+        float: right;
+        width: 15px;
+        height: 32px;
+        background-image: url(https://img.new-combats.com/i/clanpanel/klan_img_25.jpg);
+        background-repeat: no-repeat;
+    }
 
 
-#clancontent {width:100%; float:left; padding-top:25px; }
-.eventsblock {}
+    #clancontent {
+        width: 100%;
+        float: left;
+        padding-top: 25px;
+    }
+
+    .eventsblock {
+    }
 
 
+    .legtitle {
+        font-weight: bold;
+        padding: 0px 5px 0px 5px;
+        color: #990000;
+    }
 
-.legtitle   {font-weight:bold; padding:0px 5px 0px 5px; color:#990000;}
-.legcontent {padding:0px 5px 0px 5px;}
+    .legcontent {
+        padding: 0px 5px 0px 5px;
+    }
 
-.section {
-	width: 100%;
+    .section {
+        width: 100%;
 
-	margin: 0 0 30px;
-}
-ul.tabs {
-	height: 28px;
-	line-height: 25px;
-	list-style: none;
-	margin:0px; padding:0px;
-	font-size:10px;
-	color:#666;
-}
-.tabs li {
-	float: left;
-	position: relative;
-	cursor:pointer;
-	font-size:10px;
-}
+        margin: 0 0 30px;
+    }
 
-.tabs li a{
-	color:#666;
-	font-size:10px;
-}
-.tabs li:hover,
-.vertical .tabs li:hover {
+    ul.tabs {
+        height: 28px;
+        line-height: 25px;
+        list-style: none;
+        margin: 0px;
+        padding: 0px;
+        font-size: 10px;
+        color: #666;
+    }
 
-}
-li.current a{
-	color:#333333;
-	font-size:10px;
+    .tabs li {
+        float: left;
+        position: relative;
+        cursor: pointer;
+        font-size: 10px;
+    }
 
-}
+    .tabs li a {
+        color: #666;
+        font-size: 10px;
+    }
+
+    .tabs li:hover,
+    .vertical .tabs li:hover {
+
+    }
+
+    li.current a {
+        color: #333333;
+        font-size: 10px;
+
+    }
 
 
-.box {
-width:100%;
-float:left;
-display: none;
-padding-top:25px;
+    .box {
+        width: 100%;
+        float: left;
+        display: none;
+        padding-top: 25px;
 
 
-}
-.box.visible {
-	display: block;
-}
-.modpow {
+    }
 
-background-color:#ddd5bf;
+    .box.visible {
+        display: block;
+    }
 
-}
+    .modpow {
 
-.mt {
+        background-color: #ddd5bf;
 
-background-color:#b1a993;
+    }
 
-padding-left:10px;
+    .mt {
 
-padding-right:10px;
+        background-color: #b1a993;
 
-padding-top:5px;
+        padding-left: 10px;
 
-padding-bottom:5px;
+        padding-right: 10px;
 
-}
+        padding-top: 5px;
 
-.md {
+        padding-bottom: 5px;
 
-padding:10px;
+    }
 
-}
+    .md {
+
+        padding: 10px;
+
+    }
 </style>
 
 <script>
 
-function openMod(title, dat) {
-  var d = document.getElementById('useMagic');
-  if(d != undefined) {
-    document.getElementById('modtitle').innerHTML = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top">'+title+'</td><td width="30" valign="top"><div align="right"><a title="�������" onClick="closeMod(); return false;" href="#">x</a></div></td></tr></table>';
-    document.getElementById('moddata').innerHTML = dat;
-    d.style.display = '';
-  }
-}
+    function openMod(title, dat) {
+        var d = document.getElementById('useMagic');
+        if (d != undefined) {
+            document.getElementById('modtitle').innerHTML = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top">' + title + '</td><td width="30" valign="top"><div align="right"><a title="�������" onClick="closeMod(); return false;" href="#">x</a></div></td></tr></table>';
+            document.getElementById('moddata').innerHTML = dat;
+            d.style.display = '';
+        }
+    }
 
 
+    function closeMod() {
+        var d = document.getElementById('useMagic');
+        if (d != undefined) {
+            document.getElementById('modtitle').innerHTML = '';
+            document.getElementById('moddata').innerHTML = '';
+            d.style.display = 'none';
+        }
+    }
 
-function closeMod() {
-  var d = document.getElementById('useMagic');
-  if(d != undefined) {
-    document.getElementById('modtitle').innerHTML = '';
-    document.getElementById('moddata').innerHTML = '';
-    d.style.display = 'none';
-  }
-}
+    function addNewEvent() {
+        openMod('�������� �������',
+            '<form method="post" action="main.php?clan&events&add=<?=$code?>">���������: <input name="titleadd" value="" style="width:335px;" type="text"><br><textarea name="textadd" style="width:412px;" rows="5"></textarea><br><div align="right"><input type="submit" value="�������� �������"></div></form>');
+    }
 
-function addNewEvent() {
-  openMod('�������� �������',
-	'<form method="post" action="main.php?clan&events&add=<?=$code?>">���������: <input name="titleadd" value="" style="width:335px;" type="text"><br><textarea name="textadd" style="width:412px;" rows="5"></textarea><br><div align="right"><input type="submit" value="�������� �������"></div></form>');
-}
-
-function addNewTitul() {
-  openMod('�������� �����',
-	'<form method="post" action="main.php?clan&titul&add=<?=$code?>">�������� ������: <input name="tituladd" value="" style="width:235px;" type="text"><br><small style="float:left">(�� ����� 30-�� ��������)</small><input style="float:right" type="submit" value="�������� �����"></div></form>');
-}
+    function addNewTitul() {
+        openMod('�������� �����',
+            '<form method="post" action="main.php?clan&titul&add=<?=$code?>">�������� ������: <input name="tituladd" value="" style="width:235px;" type="text"><br><small style="float:left">(�� ����� 30-�� ��������)</small><input style="float:right" type="submit" value="�������� �����"></div></form>');
+    }
 
 </script>
 
-<div id="useMagic" style="display:none; position:absolute; border:solid 1px #776f59; left: 50px; top: 186px;" class="modpow">
- <div class="mt" id="modtitle"></div>
- <div class="md" id="moddata"></div>
+<div id="useMagic" style="display:none; position:absolute; border:solid 1px #776f59; left: 50px; top: 186px;"
+     class="modpow">
+    <div class="mt" id="modtitle"></div>
+    <div class="md" id="moddata"></div>
 </div>
 <input style="float:right;margin:1px" type="button" value="���������" onClick="document.location='main.php'">
-<input style="float:right;margin:1px" type="button" value="��������" onClick="document.location='<?=$_SERVER['REQUEST_URI']?>'">
+<input style="float:right;margin:1px" type="button" value="��������"
+       onClick="document.location='<?= $_SERVER['REQUEST_URI'] ?>'">
 <?
-if($u->info['clan_prava'] != 'glava') {
-  if(isset($_GET['clan_exit']) && $u->newAct($_GET['sd4']) == true) {
-    if($u->info['money'] >= 50) {
-	  $txt = '����� <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$u->info['login'].'</a>['.$u->info['level'].']<a target="_blank" title="���. � '.$u->info['login'].'" href="info/'.$u->info['id'].'"><img src="https://img.new-combats.com/i/inf_'.$u->info['cityreg'].'.gif"></a> ������� ����. (50 ��.)';
-	  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", "�������������", "�������� ���������", "'.mysql_real_escape_string($txt).'")');
-	  mysql_query('UPDATE `users` SET `palpro` = 0, `clan` = 0, `align` = 0, `clan_prava` = "0|0|0|0", `money` = `money` - 50 WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
-	  $ar = $u->rem_itm_cl($u->info, $res['id'], 7);
-    } else {
-	  echo '<script>setTimeout("alert(\'��� ������ �� ����� ��������� ������� 50 ��.\');",500)</script>';
-	}
-  }
-?>
-<input style="float:right;margin:1px;margin-right:50px;color:red;" type="button" value="�������� ���� (50 ��.)" onClick="document.location='main.php?clan&clan_exit=1&sd4=<?=$u->info['nextAct']?>'">
+if ($u->info['clan_prava'] != 'glava') {
+    if (isset($_GET['clan_exit']) && $u->newAct($_GET['sd4']) == true) {
+        if ($u->info['money'] >= 50) {
+            $txt = '����� <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $u->info['login'] . '</a>[' . $u->info['level'] . ']<a target="_blank" title="���. � ' . $u->info['login'] . '" href="info/' . $u->info['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $u->info['cityreg'] . '.gif"></a> ������� ����. (50 ��.)';
+            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", "�������������", "�������� ���������", "' . mysql_real_escape_string(
+                    $txt
+                ) . '")'
+            );
+            mysql_query(
+                'UPDATE `users` SET `palpro` = 0, `clan` = 0, `align` = 0, `clan_prava` = "0|0|0|0", `money` = `money` - 50 WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+            );
+            $ar = $u->rem_itm_cl($u->info, $res['id'], 7);
+        } else {
+            echo '<script>setTimeout("alert(\'��� ������ �� ����� ��������� ������� 50 ��.\');",500)</script>';
+        }
+    }
+    ?>
+    <input style="float:right;margin:1px;margin-right:50px;color:red;" type="button" value="�������� ���� (50 ��.)"
+           onClick="document.location='main.php?clan&clan_exit=1&sd4=<?= $u->info['nextAct'] ?>'">
 <? } ?>
 <br>
 <div class="section">
-<div id="clanpanel">
-  <div class="head" style="position:relative"><img src="https://img.new-combats.com/i/align/align<?=$res['align'];?>.gif" style="position:absolute;top:23px;left:40px;" /></div>
-    <div class="panel" style="white-space:nowrap;min-width:1000px;">
-      <div class="name" onclick='location.href="main.php?clan&events"' title="������� �����" style="cursor:pointer"><img class="clanicon" src="https://img.new-combats.com/i/clan/<?=$res['name_mini'];?>.gif"><?=$res['name'];?></div>
-      <ul class="tabs">
-      <!--<li class="events"><a href="main.php?clan&events">�������</a></li>-->
-      <? if($tt[11][0] == 1) { ?><li class="control"><a href="main.php?clan&control">����������</a></li><? } ?>
-      <? if($tt[3][0] == 1) { ?><li class="deposit"><a href="main.php?clan&deposit">���������</a></li><? } ?>
-      <? if($tt[11][0] > 0) { ?><li class="clanart"><a href="main.php?clan&titul">������</a></li><? } ?>
-      <li class="rules"><a href="main.php?clan&rules">�����</a></li>
-      <li class="info"><a href="main.php?clan&info">� �����</a></li>
-      <li class="members"><a href="main.php?clan&members">����������</a></li>
-      <? if($tt[12][0] == 1) { ?>
-      <li class="rules"><a href="main.php?clan&diplom">����������</a></li>
-      <? } ?>
-      <li class="last"></li>
-      </ul>
-    </div>
- <div class="foot"></div>
-</div><? if(isset($_GET['events'])) { ?>
-   <div class="box visible">
-   <style>
-   .leftimg {
-    float:left; /* ������������ �� ������ ���� */
-    margin: 17px 17px 17px 7px; /* ������� ������ �������� */
-   }
-   .rightimg  {
-    float: right; /* ������������ �� ������� ����  */ 
-    margin: 17px 7px 17px 17px; /* ������� ������ �������� */
-   }
-   .dnbx {
-	   width:25px;
-	   height:22px;
-	   background-color:#ecece4;
-	   vertical-align:middle;
-	   text-align:center;  
-	   display:inline-block;
-	   margin:1px;
-	   padding-top:3px;
-	   cursor:default;
-   }
-   .dnbx1 {
-	   width:25px;
-	   height:22px;
-	   background-color:#ecece4;
-	   vertical-align:middle;
-	   text-align:center;  
-	   display:inline-block;
-	   margin:1px;
-	   padding-top:3px;
-	   cursor:default;
-   }
-   .dnbx5 {
-	   height:22px;
-	   background-color:#ecece4;
-	   vertical-align:middle;
-	   text-align:center;  
-	   display:inline-block;
-	   margin:1px;
-	   padding-top:3px;
-	   cursor:default;
-   }
-   .dnbx:hover {
-	   width:25px;
-	   height:22px;
-	   background-color:#dbdad5;
-	   vertical-align:middle;
-	   text-align:center;  
-	   display:inline-block;
-	   margin:1px;
-	   padding-top:3px;
-	   cursor:default;
-   }
-   .dnbx2 {
-	   width:25px;
-	   height:22px;
-	   background-color:#b5b4b1;
-	   color:#ecebe6;
-	   vertical-align:middle;
-	   text-align:center;  
-	   display:inline-block;
-	   margin:1px;
-	   padding-top:3px;
-	   cursor:default;
-   }
-   </style>
-    <fieldset style="border:1px dashed #eeeeee">
-      <legend><span class="legtitle">�������</span></legend>
-      <?
-	  	  
-	  $c_r = ''; $c_c = ''; $c_p = '';	 
-	  
-	  if(isset($_GET['add'],$_POST['textadd']) && $tt[2][0] == 1) {
-		 $lmsg = mysql_fetch_array(mysql_query('SELECT `id` FROM `clan_news` WHERE `uid` = "'.$u->info['id'].'" AND `time` > '.(time()-10).' LIMIT 1'));
-		 if(isset($lmsg['id'])) {
-			 $c_r .= '<font color="#FF0000"><b>������ ��������� ��������� ���� ������ ���� � 10 ������</b></font><br>'; 
-		 }else{
-			 $tadd = htmlspecialchars($_POST['textadd'],NULL,'cp1251');
-			 $ttadd = htmlspecialchars($_POST['titleadd'],NULL,'cp1251');
-			 if(str_replace(' ','',str_replace('	','',$tadd)) == '') {
-				 $c_r .= '<font color="#FF0000"><b>������ ���������� ������ �������</b></font><br>';  
-			 }elseif(str_replace(' ','',str_replace('	','',$ttadd)) == '') {
-				 $c_r .= '<font color="#FF0000"><b>������ ���������� ������ ���������</b></font><br>';  
-			 }else{
-				$tadd = str_replace("\n",'<br>',$tadd);
-				mysql_query('INSERT INTO `clan_news` (`clan`,`time`,`ddmmyyyy`,`uid`,`ip`,`login`,`title`,`text`) VALUES (
-				"'.$res['id'].'","'.time().'","'.date('d.m.Y').'","'.$u->info['id'].'","'.$u->info['ip'].'","'.$u->info['login'].'","'.mysql_real_escape_string($ttadd).'","'.mysql_real_escape_string($tadd).'"
-				)');
-				$c_r .= '<font color="#FF0000"><b>������� ���� ������� ���������</b></font><br>'; 
-			 }
-		 }
-	  }elseif(isset($_GET['delete']) && $tt[2][0] == 1) {
-		  $upd = mysql_query('UPDATE `clan_news` SET `delete` = "'.$u->info['id'].'" WHERE `clan` = "'.$res['id'].'" AND `delete` = "0" AND `uid` != "0" AND `id` = "'.mysql_real_escape_string($_GET['delete']).'" LIMIT 1');
-		  if($upd) {
-			 $c_r .= '<font color="#FF0000"><b>������� ���� ������� �������</b></font><br>';  
-		  }else{
-			  $c_r .= '<font color="#FF0000"><b>������� �� �������</b></font><br>';  
-		  }
-	  }
-	   
-	  $dd = date('d');
-	  $mm = date('m');
-	  $yy = date('Y');	
-	  
-	  if(isset($_GET['mm'])) {
-		 $mm =  ceil((int)$_GET['mm']);
-	  }
-	  if(isset($_GET['dd'])) {
-		 $dd =  ceil((int)$_GET['dd']);
-	  }
-	  if(isset($_GET['yy'])) {
-		 $yy =  ceil((int)$_GET['yy']);
-	  }
-	    
-	  $mml = ceil($mm)-1;
-	  $mmr = ceil($mm)+1;	  
-	  $yyl = $yy;
-	  $yyr = $yy;	  
-	  if($mml < 1) {
-		$yyl--;
-		$mml = 12;  
-	  }	  
-	  if($mmr > 12) {
-		$yyr++;
-		$mmr = 1;  
-	  }	
-	  $dds = array('','��','��','��','��','��','<font color="#981115">��</font>','<font color="#981115">��</font>');
-	  $mms = array('','������','�������','����','������','���','����','����','������','��������','�������','������','�������');
-	  $num = 0; $lday = 0;
-	  for($i = 0; $i < 7; $i++)
-	  {
-		$dayofweek = date('w',mktime(0, 0, 0, $mm, $day_count, $yy));
-		$dayofweek = $dayofweek - 1;
-		if($dayofweek == -1) $dayofweek = 6;
-	
-		if($dayofweek == $i)
-		{
-		  $week[$num][$i] = $day_count;
-		  $lday = $day_count;
-		  $day_count++;
-		}else{
-		  $week[$num][$i] = "";
-		}
-	  }
-	  
-	  function freenews($d,$m,$y) {
-		  global $res;
-		  $r = $d;
-		  if($d < 9) {
-			 $d = '0'.$d; 
-		  }
-		  if($m < 9) {
-			 $m = '0'.((int)$m); 
-		  }
-		  $n = mysql_fetch_array(mysql_query('SELECT `id` FROM `clan_news` WHERE `clan` = "'.$res['id'].'" AND `delete` = "0" AND `ddmmyyyy` = "'.$d.'.'.$m.'.'.$y.'" LIMIT 1'));
-		  if(isset($n['id'])) {
-			 $r = '<a style="text-decoration:underline;" href="?clan&events&ftr=1&mm='.$m.'&yy='.$y.'&dd='.$d.'">'.$r.'</a>'; 
-		  }
-		  return $r;
-	  }
-	  
-	  $i = 1;
-	  $c_c .= '<div style="width:260px;border:1px solid #9d9d9d;padding:10px;background-color:#ecebe7">';
-	  if($tt[2][0] > 0) {
-	  	$c_c .= '<center><input type="button" value="�������� �������" onClick="addNewEvent();"></center><br>';
-	  }
-	  $c_c .= '<div><span style="float:left" class="dnbx" title="'.$mms[$mml].' '.$yyl.'" onclick="location=\'?clan&events&mm='.$mml.'&yy='.$yyl.'\'">&lt;</span><span style="float:right" class="dnbx" onclick="location=\'?clan&events&mm='.$mmr.'&yy='.$yyr.'\'" title="'.$mms[$mmr].' '.$yyr.'">&gt;</span><center class="dnbx5">'.$yy.' '.$mms[ceil($mm)].'</center></div><br>';
-	  while($i <= 49) {
-		 if($i <= 7) {
-		 	$c_c .= '<small class="dnbx1"><b>'.$dds[$i].'</b></small>';
-		 }else{
-			if($i-7 > 7) {
-				$lday++;
-				if(date('d',mktime(0, 0, 0, $mm, $lday)) == $lday) {
-					if($lday == date('d') && $mm == ceil(date('m')) && $yy == date('Y')) {
-						$c_c .= '<span class="dnbx2">'.freenews($lday,$mm,$yy).'</span>';
-					}else{
-						$c_c .= '<span class="dnbx">'.freenews($lday,$mm,$yy).'</span>';
-					}
-				}else{
-					$c_c .= '<span class="dnbx1">&nbsp;</span>';
-				}
-			}else{
-				if($week[0][$i-8] > 0) {
-					if($week[0][$i-8] == date('d') && $mm == ceil(date('m')) && $yy == date('Y')) {
-						$c_c .= '<span class="dnbx2">'.freenews($week[0][$i-8],$mm,$yy).'</span>';
-					}else{
-						$c_c .= '<span class="dnbx"">'.freenews($week[0][$i-8],$mm,$yy).'</span>';
-					}
-				}elseif($lday > 0) {
-					$c_c .= '<span class="dnbx1">&nbsp;</span>';
-				}
-			}
-		 }
-		 if($i == 7 || $i == 14 || $i == 21 || $i == 28 || $i == 35 || $i == 42) {
-			if($lday > 0 || $i != 14) {
-				$c_c .= '<br>';
-			}
-		 }
-		 $i++; 
-	  }
-	  $c_c .= '</div>';
-	  
-		if($tt[1][0] == 1) {
-		  $cnftr = '';
-		  if(isset($_GET['ftr'])) {
-			  if($_GET['ftr'] == 1) {
-				$dd1 = $dd;
-				$mm1 = $mm;
-				$yy1 = $yy;
-				if($dd1 < 9) {
-					$dd1 = '0'.$dd1;
-				}
-				if($mm1 < 9) {
-					$mm1 = '0'.$mm1;
-				}
-			  	$cnftr = ' AND `ddmmyyyy` = "'.mysql_real_escape_string($dd1.'.'.$mm1.'.'.$yy1).'"';
-			  }
-		  }
-			$pg = round((int)$_GET['pg']);
-			if($pg < 1) {
-				$pg = 1;	
-			}
-			$pgssee = ceil(($pg-1)*5);
-		  
-			$pgs = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `clan_news` WHERE `clan` = "'.$res['id'].'" AND `delete` = "0"'.$cnftr));
-			$pgs = $pgs[0];
-			$pga = ceil($pgs/5);
-	
-			$i = 1;
-			while($i <= $pga) {
-				if($pg == $i) {
-					$c_p .= ' <b>'.$i.'</b> ';
-				}else{
-					if(isset($_GET['ftr'])) {
-						$c_p .= ' <a href="?clan&events&dd='.$dd.'&mm='.$mm.'&yy='.$yy.'&ftr='.$_GET['ftr'].'&pg='.$i.'">'.$i.'</a> ';
-					}else{
-						$c_p .= ' <a href="?clan&events&pg='.$i.'">'.$i.'</a> ';
-					}
-				}
-				$i++;
-			}
-			
-			if($c_p != '') {
-				$c_p = '�������: '.$c_p;
-			}
-		  
-		  $sp = mysql_query('SELECT * FROM `clan_news` WHERE `clan` = "'.$res['id'].'" AND `delete` < 1'.$cnftr.' ORDER BY `id` DESC LIMIT '.mysql_real_escape_string($pgssee).',5');
-		  while($pl = mysql_fetch_array($sp)) {
-			  if($pl['uid'] > 0) {
-				$login = $u->microLogin($pl['uid'],1);
-				if($tt[2][0] == 1){
-					$pl['text'] = '<img src="https://img.new-combats.com/i/clear.gif" width="13" height="13" title="������� �������" class="leftimg" style="cursor:pointer" onclick="location=\'main.php?clan&events&pg='.ceil($pg).'&delete='.$pl['id'].'\'">'.$pl['text'];
-				}
-			  }else{
-				$login = '';  
-			  }
-			  
-			  $c_r .= '
+    <div id="clanpanel">
+        <div class="head" style="position:relative"><img
+                    src="https://img.new-combats.com/i/align/align<?= $res['align']; ?>.gif"
+                    style="position:absolute;top:23px;left:40px;"/></div>
+        <div class="panel" style="white-space:nowrap;min-width:1000px;">
+            <div class="name" onclick='location.href="main.php?clan&events"' title="������� �����"
+                 style="cursor:pointer"><img class="clanicon"
+                                             src="https://img.new-combats.com/i/clan/<?= $res['name_mini']; ?>.gif"><?= $res['name']; ?>
+            </div>
+            <ul class="tabs">
+                <!--<li class="events"><a href="main.php?clan&events">�������</a></li>-->
+                <? if ($tt[11][0] == 1) { ?>
+                    <li class="control"><a href="main.php?clan&control">����������</a></li><? } ?>
+                <? if ($tt[3][0] == 1) { ?>
+                    <li class="deposit"><a href="main.php?clan&deposit">���������</a></li><? } ?>
+                <? if ($tt[11][0] > 0) { ?>
+                    <li class="clanart"><a href="main.php?clan&titul">������</a></li><? } ?>
+                <li class="rules"><a href="main.php?clan&rules">�����</a></li>
+                <li class="info"><a href="main.php?clan&info">� �����</a></li>
+                <li class="members"><a href="main.php?clan&members">����������</a></li>
+                <? if ($tt[12][0] == 1) { ?>
+                    <li class="rules"><a href="main.php?clan&diplom">����������</a></li>
+                <? } ?>
+                <li class="last"></li>
+            </ul>
+        </div>
+        <div class="foot"></div>
+    </div><? if (isset($_GET['events'])) { ?>
+        <div class="box visible">
+            <style>
+                .leftimg {
+                    float: left; /* ������������ �� ������ ���� */
+                    margin: 17px 17px 17px 7px; /* ������� ������ �������� */
+                }
+
+                .rightimg {
+                    float: right; /* ������������ �� ������� ����  */
+                    margin: 17px 7px 17px 17px; /* ������� ������ �������� */
+                }
+
+                .dnbx {
+                    width: 25px;
+                    height: 22px;
+                    background-color: #ecece4;
+                    vertical-align: middle;
+                    text-align: center;
+                    display: inline-block;
+                    margin: 1px;
+                    padding-top: 3px;
+                    cursor: default;
+                }
+
+                .dnbx1 {
+                    width: 25px;
+                    height: 22px;
+                    background-color: #ecece4;
+                    vertical-align: middle;
+                    text-align: center;
+                    display: inline-block;
+                    margin: 1px;
+                    padding-top: 3px;
+                    cursor: default;
+                }
+
+                .dnbx5 {
+                    height: 22px;
+                    background-color: #ecece4;
+                    vertical-align: middle;
+                    text-align: center;
+                    display: inline-block;
+                    margin: 1px;
+                    padding-top: 3px;
+                    cursor: default;
+                }
+
+                .dnbx:hover {
+                    width: 25px;
+                    height: 22px;
+                    background-color: #dbdad5;
+                    vertical-align: middle;
+                    text-align: center;
+                    display: inline-block;
+                    margin: 1px;
+                    padding-top: 3px;
+                    cursor: default;
+                }
+
+                .dnbx2 {
+                    width: 25px;
+                    height: 22px;
+                    background-color: #b5b4b1;
+                    color: #ecebe6;
+                    vertical-align: middle;
+                    text-align: center;
+                    display: inline-block;
+                    margin: 1px;
+                    padding-top: 3px;
+                    cursor: default;
+                }
+            </style>
+            <fieldset style="border:1px dashed #eeeeee">
+                <legend><span class="legtitle">�������</span></legend>
+                <?
+
+                $c_r = '';
+                $c_c = '';
+                $c_p = '';
+
+                if (isset($_GET['add'], $_POST['textadd']) && $tt[2][0] == 1) {
+                    $lmsg = mysql_fetch_array(
+                        mysql_query(
+                            'SELECT `id` FROM `clan_news` WHERE `uid` = "' . $u->info['id'] . '" AND `time` > ' . (time(
+                                ) - 10) . ' LIMIT 1'
+                        )
+                    );
+                    if (isset($lmsg['id'])) {
+                        $c_r .= '<font color="#FF0000"><b>������ ��������� ��������� ���� ������ ���� � 10 ������</b></font><br>';
+                    } else {
+                        $tadd = htmlspecialchars($_POST['textadd'], null, 'cp1251');
+                        $ttadd = htmlspecialchars($_POST['titleadd'], null, 'cp1251');
+                        if (str_replace(' ', '', str_replace('	', '', $tadd)) == '') {
+                            $c_r .= '<font color="#FF0000"><b>������ ���������� ������ �������</b></font><br>';
+                        } elseif (str_replace(' ', '', str_replace('	', '', $ttadd)) == '') {
+                            $c_r .= '<font color="#FF0000"><b>������ ���������� ������ ���������</b></font><br>';
+                        } else {
+                            $tadd = str_replace("\n", '<br>', $tadd);
+                            mysql_query(
+                                'INSERT INTO `clan_news` (`clan`,`time`,`ddmmyyyy`,`uid`,`ip`,`login`,`title`,`text`) VALUES (
+				"' . $res['id'] . '","' . time() . '","' . date(
+                                    'd.m.Y'
+                                ) . '","' . $u->info['id'] . '","' . $u->info['ip'] . '","' . $u->info['login'] . '","' . mysql_real_escape_string(
+                                    $ttadd
+                                ) . '","' . mysql_real_escape_string($tadd) . '"
+				)'
+                            );
+                            $c_r .= '<font color="#FF0000"><b>������� ���� ������� ���������</b></font><br>';
+                        }
+                    }
+                } elseif (isset($_GET['delete']) && $tt[2][0] == 1) {
+                    $upd = mysql_query(
+                        'UPDATE `clan_news` SET `delete` = "' . $u->info['id'] . '" WHERE `clan` = "' . $res['id'] . '" AND `delete` = "0" AND `uid` != "0" AND `id` = "' . mysql_real_escape_string(
+                            $_GET['delete']
+                        ) . '" LIMIT 1'
+                    );
+                    if ($upd) {
+                        $c_r .= '<font color="#FF0000"><b>������� ���� ������� �������</b></font><br>';
+                    } else {
+                        $c_r .= '<font color="#FF0000"><b>������� �� �������</b></font><br>';
+                    }
+                }
+
+                $dd = date('d');
+                $mm = date('m');
+                $yy = date('Y');
+
+                if (isset($_GET['mm'])) {
+                    $mm = ceil((int)$_GET['mm']);
+                }
+                if (isset($_GET['dd'])) {
+                    $dd = ceil((int)$_GET['dd']);
+                }
+                if (isset($_GET['yy'])) {
+                    $yy = ceil((int)$_GET['yy']);
+                }
+
+                $mml = ceil($mm) - 1;
+                $mmr = ceil($mm) + 1;
+                $yyl = $yy;
+                $yyr = $yy;
+                if ($mml < 1) {
+                    $yyl--;
+                    $mml = 12;
+                }
+                if ($mmr > 12) {
+                    $yyr++;
+                    $mmr = 1;
+                }
+                $dds = ['', '��', '��', '��', '��', '��', '<font color="#981115">��</font>', '<font color="#981115">��</font>'];
+                $mms = ['', '������', '�������', '����', '������', '���', '����', '����', '������', '��������', '�������', '������', '�������'];
+                $num = 0;
+                $lday = 0;
+                for ($i = 0; $i < 7; $i++) {
+                    $dayofweek = date('w', mktime(0, 0, 0, $mm, $day_count, $yy));
+                    $dayofweek = $dayofweek - 1;
+                    if ($dayofweek == -1) {
+                        $dayofweek = 6;
+                    }
+
+                    if ($dayofweek == $i) {
+                        $week[$num][$i] = $day_count;
+                        $lday = $day_count;
+                        $day_count++;
+                    } else {
+                        $week[$num][$i] = "";
+                    }
+                }
+
+                function freenews($d, $m, $y)
+                {
+                    global $res;
+                    $r = $d;
+                    if ($d < 9) {
+                        $d = '0' . $d;
+                    }
+                    if ($m < 9) {
+                        $m = '0' . ((int)$m);
+                    }
+                    $n = mysql_fetch_array(
+                        mysql_query(
+                            'SELECT `id` FROM `clan_news` WHERE `clan` = "' . $res['id'] . '" AND `delete` = "0" AND `ddmmyyyy` = "' . $d . '.' . $m . '.' . $y . '" LIMIT 1'
+                        )
+                    );
+                    if (isset($n['id'])) {
+                        $r = '<a style="text-decoration:underline;" href="?clan&events&ftr=1&mm=' . $m . '&yy=' . $y . '&dd=' . $d . '">' . $r . '</a>';
+                    }
+                    return $r;
+                }
+
+                $i = 1;
+                $c_c .= '<div style="width:260px;border:1px solid #9d9d9d;padding:10px;background-color:#ecebe7">';
+                if ($tt[2][0] > 0) {
+                    $c_c .= '<center><input type="button" value="�������� �������" onClick="addNewEvent();"></center><br>';
+                }
+                $c_c .= '<div><span style="float:left" class="dnbx" title="' . $mms[$mml] . ' ' . $yyl . '" onclick="location=\'?clan&events&mm=' . $mml . '&yy=' . $yyl . '\'">&lt;</span><span style="float:right" class="dnbx" onclick="location=\'?clan&events&mm=' . $mmr . '&yy=' . $yyr . '\'" title="' . $mms[$mmr] . ' ' . $yyr . '">&gt;</span><center class="dnbx5">' . $yy . ' ' . $mms[ceil(
+                        $mm
+                    )] . '</center></div><br>';
+                while ($i <= 49) {
+                    if ($i <= 7) {
+                        $c_c .= '<small class="dnbx1"><b>' . $dds[$i] . '</b></small>';
+                    } else {
+                        if ($i - 7 > 7) {
+                            $lday++;
+                            if (date('d', mktime(0, 0, 0, $mm, $lday)) == $lday) {
+                                if ($lday == date('d') && $mm == ceil(date('m')) && $yy == date('Y')) {
+                                    $c_c .= '<span class="dnbx2">' . freenews($lday, $mm, $yy) . '</span>';
+                                } else {
+                                    $c_c .= '<span class="dnbx">' . freenews($lday, $mm, $yy) . '</span>';
+                                }
+                            } else {
+                                $c_c .= '<span class="dnbx1">&nbsp;</span>';
+                            }
+                        } else {
+                            if ($week[0][$i - 8] > 0) {
+                                if ($week[0][$i - 8] == date('d') && $mm == ceil(date('m')) && $yy == date('Y')) {
+                                    $c_c .= '<span class="dnbx2">' . freenews($week[0][$i - 8], $mm, $yy) . '</span>';
+                                } else {
+                                    $c_c .= '<span class="dnbx"">' . freenews($week[0][$i - 8], $mm, $yy) . '</span>';
+                                }
+                            } elseif ($lday > 0) {
+                                $c_c .= '<span class="dnbx1">&nbsp;</span>';
+                            }
+                        }
+                    }
+                    if ($i == 7 || $i == 14 || $i == 21 || $i == 28 || $i == 35 || $i == 42) {
+                        if ($lday > 0 || $i != 14) {
+                            $c_c .= '<br>';
+                        }
+                    }
+                    $i++;
+                }
+                $c_c .= '</div>';
+
+                if ($tt[1][0] == 1) {
+                    $cnftr = '';
+                    if (isset($_GET['ftr'])) {
+                        if ($_GET['ftr'] == 1) {
+                            $dd1 = $dd;
+                            $mm1 = $mm;
+                            $yy1 = $yy;
+                            if ($dd1 < 9) {
+                                $dd1 = '0' . $dd1;
+                            }
+                            if ($mm1 < 9) {
+                                $mm1 = '0' . $mm1;
+                            }
+                            $cnftr = ' AND `ddmmyyyy` = "' . mysql_real_escape_string(
+                                    $dd1 . '.' . $mm1 . '.' . $yy1
+                                ) . '"';
+                        }
+                    }
+                    $pg = round((int)$_GET['pg']);
+                    if ($pg < 1) {
+                        $pg = 1;
+                    }
+                    $pgssee = ceil(($pg - 1) * 5);
+
+                    $pgs = mysql_fetch_array(
+                        mysql_query(
+                            'SELECT COUNT(`id`) FROM `clan_news` WHERE `clan` = "' . $res['id'] . '" AND `delete` = "0"' . $cnftr
+                        )
+                    );
+                    $pgs = $pgs[0];
+                    $pga = ceil($pgs / 5);
+
+                    $i = 1;
+                    while ($i <= $pga) {
+                        if ($pg == $i) {
+                            $c_p .= ' <b>' . $i . '</b> ';
+                        } else {
+                            if (isset($_GET['ftr'])) {
+                                $c_p .= ' <a href="?clan&events&dd=' . $dd . '&mm=' . $mm . '&yy=' . $yy . '&ftr=' . $_GET['ftr'] . '&pg=' . $i . '">' . $i . '</a> ';
+                            } else {
+                                $c_p .= ' <a href="?clan&events&pg=' . $i . '">' . $i . '</a> ';
+                            }
+                        }
+                        $i++;
+                    }
+
+                    if ($c_p != '') {
+                        $c_p = '�������: ' . $c_p;
+                    }
+
+                    $sp = mysql_query(
+                        'SELECT * FROM `clan_news` WHERE `clan` = "' . $res['id'] . '" AND `delete` < 1' . $cnftr . ' ORDER BY `id` DESC LIMIT ' . mysql_real_escape_string(
+                            $pgssee
+                        ) . ',5'
+                    );
+                    while ($pl = mysql_fetch_array($sp)) {
+                        if ($pl['uid'] > 0) {
+                            $login = $u->microLogin($pl['uid'], 1);
+                            if ($tt[2][0] == 1) {
+                                $pl['text'] = '<img src="https://img.new-combats.com/i/clear.gif" width="13" height="13" title="������� �������" class="leftimg" style="cursor:pointer" onclick="location=\'main.php?clan&events&pg=' . ceil(
+                                        $pg
+                                    ) . '&delete=' . $pl['id'] . '\'">' . $pl['text'];
+                            }
+                        } else {
+                            $login = '';
+                        }
+
+                        $c_r .= '
 	<table width="100%" border="0" style="border:1px solid #aeaeae" cellspacing="0" cellpadding="5">
 	  <tr>
-		<td bgcolor="#c4c3c1"><div style="float:left"><i>'.date('d.m.Y H:i',$pl['time']).'</i> &nbsp; &nbsp; &nbsp; <a class="a" href="javascript:void(0)">'.$pl['title'].'</a></div><div style="float:right">'.$login.'</div></td>
+		<td bgcolor="#c4c3c1"><div style="float:left"><i>' . date(
+                                'd.m.Y H:i', $pl['time']
+                            ) . '</i> &nbsp; &nbsp; &nbsp; <a class="a" href="javascript:void(0)">' . $pl['title'] . '</a></div><div style="float:right">' . $login . '</div></td>
 	  </tr>
 	  <tr>
-		<td>'.$pl['text'].'</td>
+		<td>' . $pl['text'] . '</td>
 	  </tr>
 	</table><br>';
-		  }	 
-	  }
-	  if($c_r == '') {
-		 $c_r .= '<br><br><br><br><br><br><br><br><center><b>������� ���� ��� ��� ����� ����� �� ����������� ��� � ��� ������</b></center>'; 
-	  }
-	   
-	  ?>
-      <table width="100%" border="0" cellspacing="0" cellpadding="10">
-      <tr>
-        <td align="left" valign="top"><?=$c_r?></td>
-        <td width="300" align="center" valign="top"><?=$c_c?></td>
-      </tr>
-      <tr>
-        <td align="right" valign="top"><?=$c_p?></td>
-        <td align="left" valign="top">&nbsp;</td>
-      </tr>
-      </table>
-    </fieldset>
-   </div>
-   <? }elseif(isset($_GET['control'])) { ?> 
-   <script>
-	function changeLogin(selObj){
-	  selid = selObj.options[selObj.selectedIndex].value;
-	  $('#sn_titul').val($('#slg'+selid).attr('vtitul'));
-	  $('#sn_zvanie').val($('#slg'+selid).attr('vzvanie'));
-	  $('#sn_canals').val($('#slg'+selid).attr('vcanals'));
-	  
-	  if($('#slg'+selid).attr('vtitul') == '����� �����') {
-		  $('#rp_titul').attr({'disabled':'disabled'});
-		  $('#sn_zvanie').attr({'disabled':'disabled'});
-		  $('#sn_canals').attr({'disabled':'disabled'});
-		  $('#rp_save').attr({'disabled':'disabled'});
-	  }else{
-		  $('#rp_titul').attr({'disabled':false});
-		  $('#sn_zvanie').attr({'disabled':false});
-		  $('#sn_canals').attr({'disabled':false});
-		  $('#rp_save').attr({'disabled':false});
-	  }
-	}
-   </script>
-   <div class="box visible">
-    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-		��� ���������� ������: <a href="javascript:void(0)"><? if($res['politic'] == 1) { ?>���������<? }else{ ?>����������<? } ?></a>
-    </div>
-    <?
-	$c_pr = array(
-		100, //�������
-		50, //�������
-		100 //������� �����
-	);
- 
-	if(isset($_POST['svb_canals']) && $tt[11][0] == 1) {
-		echo '<font color="#FF0000"><b>������ ���� ���������</b></font><br>';
-		$res['canals'] = $_POST['svb_canals'];
-		$rce = explode();
-		$i = 1;
-		while($i <= 9) {
-			
-			$i++;
-		}
-		mysql_query('UPDATE `clan` SET `canals` = "'.mysql_real_escape_string($res['canals']).'" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-	}elseif(isset($_POST['svb_give_money']) && $tt[7][0] == 1) {
-		$mn = round((int)$_POST['svb_give_money'],2);
-		if($mn >= 0.01) {
-			if($res['money1'] < $mn) {
-				echo '<font color="#FF0000"><b>� ����� ������������ �������</b></font><br>';
-			}else{
-				$res['money1'] -= $mn;
-				$u->info['money'] += $mn;
-				echo '<font color="#FF0000"><b>�� ������� ����� � ����� ����� '.$mn.' ��.</b></font><br>';
-				mysql_query('UPDATE `clan` SET `money1` = "'.mysql_real_escape_string($res['money1']).'" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-				mysql_query('UPDATE `users` SET `money` = "'.mysql_real_escape_string($u->info['money']).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
-				mysql_query('INSERT INTO `clan_operations` (`clan`,`time`,`type`,`text`,`val`,`uid`) VALUES ("'.$res['id'].'","'.time().'","1","'.$u->info['login'].'","'.mysql_real_escape_string($mn).'","'.$u->info['id'].'")');
-			}
-		}
-	}elseif(isset($_POST['svb_take_money']) && $tt[6][0] == 1) {
-		$mn = round((int)$_POST['svb_take_money'],2);
-		if($mn >= 0.01) {
-			if($u->info['money'] < $mn) {
-				echo '<font color="#FF0000"><b>� ��� ������������ �������</b></font><br>';
-			}else{
-				$res['money1'] += $mn;
-				$u->info['money'] -= $mn;
-				echo '<font color="#FF0000"><b>�� ������� �������� � ����� ����� '.$mn.' ��.</b></font><br>';
-				mysql_query('UPDATE `clan` SET `money1` = "'.mysql_real_escape_string($res['money1']).'" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-				mysql_query('UPDATE `users` SET `money` = "'.mysql_real_escape_string($u->info['money']).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
-				mysql_query('INSERT INTO `clan_operations` (`clan`,`time`,`type`,`text`,`val`,`uid`) VALUES ("'.$res['id'].'","'.time().'","2","'.$u->info['login'].'","'.mysql_real_escape_string($mn).'","'.$u->info['id'].'")');
-			}
-		}
-	}elseif(isset($_POST['invite']) && ($_POST['invite'] == '�������' || $_POST['invite'] == '�������' || $_POST['invite'] == '���������') && $tt[11][0] == 1) {
-		if($_POST['invite'] == "�������" && $tt[10][0] == 1) {
-			$usr = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `login` = "'.mysql_real_escape_string($_POST['logingo']).'" AND `clan` = "'.$res['id'].'" LIMIT 1'));
-			//$ttus = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = "'.$usr['clan_prava'].'" LIMIT 1'));
-			if(!isset($usr['id'])) {
-				echo '<font color="#FF0000"><b>����� �� ������ � �����</b></font><br>';
-			} elseif($tt['prioritet'] >= $utitl['prioritet']) {
-				echo '<font color="#FF0000"><b>����� ������ ��� �� ������, ���� ������ ���������</b></font><br>';
-			} elseif($u->info['money'] < $c_pr[1]) {
-				echo '<font color="#FF0000"><b>� ��� �� ���������� ��. ��� ���������� ������ �� ����� (���������: '.$c_pr[1].' ��.)</b></font><br>';
-			} elseif($usr['clan_prava'] == 'galva' && $u->info['clan_prava'] != 'glava') {
-				echo '<font color="#FF0000"><b>����� ������ ��� �� ������, ���� ������ ���������</b></font><br>';
-			} else {
-			  $ar = $u->rem_itm_cl($usr, $res['id'], 8);
-				mysql_query('UPDATE `users` SET `palpro` = 0, `clan_prava` = 0, `clan` = 0, `mod_zvanie` = "", `align` = 0 WHERE `id` = "'.$usr['id'].'" LIMIT 1');
-				$u->info['money'] -= $c_pr[1];
-				mysql_query('UPDATE `users` SET `money` = "'.$u->info['money'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
-				$c_r .= '<font color="#FF0000"><b>����� &quot;'.$usr['login'].'&quot; ��� �������� �� ����� �� '.$c_pr[1].' ��.</b></font><br>'; 
-				$txt = '����� <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$u->info['login'].'</a>['.$u->info['level'].']<a target="_blank" title="���. � '.$u->info['login'].'" href="info/'.$u->info['id'].'"><img src="https://img.new-combats.com/i/inf_'.$u->info['cityreg'].'.gif"></a> �������� �� ����� ������ <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$usr['login'].'</a>['.$usr['level'].']<a target="_blank" title="���. � '.$usr['login'].'" href="info/'.$usr['id'].'"><img src="https://img.new-combats.com/i/inf_'.$usr['cityreg'].'.gif"></a>';
-				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","�������������","�������� ���������","'.mysql_real_escape_string($txt).'"
-				)');
-			}
-		}elseif($_POST['invite'] == "���������" && $u->info['clan_prava'] == 'glava') {
-			$usr = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `login` = "'.mysql_real_escape_string($_POST['logingo']).'" AND `clan` = "'.$res['id'].'" AND `banned` = "0" LIMIT 1'));
-			if(!isset($usr['id'])) {
-				echo '<font color="#FF0000"><b>����� �� ������ � �����</b></font><br>';
-			}elseif($u->info['money'] < $c_pr[2]) {
-				echo '<font color="#FF0000"><b>� ��� �� ���������� ��. ��� ���������� ������ �� ���� ����� ����� (���������: '.$c_pr[2].' ��.)</b></font><br>';
-			}elseif($usr['clan_prava'] == 'galva') {
-				echo '<font color="#FF0000"><b>����� ��� �������� ������ �����</b></font><br>';
-			}else{
-				mysql_query('UPDATE `users` SET `clan_prava` = "glava", `clan` = "'.$res['id'].'", `mod_zvanie` = "����� �����", `align` = "'.$res['align'].'" WHERE `id` = "'.$usr['id'].'" LIMIT 1');
-				$u->info['money'] -= $c_pr[2];
-				mysql_query('UPDATE `users` SET `clan_prava` = "2", `mod_zvanie` = "�������", `money` = "'.$u->info['money'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
-				$c_r .= '<font color="#FF0000"><b>����� &quot;'.$usr['login'].'&quot; ��� �������� ������ ���� �� '.$c_pr[0].' ��.</b></font><br>'; 
-				$txt = '����� <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$u->info['login'].'</a>['.$u->info['level'].']<a target="_blank" title="���. � '.$u->info['login'].'" href="info/'.$u->info['id'].'"><img src="https://img.new-combats.com/i/inf_'.$u->info['cityreg'].'.gif"></a> �������� ������ <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$usr['login'].'</a>['.$usr['level'].']<a target="_blank" title="���. � '.$usr['login'].'" href="info/'.$usr['id'].'"><img src="https://img.new-combats.com/i/inf_'.$usr['cityreg'].'.gif"></a> �� ��������� <b>����� �����</b>';
-				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","�������������","�������� ���������","'.mysql_real_escape_string($txt).'"
-				)');
-			}
-		}elseif($_POST['invite'] == "�������" && $tt[9][0] == 1) {
-            $is_cl = mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM `users` WHERE `clan` = '".$res['id']."'"));
-            $usr = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `login` = "'.mysql_real_escape_string($_POST['logingo']).'" AND `clan` != "'.$res['id'].'" LIMIT 1'));
-			if(!isset($usr['id'])) {
-				echo '<font color="#FF0000"><b>���������� ����� �� ������, ���� �� ������ �������� �� �������</b></font><br>';
-			}elseif($usr['clan_prava'] == 'galva') {
-				echo '<font color="#FF0000"><b>����� ��� �������� ������ �����</b></font><br>';
-			}elseif($usr['palpro'] < time()) {
-				echo '<font color="#FF0000"><b>����� ������ ������ �������� � ���������</b></font><br>';
-			}elseif($u->info['money'] < $c_pr[0]) {
-				echo '<font color="#FF0000"><b>� ��� �� ���������� ��. ��� ������ ������ � ���� (���������: '.$c_pr[0].' ��.)</b></font><br>';
-			}elseif($usr['clan'] != '0' || $usr['align'] != '0') {
-				echo '<font color="#FF0000"><b>�������� ��� ��������� � �����, ���� ����� ����������</b></font><br>';
-            } elseif($is_cl[0] >= $lvl_prava[$res['level']][0]) {
-                echo '<font color="#FF0000"><b>��������� ����� �����������. ������� ������� �����.</b></font><br>';
-			}else{
-				mysql_query('UPDATE `users` SET `palpro` = "0",`clan_prava` = "2",`clan` = "'.$res['id'].'",`mod_zvanie` = "",`align` = "'.$res['align'].'" WHERE `id` = "'.$usr['id'].'" LIMIT 1');
-				$u->info['money'] -= $c_pr[0];
-				mysql_query('UPDATE `users` SET `money` = "'.$u->info['money'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
-				echo '<font color="#FF0000"><b>����� &quot;'.$usr['login'].'&quot; ��� ������ � ���� �� '.$c_pr[0].' ��.</b></font><br>'; 
-				$txt = '����� <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$u->info['login'].'</a>['.$u->info['level'].']<a target="_blank" title="���. � '.$u->info['login'].'" href="info/'.$u->info['id'].'"><img src="https://img.new-combats.com/i/inf_'.$u->info['cityreg'].'.gif"></a> ������ � ���� ������ <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$usr['login'].'</a>['.$usr['level'].']<a target="_blank" title="���. � '.$usr['login'].'" href="info/'.$usr['id'].'"><img src="https://img.new-combats.com/i/inf_'.$usr['cityreg'].'.gif"></a>';
-				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","�������������","�������� ���������","'.mysql_real_escape_string($txt).'"
-				)');
-			}
-		}
-	}
-	?>
-    <? if($tt[9][0] > 0) { ?>
-    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-	<input style="width:144px;" value="���������� � ����" onClick="openMod('<b>���������� ������ � ����</b>','<form action=\'main.php?clan&control&priem\' method=\'post\'>�����: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');" type="button" /> 
-	(��� ��� ��������� � <?=$c_pr[0]?><b> ��.</b>)<br />
-    (����� ������� � ����, �������� ������ ������ �������� � ���������)<br />
-    </div>
-    <? } ?>
-    <? if($tt[10][0] > 0) { ?>
-    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-    <input type="button" style="width:144px;" value="������� �� �����" onClick="openMod('<b>������� ������ �� �����</b>','<form action=\'main.php?clan&control&unpriem\' method=\'post\'>�����: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');"> 
-    (��� ��� ��������� � <?=$c_pr[1]?><b> ��.</b>)<br />
-    </div>
-    <? } ?>
-    <? if($u->info['clan_prava'] == 'glava') { ?>
-    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-	<input style="width:144px;" value="������� ����� �����" onClick="openMod('<b>��������� ����� �����</b>','<form action=\'main.php?clan&control&newglava\' method=\'post\'>�����: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'���������\'></form>');" type="button" /> (����� ����� ������ ������� � ���� ����������, �������� ������ ����� ������� ���������)<br />
-	</div>
-    <? } ?>
-    <? if($tt[11][0] > 0) { ?>
-    <fieldset>
-      <legend><span class="legtitle">�������������� ������� ���������</span></legend>
-      <?
-	  if(isset($_GET['saveuser']) && $tt[11][0] == 1) {
-		 //[rp_login] => 0 [rp_titul] => 0 [rp_zvanie] => [rp_canals] => 
-		 $c_r = '';
-		 $usr = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.mysql_real_escape_string($_POST['rp_login']).'" AND `clan` = "'.$res['id'].'" LIMIT 1'));
-		 if(isset($usr['id'])) {
-			 if($usr['clan_prava'] != 'glava') {
-			 	$tt = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = "'.$usr['clan_prava'].'" LIMIT 1'));
-				if($tt['prioritet'] < $utitl['prioritet']) {
-					//����� �����
-					if((int)$_POST['rp_titul'] > 0) {
-						$tt_new = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = "'.mysql_real_escape_string($_POST['rp_titul']).'" AND `clan` = "'.$res['id'].'" LIMIT 1'));
-						if(isset($tt_new['id'])) {
-							if($tt_new['prioritet'] < $utitl['prioritet']) {
-								mysql_query('UPDATE `users` SET `clan_prava` = "'.$tt_new['id'].'" WHERE `id` = "'.$usr['id'].'" LIMIT 1');
-								$c_r .= '<font color="#FF0000"><b>������ &quot;'.$usr['login'].'&quot; ��� �������� ����� &quot;'.$tt_new['name'].'&quot;</b></font><br>'; 
-								if($tt_new['prioritet'] < $tt['prioritet']) {
-									//�������
-									$txt = '����� <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$u->info['login'].'</a>['.$u->info['level'].']<a target="_blank" title="���. � '.$u->info['login'].'" href="info/'.$u->info['id'].'"><img src="https://img.new-combats.com/i/inf_'.$u->info['cityreg'].'.gif"></a> ������� ����� ������ <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$usr['login'].'</a>['.$usr['level'].']<a target="_blank" title="���. � '.$usr['login'].'" href="info/'.$usr['id'].'"><img src="https://img.new-combats.com/i/inf_'.$usr['cityreg'].'.gif"></a> �� &quot;<b>'.$tt_new['name'].'</b>&quot;';
-								}else{
-									//��������
-									$txt = '����� <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$u->info['login'].'</a>['.$u->info['level'].']<a target="_blank" title="���. � '.$u->info['login'].'" href="info/'.$u->info['id'].'"><img src="https://img.new-combats.com/i/inf_'.$u->info['cityreg'].'.gif"></a> �������� ����� &quot;<b>'.$tt_new['name'].'</b>&quot; ������ <img src="https://img.new-combats.com/i/align/align'.$u->info['align'].'.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/'.$res['name'].'.gif" style="vertical-align:bottom"><a href="javascript:void(0)">'.$usr['login'].'</a>['.$usr['level'].']<a target="_blank" title="���. � '.$usr['login'].'" href="info/'.$usr['id'].'"><img src="https://img.new-combats.com/i/inf_'.$usr['cityreg'].'.gif"></a>';
-								}
-								
-								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","�������������","�������� ���������","'.mysql_real_escape_string($txt).'"
-								)');
-								
-							}else{
-								$c_r .= '<font color="#FF0000"><b>�� �� ������ ��������� ����� ������ ������ ������</b></font><br>'; 
-							}
-						}
-					}
-					mysql_query('UPDATE `users` SET `mod_zvanie` = "'.mysql_real_escape_string($_POST['rp_zvanie']).'",`ccanals` = "'.mysql_real_escape_string($_POST['rp_canals']).'" WHERE `id` = "'.$usr['id'].'" LIMIT 1');
-					$c_r .= '<font color="#FF0000"><b>���������� ������� ���������</b></font><br>';					
-					
-				}else{
-					$c_r .= '<font color="#FF0000"><b>����� ������ ��� �� ������, ���� ������ ���������</b></font><br>'; 
-				}
-			 }else{
-				$c_r .= '<font color="#FF0000"><b>����� ������ ��� �� ������, ���� ������ ���������</b></font><br>'; 
-			 }
-		 }else{
-			 $c_r .= '<font color="#FF0000"><b>����� �� ������� � ����� '.$res['name'].'</b></font><br>';  
-		 }
-	  }
-	  echo $c_r;
-	  ?>
-      <form method="post" action="main.php?clan&control&saveuser">
-      <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-      <div style="display:inline-block;width:150px;">�����:</div><select onchange="changeLogin(this);" style="width:211px;" name="rp_login">
-      <option value="0" style="color:#CCCCCC">�������� �����</option>
-	  <?
-      $sp = mysql_query('SELECT `id`,`login`,`clan_prava`,`ccanals`,`mod_zvanie` FROM `users` WHERE `clan` = "'.$res['id'].'"');
-	  while($pl = mysql_fetch_array($sp)) {
-		  $cp = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = "'.mysql_real_escape_string($pl['clan_prava']).'" LIMIT 1'));
-		  if($pl['clan_prava'] == 'glava') {
-			 $cp['name'] = '����� �����'; 
-		  }
-		  echo '<option id="slg'.$pl['id'].'" value="'.$pl['id'].'" vtitul="'.$cp['name'].'" vzvanie="'.$pl['mod_zvanie'].'" vcanals="'.$pl['ccanals'].'">'.$pl['login'].'</option>';
-	  }
-	  ?></select>
-      </div>
-      <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-      <div style="display:inline-block;width:150px;">�����:</div><input id="sn_titul" style="width:211px;" disabled="disabled" name="rp_canals" type="text" />
-      </div>
-      <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-      <div style="display:inline-block;width:150px;">��������� �����:</div><select style="width:211px;" id="rp_titul" name="rp_titul">
-	  <option value="0" style="color:#CCCCCC">�� ������</option>
-	  <?
-      $sp = mysql_query('SELECT * FROM `clan_tituls` WHERE `clan` = "'.$res['id'].'" AND `delete` = "0" LIMIT 25');
-	  while($pl = mysql_fetch_array($sp)) {
-		  echo '<option value="'.$pl['id'].'">'.$pl['name'].'</option>';
-	  }
-	  ?></select>
-      </div>
-      <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-      <div style="display:inline-block;width:150px;">�������</div>
-      </div>
-      <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-      <div style="display:inline-block;width:150px;">������ � �����:</div><input style="width:211px;" id="sn_zvanie" name="rp_zvanie" type="text" />
-      </div>
-      <div>
-      <div style="display:inline-block;width:150px;">������ ����:</div><input style="width:211px;" id="sn_canals" name="rp_canals" type="text" /><br />
-      <small>(���������� ����� ������� ������ ��������� �������. ��������: 1,3,7. ��������� ������: 1-9)</small> <input name="���������" type="submit" id="rp_save" value="���������" />
-      </div>
-      </form>
-    </fieldset>
-      <form method="post" enctype="multipart/form-data" action="?clan&control&save_canals">
-      <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-top:10px;padding-bottom:5px;">
-      <div style="display:inline-block;width:150px;">������ ����:</div><input style="width:211px;" id="svb_canals" value="<?=$res['canals']?>" name="svb_canals" type="text" /> <input name="���������" type="submit" id="rp_save" value="���������" /><br />
-      <small>(���������� ����� ������� ������ �������� �������. ��������: 2,4,8. ��������� ������: 1-9)</small>
-      </div>
-      </form>
-      <? } ?>
-    <? if($tt[5][0] == 1) { ?>
-    <? if($tt[7][0] > 0 && $res['money2'] > 0) { ?>
-    <fieldset>
-      <legend><span class="legtitle">�������� �����������</span></legend>
-      <form action="?clan&control&buy_imgae" method="post" enctype="multipart/form-data">
-      	<?
-		/* ��������� ����������� � ������ */
-		
-		if(isset($_GET['gdload'])) {
-			echo '<b style="color:red">����������� ���� ������� ��������� �� ������! ��������������� �� �������� � ���������, � ������� &quot;�������&quot;.</b><br>';
-		}elseif(isset($_POST['img_load1type'])) {
-			
-		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 = '') {
-			if (isset($_FILES[$name])) {
-				$f = &$_FILES[$name];
-				if (($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).'_'.$cnm.'.'.$ext[1];
-						$fn2 = uniqid('f_',true).'';
-						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 = '�������� ��� �����. ���������� ���� : <b>'.$exts.'</b>';
-					}
-				} else {
-					self::$error = '�������� ������ �����. ������������ ������ ����� <b>'.$max_mb.' ��</b>';
-				}
-			} else {
-				self::$error = '���� �� ������';
-			}
-			return false;
-		} // end saveimg
-		 
-		} // end class
-			
-			$data = array(
-				'obraz' => $_FILES['load_image1'],
-				'sex'	=> round((int)$_POST['img_load3type']),
-				'w'		=> '',
-				'h'		=> '',
-				'type'	=> round((int)$_POST['img_load1type']),
-				'animation'	=> round((int)$_POST['img_load2type'])
-			);
-			
-			$ers = '';
-			
-			if($data['sex'] != 0 && $data['sex'] != 1) {
-				$ers = '������! �� �� ������� ��� ���� ����� �������� �����������!';
-			}elseif($data['animation'] != 0 && $data['animation'] != 1) {
-				$ers = '������! �� �� ������� ��� �����������: �������������, �� �������������!';
-			}elseif($data['type'] < 1 || $data['type'] > 18) {
-				$ers = '������! �� �� ������� ��� ����� ��������� �����������!';
-			}
-			
-			if($res['id'] !=2) {
-				//$ers = 'NO!';
-			}
-			
-			$types = array(
-				1  => array('�����',120,220,100),
-				2  => array('�������� (�����)',120,40,15),
-				3  => array('�������� (������)',120,20,5),
-				4  => array('����',60,60,25),
-				5  => array('������',60,40,25),
-				6  => array('����� ����',60,60,25),
-				7  => array('������ ����',60,60,25),
-				8  => array('�����',60,80,25),
-				9  => array('����',60,40,25),
-				10 => array('�������',60,40,25),
-				11 => array('������',60,80,25),
-				12 => array('��������',60,40,25),
-				13 => array('������ �1',20,20,10),
-				14 => array('�����',60,20,25),
-				15 => array('������',60,20,25),						
-				16 => array('�������� ��� ���������� � ���������',244,287,5),						
-				17 => array('������ �2',20,20,10),
-				18 => array('������ �3',20,20,10)						
-			);
-			
-			$data['price'] = $types[$data['type']][3];
-				
-				
-			if($data['price'] > $res['money2']) {
-				$ers = '������! � ����� ����� ������������ ����-�������� ��� ������������ ������� �����������.';
-			}
-			
-			if($ers != '') {
-				echo '<b style="color:red">'.$ers.'</b><br>';
-			}else{
-				/* ��������� ����������� */
-				$imgname = md5(rand(0,1000000000000).'&'.rand(0,10000000).'&'.microtime());
-				if($file = upload::saveimg('load_image1',0.35,'jpg|png|jpeg|gif',$imgname)) {
-					$size = getimagesize ("https://new-combats.com/clan_prw/".htmlspecialchars($file[1],NULL,'cp1251')."");
-						
-					$bag = 0;
-												
-					if($types[$data['type']][1] != $size[0] || $types[$data['type']][2] != $size[1]) {
-						$bag = 1;
-					}
-										
-					mysql_query('INSERT INTO `reimage` (`login`,`uid`,`time`,`src`,`clan`,`type`,`sex`,`animation`,`w`,`h`,`bag`) VALUES (
-						"'.$u->info['login'].'",
-						"'.$u->info['id'].'","'.time().'",
-						"'.mysql_real_escape_string(htmlspecialchars($file[1],NULL,'cp1251')).'",
-						"'.$u->info['clan'].'",
-						"'.mysql_real_escape_string($data['type']).'",
-						"'.mysql_real_escape_string($data['sex']).'",
-						"'.mysql_real_escape_string($data['animation']).'",
-						"'.mysql_real_escape_string((int)$size[0]).'",
-						"'.mysql_real_escape_string((int)$size[1]).'",
-						"'.$bag.'"
-					)');
-					
-					$res['money2'] -= $data['price'];
-					
-					mysql_query('UPDATE `clan` SET `money2` = "'.$res['money2'].'" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-					die('<meta http-equiv="refresh" content="0; URL=/main.php?clan&control&gdload">');
-				}else{
-					echo '<b style="color:red">'.upload::$error.'</b><br>';
-				}
-			}
-		}
-		
-		?>
-        <select name="img_load1type">
-      	  <option value="0"><b>�������� ��� �����������</b></option>
-      	  <option value="0"><b>�����</b></option>
-      	  <option value="1">- ����� [������: 120x220] (100 ���.)</option>
-      	  <option value="2">- �������� (�����) [������: 120x40] (15 ���.)</option>
-      	  <option value="3">- �������� (������) [������: 120x20] (5 ���.)</option>
-      	  <option value="0"><b>����� ��� ��������������</b></option>
-      	  <option value="4">- ���� [������: 60x60] (25 ���.)</option>
-      	  <option value="5">- ������ [������: 60x40] (25 ���.)</option>
-      	  <option value="6">- ����� ���� [������: 60x60] (25 ���.)</option>
-      	  <option value="7">- ������ ���� [������: 60x60] (25 ���.)</option>
-      	  <option value="8">- ����� [������: 60x80] (25 ���.)</option>
-      	  <option value="9">- ���� [������: 60x40] (25 ���.)</option>
-      	  <option value="10">- ������� [������: 60x40] (25 ���.)</option>
-      	  <option value="11">- ������ [������: 60x80] (25 ���.)</option>
-      	  <option value="12">- �������� [������: 60x40] (25 ���.)</option>
-      	  <option value="13">- ������ �1 [������: 20x20] (10 ���.)</option>
-          <option value="17">- ������ �2 [������: 20x20] (10 ���.)</option>
-          <option value="18">- ������ �3 [������: 20x20] (10 ���.)</option>
-      	  <option value="14">- ����� [������: 60x20] (25 ���.)</option>
-      	  <option value="15">- ������ [������: 60x20] (25 ���.)</option>
-      	  <option value="16">�������� ��� ���������� � ��������� [������: 244x287] (5 ���.)</option>
-   	    </select><br />
-      	<select name="img_load2type" id="img_load2type">
-      	  <option value="0">�������� (���������)</option>
-      	  <option>�������� (��������)(��������� ����������� �����������)</option>
-   	    </select><br />
-      	<select name="img_load3type" id="img_load3type">
-          <option value="-1">�������� ���</option>
-      	  <option value="0">��� ������</option>
-      	  <option value="1">��� ������</option>
-   	    </select><br />
-        <small style="color:red;">������ ����������� �� ������ ��������� 350 ��!</small>
-      	<br />
-        <input type="file" name="load_image1" id="load_image1" /> <button type="submit">���������</button><br />
-        <small style="color:red;">��������!</small>
-        <small> ����������� ���������� ������� ����, <a href="#">������� ���������� �����������</a>, ���� ���������� �������� ������������ ����������� ������ ����� ����� ������������� ��� ����������� �������� ������� � ��� ����������� ������ ����������� �� �����.</small>
-      </form>      
-    </fieldset>
-    <? } ?>
-    <? if($tt[7][0] > 0 && $u->info['clan'] == 17 || $u->info['clan'] == 1) { ?>
-    <fieldset>
-      <legend><span class="legtitle">��������</span></legend>
-<?
-$p['m1'] = 1;
-$srok = array(15=>'15 �����',30=>'30 �����',60=>'���� ���',180=>'��� ����',360=>'����� �����',720=>'���������� �����',1440=>'���� �����',4320=>'���� �����');
-		
-if(isset($_GET['usemod']))
-{
-	if(isset($_POST['usem1']))
-	{
-		include('moder/usem1.php');					
-	}elseif(isset($_POST['teleport']))
-	{
-		include('moder/teleport.php');
-	}
-}
-?>
-<table>
-<a href="#" onClick="openMod('<b>�������� ��������</b>','<form action=\'main.php?<? echo 'clan=1&control&usemod='.$code; ?>\' method=\'post\'>����� ���������: <input type=\'text\' style=\'width:144px;\' id=\'logingo\' name=\'logingo\'><br>����� ��������: &nbsp; <select style=\'margin-left:2px;\' name=\'time\'><option value=\'5\'>5 �����</option><option value=\'30\'>30 �����</option><option value=\'60\'>1 ���</option><option value=\'4320\'>3 �����</option></select> <input type=\'submit\' name=\'usem1\' value=\'���-��\'></form>');"><img src="https://img.new-combats.com/i/items/silence30.gif" title="�������� ��������" /></a>
-&nbsp;
-<a onClick="openMod('<b>������������</b>','<form action=\'main.php?<? echo 'clan=1&control&usemod='.$code; ?>\' method=\'post\'>����� ���������: <input type=\'text\' style=\'width:144px;\' id=\'logingo\' name=\'logingo\' value=\'<? echo $u->info['login']; ?>\'><br>�����: &nbsp; <select style=\'margin-left:2px;\' name=\'city\'><option value=\'capitalcity\'>capitalcity</option><option value=\'angelscity\'>angelscity</option><option value=\'demonscity\'>demonscity</option><option value=\'devilscity\'>devilscity</option><option value=\'suncity\'>suncity</option><option value=\'emeraldscity\'>emeraldscity</option><option value=\'sandcity\'>sandcity</option><option value=\'mooncity\'>mooncity</option><option value=\'eastcity\'>eastcity</option><option value=\'abandonedplain\'>abandonedplain</option><option value=\'dreamscity\'>dreamscity</option><option value=\'lowcity\'>devilscity</option><option value=\'oldcity\'>devilscity</option><option value=\'newcapitalcity\'>newcapital</option></select> <input type=\'submit\' name=\'teleport\' value=\'���-��\'></form>');" href="#"><img src="https://img.new-combats.com/i/items/teleport.gif" title="������������" /></a></table>
-    </fieldset>
-    <? } ?>
-    <fieldset>
-      <legend><span class="legtitle">����� �����</span></legend>
-      <form method="post" action="?clan&control&give_money">
-      ������ � ����� �����: <?=$res['money1']?> ��. <? if($res['money2'] > 0) { ?><br />
-      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <?=$res['money2']?> ���. <input type="button" value="������ ��������" /><? } ?><br />
-      <? if($tt[7][0] > 0) { ?>
-      ������� �� �����: <input id="svb_give_money" name="svb_give_money" value="0" type="text" /> <input type="submit" value=">>" />
-      <? } ?>
-      </form>
-      <? if($tt[6][0] > 0) { ?>
-      <form method="post" action="?clan&control&take_money">
-      <div style="border-top:1px solid #cac9c7;margin-top:5px;padding-top:5px;">
-      �������� ������ � �����: <input id="svb_take_money" name="svb_take_money" value="0" type="text" /> <input type="submit" value=">>" />
-      <small>(��� ����: <?=$u->info['money']?>��.)</small>
-      </div>
-      </form>
-      <? } ?>
-    </fieldset>
-	<? } ?>
-      <? if($tt[11][0] > 0 && $tt[3][0] == 1) { ?>
-      <form method="post" action="?clan&control&vipiska">
-      <div style="margin-top:5px;padding-top:5px;">
-      �������� ������� ��� ���������: <small>(������ ����� 1��.)</small> <input id="svb_vipiska" name="svb_vipiska" value="<?=date('d.m.Y')?>" type="text" /> <input type="submit" value="��������" />
-      </div>
-      </form>
-      <? } ?>
-   </div> 
-   <?
-   }elseif(isset($_GET['diplom']) && $tt[12][0] == 1) {
-	
-	if($tt[14][0] == 1){
-		if(isset($_GET['clanwars'])) {
-			//RadioGroup1
-			$cln = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `name` = "'.mysql_real_escape_string($_POST['logingo']).'" LIMIT 1'));
-			if(isset($cln['id'])) {
-				if($cln['id'] == $res['id']) {
-					
-					$rn = array(
-					'<font color="#FF0000"><b>���������, �� ����� ��� ������ ������ :-)</b></font><br>',
-					'<font color="#FF0000"><b>��� ����� ����� ������ �������, ���� ������� ������!</b></font><br>',
-					'<font color="#FF0000"><b>�� ������������� �����������, ��������� �������� ������ �����!</b></font><br>');					
-					echo $rn[rand(0,2)];				
-				}elseif($cln['join1'] == $res['join1'] && $res['join1'] > 0) {
-					echo '<font color="#FF0000"><b>�� �������� � ����� � ���� ������</b></font><br>';				
-				}elseif($cln['join2'] == $res['join2'] && $res['join2'] > 0) {
-					echo '<font color="#FF0000"><b>�� �������� � ������� � ���� ������</b></font><br>';		
-				}else{
-					$lwar = mysql_fetch_array(mysql_query('SELECT * FROM `clan_wars` WHERE `time_finish` > '.time().' AND ((`clan1` = "'.$cln['id'].'" AND `clan2` = "'.$res['id'].'") OR (`clan2` = "'.$cln['id'].'" AND `clan1` = "'.$res['id'].'")) LIMIT 1 '));
-					if(!isset($lwar['id'])) {
-						$mkr = 300; $tpcw = 1;
-						if($_POST['RadioGroup1'] == 2) {
-							$mkr = 600; $tpcw = 2;
-						}
-						if( true == true ) {
-							echo '<font color="#FF0000"><b>������ �������� ����� ����� ������</b></font><br>';
-						}elseif($mkr > $res['money1']) {
-							echo '<font color="#FF0000"><b>� ����� ����� �� ���������� �������</b></font><br>';
-						}else{
-							mysql_query('UPDATE `clan` SET `money1` = `money1` - '.$mkr.' WHERE `id` = "'.$res['id'].'" LIMIT 1');
-							mysql_query('INSERT INTO `clan_wars` (`clan1`,`clan2`,`time_start`,`time_finish`,`type`,`text`) VALUES ("'.$res['id'].'","'.$cln['id'].'","'.time().'","'.(time()+60*60*24*3).'","'.$tpcw.'","�����!")');
-							mysql_query('INSERT INTO `clan_operations` (`clan`,`time`,`type`,`text`,`val`,`uid`) VALUES ("'.$res['id'].'","'.time().'","4","'.$u->info['login'].'","clanwar_'.$mkr.'_'.$cln['id'].'","'.$u->info['id'].'")');
-							echo '<font color="#FF0000"><b>�� ������� �������� ����� ����� &quot;'.$cln['name'].'&quot; �� '.$mkr.' ��.</b></font><br>';
-						}
-					}else{
-						echo '<font color="#FF0000"><b>�� ��� ������ ����� � ������ ������</b></font><br>';
-					}
-				}
-			}else{
-				echo '<font color="#FF0000"><b>���� � ����� ��������� �� ������</b></font><br>';
-			}
-		}
-	}
-	
-   ?>
-    <br /><br />
-    <fieldset>
-      <legend><span class="legtitle">�������� �����</span></legend>
-      <? if($tt[14][0] == 1){ ?>
-      <input onClick="openMod('<b>�������� ����� �����</b>','<form action=\'main.php?clan&diplom&clanwars\' method=\'post\'>�������� �����: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br><label><input type=\'radio\' name=\'RadioGroup1\' value=\'1\' id=\'RadioGroup1_0\'>������� ����� (300 ��.)</label><br><span style=\'float:left\'><label><input type=\'radio\' name=\'RadioGroup1\' value=\'2\' id=\'RadioGroup1_1\'>�������� ����� (600��.)</label></span><input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');" type="submit" name="button" id="button" value="������ �����" />
-      <? } ?>
-      <br />
-      <div style="border:1px solid #CECECE;padding:10px;">
-      <?
-	  $ms = '';
-	  $sp = mysql_query('SELECT * FROM `clan_wars` WHERE (`clan1` = "'.$res['id'].'" OR `clan2` = "'.$res['id'].'") AND `time_finish` > "'.time().'"');
-	  while($pl = mysql_fetch_array($sp)) {
-		  $cln1 = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$pl['clan1'].'" LIMIT 1'));
-		  $cln2 = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$pl['clan2'].'" LIMIT 1'));
-		  $ms .= '<div style="border:1px solid #CECECE;padding:10px;">����� ����� ������� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$cln1['name_mini'].'.gif">'.$cln1['name'].'</b> � <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$cln2['name_mini'].'.gif">'.$cln2['name'].'</b>.<br>';
-		  if($pl['text'] != '') {
-			$ms .= '������� �����: <i>'.$pl['text'].'</i><br>';  
-		  }
-		  $ms .= '����� �����: '.date('d.m.Y H:i',$pl['time_start']).' - '.date('d.m.Y H:i',$pl['time_finish']).'</div>';
-	  }
-	  if($ms == '') {
-	  ?>
-      	� ������ ������ ��� ���� �� ����� ����.
-      <?
-	  }else{
-		 echo $ms; 
-	  }
-	  ?>
-      </div>
-    </fieldset>
-  <fieldset>
-    <legend><span class="legtitle">����� � �������</span></legend>
-      <? if($tt[13][0] == 1) {
-	  if(isset($_GET['joint']) && $tt[13][0] == 1) {
-		  if($_GET['joint'] == 1) {
-			 //���������� � ����
-			  $nm = htmlspecialchars($_POST['logingo'],NULL,'cp1251');
-			  $cnm = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `name` = "'.mysql_real_escape_string($nm).'" AND `type` = "1" LIMIT 1'));
-			  if(isset($cnm['id'])) {
-				$cnmz = mysql_fetch_array(mysql_query('SELECT * FROM `clan_join` WHERE `alians` = "'.$cnm['id'].'" AND `clan` = "'.$res['id'].'" AND `time_end` = "0" AND `time_start` = "0" AND `type` = "1" LIMIT 1'));
-				if(isset($cnmz['id'])) {
-					echo '<font color="#FF0000"><b>��� ���� ��� ����� ������ � ������ ����</b></font><br>';
-				}elseif($res['join1'] > 0) {
-					echo '<font color="#FF0000"><b>��� ���� ��� ��������� � �����</b></font><br>'; 
-				}else{
-					mysql_query('UPDATE `clan` SET `join1` = "'.$cnm['id'].'" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-					echo '<font color="#FF0000"><b>�� ������� ������ ������ � ���� &quot;'.$cnm['name'].'&quot;</b></font><br>';
-					mysql_query('INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`) VALUES ("'.$res['id'].'","'.$cnm['id'].'","'.time().'","1")');
-				}
-			  }else{
-				 echo '<font color="#FF0000"><b>������ ��� ���� � ������ ��������� �� ����������</b></font><br>'; 
-			  }
-		  }else{
-			 //���������� � ������
-			  $nm = htmlspecialchars($_POST['logingo'],NULL,'cp1251');
-			  $cnm = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `name` = "'.mysql_real_escape_string($nm).'" AND `type` = "2" LIMIT 1'));
-			  if(isset($cnm['id'])) {
-				$cnmz = mysql_fetch_array(mysql_query('SELECT * FROM `clan_join` WHERE `alians` = "'.$cnm['id'].'" AND `clan` = "'.$res['id'].'" AND `time_end` = "0" AND `time_start` = "0" AND `type` = "2" LIMIT 1'));
-				if(isset($cnmz['id'])) {
-					echo '<font color="#FF0000"><b>��� ���� ��� ����� ������ � ������ ������</b></font><br>';
-				}elseif($res['join1'] == 0) {
-					echo '<font color="#FF0000"><b>��� ���������� � ������ ��������� �������� � ����</b></font><br>'; 
-				}elseif($res['join2'] > 0) {
-					echo '<font color="#FF0000"><b>��� ���� ��� ��������� � �������</b></font><br>'; 
-				}else{
-					mysql_query('UPDATE `clan` SET `join1` = "'.$cnm['id'].'" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-					echo '<font color="#FF0000"><b>�� ������� ������ ������ � ������ &quot;'.$cnm['name'].'&quot;</b></font><br>';
-					mysql_query('INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`) VALUES ("'.$res['id'].'","'.$cnm['id'].'","'.time().'","2")');
-				}
-			  }else{
-				 echo '<font color="#FF0000"><b>������ ��� ���� � ������ ��������� �� ����������</b></font><br>'; 
-			  }
-		  }
-	  }elseif(isset($_GET['newjoint']) && $tt[13][0] == 1) {
-		if($_GET['newjoint'] == 1) {
-			//�����
-			if($res['join1'] > 0) {
-				echo '<font color="#FF0000"><b>��� ���� ��� ������� � �����</b></font><br>';
-			}else{
-				$nm = htmlspecialchars($_POST['logingo'],NULL,'cp1251');
-				if(str_replace(' ','',str_replace('	','',$nm)) == '') {
-					echo '<font color="#FF0000"><b>������� �������� �����</b></font><br>';
-				}else{
-					$cnm = mysql_fetch_array(mysql_query('SELECT `id` FROM `clan_joint` WHERE `name` = "'.mysql_real_escape_string($nm).'" LIMIT 1'));
-					if(!isset($cnm['id'])) {
-						mysql_query('INSERT INTO `clan_joint` (`time_open`,`name`,`type`,`clan_open`,`clan_glava`) VALUES ("'.time().'","'.mysql_real_escape_string($nm).'","1","'.$res['id'].'","'.$res['id'].'")');
-						$id = mysql_insert_id();
-						$res['join1'] = $id;
-						mysql_query('INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`,`time_start`) VALUES ("'.$res['id'].'","'.$id.'","'.time().'","1","'.time().'")');
-						mysql_query('UPDATE `clan` SET `join1` = "'.$id.'" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-						echo '<font color="#FF0000"><b>�� ������� ������� ���� &quot;'.$nm.'&quot;</b></font><br>';
-					}else{
-						echo '<font color="#FF0000"><b>������ ��� ���� � ������ ��������� ��� ����������</b></font><br>';
-					}
-				}
-			}
-		}else{
-			//�������
-			if($res['join1'] == 0) {
-				echo '<font color="#FF0000"><b>��� ���� ������ �������� � �����</b></font><br>';
-			}elseif($res['join2'] > 0) {
-				echo '<font color="#FF0000"><b>��� ���� ��� ������� � �������</b></font><br>';
-			}else{
-				$nm = htmlspecialchars($_POST['logingo'],NULL,'cp1251');
-				if(str_replace(' ','',str_replace('	','',$nm)) == '') {
-					echo '<font color="#FF0000"><b>������� �������� �������</b></font><br>';
-				}else{
-					$cnm = mysql_fetch_array(mysql_query('SELECT `id` FROM `clan_joint` WHERE `name` = "'.mysql_real_escape_string($nm).'" LIMIT 1'));
-					if(!isset($cnm['id'])) {
-						mysql_query('INSERT INTO `clan_joint` (`time_open`,`name`,`type`,`clan_open`,`clan_glava`) VALUES ("'.time().'","'.mysql_real_escape_string($nm).'","2","'.$res['id'].'","'.$res['id'].'")');
-						$id = mysql_insert_id();
-						$res['join2'] = $id;
-						mysql_query('INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`,`time_start`) VALUES ("'.$res['id'].'","'.$id.'","'.time().'","2","'.time().'")');
-						mysql_query('UPDATE `clan` SET `join2` = "'.$id.'" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-						echo '<font color="#FF0000"><b>�� ������� ������� ������ &quot;'.$nm.'&quot;</b></font><br>';
-					}else{
-						echo '<font color="#FF0000"><b>������ ��� ���� � ������ ��������� ��� ����������</b></font><br>';
-					}
-				}
-			}
-		}
-	  }elseif(isset($_GET['cancel']) && $tt[13][0] == 1) {
-		 $zvn = mysql_fetch_array(mysql_query('SELECT * FROM `clan_join` WHERE `id` = "'.mysql_real_escape_string($_GET['cancel']).'" AND `time_start` = "0" AND `time_end` = "0" LIMIT 1')); 
-		 if(!isset($zvn['id'])) {
-			 echo '<font color="#FF0000"><b>������ �� ���������� �� �������</b></font><br>';
-		 }else{
-			 $rzv = '';
-			if($zvn['clan'] == $res['id']) {
-				//������ �������������
-				$szu = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$zvn['alians'].'" LIMIT 1'));
-				if($szu['type'] == 1) {
-					$rzv = '���� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif">'.$res['name'].'</b> ��������� �� ������������� � ����� <b>'.$szu['name'].'</b>.';
-				}else{
-					$rzv = '���� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif">'.$res['name'].'</b> ��������� �� ������������� � ������� <b>'.$szu['name'].'</b>.';
-				}
-			}elseif($zvn['alians'] == $res['join1']) {
-				//����� � ������������� � �����
-				$szu = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$zvn['alians'].'" LIMIT 1'));
-				$zvy = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$zvn['clan'].'" LIMIT 1'));
-				$rzv = '���� <b>'.$szu['name'].'</b> ������� ����� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$zvy['name_mini'].'.gif">'.$zvy['name'].'</b> � �������������.';
-			}elseif($zvn['alians'] == $res['join2']) {
-				//����� � ������������� � �������
-				$szu = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$zvn['alians'].'" LIMIT 1'));
-				$zvy = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$zvn['clan'].'" LIMIT 1'));
-				$rzv = '������ <b>'.$szu['name'].'</b> ������� ����� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$zvy['name_mini'].'.gif">'.$zvy['name'].'</b> � �������������.';
-			}
-			if($rzv != '') {
-				echo '<font color="#FF0000"><b>'.$rzv.'</b></font><br>';
-				mysql_query('UPDATE `clan_join` SET `time_end` = "'.time().'" WHERE `id` = "'.$zvn['id'].'"');
-			}
-		 }
-	  }elseif(isset($_GET['ok']) && $tt[13][0] == 1) {
-		 $zvn = mysql_fetch_array(mysql_query('SELECT * FROM `clan_join` WHERE `id` = "'.mysql_real_escape_string($_GET['ok']).'" AND `time_start` = "0" AND `time_end` = "0" LIMIT 1')); 
-		 if(!isset($zvn['id'])) {
-			 echo '<font color="#FF0000"><b>������ �� ���������� �� �������</b></font><br>';
-		 }else{
-			 $rzv = '';
-			if($zvn['alians'] == $res['join1']) {
-				//������������� � �����
-				$szu = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$zvn['alians'].'" LIMIT 1'));
-				$zvy = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$zvn['clan'].'" LIMIT 1'));
-				$rzv = '���� <b>'.$szu['name'].'</b> ������ ���� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$zvy['name_mini'].'.gif">'.$zvy['name'].'</b>.';
-				mysql_query('UPDATE `clan_join` SET `time_end` = "'.time().'" WHERE `id` != "'.$zvn['id'].'" AND `clan` = "'.$szu['clan'].'" AND `type` = "1"');
-				//mysql_query('INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`) VALUES ("'.$res['id'].'","'.$szu['id'].'","'.time().'","1")');
-				mysql_query('UPDATE `clan` SET `join1` = "'.$zvn['alians'].'" WHERE `id` = "'.$szu['id'].'"');
-			}elseif($zvn['alians'] == $res['join2']) {
-				//������������� � �������
-				$szu = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$zvn['alians'].'" LIMIT 1'));
-				$zvy = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$zvn['clan'].'" LIMIT 1'));
-				$rzv = '������ <b>'.$szu['name'].'</b> ������ ���� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$zvy['name_mini'].'.gif">'.$zvy['name'].'</b>.';
-				mysql_query('UPDATE `clan_join` SET `time_end` = "'.time().'" WHERE `id` != "'.$zvn['id'].'" AND `clan` = "'.$szu['clan'].'" AND `type` = "2" AND `time_end` = "0"');
-				//mysql_query('INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`) VALUES ("'.$res['id'].'","'.$szu['id'].'","'.time().'","2")');
-				mysql_query('UPDATE `clan` SET `join2` = "'.$zvn['alians'].'" WHERE `id` = "'.$szu['id'].'"');
-			}
-			if($rzv != '') {
-				echo '<font color="#FF0000"><b>'.$rzv.'</b></font><br>';
-				mysql_query('UPDATE `clan_join` SET `time_start` = "'.time().'" WHERE `id` = "'.$zvn['id'].'"');
-			}
-		 }
-	  }
-	  ?>
-      <? if($res['join1'] == 0 && $res['level'] > 0) { ?>
-      <input type="submit" name="button" id="button" value="������� ����" onClick="openMod('<b>������� ����</b>','<form action=\'main.php?clan&diplom&newjoint=1\' method=\'post\'>��������: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');" />
-      <input type="submit" name="button" id="button" value="�������������� � �����" onClick="openMod('<b>�������������� � �����</b>','<form action=\'main.php?clan&diplom&joint=1\' method=\'post\'>��������: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');" />
-      <? }
-	  
-	  if($res['join2'] == 0 && $res['level'] > 0) { ?>
-      <input type="submit" name="button" id="button" value="�������������� � �������" onClick="openMod('<b>�������������� � �������</b>','<form action=\'main.php?clan&diplom&joint=2\' method=\'post\'>��������: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');" />
-      <input type="submit" name="button" id="button" value="������� ������" onClick="openMod('<b>������� ������</b>','<form action=\'main.php?clan&diplom&newjoint=2\' method=\'post\'>��������: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');" />      
-      <br /><br /><? } ?><? } ?>
-      <div style="border:1px solid #CECECE;padding:10px;">
-      	<? 
-		$ms = '';
-		
-		//����������� ����� � �������
-		if($res['join1'] > 0) {
-			$j1 = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$res['join1'].'" LIMIT 1'));
-			if(isset($j1['id'])) {
-				$ms .= '<div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">';
-				$ms .= '�� �������� � �������� ����� <b>'.$j1['name'].'</b>.';
-				if( $j1['clan_glava'] != $res['id'] ) { 
-					$ms .= ' <a href="main.php?clan&diplom&delclanme=1"><img title="�������� ����" width="13" height="13" src="https://img.new-combats.com/i/clear.gif"></a>';
-				}
-				$ms .= '<Br>������ �����: ';
-				//$ms .= '<a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif">'.$res['name'].'</a>';
-				$i = 0;
-				if( isset($_GET['delclanme']) ) {
-					if( $j1['clan_glava'] != $res['id'] && ($u->info['clan_prava'] == 'glava' || $u->info['admin'] > 0) ) { 
-						$dels = mysql_fetch_array(mysql_query('SELECT * FROM `clan_join` WHERE `clan` = "'.$res['id'].'" AND `alians` = "'.$j1['id'].'" AND `time_end` = "0" AND `time_start` > 0 LIMIT 1'));
-						if(isset($dels['id'])) {
-							mysql_query('UPDATE `clan` SET `join1` = "0" WHERE `id` = "'.$res['id'].'" LIMIT 1');
-							mysql_query('UPDATE `clan_join` SET `time_end` = "'.time().'" WHERE `id` = "'.$dels['id'].'" LIMIT 1');
-							echo '<div><b><font color=red>�� ������� �������� ���� &quot;'.$j1['name'].'&quot;</font></b></div>';
-							header('location: main.php?clan&diplom');
-						}else{
-							echo '<div><b><font color=red>��� ���� �� ������� � ������ �����</font></b></div>';
-						
-						}
-					}else{
-						echo '<div><b><font color=red>�� �� ������ �������� ������ ����</font></b></div>';
-					}
-				}elseif( $j1['clan_glava'] == $res['id'] && ($u->info['clan_prava'] == 'glava' || $u->info['admin'] > 0) ) {
-					if( isset($_GET['delclan']) ) {
-						$delc = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.mysql_real_escape_string($_GET['delclan']).'" LIMIT 1'));
-						$dels = mysql_fetch_array(mysql_query('SELECT * FROM `clan_join` WHERE `clan` = "'.$delc['id'].'" AND `alians` = "'.$j1['id'].'" AND `time_end` = "0" AND `time_start` > 0 LIMIT 1'));
-						
-						if( isset($delc['id']) && isset($dels['id']) ) {
-							if( $delc['id'] != $res['id'] ) {
-								mysql_query('UPDATE `clan` SET `join1` = "0" WHERE `id` = "'.$dels['id'].'" LIMIT 1');
-								mysql_query('UPDATE `clan_join` SET `time_end` = "'.time().'" WHERE `id` = "'.$dels['id'].'" LIMIT 1');
-								echo '<div><b><font color=red>���� &quot;'.$delc['name'].'&quot; ��� �������� �� ������� �����</font></b></div>';
-								header('location: main.php?clan&diplom');
-							}else{
-								echo '<div><b><font color=red>���� ������������� �� ���� �� ����� �������� ������ ����</font></b></div>';
-							}
-						}else{
-							echo '<div><b><font color=red>���� �� ������� � ������ �����</font></b></div>';
-						}
-					}
-				}
-				$sp1 = mysql_query('SELECT `u`.*,`s`.* FROM `clan_join` AS `u` LEFT JOIN `clan` AS `s` ON `s`.`id` = `u`.`clan` WHERE `u`.`alians` = "'.$j1['id'].'" AND `u`.`time_end` = "0" AND `u`.`time_start` > 0');
-				while($pl1 = mysql_fetch_array($sp1)) {
-					if($i > 0) {
-						$ms .= ',';
-					}
-					$ms .= ' <a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$pl1['name_mini'].'.gif">'.$pl1['name'].'</a>';
-					if( $j1['clan_glava'] == $res['id'] ) {
-						if($res['id'] != $pl1['clan']) { 
-							if($u->info['clan_prava'] == 'glava' || $u->info['admin'] > 0) {
-								$ms .= ' <a title="������� �� �����" href="main.php?clan&diplom&delclan='.$pl1['clan'].'"><img width="13" height="13" src="https://img.new-combats.com/i/clear.gif"></a>';
-							}
-						}
-					}
-					$i++;
-				}
-				if( $j1['clan_glava'] == $res['id'] && ($u->info['clan_prava'] == 'glava' || $u->info['admin'] > 0) ) {
-					$ms .= '<br>�� ���������� �����, ������ ���������� ������ ����� ����:<br>';
-					$cnls = '<i>���������</i>';
-					//$ms .= '<form method="post" action="?clan&diplom&savecanals='.$res['id'].'"><a style="display:inline-block;width:210px;" href="javascript:void(0)"><img src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif">'.$res['name'].'</a> &nbsp; '.$cnls.' &nbsp; <input type="submit" value="���������"></form>';
-					$sp1 = mysql_query('SELECT `u`.*,`s`.* FROM `clan_join` AS `u` LEFT JOIN `clan` AS `s` ON `s`.`id` = `u`.`clan` WHERE `u`.`alians` = "'.$j1['id'].'" AND `u`.`time_end` = "0" AND `u`.`time_start` > 0');
-					while($pl1 = mysql_fetch_array($sp1)) {
-						$ms .= '<form method="post" action="?clan&diplom&savecanals='.$pl1['id'].'"><a style="display:inline-block;width:210px;" href="javascript:void(0)"><img src="https://img.new-combats.com/i/clan/'.$pl1['name_mini'].'.gif">'.$pl1['name'].'</a> &nbsp; '.$cnls.' &nbsp; <input type="submit" value="���������"></form>';
-					}
-				}
-				//����������� �������� ������ �����
-				
-				$ms .= '</div>';
-			}
-		}
-		if($res['join2'] > 0) {
-			$j1 = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$res['join2'].'" LIMIT 1'));
-			if(isset($j1['id'])) {
-				$ms .= '<div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">';
-				$ms .= '�� �������� � �������� ������� <b>'.$j1['name'].'</b>. ������ �������: ';
-				//$ms .= '<a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif">'.$res['name'].'</a>';
-				$sp1 = mysql_query('SELECT `u`.*,`s`.* FROM `clan_join` AS `u` LEFT JOIN `clan` AS `s` ON `s`.`id` = `u`.`clan` WHERE `u`.`alians` = "'.$j1['id'].'" AND `u`.`time_end` = "0" AND `u`.`time_start` > 0');
-				$i = 0;
-				while($pl1 = mysql_fetch_array($sp1)) {
-					if($i > 0) {
-						$ms .= ', ';	
-					}
-					$ms .= '<a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$pl1['name_mini'].'.gif">'.$pl1['name'].'</a>';
-					$i++;
-				}
-				$ms .= '<br>�� ���������� �������.<br>';				
-				$ms .= '</div>';
-			}
-		}
-		
-		//����� � ������� � ������� ������� ����
-		
-		
-		if($ms == '') {
-		?>
-        <center>� ������ ������ � ������ ����� ��� ��������������� ���������.</center>
-        <? }else{ echo $ms; } ?>
-      </div>
-      <? if($tt[13][0] == 1) { ?>
-      <br />
-      <center>������ �� �����</center>
-      <br />
-      <table width="100%" border="0" cellspacing="0" cellpadding="2">
-        <tr>
-          <td width="50%" align="center" valign="top">
-          	<div style="border:1px solid #CECECE;padding:10px;">
-            	<a href="javascript:void(0)">���� ������ �� ������������ �����</a>
-                <br />
-                <br />
-                <?
-				$ms = '';
-				$sp = mysql_query('SELECT * FROM `clan_join` WHERE `clan` = "'.mysql_real_escape_string($res['id']).'" AND `time_start` = "0" AND `time_end` = "0" AND `type` = "1"');
-				while($pl = mysql_fetch_array($sp)) {
-					$suz = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$pl['alians'].'" LIMIT 1'));
-					$ms .= '<div style="border-bottom:1px solid #cac9c7;text-align:left;margin-bottom:5px;padding-bottom:5px;">�� ������ ������ �� ���������� � ���� <b>'.$suz['name'].'</b>.<br><div style="float:left;">����� ������ ������: '.date('d.m.Y H:i',$pl['time']).'</div><a style="float:right;" href="?clan&diplom&cancel='.$pl['id'].'">��������</a><br></div>';
-				}
-				if($ms == '') {
-				?>
-                � ���� ����� �� ������� ������
-                <? }else{ echo $ms; } ?>
-            </div>
-          </td>
-          <td align="center" valign="top">
-          	<div style="border:1px solid #CECECE;padding:10px;">
-            	<a href="javascript:void(0)">������ �� ������������ ����� � ����</a>
-                <br />
-                <br />
-                <?
-				$ms = '';
-				$sp = mysql_query('SELECT * FROM `clan_join` WHERE `alians` = "'.mysql_real_escape_string($res['join1']).'" AND `time_start` = "0" AND `time_end` = "0" AND `type` = "1"');
-				while($pl = mysql_fetch_array($sp)) {
-					$suz = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$pl['alians'].'" LIMIT 1'));
-					$clz = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$pl['clan'].'" LIMIT 1'));
-					$ms .= '<div style="border-bottom:1px solid #cac9c7;text-align:left;margin-bottom:5px;padding-bottom:5px;">���� <a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$clz['name_mini'].'.gif">'.$clz['name'].'</a> ����� ������ �� ���������� � ��� ���� <b>'.$suz['name'].'</b>.<br><div style="float:left;">����� ������ ������: '.date('d.m.Y H:i',$pl['time']).'</div><div style="float:right;"><a href="?clan&diplom&ok='.$pl['id'].'">�������</a> &nbsp; <a href="?clan&diplom&cancel='.$pl['id'].'">��������</a></div><br></div>';
-				}
-				if($ms == '') {
-				?>
-                � ���� ����� �� ������� ������
-                <? }else{ echo $ms; } ?>
-            </div>
-          </td>
-        </tr>
-      </table>
-    <br />
-    <center>������ �� �������</center>     
-    <br />
-    <table width="100%" border="0" cellspacing="0" cellpadding="2">
-        <tr>
-          <td width="50%" align="center" valign="top">
-          	<div style="border:1px solid #CECECE;padding:10px;">
-            	<a href="javascript:void(0)">���� ������ �� ������������ �������</a>
-                <br />
-                <br />
-                <?
-				$ms = '';
-				$sp = mysql_query('SELECT * FROM `clan_join` WHERE `clan` = "'.mysql_real_escape_string($res['id']).'" AND `time_start` = "0" AND `time_end` = "0" AND `type` = "2"');
-				while($pl = mysql_fetch_array($sp)) {
-					$suz = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$pl['alians'].'" LIMIT 1'));
-					$ms .= '<div style="border-bottom:1px solid #cac9c7;text-align:left;margin-bottom:5px;padding-bottom:5px;">�� ������ ������ �� ���������� � ������ <b>'.$suz['name'].'</b>.<br><div style="float:left;">����� ������ ������: '.date('d.m.Y H:i',$pl['time']).'</div><a style="float:right;" href="?clan&diplom&cancel='.$pl['id'].'">��������</a><br></div>';
-				}
-				if($ms == '') {
-				?>
-                � ���� ����� �� ������� ������
-                <? }else{ echo $ms; } ?>
-            </div>
-          </td>
-          <td align="center" valign="top">
-          	<div style="border:1px solid #CECECE;padding:10px;">
-            	<a href="javascript:void(0)">������ �� ������������ ������� � ����</a>
-                <br />
-                <br />
-                <?
-				$ms = '';
-				$sp = mysql_query('SELECT * FROM `clan_join` WHERE `alians` = "'.mysql_real_escape_string($res['join2']).'" AND `time_start` = "0" AND `time_end` = "0" AND `type` = "2"');
-				while($pl = mysql_fetch_array($sp)) {
-					$suz = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$pl['alians'].'" LIMIT 1'));
-					$clz = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$pl['clan'].'" LIMIT 1'));
-					$ms .= '<div style="border-bottom:1px solid #cac9c7;text-align:left;margin-bottom:5px;padding-bottom:5px;">���� <a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$clz['name_mini'].'.gif">'.$clz['name'].'</a> ����� ������ �� ���������� � ��� ������ <b>'.$suz['name'].'</b>.<br><div style="float:left;">����� ������ ������: '.date('d.m.Y H:i',$pl['time']).'</div><div style="float:right;"><a href="?clan&diplom&ok='.$pl['id'].'">�������</a> &nbsp; <a href="?clan&diplom&cancel='.$pl['id'].'">��������</a></div><br></div>';
-				}
-				if($ms == '') {
-				?>
-                � ���� ����� �� ������� ������
-                <? }else{ echo $ms; } ?>
-            </div>
-          </td>
-        </tr>
-    </table>
-	<? } ?>
-    </fieldset>    
-   <? } elseif(isset($_GET['deposit'])) {
-	
-	$itmc = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `items_users` WHERE `uid` = "-21'.$res['id'].'" AND `delete` = 0 LIMIT 1'));
-	$itmc = $itmc[0];
-	$itms = mysql_fetch_array(mysql_query('SELECT `iu`.*,`im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` >= 0 AND `iu`.`delete` = "0"
-		AND `iu`.`id` = "'.mysql_real_escape_string($_GET['ungive_itm']).'" LIMIT 1'));
-	$ps = $u->lookStats($itms['data']);
-	$ps['cl'] = explode('#', $ps['toclan']);
-	$use_s = $ps['cl'][1];
-	if(isset($_GET['ungive_itm']) && $ps['cl'][0] == $res['id'] && ($tt[14][0] == 1 || ($u->info['id'] == $use_s))) {
-		$itm = mysql_fetch_array(mysql_query('SELECT `iu`.*,`im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` >= 0 AND `iu`.`delete` = "0"
-		AND `iu`.`id` = "'.mysql_real_escape_string($_GET['ungive_itm']).'" LIMIT 1'));
-		if(isset($itm['id'])) {
-			$btlud = mysql_fetch_array(mysql_query('SELECT `id`,`battle` FROM `users` WHERE `id` = "'.$itm['uid'].'" LIMIT 1'));
-			if( $u->testBattle($btlud['battle']) == true ) {
-				echo '<font color="#FF0000"><b>������ ������� �������� � ��������� � ���</b></font><br>';
-			}else{
-			 	echo $u->ungive_itm_cl($_GET['ungive_itm'], $u->info, $res['id']);
-			}
-		}
-	} elseif(isset($_GET['take_itm']) && $tt[4][0] == 1) {
-		$itm = mysql_fetch_array(mysql_query('SELECT `iu`.*,`im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid`="-21'.$res['id'].'" AND `iu`.`delete`="0"
-		AND `iu`.`id` = "'.mysql_real_escape_string($_GET['take_itm']).'" LIMIT 1'));
-		if(isset($itm['id'])) {
-		  echo $u->take_itm_cl($_GET['take_itm'], $u->info, $res['id']);
-	    }
-	} elseif(isset($_GET['give_itm'])) {
-      $itm = mysql_fetch_array(mysql_query('SELECT `iu`.*,`im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `im`.`inslot` > 0 AND `iu`.`gift` = "" AND `iu`.`data` NOT LIKE "%frompisher=%"
-		AND `iu`.`id` = "'.mysql_real_escape_string($_GET['give_itm']).'" LIMIT 1'));
-		if($itmc >= $lvl_prava[$res['level']][5]) {
-			echo '<font color="#FF0000"><b>��������� �����������</b></font><br>';
-		} elseif(isset($itm['id'])) {
-		  echo $u->set_cl_item($_GET['give_itm'], $u->info, $res['id']);
-		}
-	}
-	if($tt[4][0] == 1) {
-		$itm_clan = $u->genInv(66, '(`iu`.`uid` = "-21'.$u->info['clan'].'" OR `iu`.`data` LIKE "%toclan='.$u->info['clan'].'#%") AND `iu`.`delete` = 0 AND `iu`.`inShop` = 0 ORDER BY `lastUPD` DESC');
-	} else {
-		$itm_clan[2] = '<br /><br /><center>� ��� ��� ������� � ������������� ���������</center>';
-	}
-	$itm_user = $u->genInv(65, '`iu`.`uid` = '.$u->info['id'].' AND `iu`.`delete` = 0 AND `iu`.`inOdet` = 0 AND `iu`.`inShop` = 0 AND `im`.`inslot` > 0 AND `iu`.`gift` = "" AND `iu`.`data` NOT LIKE "%frompisher=%" ORDER BY `lastUPD` DESC');
-   
-   ?>
-   <div class="box visible">
-     <table width="100%" border="0" cellspacing="0" cellpadding="0">
-       <tr>
-         <td width="50%" valign="top">
-    <fieldset style="margin:0;padding:0">
-      <legend><span class="legtitle">��������� (��������� : <?=$itmc?>/<?=$lvl_prava[$res['level']][5]?>)</span></legend>
-      <? if($itm_clan[2] != '') { ?>
-      <table border="0" cellspacing="0" cellpadding="0" width="100%">
-	  <?=$itm_clan[2]?>
-      </table>
-      <? }else{ echo '<center><br />��������� ����� �����<br /><br /></center>'; } ?>
-    </fieldset>
-         </td>
-         <td width="50%" valign="top">
-    <fieldset style="margin:0;padding:0">
-      <legend><span class="legtitle">������</span></legend>
-      <? if($itm_user[2] != '') { ?>
-      <table border="0" cellspacing="0" cellpadding="0" width="100%">
-	  <?=$itm_user[2]?>
-      </table>
-      <? }else{ echo '<center><br />������ ����<br /><br /></center>'; } ?>
-    </fieldset>
-         </td>
-       </tr>
-     </table>
-   </div>
-   <? }elseif(isset($_GET['titul']) && $tt[11][0]==1) { ?>
-   <script>
-   function editTitul(id) {
-		if($('#edpnltitul'+id).css('display') == 'none') {
-			$('#edpnltitul'+id).css({'display':''});
-		}else{
-			$('#edpnltitul'+id).css({'display':'none'});
-		}
-   }
-   </script>
-   <div class="box visible">
-        <?
-		if(isset($_POST['tituladd'])) {
-			//��������� ����� �����
-			$tc = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `clan_tituls` WHERE `clan` = "'.$res['id'].'" AND `delete` = "0" LIMIT 25'));
-			if($tc[0] >= 20) {
-				echo '<font color="#FF0000"><b>������ ��������� ����� 25-�� �������, ��� ���������� ������ ������� ������</b></font><br>';
-			}else{
-				$nm = htmlspecialchars($_POST['tituladd'],NULL,'cp1251');
-				if(str_replace(' ','',str_replace('	','',$nm)) == '') {
-					echo '<font color="#FF0000"><b>�������� ������ �� ������ ���� ������</b></font><br>';
-				}else{
-					mysql_query('INSERT INTO `clan_tituls` (`clan`,`user_add`,`time_add`,`name`) VALUES ("'.$res['id'].'","'.$u->info['id'].'","'.time().'","'.mysql_real_escape_string($nm).'")');
-					echo '<font color="#FF0000"><b>����� ��� ������� ��������</b></font><br>';
-				}
-			}
-		}elseif(isset($_GET['save'])) {
-			//��������� �����
-			$tc = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `clan` = "'.$res['id'].'" AND `id` = "'.mysql_real_escape_string($_GET['save']).'" AND `delete` = "0" LIMIT 1'));
-			if(isset($tc['id'])) {
-				$tc['info'] = htmlspecialchars($_POST['t_info'],NULL,'cp1251');
-				$i = 1;
-				$tc['canals'] = '';
-				while($i <= 9) {
-					if($_POST['t_klan'.$i]) {
-						$tc['canals'] .= '1';
-					}else{
-						$tc['canals'] .= '0';
-					}
-					$i++;
-				}
-				$i = 0;
-				$tc['prava'] = '';
-				while($i <= 20) {
-					if($_POST['t_tr'.$i]) {
-						$tc['prava'] .= '1';
-					}else{
-						$tc['prava'] .= '0';
-					}
-					$i++;
-				}
-				$_POST['colorsp'] = preg_replace('/[^a-z�-��0-9]/i','',$_POST['colorsp']);
-				mysql_query('UPDATE `clan_tituls` SET `info` = "'.mysql_real_escape_string($tc['info']).'", `color` = "'.mysql_real_escape_string($_POST['colorsp']).'", `canals` = "'.$tc['canals'].'", `prava` = "'.$tc['prava'].'" WHERE `id` = "'.$tc['id'].'" LIMIT 1');
-				echo '<font color="#FF0000"><b>����� ��� ������� ��������</b></font><br>';
-			}else{
-				echo '<font color="#FF0000"><b>����� �� ������</b></font><br>';
-			}
-		}elseif(isset($_GET['delete'])) {
-			$tc = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `clan` = "'.$res['id'].'" AND `id` = "'.mysql_real_escape_string($_GET['delete']).'" AND `delete` = "0" LIMIT 1'));
-			if(isset($tc['id'])) {
-				mysql_query('UPDATE `clan_tituls` SET `delete` = "'.$u->info['id'].'" WHERE `id` = "'.$tc['id'].'" LIMIT 1');
-				echo '<font color="#FF0000"><b>����� ��� ������</b></font><br>';
-			}else{
-				echo '<font color="#FF0000"><b>����� �� ������</b></font><br>';
-			}
-		}
-?>
-<div id="clrttl" style="display:none">
-<br /><br />
-<center><a onclick="ssclrttl()" href="javascript:void(0)">�������� ������ - ������</a></center>
-<br /><br />
-<table width="100%" cellpadding="10" cellspacing="5">
-  <tbody>
-    <tr>
-      <td>000000</td>
-      <td>000033</td>
-      <td>000066</td>
-      <td>000099</td>
-      <td>0000cc</td>
-      <td>0000ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#000000"></td>
-      <td bgcolor="#000033"></td>
-      <td bgcolor="#000066"></td>
-      <td bgcolor="#000099"></td>
-      <td bgcolor="#0000cc"></td>
-      <td bgcolor="#0000ff"></td>
-    </tr>
-    <tr>
-      <td>003300</td>
-      <td>003333</td>
-      <td>003366</td>
-      <td>003399</td>
-      <td>0033cc</td>
-      <td>0033ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#003300"></td>
-      <td bgcolor="#003333"></td>
-      <td bgcolor="#003366"></td>
-      <td bgcolor="#003399"></td>
-      <td bgcolor="#0033cc"></td>
-      <td bgcolor="#0033ff"></td>
-    </tr>
-    <tr>
-      <td>006600</td>
-      <td>006633</td>
-      <td>006666</td>
-      <td>006699</td>
-      <td>0066cc</td>
-      <td>0066ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#006600"></td>
-      <td bgcolor="#006633"></td>
-      <td bgcolor="#006666"></td>
-      <td bgcolor="#006699"></td>
-      <td bgcolor="#0066cc"></td>
-      <td bgcolor="#0066ff"></td>
-    </tr>
-    <tr>
-      <td>009900</td>
-      <td>009933</td>
-      <td>009966</td>
-      <td>009999</td>
-      <td>0099cc</td>
-      <td>0099ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#009900"></td>
-      <td bgcolor="#009933"></td>
-      <td bgcolor="#009966"></td>
-      <td bgcolor="#009999"></td>
-      <td bgcolor="#0099cc"></td>
-      <td bgcolor="#0099ff"></td>
-    </tr>
-    <tr>
-      <td>00cc00</td>
-      <td>00cc33</td>
-      <td>00cc66</td>
-      <td>00cc99</td>
-      <td>00cccc</td>
-      <td>00ccff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#00cc00"></td>
-      <td bgcolor="#00cc33"></td>
-      <td bgcolor="#00cc66"></td>
-      <td bgcolor="#00cc99"></td>
-      <td bgcolor="#00cccc"></td>
-      <td bgcolor="#00ccff"></td>
-    </tr>
-    <tr>
-      <td>00ff00</td>
-      <td>00ff33</td>
-      <td>00ff66</td>
-      <td>00ff99</td>
-      <td>00ffcc</td>
-      <td>00ffff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#00ff00"></td>
-      <td bgcolor="#00ff33"></td>
-      <td bgcolor="#00ff66"></td>
-      <td bgcolor="#00ff99"></td>
-      <td bgcolor="#00ffcc"></td>
-      <td bgcolor="#00ffff"></td>
-    </tr>
-    <tr>
-      <td>330000</td>
-      <td>330033</td>
-      <td>330066</td>
-      <td>330099</td>
-      <td>3300cc</td>
-      <td>3300ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#330000"></td>
-      <td bgcolor="#330033"></td>
-      <td bgcolor="#330066"></td>
-      <td bgcolor="#330099"></td>
-      <td bgcolor="#3300cc"></td>
-      <td bgcolor="#3300ff"></td>
-    </tr>
-    <tr>
-      <td>333300</td>
-      <td>333333</td>
-      <td>333366</td>
-      <td>333399</td>
-      <td>3333cc</td>
-      <td>3333ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#333300"></td>
-      <td bgcolor="#333333"></td>
-      <td bgcolor="#333366"></td>
-      <td bgcolor="#333399"></td>
-      <td bgcolor="#3333cc"></td>
-      <td bgcolor="#3333ff"></td>
-    </tr>
-    <tr>
-      <td>336600</td>
-      <td>336633</td>
-      <td>336666</td>
-      <td>336699</td>
-      <td>3366cc</td>
-      <td>3366ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#336600"></td>
-      <td bgcolor="#336633"></td>
-      <td bgcolor="#336666"></td>
-      <td bgcolor="#336699"></td>
-      <td bgcolor="#3366cc"></td>
-      <td bgcolor="#3366ff"></td>
-    </tr>
-    <tr>
-      <td>339900</td>
-      <td>339933</td>
-      <td>339966</td>
-      <td>339999</td>
-      <td>3399cc</td>
-      <td>3399ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#339900"></td>
-      <td bgcolor="#339933"></td>
-      <td bgcolor="#339966"></td>
-      <td bgcolor="#339999"></td>
-      <td bgcolor="#3399cc"></td>
-      <td bgcolor="#3399ff"></td>
-    </tr>
-    <tr>
-      <td>33cc00</td>
-      <td>33cc33</td>
-      <td>33cc66</td>
-      <td>33cc99</td>
-      <td>33cccc</td>
-      <td>33ccff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#33cc00"></td>
-      <td bgcolor="#33cc33"></td>
-      <td bgcolor="#33cc66"></td>
-      <td bgcolor="#33cc99"></td>
-      <td bgcolor="#33cccc"></td>
-      <td bgcolor="#33ccff"></td>
-    </tr>
-    <tr>
-      <td>33ff00</td>
-      <td>33ff33</td>
-      <td>33ff66</td>
-      <td>33ff99</td>
-      <td>33ffcc</td>
-      <td>33ffff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#33ff00"></td>
-      <td bgcolor="#33ff33"></td>
-      <td bgcolor="#33ff66"></td>
-      <td bgcolor="#33ff99"></td>
-      <td bgcolor="#33ffcc"></td>
-      <td bgcolor="#33ffff"></td>
-    </tr>
-    <tr>
-      <td>660000</td>
-      <td>660033</td>
-      <td>660066</td>
-      <td>660099</td>
-      <td>6600cc</td>
-      <td>6600ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#660000"></td>
-      <td bgcolor="#660033"></td>
-      <td bgcolor="#660066"></td>
-      <td bgcolor="#660099"></td>
-      <td bgcolor="#6600cc"></td>
-      <td bgcolor="#6600ff"></td>
-    </tr>
-    <tr>
-      <td>663300</td>
-      <td>663333</td>
-      <td>663366</td>
-      <td>663399</td>
-      <td>6633cc</td>
-      <td>6633ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#663300"></td>
-      <td bgcolor="#663333"></td>
-      <td bgcolor="#663366"></td>
-      <td bgcolor="#663399"></td>
-      <td bgcolor="#6633cc"></td>
-      <td bgcolor="#6633ff"></td>
-    </tr>
-    <tr>
-      <td>666600</td>
-      <td>666633</td>
-      <td>666666</td>
-      <td>666699</td>
-      <td>6666cc</td>
-      <td>6666ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#666600"></td>
-      <td bgcolor="#666633"></td>
-      <td bgcolor="#666666"></td>
-      <td bgcolor="#666699"></td>
-      <td bgcolor="#6666cc"></td>
-      <td bgcolor="#6666ff"></td>
-    </tr>
-    <tr>
-      <td>669900</td>
-      <td>669933</td>
-      <td>669966</td>
-      <td>669999</td>
-      <td>6699cc</td>
-      <td>6699ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#669900"></td>
-      <td bgcolor="#669933"></td>
-      <td bgcolor="#669966"></td>
-      <td bgcolor="#669999"></td>
-      <td bgcolor="#6699cc"></td>
-      <td bgcolor="#6699ff"></td>
-    </tr>
-    <tr>
-      <td>66cc00</td>
-      <td>66cc33</td>
-      <td>66cc66</td>
-      <td>66cc99</td>
-      <td>66cccc</td>
-      <td>66ccff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#66cc00"></td>
-      <td bgcolor="#66cc33"></td>
-      <td bgcolor="#66cc66"></td>
-      <td bgcolor="#66cc99"></td>
-      <td bgcolor="#66cccc"></td>
-      <td bgcolor="#66ccff"></td>
-    </tr>
-    <tr>
-      <td>66ff00</td>
-      <td>66ff33</td>
-      <td>66ff66</td>
-      <td>66ff99</td>
-      <td>66ffcc</td>
-      <td>66ffff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#66ff00"></td>
-      <td bgcolor="#66ff33"></td>
-      <td bgcolor="#66ff66"></td>
-      <td bgcolor="#66ff99"></td>
-      <td bgcolor="#66ffcc"></td>
-      <td bgcolor="#66ffff"></td>
-    </tr>
-    <tr>
-      <td>990000</td>
-      <td>990033</td>
-      <td>990066</td>
-      <td>990099</td>
-      <td>9900cc</td>
-      <td>9900ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#990000"></td>
-      <td bgcolor="#990033"></td>
-      <td bgcolor="#990066"></td>
-      <td bgcolor="#990099"></td>
-      <td bgcolor="#9900cc"></td>
-      <td bgcolor="#9900ff"></td>
-    </tr>
-    <tr>
-      <td>993300</td>
-      <td>993333</td>
-      <td>993366</td>
-      <td>993399</td>
-      <td>9933cc</td>
-      <td>9933ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#993300"></td>
-      <td bgcolor="#993333"></td>
-      <td bgcolor="#993366"></td>
-      <td bgcolor="#993399"></td>
-      <td bgcolor="#9933cc"></td>
-      <td bgcolor="#9933ff"></td>
-    </tr>
-    <tr>
-      <td>996600</td>
-      <td>996633</td>
-      <td>996666</td>
-      <td>996699</td>
-      <td>9966cc</td>
-      <td>9966ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#996600"></td>
-      <td bgcolor="#996633"></td>
-      <td bgcolor="#996666"></td>
-      <td bgcolor="#996699"></td>
-      <td bgcolor="#9966cc"></td>
-      <td bgcolor="#9966ff"></td>
-    </tr>
-    <tr>
-      <td>999900</td>
-      <td>999933</td>
-      <td>999966</td>
-      <td>999999</td>
-      <td>9999cc</td>
-      <td>9999ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#999900"></td>
-      <td bgcolor="#999933"></td>
-      <td bgcolor="#999966"></td>
-      <td bgcolor="#999999"></td>
-      <td bgcolor="#9999cc"></td>
-      <td bgcolor="#9999ff"></td>
-    </tr>
-    <tr>
-      <td>99cc00</td>
-      <td>99cc33</td>
-      <td>99cc66</td>
-      <td>99cc99</td>
-      <td>99cccc</td>
-      <td>99ccff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#99cc00"></td>
-      <td bgcolor="#99cc33"></td>
-      <td bgcolor="#99cc66"></td>
-      <td bgcolor="#99cc99"></td>
-      <td bgcolor="#99cccc"></td>
-      <td bgcolor="#99ccff"></td>
-    </tr>
-    <tr>
-      <td>99ff00</td>
-      <td>99ff33</td>
-      <td>99ff66</td>
-      <td>99ff99</td>
-      <td>99ffcc</td>
-      <td>99ffff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#99ff00"></td>
-      <td bgcolor="#99ff33"></td>
-      <td bgcolor="#99ff66"></td>
-      <td bgcolor="#99ff99"></td>
-      <td bgcolor="#99ffcc"></td>
-      <td bgcolor="#99ffff"></td>
-    </tr>
-    <tr>
-      <td>cc0000</td>
-      <td>cc0033</td>
-      <td>cc0066</td>
-      <td>cc0099</td>
-      <td>cc00cc</td>
-      <td>cc00ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#cc0000"></td>
-      <td bgcolor="#cc0033"></td>
-      <td bgcolor="#cc0066"></td>
-      <td bgcolor="#cc0099"></td>
-      <td bgcolor="#cc00cc"></td>
-      <td bgcolor="#cc00ff"></td>
-    </tr>
-    <tr>
-      <td>cc3300</td>
-      <td>cc3333</td>
-      <td>cc3366</td>
-      <td>cc3399</td>
-      <td>cc33cc</td>
-      <td>cc33ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#cc3300"></td>
-      <td bgcolor="#cc3333"></td>
-      <td bgcolor="#cc3366"></td>
-      <td bgcolor="#cc3399"></td>
-      <td bgcolor="#cc33cc"></td>
-      <td bgcolor="#cc33ff"></td>
-    </tr>
-    <tr>
-      <td>cc6600</td>
-      <td>cc6633</td>
-      <td>cc6666</td>
-      <td>cc6699</td>
-      <td>cc66cc</td>
-      <td>cc66ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#cc6600"></td>
-      <td bgcolor="#cc6633"></td>
-      <td bgcolor="#cc6666"></td>
-      <td bgcolor="#cc6699"></td>
-      <td bgcolor="#cc66cc"></td>
-      <td bgcolor="#cc66ff"></td>
-    </tr>
-    <tr>
-      <td>cc9900</td>
-      <td>cc9933</td>
-      <td>cc9966</td>
-      <td>cc9999</td>
-      <td>cc99cc</td>
-      <td>cc99ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#cc9900"></td>
-      <td bgcolor="#cc9933"></td>
-      <td bgcolor="#cc9966"></td>
-      <td bgcolor="#cc9999"></td>
-      <td bgcolor="#cc99cc"></td>
-      <td bgcolor="#cc99ff"></td>
-    </tr>
-    <tr>
-      <td>cccc00</td>
-      <td>cccc33</td>
-      <td>cccc66</td>
-      <td>cccc99</td>
-      <td>cccccc</td>
-      <td>ccccff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#cccc00"></td>
-      <td bgcolor="#cccc33"></td>
-      <td bgcolor="#cccc66"></td>
-      <td bgcolor="#cccc99"></td>
-      <td bgcolor="#cccccc"></td>
-      <td bgcolor="#ccccff"></td>
-    </tr>
-    <tr>
-      <td>ccff00</td>
-      <td>ccff33</td>
-      <td>ccff66</td>
-      <td>ccff99</td>
-      <td>ccffcc</td>
-      <td>ccffff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#ccff00"></td>
-      <td bgcolor="#ccff33"></td>
-      <td bgcolor="#ccff66"></td>
-      <td bgcolor="#ccff99"></td>
-      <td bgcolor="#ccffcc"></td>
-      <td bgcolor="#ccffff"></td>
-    </tr>
-    <tr>
-      <td>ff0000</td>
-      <td>ff0033</td>
-      <td>ff0066</td>
-      <td>ff0099</td>
-      <td>ff00cc</td>
-      <td>ff00ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#ff0000"></td>
-      <td bgcolor="#ff0033"></td>
-      <td bgcolor="#ff0066"></td>
-      <td bgcolor="#ff0099"></td>
-      <td bgcolor="#ff00cc"></td>
-      <td bgcolor="#ff00ff"></td>
-    </tr>
-    <tr>
-      <td>ff3300</td>
-      <td>ff3333</td>
-      <td>ff3366</td>
-      <td>ff3399</td>
-      <td>ff33cc</td>
-      <td>ff33ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#ff3300"></td>
-      <td bgcolor="#ff3333"></td>
-      <td bgcolor="#ff3366"></td>
-      <td bgcolor="#ff3399"></td>
-      <td bgcolor="#ff33cc"></td>
-      <td bgcolor="#ff33ff"></td>
-    </tr>
-    <tr>
-      <td>ff6600</td>
-      <td>ff6633</td>
-      <td>ff6666</td>
-      <td>ff6699</td>
-      <td>ff66cc</td>
-      <td>ff66ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#ff6600"></td>
-      <td bgcolor="#ff6633"></td>
-      <td bgcolor="#ff6666"></td>
-      <td bgcolor="#ff6699"></td>
-      <td bgcolor="#ff66cc"></td>
-      <td bgcolor="#ff66ff"></td>
-    </tr>
-    <tr>
-      <td>ff9900</td>
-      <td>ff9933</td>
-      <td>ff9966</td>
-      <td>ff9999</td>
-      <td>ff99cc</td>
-      <td>ff99ff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#ff9900"></td>
-      <td bgcolor="#ff9933"></td>
-      <td bgcolor="#ff9966"></td>
-      <td bgcolor="#ff9999"></td>
-      <td bgcolor="#ff99cc"></td>
-      <td bgcolor="#ff99ff"></td>
-    </tr>
-    <tr>
-      <td>ffcc00</td>
-      <td>ffcc33</td>
-      <td>ffcc66</td>
-      <td>ffcc99</td>
-      <td>ffcccc</td>
-      <td>ffccff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#ffcc00"></td>
-      <td bgcolor="#ffcc33"></td>
-      <td bgcolor="#ffcc66"></td>
-      <td bgcolor="#ffcc99"></td>
-      <td bgcolor="#ffcccc"></td>
-      <td bgcolor="#ffccff"></td>
-    </tr>
-    <tr>
-      <td>ffff00</td>
-      <td>ffff33</td>
-      <td>ffff66</td>
-      <td>ffff99</td>
-      <td>ffffcc</td>
-      <td>ffffff</td>
-    </tr>
-    <tr>
-      <td bgcolor="#ffff00"></td>
-      <td bgcolor="#ffff33"></td>
-      <td bgcolor="#ffff66"></td>
-      <td bgcolor="#ffff99"></td>
-      <td bgcolor="#ffffcc"></td>
-      <td bgcolor="#ffffff"></td>
-    </tr>
-  </tbody>
-</table>
-</div>
-<script>
-function ssclrttl() {
-	if($('#clrttl').css('display') == 'none') {
-		$('#clrttl').css({'display':''});
-	}else{
-		$('#clrttl').css({'display':'none'});
-	}
-}
-</script>
-<?
-		$i = 0;
-		$sp = mysql_query('SELECT * FROM `clan_tituls` WHERE `clan` = "'.$res['id'].'" AND `delete` = "0" LIMIT 25');
-		while($pl = mysql_fetch_array($sp)) {
-		?>
-		<div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-        
-        <b style="color:#<?=$pl['color']?>">*</b> &nbsp; <a style="display:inline-block;width:250px;" onclick="editTitul(<?=$pl['id']?>)" href="javascript:void(0)"><?=$pl['name']?></a><font color="#999999"><i><?=$pl['info']?></i></font>
-        <img src="https://img.new-combats.com/i/clear.gif" title="������� �����" onclick="location='main.php?clan&titul&delete=<?=$pl['id']?>'" style="float:right;cursor:pointer;">
-        <div id="edpnltitul<?=$pl['id']?>" style="display:none;margin:10px;border:1px solid #9e9e9e;padding:10px;">
-           <form method="post" action="?clan&titul&save=<?=$pl['id']?>">
-           <span style="float:right"><a onclick="editTitul(<?=$pl['id']?>)" href="javascript:void(0)">x</a></span>
-                <center>�������������� ������ <a onclick="editTitul(<?=$pl['id']?>)" href="javascript:void(0)"><?=$pl['name']?></a></center><br>
-                ��������: <input style="width:360px;" value="<?=$pl['info']?>" type="text" name="t_info"><br>
-                <br>
-                ������ ����: 
-                <? $j = 1;
-				while($j <= 9) {
-						if($pl['canals'][$j-1] == 1) {
-							$pl['check'] = 'checked';
-						}else{
-							$pl['check'] = '';
-						}
-				?> 
-                <label for="t_klan<?=$j?>"><?=$j?></label>
-                <input <?=$pl['check']?> type="checkbox" <?=$pl['check2']?> name="t_klan<?=$j?>" id="t_klan<?=$j?>">
-                <? $j++; }
-				echo '<br><br>';
-				$j = 1;
-				while($j < count($tt)) {
-					if($tt[$j][1] != '0') {
-						if($pl['prava'][$j] == 1) {
-							$pl['check'] = 'checked';
-						}else{
-							$pl['check'] = '';
-						}
-						?>
-                <input <?=$pl['check']?> type="checkbox" name="t_tr<?=$j?>" id="t_tr<?=$j?>">
-                <label for="t_tr<?=$j?>"><?=$tt[$j][1]?></label><br>
-                        <?
-					}
-					$j++;
-				}
-				?>
-                <br>
-                ��������: *<br>
-                ����: &nbsp; &nbsp; &nbsp; <div style="cursor:pointer;display:inline-block;width:20px;height:15px;background-color:#<?=$pl['color']?>">&nbsp;</div> #<input name="colorsp" maxlength="6" type="text" value="<?=$pl['color']?>" /><br />
-                <small>(�� ������ ������������� <a onclick="ssclrttl()" href="javascript:void(0)">�������� ������ - ��������/������</a>)</small><br />
-       		 <br><br>
-                <input type="submit" value="���������">
-          </form>
-          </div>
-        </div>
-     <?
-   		$i++;
-		}
+                    }
+                }
+                if ($c_r == '') {
+                    $c_r .= '<br><br><br><br><br><br><br><br><center><b>������� ���� ��� ��� ����� ����� �� ����������� ��� � ��� ������</b></center>';
+                }
 
-		if($i == 0) {
-			echo '� ����� ��� �� ������ ������';
-		}
-		?>
-        <input type="button" onclick="addNewTitul()" value="�������� �����">
-   </div>
-   <? }elseif(isset($_GET['rules'])) { ?>
-   <div  class="box visible">
-    <fieldset style="border:1px dashed #eeeeee">
-      <legend><span class="legtitle">����� ��������� &quot;<?=$u->info['login']?>&quot;</span></legend>
-      <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-      ������ � �����: <b><?
-      
-	  if($u->info['clan_prava'] != 'glava') {
-		echo $u->info['moder_zvanie'];  
-	  }else{
-		echo '<b style="color:#008097">����� �����</b>'; 
-	  }
-	  
-	  ?></b>
-      </div>
-      <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-      �����: <b><?=$utitl['name']?></b> &nbsp; - &nbsp; <font color="#999999"><?=$utitl['info']?></font>
-      </div>
-                <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-                ������ ����: 
-                <? $j = 1;
-				while($j <= 9) {
-					if($utitl['canals'][$j-1] == 1) {
-                		$r .= '<a href="javascript:void(0)">klan-'.$j.'</a>, ';
-					}
-               	 	$j++;
-				}
-				echo rtrim($r,', ');
-				?>
-                </div>              
-                <?
-				$j = 1;
-				while($j < count($tt)) {
-					if($tt[$j][1] != '0') {
-						if($utitl['prava'][$j] == 1) {
-							$utitl['check'] = '��';
-						}else{
-							$utitl['check'] = '���';
-						}
-						?>
-                <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-                <div style="display:inline-block;width:410px;">&bull; <?=$tt[$j][1]?></div><?=$utitl['check']?>
-                </div>
-                        <?
-					}
-					$j++;
-				}
-				?>
-                
-    </fieldset>
-   </div>
-   <? }elseif(isset($_GET['info'])) {
-	  
-	  //���������� ����
-	  $edd = mysql_fetch_array(mysql_query('SELECT SUM(`exp`) FROM `clan_exp` WHERE `clan` = "'.$res['id'].'" AND `dd` = "'.ceil(date('d')).'" AND `mm` = "'.ceil(date('m')).'" AND `yyyy` = "'.ceil(date('Y')).'"'));
-	  $eww = mysql_fetch_array(mysql_query('SELECT SUM(`exp`) FROM `clan_exp` WHERE `clan` = "'.$res['id'].'" AND `ww` = "'.ceil(date('W')).'" AND `yyyy` = "'.ceil(date('Y')).'"'));
-	  $emm = mysql_fetch_array(mysql_query('SELECT SUM(`exp`) FROM `clan_exp` WHERE `clan` = "'.$res['id'].'" AND `mm` = "'.ceil(date('m')).'" AND `yyyy` = "'.ceil(date('Y')).'"'));
-	 
-	  $edd = 0+$edd[0];
-	  $eww = 0+$eww[0];
-	  $emm = 0+$emm[0];	   
-   ?>   
-   <div class="box visible">
-    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-    �������� �����: <img src="https://img.new-combats.com/i/clan/<?=$res['name_mini']?>.gif" style="vertical-align:bottom" width="24" height="15"><a href="javascript:void(0)"><?=$res['name']?></a> (<?=$res['name_mini']?>)
-    </div>
-    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-    ������� �����: <?=$res['level']?>
-    </div>
-    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-    ���� �����: <?=number_format($res['exp'], 0, ",", " ")?> / <?=number_format($lvl_exp[$res['level']+1], 0, ",", " ")?>
-    <div style="width:200px;display:inline-block;border:1px solid #aeaeae">
-    	<div style="width:<?=ceil(($res['exp']-$lvl_exp[$res['level']])/$lvl_exp[$res['level']+1]*200)?>px;display:inline-block;padding-left:4px;padding-right:4px;text-align:right;background-color:#E9F7E8;color:#1B3618">
-        <b><?=ceil(($res['exp']-$lvl_exp[$res['level']])/$lvl_exp[$res['level']+1]*100)?>%</b>
+                ?>
+                <table width="100%" border="0" cellspacing="0" cellpadding="10">
+                    <tr>
+                        <td align="left" valign="top"><?= $c_r ?></td>
+                        <td width="300" align="center" valign="top"><?= $c_c ?></td>
+                    </tr>
+                    <tr>
+                        <td align="right" valign="top"><?= $c_p ?></td>
+                        <td align="left" valign="top">&nbsp;</td>
+                    </tr>
+                </table>
+            </fieldset>
         </div>
-    </div>
-    </div>
-    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-    <table width="500" border="0" cellspacing="0" cellpadding="0">
-      <tr>
-        <td width="220">���������� ��������� �����:</td>
-        <td width="100">&bull; �� �������:</td>
-        <td><b style="color:#0033a1"><?=$edd?></b></td>
-      </tr>
-      <tr>
-        <td>&nbsp;</td>
-        <td>&bull; �� ������:</td>
-        <td><b style="color:#0033a1"><?=$eww?></b></td>
-      </tr>
-      <tr>
-        <td>&nbsp;</td>
-        <td>&bull; �� �����:</td>
-        <td><b style="color:#0033a1"><?=$emm?></b></td>
-      </tr>
-    </table>
-    </div>
-    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
-    <table width="100%" border="0" style="border:1px solid #232323;" cellspacing="0" cellpadding="5">
-  <tr>
-    <td align="center" valign="middle" style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc"><strong>�������</strong></td>
-    <td align="center" valign="middle" style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc"><strong>������</strong></td>
-    <td align="center" valign="middle" style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc"><strong>����</strong></td>
-    <td align="center" valign="middle" style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc"><strong>������� ����</strong></td>
-    <td align="center" valign="middle" style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc"><strong>������</strong></td>
-    <td align="center" valign="middle" style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc"><strong>������� ������</strong></td>
-    <td align="center" valign="middle" style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc"><strong>���������</strong></td>
-    <td align="center" valign="middle" style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc"><strong>������� �� ������</strong></td>
-    <td align="center" valign="middle" style="border-bottom:1px solid #232323;" bgcolor="#cccccc"><strong>������� �����</strong></td>
-  </tr>
-  <?
-  $i = 0;
-  $yn = array('���','��');
-  while($i < count($lvl_prava)) {
-	  $bgclr = '';
-	  if($res['level'] >= $i) {
-		 $bgclr = ' bgcolor="#8fd155"'; 
-	  }
-	  if($i < count($lvl_prava)-1) {
-  ?>
-  <tr<?=$bgclr?>>
-    <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center" valign="middle"><?=$i?></td>
-    <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center" valign="middle"><?=$lvl_prava[$i][0]?></td>
-    <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center" valign="middle"><?=$yn[$lvl_prava[$i][1]]?></td>
-    <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center" valign="middle"><?=$yn[$lvl_prava[$i][2]]?></td>
-    <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center" valign="middle"><?=$yn[$lvl_prava[$i][3]]?></td>
-    <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center" valign="middle"><?=$yn[$lvl_prava[$i][4]]?></td>
-    <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center" valign="middle"><?=$lvl_prava[$i][5]?></td>
-    <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;" align="center" valign="middle"><?=$lvl_prava[$i][6]?></td>
-    <td style="border-bottom:1px solid #232323;" align="center" valign="middle"><?=$lvl_prava[$i][7]?></td>
-  </tr>
-  <?
-	  }else{
-		  
-  ?>
-  <tr<?=$bgclr?>>
-    <td style="border-right:1px solid #232323;" align="center" valign="middle"><?=$i?></td>
-    <td style="border-right:1px solid #232323;" align="center" valign="middle"><?=$lvl_prava[$i][0]?></td>
-    <td style="border-right:1px solid #232323;" align="center" valign="middle"><?=$yn[$lvl_prava[$i][1]]?></td>
-    <td style="border-right:1px solid #232323;" align="center" valign="middle"><?=$yn[$lvl_prava[$i][2]]?></td>
-    <td style="border-right:1px solid #232323;" align="center" valign="middle"><?=$yn[$lvl_prava[$i][3]]?></td>
-    <td style="border-right:1px solid #232323;" align="center" valign="middle"><?=$yn[$lvl_prava[$i][4]]?></td>
-    <td style="border-right:1px solid #232323;" align="center" valign="middle"><?=$lvl_prava[$i][5]?></td>
-    <td style="border-right:1px solid #232323;" align="center" valign="middle"><?=$lvl_prava[$i][6]?></td>
-    <td align="center" valign="middle"><?=$lvl_prava[$i][7]?></td>
-  </tr>
-  <?
-	  }
-  $i++;
-  }
-  ?>
-  </table>
-    </div>
-  </div>
-   <? }elseif(isset($_GET['members'])) { ?>
-   <div  class="box visible">
-    <fieldset style="border:1px dashed #eeeeee">
-      <legend align="center"><span class="legtitle"><img title="��������" onClick="top.chat.addto('klan','private')" style="vertical-align:bottom;cursor:pointer;" src="https://img.new-combats.com/i/lock.gif" width="20" height="15"> ����������</span></legend>
-      <? if(!isset($_GET['online'])) { ?>
-      <input onClick="location='main.php?clan&members&online'" type="button" value="������ online" style="float:right">
-      <? }else{ ?>
-      <input onClick="location='main.php?clan&members'" type="button" value="�������� ����" style="float:right">
-      <? } ?>
-      <br>
-      <?
-	  $sp = mysql_query('SELECT `id`,`battle`,`login`,`clan`,`level`,`room`,`cityreg`,`align`,`clan_prava`,`mod_zvanie`,`sex`,`city`,`online`,`banned` FROM `users` WHERE `clan` = "'.$res['id'].'"');
-	  $r = '<br>'; $j = 0; $i = 0;
-	  if($res['join1'] > 0 || $res['join2'] > 0) {
-		 $r .= '<fieldset style="border:1px dashed #eeeeee;margin-top:5px;">
-      <legend align="left"><span class="legtitle">�������� ������</span></legend>'; 
-	  }
-	  while($pl = mysql_fetch_array($sp)) {
-		  if(!isset($_GET['online']) || $pl['online'] > time()-120) {
-			  $pl['textcolor1'] = '';
-			  if($pl['online'] > time()-120) {
-				 $ico = '<img onClick="top.chat.addto(\''.$pl['login'].'\',\'private\')" src="https://img.new-combats.com/i/lock.gif" width="20" height="15" style="cursor:pointer;vertical-align:bottom">'; 
-				 $j++;
-			  }else{
-				  $pl['textcolor1'] = '#837f82';
-				 $ico = '<img src="https://img.new-combats.com/i/offline.gif" width="20" height="15" style="vertical-align:bottom">'; 
-			  }		  
-			  $zvn = $pl['mod_zvanie'];
-			  $zvn = str_replace('[b]','<b>',$zvn);
-			  $zvn = str_replace('[/b]','</b>',$zvn);
-			  $zvn = str_replace('[i]','<i>',$zvn);
-			  $zvn = str_replace('[/i]','</i>',$zvn);
-			  $zvn = str_replace('[u]','<u>',$zvn);
-			  $zvn = str_replace('[/u]','</u>',$zvn);
-			  $zvn = str_replace('[c=','<font color="',$zvn);
-			  $zvn = str_replace('=]','">',$zvn);
-			  $zvn = str_replace('[/c]','</font>',$zvn);
-			  if($pl['clan_prava'] == 'glava') {
-				 if($zvn == '������' || $zvn == '') {
-					 $zvn = '<b style="color:#008097">����� �����</b>';
-				 }
-				 $zvn = '<img style="vertical-align:top" src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif" width="24" title="����� �����">'.$zvn; 
-			  }
-			  $ttl = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `clan` = "'.$res['id'].'" AND `id` = "'.$pl['clan_prava'].'" LIMIT 1'));
-			  if(isset($ttl['id'])) {
-				 $zvn = '<font color="#'.$ttl['color'].'"><b>'.$ttl['name'].'</b></font> - '.$zvn; 
-			  }
-			  if($pl['online'] > time()-120) {
-				  $rm = mysql_fetch_array(mysql_query('SELECT `id`,`name`,`city` FROM `room` WHERE `id` = "'.$pl['room'].'" LIMIT 1'));
-				  if(isset($rm['id'])) {
-					 $zvn .= ' - <i>'.$rm['name'].'</i>'; 
-				  }
-			  }else{
-				  $zvn .= ' - <i><font color="grey">�������� ������ �� � �����</font></i>';
-			  }
-			  if($pl['battle'] > 0) {
-				$zvn .= ' <a href="logs.php?id='.$pl['battle'].'" target="_blank"><img width="20" height="20" style="vertical-align:bottom"src="https://img.new-combats.com/i/fighttype0.gif" title="������� ��� ��������"></a>';  
-			  }
-			$r .= '<div style="padding:5px;background-color:#efedee"><span style="display:inline-block;width:350px;">'.$ico.' &nbsp;&nbsp; &nbsp; <img src="https://img.new-combats.com/i/align/align'.$pl['align'].'.gif" width="12" height="15" style="vertical-align:bottom"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif" width="24" height="15"><a onClick="top.chat.addto(\''.$pl['login'].'\',\'to\')" style="color:'.$pl['textcolor1'].'" href="javascript:void(0)">'.$pl['login'].'</a><font color="'.$pl['textcolor1'].'">['.$pl['level'].']<a href="https://new-combats.com/info/'.$pl['id'].'" title="���. � '.$pl['login'].'" target="_blank"><img src="https://img.new-combats.com/i/inf_'.$pl['cityreg'].'.gif" width="12" height="11"></a></font></span>'.$zvn.'</div>';
-		  }
-		  $i++;
-	  }
-	  
-	  if($res['join1'] > 0 || $res['join2'] > 0) {
-	  	$r .= '</fieldset>';
-	  }
-	  $nacln = '';	  
-	  if($res['join1'] > 0) {
-	  	$clna = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$res['join1'].'" AND `type` = "1" AND `time_close` = "0" LIMIT 1'));
-		$cn_sp = mysql_query('SELECT * FROM `clan_join` WHERE `alians` = "'.$clna['id'].'" AND `clan` != "'.$res['id'].'" AND `time_end` = "0" AND `time_start` > 0');
-		while($cn_pl = mysql_fetch_array($cn_sp)) {
-			/* ----------------------------------------------------------------------------------------------------------------------------- */
-			  $nacln .= ' AND `clan` != "'.$cn_pl['clan'].'"';
-			  $clnf = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$cn_pl['clan'].'" LIMIT 1'));
-			  $sp = mysql_query('SELECT `id`,`battle`,`login`,`clan`,`level`,`room`,`cityreg`,`align`,`clan_prava`,`mod_zvanie`,`sex`,`city`,`online`,`banned` FROM `users` WHERE `clan` = "'.$cn_pl['clan'].'"');
-			  $r .= '<fieldset style="border:1px dashed #eeeeee;margin-top:5px;">
-      <legend align="left"><span class="legtitle">������ &quot;'.$clna['name'].'&quot;</span></legend>';
-			  $j = 0; $i = 0;
-			  while($pl = mysql_fetch_array($sp)) {
-				  if(!isset($_GET['online']) || $pl['online'] > time()-120) {
-					  $pl['textcolor1'] = '';
-					  if($pl['online'] > time()-120) {
-						 $ico = '<img onClick="top.chat.addto(\''.$pl['login'].'\',\'private\')" src="https://img.new-combats.com/i/lock.gif" width="20" height="15" style="cursor:pointer;vertical-align:bottom">'; 
-						 $j++;
-					  }else{
-						  $pl['textcolor1'] = '#837f82';
-						 $ico = '<img src="https://img.new-combats.com/i/offline.gif" width="20" height="15" style="vertical-align:bottom">'; 
-					  }		  
-					  $zvn = $pl['mod_zvanie'];
-					  $zvn = str_replace('[b]','<b>',$zvn);
-					  $zvn = str_replace('[/b]','</b>',$zvn);
-					  $zvn = str_replace('[i]','<i>',$zvn);
-					  $zvn = str_replace('[/i]','</i>',$zvn);
-					  $zvn = str_replace('[u]','<u>',$zvn);
-					  $zvn = str_replace('[/u]','</u>',$zvn);
-					  $zvn = str_replace('[c=','<font color="',$zvn);
-					  $zvn = str_replace('=]','">',$zvn);
-					  $zvn = str_replace('[/c]','</font>',$zvn);
-					  if($pl['clan_prava'] == 'glava') {
-						 if($zvn == '������' || $zvn == '') {
-							 $zvn = '<b style="color:#008097">����� �����</b>';
-						 }
-						 $zvn = '<img style="vertical-align:top" src="https://img.new-combats.com/i/clan/'.$clnf['name_mini'].'.gif" width="24" title="����� �����">'.$zvn; 
-					  }
-					  $ttl = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `clan` = "'.$clnf['id'].'" AND `id` = "'.$pl['clan_prava'].'" LIMIT 1'));
-					  if(isset($ttl['id'])) {
-						 $zvn = '<font color="#'.$ttl['color'].'"><b>'.$ttl['name'].'</b></font> - '.$zvn; 
-					  }
-					  if($pl['online'] > time()-120) {
-						  $rm = mysql_fetch_array(mysql_query('SELECT `id`,`name`,`city` FROM `room` WHERE `id` = "'.$pl['room'].'" LIMIT 1'));
-						  if(isset($rm['id'])) {
-							 $zvn .= ' - <i>'.$rm['name'].'</i>'; 
-						  }
-					  }else{
-						  $zvn .= ' - <i><font color="grey">�������� ������ �� � �����</font></i>';
-					  }
-					  if($pl['battle'] > 0) {
-						$zvn .= ' <a href="logs.php?id='.$pl['battle'].'" target="_blank"><img width="20" height="20" style="vertical-align:bottom"src="https://img.new-combats.com/i/fighttype0.gif" title="������� ��� ��������"></a>';  
-					  }
-					$r .= '<div style="padding:5px;background-color:#efedee"><span style="display:inline-block;width:350px;">'.$ico.' &nbsp;&nbsp; &nbsp; <img src="https://img.new-combats.com/i/align/align'.$pl['align'].'.gif" width="12" height="15" style="vertical-align:bottom"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$clnf['name_mini'].'.gif" width="24" height="15"><a onClick="top.chat.addto(\''.$pl['login'].'\',\'to\')" style="color:'.$pl['textcolor1'].'" href="javascript:void(0)">'.$pl['login'].'</a><font color="'.$pl['textcolor1'].'">['.$pl['level'].']<a href="https://new-combats.com/info/'.$pl['id'].'" title="���. � '.$pl['login'].'" target="_blank"><img src="https://img.new-combats.com/i/inf_'.$pl['cityreg'].'.gif" width="12" height="11"></a></font></span>'.$zvn.'</div>';
-				  }
-				  $i++;
-			  }
-			  $r .= '</fieldset>';
-			/* ----------------------------------------------------------------------------------------------------------------------------- */
-		}
-	  }
-	  if($res['join2'] > 0) {
-	  	$cn_sp0 = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$res['join2'].'" AND `type` = "2" AND `time_close` = "0" LIMIT 1'));
-		$cn_sp = mysql_query('SELECT * FROM `clan_join` WHERE `alians` = "'.$cn_sp0['id'].'" AND `clan` != "'.$res['id'].'"'.$nacln.' AND `time_end` = "0" AND `time_start` > 0');
-		while($cn_pl = mysql_fetch_array($cn_sp)) {
-			/* ----------------------------------------------------------------------------------------------------------------------------- */
-			  $clnf = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$cn_pl['clan'].'" LIMIT 1'));
-			  $clna = mysql_fetch_array(mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "'.$res['join2'].'" LIMIT 1'));
-			  $sp = mysql_query('SELECT `id`,`battle`,`login`,`clan`,`level`,`room`,`cityreg`,`align`,`clan_prava`,`mod_zvanie`,`sex`,`city`,`online`,`banned` FROM `users` WHERE `clan` = "'.$cn_pl['clan'].'"');
-			  $r .= '<fieldset style="border:1px dashed #eeeeee;margin-top:5px;">
-      <legend align="left"><span class="legtitle">������ &quot;'.$clna['name'].'&quot;</span></legend>';
-			  $j = 0; $i = 0;
-			  while($pl = mysql_fetch_array($sp)) {
-				  if(!isset($_GET['online']) || $pl['online'] > time()-120) {
-					  $pl['textcolor1'] = '';
-					  if($pl['online'] > time()-120) {
-						 $ico = '<img onClick="top.chat.addto(\''.$pl['login'].'\',\'private\')" src="https://img.new-combats.com/i/lock.gif" width="20" height="15" style="cursor:pointer;vertical-align:bottom">'; 
-						 $j++;
-					  }else{
-						  $pl['textcolor1'] = '#837f82';
-						 $ico = '<img src="https://img.new-combats.com/i/offline.gif" width="20" height="15" style="vertical-align:bottom">'; 
-					  }		  
-					  $zvn = $pl['mod_zvanie'];
-					  $zvn = str_replace('[b]','<b>',$zvn);
-					  $zvn = str_replace('[/b]','</b>',$zvn);
-					  $zvn = str_replace('[i]','<i>',$zvn);
-					  $zvn = str_replace('[/i]','</i>',$zvn);
-					  $zvn = str_replace('[u]','<u>',$zvn);
-					  $zvn = str_replace('[/u]','</u>',$zvn);
-					  $zvn = str_replace('[c=','<font color="',$zvn);
-					  $zvn = str_replace('=]','">',$zvn);
-					  $zvn = str_replace('[/c]','</font>',$zvn);
-					  if($pl['clan_prava'] == 'glava') {
-						 if($zvn == '������' || $zvn == '') {
-							 $zvn = '<b style="color:#008097">����� �����</b>';
-						 }
-						 $zvn = '<img style="vertical-align:top" src="https://img.new-combats.com/i/clan/'.$clnf['name_mini'].'.gif" width="24" title="����� �����">'.$zvn; 
-					  }
-					  $ttl = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `clan` = "'.$clnf['id'].'" AND `id` = "'.$pl['clan_prava'].'" LIMIT 1'));
-					  if(isset($ttl['id'])) {
-						 $zvn = '<font color="#'.$ttl['color'].'"><b>'.$ttl['name'].'</b></font> - '.$zvn; 
-					  }
-					  if($pl['online'] > time()-120) {
-						  $rm = mysql_fetch_array(mysql_query('SELECT `id`,`name`,`city` FROM `room` WHERE `id` = "'.$pl['room'].'" LIMIT 1'));
-						  if(isset($rm['id'])) {
-							 $zvn .= ' - <i>'.$rm['name'].'</i>'; 
-						  }
-					  }else{
-						  $zvn .= ' - <i><font color="grey">�������� ������ �� � �����</font></i>';
-					  }
-					  if($pl['battle'] > 0) {
-						$zvn .= ' <a href="logs.php?id='.$pl['battle'].'" target="_blank"><img width="20" height="20" style="vertical-align:bottom"src="https://img.new-combats.com/i/fighttype0.gif" title="������� ��� ��������"></a>';  
-					  }
-					$r .= '<div style="padding:5px;background-color:#efedee"><span style="display:inline-block;width:350px;">'.$ico.' &nbsp;&nbsp; &nbsp; <img src="https://img.new-combats.com/i/align/align'.$pl['align'].'.gif" width="12" height="15" style="vertical-align:bottom"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$clnf['name_mini'].'.gif" width="24" height="15"><a onClick="top.chat.addto(\''.$pl['login'].'\',\'to\')" style="color:'.$pl['textcolor1'].'" href="javascript:void(0)">'.$pl['login'].'</a><font color="'.$pl['textcolor1'].'">['.$pl['level'].']<a href="https://new-combats.com/info/'.$pl['id'].'" title="���. � '.$pl['login'].'" target="_blank"><img src="https://img.new-combats.com/i/inf_'.$pl['cityreg'].'.gif" width="12" height="11"></a></font></span>'.$zvn.'</div>';
-				  }
-				  $i++;
-			  }
-			  $r .= '</fieldset>';
-			/* ----------------------------------------------------------------------------------------------------------------------------- */
-		}
-	  }
-	  
-	  $r .= '<br>Online: <a href="main.php?clan&members&online">'.$j.'</a><br>�����: <a href="main.php?clan&members">'.$i.'</a><br><small>(������ ����������� <s>� �������</s>)</small>';
-	  echo $r;
-	  ?>
-    </fieldset>
-   </div>
-  <? } ?>
+    <? }elseif (isset($_GET['control'])) { ?>
+        <script>
+            function changeLogin(selObj) {
+                selid = selObj.options[selObj.selectedIndex].value;
+                $('#sn_titul').val($('#slg' + selid).attr('vtitul'));
+                $('#sn_zvanie').val($('#slg' + selid).attr('vzvanie'));
+                $('#sn_canals').val($('#slg' + selid).attr('vcanals'));
+
+                if ($('#slg' + selid).attr('vtitul') == '����� �����') {
+                    $('#rp_titul').attr({'disabled': 'disabled'});
+                    $('#sn_zvanie').attr({'disabled': 'disabled'});
+                    $('#sn_canals').attr({'disabled': 'disabled'});
+                    $('#rp_save').attr({'disabled': 'disabled'});
+                } else {
+                    $('#rp_titul').attr({'disabled': false});
+                    $('#sn_zvanie').attr({'disabled': false});
+                    $('#sn_canals').attr({'disabled': false});
+                    $('#rp_save').attr({'disabled': false});
+                }
+            }
+        </script>
+        <div class="box visible">
+            <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                ��� ���������� ������: <a
+                        href="javascript:void(0)"><? if ($res['politic'] == 1) { ?>���������<? } else { ?>����������<? } ?></a>
+            </div>
+            <?
+            $c_pr = [
+                100, //�������
+                50, //�������
+                100 //������� �����
+            ];
+
+            if (isset($_POST['svb_canals']) && $tt[11][0] == 1) {
+                echo '<font color="#FF0000"><b>������ ���� ���������</b></font><br>';
+                $res['canals'] = $_POST['svb_canals'];
+                $rce = explode();
+                $i = 1;
+                while ($i <= 9) {
+
+                    $i++;
+                }
+                mysql_query(
+                    'UPDATE `clan` SET `canals` = "' . mysql_real_escape_string(
+                        $res['canals']
+                    ) . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                );
+            } elseif (isset($_POST['svb_give_money']) && $tt[7][0] == 1) {
+                $mn = round((int)$_POST['svb_give_money'], 2);
+                if ($mn >= 0.01) {
+                    if ($res['money1'] < $mn) {
+                        echo '<font color="#FF0000"><b>� ����� ������������ �������</b></font><br>';
+                    } else {
+                        $res['money1'] -= $mn;
+                        $u->info['money'] += $mn;
+                        echo '<font color="#FF0000"><b>�� ������� ����� � ����� ����� ' . $mn . ' ��.</b></font><br>';
+                        mysql_query(
+                            'UPDATE `clan` SET `money1` = "' . mysql_real_escape_string(
+                                $res['money1']
+                            ) . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                        );
+                        mysql_query(
+                            'UPDATE `users` SET `money` = "' . mysql_real_escape_string(
+                                $u->info['money']
+                            ) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+                        );
+                        mysql_query(
+                            'INSERT INTO `clan_operations` (`clan`,`time`,`type`,`text`,`val`,`uid`) VALUES ("' . $res['id'] . '","' . time(
+                            ) . '","1","' . $u->info['login'] . '","' . mysql_real_escape_string(
+                                $mn
+                            ) . '","' . $u->info['id'] . '")'
+                        );
+                    }
+                }
+            } elseif (isset($_POST['svb_take_money']) && $tt[6][0] == 1) {
+                $mn = round((int)$_POST['svb_take_money'], 2);
+                if ($mn >= 0.01) {
+                    if ($u->info['money'] < $mn) {
+                        echo '<font color="#FF0000"><b>� ��� ������������ �������</b></font><br>';
+                    } else {
+                        $res['money1'] += $mn;
+                        $u->info['money'] -= $mn;
+                        echo '<font color="#FF0000"><b>�� ������� �������� � ����� ����� ' . $mn . ' ��.</b></font><br>';
+                        mysql_query(
+                            'UPDATE `clan` SET `money1` = "' . mysql_real_escape_string(
+                                $res['money1']
+                            ) . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                        );
+                        mysql_query(
+                            'UPDATE `users` SET `money` = "' . mysql_real_escape_string(
+                                $u->info['money']
+                            ) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+                        );
+                        mysql_query(
+                            'INSERT INTO `clan_operations` (`clan`,`time`,`type`,`text`,`val`,`uid`) VALUES ("' . $res['id'] . '","' . time(
+                            ) . '","2","' . $u->info['login'] . '","' . mysql_real_escape_string(
+                                $mn
+                            ) . '","' . $u->info['id'] . '")'
+                        );
+                    }
+                }
+            } elseif (isset($_POST['invite']) && ($_POST['invite'] == '�������' || $_POST['invite'] == '�������' || $_POST['invite'] == '���������') && $tt[11][0] == 1) {
+                if ($_POST['invite'] == "�������" && $tt[10][0] == 1) {
+                    $usr = mysql_fetch_array(
+                        mysql_query(
+                            'SELECT * FROM `users` WHERE `login` = "' . mysql_real_escape_string(
+                                $_POST['logingo']
+                            ) . '" AND `clan` = "' . $res['id'] . '" LIMIT 1'
+                        )
+                    );
+                    //$ttus = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = "'.$usr['clan_prava'].'" LIMIT 1'));
+                    if (!isset($usr['id'])) {
+                        echo '<font color="#FF0000"><b>����� �� ������ � �����</b></font><br>';
+                    } elseif ($tt['prioritet'] >= $utitl['prioritet']) {
+                        echo '<font color="#FF0000"><b>����� ������ ��� �� ������, ���� ������ ���������</b></font><br>';
+                    } elseif ($u->info['money'] < $c_pr[1]) {
+                        echo '<font color="#FF0000"><b>� ��� �� ���������� ��. ��� ���������� ������ �� ����� (���������: ' . $c_pr[1] . ' ��.)</b></font><br>';
+                    } elseif ($usr['clan_prava'] == 'galva' && $u->info['clan_prava'] != 'glava') {
+                        echo '<font color="#FF0000"><b>����� ������ ��� �� ������, ���� ������ ���������</b></font><br>';
+                    } else {
+                        $ar = $u->rem_itm_cl($usr, $res['id'], 8);
+                        mysql_query(
+                            'UPDATE `users` SET `palpro` = 0, `clan_prava` = 0, `clan` = 0, `mod_zvanie` = "", `align` = 0 WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
+                        );
+                        $u->info['money'] -= $c_pr[1];
+                        mysql_query(
+                            'UPDATE `users` SET `money` = "' . $u->info['money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+                        );
+                        $c_r .= '<font color="#FF0000"><b>����� &quot;' . $usr['login'] . '&quot; ��� �������� �� ����� �� ' . $c_pr[1] . ' ��.</b></font><br>';
+                        $txt = '����� <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $u->info['login'] . '</a>[' . $u->info['level'] . ']<a target="_blank" title="���. � ' . $u->info['login'] . '" href="info/' . $u->info['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $u->info['cityreg'] . '.gif"></a> �������� �� ����� ������ <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $usr['login'] . '</a>[' . $usr['level'] . ']<a target="_blank" title="���. � ' . $usr['login'] . '" href="info/' . $usr['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $usr['cityreg'] . '.gif"></a>';
+                        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","�������������","�������� ���������","' . mysql_real_escape_string(
+                                $txt
+                            ) . '"
+				)'
+                        );
+                    }
+                } elseif ($_POST['invite'] == "���������" && $u->info['clan_prava'] == 'glava') {
+                    $usr = mysql_fetch_array(
+                        mysql_query(
+                            'SELECT * FROM `users` WHERE `login` = "' . mysql_real_escape_string(
+                                $_POST['logingo']
+                            ) . '" AND `clan` = "' . $res['id'] . '" AND `banned` = "0" LIMIT 1'
+                        )
+                    );
+                    if (!isset($usr['id'])) {
+                        echo '<font color="#FF0000"><b>����� �� ������ � �����</b></font><br>';
+                    } elseif ($u->info['money'] < $c_pr[2]) {
+                        echo '<font color="#FF0000"><b>� ��� �� ���������� ��. ��� ���������� ������ �� ���� ����� ����� (���������: ' . $c_pr[2] . ' ��.)</b></font><br>';
+                    } elseif ($usr['clan_prava'] == 'galva') {
+                        echo '<font color="#FF0000"><b>����� ��� �������� ������ �����</b></font><br>';
+                    } else {
+                        mysql_query(
+                            'UPDATE `users` SET `clan_prava` = "glava", `clan` = "' . $res['id'] . '", `mod_zvanie` = "����� �����", `align` = "' . $res['align'] . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
+                        );
+                        $u->info['money'] -= $c_pr[2];
+                        mysql_query(
+                            'UPDATE `users` SET `clan_prava` = "2", `mod_zvanie` = "�������", `money` = "' . $u->info['money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+                        );
+                        $c_r .= '<font color="#FF0000"><b>����� &quot;' . $usr['login'] . '&quot; ��� �������� ������ ���� �� ' . $c_pr[0] . ' ��.</b></font><br>';
+                        $txt = '����� <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $u->info['login'] . '</a>[' . $u->info['level'] . ']<a target="_blank" title="���. � ' . $u->info['login'] . '" href="info/' . $u->info['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $u->info['cityreg'] . '.gif"></a> �������� ������ <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $usr['login'] . '</a>[' . $usr['level'] . ']<a target="_blank" title="���. � ' . $usr['login'] . '" href="info/' . $usr['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $usr['cityreg'] . '.gif"></a> �� ��������� <b>����� �����</b>';
+                        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","�������������","�������� ���������","' . mysql_real_escape_string(
+                                $txt
+                            ) . '"
+				)'
+                        );
+                    }
+                } elseif ($_POST['invite'] == "�������" && $tt[9][0] == 1) {
+                    $is_cl = mysql_fetch_row(
+                        mysql_query("SELECT COUNT(*) FROM `users` WHERE `clan` = '" . $res['id'] . "'")
+                    );
+                    $usr = mysql_fetch_array(
+                        mysql_query(
+                            'SELECT * FROM `users` WHERE `login` = "' . mysql_real_escape_string(
+                                $_POST['logingo']
+                            ) . '" AND `clan` != "' . $res['id'] . '" LIMIT 1'
+                        )
+                    );
+                    if (!isset($usr['id'])) {
+                        echo '<font color="#FF0000"><b>���������� ����� �� ������, ���� �� ������ �������� �� �������</b></font><br>';
+                    } elseif ($usr['clan_prava'] == 'galva') {
+                        echo '<font color="#FF0000"><b>����� ��� �������� ������ �����</b></font><br>';
+                    } elseif ($usr['palpro'] < time()) {
+                        echo '<font color="#FF0000"><b>����� ������ ������ �������� � ���������</b></font><br>';
+                    } elseif ($u->info['money'] < $c_pr[0]) {
+                        echo '<font color="#FF0000"><b>� ��� �� ���������� ��. ��� ������ ������ � ���� (���������: ' . $c_pr[0] . ' ��.)</b></font><br>';
+                    } elseif ($usr['clan'] != '0' || $usr['align'] != '0') {
+                        echo '<font color="#FF0000"><b>�������� ��� ��������� � �����, ���� ����� ����������</b></font><br>';
+                    } elseif ($is_cl[0] >= $lvl_prava[$res['level']][0]) {
+                        echo '<font color="#FF0000"><b>��������� ����� �����������. ������� ������� �����.</b></font><br>';
+                    } else {
+                        mysql_query(
+                            'UPDATE `users` SET `palpro` = "0",`clan_prava` = "2",`clan` = "' . $res['id'] . '",`mod_zvanie` = "",`align` = "' . $res['align'] . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
+                        );
+                        $u->info['money'] -= $c_pr[0];
+                        mysql_query(
+                            'UPDATE `users` SET `money` = "' . $u->info['money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+                        );
+                        echo '<font color="#FF0000"><b>����� &quot;' . $usr['login'] . '&quot; ��� ������ � ���� �� ' . $c_pr[0] . ' ��.</b></font><br>';
+                        $txt = '����� <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $u->info['login'] . '</a>[' . $u->info['level'] . ']<a target="_blank" title="���. � ' . $u->info['login'] . '" href="info/' . $u->info['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $u->info['cityreg'] . '.gif"></a> ������ � ���� ������ <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $usr['login'] . '</a>[' . $usr['level'] . ']<a target="_blank" title="���. � ' . $usr['login'] . '" href="info/' . $usr['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $usr['cityreg'] . '.gif"></a>';
+                        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","�������������","�������� ���������","' . mysql_real_escape_string(
+                                $txt
+                            ) . '"
+				)'
+                        );
+                    }
+                }
+            }
+            ?>
+            <? if ($tt[9][0] > 0) { ?>
+                <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                    <input style="width:144px;" value="���������� � ����"
+                           onClick="openMod('<b>���������� ������ � ����</b>','<form action=\'main.php?clan&control&priem\' method=\'post\'>�����: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');"
+                           type="button"/>
+                    (��� ��� ��������� � <?= $c_pr[0] ?><b> ��.</b>)<br/>
+                    (����� ������� � ����, �������� ������ ������ �������� � ���������)<br/>
+                </div>
+            <? } ?>
+            <? if ($tt[10][0] > 0) { ?>
+                <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                    <input type="button" style="width:144px;" value="������� �� �����"
+                           onClick="openMod('<b>������� ������ �� �����</b>','<form action=\'main.php?clan&control&unpriem\' method=\'post\'>�����: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');">
+                    (��� ��� ��������� � <?= $c_pr[1] ?><b> ��.</b>)<br/>
+                </div>
+            <? } ?>
+            <? if ($u->info['clan_prava'] == 'glava') { ?>
+                <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                    <input style="width:144px;" value="������� ����� �����"
+                           onClick="openMod('<b>��������� ����� �����</b>','<form action=\'main.php?clan&control&newglava\' method=\'post\'>�����: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'���������\'></form>');"
+                           type="button"/> (����� ����� ������ ������� � ���� ����������, �������� ������ ����� �������
+                    ���������)<br/>
+                </div>
+            <? } ?>
+            <? if ($tt[11][0] > 0) { ?>
+                <fieldset>
+                    <legend><span class="legtitle">�������������� ������� ���������</span></legend>
+                    <?
+                    if (isset($_GET['saveuser']) && $tt[11][0] == 1) {
+                        //[rp_login] => 0 [rp_titul] => 0 [rp_zvanie] => [rp_canals] =>
+                        $c_r = '';
+                        $usr = mysql_fetch_array(
+                            mysql_query(
+                                'SELECT * FROM `users` WHERE `id` = "' . mysql_real_escape_string(
+                                    $_POST['rp_login']
+                                ) . '" AND `clan` = "' . $res['id'] . '" LIMIT 1'
+                            )
+                        );
+                        if (isset($usr['id'])) {
+                            if ($usr['clan_prava'] != 'glava') {
+                                $tt = mysql_fetch_array(
+                                    mysql_query(
+                                        'SELECT * FROM `clan_tituls` WHERE `id` = "' . $usr['clan_prava'] . '" LIMIT 1'
+                                    )
+                                );
+                                if ($tt['prioritet'] < $utitl['prioritet']) {
+                                    //����� �����
+                                    if ((int)$_POST['rp_titul'] > 0) {
+                                        $tt_new = mysql_fetch_array(
+                                            mysql_query(
+                                                'SELECT * FROM `clan_tituls` WHERE `id` = "' . mysql_real_escape_string(
+                                                    $_POST['rp_titul']
+                                                ) . '" AND `clan` = "' . $res['id'] . '" LIMIT 1'
+                                            )
+                                        );
+                                        if (isset($tt_new['id'])) {
+                                            if ($tt_new['prioritet'] < $utitl['prioritet']) {
+                                                mysql_query(
+                                                    'UPDATE `users` SET `clan_prava` = "' . $tt_new['id'] . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
+                                                );
+                                                $c_r .= '<font color="#FF0000"><b>������ &quot;' . $usr['login'] . '&quot; ��� �������� ����� &quot;' . $tt_new['name'] . '&quot;</b></font><br>';
+                                                if ($tt_new['prioritet'] < $tt['prioritet']) {
+                                                    //�������
+                                                    $txt = '����� <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $u->info['login'] . '</a>[' . $u->info['level'] . ']<a target="_blank" title="���. � ' . $u->info['login'] . '" href="info/' . $u->info['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $u->info['cityreg'] . '.gif"></a> ������� ����� ������ <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $usr['login'] . '</a>[' . $usr['level'] . ']<a target="_blank" title="���. � ' . $usr['login'] . '" href="info/' . $usr['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $usr['cityreg'] . '.gif"></a> �� &quot;<b>' . $tt_new['name'] . '</b>&quot;';
+                                                } else {
+                                                    //��������
+                                                    $txt = '����� <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $u->info['login'] . '</a>[' . $u->info['level'] . ']<a target="_blank" title="���. � ' . $u->info['login'] . '" href="info/' . $u->info['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $u->info['cityreg'] . '.gif"></a> �������� ����� &quot;<b>' . $tt_new['name'] . '</b>&quot; ������ <img src="https://img.new-combats.com/i/align/align' . $u->info['align'] . '.gif" style="vertical-align:bottom"><img src="https://img.new-combats.com/i/clan/' . $res['name'] . '.gif" style="vertical-align:bottom"><a href="javascript:void(0)">' . $usr['login'] . '</a>[' . $usr['level'] . ']<a target="_blank" title="���. � ' . $usr['login'] . '" href="info/' . $usr['id'] . '"><img src="https://img.new-combats.com/i/inf_' . $usr['cityreg'] . '.gif"></a>';
+                                                }
+
+                                                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","�������������","�������� ���������","' . mysql_real_escape_string(
+                                                        $txt
+                                                    ) . '"
+								)'
+                                                );
+
+                                            } else {
+                                                $c_r .= '<font color="#FF0000"><b>�� �� ������ ��������� ����� ������ ������ ������</b></font><br>';
+                                            }
+                                        }
+                                    }
+                                    mysql_query(
+                                        'UPDATE `users` SET `mod_zvanie` = "' . mysql_real_escape_string(
+                                            $_POST['rp_zvanie']
+                                        ) . '",`ccanals` = "' . mysql_real_escape_string(
+                                            $_POST['rp_canals']
+                                        ) . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
+                                    );
+                                    $c_r .= '<font color="#FF0000"><b>���������� ������� ���������</b></font><br>';
+
+                                } else {
+                                    $c_r .= '<font color="#FF0000"><b>����� ������ ��� �� ������, ���� ������ ���������</b></font><br>';
+                                }
+                            } else {
+                                $c_r .= '<font color="#FF0000"><b>����� ������ ��� �� ������, ���� ������ ���������</b></font><br>';
+                            }
+                        } else {
+                            $c_r .= '<font color="#FF0000"><b>����� �� ������� � ����� ' . $res['name'] . '</b></font><br>';
+                        }
+                    }
+                    echo $c_r;
+                    ?>
+                    <form method="post" action="main.php?clan&control&saveuser">
+                        <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                            <div style="display:inline-block;width:150px;">�����:</div>
+                            <select onchange="changeLogin(this);" style="width:211px;" name="rp_login">
+                                <option value="0" style="color:#CCCCCC">�������� �����</option>
+                                <?
+                                $sp = mysql_query(
+                                    'SELECT `id`,`login`,`clan_prava`,`ccanals`,`mod_zvanie` FROM `users` WHERE `clan` = "' . $res['id'] . '"'
+                                );
+                                while ($pl = mysql_fetch_array($sp)) {
+                                    $cp = mysql_fetch_array(
+                                        mysql_query(
+                                            'SELECT * FROM `clan_tituls` WHERE `id` = "' . mysql_real_escape_string(
+                                                $pl['clan_prava']
+                                            ) . '" LIMIT 1'
+                                        )
+                                    );
+                                    if ($pl['clan_prava'] == 'glava') {
+                                        $cp['name'] = '����� �����';
+                                    }
+                                    echo '<option id="slg' . $pl['id'] . '" value="' . $pl['id'] . '" vtitul="' . $cp['name'] . '" vzvanie="' . $pl['mod_zvanie'] . '" vcanals="' . $pl['ccanals'] . '">' . $pl['login'] . '</option>';
+                                }
+                                ?></select>
+                        </div>
+                        <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                            <div style="display:inline-block;width:150px;">�����:</div>
+                            <input id="sn_titul" style="width:211px;" disabled="disabled" name="rp_canals" type="text"/>
+                        </div>
+                        <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                            <div style="display:inline-block;width:150px;">��������� �����:</div>
+                            <select style="width:211px;" id="rp_titul" name="rp_titul">
+                                <option value="0" style="color:#CCCCCC">�� ������</option>
+                                <?
+                                $sp = mysql_query(
+                                    'SELECT * FROM `clan_tituls` WHERE `clan` = "' . $res['id'] . '" AND `delete` = "0" LIMIT 25'
+                                );
+                                while ($pl = mysql_fetch_array($sp)) {
+                                    echo '<option value="' . $pl['id'] . '">' . $pl['name'] . '</option>';
+                                }
+                                ?></select>
+                        </div>
+                        <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                            <div style="display:inline-block;width:150px;">�������</div>
+                        </div>
+                        <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                            <div style="display:inline-block;width:150px;">������ � �����:</div>
+                            <input style="width:211px;" id="sn_zvanie" name="rp_zvanie" type="text"/>
+                        </div>
+                        <div>
+                            <div style="display:inline-block;width:150px;">������ ����:</div>
+                            <input style="width:211px;" id="sn_canals" name="rp_canals" type="text"/><br/>
+                            <small>(���������� ����� ������� ������ ��������� �������. ��������: 1,3,7. ���������
+                                ������: 1-9)</small> <input name="���������" type="submit" id="rp_save"
+                                                            value="���������"/>
+                        </div>
+                    </form>
+                </fieldset>
+                <form method="post" enctype="multipart/form-data" action="?clan&control&save_canals">
+                    <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-top:10px;padding-bottom:5px;">
+                        <div style="display:inline-block;width:150px;">������ ����:</div>
+                        <input style="width:211px;" id="svb_canals" value="<?= $res['canals'] ?>" name="svb_canals"
+                               type="text"/> <input name="���������" type="submit" id="rp_save" value="���������"/><br/>
+                        <small>(���������� ����� ������� ������ �������� �������. ��������: 2,4,8. ��������� ������:
+                            1-9)</small>
+                    </div>
+                </form>
+            <? } ?>
+            <? if ($tt[5][0] == 1) { ?>
+                <? if ($tt[7][0] > 0 && $res['money2'] > 0) { ?>
+                    <fieldset>
+                        <legend><span class="legtitle">�������� �����������</span></legend>
+                        <form action="?clan&control&buy_imgae" method="post" enctype="multipart/form-data">
+                            <?
+                            /* ��������� ����������� � ������ */
+
+                            if (isset($_GET['gdload'])) {
+                                echo '<b style="color:red">����������� ���� ������� ��������� �� ������! ��������������� �� �������� � ���������, � ������� &quot;�������&quot;.</b><br>';
+                            } elseif (isset($_POST['img_load1type'])) {
+                                $data = [
+                                    'obraz' => $_FILES['load_image1'],
+                                    'sex' => round((int)$_POST['img_load3type']),
+                                    'w' => '',
+                                    'h' => '',
+                                    'type' => round((int)$_POST['img_load1type']),
+                                    'animation' => round((int)$_POST['img_load2type']),
+                                ];
+
+                                $ers = '';
+
+                                if ($data['sex'] != 0 && $data['sex'] != 1) {
+                                    $ers = '������! �� �� ������� ��� ���� ����� �������� �����������!';
+                                } elseif ($data['animation'] != 0 && $data['animation'] != 1) {
+                                    $ers = '������! �� �� ������� ��� �����������: �������������, �� �������������!';
+                                } elseif ($data['type'] < 1 || $data['type'] > 18) {
+                                    $ers = '������! �� �� ������� ��� ����� ��������� �����������!';
+                                }
+
+                                $types = [
+                                    1 => ['�����', 120, 220, 100],
+                                    2 => ['�������� (�����)', 120, 40, 15],
+                                    3 => ['�������� (������)', 120, 20, 5],
+                                    4 => ['����', 60, 60, 25],
+                                    5 => ['������', 60, 40, 25],
+                                    6 => ['����� ����', 60, 60, 25],
+                                    7 => ['������ ����', 60, 60, 25],
+                                    8 => ['�����', 60, 80, 25],
+                                    9 => ['����', 60, 40, 25],
+                                    10 => ['�������', 60, 40, 25],
+                                    11 => ['������', 60, 80, 25],
+                                    12 => ['��������', 60, 40, 25],
+                                    13 => ['������ �1', 20, 20, 10],
+                                    14 => ['�����', 60, 20, 25],
+                                    15 => ['������', 60, 20, 25],
+                                    16 => ['�������� ��� ���������� � ���������', 244, 287, 5],
+                                    17 => ['������ �2', 20, 20, 10],
+                                    18 => ['������ �3', 20, 20, 10],
+                                ];
+
+                                $data['price'] = $types[$data['type']][3];
+
+
+                                if ($data['price'] > $res['money2']) {
+                                    $ers = '������! � ����� ����� ������������ ����-�������� ��� ������������ ������� �����������.';
+                                }
+
+                                if ($ers != '') {
+                                    echo '<b style="color:red">' . $ers . '</b><br>';
+                                } else {
+                                    /* ��������� ����������� */
+                                    $imgname = md5(
+                                        rand(0, 1000000000000) . '&' . rand(0, 10000000) . '&' . microtime()
+                                    );
+                                    $upload = new Uploader('load_image1', $imgname);
+                                    $upload->setSavePath('clan_prw/');
+                                    $upload->setMaxFileSize(.35);
+                                    $upload->setDimensions($types[$data['type']][1], $types[$data['type']][2]);
+                                    if ($file = $upload->saveimg()) {
+                                        $size = getimagesize(
+                                            "https://new-combats.com/clan_prw/" . htmlspecialchars(
+                                                $file[1], null, 'cp1251'
+                                            )
+                                        );
+
+                                        $bag = 0;
+
+                                        if ($types[$data['type']][1] != $size[0] || $types[$data['type']][2] != $size[1]) {
+                                            $bag = 1;
+                                        }
+
+                                        mysql_query(
+                                            'INSERT INTO `reimage` (`login`,`uid`,`time`,`src`,`clan`,`type`,`sex`,`animation`,`w`,`h`,`bag`) VALUES (
+						"' . $u->info['login'] . '",
+						"' . $u->info['id'] . '","' . time() . '",
+						"' . mysql_real_escape_string(htmlspecialchars($file[1], null, 'cp1251')) . '",
+						"' . $u->info['clan'] . '",
+						"' . mysql_real_escape_string($data['type']) . '",
+						"' . mysql_real_escape_string($data['sex']) . '",
+						"' . mysql_real_escape_string($data['animation']) . '",
+						"' . mysql_real_escape_string((int)$size[0]) . '",
+						"' . mysql_real_escape_string((int)$size[1]) . '",
+						"' . $bag . '"
+					)'
+                                        );
+
+                                        $res['money2'] -= $data['price'];
+
+                                        mysql_query(
+                                            'UPDATE `clan` SET `money2` = "' . $res['money2'] . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                                        );
+                                        die('<meta http-equiv="refresh" content="0; URL=/main.php?clan&control&gdload">');
+                                    } else {
+                                        echo '<b style="color:red">' . Uploader::$error . '</b><br>';
+                                    }
+                                }
+                            }
+
+                            ?>
+                            <select name="img_load1type">
+                                <option value="0"><b>�������� ��� �����������</b></option>
+                                <option value="0"><b>�����</b></option>
+                                <option value="1">- ����� [������: 120x220] (100 ���.)</option>
+                                <option value="2">- �������� (�����) [������: 120x40] (15 ���.)</option>
+                                <option value="3">- �������� (������) [������: 120x20] (5 ���.)</option>
+                                <option value="0"><b>����� ��� ��������������</b></option>
+                                <option value="4">- ���� [������: 60x60] (25 ���.)</option>
+                                <option value="5">- ������ [������: 60x40] (25 ���.)</option>
+                                <option value="6">- ����� ���� [������: 60x60] (25 ���.)</option>
+                                <option value="7">- ������ ���� [������: 60x60] (25 ���.)</option>
+                                <option value="8">- ����� [������: 60x80] (25 ���.)</option>
+                                <option value="9">- ���� [������: 60x40] (25 ���.)</option>
+                                <option value="10">- ������� [������: 60x40] (25 ���.)</option>
+                                <option value="11">- ������ [������: 60x80] (25 ���.)</option>
+                                <option value="12">- �������� [������: 60x40] (25 ���.)</option>
+                                <option value="13">- ������ �1 [������: 20x20] (10 ���.)</option>
+                                <option value="17">- ������ �2 [������: 20x20] (10 ���.)</option>
+                                <option value="18">- ������ �3 [������: 20x20] (10 ���.)</option>
+                                <option value="14">- ����� [������: 60x20] (25 ���.)</option>
+                                <option value="15">- ������ [������: 60x20] (25 ���.)</option>
+                                <option value="16">�������� ��� ���������� � ��������� [������: 244x287] (5 ���.)
+                                </option>
+                            </select><br/>
+                            <select name="img_load2type" id="img_load2type">
+                                <option value="0">�������� (���������)</option>
+                                <option>�������� (��������)(��������� ����������� �����������)</option>
+                            </select><br/>
+                            <select name="img_load3type" id="img_load3type">
+                                <option value="-1">�������� ���</option>
+                                <option value="0">��� ������</option>
+                                <option value="1">��� ������</option>
+                            </select><br/>
+                            <small style="color:red;">������ ����������� �� ������ ��������� 350 ��!</small>
+                            <br/>
+                            <input type="file" name="load_image1" id="load_image1"/>
+                            <button type="submit">���������</button>
+                            <br/>
+                            <small style="color:red;">��������!</small>
+                            <small> ����������� ���������� ������� ����, <a href="#">������� ���������� �����������</a>,
+                                ���� ���������� �������� ������������ ����������� ������ ����� ����� ������������� ���
+                                ����������� �������� ������� � ��� ����������� ������ ����������� �� �����.</small>
+                        </form>
+                    </fieldset>
+                <? } ?>
+                <? if ($tt[7][0] > 0 && $u->info['clan'] == 17 || $u->info['clan'] == 1) { ?>
+                    <fieldset>
+                        <legend><span class="legtitle">��������</span></legend>
+                        <?
+                        $p['m1'] = 1;
+                        $srok = [15 => '15 �����', 30 => '30 �����', 60 => '���� ���', 180 => '��� ����', 360 => '����� �����', 720 => '���������� �����', 1440 => '���� �����', 4320 => '���� �����'];
+
+                        if (isset($_GET['usemod'])) {
+                            if (isset($_POST['usem1'])) {
+                                include('moder/usem1.php');
+                            } elseif (isset($_POST['teleport'])) {
+                                include('moder/teleport.php');
+                            }
+                        }
+                        ?>
+                        <table>
+                            <a href="#"
+                               onClick="openMod('<b>�������� ��������</b>','<form action=\'main.php?<? echo 'clan=1&control&usemod=' . $code; ?>\' method=\'post\'>����� ���������: <input type=\'text\' style=\'width:144px;\' id=\'logingo\' name=\'logingo\'><br>����� ��������: &nbsp; <select style=\'margin-left:2px;\' name=\'time\'><option value=\'5\'>5 �����</option><option value=\'30\'>30 �����</option><option value=\'60\'>1 ���</option><option value=\'4320\'>3 �����</option></select> <input type=\'submit\' name=\'usem1\' value=\'���-��\'></form>');"><img
+                                        src="https://img.new-combats.com/i/items/silence30.gif"
+                                        title="�������� ��������"/></a>
+                            &nbsp;
+                            <a onClick="openMod('<b>������������</b>','<form action=\'main.php?<? echo 'clan=1&control&usemod=' . $code; ?>\' method=\'post\'>����� ���������: <input type=\'text\' style=\'width:144px;\' id=\'logingo\' name=\'logingo\' value=\'<? echo $u->info['login']; ?>\'><br>�����: &nbsp; <select style=\'margin-left:2px;\' name=\'city\'><option value=\'capitalcity\'>capitalcity</option><option value=\'angelscity\'>angelscity</option><option value=\'demonscity\'>demonscity</option><option value=\'devilscity\'>devilscity</option><option value=\'suncity\'>suncity</option><option value=\'emeraldscity\'>emeraldscity</option><option value=\'sandcity\'>sandcity</option><option value=\'mooncity\'>mooncity</option><option value=\'eastcity\'>eastcity</option><option value=\'abandonedplain\'>abandonedplain</option><option value=\'dreamscity\'>dreamscity</option><option value=\'lowcity\'>devilscity</option><option value=\'oldcity\'>devilscity</option><option value=\'newcapitalcity\'>newcapital</option></select> <input type=\'submit\' name=\'teleport\' value=\'���-��\'></form>');"
+                               href="#"><img src="https://img.new-combats.com/i/items/teleport.gif"
+                                             title="������������"/></a></table>
+                    </fieldset>
+                <? } ?>
+                <fieldset>
+                    <legend><span class="legtitle">����� �����</span></legend>
+                    <form method="post" action="?clan&control&give_money">
+                        ������ � ����� �����: <?= $res['money1'] ?> ��. <? if ($res['money2'] > 0) { ?><br/>
+                            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <?= $res['money2'] ?> ���.
+                            <input type="button" value="������ ��������"/><? } ?><br/>
+                        <? if ($tt[7][0] > 0) { ?>
+                            ������� �� �����: <input id="svb_give_money" name="svb_give_money" value="0" type="text"/>
+                            <input type="submit" value=">>"/>
+                        <? } ?>
+                    </form>
+                    <? if ($tt[6][0] > 0) { ?>
+                        <form method="post" action="?clan&control&take_money">
+                            <div style="border-top:1px solid #cac9c7;margin-top:5px;padding-top:5px;">
+                                �������� ������ � �����: <input id="svb_take_money" name="svb_take_money" value="0"
+                                                                type="text"/> <input type="submit" value=">>"/>
+                                <small>(��� ����: <?= $u->info['money'] ?>��.)</small>
+                            </div>
+                        </form>
+                    <? } ?>
+                </fieldset>
+            <? } ?>
+            <? if ($tt[11][0] > 0 && $tt[3][0] == 1) { ?>
+                <form method="post" action="?clan&control&vipiska">
+                    <div style="margin-top:5px;padding-top:5px;">
+                        �������� ������� ��� ���������: <small>(������ ����� 1��.)</small> <input id="svb_vipiska"
+                                                                                                  name="svb_vipiska"
+                                                                                                  value="<?= date(
+                                                                                                      'd.m.Y'
+                                                                                                  ) ?>" type="text"/>
+                        <input type="submit" value="��������"/>
+                    </div>
+                </form>
+            <? } ?>
+        </div>
+    <?
+    }elseif (isset($_GET['diplom']) && $tt[12][0] == 1) {
+
+    if ($tt[14][0] == 1) {
+        if (isset($_GET['clanwars'])) {
+            //RadioGroup1
+            $cln = mysql_fetch_array(
+                mysql_query(
+                    'SELECT * FROM `clan` WHERE `name` = "' . mysql_real_escape_string($_POST['logingo']) . '" LIMIT 1'
+                )
+            );
+            if (isset($cln['id'])) {
+                if ($cln['id'] == $res['id']) {
+
+                    $rn = [
+                        '<font color="#FF0000"><b>���������, �� ����� ��� ������ ������ :-)</b></font><br>',
+                        '<font color="#FF0000"><b>��� ����� ����� ������ �������, ���� ������� ������!</b></font><br>',
+                        '<font color="#FF0000"><b>�� ������������� �����������, ��������� �������� ������ �����!</b></font><br>'];
+                    echo $rn[rand(0, 2)];
+                } elseif ($cln['join1'] == $res['join1'] && $res['join1'] > 0) {
+                    echo '<font color="#FF0000"><b>�� �������� � ����� � ���� ������</b></font><br>';
+                } elseif ($cln['join2'] == $res['join2'] && $res['join2'] > 0) {
+                    echo '<font color="#FF0000"><b>�� �������� � ������� � ���� ������</b></font><br>';
+                } else {
+                    $lwar = mysql_fetch_array(
+                        mysql_query(
+                            'SELECT * FROM `clan_wars` WHERE `time_finish` > ' . time(
+                            ) . ' AND ((`clan1` = "' . $cln['id'] . '" AND `clan2` = "' . $res['id'] . '") OR (`clan2` = "' . $cln['id'] . '" AND `clan1` = "' . $res['id'] . '")) LIMIT 1 '
+                        )
+                    );
+                    if (!isset($lwar['id'])) {
+                        $mkr = 300;
+                        $tpcw = 1;
+                        if ($_POST['RadioGroup1'] == 2) {
+                            $mkr = 600;
+                            $tpcw = 2;
+                        }
+                        if (true == true) {
+                            echo '<font color="#FF0000"><b>������ �������� ����� ����� ������</b></font><br>';
+                        } elseif ($mkr > $res['money1']) {
+                            echo '<font color="#FF0000"><b>� ����� ����� �� ���������� �������</b></font><br>';
+                        } else {
+                            mysql_query(
+                                'UPDATE `clan` SET `money1` = `money1` - ' . $mkr . ' WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                            );
+                            mysql_query(
+                                'INSERT INTO `clan_wars` (`clan1`,`clan2`,`time_start`,`time_finish`,`type`,`text`) VALUES ("' . $res['id'] . '","' . $cln['id'] . '","' . time(
+                                ) . '","' . (time() + 60 * 60 * 24 * 3) . '","' . $tpcw . '","�����!")'
+                            );
+                            mysql_query(
+                                'INSERT INTO `clan_operations` (`clan`,`time`,`type`,`text`,`val`,`uid`) VALUES ("' . $res['id'] . '","' . time(
+                                ) . '","4","' . $u->info['login'] . '","clanwar_' . $mkr . '_' . $cln['id'] . '","' . $u->info['id'] . '")'
+                            );
+                            echo '<font color="#FF0000"><b>�� ������� �������� ����� ����� &quot;' . $cln['name'] . '&quot; �� ' . $mkr . ' ��.</b></font><br>';
+                        }
+                    } else {
+                        echo '<font color="#FF0000"><b>�� ��� ������ ����� � ������ ������</b></font><br>';
+                    }
+                }
+            } else {
+                echo '<font color="#FF0000"><b>���� � ����� ��������� �� ������</b></font><br>';
+            }
+        }
+    }
+
+    ?>
+    <br/><br/>
+        <fieldset>
+            <legend><span class="legtitle">�������� �����</span></legend>
+            <? if ($tt[14][0] == 1) { ?>
+                <input onClick="openMod('<b>�������� ����� �����</b>','<form action=\'main.php?clan&diplom&clanwars\' method=\'post\'>�������� �����: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br><label><input type=\'radio\' name=\'RadioGroup1\' value=\'1\' id=\'RadioGroup1_0\'>������� ����� (300 ��.)</label><br><span style=\'float:left\'><label><input type=\'radio\' name=\'RadioGroup1\' value=\'2\' id=\'RadioGroup1_1\'>�������� ����� (600��.)</label></span><input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');"
+                       type="submit" name="button" id="button" value="������ �����"/>
+            <? } ?>
+            <br/>
+            <div style="border:1px solid #CECECE;padding:10px;">
+                <?
+                $ms = '';
+                $sp = mysql_query(
+                    'SELECT * FROM `clan_wars` WHERE (`clan1` = "' . $res['id'] . '" OR `clan2` = "' . $res['id'] . '") AND `time_finish` > "' . time(
+                    ) . '"'
+                );
+                while ($pl = mysql_fetch_array($sp)) {
+                    $cln1 = mysql_fetch_array(
+                        mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $pl['clan1'] . '" LIMIT 1')
+                    );
+                    $cln2 = mysql_fetch_array(
+                        mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $pl['clan2'] . '" LIMIT 1')
+                    );
+                    $ms .= '<div style="border:1px solid #CECECE;padding:10px;">����� ����� ������� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $cln1['name_mini'] . '.gif">' . $cln1['name'] . '</b> � <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $cln2['name_mini'] . '.gif">' . $cln2['name'] . '</b>.<br>';
+                    if ($pl['text'] != '') {
+                        $ms .= '������� �����: <i>' . $pl['text'] . '</i><br>';
+                    }
+                    $ms .= '����� �����: ' . date('d.m.Y H:i', $pl['time_start']) . ' - ' . date(
+                            'd.m.Y H:i', $pl['time_finish']
+                        ) . '</div>';
+                }
+                if ($ms == '') {
+                    ?>
+                    � ������ ������ ��� ���� �� ����� ����.
+                    <?
+                } else {
+                    echo $ms;
+                }
+                ?>
+            </div>
+        </fieldset>
+        <fieldset>
+            <legend><span class="legtitle">����� � �������</span></legend>
+            <? if ($tt[13][0] == 1) {
+                if (isset($_GET['joint']) && $tt[13][0] == 1) {
+                    if ($_GET['joint'] == 1) {
+                        //���������� � ����
+                        $nm = htmlspecialchars($_POST['logingo'], null, 'cp1251');
+                        $cnm = mysql_fetch_array(
+                            mysql_query(
+                                'SELECT * FROM `clan_joint` WHERE `name` = "' . mysql_real_escape_string(
+                                    $nm
+                                ) . '" AND `type` = "1" LIMIT 1'
+                            )
+                        );
+                        if (isset($cnm['id'])) {
+                            $cnmz = mysql_fetch_array(
+                                mysql_query(
+                                    'SELECT * FROM `clan_join` WHERE `alians` = "' . $cnm['id'] . '" AND `clan` = "' . $res['id'] . '" AND `time_end` = "0" AND `time_start` = "0" AND `type` = "1" LIMIT 1'
+                                )
+                            );
+                            if (isset($cnmz['id'])) {
+                                echo '<font color="#FF0000"><b>��� ���� ��� ����� ������ � ������ ����</b></font><br>';
+                            } elseif ($res['join1'] > 0) {
+                                echo '<font color="#FF0000"><b>��� ���� ��� ��������� � �����</b></font><br>';
+                            } else {
+                                mysql_query(
+                                    'UPDATE `clan` SET `join1` = "' . $cnm['id'] . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                                );
+                                echo '<font color="#FF0000"><b>�� ������� ������ ������ � ���� &quot;' . $cnm['name'] . '&quot;</b></font><br>';
+                                mysql_query(
+                                    'INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`) VALUES ("' . $res['id'] . '","' . $cnm['id'] . '","' . time(
+                                    ) . '","1")'
+                                );
+                            }
+                        } else {
+                            echo '<font color="#FF0000"><b>������ ��� ���� � ������ ��������� �� ����������</b></font><br>';
+                        }
+                    } else {
+                        //���������� � ������
+                        $nm = htmlspecialchars($_POST['logingo'], null, 'cp1251');
+                        $cnm = mysql_fetch_array(
+                            mysql_query(
+                                'SELECT * FROM `clan_joint` WHERE `name` = "' . mysql_real_escape_string(
+                                    $nm
+                                ) . '" AND `type` = "2" LIMIT 1'
+                            )
+                        );
+                        if (isset($cnm['id'])) {
+                            $cnmz = mysql_fetch_array(
+                                mysql_query(
+                                    'SELECT * FROM `clan_join` WHERE `alians` = "' . $cnm['id'] . '" AND `clan` = "' . $res['id'] . '" AND `time_end` = "0" AND `time_start` = "0" AND `type` = "2" LIMIT 1'
+                                )
+                            );
+                            if (isset($cnmz['id'])) {
+                                echo '<font color="#FF0000"><b>��� ���� ��� ����� ������ � ������ ������</b></font><br>';
+                            } elseif ($res['join1'] == 0) {
+                                echo '<font color="#FF0000"><b>��� ���������� � ������ ��������� �������� � ����</b></font><br>';
+                            } elseif ($res['join2'] > 0) {
+                                echo '<font color="#FF0000"><b>��� ���� ��� ��������� � �������</b></font><br>';
+                            } else {
+                                mysql_query(
+                                    'UPDATE `clan` SET `join1` = "' . $cnm['id'] . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                                );
+                                echo '<font color="#FF0000"><b>�� ������� ������ ������ � ������ &quot;' . $cnm['name'] . '&quot;</b></font><br>';
+                                mysql_query(
+                                    'INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`) VALUES ("' . $res['id'] . '","' . $cnm['id'] . '","' . time(
+                                    ) . '","2")'
+                                );
+                            }
+                        } else {
+                            echo '<font color="#FF0000"><b>������ ��� ���� � ������ ��������� �� ����������</b></font><br>';
+                        }
+                    }
+                } elseif (isset($_GET['newjoint']) && $tt[13][0] == 1) {
+                    if ($_GET['newjoint'] == 1) {
+                        //�����
+                        if ($res['join1'] > 0) {
+                            echo '<font color="#FF0000"><b>��� ���� ��� ������� � �����</b></font><br>';
+                        } else {
+                            $nm = htmlspecialchars($_POST['logingo'], null, 'cp1251');
+                            if (str_replace(' ', '', str_replace('	', '', $nm)) == '') {
+                                echo '<font color="#FF0000"><b>������� �������� �����</b></font><br>';
+                            } else {
+                                $cnm = mysql_fetch_array(
+                                    mysql_query(
+                                        'SELECT `id` FROM `clan_joint` WHERE `name` = "' . mysql_real_escape_string(
+                                            $nm
+                                        ) . '" LIMIT 1'
+                                    )
+                                );
+                                if (!isset($cnm['id'])) {
+                                    mysql_query(
+                                        'INSERT INTO `clan_joint` (`time_open`,`name`,`type`,`clan_open`,`clan_glava`) VALUES ("' . time(
+                                        ) . '","' . mysql_real_escape_string(
+                                            $nm
+                                        ) . '","1","' . $res['id'] . '","' . $res['id'] . '")'
+                                    );
+                                    $id = mysql_insert_id();
+                                    $res['join1'] = $id;
+                                    mysql_query(
+                                        'INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`,`time_start`) VALUES ("' . $res['id'] . '","' . $id . '","' . time(
+                                        ) . '","1","' . time() . '")'
+                                    );
+                                    mysql_query(
+                                        'UPDATE `clan` SET `join1` = "' . $id . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                                    );
+                                    echo '<font color="#FF0000"><b>�� ������� ������� ���� &quot;' . $nm . '&quot;</b></font><br>';
+                                } else {
+                                    echo '<font color="#FF0000"><b>������ ��� ���� � ������ ��������� ��� ����������</b></font><br>';
+                                }
+                            }
+                        }
+                    } else {
+                        //�������
+                        if ($res['join1'] == 0) {
+                            echo '<font color="#FF0000"><b>��� ���� ������ �������� � �����</b></font><br>';
+                        } elseif ($res['join2'] > 0) {
+                            echo '<font color="#FF0000"><b>��� ���� ��� ������� � �������</b></font><br>';
+                        } else {
+                            $nm = htmlspecialchars($_POST['logingo'], null, 'cp1251');
+                            if (str_replace(' ', '', str_replace('	', '', $nm)) == '') {
+                                echo '<font color="#FF0000"><b>������� �������� �������</b></font><br>';
+                            } else {
+                                $cnm = mysql_fetch_array(
+                                    mysql_query(
+                                        'SELECT `id` FROM `clan_joint` WHERE `name` = "' . mysql_real_escape_string(
+                                            $nm
+                                        ) . '" LIMIT 1'
+                                    )
+                                );
+                                if (!isset($cnm['id'])) {
+                                    mysql_query(
+                                        'INSERT INTO `clan_joint` (`time_open`,`name`,`type`,`clan_open`,`clan_glava`) VALUES ("' . time(
+                                        ) . '","' . mysql_real_escape_string(
+                                            $nm
+                                        ) . '","2","' . $res['id'] . '","' . $res['id'] . '")'
+                                    );
+                                    $id = mysql_insert_id();
+                                    $res['join2'] = $id;
+                                    mysql_query(
+                                        'INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`,`time_start`) VALUES ("' . $res['id'] . '","' . $id . '","' . time(
+                                        ) . '","2","' . time() . '")'
+                                    );
+                                    mysql_query(
+                                        'UPDATE `clan` SET `join2` = "' . $id . '" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                                    );
+                                    echo '<font color="#FF0000"><b>�� ������� ������� ������ &quot;' . $nm . '&quot;</b></font><br>';
+                                } else {
+                                    echo '<font color="#FF0000"><b>������ ��� ���� � ������ ��������� ��� ����������</b></font><br>';
+                                }
+                            }
+                        }
+                    }
+                } elseif (isset($_GET['cancel']) && $tt[13][0] == 1) {
+                    $zvn = mysql_fetch_array(
+                        mysql_query(
+                            'SELECT * FROM `clan_join` WHERE `id` = "' . mysql_real_escape_string(
+                                $_GET['cancel']
+                            ) . '" AND `time_start` = "0" AND `time_end` = "0" LIMIT 1'
+                        )
+                    );
+                    if (!isset($zvn['id'])) {
+                        echo '<font color="#FF0000"><b>������ �� ���������� �� �������</b></font><br>';
+                    } else {
+                        $rzv = '';
+                        if ($zvn['clan'] == $res['id']) {
+                            //������ �������������
+                            $szu = mysql_fetch_array(
+                                mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "' . $zvn['alians'] . '" LIMIT 1')
+                            );
+                            if ($szu['type'] == 1) {
+                                $rzv = '���� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $res['name_mini'] . '.gif">' . $res['name'] . '</b> ��������� �� ������������� � ����� <b>' . $szu['name'] . '</b>.';
+                            } else {
+                                $rzv = '���� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $res['name_mini'] . '.gif">' . $res['name'] . '</b> ��������� �� ������������� � ������� <b>' . $szu['name'] . '</b>.';
+                            }
+                        } elseif ($zvn['alians'] == $res['join1']) {
+                            //����� � ������������� � �����
+                            $szu = mysql_fetch_array(
+                                mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "' . $zvn['alians'] . '" LIMIT 1')
+                            );
+                            $zvy = mysql_fetch_array(
+                                mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $zvn['clan'] . '" LIMIT 1')
+                            );
+                            $rzv = '���� <b>' . $szu['name'] . '</b> ������� ����� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $zvy['name_mini'] . '.gif">' . $zvy['name'] . '</b> � �������������.';
+                        } elseif ($zvn['alians'] == $res['join2']) {
+                            //����� � ������������� � �������
+                            $szu = mysql_fetch_array(
+                                mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "' . $zvn['alians'] . '" LIMIT 1')
+                            );
+                            $zvy = mysql_fetch_array(
+                                mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $zvn['clan'] . '" LIMIT 1')
+                            );
+                            $rzv = '������ <b>' . $szu['name'] . '</b> ������� ����� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $zvy['name_mini'] . '.gif">' . $zvy['name'] . '</b> � �������������.';
+                        }
+                        if ($rzv != '') {
+                            echo '<font color="#FF0000"><b>' . $rzv . '</b></font><br>';
+                            mysql_query(
+                                'UPDATE `clan_join` SET `time_end` = "' . time() . '" WHERE `id` = "' . $zvn['id'] . '"'
+                            );
+                        }
+                    }
+                } elseif (isset($_GET['ok']) && $tt[13][0] == 1) {
+                    $zvn = mysql_fetch_array(
+                        mysql_query(
+                            'SELECT * FROM `clan_join` WHERE `id` = "' . mysql_real_escape_string(
+                                $_GET['ok']
+                            ) . '" AND `time_start` = "0" AND `time_end` = "0" LIMIT 1'
+                        )
+                    );
+                    if (!isset($zvn['id'])) {
+                        echo '<font color="#FF0000"><b>������ �� ���������� �� �������</b></font><br>';
+                    } else {
+                        $rzv = '';
+                        if ($zvn['alians'] == $res['join1']) {
+                            //������������� � �����
+                            $szu = mysql_fetch_array(
+                                mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "' . $zvn['alians'] . '" LIMIT 1')
+                            );
+                            $zvy = mysql_fetch_array(
+                                mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $zvn['clan'] . '" LIMIT 1')
+                            );
+                            $rzv = '���� <b>' . $szu['name'] . '</b> ������ ���� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $zvy['name_mini'] . '.gif">' . $zvy['name'] . '</b>.';
+                            mysql_query(
+                                'UPDATE `clan_join` SET `time_end` = "' . time(
+                                ) . '" WHERE `id` != "' . $zvn['id'] . '" AND `clan` = "' . $szu['clan'] . '" AND `type` = "1"'
+                            );
+                            //mysql_query('INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`) VALUES ("'.$res['id'].'","'.$szu['id'].'","'.time().'","1")');
+                            mysql_query(
+                                'UPDATE `clan` SET `join1` = "' . $zvn['alians'] . '" WHERE `id` = "' . $szu['id'] . '"'
+                            );
+                        } elseif ($zvn['alians'] == $res['join2']) {
+                            //������������� � �������
+                            $szu = mysql_fetch_array(
+                                mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "' . $zvn['alians'] . '" LIMIT 1')
+                            );
+                            $zvy = mysql_fetch_array(
+                                mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $zvn['clan'] . '" LIMIT 1')
+                            );
+                            $rzv = '������ <b>' . $szu['name'] . '</b> ������ ���� <b><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $zvy['name_mini'] . '.gif">' . $zvy['name'] . '</b>.';
+                            mysql_query(
+                                'UPDATE `clan_join` SET `time_end` = "' . time(
+                                ) . '" WHERE `id` != "' . $zvn['id'] . '" AND `clan` = "' . $szu['clan'] . '" AND `type` = "2" AND `time_end` = "0"'
+                            );
+                            //mysql_query('INSERT INTO `clan_join` (`clan`,`alians`,`time`,`type`) VALUES ("'.$res['id'].'","'.$szu['id'].'","'.time().'","2")');
+                            mysql_query(
+                                'UPDATE `clan` SET `join2` = "' . $zvn['alians'] . '" WHERE `id` = "' . $szu['id'] . '"'
+                            );
+                        }
+                        if ($rzv != '') {
+                            echo '<font color="#FF0000"><b>' . $rzv . '</b></font><br>';
+                            mysql_query(
+                                'UPDATE `clan_join` SET `time_start` = "' . time(
+                                ) . '" WHERE `id` = "' . $zvn['id'] . '"'
+                            );
+                        }
+                    }
+                }
+                ?>
+                <? if ($res['join1'] == 0 && $res['level'] > 0) { ?>
+                    <input type="submit" name="button" id="button" value="������� ����"
+                           onClick="openMod('<b>������� ����</b>','<form action=\'main.php?clan&diplom&newjoint=1\' method=\'post\'>��������: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');"/>
+                    <input type="submit" name="button" id="button" value="�������������� � �����"
+                           onClick="openMod('<b>�������������� � �����</b>','<form action=\'main.php?clan&diplom&joint=1\' method=\'post\'>��������: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');"/>
+                <? }
+
+                if ($res['join2'] == 0 && $res['level'] > 0) { ?>
+                    <input type="submit" name="button" id="button" value="�������������� � �������"
+                           onClick="openMod('<b>�������������� � �������</b>','<form action=\'main.php?clan&diplom&joint=2\' method=\'post\'>��������: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');"/>
+                    <input type="submit" name="button" id="button" value="������� ������"
+                           onClick="openMod('<b>������� ������</b>','<form action=\'main.php?clan&diplom&newjoint=2\' method=\'post\'>��������: <input type=\'text\' style=\'width:244px;\' id=\'logingo\' name=\'logingo\'><br> <input style=\'float:right;\' type=\'submit\' name=\'invite\' value=\'�������\'></form>');"/>
+                    <br/><br/><? } ?><? } ?>
+            <div style="border:1px solid #CECECE;padding:10px;">
+                <?
+                $ms = '';
+
+                //����������� ����� � �������
+                if ($res['join1'] > 0) {
+                    $j1 = mysql_fetch_array(
+                        mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "' . $res['join1'] . '" LIMIT 1')
+                    );
+                    if (isset($j1['id'])) {
+                        $ms .= '<div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">';
+                        $ms .= '�� �������� � �������� ����� <b>' . $j1['name'] . '</b>.';
+                        if ($j1['clan_glava'] != $res['id']) {
+                            $ms .= ' <a href="main.php?clan&diplom&delclanme=1"><img title="�������� ����" width="13" height="13" src="https://img.new-combats.com/i/clear.gif"></a>';
+                        }
+                        $ms .= '<Br>������ �����: ';
+                        //$ms .= '<a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif">'.$res['name'].'</a>';
+                        $i = 0;
+                        if (isset($_GET['delclanme'])) {
+                            if ($j1['clan_glava'] != $res['id'] && ($u->info['clan_prava'] == 'glava' || $u->info['admin'] > 0)) {
+                                $dels = mysql_fetch_array(
+                                    mysql_query(
+                                        'SELECT * FROM `clan_join` WHERE `clan` = "' . $res['id'] . '" AND `alians` = "' . $j1['id'] . '" AND `time_end` = "0" AND `time_start` > 0 LIMIT 1'
+                                    )
+                                );
+                                if (isset($dels['id'])) {
+                                    mysql_query(
+                                        'UPDATE `clan` SET `join1` = "0" WHERE `id` = "' . $res['id'] . '" LIMIT 1'
+                                    );
+                                    mysql_query(
+                                        'UPDATE `clan_join` SET `time_end` = "' . time(
+                                        ) . '" WHERE `id` = "' . $dels['id'] . '" LIMIT 1'
+                                    );
+                                    echo '<div><b><font color=red>�� ������� �������� ���� &quot;' . $j1['name'] . '&quot;</font></b></div>';
+                                    header('location: main.php?clan&diplom');
+                                } else {
+                                    echo '<div><b><font color=red>��� ���� �� ������� � ������ �����</font></b></div>';
+
+                                }
+                            } else {
+                                echo '<div><b><font color=red>�� �� ������ �������� ������ ����</font></b></div>';
+                            }
+                        } elseif ($j1['clan_glava'] == $res['id'] && ($u->info['clan_prava'] == 'glava' || $u->info['admin'] > 0)) {
+                            if (isset($_GET['delclan'])) {
+                                $delc = mysql_fetch_array(
+                                    mysql_query(
+                                        'SELECT * FROM `clan` WHERE `id` = "' . mysql_real_escape_string(
+                                            $_GET['delclan']
+                                        ) . '" LIMIT 1'
+                                    )
+                                );
+                                $dels = mysql_fetch_array(
+                                    mysql_query(
+                                        'SELECT * FROM `clan_join` WHERE `clan` = "' . $delc['id'] . '" AND `alians` = "' . $j1['id'] . '" AND `time_end` = "0" AND `time_start` > 0 LIMIT 1'
+                                    )
+                                );
+
+                                if (isset($delc['id']) && isset($dels['id'])) {
+                                    if ($delc['id'] != $res['id']) {
+                                        mysql_query(
+                                            'UPDATE `clan` SET `join1` = "0" WHERE `id` = "' . $dels['id'] . '" LIMIT 1'
+                                        );
+                                        mysql_query(
+                                            'UPDATE `clan_join` SET `time_end` = "' . time(
+                                            ) . '" WHERE `id` = "' . $dels['id'] . '" LIMIT 1'
+                                        );
+                                        echo '<div><b><font color=red>���� &quot;' . $delc['name'] . '&quot; ��� �������� �� ������� �����</font></b></div>';
+                                        header('location: main.php?clan&diplom');
+                                    } else {
+                                        echo '<div><b><font color=red>���� ������������� �� ���� �� ����� �������� ������ ����</font></b></div>';
+                                    }
+                                } else {
+                                    echo '<div><b><font color=red>���� �� ������� � ������ �����</font></b></div>';
+                                }
+                            }
+                        }
+                        $sp1 = mysql_query(
+                            'SELECT `u`.*,`s`.* FROM `clan_join` AS `u` LEFT JOIN `clan` AS `s` ON `s`.`id` = `u`.`clan` WHERE `u`.`alians` = "' . $j1['id'] . '" AND `u`.`time_end` = "0" AND `u`.`time_start` > 0'
+                        );
+                        while ($pl1 = mysql_fetch_array($sp1)) {
+                            if ($i > 0) {
+                                $ms .= ',';
+                            }
+                            $ms .= ' <a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $pl1['name_mini'] . '.gif">' . $pl1['name'] . '</a>';
+                            if ($j1['clan_glava'] == $res['id']) {
+                                if ($res['id'] != $pl1['clan']) {
+                                    if ($u->info['clan_prava'] == 'glava' || $u->info['admin'] > 0) {
+                                        $ms .= ' <a title="������� �� �����" href="main.php?clan&diplom&delclan=' . $pl1['clan'] . '"><img width="13" height="13" src="https://img.new-combats.com/i/clear.gif"></a>';
+                                    }
+                                }
+                            }
+                            $i++;
+                        }
+                        if ($j1['clan_glava'] == $res['id'] && ($u->info['clan_prava'] == 'glava' || $u->info['admin'] > 0)) {
+                            $ms .= '<br>�� ���������� �����, ������ ���������� ������ ����� ����:<br>';
+                            $cnls = '<i>���������</i>';
+                            //$ms .= '<form method="post" action="?clan&diplom&savecanals='.$res['id'].'"><a style="display:inline-block;width:210px;" href="javascript:void(0)"><img src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif">'.$res['name'].'</a> &nbsp; '.$cnls.' &nbsp; <input type="submit" value="���������"></form>';
+                            $sp1 = mysql_query(
+                                'SELECT `u`.*,`s`.* FROM `clan_join` AS `u` LEFT JOIN `clan` AS `s` ON `s`.`id` = `u`.`clan` WHERE `u`.`alians` = "' . $j1['id'] . '" AND `u`.`time_end` = "0" AND `u`.`time_start` > 0'
+                            );
+                            while ($pl1 = mysql_fetch_array($sp1)) {
+                                $ms .= '<form method="post" action="?clan&diplom&savecanals=' . $pl1['id'] . '"><a style="display:inline-block;width:210px;" href="javascript:void(0)"><img src="https://img.new-combats.com/i/clan/' . $pl1['name_mini'] . '.gif">' . $pl1['name'] . '</a> &nbsp; ' . $cnls . ' &nbsp; <input type="submit" value="���������"></form>';
+                            }
+                        }
+                        //����������� �������� ������ �����
+
+                        $ms .= '</div>';
+                    }
+                }
+                if ($res['join2'] > 0) {
+                    $j1 = mysql_fetch_array(
+                        mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "' . $res['join2'] . '" LIMIT 1')
+                    );
+                    if (isset($j1['id'])) {
+                        $ms .= '<div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">';
+                        $ms .= '�� �������� � �������� ������� <b>' . $j1['name'] . '</b>. ������ �������: ';
+                        //$ms .= '<a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/'.$res['name_mini'].'.gif">'.$res['name'].'</a>';
+                        $sp1 = mysql_query(
+                            'SELECT `u`.*,`s`.* FROM `clan_join` AS `u` LEFT JOIN `clan` AS `s` ON `s`.`id` = `u`.`clan` WHERE `u`.`alians` = "' . $j1['id'] . '" AND `u`.`time_end` = "0" AND `u`.`time_start` > 0'
+                        );
+                        $i = 0;
+                        while ($pl1 = mysql_fetch_array($sp1)) {
+                            if ($i > 0) {
+                                $ms .= ', ';
+                            }
+                            $ms .= '<a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $pl1['name_mini'] . '.gif">' . $pl1['name'] . '</a>';
+                            $i++;
+                        }
+                        $ms .= '<br>�� ���������� �������.<br>';
+                        $ms .= '</div>';
+                    }
+                }
+
+                //����� � ������� � ������� ������� ����
+
+
+                if ($ms == '') {
+                    ?>
+                    <center>� ������ ������ � ������ ����� ��� ��������������� ���������.</center>
+                <? } else {
+                    echo $ms;
+                } ?>
+            </div>
+            <? if ($tt[13][0] == 1) { ?>
+                <br/>
+                <center>������ �� �����</center>
+                <br/>
+                <table width="100%" border="0" cellspacing="0" cellpadding="2">
+                    <tr>
+                        <td width="50%" align="center" valign="top">
+                            <div style="border:1px solid #CECECE;padding:10px;">
+                                <a href="javascript:void(0)">���� ������ �� ������������ �����</a>
+                                <br/>
+                                <br/>
+                                <?
+                                $ms = '';
+                                $sp = mysql_query(
+                                    'SELECT * FROM `clan_join` WHERE `clan` = "' . mysql_real_escape_string(
+                                        $res['id']
+                                    ) . '" AND `time_start` = "0" AND `time_end` = "0" AND `type` = "1"'
+                                );
+                                while ($pl = mysql_fetch_array($sp)) {
+                                    $suz = mysql_fetch_array(
+                                        mysql_query(
+                                            'SELECT * FROM `clan_joint` WHERE `id` = "' . $pl['alians'] . '" LIMIT 1'
+                                        )
+                                    );
+                                    $ms .= '<div style="border-bottom:1px solid #cac9c7;text-align:left;margin-bottom:5px;padding-bottom:5px;">�� ������ ������ �� ���������� � ���� <b>' . $suz['name'] . '</b>.<br><div style="float:left;">����� ������ ������: ' . date(
+                                            'd.m.Y H:i', $pl['time']
+                                        ) . '</div><a style="float:right;" href="?clan&diplom&cancel=' . $pl['id'] . '">��������</a><br></div>';
+                                }
+                                if ($ms == '') {
+                                    ?>
+                                    � ���� ����� �� ������� ������
+                                <? } else {
+                                    echo $ms;
+                                } ?>
+                            </div>
+                        </td>
+                        <td align="center" valign="top">
+                            <div style="border:1px solid #CECECE;padding:10px;">
+                                <a href="javascript:void(0)">������ �� ������������ ����� � ����</a>
+                                <br/>
+                                <br/>
+                                <?
+                                $ms = '';
+                                $sp = mysql_query(
+                                    'SELECT * FROM `clan_join` WHERE `alians` = "' . mysql_real_escape_string(
+                                        $res['join1']
+                                    ) . '" AND `time_start` = "0" AND `time_end` = "0" AND `type` = "1"'
+                                );
+                                while ($pl = mysql_fetch_array($sp)) {
+                                    $suz = mysql_fetch_array(
+                                        mysql_query(
+                                            'SELECT * FROM `clan_joint` WHERE `id` = "' . $pl['alians'] . '" LIMIT 1'
+                                        )
+                                    );
+                                    $clz = mysql_fetch_array(
+                                        mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $pl['clan'] . '" LIMIT 1')
+                                    );
+                                    $ms .= '<div style="border-bottom:1px solid #cac9c7;text-align:left;margin-bottom:5px;padding-bottom:5px;">���� <a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $clz['name_mini'] . '.gif">' . $clz['name'] . '</a> ����� ������ �� ���������� � ��� ���� <b>' . $suz['name'] . '</b>.<br><div style="float:left;">����� ������ ������: ' . date(
+                                            'd.m.Y H:i', $pl['time']
+                                        ) . '</div><div style="float:right;"><a href="?clan&diplom&ok=' . $pl['id'] . '">�������</a> &nbsp; <a href="?clan&diplom&cancel=' . $pl['id'] . '">��������</a></div><br></div>';
+                                }
+                                if ($ms == '') {
+                                    ?>
+                                    � ���� ����� �� ������� ������
+                                <? } else {
+                                    echo $ms;
+                                } ?>
+                            </div>
+                        </td>
+                    </tr>
+                </table>
+                <br/>
+                <center>������ �� �������</center>
+                <br/>
+                <table width="100%" border="0" cellspacing="0" cellpadding="2">
+                    <tr>
+                        <td width="50%" align="center" valign="top">
+                            <div style="border:1px solid #CECECE;padding:10px;">
+                                <a href="javascript:void(0)">���� ������ �� ������������ �������</a>
+                                <br/>
+                                <br/>
+                                <?
+                                $ms = '';
+                                $sp = mysql_query(
+                                    'SELECT * FROM `clan_join` WHERE `clan` = "' . mysql_real_escape_string(
+                                        $res['id']
+                                    ) . '" AND `time_start` = "0" AND `time_end` = "0" AND `type` = "2"'
+                                );
+                                while ($pl = mysql_fetch_array($sp)) {
+                                    $suz = mysql_fetch_array(
+                                        mysql_query(
+                                            'SELECT * FROM `clan_joint` WHERE `id` = "' . $pl['alians'] . '" LIMIT 1'
+                                        )
+                                    );
+                                    $ms .= '<div style="border-bottom:1px solid #cac9c7;text-align:left;margin-bottom:5px;padding-bottom:5px;">�� ������ ������ �� ���������� � ������ <b>' . $suz['name'] . '</b>.<br><div style="float:left;">����� ������ ������: ' . date(
+                                            'd.m.Y H:i', $pl['time']
+                                        ) . '</div><a style="float:right;" href="?clan&diplom&cancel=' . $pl['id'] . '">��������</a><br></div>';
+                                }
+                                if ($ms == '') {
+                                    ?>
+                                    � ���� ����� �� ������� ������
+                                <? } else {
+                                    echo $ms;
+                                } ?>
+                            </div>
+                        </td>
+                        <td align="center" valign="top">
+                            <div style="border:1px solid #CECECE;padding:10px;">
+                                <a href="javascript:void(0)">������ �� ������������ ������� � ����</a>
+                                <br/>
+                                <br/>
+                                <?
+                                $ms = '';
+                                $sp = mysql_query(
+                                    'SELECT * FROM `clan_join` WHERE `alians` = "' . mysql_real_escape_string(
+                                        $res['join2']
+                                    ) . '" AND `time_start` = "0" AND `time_end` = "0" AND `type` = "2"'
+                                );
+                                while ($pl = mysql_fetch_array($sp)) {
+                                    $suz = mysql_fetch_array(
+                                        mysql_query(
+                                            'SELECT * FROM `clan_joint` WHERE `id` = "' . $pl['alians'] . '" LIMIT 1'
+                                        )
+                                    );
+                                    $clz = mysql_fetch_array(
+                                        mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $pl['clan'] . '" LIMIT 1')
+                                    );
+                                    $ms .= '<div style="border-bottom:1px solid #cac9c7;text-align:left;margin-bottom:5px;padding-bottom:5px;">���� <a href="javascript:void(0)"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $clz['name_mini'] . '.gif">' . $clz['name'] . '</a> ����� ������ �� ���������� � ��� ������ <b>' . $suz['name'] . '</b>.<br><div style="float:left;">����� ������ ������: ' . date(
+                                            'd.m.Y H:i', $pl['time']
+                                        ) . '</div><div style="float:right;"><a href="?clan&diplom&ok=' . $pl['id'] . '">�������</a> &nbsp; <a href="?clan&diplom&cancel=' . $pl['id'] . '">��������</a></div><br></div>';
+                                }
+                                if ($ms == '') {
+                                    ?>
+                                    � ���� ����� �� ������� ������
+                                <? } else {
+                                    echo $ms;
+                                } ?>
+                            </div>
+                        </td>
+                    </tr>
+                </table>
+            <? } ?>
+        </fieldset>
+    <? } elseif (isset($_GET['deposit'])) {
+
+    $itmc = mysql_fetch_array(
+        mysql_query(
+            'SELECT COUNT(`id`) FROM `items_users` WHERE `uid` = "-21' . $res['id'] . '" AND `delete` = 0 LIMIT 1'
+        )
+    );
+    $itmc = $itmc[0];
+    $itms = mysql_fetch_array(
+        mysql_query(
+            'SELECT `iu`.*,`im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` >= 0 AND `iu`.`delete` = "0"
+		AND `iu`.`id` = "' . mysql_real_escape_string($_GET['ungive_itm']) . '" LIMIT 1'
+        )
+    );
+    $ps = $u->lookStats($itms['data']);
+    $ps['cl'] = explode('#', $ps['toclan']);
+    $use_s = $ps['cl'][1];
+    if (isset($_GET['ungive_itm']) && $ps['cl'][0] == $res['id'] && ($tt[14][0] == 1 || ($u->info['id'] == $use_s))) {
+        $itm = mysql_fetch_array(
+            mysql_query(
+                'SELECT `iu`.*,`im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` >= 0 AND `iu`.`delete` = "0"
+		AND `iu`.`id` = "' . mysql_real_escape_string($_GET['ungive_itm']) . '" LIMIT 1'
+            )
+        );
+        if (isset($itm['id'])) {
+            $btlud = mysql_fetch_array(
+                mysql_query('SELECT `id`,`battle` FROM `users` WHERE `id` = "' . $itm['uid'] . '" LIMIT 1')
+            );
+            if ($u->testBattle($btlud['battle']) == true) {
+                echo '<font color="#FF0000"><b>������ ������� �������� � ��������� � ���</b></font><br>';
+            } else {
+                echo $u->ungive_itm_cl($_GET['ungive_itm'], $u->info, $res['id']);
+            }
+        }
+    } elseif (isset($_GET['take_itm']) && $tt[4][0] == 1) {
+        $itm = mysql_fetch_array(
+            mysql_query(
+                'SELECT `iu`.*,`im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid`="-21' . $res['id'] . '" AND `iu`.`delete`="0"
+		AND `iu`.`id` = "' . mysql_real_escape_string($_GET['take_itm']) . '" LIMIT 1'
+            )
+        );
+        if (isset($itm['id'])) {
+            echo $u->take_itm_cl($_GET['take_itm'], $u->info, $res['id']);
+        }
+    } elseif (isset($_GET['give_itm'])) {
+        $itm = mysql_fetch_array(
+            mysql_query(
+                'SELECT `iu`.*,`im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `im`.`inslot` > 0 AND `iu`.`gift` = "" AND `iu`.`data` NOT LIKE "%frompisher=%"
+		AND `iu`.`id` = "' . mysql_real_escape_string($_GET['give_itm']) . '" LIMIT 1'
+            )
+        );
+        if ($itmc >= $lvl_prava[$res['level']][5]) {
+            echo '<font color="#FF0000"><b>��������� �����������</b></font><br>';
+        } elseif (isset($itm['id'])) {
+            echo $u->set_cl_item($_GET['give_itm'], $u->info, $res['id']);
+        }
+    }
+    if ($tt[4][0] == 1) {
+        $itm_clan = $u->genInv(
+            66,
+            '(`iu`.`uid` = "-21' . $u->info['clan'] . '" OR `iu`.`data` LIKE "%toclan=' . $u->info['clan'] . '#%") AND `iu`.`delete` = 0 AND `iu`.`inShop` = 0 ORDER BY `lastUPD` DESC'
+        );
+    } else {
+        $itm_clan[2] = '<br /><br /><center>� ��� ��� ������� � ������������� ���������</center>';
+    }
+    $itm_user = $u->genInv(
+        65,
+        '`iu`.`uid` = ' . $u->info['id'] . ' AND `iu`.`delete` = 0 AND `iu`.`inOdet` = 0 AND `iu`.`inShop` = 0 AND `im`.`inslot` > 0 AND `iu`.`gift` = "" AND `iu`.`data` NOT LIKE "%frompisher=%" ORDER BY `lastUPD` DESC'
+    );
+
+    ?>
+        <div class="box visible">
+            <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                <tr>
+                    <td width="50%" valign="top">
+                        <fieldset style="margin:0;padding:0">
+                            <legend><span
+                                        class="legtitle">��������� (��������� : <?= $itmc ?>/<?= $lvl_prava[$res['level']][5] ?>)</span>
+                            </legend>
+                            <? if ($itm_clan[2] != '') { ?>
+                                <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                    <?= $itm_clan[2] ?>
+                                </table>
+                            <? } else {
+                                echo '<center><br />��������� ����� �����<br /><br /></center>';
+                            } ?>
+                        </fieldset>
+                    </td>
+                    <td width="50%" valign="top">
+                        <fieldset style="margin:0;padding:0">
+                            <legend><span class="legtitle">������</span></legend>
+                            <? if ($itm_user[2] != '') { ?>
+                                <table border="0" cellspacing="0" cellpadding="0" width="100%">
+                                    <?= $itm_user[2] ?>
+                                </table>
+                            <? } else {
+                                echo '<center><br />������ ����<br /><br /></center>';
+                            } ?>
+                        </fieldset>
+                    </td>
+                </tr>
+            </table>
+        </div>
+    <? }elseif (isset($_GET['titul']) && $tt[11][0] == 1) { ?>
+        <script>
+            function editTitul(id) {
+                if ($('#edpnltitul' + id).css('display') == 'none') {
+                    $('#edpnltitul' + id).css({'display': ''});
+                } else {
+                    $('#edpnltitul' + id).css({'display': 'none'});
+                }
+            }
+        </script>
+        <div class="box visible">
+            <?
+            if (isset($_POST['tituladd'])) {
+                //��������� ����� �����
+                $tc = mysql_fetch_array(
+                    mysql_query(
+                        'SELECT COUNT(*) FROM `clan_tituls` WHERE `clan` = "' . $res['id'] . '" AND `delete` = "0" LIMIT 25'
+                    )
+                );
+                if ($tc[0] >= 20) {
+                    echo '<font color="#FF0000"><b>������ ��������� ����� 25-�� �������, ��� ���������� ������ ������� ������</b></font><br>';
+                } else {
+                    $nm = htmlspecialchars($_POST['tituladd'], null, 'cp1251');
+                    if (str_replace(' ', '', str_replace('	', '', $nm)) == '') {
+                        echo '<font color="#FF0000"><b>�������� ������ �� ������ ���� ������</b></font><br>';
+                    } else {
+                        mysql_query(
+                            'INSERT INTO `clan_tituls` (`clan`,`user_add`,`time_add`,`name`) VALUES ("' . $res['id'] . '","' . $u->info['id'] . '","' . time(
+                            ) . '","' . mysql_real_escape_string($nm) . '")'
+                        );
+                        echo '<font color="#FF0000"><b>����� ��� ������� ��������</b></font><br>';
+                    }
+                }
+            } elseif (isset($_GET['save'])) {
+                //��������� �����
+                $tc = mysql_fetch_array(
+                    mysql_query(
+                        'SELECT * FROM `clan_tituls` WHERE `clan` = "' . $res['id'] . '" AND `id` = "' . mysql_real_escape_string(
+                            $_GET['save']
+                        ) . '" AND `delete` = "0" LIMIT 1'
+                    )
+                );
+                if (isset($tc['id'])) {
+                    $tc['info'] = htmlspecialchars($_POST['t_info'], null, 'cp1251');
+                    $i = 1;
+                    $tc['canals'] = '';
+                    while ($i <= 9) {
+                        if ($_POST['t_klan' . $i]) {
+                            $tc['canals'] .= '1';
+                        } else {
+                            $tc['canals'] .= '0';
+                        }
+                        $i++;
+                    }
+                    $i = 0;
+                    $tc['prava'] = '';
+                    while ($i <= 20) {
+                        if ($_POST['t_tr' . $i]) {
+                            $tc['prava'] .= '1';
+                        } else {
+                            $tc['prava'] .= '0';
+                        }
+                        $i++;
+                    }
+                    $_POST['colorsp'] = preg_replace('/[^a-z�-��0-9]/i', '', $_POST['colorsp']);
+                    mysql_query(
+                        'UPDATE `clan_tituls` SET `info` = "' . mysql_real_escape_string(
+                            $tc['info']
+                        ) . '", `color` = "' . mysql_real_escape_string(
+                            $_POST['colorsp']
+                        ) . '", `canals` = "' . $tc['canals'] . '", `prava` = "' . $tc['prava'] . '" WHERE `id` = "' . $tc['id'] . '" LIMIT 1'
+                    );
+                    echo '<font color="#FF0000"><b>����� ��� ������� ��������</b></font><br>';
+                } else {
+                    echo '<font color="#FF0000"><b>����� �� ������</b></font><br>';
+                }
+            } elseif (isset($_GET['delete'])) {
+                $tc = mysql_fetch_array(
+                    mysql_query(
+                        'SELECT * FROM `clan_tituls` WHERE `clan` = "' . $res['id'] . '" AND `id` = "' . mysql_real_escape_string(
+                            $_GET['delete']
+                        ) . '" AND `delete` = "0" LIMIT 1'
+                    )
+                );
+                if (isset($tc['id'])) {
+                    mysql_query(
+                        'UPDATE `clan_tituls` SET `delete` = "' . $u->info['id'] . '" WHERE `id` = "' . $tc['id'] . '" LIMIT 1'
+                    );
+                    echo '<font color="#FF0000"><b>����� ��� ������</b></font><br>';
+                } else {
+                    echo '<font color="#FF0000"><b>����� �� ������</b></font><br>';
+                }
+            }
+            ?>
+            <div id="clrttl" style="display:none">
+                <br/><br/>
+                <center><a onclick="ssclrttl()" href="javascript:void(0)">�������� ������ - ������</a></center>
+                <br/><br/>
+                <table width="100%" cellpadding="10" cellspacing="5">
+                    <tbody>
+                    <tr>
+                        <td>000000</td>
+                        <td>000033</td>
+                        <td>000066</td>
+                        <td>000099</td>
+                        <td>0000cc</td>
+                        <td>0000ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#000000"></td>
+                        <td bgcolor="#000033"></td>
+                        <td bgcolor="#000066"></td>
+                        <td bgcolor="#000099"></td>
+                        <td bgcolor="#0000cc"></td>
+                        <td bgcolor="#0000ff"></td>
+                    </tr>
+                    <tr>
+                        <td>003300</td>
+                        <td>003333</td>
+                        <td>003366</td>
+                        <td>003399</td>
+                        <td>0033cc</td>
+                        <td>0033ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#003300"></td>
+                        <td bgcolor="#003333"></td>
+                        <td bgcolor="#003366"></td>
+                        <td bgcolor="#003399"></td>
+                        <td bgcolor="#0033cc"></td>
+                        <td bgcolor="#0033ff"></td>
+                    </tr>
+                    <tr>
+                        <td>006600</td>
+                        <td>006633</td>
+                        <td>006666</td>
+                        <td>006699</td>
+                        <td>0066cc</td>
+                        <td>0066ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#006600"></td>
+                        <td bgcolor="#006633"></td>
+                        <td bgcolor="#006666"></td>
+                        <td bgcolor="#006699"></td>
+                        <td bgcolor="#0066cc"></td>
+                        <td bgcolor="#0066ff"></td>
+                    </tr>
+                    <tr>
+                        <td>009900</td>
+                        <td>009933</td>
+                        <td>009966</td>
+                        <td>009999</td>
+                        <td>0099cc</td>
+                        <td>0099ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#009900"></td>
+                        <td bgcolor="#009933"></td>
+                        <td bgcolor="#009966"></td>
+                        <td bgcolor="#009999"></td>
+                        <td bgcolor="#0099cc"></td>
+                        <td bgcolor="#0099ff"></td>
+                    </tr>
+                    <tr>
+                        <td>00cc00</td>
+                        <td>00cc33</td>
+                        <td>00cc66</td>
+                        <td>00cc99</td>
+                        <td>00cccc</td>
+                        <td>00ccff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#00cc00"></td>
+                        <td bgcolor="#00cc33"></td>
+                        <td bgcolor="#00cc66"></td>
+                        <td bgcolor="#00cc99"></td>
+                        <td bgcolor="#00cccc"></td>
+                        <td bgcolor="#00ccff"></td>
+                    </tr>
+                    <tr>
+                        <td>00ff00</td>
+                        <td>00ff33</td>
+                        <td>00ff66</td>
+                        <td>00ff99</td>
+                        <td>00ffcc</td>
+                        <td>00ffff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#00ff00"></td>
+                        <td bgcolor="#00ff33"></td>
+                        <td bgcolor="#00ff66"></td>
+                        <td bgcolor="#00ff99"></td>
+                        <td bgcolor="#00ffcc"></td>
+                        <td bgcolor="#00ffff"></td>
+                    </tr>
+                    <tr>
+                        <td>330000</td>
+                        <td>330033</td>
+                        <td>330066</td>
+                        <td>330099</td>
+                        <td>3300cc</td>
+                        <td>3300ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#330000"></td>
+                        <td bgcolor="#330033"></td>
+                        <td bgcolor="#330066"></td>
+                        <td bgcolor="#330099"></td>
+                        <td bgcolor="#3300cc"></td>
+                        <td bgcolor="#3300ff"></td>
+                    </tr>
+                    <tr>
+                        <td>333300</td>
+                        <td>333333</td>
+                        <td>333366</td>
+                        <td>333399</td>
+                        <td>3333cc</td>
+                        <td>3333ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#333300"></td>
+                        <td bgcolor="#333333"></td>
+                        <td bgcolor="#333366"></td>
+                        <td bgcolor="#333399"></td>
+                        <td bgcolor="#3333cc"></td>
+                        <td bgcolor="#3333ff"></td>
+                    </tr>
+                    <tr>
+                        <td>336600</td>
+                        <td>336633</td>
+                        <td>336666</td>
+                        <td>336699</td>
+                        <td>3366cc</td>
+                        <td>3366ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#336600"></td>
+                        <td bgcolor="#336633"></td>
+                        <td bgcolor="#336666"></td>
+                        <td bgcolor="#336699"></td>
+                        <td bgcolor="#3366cc"></td>
+                        <td bgcolor="#3366ff"></td>
+                    </tr>
+                    <tr>
+                        <td>339900</td>
+                        <td>339933</td>
+                        <td>339966</td>
+                        <td>339999</td>
+                        <td>3399cc</td>
+                        <td>3399ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#339900"></td>
+                        <td bgcolor="#339933"></td>
+                        <td bgcolor="#339966"></td>
+                        <td bgcolor="#339999"></td>
+                        <td bgcolor="#3399cc"></td>
+                        <td bgcolor="#3399ff"></td>
+                    </tr>
+                    <tr>
+                        <td>33cc00</td>
+                        <td>33cc33</td>
+                        <td>33cc66</td>
+                        <td>33cc99</td>
+                        <td>33cccc</td>
+                        <td>33ccff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#33cc00"></td>
+                        <td bgcolor="#33cc33"></td>
+                        <td bgcolor="#33cc66"></td>
+                        <td bgcolor="#33cc99"></td>
+                        <td bgcolor="#33cccc"></td>
+                        <td bgcolor="#33ccff"></td>
+                    </tr>
+                    <tr>
+                        <td>33ff00</td>
+                        <td>33ff33</td>
+                        <td>33ff66</td>
+                        <td>33ff99</td>
+                        <td>33ffcc</td>
+                        <td>33ffff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#33ff00"></td>
+                        <td bgcolor="#33ff33"></td>
+                        <td bgcolor="#33ff66"></td>
+                        <td bgcolor="#33ff99"></td>
+                        <td bgcolor="#33ffcc"></td>
+                        <td bgcolor="#33ffff"></td>
+                    </tr>
+                    <tr>
+                        <td>660000</td>
+                        <td>660033</td>
+                        <td>660066</td>
+                        <td>660099</td>
+                        <td>6600cc</td>
+                        <td>6600ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#660000"></td>
+                        <td bgcolor="#660033"></td>
+                        <td bgcolor="#660066"></td>
+                        <td bgcolor="#660099"></td>
+                        <td bgcolor="#6600cc"></td>
+                        <td bgcolor="#6600ff"></td>
+                    </tr>
+                    <tr>
+                        <td>663300</td>
+                        <td>663333</td>
+                        <td>663366</td>
+                        <td>663399</td>
+                        <td>6633cc</td>
+                        <td>6633ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#663300"></td>
+                        <td bgcolor="#663333"></td>
+                        <td bgcolor="#663366"></td>
+                        <td bgcolor="#663399"></td>
+                        <td bgcolor="#6633cc"></td>
+                        <td bgcolor="#6633ff"></td>
+                    </tr>
+                    <tr>
+                        <td>666600</td>
+                        <td>666633</td>
+                        <td>666666</td>
+                        <td>666699</td>
+                        <td>6666cc</td>
+                        <td>6666ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#666600"></td>
+                        <td bgcolor="#666633"></td>
+                        <td bgcolor="#666666"></td>
+                        <td bgcolor="#666699"></td>
+                        <td bgcolor="#6666cc"></td>
+                        <td bgcolor="#6666ff"></td>
+                    </tr>
+                    <tr>
+                        <td>669900</td>
+                        <td>669933</td>
+                        <td>669966</td>
+                        <td>669999</td>
+                        <td>6699cc</td>
+                        <td>6699ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#669900"></td>
+                        <td bgcolor="#669933"></td>
+                        <td bgcolor="#669966"></td>
+                        <td bgcolor="#669999"></td>
+                        <td bgcolor="#6699cc"></td>
+                        <td bgcolor="#6699ff"></td>
+                    </tr>
+                    <tr>
+                        <td>66cc00</td>
+                        <td>66cc33</td>
+                        <td>66cc66</td>
+                        <td>66cc99</td>
+                        <td>66cccc</td>
+                        <td>66ccff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#66cc00"></td>
+                        <td bgcolor="#66cc33"></td>
+                        <td bgcolor="#66cc66"></td>
+                        <td bgcolor="#66cc99"></td>
+                        <td bgcolor="#66cccc"></td>
+                        <td bgcolor="#66ccff"></td>
+                    </tr>
+                    <tr>
+                        <td>66ff00</td>
+                        <td>66ff33</td>
+                        <td>66ff66</td>
+                        <td>66ff99</td>
+                        <td>66ffcc</td>
+                        <td>66ffff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#66ff00"></td>
+                        <td bgcolor="#66ff33"></td>
+                        <td bgcolor="#66ff66"></td>
+                        <td bgcolor="#66ff99"></td>
+                        <td bgcolor="#66ffcc"></td>
+                        <td bgcolor="#66ffff"></td>
+                    </tr>
+                    <tr>
+                        <td>990000</td>
+                        <td>990033</td>
+                        <td>990066</td>
+                        <td>990099</td>
+                        <td>9900cc</td>
+                        <td>9900ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#990000"></td>
+                        <td bgcolor="#990033"></td>
+                        <td bgcolor="#990066"></td>
+                        <td bgcolor="#990099"></td>
+                        <td bgcolor="#9900cc"></td>
+                        <td bgcolor="#9900ff"></td>
+                    </tr>
+                    <tr>
+                        <td>993300</td>
+                        <td>993333</td>
+                        <td>993366</td>
+                        <td>993399</td>
+                        <td>9933cc</td>
+                        <td>9933ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#993300"></td>
+                        <td bgcolor="#993333"></td>
+                        <td bgcolor="#993366"></td>
+                        <td bgcolor="#993399"></td>
+                        <td bgcolor="#9933cc"></td>
+                        <td bgcolor="#9933ff"></td>
+                    </tr>
+                    <tr>
+                        <td>996600</td>
+                        <td>996633</td>
+                        <td>996666</td>
+                        <td>996699</td>
+                        <td>9966cc</td>
+                        <td>9966ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#996600"></td>
+                        <td bgcolor="#996633"></td>
+                        <td bgcolor="#996666"></td>
+                        <td bgcolor="#996699"></td>
+                        <td bgcolor="#9966cc"></td>
+                        <td bgcolor="#9966ff"></td>
+                    </tr>
+                    <tr>
+                        <td>999900</td>
+                        <td>999933</td>
+                        <td>999966</td>
+                        <td>999999</td>
+                        <td>9999cc</td>
+                        <td>9999ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#999900"></td>
+                        <td bgcolor="#999933"></td>
+                        <td bgcolor="#999966"></td>
+                        <td bgcolor="#999999"></td>
+                        <td bgcolor="#9999cc"></td>
+                        <td bgcolor="#9999ff"></td>
+                    </tr>
+                    <tr>
+                        <td>99cc00</td>
+                        <td>99cc33</td>
+                        <td>99cc66</td>
+                        <td>99cc99</td>
+                        <td>99cccc</td>
+                        <td>99ccff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#99cc00"></td>
+                        <td bgcolor="#99cc33"></td>
+                        <td bgcolor="#99cc66"></td>
+                        <td bgcolor="#99cc99"></td>
+                        <td bgcolor="#99cccc"></td>
+                        <td bgcolor="#99ccff"></td>
+                    </tr>
+                    <tr>
+                        <td>99ff00</td>
+                        <td>99ff33</td>
+                        <td>99ff66</td>
+                        <td>99ff99</td>
+                        <td>99ffcc</td>
+                        <td>99ffff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#99ff00"></td>
+                        <td bgcolor="#99ff33"></td>
+                        <td bgcolor="#99ff66"></td>
+                        <td bgcolor="#99ff99"></td>
+                        <td bgcolor="#99ffcc"></td>
+                        <td bgcolor="#99ffff"></td>
+                    </tr>
+                    <tr>
+                        <td>cc0000</td>
+                        <td>cc0033</td>
+                        <td>cc0066</td>
+                        <td>cc0099</td>
+                        <td>cc00cc</td>
+                        <td>cc00ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#cc0000"></td>
+                        <td bgcolor="#cc0033"></td>
+                        <td bgcolor="#cc0066"></td>
+                        <td bgcolor="#cc0099"></td>
+                        <td bgcolor="#cc00cc"></td>
+                        <td bgcolor="#cc00ff"></td>
+                    </tr>
+                    <tr>
+                        <td>cc3300</td>
+                        <td>cc3333</td>
+                        <td>cc3366</td>
+                        <td>cc3399</td>
+                        <td>cc33cc</td>
+                        <td>cc33ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#cc3300"></td>
+                        <td bgcolor="#cc3333"></td>
+                        <td bgcolor="#cc3366"></td>
+                        <td bgcolor="#cc3399"></td>
+                        <td bgcolor="#cc33cc"></td>
+                        <td bgcolor="#cc33ff"></td>
+                    </tr>
+                    <tr>
+                        <td>cc6600</td>
+                        <td>cc6633</td>
+                        <td>cc6666</td>
+                        <td>cc6699</td>
+                        <td>cc66cc</td>
+                        <td>cc66ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#cc6600"></td>
+                        <td bgcolor="#cc6633"></td>
+                        <td bgcolor="#cc6666"></td>
+                        <td bgcolor="#cc6699"></td>
+                        <td bgcolor="#cc66cc"></td>
+                        <td bgcolor="#cc66ff"></td>
+                    </tr>
+                    <tr>
+                        <td>cc9900</td>
+                        <td>cc9933</td>
+                        <td>cc9966</td>
+                        <td>cc9999</td>
+                        <td>cc99cc</td>
+                        <td>cc99ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#cc9900"></td>
+                        <td bgcolor="#cc9933"></td>
+                        <td bgcolor="#cc9966"></td>
+                        <td bgcolor="#cc9999"></td>
+                        <td bgcolor="#cc99cc"></td>
+                        <td bgcolor="#cc99ff"></td>
+                    </tr>
+                    <tr>
+                        <td>cccc00</td>
+                        <td>cccc33</td>
+                        <td>cccc66</td>
+                        <td>cccc99</td>
+                        <td>cccccc</td>
+                        <td>ccccff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#cccc00"></td>
+                        <td bgcolor="#cccc33"></td>
+                        <td bgcolor="#cccc66"></td>
+                        <td bgcolor="#cccc99"></td>
+                        <td bgcolor="#cccccc"></td>
+                        <td bgcolor="#ccccff"></td>
+                    </tr>
+                    <tr>
+                        <td>ccff00</td>
+                        <td>ccff33</td>
+                        <td>ccff66</td>
+                        <td>ccff99</td>
+                        <td>ccffcc</td>
+                        <td>ccffff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#ccff00"></td>
+                        <td bgcolor="#ccff33"></td>
+                        <td bgcolor="#ccff66"></td>
+                        <td bgcolor="#ccff99"></td>
+                        <td bgcolor="#ccffcc"></td>
+                        <td bgcolor="#ccffff"></td>
+                    </tr>
+                    <tr>
+                        <td>ff0000</td>
+                        <td>ff0033</td>
+                        <td>ff0066</td>
+                        <td>ff0099</td>
+                        <td>ff00cc</td>
+                        <td>ff00ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#ff0000"></td>
+                        <td bgcolor="#ff0033"></td>
+                        <td bgcolor="#ff0066"></td>
+                        <td bgcolor="#ff0099"></td>
+                        <td bgcolor="#ff00cc"></td>
+                        <td bgcolor="#ff00ff"></td>
+                    </tr>
+                    <tr>
+                        <td>ff3300</td>
+                        <td>ff3333</td>
+                        <td>ff3366</td>
+                        <td>ff3399</td>
+                        <td>ff33cc</td>
+                        <td>ff33ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#ff3300"></td>
+                        <td bgcolor="#ff3333"></td>
+                        <td bgcolor="#ff3366"></td>
+                        <td bgcolor="#ff3399"></td>
+                        <td bgcolor="#ff33cc"></td>
+                        <td bgcolor="#ff33ff"></td>
+                    </tr>
+                    <tr>
+                        <td>ff6600</td>
+                        <td>ff6633</td>
+                        <td>ff6666</td>
+                        <td>ff6699</td>
+                        <td>ff66cc</td>
+                        <td>ff66ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#ff6600"></td>
+                        <td bgcolor="#ff6633"></td>
+                        <td bgcolor="#ff6666"></td>
+                        <td bgcolor="#ff6699"></td>
+                        <td bgcolor="#ff66cc"></td>
+                        <td bgcolor="#ff66ff"></td>
+                    </tr>
+                    <tr>
+                        <td>ff9900</td>
+                        <td>ff9933</td>
+                        <td>ff9966</td>
+                        <td>ff9999</td>
+                        <td>ff99cc</td>
+                        <td>ff99ff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#ff9900"></td>
+                        <td bgcolor="#ff9933"></td>
+                        <td bgcolor="#ff9966"></td>
+                        <td bgcolor="#ff9999"></td>
+                        <td bgcolor="#ff99cc"></td>
+                        <td bgcolor="#ff99ff"></td>
+                    </tr>
+                    <tr>
+                        <td>ffcc00</td>
+                        <td>ffcc33</td>
+                        <td>ffcc66</td>
+                        <td>ffcc99</td>
+                        <td>ffcccc</td>
+                        <td>ffccff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#ffcc00"></td>
+                        <td bgcolor="#ffcc33"></td>
+                        <td bgcolor="#ffcc66"></td>
+                        <td bgcolor="#ffcc99"></td>
+                        <td bgcolor="#ffcccc"></td>
+                        <td bgcolor="#ffccff"></td>
+                    </tr>
+                    <tr>
+                        <td>ffff00</td>
+                        <td>ffff33</td>
+                        <td>ffff66</td>
+                        <td>ffff99</td>
+                        <td>ffffcc</td>
+                        <td>ffffff</td>
+                    </tr>
+                    <tr>
+                        <td bgcolor="#ffff00"></td>
+                        <td bgcolor="#ffff33"></td>
+                        <td bgcolor="#ffff66"></td>
+                        <td bgcolor="#ffff99"></td>
+                        <td bgcolor="#ffffcc"></td>
+                        <td bgcolor="#ffffff"></td>
+                    </tr>
+                    </tbody>
+                </table>
+            </div>
+            <script>
+                function ssclrttl() {
+                    if ($('#clrttl').css('display') == 'none') {
+                        $('#clrttl').css({'display': ''});
+                    } else {
+                        $('#clrttl').css({'display': 'none'});
+                    }
+                }
+            </script>
+            <?
+            $i = 0;
+            $sp = mysql_query(
+                'SELECT * FROM `clan_tituls` WHERE `clan` = "' . $res['id'] . '" AND `delete` = "0" LIMIT 25'
+            );
+            while ($pl = mysql_fetch_array($sp)) {
+                ?>
+                <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+
+                    <b style="color:#<?= $pl['color'] ?>">*</b> &nbsp; <a style="display:inline-block;width:250px;"
+                                                                          onclick="editTitul(<?= $pl['id'] ?>)"
+                                                                          href="javascript:void(0)"><?= $pl['name'] ?></a><font
+                            color="#999999"><i><?= $pl['info'] ?></i></font>
+                    <img src="https://img.new-combats.com/i/clear.gif" title="������� �����"
+                         onclick="location='main.php?clan&titul&delete=<?= $pl['id'] ?>'"
+                         style="float:right;cursor:pointer;">
+                    <div id="edpnltitul<?= $pl['id'] ?>"
+                         style="display:none;margin:10px;border:1px solid #9e9e9e;padding:10px;">
+                        <form method="post" action="?clan&titul&save=<?= $pl['id'] ?>">
+                            <span style="float:right"><a onclick="editTitul(<?= $pl['id'] ?>)"
+                                                         href="javascript:void(0)">x</a></span>
+                            <center>�������������� ������ <a onclick="editTitul(<?= $pl['id'] ?>)"
+                                                             href="javascript:void(0)"><?= $pl['name'] ?></a></center>
+                            <br>
+                            ��������: <input style="width:360px;" value="<?= $pl['info'] ?>" type="text"
+                                             name="t_info"><br>
+                            <br>
+                            ������ ����:
+                            <? $j = 1;
+                            while ($j <= 9) {
+                                if ($pl['canals'][$j - 1] == 1) {
+                                    $pl['check'] = 'checked';
+                                } else {
+                                    $pl['check'] = '';
+                                }
+                                ?>
+                                <label for="t_klan<?= $j ?>"><?= $j ?></label>
+                                <input <?= $pl['check'] ?> type="checkbox" <?= $pl['check2'] ?> name="t_klan<?= $j ?>"
+                                                           id="t_klan<?= $j ?>">
+                                <? $j++;
+                            }
+                            echo '<br><br>';
+                            $j = 1;
+                            while ($j < count($tt)) {
+                                if ($tt[$j][1] != '0') {
+                                    if ($pl['prava'][$j] == 1) {
+                                        $pl['check'] = 'checked';
+                                    } else {
+                                        $pl['check'] = '';
+                                    }
+                                    ?>
+                                    <input <?= $pl['check'] ?> type="checkbox" name="t_tr<?= $j ?>" id="t_tr<?= $j ?>">
+                                    <label for="t_tr<?= $j ?>"><?= $tt[$j][1] ?></label><br>
+                                    <?
+                                }
+                                $j++;
+                            }
+                            ?>
+                            <br>
+                            ��������: *<br>
+                            ����: &nbsp; &nbsp; &nbsp;
+                            <div style="cursor:pointer;display:inline-block;width:20px;height:15px;background-color:#<?= $pl['color'] ?>">
+                                &nbsp;
+                            </div>
+                            #<input name="colorsp" maxlength="6" type="text" value="<?= $pl['color'] ?>"/><br/>
+                            <small>(�� ������ ������������� <a onclick="ssclrttl()" href="javascript:void(0)">��������
+                                    ������ - ��������/������</a>)</small><br/>
+                            <br><br>
+                            <input type="submit" value="���������">
+                        </form>
+                    </div>
+                </div>
+                <?
+                $i++;
+            }
+
+            if ($i == 0) {
+                echo '� ����� ��� �� ������ ������';
+            }
+            ?>
+            <input type="button" onclick="addNewTitul()" value="�������� �����">
+        </div>
+    <? }elseif (isset($_GET['rules'])) { ?>
+        <div class="box visible">
+            <fieldset style="border:1px dashed #eeeeee">
+                <legend><span class="legtitle">����� ��������� &quot;<?= $u->info['login'] ?>&quot;</span></legend>
+                <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                    ������ � �����: <b><?
+
+                        if ($u->info['clan_prava'] != 'glava') {
+                            echo $u->info['moder_zvanie'];
+                        } else {
+                            echo '<b style="color:#008097">����� �����</b>';
+                        }
+
+                        ?></b>
+                </div>
+                <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                    �����: <b><?= $utitl['name'] ?></b> &nbsp; - &nbsp; <font
+                            color="#999999"><?= $utitl['info'] ?></font>
+                </div>
+                <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                    ������ ����:
+                    <? $j = 1;
+                    while ($j <= 9) {
+                        if ($utitl['canals'][$j - 1] == 1) {
+                            $r .= '<a href="javascript:void(0)">klan-' . $j . '</a>, ';
+                        }
+                        $j++;
+                    }
+                    echo rtrim($r, ', ');
+                    ?>
+                </div>
+                <?
+                $j = 1;
+                while ($j < count($tt)) {
+                    if ($tt[$j][1] != '0') {
+                        if ($utitl['prava'][$j] == 1) {
+                            $utitl['check'] = '��';
+                        } else {
+                            $utitl['check'] = '���';
+                        }
+                        ?>
+                        <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                            <div style="display:inline-block;width:410px;">
+                                &bull; <?= $tt[$j][1] ?></div><?= $utitl['check'] ?>
+                        </div>
+                        <?
+                    }
+                    $j++;
+                }
+                ?>
+
+            </fieldset>
+        </div>
+    <? }elseif (isset($_GET['info'])) {
+
+    //���������� ����
+    $edd = mysql_fetch_array(
+        mysql_query(
+            'SELECT SUM(`exp`) FROM `clan_exp` WHERE `clan` = "' . $res['id'] . '" AND `dd` = "' . ceil(
+                date('d')
+            ) . '" AND `mm` = "' . ceil(date('m')) . '" AND `yyyy` = "' . ceil(date('Y')) . '"'
+        )
+    );
+    $eww = mysql_fetch_array(
+        mysql_query(
+            'SELECT SUM(`exp`) FROM `clan_exp` WHERE `clan` = "' . $res['id'] . '" AND `ww` = "' . ceil(
+                date('W')
+            ) . '" AND `yyyy` = "' . ceil(date('Y')) . '"'
+        )
+    );
+    $emm = mysql_fetch_array(
+        mysql_query(
+            'SELECT SUM(`exp`) FROM `clan_exp` WHERE `clan` = "' . $res['id'] . '" AND `mm` = "' . ceil(
+                date('m')
+            ) . '" AND `yyyy` = "' . ceil(date('Y')) . '"'
+        )
+    );
+
+    $edd = 0 + $edd[0];
+    $eww = 0 + $eww[0];
+    $emm = 0 + $emm[0];
+    ?>
+        <div class="box visible">
+            <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                �������� �����: <img src="https://img.new-combats.com/i/clan/<?= $res['name_mini'] ?>.gif"
+                                     style="vertical-align:bottom" width="24" height="15"><a
+                        href="javascript:void(0)"><?= $res['name'] ?></a> (<?= $res['name_mini'] ?>)
+            </div>
+            <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                ������� �����: <?= $res['level'] ?>
+            </div>
+            <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                ���� �����: <?= number_format($res['exp'], 0, ",", " ") ?> / <?= number_format(
+                    $lvl_exp[$res['level'] + 1], 0, ",", " "
+                ) ?>
+                <div style="width:200px;display:inline-block;border:1px solid #aeaeae">
+                    <div style="width:<?= ceil(
+                        ($res['exp'] - $lvl_exp[$res['level']]) / $lvl_exp[$res['level'] + 1] * 200
+                    ) ?>px;display:inline-block;padding-left:4px;padding-right:4px;text-align:right;background-color:#E9F7E8;color:#1B3618">
+                        <b><?= ceil(($res['exp'] - $lvl_exp[$res['level']]) / $lvl_exp[$res['level'] + 1] * 100) ?>%</b>
+                    </div>
+                </div>
+            </div>
+            <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                <table width="500" border="0" cellspacing="0" cellpadding="0">
+                    <tr>
+                        <td width="220">���������� ��������� �����:</td>
+                        <td width="100">&bull; �� �������:</td>
+                        <td><b style="color:#0033a1"><?= $edd ?></b></td>
+                    </tr>
+                    <tr>
+                        <td>&nbsp;</td>
+                        <td>&bull; �� ������:</td>
+                        <td><b style="color:#0033a1"><?= $eww ?></b></td>
+                    </tr>
+                    <tr>
+                        <td>&nbsp;</td>
+                        <td>&bull; �� �����:</td>
+                        <td><b style="color:#0033a1"><?= $emm ?></b></td>
+                    </tr>
+                </table>
+            </div>
+            <div style="border-bottom:1px solid #cac9c7;margin-bottom:5px;padding-bottom:5px;">
+                <table width="100%" border="0" style="border:1px solid #232323;" cellspacing="0" cellpadding="5">
+                    <tr>
+                        <td align="center" valign="middle"
+                            style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc">
+                            <strong>�������</strong></td>
+                        <td align="center" valign="middle"
+                            style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc">
+                            <strong>������</strong></td>
+                        <td align="center" valign="middle"
+                            style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc">
+                            <strong>����</strong></td>
+                        <td align="center" valign="middle"
+                            style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc">
+                            <strong>������� ����</strong></td>
+                        <td align="center" valign="middle"
+                            style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc">
+                            <strong>������</strong></td>
+                        <td align="center" valign="middle"
+                            style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc">
+                            <strong>������� ������</strong></td>
+                        <td align="center" valign="middle"
+                            style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc">
+                            <strong>���������</strong></td>
+                        <td align="center" valign="middle"
+                            style="border-bottom:1px solid #232323;border-right:1px solid #232323;" bgcolor="#cccccc">
+                            <strong>������� �� ������</strong></td>
+                        <td align="center" valign="middle" style="border-bottom:1px solid #232323;" bgcolor="#cccccc">
+                            <strong>������� �����</strong></td>
+                    </tr>
+                    <?
+                    $i = 0;
+                    $yn = ['���', '��'];
+                    while ($i < count($lvl_prava)) {
+                        $bgclr = '';
+                        if ($res['level'] >= $i) {
+                            $bgclr = ' bgcolor="#8fd155"';
+                        }
+                        if ($i < count($lvl_prava) - 1) {
+                            ?>
+                            <tr<?= $bgclr ?>>
+                                <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;"
+                                    align="center" valign="middle"><?= $i ?></td>
+                                <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;"
+                                    align="center" valign="middle"><?= $lvl_prava[$i][0] ?></td>
+                                <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;"
+                                    align="center" valign="middle"><?= $yn[$lvl_prava[$i][1]] ?></td>
+                                <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;"
+                                    align="center" valign="middle"><?= $yn[$lvl_prava[$i][2]] ?></td>
+                                <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;"
+                                    align="center" valign="middle"><?= $yn[$lvl_prava[$i][3]] ?></td>
+                                <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;"
+                                    align="center" valign="middle"><?= $yn[$lvl_prava[$i][4]] ?></td>
+                                <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;"
+                                    align="center" valign="middle"><?= $lvl_prava[$i][5] ?></td>
+                                <td style="border-bottom:1px solid #232323;border-right:1px solid #232323;"
+                                    align="center" valign="middle"><?= $lvl_prava[$i][6] ?></td>
+                                <td style="border-bottom:1px solid #232323;" align="center"
+                                    valign="middle"><?= $lvl_prava[$i][7] ?></td>
+                            </tr>
+                            <?
+                        } else {
+
+                            ?>
+                            <tr<?= $bgclr ?>>
+                                <td style="border-right:1px solid #232323;" align="center"
+                                    valign="middle"><?= $i ?></td>
+                                <td style="border-right:1px solid #232323;" align="center"
+                                    valign="middle"><?= $lvl_prava[$i][0] ?></td>
+                                <td style="border-right:1px solid #232323;" align="center"
+                                    valign="middle"><?= $yn[$lvl_prava[$i][1]] ?></td>
+                                <td style="border-right:1px solid #232323;" align="center"
+                                    valign="middle"><?= $yn[$lvl_prava[$i][2]] ?></td>
+                                <td style="border-right:1px solid #232323;" align="center"
+                                    valign="middle"><?= $yn[$lvl_prava[$i][3]] ?></td>
+                                <td style="border-right:1px solid #232323;" align="center"
+                                    valign="middle"><?= $yn[$lvl_prava[$i][4]] ?></td>
+                                <td style="border-right:1px solid #232323;" align="center"
+                                    valign="middle"><?= $lvl_prava[$i][5] ?></td>
+                                <td style="border-right:1px solid #232323;" align="center"
+                                    valign="middle"><?= $lvl_prava[$i][6] ?></td>
+                                <td align="center" valign="middle"><?= $lvl_prava[$i][7] ?></td>
+                            </tr>
+                            <?
+                        }
+                        $i++;
+                    }
+                    ?>
+                </table>
+            </div>
+        </div>
+    <? }elseif (isset($_GET['members'])) { ?>
+        <div class="box visible">
+            <fieldset style="border:1px dashed #eeeeee">
+                <legend align="center"><span class="legtitle"><img title="��������"
+                                                                   onClick="top.chat.addto('klan','private')"
+                                                                   style="vertical-align:bottom;cursor:pointer;"
+                                                                   src="https://img.new-combats.com/i/lock.gif"
+                                                                   width="20" height="15"> ����������</span></legend>
+                <? if (!isset($_GET['online'])) { ?>
+                    <input onClick="location='main.php?clan&members&online'" type="button" value="������ online"
+                           style="float:right">
+                <? } else { ?>
+                    <input onClick="location='main.php?clan&members'" type="button" value="�������� ����"
+                           style="float:right">
+                <? } ?>
+                <br>
+                <?
+                $sp = mysql_query(
+                    'SELECT `id`,`battle`,`login`,`clan`,`level`,`room`,`cityreg`,`align`,`clan_prava`,`mod_zvanie`,`sex`,`city`,`online`,`banned` FROM `users` WHERE `clan` = "' . $res['id'] . '"'
+                );
+                $r = '<br>';
+                $j = 0;
+                $i = 0;
+                if ($res['join1'] > 0 || $res['join2'] > 0) {
+                    $r .= '<fieldset style="border:1px dashed #eeeeee;margin-top:5px;">
+      <legend align="left"><span class="legtitle">�������� ������</span></legend>';
+                }
+                while ($pl = mysql_fetch_array($sp)) {
+                    if (!isset($_GET['online']) || $pl['online'] > time() - 120) {
+                        $pl['textcolor1'] = '';
+                        if ($pl['online'] > time() - 120) {
+                            $ico = '<img onClick="top.chat.addto(\'' . $pl['login'] . '\',\'private\')" src="https://img.new-combats.com/i/lock.gif" width="20" height="15" style="cursor:pointer;vertical-align:bottom">';
+                            $j++;
+                        } else {
+                            $pl['textcolor1'] = '#837f82';
+                            $ico = '<img src="https://img.new-combats.com/i/offline.gif" width="20" height="15" style="vertical-align:bottom">';
+                        }
+                        $zvn = $pl['mod_zvanie'];
+                        $zvn = str_replace('[b]', '<b>', $zvn);
+                        $zvn = str_replace('[/b]', '</b>', $zvn);
+                        $zvn = str_replace('[i]', '<i>', $zvn);
+                        $zvn = str_replace('[/i]', '</i>', $zvn);
+                        $zvn = str_replace('[u]', '<u>', $zvn);
+                        $zvn = str_replace('[/u]', '</u>', $zvn);
+                        $zvn = str_replace('[c=', '<font color="', $zvn);
+                        $zvn = str_replace('=]', '">', $zvn);
+                        $zvn = str_replace('[/c]', '</font>', $zvn);
+                        if ($pl['clan_prava'] == 'glava') {
+                            if ($zvn == '������' || $zvn == '') {
+                                $zvn = '<b style="color:#008097">����� �����</b>';
+                            }
+                            $zvn = '<img style="vertical-align:top" src="https://img.new-combats.com/i/clan/' . $res['name_mini'] . '.gif" width="24" title="����� �����">' . $zvn;
+                        }
+                        $ttl = mysql_fetch_array(
+                            mysql_query(
+                                'SELECT * FROM `clan_tituls` WHERE `clan` = "' . $res['id'] . '" AND `id` = "' . $pl['clan_prava'] . '" LIMIT 1'
+                            )
+                        );
+                        if (isset($ttl['id'])) {
+                            $zvn = '<font color="#' . $ttl['color'] . '"><b>' . $ttl['name'] . '</b></font> - ' . $zvn;
+                        }
+                        if ($pl['online'] > time() - 120) {
+                            $rm = mysql_fetch_array(
+                                mysql_query(
+                                    'SELECT `id`,`name`,`city` FROM `room` WHERE `id` = "' . $pl['room'] . '" LIMIT 1'
+                                )
+                            );
+                            if (isset($rm['id'])) {
+                                $zvn .= ' - <i>' . $rm['name'] . '</i>';
+                            }
+                        } else {
+                            $zvn .= ' - <i><font color="grey">�������� ������ �� � �����</font></i>';
+                        }
+                        if ($pl['battle'] > 0) {
+                            $zvn .= ' <a href="logs.php?id=' . $pl['battle'] . '" target="_blank"><img width="20" height="20" style="vertical-align:bottom"src="https://img.new-combats.com/i/fighttype0.gif" title="������� ��� ��������"></a>';
+                        }
+                        $r .= '<div style="padding:5px;background-color:#efedee"><span style="display:inline-block;width:350px;">' . $ico . ' &nbsp;&nbsp; &nbsp; <img src="https://img.new-combats.com/i/align/align' . $pl['align'] . '.gif" width="12" height="15" style="vertical-align:bottom"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $res['name_mini'] . '.gif" width="24" height="15"><a onClick="top.chat.addto(\'' . $pl['login'] . '\',\'to\')" style="color:' . $pl['textcolor1'] . '" href="javascript:void(0)">' . $pl['login'] . '</a><font color="' . $pl['textcolor1'] . '">[' . $pl['level'] . ']<a href="https://new-combats.com/info/' . $pl['id'] . '" title="���. � ' . $pl['login'] . '" target="_blank"><img src="https://img.new-combats.com/i/inf_' . $pl['cityreg'] . '.gif" width="12" height="11"></a></font></span>' . $zvn . '</div>';
+                    }
+                    $i++;
+                }
+
+                if ($res['join1'] > 0 || $res['join2'] > 0) {
+                    $r .= '</fieldset>';
+                }
+                $nacln = '';
+                if ($res['join1'] > 0) {
+                    $clna = mysql_fetch_array(
+                        mysql_query(
+                            'SELECT * FROM `clan_joint` WHERE `id` = "' . $res['join1'] . '" AND `type` = "1" AND `time_close` = "0" LIMIT 1'
+                        )
+                    );
+                    $cn_sp = mysql_query(
+                        'SELECT * FROM `clan_join` WHERE `alians` = "' . $clna['id'] . '" AND `clan` != "' . $res['id'] . '" AND `time_end` = "0" AND `time_start` > 0'
+                    );
+                    while ($cn_pl = mysql_fetch_array($cn_sp)) {
+                        /* ----------------------------------------------------------------------------------------------------------------------------- */
+                        $nacln .= ' AND `clan` != "' . $cn_pl['clan'] . '"';
+                        $clnf = mysql_fetch_array(
+                            mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $cn_pl['clan'] . '" LIMIT 1')
+                        );
+                        $sp = mysql_query(
+                            'SELECT `id`,`battle`,`login`,`clan`,`level`,`room`,`cityreg`,`align`,`clan_prava`,`mod_zvanie`,`sex`,`city`,`online`,`banned` FROM `users` WHERE `clan` = "' . $cn_pl['clan'] . '"'
+                        );
+                        $r .= '<fieldset style="border:1px dashed #eeeeee;margin-top:5px;">
+      <legend align="left"><span class="legtitle">������ &quot;' . $clna['name'] . '&quot;</span></legend>';
+                        $j = 0;
+                        $i = 0;
+                        while ($pl = mysql_fetch_array($sp)) {
+                            if (!isset($_GET['online']) || $pl['online'] > time() - 120) {
+                                $pl['textcolor1'] = '';
+                                if ($pl['online'] > time() - 120) {
+                                    $ico = '<img onClick="top.chat.addto(\'' . $pl['login'] . '\',\'private\')" src="https://img.new-combats.com/i/lock.gif" width="20" height="15" style="cursor:pointer;vertical-align:bottom">';
+                                    $j++;
+                                } else {
+                                    $pl['textcolor1'] = '#837f82';
+                                    $ico = '<img src="https://img.new-combats.com/i/offline.gif" width="20" height="15" style="vertical-align:bottom">';
+                                }
+                                $zvn = $pl['mod_zvanie'];
+                                $zvn = str_replace('[b]', '<b>', $zvn);
+                                $zvn = str_replace('[/b]', '</b>', $zvn);
+                                $zvn = str_replace('[i]', '<i>', $zvn);
+                                $zvn = str_replace('[/i]', '</i>', $zvn);
+                                $zvn = str_replace('[u]', '<u>', $zvn);
+                                $zvn = str_replace('[/u]', '</u>', $zvn);
+                                $zvn = str_replace('[c=', '<font color="', $zvn);
+                                $zvn = str_replace('=]', '">', $zvn);
+                                $zvn = str_replace('[/c]', '</font>', $zvn);
+                                if ($pl['clan_prava'] == 'glava') {
+                                    if ($zvn == '������' || $zvn == '') {
+                                        $zvn = '<b style="color:#008097">����� �����</b>';
+                                    }
+                                    $zvn = '<img style="vertical-align:top" src="https://img.new-combats.com/i/clan/' . $clnf['name_mini'] . '.gif" width="24" title="����� �����">' . $zvn;
+                                }
+                                $ttl = mysql_fetch_array(
+                                    mysql_query(
+                                        'SELECT * FROM `clan_tituls` WHERE `clan` = "' . $clnf['id'] . '" AND `id` = "' . $pl['clan_prava'] . '" LIMIT 1'
+                                    )
+                                );
+                                if (isset($ttl['id'])) {
+                                    $zvn = '<font color="#' . $ttl['color'] . '"><b>' . $ttl['name'] . '</b></font> - ' . $zvn;
+                                }
+                                if ($pl['online'] > time() - 120) {
+                                    $rm = mysql_fetch_array(
+                                        mysql_query(
+                                            'SELECT `id`,`name`,`city` FROM `room` WHERE `id` = "' . $pl['room'] . '" LIMIT 1'
+                                        )
+                                    );
+                                    if (isset($rm['id'])) {
+                                        $zvn .= ' - <i>' . $rm['name'] . '</i>';
+                                    }
+                                } else {
+                                    $zvn .= ' - <i><font color="grey">�������� ������ �� � �����</font></i>';
+                                }
+                                if ($pl['battle'] > 0) {
+                                    $zvn .= ' <a href="logs.php?id=' . $pl['battle'] . '" target="_blank"><img width="20" height="20" style="vertical-align:bottom"src="https://img.new-combats.com/i/fighttype0.gif" title="������� ��� ��������"></a>';
+                                }
+                                $r .= '<div style="padding:5px;background-color:#efedee"><span style="display:inline-block;width:350px;">' . $ico . ' &nbsp;&nbsp; &nbsp; <img src="https://img.new-combats.com/i/align/align' . $pl['align'] . '.gif" width="12" height="15" style="vertical-align:bottom"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $clnf['name_mini'] . '.gif" width="24" height="15"><a onClick="top.chat.addto(\'' . $pl['login'] . '\',\'to\')" style="color:' . $pl['textcolor1'] . '" href="javascript:void(0)">' . $pl['login'] . '</a><font color="' . $pl['textcolor1'] . '">[' . $pl['level'] . ']<a href="https://new-combats.com/info/' . $pl['id'] . '" title="���. � ' . $pl['login'] . '" target="_blank"><img src="https://img.new-combats.com/i/inf_' . $pl['cityreg'] . '.gif" width="12" height="11"></a></font></span>' . $zvn . '</div>';
+                            }
+                            $i++;
+                        }
+                        $r .= '</fieldset>';
+                        /* ----------------------------------------------------------------------------------------------------------------------------- */
+                    }
+                }
+                if ($res['join2'] > 0) {
+                    $cn_sp0 = mysql_fetch_array(
+                        mysql_query(
+                            'SELECT * FROM `clan_joint` WHERE `id` = "' . $res['join2'] . '" AND `type` = "2" AND `time_close` = "0" LIMIT 1'
+                        )
+                    );
+                    $cn_sp = mysql_query(
+                        'SELECT * FROM `clan_join` WHERE `alians` = "' . $cn_sp0['id'] . '" AND `clan` != "' . $res['id'] . '"' . $nacln . ' AND `time_end` = "0" AND `time_start` > 0'
+                    );
+                    while ($cn_pl = mysql_fetch_array($cn_sp)) {
+                        /* ----------------------------------------------------------------------------------------------------------------------------- */
+                        $clnf = mysql_fetch_array(
+                            mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $cn_pl['clan'] . '" LIMIT 1')
+                        );
+                        $clna = mysql_fetch_array(
+                            mysql_query('SELECT * FROM `clan_joint` WHERE `id` = "' . $res['join2'] . '" LIMIT 1')
+                        );
+                        $sp = mysql_query(
+                            'SELECT `id`,`battle`,`login`,`clan`,`level`,`room`,`cityreg`,`align`,`clan_prava`,`mod_zvanie`,`sex`,`city`,`online`,`banned` FROM `users` WHERE `clan` = "' . $cn_pl['clan'] . '"'
+                        );
+                        $r .= '<fieldset style="border:1px dashed #eeeeee;margin-top:5px;">
+      <legend align="left"><span class="legtitle">������ &quot;' . $clna['name'] . '&quot;</span></legend>';
+                        $j = 0;
+                        $i = 0;
+                        while ($pl = mysql_fetch_array($sp)) {
+                            if (!isset($_GET['online']) || $pl['online'] > time() - 120) {
+                                $pl['textcolor1'] = '';
+                                if ($pl['online'] > time() - 120) {
+                                    $ico = '<img onClick="top.chat.addto(\'' . $pl['login'] . '\',\'private\')" src="https://img.new-combats.com/i/lock.gif" width="20" height="15" style="cursor:pointer;vertical-align:bottom">';
+                                    $j++;
+                                } else {
+                                    $pl['textcolor1'] = '#837f82';
+                                    $ico = '<img src="https://img.new-combats.com/i/offline.gif" width="20" height="15" style="vertical-align:bottom">';
+                                }
+                                $zvn = $pl['mod_zvanie'];
+                                $zvn = str_replace('[b]', '<b>', $zvn);
+                                $zvn = str_replace('[/b]', '</b>', $zvn);
+                                $zvn = str_replace('[i]', '<i>', $zvn);
+                                $zvn = str_replace('[/i]', '</i>', $zvn);
+                                $zvn = str_replace('[u]', '<u>', $zvn);
+                                $zvn = str_replace('[/u]', '</u>', $zvn);
+                                $zvn = str_replace('[c=', '<font color="', $zvn);
+                                $zvn = str_replace('=]', '">', $zvn);
+                                $zvn = str_replace('[/c]', '</font>', $zvn);
+                                if ($pl['clan_prava'] == 'glava') {
+                                    if ($zvn == '������' || $zvn == '') {
+                                        $zvn = '<b style="color:#008097">����� �����</b>';
+                                    }
+                                    $zvn = '<img style="vertical-align:top" src="https://img.new-combats.com/i/clan/' . $clnf['name_mini'] . '.gif" width="24" title="����� �����">' . $zvn;
+                                }
+                                $ttl = mysql_fetch_array(
+                                    mysql_query(
+                                        'SELECT * FROM `clan_tituls` WHERE `clan` = "' . $clnf['id'] . '" AND `id` = "' . $pl['clan_prava'] . '" LIMIT 1'
+                                    )
+                                );
+                                if (isset($ttl['id'])) {
+                                    $zvn = '<font color="#' . $ttl['color'] . '"><b>' . $ttl['name'] . '</b></font> - ' . $zvn;
+                                }
+                                if ($pl['online'] > time() - 120) {
+                                    $rm = mysql_fetch_array(
+                                        mysql_query(
+                                            'SELECT `id`,`name`,`city` FROM `room` WHERE `id` = "' . $pl['room'] . '" LIMIT 1'
+                                        )
+                                    );
+                                    if (isset($rm['id'])) {
+                                        $zvn .= ' - <i>' . $rm['name'] . '</i>';
+                                    }
+                                } else {
+                                    $zvn .= ' - <i><font color="grey">�������� ������ �� � �����</font></i>';
+                                }
+                                if ($pl['battle'] > 0) {
+                                    $zvn .= ' <a href="logs.php?id=' . $pl['battle'] . '" target="_blank"><img width="20" height="20" style="vertical-align:bottom"src="https://img.new-combats.com/i/fighttype0.gif" title="������� ��� ��������"></a>';
+                                }
+                                $r .= '<div style="padding:5px;background-color:#efedee"><span style="display:inline-block;width:350px;">' . $ico . ' &nbsp;&nbsp; &nbsp; <img src="https://img.new-combats.com/i/align/align' . $pl['align'] . '.gif" width="12" height="15" style="vertical-align:bottom"><img style="vertical-align:bottom" src="https://img.new-combats.com/i/clan/' . $clnf['name_mini'] . '.gif" width="24" height="15"><a onClick="top.chat.addto(\'' . $pl['login'] . '\',\'to\')" style="color:' . $pl['textcolor1'] . '" href="javascript:void(0)">' . $pl['login'] . '</a><font color="' . $pl['textcolor1'] . '">[' . $pl['level'] . ']<a href="https://new-combats.com/info/' . $pl['id'] . '" title="���. � ' . $pl['login'] . '" target="_blank"><img src="https://img.new-combats.com/i/inf_' . $pl['cityreg'] . '.gif" width="12" height="11"></a></font></span>' . $zvn . '</div>';
+                            }
+                            $i++;
+                        }
+                        $r .= '</fieldset>';
+                        /* ----------------------------------------------------------------------------------------------------------------------------- */
+                    }
+                }
+
+                $r .= '<br>Online: <a href="main.php?clan&members&online">' . $j . '</a><br>�����: <a href="main.php?clan&members">' . $i . '</a><br><small>(������ ����������� <s>� �������</s>)</small>';
+                echo $r;
+                ?>
+            </fieldset>
+        </div>
+    <? } ?>
 
 
 </div><!-- .section -->
\ No newline at end of file
diff --git a/modules_data/_dialog.php b/modules_data/_dialog.php
index 73116218..5809fe1e 100644
--- a/modules_data/_dialog.php
+++ b/modules_data/_dialog.php
@@ -1,46 +1,52 @@
-<?
-if(!defined('GAME'))
-{
-	die();
+<?php
+if (!defined('GAME')) {
+    die();
 }
-include('_incl_data/class/dialog.class.php');
+$dialog = new Dialog;
 $dialog->start($_GET['talk']);
 ?>
 <style>
-body {
-	background-image: url(https://img.new-combats.com/i/misc/showitems/dungeon.jpg);background-repeat:no-repeat;background-position:top right;
-}
+    body {
+        background-image: url(https://img.new-combats.com/i/misc/showitems/dungeon.jpg);
+        background-repeat: no-repeat;
+        background-position: top right;
+    }
 </style>
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr>
-    <td width="300" valign="top"><div align="left"><? echo $dialog->youInfo; ?></div></td>
-    <td valign="top"><div align="center"><H3><? echo $dialog->title; ?></H3></div>
-    <p><?
-	if($u->info['admin'] > 0) {
-		$dpages = '';
-		if(isset($_GET['add_new_page'])) {
-			$dsp = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_dlg` WHERE `id_dg` = "'.mysql_real_escape_string((int)$_GET['talk']).'" AND `qid` = "0" ORDER BY `page` DESC LIMIT 1'));
-			$dsp = ($dsp['page']+1);
-			mysql_query('INSERT INTO `dungeon_dlg` (`id_dg`,`page`,`qid`,`type`) VALUES ("'.mysql_real_escape_string((int)$_GET['talk']).'","'.mysql_real_escape_string((int)$dsp).'","0","1")');
-			die('<script>location.href="main.php?talk='.((int)$_GET['talk']).'&act='.((int)$_GET['act']).'"</script>');
-		}
-		$dsp = mysql_query('SELECT * FROM `dungeon_dlg` WHERE `id_dg` = "'.mysql_real_escape_string((int)$_GET['talk']).'" AND `qid` = "0"');
-		while($dpl = mysql_fetch_array($dsp)) {
-			$dact = mysql_fetch_array(mysql_query('SELECT `id` FROM `dungeon_dlg` WHERE `id_dg` = "'.mysql_real_escape_string((int)$_GET['talk']).'" AND `qid` > "0" AND `action` LIKE "%go|'.$dpl['page'].'%" LIMIT 1'));
-			if($dact['id'] == $_GET['act']) {
-				$dpages .= '[';
-			}
-			$dpages .= '<a href="main.php?talk='.((int)$_GET['talk']).'&act='.$dact['id'].'">'.$dpl['page'].'</a>';
-			if($dact['id'] == $_GET['act']) {
-				$dpages .= ']';
-			}
-			$dpages .= ' ';
-		}
-		$dpages .= ' &nbsp; <a href="main.php?talk='.((int)$_GET['talk']).'&act='.((int)$_GET['act']).'&add_new_page=1" title="�������� ����� ��������"><small>[+]</small></a>';
-		echo '<small style="float:right;border-bottom:1px solid black;padding-bottom:2px;"><a href="javascript:window.open(\'https://new-combats.com/quest_dlg_edit.php?pid='.((int)$dialog->pg).'\',\'winEdi1\',\'width=850,height=400,top=400,left=500,resizable=no,scrollbars=yes,status=no\');" target="_blank">������������� �����</a> &nbsp; | &nbsp; ��������: '.$dpages.'</small><br><br>';	
-	}
-	echo $dialog->dText; ?></p>
-    <p><? echo $dialog->aText; ?></p></td>
-    <td width="300" valign="top"><div align="right"><? echo $dialog->botInfo; ?></div></td>
-  </tr>
+    <tr>
+        <td width="300" valign="top">
+            <div align="left"><? echo $dialog->youInfo; ?></div>
+        </td>
+        <td valign="top">
+            <div align="center"><H3><? echo $dialog->title; ?></H3></div>
+            <p><?
+                if ($u->info['admin'] > 0) {
+                    $dpages = '';
+                    if (isset($_GET['add_new_page'])) {
+                        $dsp = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_dlg` WHERE `id_dg` = "' . mysql_real_escape_string((int)$_GET['talk']) . '" AND `qid` = "0" ORDER BY `page` DESC LIMIT 1'));
+                        $dsp = ($dsp['page'] + 1);
+                        mysql_query('INSERT INTO `dungeon_dlg` (`id_dg`,`page`,`qid`,`type`) VALUES ("' . mysql_real_escape_string((int)$_GET['talk']) . '","' . mysql_real_escape_string((int)$dsp) . '","0","1")');
+                        die('<script>location.href="main.php?talk=' . ((int)$_GET['talk']) . '&act=' . ((int)$_GET['act']) . '"</script>');
+                    }
+                    $dsp = mysql_query('SELECT * FROM `dungeon_dlg` WHERE `id_dg` = "' . mysql_real_escape_string((int)$_GET['talk']) . '" AND `qid` = "0"');
+                    while ($dpl = mysql_fetch_array($dsp)) {
+                        $dact = mysql_fetch_array(mysql_query('SELECT `id` FROM `dungeon_dlg` WHERE `id_dg` = "' . mysql_real_escape_string((int)$_GET['talk']) . '" AND `qid` > "0" AND `action` LIKE "%go|' . $dpl['page'] . '%" LIMIT 1'));
+                        if ($dact['id'] == $_GET['act']) {
+                            $dpages .= '[';
+                        }
+                        $dpages .= '<a href="main.php?talk=' . ((int)$_GET['talk']) . '&act=' . $dact['id'] . '">' . $dpl['page'] . '</a>';
+                        if ($dact['id'] == $_GET['act']) {
+                            $dpages .= ']';
+                        }
+                        $dpages .= ' ';
+                    }
+                    $dpages .= ' &nbsp; <a href="main.php?talk=' . ((int)$_GET['talk']) . '&act=' . ((int)$_GET['act']) . '&add_new_page=1" title="�������� ����� ��������"><small>[+]</small></a>';
+                    echo '<small style="float:right;border-bottom:1px solid black;padding-bottom:2px;"><a href="javascript:window.open(\'https://new-combats.com/quest_dlg_edit.php?pid=' . ((int)$dialog->pg) . '\',\'winEdi1\',\'width=850,height=400,top=400,left=500,resizable=no,scrollbars=yes,status=no\');" target="_blank">������������� �����</a> &nbsp; | &nbsp; ��������: ' . $dpages . '</small><br><br>';
+                }
+                echo $dialog->dText; ?></p>
+            <p><? echo $dialog->aText; ?></p></td>
+        <td width="300" valign="top">
+            <div align="right"><? echo $dialog->botInfo; ?></div>
+        </td>
+    </tr>
 </table>
diff --git a/modules_data/_inv-new.php b/modules_data/_inv-new.php
index a153802a..3464e8e1 100644
--- a/modules_data/_inv-new.php
+++ b/modules_data/_inv-new.php
@@ -106,7 +106,6 @@ $inventorySortBox = '<div id="inventorySortBox">
 if(isset($_SESSION['paged']))$page_look = '<!-- PAGED SEE '.round((int)@$_SESSION['paged']).'-->'; else $page_look = '<!-- PAGED '.$_SESSION['paged'].' -->';
 if($pgs > $pc) {
 	$nlim = ' LIMIT '.$pxc.' , '.$pc.'';
-	#$page_look .= '<table border=0 cellpadding=0 cellspacing=0 width=100% bgcolor="#A5A5A5"><tr><td width=99% align=center>';
 	$page_look .= '<div style="padding:0px;">';
 	$page_look .= '��������: ';
 	$i = 1;
@@ -125,7 +124,6 @@ if($pgs > $pc) {
 			$i++;
 	}
 	$page_look .= '</div>';
-#	$page_look .= '<td nowrap>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr></table>';
 }
 $filt='`lastUPD` DESC';
 if(isset($_GET['boxsort'])){
@@ -338,8 +336,8 @@ function seetext(id) {
 	</tr>
 	<tr>
 		<td width="250" valign="top" align="right"><div style="padding-top: 6px;" align="center"><? $usee = $u->getInfoPers($u->info['id'],0,0,1); if($usee!=false){ echo $usee[0]; }else{ echo 'information is lost.'; } 
-		if($u->info['level']>1 && $u->info['inTurnir'] == 0) { 
-			include('_incl_data/class/_cron_.php');
+		if($u->info['level']>1 && $u->info['inTurnir'] == 0) {
+            $priem = new Priems();
 			$priem->seeMy(1);
 		}
 		if( $u->info['inTurnir'] > 0 ) {
diff --git a/modules_data/_inv-old.php b/modules_data/_inv-old.php
index 44fa97f1..3d9ab9f3 100644
--- a/modules_data/_inv-old.php
+++ b/modules_data/_inv-old.php
@@ -216,41 +216,15 @@ function seetext(id) {
   <tr>
     <td width="250" valign="top" align="right"><div align="center"><? $usee = $u->getInfoPers($u->info['id'],0,0,1); if($usee!=false){ echo $usee[0]; }else{ echo 'information is lost.'; } 
 	if($u->info['level']>1 && $u->info['inTurnir'] == 0)
-	{ 
-		include('_incl_data/class/_cron_.php');
+	{
+        $priem = new Priems();
 		$priem->seeMy(1);
 	}
 	if( $u->info['inTurnir'] > 0 ) {
 		echo '<center><a href="/main.php?inv&remitem&otdel='.round((int)$_GET['otdel']).'">����� ���</a></center>';
 	}
 	echo '<br>'.$u->info_remont();
-	if( $u->info['inTurnir'] == 0 ) {
-		/*$bns = mysql_fetch_array(mysql_query('SELECT `id`,`time` FROM `aaa_bonus` WHERE `uid` = "'.$u->info['id'].'" AND `time` > '.time().' LIMIT 1'));
-		if(isset($bns['id'])) {
-			$bns2 = '����� '.$u->timeOut($bns['time']-time());
-			$bns1 = '0';
-			$bns3 = '';
-		}else{
-			$bns2 = '';
-			$bns1 = '';
-			$bns3 = ' onclick="location.href=\'main.php?inv=1&takebns='.$u->info['nextAct'].'\'"';
-		}
-		if(isset($_GET['takebns']) && $u->newAct($_GET['takebns'])==true && !isset($bns['id'])) {
-			$u->takeBonus();
-			$bns2 = '<div style="width:112px" align="center">����� '.$u->timeOut( 2 * 3600 ).'</div>';
-			$bns1 = '0';
-			$bns3 = '';
-		}
-		?>
-		<div align="center">
-		<div class="on2gb"<?=$bns3?>>
-		<div class="on1gb<?=$bns1?>">
-			<small class="on1gbt<?=$bns1?>"><?=$bns2?></small>
-		</div>
-		</div>
-		</div>
-		<?*/
-	}
+
 	?>
     </div></td>
     <td width="242" valign="top" align="left"><? if( $u->info['inTurnir'] == 0) { include('stats_inv.php'); }else{ include('stats_inv2.php'); } ?></td>    
diff --git a/modules_data/_inv.php b/modules_data/_inv.php
index c425ce31..b3bad89e 100644
--- a/modules_data/_inv.php
+++ b/modules_data/_inv.php
@@ -1,457 +1,489 @@
-<script language="JavaScript">
-	var elem = document.getElementById("se-pre-con");
-	elem.parentNode.removeChild(elem);
-</script>
-
-<?
-session_start();
-if(!defined('GAME')) {
-	die();
-}
-
-$u->info['marker'] = 'inv';
-
-if( isset( $_SESSION['otdel'] ) && !isset($_GET['otdel']) && !isset($_GET['paged'])) {
-	$_GET['otdel'] = $_SESSION['otdel'];
-	$_GET['paged'] = $_SESSION['paged'];
-}elseif( !isset( $_GET['otdel'] ) || ( $_GET['otdel']<1 && $_GET['otdel']>6 ) ) {
-	$_GET['otdel'] = 1; // ���� ������ �� ������.
-	$_GET['paged'] = $_SESSION['paged'] = 0;
-}
-
-if( isset($_GET['otdel']) ) {
-	if( !isset($_GET['paged']) && (isset($_GET['use_pid']) || isset($_GET['sid']) || isset($_GET['oid']) || isset($_GET['usecopr']) || isset($_GET['delcop'])) ) {
-		$_GET['paged'] = $_SESSION['paged']; // use item and load old paging
-	} elseif(isset($_GET['paged']) && $_GET['paged']!='') {
-		$_SESSION['paged'] = $_GET['paged']; // ������ ����� ��������.
-	} elseif(isset($_SESSION['paged']) && $_SESSION['paged']!='' && $_SESSION['otdel']==$_GET['otdel']) {
-		$_GET['paged'] = $_SESSION['paged']; // ���� �������� ��� ������� � ������, ���������� � � �������.
-	} else {
-		$_GET['paged'] = $_SESSION['paged'] = 0;
-	}
-}
-
-$_SESSION['otdel'] = $_GET['otdel']; // ��� �������.
-
-if( isset($_GET['delcop']) ) {
-	mysql_query('DELETE FROM `complects_priem` WHERE `id` = "'.mysql_real_escape_string($_GET['delcop']).'" AND `uid` = "'.$u->info['id'].'" LIMIT 1');
-} elseif( isset($_GET['usecopr']) ) {
-	$cpr = mysql_fetch_array(mysql_query('SELECT * FROM `complects_priem` WHERE `id` = "'.mysql_real_escape_string($_GET['usecopr']).'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'));
-	if( isset($cpr['id']) ) {
-		$u->info['priems'] = $cpr['priems'];
-		mysql_query('UPDATE `stats` SET `priems` = "'.mysql_real_escape_string($cpr['priems']).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
-	}
-}
-
-//��������� ��������
-if( isset($_POST['compname']) ) {
-	$_POST['compname'] = htmlspecialchars($_POST['compname'],NULL,'cp1251');
-	$_POST['compname'] = str_replace("'",'',$_POST['compname']);
-	$_POST['compname'] = str_replace('"','',$_POST['compname']);
-	$ptst = str_replace(' ','',$_POST['compname']);
-	if( $ptst!='' ) {
-		//��������� ��������
-		$ptst = '';
-		$sp = mysql_query('SELECT `inOdet`,`id` FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `inOdet` > 0 AND `inShop` = "0" ORDER BY `inOdet` ASC LIMIT 250');
-		while ( $pl = mysql_fetch_array($sp) ) {
-			$ptst .= $pl['inOdet'].'='.$pl['id'].'|';
-		}
-		$tcm = mysql_fetch_array(mysql_query('SELECT * FROM `save_com` WHERE `uid` = "'.$u->info['id'].'" AND `name` = "'.mysql_real_escape_string($_POST['compname']).'" AND `delete` = "0" LIMIT 1'));
-		if( !isset($tcm['id']) ) {
-			//��������� ����� ��������
-			$ins = mysql_query('INSERT INTO `save_com` (`uid`,`time`,`name`,`val`,`type`) VALUES ("'.$u->info['id'].'","'.time().'","'.mysql_real_escape_string($_POST['compname']).'","'.$ptst.'","0")');
-			if($ins) {
-				$u->error = '�������� &quot;'.$_POST['compname'].'&quot; ��� ������� ��������';
-			} else {
-				$u->error = '�� ������� ��������� �������� �� ����������� ��������';	
-			}
-		}else{
-			//�������� ������������
-			$ins = mysql_query('UPDATE `save_com` SET `val` = "'.$ptst.'" WHERE `id` = "'.$tcm['id'].'" LIMIT 1');
-			if($ins)
-			{
-				$u->error = '�������� &quot;'.$_POST['compname'].'&quot; ��� ������� �������';
-			}else{
-				$u->error = '�� ������� �������� �������� �� ����������� ��������';	
-			}	
-		}
-		unset($ptst,$tcm,$inc);
-	}
-}elseif(isset($_GET['delc1'])) {
-	$cmpl = mysql_query('UPDATE `save_com` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `id` = "'.mysql_real_escape_string($_GET['delc1']).'" LIMIT 1');
-	if($cmpl)
-	{
-		$u->error = '�������� ��� ������� ������';		
-	}
-}
-$filt='`iu`.`lastUPD` DESC';
-if(isset($_GET['boxsort'])){
-	switch($_GET['boxsort']){
-		case'name':
-			$filt='`im`.`name` ASC';
-		break;
-		case'cost':
-			$filt='`im`.`price2` DESC, `im`.`price1` DESC';
-		break;
-		case'type':
-			$filt='`im`.`inslot`';
-		break;
-	}
-}
-
-$pc = 3000;
-$pg = round((int)@$_GET['paged']);
-$pxc = $pg*$pc;
-$nlim = '';
-$pgs = 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 `iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `im`.`inRazdel`="'.mysql_real_escape_string($_GET['otdel']).'" ORDER BY '.$filt.' LIMIT 1'));
-$pgs = $pgs[0];
-$page_look = '';
-$inventorySortBox = '<div id="inventorySortBox">
-	����������: <br/>
-		<input type="button" onclick="inventoryAjax(\'main.php?inv=1&mAjax=true&boxsort=name&otdel=' . intval($_GET['otdel']) . '\');" class="btn btn-danger" value="��������" />
-		<input type="button" onclick="inventoryAjax(\'main.php?inv=1&mAjax=true&boxsort=cost&otdel=' . intval($_GET['otdel']) . '\');" class="btn btn-danger" value="����" />
-		<input type="button" onclick="inventoryAjax(\'main.php?inv=1&mAjax=true&boxsort=type&otdel=' . intval($_GET['otdel']) . '\');" class="btn btn-danger" value="����" />
-</div>';
-
-if(isset($_SESSION['paged']))$page_look = '<!-- PAGED SEE '.round((int)@$_SESSION['paged']).'-->'; else $page_look = '<!-- PAGED '.$_SESSION['paged'].' -->';
-if($pgs > $pc) {
-	$nlim = ' LIMIT '.$pxc.' , '.$pc.'';
-	#$page_look .= '<table border=0 cellpadding=0 cellspacing=0 width=100% bgcolor="#A5A5A5"><tr><td width=99% align=center>';
-	$page_look .= '<div style="padding:0px;">';
-	$page_look .= '��������: ';
-	$i = 1;
-	echo '<style>.pgdas { display:inline-block;background-color:#dadada; padding:2px 4px 1px 4px; font-size:12px;} .pgdas1 { display:inline-block;background-color:#a5a5a5; padding:2px 4px 1px 4px;  font-size:12px;}
-	.pgdas { background: #dadada;background: -moz-linear-gradient(top,  #dadada 50%, #a5a5a5 99%);background: -webkit-gradient(linear, left top, left bottom, color-stop(50%,#dadada), color-stop(99%,#a5a5a5));background: -webkit-linear-gradient(top,  #dadada 50%,#a5a5a5 99%);background: -o-linear-gradient(top,  #dadada 50%,#a5a5a5 99%);background: -ms-linear-gradient(top,  #dadada 50%,#a5a5a5 99%);background: linear-gradient(to bottom,  #dadada 50%,#a5a5a5 99%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\'#dadada\', endColorstr=\'#a5a5a5\',GradientType=0 );
-}
-	.pgdas1 { background: #a5a5a5;  }
-	</style>';
-	while($i <= ceil($pgs/$pc)) {
-		if($i-1 == $pg) {
-			$sep = 1;
-		}else{
-			$sep = '';
-		}
-		$page_look .= '<a class="pgdas'.$sep.'" href="javascript:void(0);" onclick="inventoryAjax(\'main.php?paged='.($i-1).'&inv&mAjax=true&otdel='.round($_GET['otdel']).'\');">'.$i.'</a> ';
-			$i++;
-	}
-	$page_look .= '</div>';
-#	$page_look .= '<td nowrap>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr></table>';
-}
-$filt='`lastUPD` DESC';
-if(isset($_GET['boxsort'])){
-	switch($_GET['boxsort']){
-		case'name':
-			$filt='`name` ASC';
-		break;
-		case'cost':
-			$filt='`price2` DESC, `price1` DESC';
-		break;
-		case'type':
-			$filt='`inslot`';
-		break;
-	}
-}
-$itmAll = $itmAllSee = '';
-if( isset($_GET['boxsort']) && $_GET['otdel']==5 ) {
-	if($_POST['subfilter']) {
-		$itmAll = $u->genInv(1,'`iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `name` LIKE "%'.addcslashes(mysql_real_escape_string($_POST['filter']), '%_').'%" ORDER BY `name` ASC');
-	}
-} else {
-	$itmAll = $u->genInv(1,'`iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `im`.`inRazdel`="'.mysql_real_escape_string($_GET['otdel']).'" ORDER BY '.$filt.''.$nlim);
-}
-
-$itmAllSee = '<tr><td align="center" bgcolor="#c7c7c7">�����</td></tr>';
-if($itmAll[0] > 0)
-	$itmAllSee = $itmAll[2];
-	$clrb = '';
-	$clrba = '';
-	if($u->aves['now'] >= $u->aves['max']) {
-		$clrb = 'color:#BB0000;';
-		$clrba = ' &nbsp; (� ��� ��������!)';
-	}
-$showItems = '<table width="100%" cellspacing="0" cellpadding="0">
-  <tr>
-    <td valign="top"><table style="" width="100%" cellspacing="0" cellpadding="0" bgcolor="#d4d2d2">
-      <tr>
-        <td style="border-top:4px solid #d4d2d2;border-bottom:4px solid #d4d2d2;" width="20%"  ' . (($_GET['otdel'] != 1) ? 'style=""' : 'style=""') .'  align=center bgcolor="' . (($_GET['otdel'] == 1) ? '#a5a5a5' : '' ) .'"><a href="javascript:void(0);" onclick="inventoryAjax(\'main.php?inv=1&mAjax=true&otdel=1&rn=1.1\');">��������������</a></td>
-        <td style="border-top:4px solid #d4d2d2;border-bottom:4px solid #d4d2d2;" width="20%"  ' . (($_GET['otdel'] != 2) ? 'style=""' : 'style=""') .'  align=center bgcolor="' . (($_GET['otdel'] == 2) ? '#a5a5a5' : '' ) .'"><a href="javascript:void(0);" onclick="inventoryAjax(\'main.php?inv=1&mAjax=true&otdel=2&rn=2.1\');">��������</a></td>
-        <td style="border-top:4px solid #d4d2d2;border-bottom:4px solid #d4d2d2;" width="20%" ' . (($_GET['otdel'] != 3) ? 'style=""' : 'style=""') .' align=center bgcolor="' . (($_GET['otdel'] == 3) ? '#a5a5a5' : '' ) .'"><a href="javascript:void(0);" onclick="inventoryAjax(\'main.php?inv=1&mAjax=true&otdel=3&rn=3.1\');">��������</a></td>
-        <td style="border-top:4px solid #d4d2d2;border-bottom:4px solid #d4d2d2;" width="20%"  ' . (($_GET['otdel'] != 6) ? 'style=""' : 'style=""') .'  align=center bgcolor="' . (($_GET['otdel'] == 6) ? '#a5a5a5' : '' ) .'"><a href="javascript:void(0);" onclick="inventoryAjax(\'main.php?inv=1&mAjax=true&otdel=6&rn=6.1\');">����</a></td>
-        <td style="border-top:4px solid #d4d2d2;border-bottom:4px solid #d4d2d2;" width="20%"  ' . (($_GET['otdel'] != 4) ? 'style=""' : 'style="" ') .'  align=center bgcolor="' . (($_GET['otdel'] == 4) ? '#a5a5a5' : '' ) .'"><a href="javascript:void(0);" onclick="inventoryAjax(\'main.php?inv=1&mAjax=true&otdel=4&rn=4.1\');">������</a></td>
-      </tr>
-    </table></td>
-  </tr>
-  <tr>
-    <td align="center" ><table border="0" cellpadding="0" cellspacing="0" width="100%" style="padding-top:0px; border-left: 1px solid #A5A5A5; border-right: 1px solid #A5A5A5;" bgcolor="#a5a5a5">
-      <tr>
-        <td align="left" style="color:#2b2c2c; height: 20 px;font-size:12px; padding-top:2px;'.$clrb.'">
-		<b>&nbsp; ������ (�����: ' . (0+$u->aves['now']) . '/' . $u->aves['max'] . ')</b> '.$clrba.'<!--, ���������: ' . $u->aves['items'] . '-->
-		</td>
-		<td width="450" align="right" style="color:#2b2c2c; padding-top:2px; font-size:12px; position:relative;">
-		<form id="line_filter" style="display:inline;" onsubmit="return false;" prc_adsf="true">
-			����� �� �����: <div style="display:inline-block; position:relative; ">
-			<input type="text" id="inpFilterName"  placeholder="������� �������� ��������..."  autofocus="autofocus" 	size="44" autocomplete="off">
-			<img style="position:absolute; cursor:pointer; right: 2px; top: 3px; width: 12px; height: 12px;" onclick="document.getElementById(\'inpFilterName\').value=\'\';" title="������ ������ (������� Esc)"  src="https://img.new-combats.com/i/clear.gif">
-			<input type="submit" style="display: none" id="inpFilterName_submit" value="������" onclick="return false">
-			<div class="autocomplete-suggestions" style="position: absolute; display: none;top: 15px; left:0px; margin:0px auto; right: 0px; font-size:12px; font-family: Tahoma; max-height: 300px; z-index: 9999;"></div>
-			</div>
-		</form>
-		
-			<input type="button" onclick="inventorySort(this);" style="margin:0px 2px;"  value="����������" />
-			'.$inventorySortBox.'
-		</td>
-      </tr>
-    </table></td>
-  </tr>
-  <tr>
-    <td valign="top" align="center">
-		<div style="height:350px; border-bottom: 1px solid #A5A5A5;border-top: 1px solid #A5A5A5;" id="itmAllSee"><table width="100%" border="0" cellspacing="1" align="center" cellpadding="0" bgcolor="#A5A5A5">' . (( $u->info['invBlock'] == 0 ) ? $itmAllSee : '<div align="center" style="padding:10px;background-color:#A5A5A5;"><form method="post" action="main.php?inv=1&otdel='.$_GET['otdel'].'&relockinvent"><b>������ ������.</b><br><img title="����� ��� �������" src="https://img.new-combats.com/i/items/box_lock.gif"> ������� ������: <input id="relockInv" name="relockInv" type="password"><input type="submit" value="�������"></form></div>' ) . '</table></div></td>
-  </tr>
-</table>
-<script language="JavaScript">
-	if($.cookie(\'invFilterByName\')) $("#ShowInventory").hide();
-	$(document).ready(function (){ $("#ShowInventory").show(); });
-</script>
-';
-if(isset($_GET['mAjax'])){
-	exit($showItems);
-}
-?>
-<script type="text/javascript" src="js/jquery.1.11.js"></script>
-<script type="text/javascript" src="js/jquery.cookie.1.4.1.js"></script>
-<script type="text/javascript" src="js/jquery.autocomplete.js"></script>
-<script> 
-$.cookie('invFilterByName','');
-var UpdateItemList;
-	function inventorySort(e){
-		if ( $('#inventorySortBox').css('display') =='none') {
-			$('#inventorySortBox').show();
-			$(e).addClass('focus');
-		} else {
-			$('#inventorySortBox').hide();
-			$(e).removeClass('focus');
-		} 
-	}
-	function inventoryHeight() {
-		var height = $('#itmAll').height();
-		var heW = $(window).height();
-		heW = heW-148; // 1060
-		height = height-120; // 462
-		var heMax = $("#itmAllSee").children('table').height();
-		if (heMax > height) {
-			if (heW > height) {
-				$("#itmAllSee").height(heW);	
-			} else {
-				$("#itmAllSee").height(height);
-			}
-		} else {
-			$("#itmAllSee").height(heMax);
-		}
-	}
-	$(window).ready(function(){
-		inventoryHeight();
-	});
-	$(window).resize(function(){
-		inventoryHeight();
-	});
-	
-	function seetext(id) {
-		var id = document.getElementById('close_text_itm'+id);
-		if(id.style.display == 'none') {
-			id.style.display = '';
-		}else{
-			id.style.display = 'none';
-		}
-	}
-	
-	function UpdateItemList(){
-		var inv_names = [];
-		var items = $('a.inv_name');
-		$(items).each(function(){ if($.inArray($(this).text(), inv_names)<0) inv_names.push($(this).text()); });
-		$('#inpFilterName').autocomplete({ lookup:inv_names, onSelect: invFilterByName });
-	}
-	function invFilterByName(){
-		$.cookie('invFilterByName', ''); 
-		var val = $('#inpFilterName').val();
-		if (val == '') $("a.inv_name").parent().parent().stop().show();
-		else {
-			$.cookie('invFilterByName', val);
-			$("a.inv_name:not(:contains('" + val + "'))").parents('.item').stop().css('background-color', '').hide();
-			$("a.inv_name:contains('" + val + "')").parents('.item').stop().show(); 
-		}
-	}
-	
-	function inventoryAjax(url){
-		$('#ShowInventory').html('<div align="center" style="padding:10px;background-color:#d4d2d2;color:grey;"><b>��������...</b></div>');
-		$.ajax({
-			url: url,
-			cache: false,
-			dataType: 'html',
-			success: function (html) {
-				$('#ShowInventory').html(html);
-				
-				inventoryHeight();
-				
-				UpdateItemList();
-			}
-		});
-	}
-	
-$(document).ready(function () {
-	
-	function UpdateItemList(){
-		var inv_names = [];
-		var items = $('a.inv_name');
-		$(items).each(function(){ if($.inArray($(this).text(), inv_names)<0) inv_names.push($(this).text()); });
-		$('#inpFilterName').autocomplete({ lookup:inv_names, onSelect: invFilterByName });
-	}
-	
-	function invFilterByName(){
-		$.cookie('invFilterByName', ''); 
-		var val = $('#inpFilterName').val();
-		if (val == '') $("a.inv_name").parent().parent().stop().show();
-		else {
-			$.cookie('invFilterByName', val);
-			$("a.inv_name:not(:contains('" + val + "'))").parents('.item').stop().css('background-color', '').hide();
-			$("a.inv_name:contains('" + val + "')").parents('.item').stop().show(); 
-		}
-	}
-	
-	UpdateItemList(); // �������� ���������.
-	invFilterByNameTimer=null;
-	
-	// ������������� ���������
-	$('#line_filter').submit(function (){ $('#inpFilterName_submit').trigger('click'); });
-	
-	// ���� � ���������� ������ ��������� ������� ��� ������ ������ Up � Down, ������������� ������������� ���������.
-	$('#inpFilterName').keyup(function (e){ $('#inpFilterName_submit').trigger('click'); });
-	
-	// ���������� ������� ����� �������� � ���������� ��� ��� �������� ���������\�������
-	if ($.cookie('invFilterByName')) { $('#inpFilterName').val($.cookie('invFilterByName')); invFilterByName(); }
-	
-	// �������������� � �������� ������� ��� ��������� ������.
-	$('#line_filter').click(function (){ window.clearInterval(invFilterByNameTimer); if($('#inpFilterName').val()=='')invFilterByName(); else invFilterByNameTimer=setTimeout(invFilterByName, 200); return false;} );
-	
-	/*
-	
-	var inv_names = [];
-	$('a.inv_name').each(function(){ if($.inArray($(this).text(), inv_names)<0) inv_names.push($(this).text()); });
-	$('#inpFilterName').autocomplete({lookup:inv_names,onSelect: invFilterByName});
-	$('#inpFilterName').focus();
-	$(document).keyup(function (e) {if (e.which == 13)invFilterByName(); if (e.which == 27) { $('#textSearch').click(); } });
-	$('#line_filter').submit(function (){$('#inpFilterName_submit').trigger('click');});
-	function invFilterByName(){
-		$.cookie('invFilterByName', ''); 
-		var val = $('#inpFilterName').val();
-		if (val == '') $("a.inv_name").parent().parent().stop().show();
-		else {
-			$.cookie('invFilterByName', val);
-			$("a.inv_name:not(:contains('" + val + "'))").parents('.item').stop().css('background-color', '').hide();
-			$("a.inv_name:contains('" + val + "')").parents('.item').stop().show(); 
-		}
-	}
-	invFilterByNameTimer=null;
-	$('#line_filter').click(function (){window.clearInterval(invFilterByNameTimer);if($('#inpFilterName').val()=='')invFilterByName();else invFilterByNameTimer=setTimeout(invFilterByName, 200);return false;});
-	$('#inpFilterName').keyup(function (e){ $('#inpFilterName_submit').trigger('click'); });
-	if ($.cookie('invFilterByName')) {$('#inpFilterName').val($.cookie('invFilterByName'));invFilterByName();}
-	if ($.cookie('invFilterByName')) {$('#inpFilterName').val($.cookie('invFilterByName'));invFilterByName();}
-	*/
-});
-
-jQuery.expr[":"].contains = function (elem, i, match, array){
-	return (elem.textContent || elem.innerText || jQuery.text(elem) || "").toLowerCase().indexOf(match[3].toLowerCase()) >= 0;
-}
- 
-</script> 
-<table width="100%" border="0" cellspacing="0" cellpadding="0">
-	<tr>
-		<td width="250" valign="top" align="right">
-        <div style="padding-top: 6px;" align="center"><? $usee = $u->getInfoPers($u->info['id'],0,0,1); if($usee!=false){ echo $usee[0]; }else{ echo 'information is lost.'; } 
-		//if($u->info['level']>1 && $u->info['inTurnir'] == 0) { 
-			include('_incl_data/class/_cron_.php');
-			echo '<br>';
-			$priem->seeMy(1);
-		//}
-		//if( $u->info['inTurnir'] > 0 ) {
-		//	echo '<center><a href="/main.php?inv&remitem&otdel='.round((int)$_GET['otdel']).'">����� ���</a></center>';
-		//}
-		echo '<br>'.$u->info_remont();
-		//if( $u->info['inTurnir'] == 0 ) {
-			/*$bns = mysql_fetch_array(mysql_query('SELECT `id`,`time` FROM `aaa_bonus` WHERE `uid` = "'.$u->info['id'].'" AND `time` > '.time().' LIMIT 1'));
-			if(isset($bns['id'])) {
-				$bns2 = '����� '.$u->timeOut($bns['time']-time());
-				$bns1 = '0';
-				$bns3 = '';
-			}else{
-				$bns2 = '';
-				$bns1 = '';
-				$bns3 = ' onclick="location.href=\'main.php?inv=1&takebns='.$u->info['nextAct'].'\'"';
-			}
-			if(isset($_GET['takebns']) && $u->newAct($_GET['takebns'])==true && !isset($bns['id'])) {
-				$u->takeBonus();
-				$bns2 = '<div style="width:112px" align="center">����� '.$u->timeOut( 2 * 3600 ).'</div>';
-				$bns1 = '0';
-				$bns3 = '';
-			}
-			?>
-			<div align="center">
-			<div class="on2gb"<?=$bns3?>>
-			<div class="on1gb<?=$bns1?>">
-				<small class="on1gbt<?=$bns1?>"><?=$bns2?></small>
-			</div>
-			</div>
-			</div>
-			<?*/
-		//}
-		?>
-	    </div> 
-			<div align="center"><?php echo $c['counters']; ?></div> 
-		</td>
-	    <td width="287" style="padding-right:7px;" valign="top" align="left"><? include('stats_inv.php'); ?></td>    
-		<td valign="top"  id="itmAll">
-			<div style="z-index: 2; position: relative; width:100%; display:table; box-sizing: border-box; margin: 0px; padding: 0px 5px 3px 5px;">
-				<div style="display:table-cell;"><!-- ������ �������� � ������--></div>
-				<div style="display:table-cell; text-align: right;">
-					<?
-					if ($u->info['admin'] > 0) { ?>

-					<input class="btnnew2" type="button" onclick="location.href='main.php?worklist'" style="color:red" value="������� ����" /> &nbsp; 

-					<input class="btn btn-success" type="button" onclick="top.frames['main'].location='main.php?titul&rnd=<? echo $code; ?>'" value="����������" />

-					<? }
-					/*if($u->info['animal'] != 0) {
-						echo '<input class="btn btn-success" type="button" onclick="top.frames[\'main\'].location=\'main.php?pet=1&rnd='.$code.'\'" value="�����" />';
-					}*/
-					?>
-                    <input class="btn btn-success" type="button" onclick="top.frames['main'].location='main.php?newanimal&rnd=<? echo $code; ?>'" value="�����" />
-                    <input class="btn btn-success" type="button" onclick="window.open('/exp');" value="������� �����" />
-					<input class="btn btn-success" type="button" onclick="window.open('/stats_bonus.php');" value="������ ������" />
-                    <input class="btn btn-success" type="button" onclick="top.frames['main'].location='main.php?act_trf&rnd=<? echo $code; ?>'" value="������ � ���������" />
-					<?
-					if ($u->info['inTurnir'] == 0) { ?><input class="btn btn-success" type="button" onclick="top.frames['main'].location='main.php?obraz&rnd=<? echo $code; ?>'" value="�����" /> <? }
-					$gl = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `reimage` WHERE ((`uid` = "'.$u->info['id'].'" AND `clan` = "0") OR (`clan` = "'.$u->info['clan'].'" AND `clan` > 0)) AND `good` > 0 AND `bad` = "0" LIMIT 1'));
-					if($gl[0] > 0) { ?><input class="btn" type="button" onclick="top.frames['main'].location='main.php?galery&rnd=<? echo $code; ?>'" value="�������" /> <? } unset($gl); 
-					
-					?>
-					<input class="btn btn-success" type="button" onclick="top.frames['main'].location='main.php'" value="���������" />
-					<!--
-					<input class="btnnew" type="button" onclick="top.frames['main'].location='main.php?anketa&amp;rn=<? echo $code; ?>'" value="������" />
-					<input class="btnnew" type="button" onclick="top.frames['main'].location='main.php?act_trf=1&amp;rn=<? echo $code; ?>'" value="����� � ���������" />
-					<input class="btnnew" type="button" style="font-weight:bold;" value="������������" onclick="top.frames['main'].location='main.php?security&amp;rn=<? echo $code; ?>'" />
-					<input class="btnnew" type="button" style="background-color:#A9AFC0" onClick="alert('������ �����������');" value="���������" />
-					-->
-				</div>
-			</div>
-            <table width="100%" border="0" cellspacing="0" cellpadding="0" noresize="noresize">
-				<? if( $u->error != '' )  { ?>
-				<tr>
-					<td>
-						<div style="min-height:18px;padding:2px 4px;"><font color="#FF0000"><b><? echo $u->error; ?></b></font></div>
-					</td>
-				</tr>
-				<? } ?> 
-				<tr>
-					<td id="ShowInventory"><?php echo $showItems; ?></td>
-				</tr>
-			</table>
-		</td>
-	</tr>
+<script language="JavaScript">
+    var elem = document.getElementById("se-pre-con");
+    elem.parentNode.removeChild(elem);
+</script>
+
+<?php
+session_start();
+if (!defined('GAME')) {
+    die();
+}
+
+$u->info['marker'] = 'inv';
+
+if (isset($_SESSION['otdel']) && !isset($_GET['otdel']) && !isset($_GET['paged'])) {
+    $_GET['otdel'] = $_SESSION['otdel'];
+    $_GET['paged'] = $_SESSION['paged'];
+} elseif (!isset($_GET['otdel']) || ($_GET['otdel'] < 1 && $_GET['otdel'] > 6)) {
+    $_GET['otdel'] = 1; // ���� ������ �� ������.
+    $_GET['paged'] = $_SESSION['paged'] = 0;
+}
+
+if (isset($_GET['otdel'])) {
+    if (!isset($_GET['paged']) && (isset($_GET['use_pid']) || isset($_GET['sid']) || isset($_GET['oid']) || isset($_GET['usecopr']) || isset($_GET['delcop']))) {
+        $_GET['paged'] = $_SESSION['paged']; // use item and load old paging
+    } elseif (isset($_GET['paged']) && $_GET['paged'] != '') {
+        $_SESSION['paged'] = $_GET['paged']; // ������ ����� ��������.
+    } elseif (isset($_SESSION['paged']) && $_SESSION['paged'] != '' && $_SESSION['otdel'] == $_GET['otdel']) {
+        $_GET['paged'] = $_SESSION['paged']; // ���� �������� ��� ������� � ������, ���������� � � �������.
+    } else {
+        $_GET['paged'] = $_SESSION['paged'] = 0;
+    }
+}
+
+$_SESSION['otdel'] = $_GET['otdel']; // ��� �������.
+
+if (isset($_GET['delcop'])) {
+    mysql_query(
+        'DELETE FROM `complects_priem` WHERE `id` = "' . mysql_real_escape_string(
+            $_GET['delcop']
+        ) . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
+    );
+} elseif (isset($_GET['usecopr'])) {
+    $cpr = mysql_fetch_array(
+        mysql_query(
+            'SELECT * FROM `complects_priem` WHERE `id` = "' . mysql_real_escape_string(
+                $_GET['usecopr']
+            ) . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
+        )
+    );
+    if (isset($cpr['id'])) {
+        $u->info['priems'] = $cpr['priems'];
+        mysql_query(
+            'UPDATE `stats` SET `priems` = "' . mysql_real_escape_string(
+                $cpr['priems']
+            ) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+        );
+    }
+}
+
+//��������� ��������
+if (isset($_POST['compname'])) {
+    $_POST['compname'] = htmlspecialchars($_POST['compname'], null, 'cp1251');
+    $_POST['compname'] = str_replace("'", '', $_POST['compname']);
+    $_POST['compname'] = str_replace('"', '', $_POST['compname']);
+    $ptst = str_replace(' ', '', $_POST['compname']);
+    if ($ptst != '') {
+        //��������� ��������
+        $ptst = '';
+        $sp = mysql_query(
+            'SELECT `inOdet`,`id` FROM `items_users` WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `inOdet` > 0 AND `inShop` = "0" ORDER BY `inOdet` ASC LIMIT 250'
+        );
+        while ($pl = mysql_fetch_array($sp)) {
+            $ptst .= $pl['inOdet'] . '=' . $pl['id'] . '|';
+        }
+        $tcm = mysql_fetch_array(
+            mysql_query(
+                'SELECT * FROM `save_com` WHERE `uid` = "' . $u->info['id'] . '" AND `name` = "' . mysql_real_escape_string(
+                    $_POST['compname']
+                ) . '" AND `delete` = "0" LIMIT 1'
+            )
+        );
+        if (!isset($tcm['id'])) {
+            //��������� ����� ��������
+            $ins = mysql_query(
+                'INSERT INTO `save_com` (`uid`,`time`,`name`,`val`,`type`) VALUES ("' . $u->info['id'] . '","' . time(
+                ) . '","' . mysql_real_escape_string($_POST['compname']) . '","' . $ptst . '","0")'
+            );
+            if ($ins) {
+                $u->error = '�������� &quot;' . $_POST['compname'] . '&quot; ��� ������� ��������';
+            } else {
+                $u->error = '�� ������� ��������� �������� �� ����������� ��������';
+            }
+        } else {
+            //�������� ������������
+            $ins = mysql_query(
+                'UPDATE `save_com` SET `val` = "' . $ptst . '" WHERE `id` = "' . $tcm['id'] . '" LIMIT 1'
+            );
+            if ($ins) {
+                $u->error = '�������� &quot;' . $_POST['compname'] . '&quot; ��� ������� �������';
+            } else {
+                $u->error = '�� ������� �������� �������� �� ����������� ��������';
+            }
+        }
+        unset($ptst, $tcm, $inc);
+    }
+} elseif (isset($_GET['delc1'])) {
+    $cmpl = mysql_query(
+        'UPDATE `save_com` SET `delete` = "' . time(
+        ) . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `id` = "' . mysql_real_escape_string(
+            $_GET['delc1']
+        ) . '" LIMIT 1'
+    );
+    if ($cmpl) {
+        $u->error = '�������� ��� ������� ������';
+    }
+}
+$filt = '`iu`.`lastUPD` DESC';
+if (isset($_GET['boxsort'])) {
+    switch ($_GET['boxsort']) {
+        case'name':
+            $filt = '`im`.`name` ASC';
+            break;
+        case'cost':
+            $filt = '`im`.`price2` DESC, `im`.`price1` DESC';
+            break;
+        case'type':
+            $filt = '`im`.`inslot`';
+            break;
+    }
+}
+
+$pc = 3000;
+$pg = round((int)@$_GET['paged']);
+$pxc = $pg * $pc;
+$nlim = '';
+$pgs = 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 `iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `im`.`inRazdel`="' . mysql_real_escape_string(
+            $_GET['otdel']
+        ) . '" ORDER BY ' . $filt . ' LIMIT 1'
+    )
+);
+$pgs = $pgs[0];
+$page_look = '';
+$inventorySortBox = '<div id="inventorySortBox">
+	����������: <br/>
+		<input type="button" onclick="inventoryAjax(\'main.php?inv=1&mAjax=true&boxsort=name&otdel=' . intval(
+        $_GET['otdel']
+    ) . '\');" class="btn btn-danger" value="��������" />
+		<input type="button" onclick="inventoryAjax(\'main.php?inv=1&mAjax=true&boxsort=cost&otdel=' . intval(
+        $_GET['otdel']
+    ) . '\');" class="btn btn-danger" value="����" />
+		<input type="button" onclick="inventoryAjax(\'main.php?inv=1&mAjax=true&boxsort=type&otdel=' . intval(
+        $_GET['otdel']
+    ) . '\');" class="btn btn-danger" value="����" />
+</div>';
+
+if (isset($_SESSION['paged'])) {
+    $page_look = '<!-- PAGED SEE ' . round((int)@$_SESSION['paged']) . '-->';
+} else {
+    $page_look = '<!-- PAGED ' . $_SESSION['paged'] . ' -->';
+}
+if ($pgs > $pc) {
+    $nlim = ' LIMIT ' . $pxc . ' , ' . $pc . '';
+    $page_look .= '<div style="padding:0px;">';
+    $page_look .= '��������: ';
+    $i = 1;
+    echo '<style>.pgdas { display:inline-block;background-color:#dadada; padding:2px 4px 1px 4px; font-size:12px;} .pgdas1 { display:inline-block;background-color:#a5a5a5; padding:2px 4px 1px 4px;  font-size:12px;}
+	.pgdas { background: #dadada;background: -moz-linear-gradient(top,  #dadada 50%, #a5a5a5 99%);background: -webkit-gradient(linear, left top, left bottom, color-stop(50%,#dadada), color-stop(99%,#a5a5a5));background: -webkit-linear-gradient(top,  #dadada 50%,#a5a5a5 99%);background: -o-linear-gradient(top,  #dadada 50%,#a5a5a5 99%);background: -ms-linear-gradient(top,  #dadada 50%,#a5a5a5 99%);background: linear-gradient(to bottom,  #dadada 50%,#a5a5a5 99%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\'#dadada\', endColorstr=\'#a5a5a5\',GradientType=0 );
+}
+	.pgdas1 { background: #a5a5a5;  }
+	</style>';
+    while ($i <= ceil($pgs / $pc)) {
+        if ($i - 1 == $pg) {
+            $sep = 1;
+        } else {
+            $sep = '';
+        }
+        $page_look .= '<a class="pgdas' . $sep . '" href="javascript:void(0);" onclick="inventoryAjax(\'main.php?paged=' . ($i - 1) . '&inv&mAjax=true&otdel=' . round(
+                $_GET['otdel']
+            ) . '\');">' . $i . '</a> ';
+        $i++;
+    }
+    $page_look .= '</div>';
+}
+$filt = '`lastUPD` DESC';
+if (isset($_GET['boxsort'])) {
+    switch ($_GET['boxsort']) {
+        case'name':
+            $filt = '`name` ASC';
+            break;
+        case'cost':
+            $filt = '`price2` DESC, `price1` DESC';
+            break;
+        case'type':
+            $filt = '`inslot`';
+            break;
+    }
+}
+$itmAll = $itmAllSee = '';
+if (isset($_GET['boxsort']) && $_GET['otdel'] == 5) {
+    if ($_POST['subfilter']) {
+        $itmAll = $u->genInv(
+            1,
+            '`iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `name` LIKE "%' . addcslashes(
+                mysql_real_escape_string($_POST['filter']), '%_'
+            ) . '%" ORDER BY `name` ASC'
+        );
+    }
+} else {
+    $itmAll = $u->genInv(
+        1,
+        '`iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `im`.`inRazdel`="' . mysql_real_escape_string(
+            $_GET['otdel']
+        ) . '" ORDER BY ' . $filt . '' . $nlim
+    );
+}
+
+$itmAllSee = '<tr><td align="center" bgcolor="#c7c7c7">�����</td></tr>';
+if ($itmAll[0] > 0)
+    $itmAllSee = $itmAll[2];
+    $clrb = '';
+    $clrba = '';
+if ($u->aves['now'] >= $u->aves['max']) {
+    $clrb = 'color:#BB0000;';
+    $clrba = ' &nbsp; (� ��� ��������!)';
+}
+$showItems = '
+<table width="100%" cellspacing="0" cellpadding="0">
+  <tr>
+    <td valign="top">
+        <table width="100%" style="" cellspacing="0" cellpadding="0" bgcolor="#d4d2d2">
+          <tr>
+            <td style="border-top:4px solid #d4d2d2;border-bottom:4px solid #d4d2d2;" width="20%"  ' . (($_GET['otdel'] != 1) ? 'style=""' : 'style=""') . '  align=center bgcolor="' . (($_GET['otdel'] == 1) ? '#a5a5a5' : '') . '"><a href="javascript:void(0);" onclick="inventoryAjax(\'main.php?inv=1&mAjax=true&otdel=1&rn=1.1\');">��������������</a></td>
+            <td style="border-top:4px solid #d4d2d2;border-bottom:4px solid #d4d2d2;" width="20%"  ' . (($_GET['otdel'] != 2) ? 'style=""' : 'style=""') . '  align=center bgcolor="' . (($_GET['otdel'] == 2) ? '#a5a5a5' : '') . '"><a href="javascript:void(0);" onclick="inventoryAjax(\'main.php?inv=1&mAjax=true&otdel=2&rn=2.1\');">��������</a></td>
+            <td style="border-top:4px solid #d4d2d2;border-bottom:4px solid #d4d2d2;" width="20%" ' . (($_GET['otdel'] != 3) ? 'style=""' : 'style=""') . ' align=center bgcolor="' . (($_GET['otdel'] == 3) ? '#a5a5a5' : '') . '"><a href="javascript:void(0);" onclick="inventoryAjax(\'main.php?inv=1&mAjax=true&otdel=3&rn=3.1\');">��������</a></td>
+            <td style="border-top:4px solid #d4d2d2;border-bottom:4px solid #d4d2d2;" width="20%"  ' . (($_GET['otdel'] != 6) ? 'style=""' : 'style=""') . '  align=center bgcolor="' . (($_GET['otdel'] == 6) ? '#a5a5a5' : '') . '"><a href="javascript:void(0);" onclick="inventoryAjax(\'main.php?inv=1&mAjax=true&otdel=6&rn=6.1\');">����</a></td>
+            <td style="border-top:4px solid #d4d2d2;border-bottom:4px solid #d4d2d2;" width="20%"  ' . (($_GET['otdel'] != 4) ? 'style=""' : 'style="" ') . '  align=center bgcolor="' . (($_GET['otdel'] == 4) ? '#a5a5a5' : '') . '"><a href="javascript:void(0);" onclick="inventoryAjax(\'main.php?inv=1&mAjax=true&otdel=4&rn=4.1\');">������</a></td>
+          </tr>
+    </table></td>
+  </tr>
+  <tr>
+    <td align="center" ><table border="0" cellpadding="0" cellspacing="0" width="100%" style="padding-top:0px; border-left: 1px solid #A5A5A5; border-right: 1px solid #A5A5A5;" bgcolor="#a5a5a5">
+      <tr>
+        <td align="left" style="color:#2b2c2c; height: 20 px;font-size:12px; padding-top:2px;' . $clrb . '">
+		<b>&nbsp; ������ (�����: ' . (0 + $u->aves['now']) . '/' . $u->aves['max'] . ')</b> ' . $clrba . '
+			<input type="submit" style="display: none" id="inpFilterName_submit" value="������" onclick="return false">
+			<div class="autocomplete-suggestions" style="position: absolute; display: none;top: 15px; left:0; margin:0px auto; right: 0px; font-size:12px; font-family: Tahoma; max-height: 300px; z-index: 9999;"></div>
+			</div>
+		</form>
+		
+			<input type="button" onclick="inventorySort(this);" style="margin:0px 2px;"  value="����������" />
+			' . $inventorySortBox . '
+		</td>
+      </tr>
+    </table></td>
+  </tr>
+  <tr>
+    <td valign="top" align="center">
+		<div style="height:350px; border-bottom: 1px solid #A5A5A5;border-top: 1px solid #A5A5A5;" id="itmAllSee"><table width="100%" border="0" cellspacing="1" align="center" cellpadding="0" bgcolor="#A5A5A5">' . (($u->info['invBlock'] == 0) ? $itmAllSee : '<div align="center" style="padding:10px;background-color:#A5A5A5;"><form method="post" action="main.php?inv=1&otdel=' . $_GET['otdel'] . '&relockinvent"><b>������ ������.</b><br><img title="����� ��� �������" src="https://img.new-combats.com/i/items/box_lock.gif"> ������� ������: <input id="relockInv" name="relockInv" type="password"><input type="submit" value="�������"></form></div>') . '</table></div></td>
+  </tr>
+</table>
+<script language="JavaScript">
+	if($.cookie(\'invFilterByName\')) $("#ShowInventory").hide();
+	$(document).ready(function (){ $("#ShowInventory").show(); });
+</script>
+';
+if (isset($_GET['mAjax'])) {
+    exit($showItems);
+}
+?>
+<script type="text/javascript" src="js/jquery.1.11.js"></script>
+<script type="text/javascript" src="js/jquery.cookie.1.4.1.js"></script>
+<script type="text/javascript" src="js/jquery.autocomplete.js"></script>
+<script>
+    $.cookie('invFilterByName', '');
+    var UpdateItemList;
+
+    function inventorySort(e) {
+        if ($('#inventorySortBox').css('display') == 'none') {
+            $('#inventorySortBox').show();
+            $(e).addClass('focus');
+        } else {
+            $('#inventorySortBox').hide();
+            $(e).removeClass('focus');
+        }
+    }
+
+    function inventoryHeight() {
+        var height = $('#itmAll').height();
+        var heW = $(window).height();
+        heW = heW - 148; // 1060
+        height = height - 120; // 462
+        var heMax = $("#itmAllSee").children('table').height();
+        if (heMax > height) {
+            if (heW > height) {
+                $("#itmAllSee").height(heW);
+            } else {
+                $("#itmAllSee").height(height);
+            }
+        } else {
+            $("#itmAllSee").height(heMax);
+        }
+    }
+
+    $(window).ready(function () {
+        inventoryHeight();
+    });
+    $(window).resize(function () {
+        inventoryHeight();
+    });
+
+    function seetext(id) {
+        var id = document.getElementById('close_text_itm' + id);
+        if (id.style.display == 'none') {
+            id.style.display = '';
+        } else {
+            id.style.display = 'none';
+        }
+    }
+
+    function UpdateItemList() {
+        var inv_names = [];
+        var items = $('a.inv_name');
+        $(items).each(function () {
+            if ($.inArray($(this).text(), inv_names) < 0) inv_names.push($(this).text());
+        });
+        $('#inpFilterName').autocomplete({lookup: inv_names, onSelect: invFilterByName});
+    }
+
+    function invFilterByName() {
+        $.cookie('invFilterByName', '');
+        var val = $('#inpFilterName').val();
+        if (val == '') $("a.inv_name").parent().parent().stop().show();
+        else {
+            $.cookie('invFilterByName', val);
+            $("a.inv_name:not(:contains('" + val + "'))").parents('.item').stop().css('background-color', '').hide();
+            $("a.inv_name:contains('" + val + "')").parents('.item').stop().show();
+        }
+    }
+
+    function inventoryAjax(url) {
+        $('#ShowInventory').html('<div align="center" style="padding:10px;background-color:#d4d2d2;color:grey;"><b>��������...</b></div>');
+        $.ajax({
+            url: url,
+            cache: false,
+            dataType: 'html',
+            success: function (html) {
+                $('#ShowInventory').html(html);
+
+                inventoryHeight();
+
+                UpdateItemList();
+            }
+        });
+    }
+
+    $(document).ready(function () {
+
+        function UpdateItemList() {
+            var inv_names = [];
+            var items = $('a.inv_name');
+            $(items).each(function () {
+                if ($.inArray($(this).text(), inv_names) < 0) inv_names.push($(this).text());
+            });
+            $('#inpFilterName').autocomplete({lookup: inv_names, onSelect: invFilterByName});
+        }
+
+        function invFilterByName() {
+            $.cookie('invFilterByName', '');
+            var val = $('#inpFilterName').val();
+            if (val == '') $("a.inv_name").parent().parent().stop().show();
+            else {
+                $.cookie('invFilterByName', val);
+                $("a.inv_name:not(:contains('" + val + "'))").parents('.item').stop().css('background-color', '').hide();
+                $("a.inv_name:contains('" + val + "')").parents('.item').stop().show();
+            }
+        }
+
+        UpdateItemList(); // �������� ���������.
+        invFilterByNameTimer = null;
+
+        // ������������� ���������
+        $('#line_filter').submit(function () {
+            $('#inpFilterName_submit').trigger('click');
+        });
+
+        // ���� � ���������� ������ ��������� ������� ��� ������ ������ Up � Down, ������������� ������������� ���������.
+        $('#inpFilterName').keyup(function (e) {
+            $('#inpFilterName_submit').trigger('click');
+        });
+
+        // ���������� ������� ����� �������� � ���������� ��� ��� �������� ���������\�������
+        if ($.cookie('invFilterByName')) {
+            $('#inpFilterName').val($.cookie('invFilterByName'));
+            invFilterByName();
+        }
+
+        // �������������� � �������� ������� ��� ��������� ������.
+        $('#line_filter').click(function () {
+            window.clearInterval(invFilterByNameTimer);
+            if ($('#inpFilterName').val() == '') invFilterByName(); else invFilterByNameTimer = setTimeout(invFilterByName, 200);
+            return false;
+        });
+
+
+    });
+
+    jQuery.expr[":"].contains = function (elem, i, match, array) {
+        return (elem.textContent || elem.innerText || jQuery.text(elem) || "").toLowerCase().indexOf(match[3].toLowerCase()) >= 0;
+    }
+
+</script>
+<table width="100%" border="0" cellspacing="0" cellpadding="0">
+    <tr>
+        <td width="250" valign="top" align="right">
+            <div style="padding-top: 6px; text-align: center">
+                <?php
+                $usee = $u->getInfoPers($u->info['id'], 0, 0, 1);
+                echo $usee ? $usee[0] : 'information is lost.';
+                $priem = new Priems();
+                echo '<br>';
+                $priem->seeMy(1);
+                echo '<br>' . $u->info_remont();
+                ?>
+            </div>
+            <div style="text-align: center">
+                <?= $c['counters']; ?>
+            </div>
+        </td>
+        <td width="287" style="padding-right:7px;" valign="top" align="left">
+            <?php include('stats_inv.php'); ?>
+        </td>
+        <td valign="top" id="itmAll">
+            <div style="z-index: 2; position: relative; width:100%; display:table; box-sizing: border-box; margin: 0; padding: 0 5px 3px 5px;">
+                <div style="display:table-cell;"><!-- ������ �������� � ������--></div>
+                <div style="display:table-cell; text-align: right;">
+                    <input class="btn btn-success" type="button"
+                           onclick="top.frames['main'].location='main.php?titul&rnd=<?php
+                           echo $code; ?>'" value="����������"/>
+                    <input class="btn btn-success" type="button"
+                           onclick="top.frames['main'].location='main.php?newanimal&rnd=<?php
+                           echo $code; ?>'" value="�����"/>
+                    <input class="btn btn-success" type="button" onclick="window.open('/exp');" value="������� �����"/>
+                    <input class="btn btn-success" type="button" onclick="window.open('/stats_bonus.php');"
+                           value="������ ������"/>
+                    <input class="btn btn-success" type="button"
+                           onclick="top.frames['main'].location='main.php?act_trf&rnd=<?php
+                           echo $code; ?>'" value="������ � ���������"/>
+                    <?php if (!$u->info['inTurnir']): ?>
+                        <input class="btn btn-success" type="button"
+                               onclick="top.frames['main'].location='main.php?obraz&rnd=<?= $code; ?>'" value="�����"/>
+                    <?php endif;
+                    $stmt = $pdo->prepare(
+                        'select count(*) from reimage where ((uid = ? and clan = 0) or clan = ?) and good != 0 and bad = 0'
+                    );
+                    $stmt->execute([$u->info['id'], $u->info['clan']]);
+                    if ($stmt->fetchColumn()) { ?>
+                        <input class="btn" type="button"
+                               onclick="top.frames['main'].location='main.php?galery&rnd=<?= $code; ?>'"
+                               value="�������"/>
+                        <?php
+                    }
+                    unset($stmt);
+                    ?>
+                    <input class="btn btn-success" type="button" onclick="top.frames['main'].location='main.php'"
+                           value="���������"/>
+                </div>
+            </div>
+
+            <table width="100%" border="0" cellspacing="0" cellpadding="0" noresize="noresize">
+                <?php if ($u->error): ?>
+                    <tr>
+                        <td>
+                            <div style="min-height:18px;padding:2px 4px; color: red; font-weight: bold;">
+                                <?= $u->error ?>
+                            </div>
+                        </td>
+                    </tr>
+                <?php endif; ?>
+                <tr>
+                    <td id="ShowInventory">
+                        <?= $showItems; ?>
+                    </td>
+                </tr>
+            </table>
+        </td>
+    </tr>
 </table>
\ No newline at end of file
diff --git a/modules_data/_light.php b/modules_data/_light.php
index cc7f6f79..75086699 100644
--- a/modules_data/_light.php
+++ b/modules_data/_light.php
@@ -115,10 +115,10 @@ function closeMod()
 	$go = 0;
 if(isset($_GET['go'])){$go = round($_GET['go']);}
 if($go==2 && $u->info['admin']>0){
-	include('moder/new/editor.php');
+	require_once('moder/new/editor.php');
 }
 if($go==1 && $p['editAlign']==1){
-	include('moder/new/editalign.php');
+	require_once('moder/new/editalign.php');
 }
 ?>
 <div id="useMagic" style="display:none; position:absolute; border:solid 1px #776f59; left: 50px; top: 186px;" class="modpow">
@@ -155,13 +155,13 @@ $uer = '';
 	if(isset($_GET['usemod'])){
 	$srok = array(5=>'5 �����',15=>'15 �����',30=>'30 �����',60=>'���� ���',180=>'��� ����',360=>'����� �����',720=>'���������� �����',1440=>'���� �����',4320=>'���� �����');
 	$srokt = array(1=>'1 ����',3=>'3 ���',7=>'������',14=>'2 ������',30=>'�����',60=>'2 ������',365=>'���',24=>'���������',6=>'�����');
-	if(isset($_POST['usem1'])){include('moder/usem1.php');}
-	elseif(isset($_POST['usem2'])){include('moder/usem2.php');}
-	elseif(isset($_POST['usesm'])){include('moder/usesm.php');}
-	elseif(isset($_POST['useban'])){include('moder/useban.php');}
-	elseif(isset($_POST['useunban'])){include('moder/useunban.php');}
-	elseif(isset($_POST['usehaos'])){include('moder/usehaos.php');}
-	elseif(isset($_POST['useshaos'])){include('moder/useshaos.php');}
+	if(isset($_POST['usem1'])){require_once('moder/usem1.php');}
+	elseif(isset($_POST['usem2'])){require_once('moder/usem2.php');}
+	elseif(isset($_POST['usesm'])){require_once('moder/usesm.php');}
+	elseif(isset($_POST['useban'])){require_once('moder/useban.php');}
+	elseif(isset($_POST['useunban'])){require_once('moder/useunban.php');}
+	elseif(isset($_POST['usehaos'])){require_once('moder/usehaos.php');}
+	elseif(isset($_POST['useshaos'])){require_once('moder/useshaos.php');}
 	
 	}
 														/*���������� ������� � ������� ;)*/
diff --git a/modules_data/_locations.php b/modules_data/_locations.php
index e1b874b4..0ba77fdb 100644
--- a/modules_data/_locations.php
+++ b/modules_data/_locations.php
@@ -328,7 +328,7 @@ if(isset($_GET['loc']))
 
 if($u->info['room']==209)
 {
-	include('_incl_data/class/__zv.php');
+    $zv = new FightRequest();
 }
 
 if($re!=''){ $re = $re.'&nbsp;'; }
diff --git a/modules_data/_mod.php b/modules_data/_mod.php
index 2677b723..588c485a 100644
--- a/modules_data/_mod.php
+++ b/modules_data/_mod.php
@@ -233,7 +233,7 @@ if(isset($p['id']) || $u->info['align']==1 || $u->info['align']==3)
 	
 	if(isset($_GET['newuidinv'])) {	
 		$_GET['newuidinv'] = htmlspecialchars($_GET['newuidinv']);
-		include('_inv_moder.php');
+		require_once('_inv_moder.php');
 		die();
 	}
 	if($go == 3 && $u->info['admin'] > 0) {
@@ -833,90 +833,90 @@ function closeMod()
 		//���������� ��������
 		if(isset($_POST['usevampir']))
 		{
-			include('moder/usevampir.php');	
+			require_once('moder/usevampir.php');	
 		}elseif(isset($_POST['usem1']))
 		{
-			include('moder/usem1.php');					
+			require_once('moder/usem1.php');					
 		}elseif(isset($_POST['usem2']))
 		{
-			include('moder/usem2.php');					
+			require_once('moder/usem2.php');					
 		}elseif(isset($_POST['usesm']))
 		{
-			include('moder/usesm.php');	
+			require_once('moder/usesm.php');	
 		}elseif(isset($_POST['useban']))
 		{
-			include('moder/useban.php');
+			require_once('moder/useban.php');
 		}elseif(isset($_POST['useunban']))
 		{
-			include('moder/useunban.php');
+			require_once('moder/useunban.php');
 		}elseif(isset($_POST['usehaos']))
 		{
-			include('moder/usehaos.php');
+			require_once('moder/usehaos.php');
 		}elseif(isset($_POST['useshaos']))
 		{
-			include('moder/useshaos.php');
+			require_once('moder/useshaos.php');
 		}elseif(isset($_POST['teleport'])){
-			include('moder/teleport.php');
+			require_once('moder/teleport.php');
 		}elseif(isset($_POST['teleport-cometome'])){
-			include('moder/teleport-cometome.php');
+			require_once('moder/teleport-cometome.php');
 		}elseif(isset($_POST['usedeletinfo']))
 		{
-			include('moder/usedeletinfo.php');
+			require_once('moder/usedeletinfo.php');
 		}elseif(isset($_POST['unusedeletinfo']))
 		{
-			include('moder/unusedeletinfo.php');
+			require_once('moder/unusedeletinfo.php');
 		}elseif(isset($_POST['unmoder']))
 		{
-			include('moder/unmoder.php');
+			require_once('moder/unmoder.php');
 		}elseif(isset($_POST['gomoder']))
 		{
-			include('moder/moder.php');
+			require_once('moder/moder.php');
 		}elseif(isset($_POST['use_carcer'])){
-		    include('moder/use_carcer.php');
+		    require_once('moder/use_carcer.php');
 		}elseif(isset($_POST['v_carcer'])){
-		    include('moder/v_carcer.php');
+		    require_once('moder/v_carcer.php');
 		}elseif(isset($_POST['usepro'])){
-		    include('moder/usepro.php');
+		    require_once('moder/usepro.php');
 		}elseif(isset($_POST['usemarry'])){
-		    include('moder/usemarry.php');
+		    require_once('moder/usemarry.php');
 		}elseif(isset($_POST['useunmarry'])){
-		    include('moder/useunmarry.php');
+		    require_once('moder/useunmarry.php');
 		}elseif(isset($_POST['usenoper'])) {
-			include('moder/usenoper.php');
+			require_once('moder/usenoper.php');
 		}elseif(isset($_POST['useunnoper'])) {
-			include('moder/useunnoper.php');
+			require_once('moder/useunnoper.php');
 		}elseif(isset($_POST['usenoper2'])) {
-			include('moder/usenoper2.php');
+			require_once('moder/usenoper2.php');
 		}elseif(isset($_POST['useunnoper2'])) {
-			include('moder/useunnoper2.php');
+			require_once('moder/useunnoper2.php');
 		}elseif(isset($_POST['useunalign'])) {
-			include('moder/useunalign.php');
+			require_once('moder/useunalign.php');
 		}elseif(isset($_POST['usehpa'])) {
-			include('moder/usehpa.php');
+			require_once('moder/usehpa.php');
 		}elseif(isset($_POST['usempa'])) {
-			include('moder/usempa.php');
+			require_once('moder/usempa.php');
 		}elseif(isset($_POST['usenevid'])) {
-			include('moder/usenevid.php');
+			require_once('moder/usenevid.php');
 		}elseif(isset($_POST['usepro2'])) {
-			include('moder/usepro2.php');
+			require_once('moder/usepro2.php');
 		}elseif(isset($_POST['useunfight'])) {
-			include('moder/useunfight.php');
+			require_once('moder/useunfight.php');
 		}elseif(isset($_POST['usesex'])) {
-			include('moder/usesex.php');
+			require_once('moder/usesex.php');
 		}elseif(isset($_POST['uselogin'])) {
-			include('moder/uselogin.php');
+			require_once('moder/uselogin.php');
 		}elseif(isset($_POST['usealign7'])) {
-			include('moder/usealign7.php');
+			require_once('moder/usealign7.php');
 		}elseif(isset($_POST['usealign3'])) {
-			include('moder/usealign3.php');
+			require_once('moder/usealign3.php');
 		}elseif(isset($_POST['usealign1'])) {
-			include('moder/usealign1.php');
+			require_once('moder/usealign1.php');
 		}elseif(isset($_POST['useuntravm'])) {
-			include('moder/useuntravm.php');
+			require_once('moder/useuntravm.php');
 		}elseif(isset($_POST['useatack'])) {
-			include('moder/useatack.php');
+			require_once('moder/useatack.php');
 		}elseif(isset($_POST['100kexp'])) {
-			include('moder/100kexp.php');
+			require_once('moder/100kexp.php');
 		}
 	}
 	
diff --git a/modules_data/_umenie.php b/modules_data/_umenie.php
index 769b8043..32677646 100644
--- a/modules_data/_umenie.php
+++ b/modules_data/_umenie.php
@@ -1,68 +1,81 @@
-<?
-if(!defined('GAME'))
-{
-	die();
+<?php
+if (!defined('GAME')) {
+    die();
 }
 
 $u->info['marker'] = 'skills';
 
-if(isset($_GET['delcop'])) {
-	mysql_query('DELETE FROM `complects_priem` WHERE `id` = "'.mysql_real_escape_string($_GET['delcop']).'" AND `uid` = "'.$u->info['id'].'" LIMIT 1');
-}elseif(isset($_GET['usecopr'])) {
-	$cpr = mysql_fetch_array(mysql_query('SELECT * FROM `complects_priem` WHERE `id` = "'.mysql_real_escape_string($_GET['usecopr']).'" AND `uid` = "'.$u->info['id'].'" LIMIT 1'));
-	if(isset($cpr['id'])) {
-		$u->info['priems'] = $cpr['priems'];
-		mysql_query('UPDATE `stats` SET `priems` = "'.mysql_real_escape_string($cpr['priems']).'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
-	}
-}elseif(isset($_GET['clear_abil']) && $u->info['priems'] != '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') {
-	$u->info['priems'] = '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';
-	mysql_query('UPDATE `stats` SET `priems` = "'.$u->info['priems'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
+if (isset($_GET['delcop'])) {
+    mysql_query(
+        'DELETE FROM `complects_priem` WHERE `id` = "' . mysql_real_escape_string(
+            $_GET['delcop']
+        ) . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
+    );
+} elseif (isset($_GET['usecopr'])) {
+    $cpr = mysql_fetch_array(
+        mysql_query(
+            'SELECT * FROM `complects_priem` WHERE `id` = "' . mysql_real_escape_string(
+                $_GET['usecopr']
+            ) . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
+        )
+    );
+    if (isset($cpr['id'])) {
+        $u->info['priems'] = $cpr['priems'];
+        mysql_query(
+            'UPDATE `stats` SET `priems` = "' . mysql_real_escape_string(
+                $cpr['priems']
+            ) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+        );
+    }
+} elseif (isset($_GET['clear_abil']) && $u->info['priems'] != '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') {
+    $u->info['priems'] = '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';
+    mysql_query(
+        'UPDATE `stats` SET `priems` = "' . $u->info['priems'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+    );
 }
 
-include_once('_incl_data/class/_cron_.php');
+$priem = new Priems();
 
-if(isset($_GET['use_priem']))
-{
-	$priem->uns((int)$_GET['use_priem']);
-}elseif(isset($_GET['unuse_priem']))
-{
-	$priem->reuns((int)$_GET['unuse_priem']);
+if (isset($_GET['use_priem'])) {
+    $priem->uns((int)$_GET['use_priem']);
+} elseif (isset($_GET['unuse_priem'])) {
+    $priem->reuns((int)$_GET['unuse_priem']);
 }
 
 //����� ������
 $znn = '';
 $toms = 0;
-$sp = mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars` = "read" AND `time` < '.time().'');
-while($pl = mysql_fetch_array($sp))
-{
-	$itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$pl['vals'].'" LIMIT 1'));
-	if(isset($itm['id']))
-	{
-		if( $itm['id'] >= 1044 && $itm['id'] <=1047 ) {
-			$toms++;
-		}
-		$lvar = '<br>���� ��������: '.date('d.m.Y',$pl['time']).'';	
-		$znn .= '<a target="_blank" href="https://lib.'.$c['host'].'/items_info.php?id='.$pl['vals'].'&rnd='.$code.'"><img style="margin:2px;" src="https://img.new-combats.com/i/items/'.$itm['img'].'" onMouseOver="top.hi(this,\'�������: <b>'.$itm['name'].'</b>'.$lvar.'\',event,3,0,1,1);" onMouseOut="top.hic();" onMouseDown="top.hic();" /></a> ';
-	}else{
-		$znn .= '<img style="margin:2px;" src="https://img.new-combats.com/i/items/nozn.gif" title="���������: ����������� ������" /> ';
-	}
+$sp = mysql_query(
+    'SELECT * FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "read" AND `time` < ' . time() . ''
+);
+while ($pl = mysql_fetch_array($sp)) {
+    $itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $pl['vals'] . '" LIMIT 1'));
+    if (isset($itm['id'])) {
+        if ($itm['id'] >= 1044 && $itm['id'] <= 1047) {
+            $toms++;
+        }
+        $lvar = '<br>���� ��������: ' . date('d.m.Y', $pl['time']) . '';
+        $znn .= '<a target="_blank" href="https://lib.' . $c['host'] . '/items_info.php?id=' . $pl['vals'] . '&rnd=' . $code . '"><img style="margin:2px;" src="https://img.new-combats.com/i/items/' . $itm['img'] . '" onMouseOver="top.hi(this,\'�������: <b>' . $itm['name'] . '</b>' . $lvar . '\',event,3,0,1,1);" onMouseOut="top.hic();" onMouseDown="top.hic();" /></a> ';
+    } else {
+        $znn .= '<img style="margin:2px;" src="https://img.new-combats.com/i/items/nozn.gif" title="���������: ����������� ������" /> ';
+    }
 }
 
-if( 10+$toms > $u->info['priemslot'] ) {	
-	$u->info['priemslot'] = 10 + $toms;
-	mysql_query('UPDATE `stats` SET `priemslot` = "'.$u->info['priemslot'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
+if (10 + $toms > $u->info['priemslot']) {
+    $u->info['priemslot'] = 10 + $toms;
+    mysql_query(
+        'UPDATE `stats` SET `priemslot` = "' . $u->info['priemslot'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+    );
 }
 
 $rzsee = 1;
 
-if(isset($_GET['rz']))
-{
-	$rzsee = round((int)$_GET['rz']);
-	if($rzsee<=0 || $rzsee>7 || $rzsee==2)
-	{
-		$rzsee = 1;
-	}
-}	
+if (isset($_GET['rz'])) {
+    $rzsee = round((int)$_GET['rz']);
+    if ($rzsee <= 0 || $rzsee > 7 || $rzsee == 2) {
+        $rzsee = 1;
+    }
+}
 
 $energy = '';
 $str = '';
@@ -78,1820 +91,2551 @@ $ogon = '';
 $voda = '';
 $vozduh = '';
 $zemla = '';
-$svet  = '';
+$svet = '';
 $seraya = '';
 $tma = '';
 ?>
 
 
-<style type="text/css"> 
-.tz		{ font-weight:bold; color: #003388; background-color: #CCCCCC; cursor:pointer; text-align: center; }
-.tzS		{ font-weight:bold; color: #000000; background-color: #CCCCCC; text-align: center; }
-.tzOver		{ font-weight:bold; color: #003388; background-color: #C0C0C0; cursor:pointer; text-align: center; }
-.tzSet		{ font-weight:bold; color: #003388; background-color: #A6B1C6; cursor:default; text-align: center; }
-.dtz		{ display: none }
-.nonactive	{filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);}
-.nactive {
-cursor:pointer;
-}
+<style type="text/css">
+    .tz {
+        font-weight: bold;
+        color: #003388;
+        background-color: #CCCCCC;
+        cursor: pointer;
+        text-align: center;
+    }
+
+    .tzS {
+        font-weight: bold;
+        color: #000000;
+        background-color: #CCCCCC;
+        text-align: center;
+    }
+
+    .tzOver {
+        font-weight: bold;
+        color: #003388;
+        background-color: #C0C0C0;
+        cursor: pointer;
+        text-align: center;
+    }
+
+    .tzSet {
+        font-weight: bold;
+        color: #003388;
+        background-color: #A6B1C6;
+        cursor: default;
+        text-align: center;
+    }
+
+    .dtz {
+        display: none
+    }
+
+    .nonactive {
+        filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
+        filter: progid:DXImageTransform.Microsoft.Alpha(opacity=30);
+    }
+
+    .nactive {
+        cursor: pointer;
+    }
 </style>
 
 <body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=e2e0e0>
 
 <SCRIPT>
-var clevel='';
-var currentID=<? echo time(); ?>;
-var newrz = <? echo $rzsee; ?>;
-function dw(s) {document.write(s);}
+    var clevel = '';
+    var currentID =<?php echo time(); ?>;
+    var newrz = <?php echo $rzsee; ?>;
 
-function highl(nm, i)
-{	if (clevel == nm) { document.getElementById(nm).className = 'tzSet' }
-	else {
-		if (i==1) { document.getElementById(nm).className = 'tzOver' }
-		else { document.getElementById(nm).className = 'tz' }
-	}
-}
-function setlevel(nm)
-{
+    function dw(s) {
+        document.write(s);
+    }
 
-		if (clevel != '') {
-			document.getElementById(clevel).className = 'tz';
-			document.getElementById('d'+clevel).style.display = 'none';
-		}
-		clevel = nm || 'L1';
-		document.getElementById(clevel).className = 'tzSet';
-		document.getElementById('d'+clevel).style.display = 'inline';
-		newrz = nm.split('L');
-		newrz = newrz[1];
-}
+    function highl(nm, i) {
+        if (clevel == nm) {
+            document.getElementById(nm).className = 'tzSet'
+        } else {
+            if (i == 1) {
+                document.getElementById(nm).className = 'tzOver'
+            } else {
+                document.getElementById(nm).className = 'tz'
+            }
+        }
+    }
+
+    function setlevel(nm) {
+
+        if (clevel != '') {
+            document.getElementById(clevel).className = 'tz';
+            document.getElementById('d' + clevel).style.display = 'none';
+        }
+        clevel = nm || 'L1';
+        document.getElementById(clevel).className = 'tzSet';
+        document.getElementById('d' + clevel).style.display = 'inline';
+        newrz = nm.split('L');
+        newrz = newrz[1];
+    }
 
 </SCRIPT>
 
 <TABLE width=100%>
-	<TD>
-<?
-$st = $u->lookStats($u->info['stats']);
-if(@$_GET['dec_transfer'] || @$_GET['dec_travma'] || @$_GET['fast_homeworld'] || @$_GET['inc_expr'] || @$_GET['inc_friends'] || @$_GET['inc_hobby'] || @$_GET['max_inventory'] || @$_GET['num_transfer'] || @$_GET['speed_HP'] || @$_GET['speed_MP'] || @$_GET['speed_debuff'])
-{
-	$summs = floor($_GET['dec_transfer']+$_GET['dec_travma']+$_GET['fast_homeworld']+$_GET['inc_expr']+$_GET['inc_friends']+$_GET['inc_hobby']+$_GET['max_inventory']+$_GET['num_transfer']+$_GET['speed_HP']+$_GET['speed_MP']+$_GET['speed_debuff']);
-	if(!is_numeric($summs)){$summs=0;}
-	
-	if($summs>1)
-	{
-		$summs=0;
-		echo '&nbsp; &nbsp;<font color=red>���-�� ����� �� ���...</font><br>';
-	}elseif($summs<0)
-	{
-		$summs=0;
-		echo '&nbsp; &nbsp;<font color=red>��� �������� ����� ����������, ��� �� ��� ������ �� ��� ;)</font><br>';
-	}elseif(($st['os1']+$_GET['dec_transfer']<=5 && $_GET['dec_transfer']>0) ||
-			($st['os2']+$_GET['dec_travma']<=5 && $_GET['dec_travma']>0) ||
-			($st['os3']+$_GET['fast_homeworld']<=5 && $_GET['fast_homeworld']>0) ||
-			($st['os4']+$_GET['inc_expr']<=5 && $_GET['inc_expr']>0) ||
-			($st['os5']+$_GET['inc_friends']<=5 && $_GET['inc_friends']>0) ||
-			($st['os6']+$_GET['inc_hobby']<=5 && $_GET['inc_hobby']>0) ||
-			($st['os7']+$_GET['max_inventory']<=5 && $_GET['max_inventory']>0) ||
-			($st['os8']+$_GET['num_transfer']<=5 && $_GET['num_transfer']>0) ||
-			($st['os9']+$_GET['speed_HP']<=5 && $_GET['speed_HP']>0) ||
-			($st['os10']+$_GET['speed_MP']<=5 && $_GET['speed_MP']>0) ||
-			($st['os11']+$_GET['speed_debuff']<=5 && $_GET['speed_debuff']>0) && $u->info['id']==$_GET['s4i']
-		  )
-		{
-		
-			$st['os1'] += (int)$_GET['dec_transfer'];
-			$st['os2'] += (int)$_GET['dec_travma'];
-			$st['os3'] += (int)$_GET['fast_homeworld'];
-			$st['os4'] += (int)$_GET['inc_expr'];
-			$st['os5'] += (int)$_GET['inc_friends'];
-			$st['os6'] += (int)$_GET['inc_hobby'];
-			$st['os7'] += (int)$_GET['max_inventory'];
-			$st['os8'] += (int)$_GET['num_transfer'];
-			$st['os9'] += (int)$_GET['speed_HP'];
-			$st['os10'] += (int)$_GET['speed_MP'];
-			$st['os11'] += (int)$_GET['speed_debuff'];
-			$u->info['stats'] = $u->impStats($st);
-		}if($u->info['sskills']-(int)$summs<0)
-		{
-			echo '&nbsp; &nbsp;<font color=red>� ��� ��� ��������� ������������</font><br>';
-		}elseif(mysql_query("UPDATE 
+    <TD>
+        <?php
+        $st = $u->lookStats($u->info['stats']);
+        if (@$_GET['dec_transfer'] || @$_GET['dec_travma'] || @$_GET['fast_homeworld'] || @$_GET['inc_expr'] || @$_GET['inc_friends'] || @$_GET['inc_hobby'] || @$_GET['max_inventory'] || @$_GET['num_transfer'] || @$_GET['speed_HP'] || @$_GET['speed_MP'] || @$_GET['speed_debuff']) {
+            $summs = floor(
+                $_GET['dec_transfer'] + $_GET['dec_travma'] + $_GET['fast_homeworld'] + $_GET['inc_expr'] + $_GET['inc_friends'] + $_GET['inc_hobby'] + $_GET['max_inventory'] + $_GET['num_transfer'] + $_GET['speed_HP'] + $_GET['speed_MP'] + $_GET['speed_debuff']
+            );
+            if (!is_numeric($summs)) {
+                $summs = 0;
+            }
+
+            if ($summs > 1) {
+                $summs = 0;
+                echo '&nbsp; &nbsp;<font color=red>���-�� ����� �� ���...</font><br>';
+            } elseif ($summs < 0) {
+                $summs = 0;
+                echo '&nbsp; &nbsp;<font color=red>��� �������� ����� ����������, ��� �� ��� ������ �� ��� ;)</font><br>';
+            } elseif (($st['os1'] + $_GET['dec_transfer'] <= 5 && $_GET['dec_transfer'] > 0) ||
+                ($st['os2'] + $_GET['dec_travma'] <= 5 && $_GET['dec_travma'] > 0) ||
+                ($st['os3'] + $_GET['fast_homeworld'] <= 5 && $_GET['fast_homeworld'] > 0) ||
+                ($st['os4'] + $_GET['inc_expr'] <= 5 && $_GET['inc_expr'] > 0) ||
+                ($st['os5'] + $_GET['inc_friends'] <= 5 && $_GET['inc_friends'] > 0) ||
+                ($st['os6'] + $_GET['inc_hobby'] <= 5 && $_GET['inc_hobby'] > 0) ||
+                ($st['os7'] + $_GET['max_inventory'] <= 5 && $_GET['max_inventory'] > 0) ||
+                ($st['os8'] + $_GET['num_transfer'] <= 5 && $_GET['num_transfer'] > 0) ||
+                ($st['os9'] + $_GET['speed_HP'] <= 5 && $_GET['speed_HP'] > 0) ||
+                ($st['os10'] + $_GET['speed_MP'] <= 5 && $_GET['speed_MP'] > 0) ||
+                ($st['os11'] + $_GET['speed_debuff'] <= 5 && $_GET['speed_debuff'] > 0) && $u->info['id'] == $_GET['s4i']
+            ) {
+
+                $st['os1'] += (int)$_GET['dec_transfer'];
+                $st['os2'] += (int)$_GET['dec_travma'];
+                $st['os3'] += (int)$_GET['fast_homeworld'];
+                $st['os4'] += (int)$_GET['inc_expr'];
+                $st['os5'] += (int)$_GET['inc_friends'];
+                $st['os6'] += (int)$_GET['inc_hobby'];
+                $st['os7'] += (int)$_GET['max_inventory'];
+                $st['os8'] += (int)$_GET['num_transfer'];
+                $st['os9'] += (int)$_GET['speed_HP'];
+                $st['os10'] += (int)$_GET['speed_MP'];
+                $st['os11'] += (int)$_GET['speed_debuff'];
+                $u->info['stats'] = $u->impStats($st);
+            }
+            if ($u->info['sskills'] - (int)$summs < 0) {
+                echo '&nbsp; &nbsp;<font color=red>� ��� ��� ��������� ������������</font><br>';
+            } elseif (mysql_query(
+                "UPDATE 
 							`stats` 
 						SET 
-							`stats`= '".mysql_real_escape_string($u->info['stats'])."',
-							`sskills` = `sskills` - '".mysql_real_escape_string((int)$summs)."'
+							`stats`= '" . mysql_real_escape_string($u->info['stats']) . "',
+							`sskills` = `sskills` - '" . mysql_real_escape_string((int)$summs) . "'
 						WHERE 
-							`id` = '".(int)$u->info['id']."';")) 
-		{
-			if($_GET['dec_transfer']==1) {echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"������������ ".($st['os1']>1?" - ".$st['os1']."":"")."\"</font><br>";}
-			if($_GET['dec_travma']==1) {echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"������� ".($st['os2']>1?" - ".$st['os2']."":"")."\"</font><br>";}
-			if($_GET['fast_homeworld']==1) {echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"������� ".($st['os3']>1?" - ".$st['os3']."":"")."\"</font><br>";}
-			if($_GET['inc_expr']==1) {echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"��������������� ".($st['os4']>1?" - ".$st['os4']."":"")."\"</font><br>";}
-			if($_GET['inc_friends']==1) {echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"����������� ".($st['os5']>1?" - ".$st['os5']."":"")."\"</font><br>";}
-			if($_GET['inc_hobby']==1) {echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"����������� ".($st['os6']>1?" - ".$st['os6']."":"")."\"</font><br>";}
-			if($_GET['max_inventory']==1) {echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"���������� ".($st['os7']>1?" - ".$st['os7']."":"")."\"</font><br>";}
-			if($_GET['num_transfer']==1) {echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"���������������� ".($st['os8']>1?" - ".$st['os8']."":"")."\"</font><br>";}
-			if($_GET['speed_HP']==1) {echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"���������� ".($st['os9']>1?" - ".$st['os9']."":"")."\"</font><br>";}
-			if($_GET['speed_MP']==1) {echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"�������������� ".($st['os10']>1?" - ".$st['os10']."":"")."\"</font><br>";}
-			if($_GET['speed_debuff']==1) {echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"�������� ��� ".($st['os11']>1?" - ".$st['os11']."":"")."\"</font><br>";}
-			$u->info['sskills'] -= $summs;
-		}
-}
-if (@$_GET['upr']) {
-	/*-----��������� ����� ������ � ������-----*/
-	if(!isset($_GET['energy']) || $_GET['energy'] < 0){ $_GET['energy'] = 0; }
-	if(!isset($_GET['str']) || $_GET['str'] < 0){ $_GET['str'] = 0; }
-	if(!isset($_GET['dex']) || $_GET['dex'] < 0){ $_GET['dex'] = 0; }
-	if(!isset($_GET['inst']) || $_GET['inst'] < 0){ $_GET['inst'] = 0; }
-	if(!isset($_GET['power']) || $_GET['power'] < 0){ $_GET['power'] = 0; }
-	if(!isset($_GET['intel']) || $_GET['intel'] < 0){ $_GET['intel'] = 0; }
-	if(!isset($_GET['wis']) || $_GET['wis'] < 0){ $_GET['wis'] = 0; }
-	if(!isset($_GET['spirit']) || $_GET['spirit'] < 0){ $_GET['spirit'] = 0; }
-	if(!isset($_GET['will']) || $_GET['will'] < 0){ $_GET['will'] = 0; }
-	if(!isset($_GET['freedom']) || $_GET['freedom'] < 0){ $_GET['freedom'] = 0; }
-	if(!isset($_GET['god']) || $_GET['god'] < 0){ $_GET['god'] = 0; }
-	
-	if(!isset($_GET['m_sword']) || $_GET['m_sword'] < 0){ $_GET['m_sword'] = 0; }
-	if(!isset($_GET['m_tohand']) || $_GET['m_tohand'] < 0){ $_GET['m_tohand'] = 0; }
-	if(!isset($_GET['m_molot']) || $_GET['m_molot'] < 0){ $_GET['m_molot'] = 0; }
-	if(!isset($_GET['m_axe']) || $_GET['m_axe'] < 0){ $_GET['m_axe'] = 0; }
-	if(!isset($_GET['m_staff']) || $_GET['m_staff'] < 0){ $_GET['m_staff'] = 0; }
-	if(!isset($_GET['m_magic1']) || $_GET['m_magic1'] < 0){ $_GET['m_magic1'] = 0; }
-	if(!isset($_GET['m_magic2']) || $_GET['m_magic2'] < 0){ $_GET['m_magic2'] = 0; }
-	if(!isset($_GET['m_magic3']) || $_GET['m_magic3'] < 0){ $_GET['m_magic3'] = 0; }
-	if(!isset($_GET['m_magic4']) || $_GET['m_magic4'] < 0){ $_GET['m_magic4'] = 0; }
-	if(!isset($_GET['m_magic5']) || $_GET['m_magic5'] < 0){ $_GET['m_magic5'] = 0; }
-	if(!isset($_GET['m_magic6']) || $_GET['m_magic6'] < 0){ $_GET['m_magic6'] = 0; }
-	if(!isset($_GET['m_magic7']) || $_GET['m_magic7'] < 0){ $_GET['m_magic7'] = 0; }
+							`id` = '" . (int)$u->info['id'] . "';"
+            )) {
+                if ($_GET['dec_transfer'] == 1) {
+                    echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"������������ " . ($st['os1'] > 1 ? " - " . $st['os1'] . "" : "") . "\"</font><br>";
+                }
+                if ($_GET['dec_travma'] == 1) {
+                    echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"������� " . ($st['os2'] > 1 ? " - " . $st['os2'] . "" : "") . "\"</font><br>";
+                }
+                if ($_GET['fast_homeworld'] == 1) {
+                    echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"������� " . ($st['os3'] > 1 ? " - " . $st['os3'] . "" : "") . "\"</font><br>";
+                }
+                if ($_GET['inc_expr'] == 1) {
+                    echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"��������������� " . ($st['os4'] > 1 ? " - " . $st['os4'] . "" : "") . "\"</font><br>";
+                }
+                if ($_GET['inc_friends'] == 1) {
+                    echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"����������� " . ($st['os5'] > 1 ? " - " . $st['os5'] . "" : "") . "\"</font><br>";
+                }
+                if ($_GET['inc_hobby'] == 1) {
+                    echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"����������� " . ($st['os6'] > 1 ? " - " . $st['os6'] . "" : "") . "\"</font><br>";
+                }
+                if ($_GET['max_inventory'] == 1) {
+                    echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"���������� " . ($st['os7'] > 1 ? " - " . $st['os7'] . "" : "") . "\"</font><br>";
+                }
+                if ($_GET['num_transfer'] == 1) {
+                    echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"���������������� " . ($st['os8'] > 1 ? " - " . $st['os8'] . "" : "") . "\"</font><br>";
+                }
+                if ($_GET['speed_HP'] == 1) {
+                    echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"���������� " . ($st['os9'] > 1 ? " - " . $st['os9'] . "" : "") . "\"</font><br>";
+                }
+                if ($_GET['speed_MP'] == 1) {
+                    echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"�������������� " . ($st['os10'] > 1 ? " - " . $st['os10'] . "" : "") . "\"</font><br>";
+                }
+                if ($_GET['speed_debuff'] == 1) {
+                    echo "&nbsp; &nbsp;<font color=red>�� ������� ����������� \"�������� ��� " . ($st['os11'] > 1 ? " - " . $st['os11'] . "" : "") . "\"</font><br>";
+                }
+                $u->info['sskills'] -= $summs;
+            }
+        }
+        if (@$_GET['upr']) {
+            /*-----��������� ����� ������ � ������-----*/
+            if (!isset($_GET['energy']) || $_GET['energy'] < 0) {
+                $_GET['energy'] = 0;
+            }
+            if (!isset($_GET['str']) || $_GET['str'] < 0) {
+                $_GET['str'] = 0;
+            }
+            if (!isset($_GET['dex']) || $_GET['dex'] < 0) {
+                $_GET['dex'] = 0;
+            }
+            if (!isset($_GET['inst']) || $_GET['inst'] < 0) {
+                $_GET['inst'] = 0;
+            }
+            if (!isset($_GET['power']) || $_GET['power'] < 0) {
+                $_GET['power'] = 0;
+            }
+            if (!isset($_GET['intel']) || $_GET['intel'] < 0) {
+                $_GET['intel'] = 0;
+            }
+            if (!isset($_GET['wis']) || $_GET['wis'] < 0) {
+                $_GET['wis'] = 0;
+            }
+            if (!isset($_GET['spirit']) || $_GET['spirit'] < 0) {
+                $_GET['spirit'] = 0;
+            }
+            if (!isset($_GET['will']) || $_GET['will'] < 0) {
+                $_GET['will'] = 0;
+            }
+            if (!isset($_GET['freedom']) || $_GET['freedom'] < 0) {
+                $_GET['freedom'] = 0;
+            }
+            if (!isset($_GET['god']) || $_GET['god'] < 0) {
+                $_GET['god'] = 0;
+            }
 
-			
-	$summ = floor($_GET['energy']+$_GET['str']+$_GET['dex']+$_GET['inst']+$_GET['power']+$_GET['intel']+$_GET['wis']+$_GET['spirit']+$_GET['will']+$_GET['freedom']+$_GET['god']);
-	if(!is_numeric($summ)){$summ=0;}
-	$summu = floor($_GET['m_axe']+$_GET['m_molot']+$_GET['m_sword']+$_GET['m_tohand']+$_GET['m_staff']+$_GET['m_magic1']+$_GET['m_magic2']+$_GET['m_magic3']+$_GET['m_magic4']+$_GET['m_magic5']+$_GET['m_magic6']+$_GET['m_magic7']);
-	if(!is_numeric($summu)){$summu=0;}
+            if (!isset($_GET['m_sword']) || $_GET['m_sword'] < 0) {
+                $_GET['m_sword'] = 0;
+            }
+            if (!isset($_GET['m_tohand']) || $_GET['m_tohand'] < 0) {
+                $_GET['m_tohand'] = 0;
+            }
+            if (!isset($_GET['m_molot']) || $_GET['m_molot'] < 0) {
+                $_GET['m_molot'] = 0;
+            }
+            if (!isset($_GET['m_axe']) || $_GET['m_axe'] < 0) {
+                $_GET['m_axe'] = 0;
+            }
+            if (!isset($_GET['m_staff']) || $_GET['m_staff'] < 0) {
+                $_GET['m_staff'] = 0;
+            }
+            if (!isset($_GET['m_magic1']) || $_GET['m_magic1'] < 0) {
+                $_GET['m_magic1'] = 0;
+            }
+            if (!isset($_GET['m_magic2']) || $_GET['m_magic2'] < 0) {
+                $_GET['m_magic2'] = 0;
+            }
+            if (!isset($_GET['m_magic3']) || $_GET['m_magic3'] < 0) {
+                $_GET['m_magic3'] = 0;
+            }
+            if (!isset($_GET['m_magic4']) || $_GET['m_magic4'] < 0) {
+                $_GET['m_magic4'] = 0;
+            }
+            if (!isset($_GET['m_magic5']) || $_GET['m_magic5'] < 0) {
+                $_GET['m_magic5'] = 0;
+            }
+            if (!isset($_GET['m_magic6']) || $_GET['m_magic6'] < 0) {
+                $_GET['m_magic6'] = 0;
+            }
+            if (!isset($_GET['m_magic7']) || $_GET['m_magic7'] < 0) {
+                $_GET['m_magic7'] = 0;
+            }
 
-	/*-----��������� ����� ������ � ������-----*/
-	/*-----����� ����� � ������----*/
-		if(
-			(($_GET['energy']>0 || $_GET['str']>0 ||
-			$_GET['dex']>0 ||
-			$_GET['inst']>0 ||
-			$_GET['power']>0 ||
-			($_GET['intel']>0 && $u->info['level'] > 3) ||
-			($_GET['wis']>0 && $u->info['level'] > 6) ||
-			($_GET['spirit']>0 && $u->info['level'] > 9) ||
-			($_GET['will']>0 && $u->info['level'] > 12) ||
-			($_GET['freedom']>0 && $u->info['level'] > 15) ||
-			($_GET['god']>0 && $u->info['level'] > 18)) && $summ<=$u->info['ability'] && $u->info['ability']>0) ||
-			(($st['a1']+$_GET['m_sword']<=20 && $_GET['m_sword']>0) ||
-			($st['a2']+$_GET['m_tohand']<=20 && $_GET['m_tohand']>0) ||
-			($st['a3']+$_GET['m_molot']<=20 && $_GET['m_molot']>0) ||
-			($st['a4']+$_GET['m_axe']<=20 && $_GET['m_axe']>0) ||
-			($st['a5']+$_GET['m_staff']<=20 && $_GET['m_staff']>0) ||
-			($st['mg1']+$_GET['m_magic1']<=20 && $_GET['m_magic1']>0) ||
-			($st['mg2']+$_GET['m_magic2']<=20 && $_GET['m_magic2']>0) ||
-			($st['mg3']+$_GET['m_magic3']<=20 && $_GET['m_magic3']>0) ||
-			($st['mg4']+$_GET['m_magic4']<=20 && $_GET['m_magic4']>0) ||
-			($st['mg5']+$_GET['m_magic5']<=20 && $_GET['m_magic5']>0) ||
-			($st['mg6']+$_GET['m_magic6']<=20 && $_GET['m_magic6']>0) ||
-			($st['mg7']+$_GET['m_magic7']<=20 && $_GET['m_magic7']>0) && $summu<=$u->info['skills'] && $u->info['skills']>0)  && $u->info['id']==$_GET['s4i']
-		)
-		{
-			$st['s1'] += (int)$_GET['str'];
-			$st['s2'] += (int)$_GET['dex'];
-			$st['s3'] += (int)$_GET['inst'];
-			$st['s4'] += (int)$_GET['power'];
-			$st['a1'] += (int)$_GET['m_sword'];
-			$st['a2'] += (int)$_GET['m_tohand'];
-			$st['a3'] += (int)$_GET['m_molot'];
-			$st['a4'] += (int)$_GET['m_axe'];
-			$st['a5'] += (int)$_GET['m_staff'];
-			$st['mg1'] += (int)$_GET['m_magic1'];
-			$st['mg2'] += (int)$_GET['m_magic2'];
-			$st['mg3'] += (int)$_GET['m_magic3'];
-			$st['mg4'] += (int)$_GET['m_magic4'];
-			$st['mg5'] += (int)$_GET['m_magic5'];
-			$st['mg6'] += (int)$_GET['m_magic6'];
-			$st['mg7'] += (int)$_GET['m_magic7'];
-			if ($u->info['level'] > 3) {$st['s5'] += (int)$_GET['intel'];}
-			if ($u->info['level'] > 6) {$st['s6'] += (int)$_GET['wis'];}
-			if ($u->info['level'] > 9) {$st['s7'] += (int)$_GET['spirit'];}
-			if ($u->info['level'] > 12) {$st['s8'] += (int)$_GET['will'];}
-			if ($u->info['level'] > 15) {$st['s9'] += (int)$_GET['freedom'];}
-			if ($u->info['level'] > 18) {$st['s10'] += (int)$_GET['god'];}
-			//$st['s11'] +=(int)$_GET['energy'];
-			
-			$u->info['stats'] = $u->impStats($st);
-			
-			/*if((int)$_GET['energy'] + $u->stats['s11'] > $u->info['level']) {
+
+            $summ = floor(
+                $_GET['energy'] + $_GET['str'] + $_GET['dex'] + $_GET['inst'] + $_GET['power'] + $_GET['intel'] + $_GET['wis'] + $_GET['spirit'] + $_GET['will'] + $_GET['freedom'] + $_GET['god']
+            );
+            if (!is_numeric($summ)) {
+                $summ = 0;
+            }
+            $summu = floor(
+                $_GET['m_axe'] + $_GET['m_molot'] + $_GET['m_sword'] + $_GET['m_tohand'] + $_GET['m_staff'] + $_GET['m_magic1'] + $_GET['m_magic2'] + $_GET['m_magic3'] + $_GET['m_magic4'] + $_GET['m_magic5'] + $_GET['m_magic6'] + $_GET['m_magic7']
+            );
+            if (!is_numeric($summu)) {
+                $summu = 0;
+            }
+
+            /*-----��������� ����� ������ � ������-----*/
+            /*-----����� ����� � ������----*/
+            if (
+                (($_GET['energy'] > 0 || $_GET['str'] > 0 ||
+                        $_GET['dex'] > 0 ||
+                        $_GET['inst'] > 0 ||
+                        $_GET['power'] > 0 ||
+                        ($_GET['intel'] > 0 && $u->info['level'] > 3) ||
+                        ($_GET['wis'] > 0 && $u->info['level'] > 6) ||
+                        ($_GET['spirit'] > 0 && $u->info['level'] > 9) ||
+                        ($_GET['will'] > 0 && $u->info['level'] > 12) ||
+                        ($_GET['freedom'] > 0 && $u->info['level'] > 15) ||
+                        ($_GET['god'] > 0 && $u->info['level'] > 18)) && $summ <= $u->info['ability'] && $u->info['ability'] > 0) ||
+                (($st['a1'] + $_GET['m_sword'] <= 20 && $_GET['m_sword'] > 0) ||
+                    ($st['a2'] + $_GET['m_tohand'] <= 20 && $_GET['m_tohand'] > 0) ||
+                    ($st['a3'] + $_GET['m_molot'] <= 20 && $_GET['m_molot'] > 0) ||
+                    ($st['a4'] + $_GET['m_axe'] <= 20 && $_GET['m_axe'] > 0) ||
+                    ($st['a5'] + $_GET['m_staff'] <= 20 && $_GET['m_staff'] > 0) ||
+                    ($st['mg1'] + $_GET['m_magic1'] <= 20 && $_GET['m_magic1'] > 0) ||
+                    ($st['mg2'] + $_GET['m_magic2'] <= 20 && $_GET['m_magic2'] > 0) ||
+                    ($st['mg3'] + $_GET['m_magic3'] <= 20 && $_GET['m_magic3'] > 0) ||
+                    ($st['mg4'] + $_GET['m_magic4'] <= 20 && $_GET['m_magic4'] > 0) ||
+                    ($st['mg5'] + $_GET['m_magic5'] <= 20 && $_GET['m_magic5'] > 0) ||
+                    ($st['mg6'] + $_GET['m_magic6'] <= 20 && $_GET['m_magic6'] > 0) ||
+                    ($st['mg7'] + $_GET['m_magic7'] <= 20 && $_GET['m_magic7'] > 0) && $summu <= $u->info['skills'] && $u->info['skills'] > 0) && $u->info['id'] == $_GET['s4i']
+            ) {
+                $st['s1'] += (int)$_GET['str'];
+                $st['s2'] += (int)$_GET['dex'];
+                $st['s3'] += (int)$_GET['inst'];
+                $st['s4'] += (int)$_GET['power'];
+                $st['a1'] += (int)$_GET['m_sword'];
+                $st['a2'] += (int)$_GET['m_tohand'];
+                $st['a3'] += (int)$_GET['m_molot'];
+                $st['a4'] += (int)$_GET['m_axe'];
+                $st['a5'] += (int)$_GET['m_staff'];
+                $st['mg1'] += (int)$_GET['m_magic1'];
+                $st['mg2'] += (int)$_GET['m_magic2'];
+                $st['mg3'] += (int)$_GET['m_magic3'];
+                $st['mg4'] += (int)$_GET['m_magic4'];
+                $st['mg5'] += (int)$_GET['m_magic5'];
+                $st['mg6'] += (int)$_GET['m_magic6'];
+                $st['mg7'] += (int)$_GET['m_magic7'];
+                if ($u->info['level'] > 3) {
+                    $st['s5'] += (int)$_GET['intel'];
+                }
+                if ($u->info['level'] > 6) {
+                    $st['s6'] += (int)$_GET['wis'];
+                }
+                if ($u->info['level'] > 9) {
+                    $st['s7'] += (int)$_GET['spirit'];
+                }
+                if ($u->info['level'] > 12) {
+                    $st['s8'] += (int)$_GET['will'];
+                }
+                if ($u->info['level'] > 15) {
+                    $st['s9'] += (int)$_GET['freedom'];
+                }
+                if ($u->info['level'] > 18) {
+                    $st['s10'] += (int)$_GET['god'];
+                }
+                //$st['s11'] +=(int)$_GET['energy'];
+
+                $u->info['stats'] = $u->impStats($st);
+
+                /*if((int)$_GET['energy'] + $u->stats['s11'] > $u->info['level']) {
 				echo '&nbsp; &nbsp;<font color=red>������� �� ����� ���� ���� ������ ���������</font><br>';
 			}else*/
-			if(/*$_GET['energy'] < 0 || */$_GET['str'] < 0 || $_GET['dex'] < 0 || $_GET['intel'] < 0 || $_GET['wis'] < 0 || $_GET['spirit'] < 0 || $_GET['will'] < 0 || $_GET['freedom'] < 0 || $_GET['god'] < 0 || $_GET['inst'] < 0 || $_GET['power'] < 0 || $_GET['m_sword'] < 0 || $_GET['m_tohand'] < 0 || $_GET['m_molot'] < 0 || $_GET['m_staff'] < 0	|| $_GET['m_magic1'] < 0 || $_GET['m_magic2'] < 0 || $_GET['m_magic3'] < 0 || $_GET['m_magic4'] < 0 || $_GET['m_magic5'] < 0 || $_GET['m_magic6'] < 0 || $_GET['m_magic7'] < 0) {
-				echo '&nbsp; &nbsp;<font color=red>1) ���-�� ����� �� ���...</font><br>';
-			}elseif($u->info['ability']-(int)$summ<0 || $u->info['skills']-(int)$summu<0)
-			{
-				echo '&nbsp; &nbsp;<font color=red>���-�� ����� �� ���... (�����������: '.($u->info['ability']-(int)$summ).', ������: '.($u->info['skills']-(int)$summu).')</font><br>';
-			}elseif(mysql_query("UPDATE 
+                if (/*$_GET['energy'] < 0 || */
+                    $_GET['str'] < 0 || $_GET['dex'] < 0 || $_GET['intel'] < 0 || $_GET['wis'] < 0 || $_GET['spirit'] < 0 || $_GET['will'] < 0 || $_GET['freedom'] < 0 || $_GET['god'] < 0 || $_GET['inst'] < 0 || $_GET['power'] < 0 || $_GET['m_sword'] < 0 || $_GET['m_tohand'] < 0 || $_GET['m_molot'] < 0 || $_GET['m_staff'] < 0 || $_GET['m_magic1'] < 0 || $_GET['m_magic2'] < 0 || $_GET['m_magic3'] < 0 || $_GET['m_magic4'] < 0 || $_GET['m_magic5'] < 0 || $_GET['m_magic6'] < 0 || $_GET['m_magic7'] < 0) {
+                    echo '&nbsp; &nbsp;<font color=red>1) ���-�� ����� �� ���...</font><br>';
+                } elseif ($u->info['ability'] - (int)$summ < 0 || $u->info['skills'] - (int)$summu < 0) {
+                    echo '&nbsp; &nbsp;<font color=red>���-�� ����� �� ���... (�����������: ' . ($u->info['ability'] - (int)$summ) . ', ������: ' . ($u->info['skills'] - (int)$summu) . ')</font><br>';
+                } elseif (mysql_query(
+                    "UPDATE 
 							`stats` 
 						SET 
-							`stats`= '".mysql_real_escape_string($u->info['stats'])."', 
-							`ability` = `ability` - '".mysql_real_escape_string((int)$summ)."', 
-							`skills` = `skills` - '".mysql_real_escape_string((int)$summu)."'
+							`stats`= '" . mysql_real_escape_string($u->info['stats']) . "', 
+							`ability` = `ability` - '" . mysql_real_escape_string((int)$summ) . "', 
+							`skills` = `skills` - '" . mysql_real_escape_string((int)$summu) . "'
 						WHERE 
-							`id` = '".(int)$u->info['id']."';")) 
-			{				
-				//if($_GET['energy']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>�������</B>" ����������� ������</font><br>';}
-				if($_GET['str']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>����</B>" ����������� ������</font><br>';}
-				if($_GET['dex']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>��������</B>" ����������� ������</font><br>';}
-				if($_GET['inst']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>��������</B>" ����������� ������</font><br>';}
-				if($_GET['power']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>������������</B>" ����������� ������</font><br>';}
-				if($_GET['intel']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>���������</B>" ����������� ������</font><br>';}
-				if($_GET['wis']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>��������</B>" ����������� ������</font><br>';}
-				if($_GET['spirit']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>����������</B>" ����������� ������</font><br>';}
-				if($_GET['will']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>����</B>" ����������� ������</font><br>';}
-				if($_GET['freedom']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>������� ����</B>" ����������� ������</font><br>';}
-				if($_GET['god']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>��������������</B>" ����������� ������</font><br>';}
-				if($_GET['m_sword']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ������, ���������</B>" ����������� ������</font><br>';}
-				if($_GET['m_axe']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ������</B>" ����������� ������</font><br>';}
-				if($_GET['m_molot']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ��������, ��������</B>" ����������� ������</font><br>';}
-				if($_GET['m_tohand']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ��������, ��������</B>" ����������� ������</font><br>';}
-				if($_GET['m_staff']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ����������� ��������</B>" ����������� ������</font><br>';}
-				if($_GET['m_magic1']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ������� ����</B>" ����������� ������</font><br>';}
-				if($_GET['m_magic2']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ������� �������</B>" ����������� ������</font><br>';}
-				if($_GET['m_magic3']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ������� ����</B>" ����������� ������</font><br>';}
-				if($_GET['m_magic4']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ������� �����</B>" ����������� ������</font><br>';}
-				if($_GET['m_magic5']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ������ �����</B>" ����������� ������</font><br>';}
-				if($_GET['m_magic6']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ������ ����</B>" ����������� ������</font><br>';}
-				if($_GET['m_magic7']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ����� ������</B>" ����������� ������</font><br>';}
-				/*--��� ����������--*/
-							//$u->stats['s11'] += (int)$_GET['energy'];
-							$u->stats['s1'] += (int)$_GET['str'];
-							$u->stats['s2'] += (int)$_GET['dex'];
-							$u->stats['s3'] += (int)$_GET['inst'];
-							$u->stats['s4'] += (int)$_GET['power'];
-							$u->stats['a1'] += (int)$_GET['m_sword'];
-							$u->stats['a2'] += (int)$_GET['m_tohand'];
-							$u->stats['a3'] += (int)$_GET['m_molot'];
-							$u->stats['a4'] += (int)$_GET['m_axe'];
-							$u->stats['a5'] += (int)$_GET['m_staff'];
-							$u->stats['mg1'] += (int)$_GET['m_magic1'];
-							$u->stats['mg2'] += (int)$_GET['m_magic2'];
-							$u->stats['mg3'] += (int)$_GET['m_magic3'];
-							$u->stats['mg4'] += (int)$_GET['m_magic4'];
-							$u->stats['mg5'] += (int)$_GET['m_magic5'];
-							$u->stats['mg6'] += (int)$_GET['m_magic6'];
-							$u->stats['mg7'] += (int)$_GET['m_magic7'];
-							if ($u->info['level'] > 3) {$u->stats['s5'] += (int)$_GET['intel'];}
-							if ($u->info['level'] > 6) {$u->stats['s6'] += (int)$_GET['wis'];}
-							if ($u->info['level'] > 9) {$u->stats['s7'] += (int)$_GET['spirit'];}
-							if ($u->info['level'] > 12) {$u->stats['s8'] += (int)$_GET['will'];}
-							if ($u->info['level'] > 15) {$u->stats['s9'] += (int)$_GET['freedom'];}
-							if ($u->info['level'] > 18) {$u->stats['s10'] += (int)$_GET['god'];}
-							$u->info['ability'] -= $summ;
-							$u->info['skills'] -= $summu;
-							/*--��� ����������--*/
-			}
-		}
-}
-	/*-----����� ����� � ������-----*/
-/////������ ������ ��������
-if(!isset($st['s1'])) {$st['s1']=0;}
-if(!isset($st['s2'])) {$st['s2']=0;}
-if(!isset($st['s3'])) {$st['s3']=0;}
-if(!isset($st['s4'])) {$st['s4']=0;}
-if(!isset($st['s5'])) {$st['s5']=0;}
-if(!isset($st['s6'])) {$st['s6']=0;}
-if(!isset($st['s7'])) {$st['s7']=0;}
-if(!isset($st['s8'])) {$st['s8']=0;}
-if(!isset($st['s9'])) {$st['s9']=0;}
-if(!isset($st['s10'])) {$st['s10']=0;}
-//if(!isset($st['s11'])) {$st['s11']=0;}
-if(!isset($st['a1'])) {$st['a1']=0;}
-if(!isset($st['a2'])) {$st['a2']=0;}
-if(!isset($st['a3'])) {$st['a3']=0;}
-if(!isset($st['a4'])) {$st['a4']=0;}
-if(!isset($st['a5'])) {$st['a5']=0;}
-if(!isset($st['mg1'])) {$st['mg1']=0;}
-if(!isset($st['mg2'])) {$st['mg2']=0;}
-if(!isset($st['mg3'])) {$st['mg3']=0;}
-if(!isset($st['mg4'])) {$st['mg4']=0;}
-if(!isset($st['mg5'])) {$st['mg5']=0;}
-if(!isset($st['mg6'])) {$st['mg6']=0;}
-if(!isset($st['mg7'])) {$st['mg7']=0;}
-if(!isset($u->stats['s1'])) {$u->stats['s1']=0;}
-if(!isset($u->stats['s2'])) {$u->stats['s2']=0;}
-if(!isset($u->stats['s3'])) {$u->stats['s3']=0;}
-if(!isset($u->stats['s4'])) {$u->stats['s4']=0;}
-if(!isset($u->stats['s5'])) {$u->stats['s5']=0;}
-if(!isset($u->stats['s6'])) {$u->stats['s6']=0;}
-if(!isset($u->stats['s7'])) {$u->stats['s7']=0;}
-if(!isset($u->stats['s8'])) {$u->stats['s8']=0;}
-if(!isset($u->stats['s9'])) {$u->stats['s9']=0;}
-if(!isset($u->stats['s10'])) {$u->stats['s10']=0;}
-//if(!isset($u->stats['s11'])) {$u->stats['s11']=0;}
-if(!isset($u->stats['a1'])) {$u->stats['a1']=0;}
-if(!isset($u->stats['a2'])) {$u->stats['a2']=0;}
-if(!isset($u->stats['a3'])) {$u->stats['a3']=0;}
-if(!isset($u->stats['a4'])) {$u->stats['a4']=0;}
-if(!isset($u->stats['a5'])) {$u->stats['a5']=0;}
-if(!isset($u->stats['mg1'])) {$u->stats['mg1']=0;}
-if(!isset($u->stats['mg2'])) {$u->stats['mg2']=0;}
-if(!isset($u->stats['mg3'])) {$u->stats['mg3']=0;}
-if(!isset($u->stats['mg4'])) {$u->stats['mg4']=0;}
-if(!isset($u->stats['mg5'])) {$u->stats['mg5']=0;}
-if(!isset($u->stats['mg6'])) {$u->stats['mg6']=0;}
-if(!isset($u->stats['mg7'])) {$u->stats['mg7']=0;}
-if(!isset($u->stats['a1'])) {$u->stats['a1']=0;}
-if(!isset($u->stats['a2'])) {$u->stats['a2']=0;}
-if(!isset($u->stats['a3'])) {$u->stats['a3']=0;}
-if(!isset($u->stats['a4'])) {$u->stats['a4']=0;}
-if(!isset($u->stats['a5'])) {$u->stats['a5']=0;}
-if(!isset($u->stats['mg1'])) {$u->stats['mg1']=0;}
-if(!isset($u->stats['mg2'])) {$u->stats['mg2']=0;}
-if(!isset($u->stats['mg3'])) {$u->stats['mg3']=0;}
-if(!isset($u->stats['mg4'])) {$u->stats['mg4']=0;}
-if(!isset($u->stats['mg5'])) {$u->stats['mg5']=0;}
-if(!isset($u->stats['mg6'])) {$u->stats['mg6']=0;}
-if(!isset($u->stats['mg7'])) {$u->stats['mg7']=0;}
-///////////////////////////
-/////�����
-$sil = $u->stats['s1'] - $st['s1'];
-if($sil>0){$str = "<SMALL>&nbsp;(<SPAN id=\"str_inst\">".$st['s1']."</SPAN>+".$sil.")</SMALL>";}
-$lov = $u->stats['s2'] - $st['s2'];
-if($lov>0){$dex = "<SMALL>&nbsp;(<SPAN id=\"dex_inst\">".$st['s2']."</SPAN>+".$lov.")</SMALL>";}
-$int = $u->stats['s3'] - $st['s3'];
-if($int>0){$inst = "<SMALL>&nbsp;(<SPAN id=\"inst_inst\">".$st['s3']."</SPAN>+".$int.")</SMALL>";}
-$intell = $u->stats['s5'] - $st['s5'];
-if($intell>0){$intel = "<SMALL>&nbsp;(<SPAN id=\"intel_inst\">".$st['s5']."</SPAN>+".$intell.")</SMALL>";}
-//$energy = $u->stats['s11'] - $st['s11'];
-//if($energy>0){$energy = "<SMALL>&nbsp;(<SPAN id=\"intel_inst\">".$st['s11']."</SPAN>+".$energy.")</SMALL>";}
-/////������
-$noj = $u->stats['a1'] - $st['a1'];
-if($noj>0){$nj = "<SMALL>&nbsp;(<SPAN id=\"m_sword_inst\">".$st['a1']."</SPAN>+".$noj.")</SMALL>";}
-$topor = $u->stats['a2'] - $st['a2'];
-if($topor>0){$top = "<SMALL>&nbsp;(<SPAN id=\"m_tohand_inst\">".$st['a2']."</SPAN>+".$topor.")</SMALL>";}
-$dubina = $u->stats['a3'] - $st['a3'];
-if($dubina>0){$dub = "<SMALL>&nbsp;(<SPAN id=\"m_molot_inst\">".$st['a3']."</SPAN>+".$dubina.")</SMALL>";}
-$mech = $u->stats['a4'] - $st['a4'];
-if($mech>0){$mec = "<SMALL>&nbsp;(<SPAN id=\"m_axe_inst\">".$st['a4']."</SPAN>+".$mech.")</SMALL>";}
-$posoh = $u->stats['a5'] - $st['a5'];
-if($posoh>0){$pos = "<SMALL>&nbsp;(<SPAN id=\"m_staff_inst\">".$st['a5']."</SPAN>+".$posoh.")</SMALL>";}
-/////�����
-$fire = $u->stats['mg1'] - $st['mg1'];
-if($fire>0){$ogon = "<SMALL>&nbsp;(<SPAN id=\"m_magic1_inst\">".$st['mg1']."</SPAN>+".$fire.")</SMALL>";}
-$water = $u->stats['mg2'] - $st['mg2'];
-if($water>0){$voda = "<SMALL>&nbsp;(<SPAN id=\"m_magic2_inst\">".$st['mg2']."</SPAN>+".$water.")</SMALL>";}
-$air = $u->stats['mg3'] - $st['mg3'];
-if($air>0){$vozduh = "<SMALL>&nbsp;(<SPAN id=\"m_magic3_inst\">".$st['mg3']."</SPAN>+".$air.")</SMALL>";}
-$earth = $u->stats['mg4'] - $st['mg4'];
-if($earth>0){$zemla = "<SMALL>&nbsp;(<SPAN id=\"m_magic4_inst\">".$st['mg4']."</SPAN>+".$earth.")</SMALL>";}
-$light = $u->stats['mg5'] - $st['mg5'];
-if($light>0){$svet = "<SMALL>&nbsp;(<SPAN id=\"m_magic5_inst\">".$st['mg5']."</SPAN>+".$light.")</SMALL>";}
-$gray = $u->stats['mg6'] - $st['mg6'];
-if($gray>0){$seraya = "<SMALL>&nbsp;(<SPAN id=\"m_magic6_inst\">".$st['mg6']."</SPAN>+".$gray.")</SMALL>";}
-$dark = $u->stats['mg7'] - $st['mg7'];
-if($dark>0){$tma = "<SMALL>&nbsp;(<SPAN id=\"m_magic7_inst\">".$st['mg7']."</SPAN>+".$dark.")</SMALL>";}
-/////�����������
-$os['os1'] = $st['os1'];
-//$os['os2'] = $st['os2'];
-$os['os3'] = $st['os3'];
-$os['os4'] = $st['os4'];
-$os['os5'] = $st['os5'];
-$os['os6'] = $st['os6'];
-$os['os7'] = $st['os7'];
-//$os['os8'] = $st['os8'];
-$os['os9'] = $st['os9'];
-$os['os10'] = $st['os10'];
-//$os['os11'] = $st['os11'];
+							`id` = '" . (int)$u->info['id'] . "';"
+                )) {
+                    //if($_GET['energy']>0) {echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>�������</B>" ����������� ������</font><br>';}
+                    if ($_GET['str'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>����</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['dex'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>��������</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['inst'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>��������</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['power'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>������������</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['intel'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>���������</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['wis'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>��������</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['spirit'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>����������</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['will'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>����</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['freedom'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>������� ����</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['god'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ����������� "<B>��������������</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['m_sword'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ������, ���������</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['m_axe'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ������</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['m_molot'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ��������, ��������</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['m_tohand'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ��������, ��������</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['m_staff'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ����������� ��������</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['m_magic1'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ������� ����</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['m_magic2'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ������� �������</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['m_magic3'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ������� ����</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['m_magic4'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ������� �����</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['m_magic5'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ������ �����</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['m_magic6'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ������ ����</B>" ����������� ������</font><br>';
+                    }
+                    if ($_GET['m_magic7'] > 0) {
+                        echo '&nbsp; &nbsp;<font color=red>���������� ������ "<B>���������� �������� ����� ������</B>" ����������� ������</font><br>';
+                    }
+                    /*--��� ����������--*/
+                    //$u->stats['s11'] += (int)$_GET['energy'];
+                    $u->stats['s1'] += (int)$_GET['str'];
+                    $u->stats['s2'] += (int)$_GET['dex'];
+                    $u->stats['s3'] += (int)$_GET['inst'];
+                    $u->stats['s4'] += (int)$_GET['power'];
+                    $u->stats['a1'] += (int)$_GET['m_sword'];
+                    $u->stats['a2'] += (int)$_GET['m_tohand'];
+                    $u->stats['a3'] += (int)$_GET['m_molot'];
+                    $u->stats['a4'] += (int)$_GET['m_axe'];
+                    $u->stats['a5'] += (int)$_GET['m_staff'];
+                    $u->stats['mg1'] += (int)$_GET['m_magic1'];
+                    $u->stats['mg2'] += (int)$_GET['m_magic2'];
+                    $u->stats['mg3'] += (int)$_GET['m_magic3'];
+                    $u->stats['mg4'] += (int)$_GET['m_magic4'];
+                    $u->stats['mg5'] += (int)$_GET['m_magic5'];
+                    $u->stats['mg6'] += (int)$_GET['m_magic6'];
+                    $u->stats['mg7'] += (int)$_GET['m_magic7'];
+                    if ($u->info['level'] > 3) {
+                        $u->stats['s5'] += (int)$_GET['intel'];
+                    }
+                    if ($u->info['level'] > 6) {
+                        $u->stats['s6'] += (int)$_GET['wis'];
+                    }
+                    if ($u->info['level'] > 9) {
+                        $u->stats['s7'] += (int)$_GET['spirit'];
+                    }
+                    if ($u->info['level'] > 12) {
+                        $u->stats['s8'] += (int)$_GET['will'];
+                    }
+                    if ($u->info['level'] > 15) {
+                        $u->stats['s9'] += (int)$_GET['freedom'];
+                    }
+                    if ($u->info['level'] > 18) {
+                        $u->stats['s10'] += (int)$_GET['god'];
+                    }
+                    $u->info['ability'] -= $summ;
+                    $u->info['skills'] -= $summu;
+                    /*--��� ����������--*/
+                }
+            }
+        }
+        /*-----����� ����� � ������-----*/
+        /////������ ������ ��������
+        if (!isset($st['s1'])) {
+            $st['s1'] = 0;
+        }
+        if (!isset($st['s2'])) {
+            $st['s2'] = 0;
+        }
+        if (!isset($st['s3'])) {
+            $st['s3'] = 0;
+        }
+        if (!isset($st['s4'])) {
+            $st['s4'] = 0;
+        }
+        if (!isset($st['s5'])) {
+            $st['s5'] = 0;
+        }
+        if (!isset($st['s6'])) {
+            $st['s6'] = 0;
+        }
+        if (!isset($st['s7'])) {
+            $st['s7'] = 0;
+        }
+        if (!isset($st['s8'])) {
+            $st['s8'] = 0;
+        }
+        if (!isset($st['s9'])) {
+            $st['s9'] = 0;
+        }
+        if (!isset($st['s10'])) {
+            $st['s10'] = 0;
+        }
+        //if(!isset($st['s11'])) {$st['s11']=0;}
+        if (!isset($st['a1'])) {
+            $st['a1'] = 0;
+        }
+        if (!isset($st['a2'])) {
+            $st['a2'] = 0;
+        }
+        if (!isset($st['a3'])) {
+            $st['a3'] = 0;
+        }
+        if (!isset($st['a4'])) {
+            $st['a4'] = 0;
+        }
+        if (!isset($st['a5'])) {
+            $st['a5'] = 0;
+        }
+        if (!isset($st['mg1'])) {
+            $st['mg1'] = 0;
+        }
+        if (!isset($st['mg2'])) {
+            $st['mg2'] = 0;
+        }
+        if (!isset($st['mg3'])) {
+            $st['mg3'] = 0;
+        }
+        if (!isset($st['mg4'])) {
+            $st['mg4'] = 0;
+        }
+        if (!isset($st['mg5'])) {
+            $st['mg5'] = 0;
+        }
+        if (!isset($st['mg6'])) {
+            $st['mg6'] = 0;
+        }
+        if (!isset($st['mg7'])) {
+            $st['mg7'] = 0;
+        }
+        if (!isset($u->stats['s1'])) {
+            $u->stats['s1'] = 0;
+        }
+        if (!isset($u->stats['s2'])) {
+            $u->stats['s2'] = 0;
+        }
+        if (!isset($u->stats['s3'])) {
+            $u->stats['s3'] = 0;
+        }
+        if (!isset($u->stats['s4'])) {
+            $u->stats['s4'] = 0;
+        }
+        if (!isset($u->stats['s5'])) {
+            $u->stats['s5'] = 0;
+        }
+        if (!isset($u->stats['s6'])) {
+            $u->stats['s6'] = 0;
+        }
+        if (!isset($u->stats['s7'])) {
+            $u->stats['s7'] = 0;
+        }
+        if (!isset($u->stats['s8'])) {
+            $u->stats['s8'] = 0;
+        }
+        if (!isset($u->stats['s9'])) {
+            $u->stats['s9'] = 0;
+        }
+        if (!isset($u->stats['s10'])) {
+            $u->stats['s10'] = 0;
+        }
+        //if(!isset($u->stats['s11'])) {$u->stats['s11']=0;}
+        if (!isset($u->stats['a1'])) {
+            $u->stats['a1'] = 0;
+        }
+        if (!isset($u->stats['a2'])) {
+            $u->stats['a2'] = 0;
+        }
+        if (!isset($u->stats['a3'])) {
+            $u->stats['a3'] = 0;
+        }
+        if (!isset($u->stats['a4'])) {
+            $u->stats['a4'] = 0;
+        }
+        if (!isset($u->stats['a5'])) {
+            $u->stats['a5'] = 0;
+        }
+        if (!isset($u->stats['mg1'])) {
+            $u->stats['mg1'] = 0;
+        }
+        if (!isset($u->stats['mg2'])) {
+            $u->stats['mg2'] = 0;
+        }
+        if (!isset($u->stats['mg3'])) {
+            $u->stats['mg3'] = 0;
+        }
+        if (!isset($u->stats['mg4'])) {
+            $u->stats['mg4'] = 0;
+        }
+        if (!isset($u->stats['mg5'])) {
+            $u->stats['mg5'] = 0;
+        }
+        if (!isset($u->stats['mg6'])) {
+            $u->stats['mg6'] = 0;
+        }
+        if (!isset($u->stats['mg7'])) {
+            $u->stats['mg7'] = 0;
+        }
+        if (!isset($u->stats['a1'])) {
+            $u->stats['a1'] = 0;
+        }
+        if (!isset($u->stats['a2'])) {
+            $u->stats['a2'] = 0;
+        }
+        if (!isset($u->stats['a3'])) {
+            $u->stats['a3'] = 0;
+        }
+        if (!isset($u->stats['a4'])) {
+            $u->stats['a4'] = 0;
+        }
+        if (!isset($u->stats['a5'])) {
+            $u->stats['a5'] = 0;
+        }
+        if (!isset($u->stats['mg1'])) {
+            $u->stats['mg1'] = 0;
+        }
+        if (!isset($u->stats['mg2'])) {
+            $u->stats['mg2'] = 0;
+        }
+        if (!isset($u->stats['mg3'])) {
+            $u->stats['mg3'] = 0;
+        }
+        if (!isset($u->stats['mg4'])) {
+            $u->stats['mg4'] = 0;
+        }
+        if (!isset($u->stats['mg5'])) {
+            $u->stats['mg5'] = 0;
+        }
+        if (!isset($u->stats['mg6'])) {
+            $u->stats['mg6'] = 0;
+        }
+        if (!isset($u->stats['mg7'])) {
+            $u->stats['mg7'] = 0;
+        }
+        ///////////////////////////
+        /////�����
+        $sil = $u->stats['s1'] - $st['s1'];
+        if ($sil > 0) {
+            $str = "<SMALL>&nbsp;(<SPAN id=\"str_inst\">" . $st['s1'] . "</SPAN>+" . $sil . ")</SMALL>";
+        }
+        $lov = $u->stats['s2'] - $st['s2'];
+        if ($lov > 0) {
+            $dex = "<SMALL>&nbsp;(<SPAN id=\"dex_inst\">" . $st['s2'] . "</SPAN>+" . $lov . ")</SMALL>";
+        }
+        $int = $u->stats['s3'] - $st['s3'];
+        if ($int > 0) {
+            $inst = "<SMALL>&nbsp;(<SPAN id=\"inst_inst\">" . $st['s3'] . "</SPAN>+" . $int . ")</SMALL>";
+        }
+        $intell = $u->stats['s5'] - $st['s5'];
+        if ($intell > 0) {
+            $intel = "<SMALL>&nbsp;(<SPAN id=\"intel_inst\">" . $st['s5'] . "</SPAN>+" . $intell . ")</SMALL>";
+        }
+        //$energy = $u->stats['s11'] - $st['s11'];
+        //if($energy>0){$energy = "<SMALL>&nbsp;(<SPAN id=\"intel_inst\">".$st['s11']."</SPAN>+".$energy.")</SMALL>";}
+        /////������
+        $noj = $u->stats['a1'] - $st['a1'];
+        if ($noj > 0) {
+            $nj = "<SMALL>&nbsp;(<SPAN id=\"m_sword_inst\">" . $st['a1'] . "</SPAN>+" . $noj . ")</SMALL>";
+        }
+        $topor = $u->stats['a2'] - $st['a2'];
+        if ($topor > 0) {
+            $top = "<SMALL>&nbsp;(<SPAN id=\"m_tohand_inst\">" . $st['a2'] . "</SPAN>+" . $topor . ")</SMALL>";
+        }
+        $dubina = $u->stats['a3'] - $st['a3'];
+        if ($dubina > 0) {
+            $dub = "<SMALL>&nbsp;(<SPAN id=\"m_molot_inst\">" . $st['a3'] . "</SPAN>+" . $dubina . ")</SMALL>";
+        }
+        $mech = $u->stats['a4'] - $st['a4'];
+        if ($mech > 0) {
+            $mec = "<SMALL>&nbsp;(<SPAN id=\"m_axe_inst\">" . $st['a4'] . "</SPAN>+" . $mech . ")</SMALL>";
+        }
+        $posoh = $u->stats['a5'] - $st['a5'];
+        if ($posoh > 0) {
+            $pos = "<SMALL>&nbsp;(<SPAN id=\"m_staff_inst\">" . $st['a5'] . "</SPAN>+" . $posoh . ")</SMALL>";
+        }
+        /////�����
+        $fire = $u->stats['mg1'] - $st['mg1'];
+        if ($fire > 0) {
+            $ogon = "<SMALL>&nbsp;(<SPAN id=\"m_magic1_inst\">" . $st['mg1'] . "</SPAN>+" . $fire . ")</SMALL>";
+        }
+        $water = $u->stats['mg2'] - $st['mg2'];
+        if ($water > 0) {
+            $voda = "<SMALL>&nbsp;(<SPAN id=\"m_magic2_inst\">" . $st['mg2'] . "</SPAN>+" . $water . ")</SMALL>";
+        }
+        $air = $u->stats['mg3'] - $st['mg3'];
+        if ($air > 0) {
+            $vozduh = "<SMALL>&nbsp;(<SPAN id=\"m_magic3_inst\">" . $st['mg3'] . "</SPAN>+" . $air . ")</SMALL>";
+        }
+        $earth = $u->stats['mg4'] - $st['mg4'];
+        if ($earth > 0) {
+            $zemla = "<SMALL>&nbsp;(<SPAN id=\"m_magic4_inst\">" . $st['mg4'] . "</SPAN>+" . $earth . ")</SMALL>";
+        }
+        $light = $u->stats['mg5'] - $st['mg5'];
+        if ($light > 0) {
+            $svet = "<SMALL>&nbsp;(<SPAN id=\"m_magic5_inst\">" . $st['mg5'] . "</SPAN>+" . $light . ")</SMALL>";
+        }
+        $gray = $u->stats['mg6'] - $st['mg6'];
+        if ($gray > 0) {
+            $seraya = "<SMALL>&nbsp;(<SPAN id=\"m_magic6_inst\">" . $st['mg6'] . "</SPAN>+" . $gray . ")</SMALL>";
+        }
+        $dark = $u->stats['mg7'] - $st['mg7'];
+        if ($dark > 0) {
+            $tma = "<SMALL>&nbsp;(<SPAN id=\"m_magic7_inst\">" . $st['mg7'] . "</SPAN>+" . $dark . ")</SMALL>";
+        }
+        /////�����������
+        $os['os1'] = $st['os1'];
+        //$os['os2'] = $st['os2'];
+        $os['os3'] = $st['os3'];
+        $os['os4'] = $st['os4'];
+        $os['os5'] = $st['os5'];
+        $os['os6'] = $st['os6'];
+        $os['os7'] = $st['os7'];
+        //$os['os8'] = $st['os8'];
+        $os['os9'] = $st['os9'];
+        $os['os10'] = $st['os10'];
+        //$os['os11'] = $st['os11'];
 
-$os["os1"]=array("name"=>"������������","opt"=>"dec_transfer","descr"=>"�������� ��������� ������� �� ", "nlevel"=>4,"bonus1"=>"0,1 ��.","bonus2"=>"0,2 ��.","bonus3"=>"0,3 ��.","bonus4"=>"0,4 ��.","bonus5"=>"0,5 ��.");
-//$os["os2"]=array("name"=>"�������","opt"=>"dec_travma","descr"=>"����� ������ ������ �� ", "nlevel"=>4,"bonus1"=>"5%","bonus2"=>"10%","bonus3"=>"15%","bonus4"=>"20%","bonus5"=>"25%");
-$os["os3"]=array("name"=>"�������","opt"=>"fast_homeworld","descr"=>"������ \"�������\" ���������� ������ �� ", "nlevel"=>4,"bonus1"=>"5 �����","bonus2"=>"10 �����","bonus3"=>"15 �����","bonus4"=>"20 �����","bonus5"=>"25 �����");
-$os["os4"]=array("name"=>"���������������","opt"=>"inc_expr","descr"=>"���������� ���� ������ �� ", "nlevel"=>4,"bonus1"=>"1 %","bonus2"=>"2 %","bonus3"=>"3 %","bonus4"=>"4 %","bonus5"=>"5 %");
-$os["os5"]=array("name"=>"�����������","opt"=>"inc_friends","descr"=>"C����� ������ ������ �� ","bonus1"=>5,"bonus2"=>10,"bonus3"=>15,"bonus4"=>20,"bonus5"=>25);
-$os["os6"]=array("name"=>"�����������","opt"=>"inc_hobby","descr"=>"���������� ������������� ������� ������� \"��������� / �����\" �� ","bonus1"=>"200 ��������","bonus2"=>"400 ��������","bonus3"=>"600 ��������","bonus4"=>"800 ��������","bonus5"=>"1000 ��������");
-$os["os7"]=array("name"=>"����������","opt"=>"max_inventory","descr"=>"������ ����� � ������� �� ", "nlevel"=>4,"bonus1"=>"10 ������","bonus2"=>"20 ������","bonus3"=>"30 ������","bonus4"=>"40 ������","bonus5"=>"50 ������");
-//$os["os8"]=array("name"=>"����������������","opt"=>"num_transfer","descr"=>"����� ������� � ���� ", "nlevel"=>4,"bonus1"=>"+20","bonus2"=>"+40","bonus3"=>"+60","bonus4"=>"+80","bonus5"=>"+100");
-$os["os9"]=array("name"=>"����������","opt"=>"speed_HP","descr"=>"�������� ����������������� ������� �� ", "npower"=>10,"bonus1"=>"+5%","bonus2"=>"+10%","bonus3"=>"+15%","bonus4"=>"+20%","bonus5"=>"+30%");    
-$os["os10"]=array("name"=>"��������������","opt"=>"speed_MP","descr"=>"���� ����������������� ������� �� ", "nwis"=>20,"bonus1"=>"+5%","bonus2"=>"+10%","bonus3"=>"+15%","bonus4"=>"+20%","bonus5"=>"+25%");    
-//$os["os11"]=array("name"=>"�������� ���","opt"=>"speed_debuff","descr"=>"�� ����� ��� ����� �������� ���������� �������� ����� �� ��������� ", "nlevel"=>5,"bonus1"=>"10% �� ����������","bonus2"=>"20% �� ����������","bonus3"=>"30% �� ����������","bonus4"=>"40% �� ����������","bonus5"=>"50% �� ����������");
-?>
-	<? echo $u->microLogin($u->info['id'],1);?>
-	&nbsp; &nbsp;
-<TD valign=top align=right>
-<INPUT class="btn" TYPE=button value='��������' style='width: 100px' onclick='location="main.php?skills=1&p_raz="+p_raz+"&rz="+newrz+"&all=<?=$_GET['all'];?>&rnd=<? echo $code; ?>"'>
-<INPUT class="btn" TYPE=button value="���������" style='width: 100px' onClick="location.href='main.php'"></div>
+        $os["os1"] = ["name" => "������������", "opt" => "dec_transfer", "descr" => "�������� ��������� ������� �� ", "nlevel" => 4, "bonus1" => "0,1 ��.", "bonus2" => "0,2 ��.", "bonus3" => "0,3 ��.", "bonus4" => "0,4 ��.", "bonus5" => "0,5 ��."];
+        //$os["os2"]=array("name"=>"�������","opt"=>"dec_travma","descr"=>"����� ������ ������ �� ", "nlevel"=>4,"bonus1"=>"5%","bonus2"=>"10%","bonus3"=>"15%","bonus4"=>"20%","bonus5"=>"25%");
+        $os["os3"] = ["name" => "�������", "opt" => "fast_homeworld", "descr" => "������ \"�������\" ���������� ������ �� ", "nlevel" => 4, "bonus1" => "5 �����", "bonus2" => "10 �����", "bonus3" => "15 �����", "bonus4" => "20 �����", "bonus5" => "25 �����"];
+        $os["os4"] = ["name" => "���������������", "opt" => "inc_expr", "descr" => "���������� ���� ������ �� ", "nlevel" => 4, "bonus1" => "1 %", "bonus2" => "2 %", "bonus3" => "3 %", "bonus4" => "4 %", "bonus5" => "5 %"];
+        $os["os5"] = ["name" => "�����������", "opt" => "inc_friends", "descr" => "C����� ������ ������ �� ", "bonus1" => 5, "bonus2" => 10, "bonus3" => 15, "bonus4" => 20, "bonus5" => 25];
+        $os["os6"] = ["name" => "�����������", "opt" => "inc_hobby", "descr" => "���������� ������������� ������� ������� \"��������� / �����\" �� ", "bonus1" => "200 ��������", "bonus2" => "400 ��������", "bonus3" => "600 ��������", "bonus4" => "800 ��������", "bonus5" => "1000 ��������"];
+        $os["os7"] = ["name" => "����������", "opt" => "max_inventory", "descr" => "������ ����� � ������� �� ", "nlevel" => 4, "bonus1" => "10 ������", "bonus2" => "20 ������", "bonus3" => "30 ������", "bonus4" => "40 ������", "bonus5" => "50 ������"];
+        //$os["os8"]=array("name"=>"����������������","opt"=>"num_transfer","descr"=>"����� ������� � ���� ", "nlevel"=>4,"bonus1"=>"+20","bonus2"=>"+40","bonus3"=>"+60","bonus4"=>"+80","bonus5"=>"+100");
+        $os["os9"] = ["name" => "����������", "opt" => "speed_HP", "descr" => "�������� ����������������� ������� �� ", "npower" => 10, "bonus1" => "+5%", "bonus2" => "+10%", "bonus3" => "+15%", "bonus4" => "+20%", "bonus5" => "+30%"];
+        $os["os10"] = ["name" => "��������������", "opt" => "speed_MP", "descr" => "���� ����������������� ������� �� ", "nwis" => 20, "bonus1" => "+5%", "bonus2" => "+10%", "bonus3" => "+15%", "bonus4" => "+20%", "bonus5" => "+25%"];
+        //$os["os11"]=array("name"=>"�������� ���","opt"=>"speed_debuff","descr"=>"�� ����� ��� ����� �������� ���������� �������� ����� �� ��������� ", "nlevel"=>5,"bonus1"=>"10% �� ����������","bonus2"=>"20% �� ����������","bonus3"=>"30% �� ����������","bonus4"=>"40% �� ����������","bonus5"=>"50% �� ����������");
+        ?>
+        <?php
+        echo $u->microLogin($u->info['id'], 1); ?>
+        &nbsp; &nbsp;
+    <TD valign=top align=right>
+        <INPUT class="btn" TYPE=button value='��������' style='width: 100px'
+               onclick='location="main.php?skills=1&p_raz="+p_raz+"&rz="+newrz+"&all=<?= $_GET['all']; ?>&rnd=<?php
+               echo $code; ?>"'>
+        <INPUT class="btn" TYPE=button value="���������" style='width: 100px' onClick="location.href='main.php'"></div>
 </TABLE>
 <TABLE border=0 cellspacing=0 cellpadding=0 width=100%>
-<TD width=30% valign=top>
-<TABLE border=0 cellspacing=1 cellpadding=0 width=100%>
-<TR>
-<TD height="10" class=tzS>�������������� ���������</TD>
-<TR><TD style='padding-left: 5'>
-<STYLE> 
-IMG.skill{width:9px;height:9px;cursor:pointer}
-TD.skill{font-weight:bold}
-TD.skills{font-weight:bold;color:#600000}
-TD.skillb{font-weight:bold;color:#006000}
-.linestl1 {
-	background-color: #E2E0E0;
-	font-size: 10px;
-	font-weight: bold;
-}
-</STYLE>
+    <TD width=30% valign=top>
+        <TABLE border=0 cellspacing=1 cellpadding=0 width=100%>
+            <TR>
+                <TD height="10" class=tzS>�������������� ���������</TD>
+            <TR>
+                <TD style='padding-left: 5'>
+                    <STYLE>
+                        IMG.skill {
+                            width: 9px;
+                            height: 9px;
+                            cursor: pointer
+                        }
 
-<TABLE cellSpacing=0>
-<TR id="str" onMouseDown="ChangeSkill(event,this)" onMouseUp="DropTimer()" onClick="OnClick(event,this);">
-<TD>&bull; ����: </TD>
-<TD width=40 class="skill" align="right" wdth=30><?=$u->stats['s1']?></TD>
-<TD width=60 noWrap><?=$str?></TD>
-<?if ($u->info['ability']>0){?><TD><IMG id="minus_str" SRC=https://img.new-combats.com/i/minus.gif class="nonactive" ALT="���������">&nbsp;<IMG SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������" id="plus_str"></TD><?}?>
-</TR>
-<TR id="dex" onMouseDown="ChangeSkill( event, this )" onMouseUp="DropTimer()"  onclick="OnClick(event,this);">
-<TD>&bull; ��������: </TD>
-<TD width=40 class="skill" align="right" wdth=30><?=$u->stats['s2']?><BR></small></TD>
-<TD width=60 noWrap><?=$dex?></TD>
-<?if ($u->info['ability']>0){?><TD><IMG id="minus_dex" SRC=https://img.new-combats.com/i/minus.gif class="nonactive" ALT="���������">&nbsp;<IMG SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������" id="plus_dex"></TD><?}?>
-</TR>
-<TR id="inst" onMouseDown="ChangeSkill( event, this )" onMouseUp="DropTimer()"  onclick="OnClick(event,this);">
-<TD>&bull; ��������: </TD>
-<TD width=40 class="skill" align="right" wdth=30><?=$u->stats['s3']?><BR></small></TD>
-<TD width=60 noWrap><?=$inst?></TD>
-<?if ($u->info['ability']>0){?><TD><IMG id="minus_inst" SRC=https://img.new-combats.com/i/minus.gif class="nonactive" ALT="���������">&nbsp;<IMG SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������" id="plus_inst"></TD><?}?>
-</TR>
-<TR id="power" onMouseDown="ChangeSkill( event, this )" onMouseUp="DropTimer()"  onclick="OnClick(event,this);">
-<TD>&bull; ������������: </TD>
-<TD width=40 class="skill" align="right" wdth=30><?=$u->stats['s4']?><BR></small></TD>
-<TD width=60 noWrap></TD>
-<?if ($u->info['ability']>0){?><TD><IMG id="minus_power" SRC=https://img.new-combats.com/i/minus.gif class="nonactive" ALT="���������">&nbsp;<IMG SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������"  id="plus_power"></TD><?}?>
-</TR>
-<?if ($u->info['level'] > 3) {?>
-<TR id="intel" onMouseDown="ChangeSkill( event, this )" onMouseUp="DropTimer()"  onclick="OnClick(event,this);">
-<TD>&bull; ���������: </TD>
-<TD width=40 class="skill" align="right" wdth=30><?=$u->stats['s5']?></TD>
-<TD width=60 noWrap><?=$intel?></TD>
-<?if ($u->info['ability']>0){?><TD><IMG id="minus_intel" SRC=https://img.new-combats.com/i/minus.gif class="nonactive" ALT="���������">&nbsp;<IMG SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������"  id="plus_intel"></TD><?}?>
-</TR>
-<?}if ($u->info['level'] > 6) {?>
-<TR id="wis" onMouseDown="ChangeSkill( event, this )" onMouseUp="DropTimer()"  onclick="OnClick(event,this);">
-<TD>&bull; ��������: </TD>
-<TD width=40 class="skill" align="right" wdth=30><?=$u->stats['s6']?></TD>
-<TD width=60 noWrap></TD>
-<?if ($u->info['ability']>0){?><TD><IMG id="minus_wis" SRC=https://img.new-combats.com/i/minus.gif class="nonactive" ALT="���������">&nbsp;<IMG SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������"  id="plus_wis"></TD><?}?>
-</TR>
-<?}if ($u->info['level'] > 9) {?>
-<TR id="spirit" onMouseDown="ChangeSkill( event, this )" onMouseUp="DropTimer()"  onclick="OnClick(event,this);">
-<TD>&bull; ����������: </TD>
-<TD width=40 class="skill" align="right" wdth=30><?=$u->stats['s7']?></TD>
-<TD width=60 noWrap></TD>
-<?if ($u->info['ability']>0){?><TD><IMG id="minus_spirit" SRC=https://img.new-combats.com/i/minus.gif class="nonactive" ALT="���������">&nbsp;<IMG SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������"  id="plus_spirit"></TD><?}?>
-</TR>
-<?}if ($u->info['level'] > 12) {?>
-<TR id="will" onMouseDown="ChangeSkill( event, this )" onMouseUp="DropTimer()"  onclick="OnClick(event,this);">
-<TD>&bull; ����: </TD>
-<TD width=40 class="skill" align="right" wdth=30><?=$u->stats['s8']?></TD>
-<TD width=60 noWrap></TD>
-<?if ($u->info['ability']>0){?><TD><IMG id="minus_will" SRC=https://img.new-combats.com/i/minus.gif class="nonactive" ALT="���������">&nbsp;<IMG SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������"  id="plus_will"></TD><?}?>
-</TR>
-<?}if ($u->info['level'] > 15) {?>
-<TR id="freedom" onMouseDown="ChangeSkill( event, this )" onMouseUp="DropTimer()"  onclick="OnClick(event,this);">
-<TD>&bull; ������� ����: </TD>
-<TD width=40 class="skill" align="right" wdth=30><?=$u->stats['s9']?></TD>
-<TD width=60 noWrap></TD>
-<?if ($u->info['ability']>0){?><TD><IMG id="minus_freedom" SRC=https://img.new-combats.com/i/minus.gif class="nonactive" ALT="���������">&nbsp;<IMG SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������"  id="plus_freedom"></TD><?}?>
-</TR>
-<?}if ($u->info['level'] > 18) {?>
-<TR id="god" onMouseDown="ChangeSkill( event, this )" onMouseUp="DropTimer()"  onclick="OnClick(event,this);">
-<TD>&bull; ��������������: </TD>
-<TD width=40 class="skill" align="right" wdth=30><?=$u->stats['s10']?></TD>
-<TD width=60 noWrap></TD>
-<?if ($u->info['ability']>0){?><TD><IMG id="minus_god" SRC=https://img.new-combats.com/i/minus.gif class="nonactive" ALT="���������">&nbsp;<IMG SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������"  id="plus_god"></TD><?}?>
-</TR>
-<?}?>
-<?
-/*<TR id="energy" onMouseDown="ChangeSkill( event, this )" onMouseUp="DropTimer()"  onclick="OnClick(event,this);">
-<TD>&bull; �������: </TD>
-<TD width=40 class="skill" align="right" wdth=30><?=$u->stats['s11']?></TD>
-<TD width=60 noWrap></TD>
-*/
-?>
-<?
-/*
-if ($u->info['ability']>0){?><TD><IMG id="minus_energy" SRC=https://img.new-combats.com/i/minus.gif class="nonactive" ALT="���������">&nbsp;<IMG SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������"  id="plus_energy"></TD><?
-} */?>
-</TR>
-</TABLE>
-<INPUT class="btn btn-success" type="button" value="���������" disabled id="save_button0" onClick="SaveSkill()">
-<INPUT type="checkbox" onClick="ChangeButtonState(0)">
-<br><FONT COLOR=green><br>
-<? if($u->info['ability']>0){?>&nbsp;��������� ����������: <SPAN id=UP><?=$u->info['ability']?></SPAN><BR><?}?>
+                        TD.skill {
+                            font-weight: bold
+                        }
 
-<? if($u->info['skills']>0){?>&nbsp;��������� ������: <SPAN id=m_UP><?=$u->info['skills']?></SPAN><BR><?}?>
+                        TD.skills {
+                            font-weight: bold;
+                            color: #600000
+                        }
 
-<? if($u->info['sskills']>0){?>&nbsp;��������� ������������: <SPAN id=m_UP><?=$u->info['sskills']?></SPAN><BR><?}?>
-</FONT>
-<Br><Br>
-<INPUT TYPE=button class="btn btn-danger" onClick="window.open('https://new-combats.com/stats_bonus.php/', 'stats_bonus', 'location=yes,menubar=yes,status=yes,resizable=yes,toolbar=yes,scrollbars=yes,scrollbars=yes')" value="�������� ������">
-                    <br/><br/>
-                    <small>
-                        <b>������������ ������������� ����������� ����� ������� � �������� �������� �������.</b>:<br/>
-                        - <font color=green><b>��������</b></font> ( <b>������</b> ): 1 ���� = 0,5 � ����� � 1 ������������ = +1 � �����.<br/>
-                        - <font color=green><b>�������</b></font> ( <b>����</b> ): 1 �������� = 1 � �����.<br/>
-                        - <font color=green><b>�������</b></font> ( <b>�������</b> ): 1 ���� = 0,25 � ����� � 1 �������� = 0,75 � �����.<br/>
-                        - <font color=green><b>�������</b></font> ( <b>������</b> ): 1 ���� = 1,2 � �����.<br/>
-                    </small>
-                    </FONT>
-</FONT>
-</TABLE>
-<SCRIPT> 
-var nUP = <?=$u->info['ability']?>;
-var oUP = document.getElementById( "UP" );
-var nm_UP = <?=$u->info['skills']?>;
-var m_UP = document.getElementById( "m_UP" );
-var arrChange = { };
-var arrMin = {str: <?=$st['s1']?>, dex: <?=$st['s2']?>, inst: <?=$st['s3']?>, power: <?=$st['s4']?><?if($u->info['level']>3) {?>, intel: <?=$st['s5']?><?}?>
-<?if($u->info['level']>6) {?>, wis: <?=$st['s6']?><?}?><?if($u->info['level']>9) {?>, spirit: <?=$st['s7']?><?}?><?if($u->info['level']>12) {?>, will: <?=$st['s8']?><?}?><?if($u->info['level']>15) {?>, freedom: <?=$st['s9']?><?}?><?if($u->info['level']>18) {?>,god: <?=$st['s10']?><?}?>
-};
-var skillsArr = new Array ();
-skillsArr["m_axe"] = <?=$st['a4']?>;
-skillsArr["m_molot"] = <?=$st['a3']?>;
-skillsArr["m_staff"] = <?=$st['a5']?>;
-skillsArr["m_sword"] = <?=$st['a1']?>;
-skillsArr["m_tohand"] = <?=$st['a2']?>;
-skillsArr["m_magic1"] = <?=$st['mg1']?>;
-skillsArr["m_magic2"] = <?=$st['mg2']?>;
-skillsArr["m_magic3"] = <?=$st['mg3']?>;
-skillsArr["m_magic4"] = <?=$st['mg4']?>;
-skillsArr["m_magic5"] = <?=$st['mg5']?>;
-skillsArr["m_magic6"] = <?=$st['mg6']?>;
-skillsArr["m_magic7"] = <?=$st['mg7']?>;
-function SetAllSkills(isOn) {
-var arrSkills = new Array("str", "dex", "inst", "power", "intel", "wis", "spirit", "will", "freedom", "god");
-for (var i in arrSkills) {
-var clname = ( isOn ) ? "skill" : "nonactive";
-if( oNode = document.getElementById( "plus_" + arrSkills[i] ) ) oNode.className=clname;
-}
-}
-var t;
-function OnClick(eEvent, This) {
-DropTimer();
-var oNode = eEvent.target || eEvent.srcElement;
-if( oNode.nodeName != "IMG" ) return;
-var nDelta = ( oNode.nextSibling ) ? -1 : 1;
-MakeSkillStep(nDelta, This, 0);
-}
-function DropTimer() {
-if (t) {
-clearTimeout(t);
-t = 0;
-}
-}
-function ChangeSkill( eEvent, This ) {
-var oNode = eEvent.target || eEvent.srcElement;
-if( oNode.nodeName != "IMG" ) return;
-var nDelta = ( oNode.nextSibling ) ? -1 : 1;
-t=setTimeout(function() {MakeSkillStep(nDelta, This, 1)}, 500);
-}
-function MakeSkillStep(nDelta, This, IsRecurse) {
-if ((nUP - nDelta ) < 0) return;
-var id = This.id;
-if (!arrChange[ id ]) arrChange[ id ] = 0;
-if ((arrChange[ id ] + nDelta) < 0 ) {
-if (oNode = document.getElementById( "minus_" + id ))
-oNode.className = "nonactive";
-return;
-}
-SetAllSkills(( nUP - nDelta ));
-arrChange[ id ] += nDelta;
-This.cells[ 1 ].innerHTML = parseFloat( This.cells[ 1 ].innerHTML ) + nDelta;
-if( oNode = document.getElementById( id + "_inst" ) )
-oNode.innerHTML = parseFloat( oNode.innerHTML ) + nDelta;
-oUP.innerHTML = nUP -= nDelta;
-if ( !arrChange[ id ] ) {
-if( oNode = document.getElementById( "minus_" + id ) ) oNode.className = "nonactive";
-} else {
-if( oNode = document.getElementById( "minus_" + id ) ) oNode.className = "skill";
-}
-if (IsRecurse) t = setTimeout(function(){MakeSkillStep(nDelta, This, 1)}, 50);
-}
-function ChangeAbility( id, nDelta, inst, maxval) {
-IsTimerStarted = 0;
-if( ( nm_UP - nDelta ) < 0 ) return;
-if( !arrChange[ id ] ) arrChange[ id ] = 0;
-if( ( arrChange[ id ] + nDelta ) == 0 )  {
-if( oNode = document.getElementById( "minus_" + id ) ) oNode.className = "nonactive";
-}
-if (nDelta > 0 && ( arrChange[ id ] + nDelta + inst ) == maxval) {
-skillsArr[id] = 1;
-if( oNode = document.getElementById( "plus_" + id ) ) oNode.className = "nonactive";
-}
-if( ( arrChange[ id ] + nDelta ) < 0 ) return;
-if (nDelta > 0 && ( arrChange[ id ] + nDelta + inst ) > maxval) return;
-arrChange[ id ] += nDelta;
-if( ( nm_UP - nDelta ) == 0 )  {
-for (var i in skillsArr) {
-if( oNode = document.getElementById( "plus_" + i ) ) oNode.className = "nonactive";
-}
-}
-if( oNode = document.getElementById( id + "_base" ) )
-oNode.innerHTML = parseFloat( oNode.innerHTML ) + nDelta;
-if( oNode = document.getElementById( id + "_inst" ) )
-oNode.innerHTML = parseFloat( oNode.innerHTML ) + nDelta;
-m_UP.innerHTML = nm_UP -= nDelta;
-if ( nDelta > 0 ) {
-prefix = "minus_";
-} else {
-prefix = "plus_";
-skillsArr[id] = 0;
-for (var i in skillsArr) {
-if (skillsArr[i]==0)  {
-if( oNode = document.getElementById( "plus_" + i ) ) oNode.className = "skill";
-}
-}
-}
-if( oNode = document.getElementById( prefix + id ) ) oNode.className = "skill";
-}
-function SaveSkill( This ) {
-var sHref = "main.php?skills=1&upr=save&s4i=<?=$u->info['id']?>";
-for( var i in arrChange )
-if( arrChange[ i ] > 0 )
-sHref += "&" + i + "=" + arrChange[ i ];
-if (This) {
-This.href = sHref;
-} else {
-document.location = sHref;
-}
-return true;
-}
-function SaveAbility(This) {
-var sHref = "main.php?skills=1&upr=save&s4i=<?=$u->info['id']?>";
-for( var i in arrChange )
-if( arrChange[ i ] > 0 )
-sHref += "&" + i + "=" + arrChange[ i ];
-if (This) {
-This.href = sHref;
-} else {
-document.location = sHref;
-}
-return true;
-}
-function ChangeButtonState(bid) {
-var button = document.getElementById( "save_button"+bid );
-if (button.disabled) {
-button.disabled = 0;
-} else {
-button.disabled = 1;
-}
-}
-</SCRIPT>
+                        TD.skillb {
+                            font-weight: bold;
+                            color: #006000
+                        }
 
-<TD width=1 bgcolor=#A0A0A0><SPAN></SPAN></TD>
-<TD valign=top>
-<TABLE border=0 cellspacing=1 cellpadding=0 width=100%>
-<TR>
+                        .linestl1 {
+                            background-color: #E2E0E0;
+                            font-size: 10px;
+                            font-weight: bold;
+                        }
+                    </STYLE>
 
-<TD class=tz id=L1 width=150 height="10" onMouseOver="highl('L1',1)" onMouseOut="highl('L1',0)" onClick="setlevel('L1')">����������</TD>
-<? if($u->info['level']>1){ ?>
-<TD class=tz id=L3 width=150 onMouseOver="highl('L3',1)" onMouseOut="highl('L3',0)" onClick="setlevel('L3')">�����������</TD>
-<? /*if( $u->info['inTurnir'] == 0 ) {*/ ?>
-<TD>
-<TD class=tz id=L4 width=150 onMouseOver="highl('L4',1)" onMouseOut="highl('L4',0)" onClick="setlevel('L4')">������</TD>
-<? /*}*/ ?>
-<? } ?>
-
-<? if($znn!=''){ ?><TD><TD class=tz id=L7 width=150 onMouseOver="highl('L7',1)" onMouseOut="highl('L7',0)" onClick="setlevel('L7')">������</TD><? } ?>
-<TD>
-<TD class=tz id=L5 width=150 onMouseOver="highl('L5',1)" onMouseOut="highl('L5',0)" onClick="setlevel('L5')">���������</TD>
- 
-<TD>
-<TD class=tz id=L6 width=150 onMouseOver="highl('L6',1)" onMouseOut="highl('L6',0)" onClick="setlevel('L6')">���������</TD>
-<TD class=tz >&nbsp</TD>
-</TR>
-</TABLE>
-<TABLE border=0 cellspacing=1 cellpadding=0 width=100%>
-<TD width=100% style='padding-left: 7'>
-<div class=dtz ID=dL1>
+                    <TABLE cellSpacing=0>
+                        <TR id="str" onMouseDown="ChangeSkill(event,this)" onMouseUp="DropTimer()"
+                            onclick="OnClick(event,this);">                            <TD>&bull; ����:</TD>                            <TD width=40 class="skill" align="right" wdth=30><?= $u->stats['s1'] ?><BR></small></TD>                            <TD width=60 noWrap><?= $dex ?></TD>                            <?php
+                            if ($u->info['ability'] > 0) { ?>                                <TD><IMG id="minus_dex" SRC=https://img.new-combats.com/i/minus.gif class="nonactive"                                         ALT="���������">&nbsp;<IMG SRC=https://img.new-combats.com/i/plus.gif                                                                    class=skill ALT="���������" id="plus_dex"></TD><?php                            } ?>
+                        </TR>
+                        <TR id="dex" onMouseDown="ChangeSkill( event, this )" onMouseUp="DropTimer()"
+                            onclick="OnClick(event,this);">
+                            <TD>&bull; ��������:</TD>
+                            <TD width=40 class="skill" align="right" wdth=30><?= $u->stats['s2'] ?><BR></small></TD>
+                            <TD width=60 noWrap><?= $dex ?></TD>
+                            <?php
+                            if ($u->info['ability'] > 0) { ?>
+                                <TD><IMG id="minus_dex" SRC=https://img.new-combats.com/i/minus.gif class="nonactive"
+                                         ALT="���������">&nbsp;<IMG SRC=https://img.new-combats.com/i/plus.gif
+                                                                    class=skill ALT="���������" id="plus_dex"></TD><?php
+                            } ?>
+                        </TR>
+                        <TR id="inst" onMouseDown="ChangeSkill( event, this )" onMouseUp="DropTimer()"
+                            onclick="OnClick(event,this);">
+                            <TD>&bull; ��������:</TD>
+                            <TD width=40 class="skill" align="right" wdth=30><?= $u->stats['s3'] ?><BR></small></TD>
+                            <TD width=60 noWrap><?= $inst ?></TD>
+                            <?php
+                            if ($u->info['ability'] > 0) { ?>                                <TD><IMG id="minus_dex" SRC=https://img.new-combats.com/i/minus.gif class="nonactive"                                         ALT="���������">&nbsp;<IMG SRC=https://img.new-combats.com/i/plus.gif                                                                    class=skill ALT="���������" id="plus_dex"></TD><?php                            } ?>
+                        </TR>
+                        <TR id="power" onMouseDown="ChangeSkill( event, this )" onMouseUp="DropTimer()"
+                            onclick="OnClick(event,this);">
+                            <TD>&bull; ������������:</TD>
+                            <TD width=40 class="skill" align="right" wdth=30><?= $u->stats['s4'] ?><BR></small></TD>
+                            <TD width=60 noWrap></TD>
+                            <?php
+                            if ($u->info['ability'] > 0) { ?>                                <TD><IMG id="minus_dex" SRC=https://img.new-combats.com/i/minus.gif class="nonactive"                                         ALT="���������">&nbsp;<IMG SRC=https://img.new-combats.com/i/plus.gif                                                                    class=skill ALT="���������" id="plus_dex"></TD><?php                            } ?>
+                        </TR>
+                        <?php
+                        if ($u->info['level'] > 3) { ?>
+                            <TR id="intel" onMouseDown="ChangeSkill( event, this )" onMouseUp="DropTimer()"
+                                onclick="OnClick(event,this);">
+                                <TD>&bull; ���������:</TD>
+                                <TD width=40 class="skill" align="right" wdth=30><?= $u->stats['s5'] ?></TD>
+                                <TD width=60 noWrap><?= $intel ?></TD>
+                                <?php
+                                if ($u->info['ability'] > 0) { ?>
+                                    <TD><IMG id="minus_intel" SRC=https://img.new-combats.com/i/minus.gif
+                                             class="nonactive" ALT="���������">&nbsp;<IMG
+                                                SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������"
+                                                id="plus_intel"></TD><?php
+                                } ?>
+                            </TR>
+                            <?php
+                        }
+                        if ($u->info['level'] > 6) { ?>
+                            <TR id="wis" onMouseDown="ChangeSkill( event, this )" onMouseUp="DropTimer()"
+                                onclick="OnClick(event,this);">
+                                <TD>&bull; ��������:</TD>
+                                <TD width=40 class="skill" align="right" wdth=30><?= $u->stats['s6'] ?></TD>
+                                <TD width=60 noWrap></TD>
+                                <?php
+                                if ($u->info['ability'] > 0) { ?>
+                                    <TD><IMG id="minus_wis" SRC=https://img.new-combats.com/i/minus.gif
+                                             class="nonactive" ALT="���������">&nbsp;<IMG
+                                                SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������"
+                                                id="plus_wis"></TD><?php
+                                } ?>
+                            </TR>
+                            <?php
+                        }
+                        if ($u->info['level'] > 9) { ?>
+                            <TR id="spirit" onMouseDown="ChangeSkill( event, this )" onMouseUp="DropTimer()"
+                                onclick="OnClick(event,this);">
+                                <TD>&bull; ����������:</TD>
+                                <TD width=40 class="skill" align="right" wdth=30><?= $u->stats['s7'] ?></TD>
+                                <TD width=60 noWrap></TD>
+                                <?php
+                                if ($u->info['ability'] > 0) { ?>
+                                    <TD><IMG id="minus_spirit" SRC=https://img.new-combats.com/i/minus.gif
+                                             class="nonactive" ALT="���������">&nbsp;<IMG
+                                                SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������"
+                                                id="plus_spirit"></TD><?php
+                                } ?>
+                            </TR>
+                            <?php
+                        }
+                        if ($u->info['level'] > 12) { ?>
+                            <TR id="will" onMouseDown="ChangeSkill( event, this )" onMouseUp="DropTimer()"
+                                onclick="OnClick(event,this);">
+                                <TD>&bull; ����:</TD>
+                                <TD width=40 class="skill" align="right" wdth=30><?= $u->stats['s8'] ?></TD>
+                                <TD width=60 noWrap></TD>
+                                <?php
+                                if ($u->info['ability'] > 0) { ?>
+                                    <TD><IMG id="minus_will" SRC=https://img.new-combats.com/i/minus.gif
+                                             class="nonactive" ALT="���������">&nbsp;<IMG
+                                                SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������"
+                                                id="plus_will"></TD><?php
+                                } ?>
+                            </TR>
+                            <?php
+                        }
+                        if ($u->info['level'] > 15) { ?>
+                            <TR id="freedom" onMouseDown="ChangeSkill( event, this )" onMouseUp="DropTimer()"
+                                onclick="OnClick(event,this);">
+                                <TD>&bull; ������� ����:</TD>
+                                <TD width=40 class="skill" align="right" wdth=30><?= $u->stats['s9'] ?></TD>
+                                <TD width=60 noWrap></TD>
+                                <?php
+                                if ($u->info['ability'] > 0) { ?>
+                                    <TD><IMG id="minus_freedom" SRC=https://img.new-combats.com/i/minus.gif
+                                             class="nonactive" ALT="���������">&nbsp;<IMG
+                                                SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������"
+                                                id="plus_freedom"></TD><?php
+                                } ?>
+                            </TR>
+                            <?php
+                        }
+                        if ($u->info['level'] > 18) { ?>
+                            <TR id="god" onMouseDown="ChangeSkill( event, this )" onMouseUp="DropTimer()"
+                                onclick="OnClick(event,this);">
+                                <TD>&bull; ��������������:</TD>
+                                <TD width=40 class="skill" align="right" wdth=30><?= $u->stats['s10'] ?></TD>
+                                <TD width=60 noWrap></TD>
+                                <?php
+                                if ($u->info['ability'] > 0) { ?>
+                                    <TD><IMG id="minus_god" SRC=https://img.new-combats.com/i/minus.gif
+                                             class="nonactive" ALT="���������">&nbsp;<IMG
+                                                SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������"
+                                                id="plus_god"></TD><?php
+                                } ?>
+                            </TR>
+                            <?php
+                        } ?>
+                        </TR>
+                    </TABLE>
+                    <INPUT class="btn btn-success" type="button" value="���������" disabled id="save_button0"
+                           onClick="SaveSkill()">
+                    <INPUT type="checkbox" onClick="ChangeButtonState(0)">
+                    <div style="color: green; margin: 16px 0;" id="ups">
+                        <?php
+                        if ($u->info['ability']) {
+                            echo "��������� ����������: <span id='UP'>{$u->info['ability']}</span><br>";
+                        }
+                        if ($u->info['skills']) {
+                            echo "��������� ������: <span id='m_UP'>{$u->info['skills']}</span><br>";
+                        }
+                        if ($u->info['sskills']) {
+                            echo "��������� ������������: <span id='m_UP'>{$u->info['sskills']}</span><br>";
+                        }
+                        ?>
+                    </div>
+                    <div>
+                        <INPUT TYPE=button class="btn btn-danger"
+                               onClick="window.open('https://new-combats.com/stats_bonus.php/', 'stats_bonus', 'location=yes,menubar=yes,status=yes,resizable=yes,toolbar=yes,scrollbars=yes,scrollbars=yes')"
+                               value="�������� ������">
+                        <br/><br/>
+                        <small>
+                            <b>������������ ������������� ����������� ����� ������� � �������� ��������
+                                �������.</b>:<br/>
+                            - <b style="color: green">��������</b> (������): 1 ���� = 0,5 � ����� � 1 ������������ = +1
+                            �
+                            �����.<br/>
+                            - <b style="color: green">�������</b> (����): 1 �������� = 1 � �����.<br/>
+                            - <b style="color: green">�������</b> (�������): 1 ���� = 0,25 � ����� � 1 �������� = 0,75 �
+                            �����.<br/>
+                            - <b style="color: green">�������</b> (������): 1 ���� = 1,2 � �����.<br/>
+                        </small>
+                    </div>
 
 
-<table>
-<tr><td colspan="4"><b>������:</b></td></tr>
+        </TABLE>
+        <SCRIPT>
+            var nUP = <?=$u->info['ability']?>;
+            var oUP = document.getElementById("UP");
+            var nm_UP = <?=$u->info['skills']?>;
+            var m_UP = document.getElementById("m_UP");
+            var arrChange = {};
+            var arrMin = {
+                str: <?=$st['s1']?>,
+                dex: <?=$st['s2']?>,
+                inst: <?=$st['s3']?>,
+                power: <?=$st['s4']?>
+                <?php if($u->info['level'] > 3) {?>,
+                intel: <?=$st['s5']?>
+                <?php } ?>
+                <?php if($u->info['level'] > 6) {?>,
+                wis: <?=$st['s6']?>
+                <?php } ?>
+                <?php if($u->info['level'] > 9) {?>,
+                spirit: <?=$st['s7']?>
+                <?php }?>
+                <?php if($u->info['level'] > 12) {?>,
+                will: <?=$st['s8']?>
+                <?php }?>
+                <?php if($u->info['level'] > 15) {?>,
+                freedom: <?=$st['s9']?>
+                <?php }?>
+                <?php if($u->info['level'] > 18) {?>,
+                god: <?=$st['s10']?>
+                <?php }?>
+            };
+            var skillsArr = new Array();
+            skillsArr["m_axe"] = <?=$st['a4']?>;
+            skillsArr["m_molot"] = <?=$st['a3']?>;
+            skillsArr["m_staff"] = <?=$st['a5']?>;
+            skillsArr["m_sword"] = <?=$st['a1']?>;
+            skillsArr["m_tohand"] = <?=$st['a2']?>;
+            skillsArr["m_magic1"] = <?=$st['mg1']?>;
+            skillsArr["m_magic2"] = <?=$st['mg2']?>;
+            skillsArr["m_magic3"] = <?=$st['mg3']?>;
+            skillsArr["m_magic4"] = <?=$st['mg4']?>;
+            skillsArr["m_magic5"] = <?=$st['mg5']?>;
+            skillsArr["m_magic6"] = <?=$st['mg6']?>;
+            skillsArr["m_magic7"] = <?=$st['mg7']?>;
 
-<tr>
-<TD>&nbsp;&bull;&nbsp;���������� �������� ������: </TD>
-<TD width=40 class="skill" align="right" width=30 id='m_axe_base'><?=$u->stats['a4']?></small><BR></TD>
-<TD width=60 noWrap><?=$mec?></TD>
-<?if ($u->info['skills'] && $st['a4']<30){?>
-<TD>
-<IMG id="minus_m_axe" SRC=https://img.new-combats.com/i/minus.gif class=nonactive ALT="���������" onMouseUp="ChangeAbility('m_axe', -1, <?=$st['a4']?>, 30)">&nbsp;
-<IMG id="plus_m_axe" SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������" onMouseUp="ChangeAbility('m_axe', 1, <?=$st['a4']?>, 30)">
-</TD>
-<?}elseif($u->info['skills']>0 && $st['a4']>=30){?>
-<TD>
-<IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
-<IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
-</TD>
-<?}?>
-</tr>
+            function SetAllSkills(isOn) {
+                var arrSkills = new Array("str", "dex", "inst", "power", "intel", "wis", "spirit", "will", "freedom", "god");
+                for (var i in arrSkills) {
+                    var clname = (isOn) ? "skill" : "nonactive";
+                    if (oNode = document.getElementById("plus_" + arrSkills[i])) oNode.className = clname;
+                }
+            }
+
+            var t;
+
+            function OnClick(eEvent, This) {
+                DropTimer();
+                var oNode = eEvent.target || eEvent.srcElement;
+                if (oNode.nodeName != "IMG") return;
+                var nDelta = (oNode.nextSibling) ? -1 : 1;
+                MakeSkillStep(nDelta, This, 0);
+            }
+
+            function DropTimer() {
+                if (t) {
+                    clearTimeout(t);
+                    t = 0;
+                }
+            }
+
+            function ChangeSkill(eEvent, This) {
+                var oNode = eEvent.target || eEvent.srcElement;
+                if (oNode.nodeName != "IMG") return;
+                var nDelta = (oNode.nextSibling) ? -1 : 1;
+                t = setTimeout(function () {
+                    MakeSkillStep(nDelta, This, 1)
+                }, 500);
+            }
+
+            function MakeSkillStep(nDelta, This, IsRecurse) {
+                if ((nUP - nDelta) < 0) return;
+                var id = This.id;
+                if (!arrChange[id]) arrChange[id] = 0;
+                if ((arrChange[id] + nDelta) < 0) {
+                    if (oNode = document.getElementById("minus_" + id))
+                        oNode.className = "nonactive";
+                    return;
+                }
+                SetAllSkills((nUP - nDelta));
+                arrChange[id] += nDelta;
+                This.cells[1].innerHTML = parseFloat(This.cells[1].innerHTML) + nDelta;
+                if (oNode = document.getElementById(id + "_inst"))
+                    oNode.innerHTML = parseFloat(oNode.innerHTML) + nDelta;
+                oUP.innerHTML = nUP -= nDelta;
+                if (!arrChange[id]) {
+                    if (oNode = document.getElementById("minus_" + id)) oNode.className = "nonactive";
+                } else {
+                    if (oNode = document.getElementById("minus_" + id)) oNode.className = "skill";
+                }
+                if (IsRecurse) t = setTimeout(function () {
+                    MakeSkillStep(nDelta, This, 1)
+                }, 50);
+            }
+
+            function ChangeAbility(id, nDelta, inst, maxval) {
+                IsTimerStarted = 0;
+                if ((nm_UP - nDelta) < 0) return;
+                if (!arrChange[id]) arrChange[id] = 0;
+                if ((arrChange[id] + nDelta) == 0) {
+                    if (oNode = document.getElementById("minus_" + id)) oNode.className = "nonactive";
+                }
+                if (nDelta > 0 && (arrChange[id] + nDelta + inst) == maxval) {
+                    skillsArr[id] = 1;
+                    if (oNode = document.getElementById("plus_" + id)) oNode.className = "nonactive";
+                }
+                if ((arrChange[id] + nDelta) < 0) return;
+                if (nDelta > 0 && (arrChange[id] + nDelta + inst) > maxval) return;
+                arrChange[id] += nDelta;
+                if ((nm_UP - nDelta) == 0) {
+                    for (var i in skillsArr) {
+                        if (oNode = document.getElementById("plus_" + i)) oNode.className = "nonactive";
+                    }
+                }
+                if (oNode = document.getElementById(id + "_base"))
+                    oNode.innerHTML = parseFloat(oNode.innerHTML) + nDelta;
+                if (oNode = document.getElementById(id + "_inst"))
+                    oNode.innerHTML = parseFloat(oNode.innerHTML) + nDelta;
+                m_UP.innerHTML = nm_UP -= nDelta;
+                if (nDelta > 0) {
+                    prefix = "minus_";
+                } else {
+                    prefix = "plus_";
+                    skillsArr[id] = 0;
+                    for (var i in skillsArr) {
+                        if (skillsArr[i] == 0) {
+                            if (oNode = document.getElementById("plus_" + i)) oNode.className = "skill";
+                        }
+                    }
+                }
+                if (oNode = document.getElementById(prefix + id)) oNode.className = "skill";
+            }
+
+            function SaveSkill(This) {
+                var sHref = "main.php?skills=1&upr=save&s4i=<?=$u->info['id']?>";
+                for (var i in arrChange)
+                    if (arrChange[i] > 0)
+                        sHref += "&" + i + "=" + arrChange[i];
+                if (This) {
+                    This.href = sHref;
+                } else {
+                    document.location = sHref;
+                }
+                return true;
+            }
+
+            function SaveAbility(This) {
+                var sHref = "main.php?skills=1&upr=save&s4i=<?=$u->info['id']?>";
+                for (var i in arrChange)
+                    if (arrChange[i] > 0)
+                        sHref += "&" + i + "=" + arrChange[i];
+                if (This) {
+                    This.href = sHref;
+                } else {
+                    document.location = sHref;
+                }
+                return true;
+            }
+
+            function ChangeButtonState(bid) {
+                var button = document.getElementById("save_button" + bid);
+                if (button.disabled) {
+                    button.disabled = 0;
+                } else {
+                    button.disabled = 1;
+                }
+            }
+        </SCRIPT>
+
+    <TD width=1 bgcolor=#A0A0A0><SPAN></SPAN></TD>
+    <TD valign=top>
+        <TABLE border=0 cellspacing=1 cellpadding=0 width=100%>
+            <TR>
+
+                <TD class=tz id=L1 width=150 height="10" onMouseOver="highl('L1',1)" onMouseOut="highl('L1',0)"
+                    onClick="setlevel('L1')">����������
+                </TD>
+                <?php
+                if ($u->info['level'] > 1) { ?>
+                    <TD class=tz id=L3 width=150 onMouseOver="highl('L3',1)" onMouseOut="highl('L3',0)"
+                        onClick="setlevel('L3')">�����������
+                    </TD>
+                    <?php
+                    /*if( $u->info['inTurnir'] == 0 ) {*/ ?>
+                    <TD>
+                    <TD class=tz id=L4 width=150 onMouseOver="highl('L4',1)" onMouseOut="highl('L4',0)"
+                        onClick="setlevel('L4')">������
+                    </TD>
+                    <?php
+                    /*}*/ ?>
+                    <?php
+                } ?>
+
+                <?php
+                if ($znn != '') { ?>
+                    <TD>
+                    <TD class=tz id=L7 width=150 onMouseOver="highl('L7',1)" onMouseOut="highl('L7',0)"
+                        onClick="setlevel('L7')">������
+                    </TD><?php
+                } ?>
+                <TD>
+                <TD class=tz id=L5 width=150 onMouseOver="highl('L5',1)" onMouseOut="highl('L5',0)"
+                    onClick="setlevel('L5')">���������
+                </TD>
+
+                <TD>
+                <TD class=tz id=L6 width=150 onMouseOver="highl('L6',1)" onMouseOut="highl('L6',0)"
+                    onClick="setlevel('L6')">���������
+                </TD>
+                <TD class=tz>&nbsp</TD>
+            </TR>
+        </TABLE>
+        <TABLE border=0 cellspacing=1 cellpadding=0 width=100%>
+            <TD width=100% style='padding-left: 7'>
+                <div class=dtz ID=dL1>
 
 
-<tr>
-<TD>&nbsp;&bull;&nbsp;���������� �������� ��������, ��������: </TD>
-<TD width=40 class="skill" align="right" width=30 id='m_molot_base'><?=$u->stats['a3']?></small><BR></TD>
-<TD width=60 noWrap><?=$dub?></TD>
-<?if ($u->info['skills'] && $st['a3']<30){?>
-<TD>
-<IMG id="minus_m_molot" SRC=https://img.new-combats.com/i/minus.gif class=nonactive ALT="���������" onMouseUp="ChangeAbility('m_molot', -1, <?=$st['a3']?>,20)">&nbsp;
-<IMG id="plus_m_molot" SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������" onMouseUp="ChangeAbility('m_molot', 1, <?=$st['a3']?>, 30)">
-</TD>
-<?}elseif($u->info['skills']>0 && $st['a3']>=30){?>
-<TD>
-<IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
-<IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
-</TD>
-<?}?>
-</tr>
+                    <table>
+                        <tr>
+                            <td colspan="4"><b>������:</b></td>
+                        </tr>
 
-<tr>
-<TD>&nbsp;&bull;&nbsp;���������� �������� ������, ���������: </TD>
-<TD width=40 class="skill" align="right" width=30 id='m_sword_base'><?=$u->stats['a1']?></small><BR></TD>
-<TD width=60 noWrap><?=$nj?></TD>
-<?if ($u->info['skills'] && $st['a1']<30){?>
-<TD>
-<IMG id="minus_m_sword" SRC=https://img.new-combats.com/i/minus.gif class=nonactive ALT="���������" onMouseUp="ChangeAbility('m_sword', -1, <?=$st['a1']?>, 30)">&nbsp;
-<IMG id="plus_m_sword" SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������" onMouseUp="ChangeAbility('m_sword', 1, <?=$st['a1']?>, 30)">
-</TD>
-<?}elseif($u->info['skills']>0 && $st['a1']>=30){?>
-<TD>
-<IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
-<IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
-</TD>
-<?}?>
-</tr>
+                        <tr>
+                            <TD>&nbsp;&bull;&nbsp;���������� �������� ������:</TD>
+                            <TD width=40 class="skill" align="right" width=30
+                                id='m_axe_base'><?= $u->stats['a4'] ?></small><BR></TD>
+                            <TD width=60 noWrap><?= $mec ?></TD>
+                            <?php
+                            if ($u->info['skills'] && $st['a4'] < 30) { ?>
+                                <TD>
+                                    <IMG id="minus_m_axe" SRC=https://img.new-combats.com/i/minus.gif class=nonactive
+                                         ALT="���������" onMouseUp="ChangeAbility('m_axe', -1, <?= $st['a4'] ?>, 30)">&nbsp;
+                                    <IMG id="plus_m_axe" SRC=https://img.new-combats.com/i/plus.gif class=skill
+                                         ALT="���������" onMouseUp="ChangeAbility('m_axe', 1, <?= $st['a4'] ?>, 30)">
+                                </TD>
+                                <?php
+                            } elseif ($u->info['skills'] > 0 && $st['a4'] >= 30) { ?>
+                                <TD>
+                                    <IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
+                                    <IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
+                                </TD>
+                                <?php
+                            } ?>
+                        </tr>
 
-<tr>
-<TD>&nbsp;&bull;&nbsp;���������� �������� ��������, ��������: </TD>
-<TD width=40 class="skill" align="right" width=30 id='m_tohand_base'><?=$u->stats['a2']?></small><BR></TD>
-<TD width=60 noWrap><?=$top?></TD>
-<?if ($u->info['skills'] && $st['a2']<30){?>
-<TD>
-<IMG id="minus_m_tohand" SRC=https://img.new-combats.com/i/minus.gif class=nonactive ALT="���������" onMouseUp="ChangeAbility('m_tohand', -1, <?=$st['a2']?>, 30)">&nbsp;
-<IMG id="plus_m_tohand" SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������" onMouseUp="ChangeAbility('m_tohand', 1, <?=$st['a2']?>, 30)">
-</TD>
-<?}elseif($u->info['skills']>0 && $st['a2']>=30){?>
-<TD>
-<IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
-<IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
-</TD>
-<?}?>
-</tr>
 
-<tr>
-<TD>&nbsp;&bull;&nbsp;���������� �������� ����������� ��������: </TD>
-<TD width=40 class="skill" align="right" width=30 id='m_staff_base'><?=$u->stats['a5']?></small><BR></TD>
-<TD width=60 noWrap><?=$pos?></TD>
-<?if ($u->info['skills'] && $st['a5']<30){?>
-<TD>
-<IMG id="minus_m_staff" SRC=https://img.new-combats.com/i/minus.gif class=nonactive ALT="���������" onMouseUp="ChangeAbility('m_staff', -1, <?=$st['a5']?>, 30)">&nbsp;
-<IMG id="plus_m_staff" SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������" onMouseUp="ChangeAbility('m_staff', 1, <?=$st['a5']?>, 30)">
-</TD>
-<?}elseif($u->info['skills']>0 && $st['a5']>=30){?>
-<TD>
-<IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
-<IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
-</TD>
-<?}?>
-</tr>
-<tr><td colspan="4"><b>�����:<b></td></tr>
+                        <tr>
+                            <TD>&nbsp;&bull;&nbsp;���������� �������� ��������, ��������:</TD>
+                            <TD width=40 class="skill" align="right" width=30
+                                id='m_molot_base'><?= $u->stats['a3'] ?></small><BR></TD>
+                            <TD width=60 noWrap><?= $dub ?></TD>
+                            <?php
+                            if ($u->info['skills'] && $st['a3'] < 30) { ?>
+                                <TD>
+                                    <IMG id="minus_m_molot" SRC=https://img.new-combats.com/i/minus.gif class=nonactive
+                                         ALT="���������" onMouseUp="ChangeAbility('m_molot', -1, <?= $st['a3'] ?>,20)">&nbsp;
+                                    <IMG id="plus_m_molot" SRC=https://img.new-combats.com/i/plus.gif class=skill
+                                         ALT="���������" onMouseUp="ChangeAbility('m_molot', 1, <?= $st['a3'] ?>, 30)">
+                                </TD>
+                                <?php
+                            } elseif ($u->info['skills'] > 0 && $st['a3'] >= 30) { ?>
+                                <TD>
+                                    <IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
+                                    <IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
+                                </TD>
+                                <?php
+                            } ?>
+                        </tr>
 
-<tr>
-<TD>&nbsp;&bull;&nbsp;���������� �������� ������� ����: </TD>
-<TD width=40 class="skill" align="right" width=30 id='m_magic1_base'><?=$u->stats['mg1']?></small><BR></TD>
-<TD width=60 noWrap><?=$ogon?></TD>
-<?if ($u->info['skills'] && $st['mg1']<30){?>
-<TD>
-<IMG id="minus_m_magic1"  SRC=https://img.new-combats.com/i/minus.gif class=nonactive ALT="���������" onMouseUp="ChangeAbility('m_magic1', -1, <?=$st['mg1']?>, 30)">&nbsp;
-<IMG id="plus_m_magic1"  SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������" onMouseUp="ChangeAbility('m_magic1', 1, <?=$st['mg1']?>, 30)">
-</TD>
-<?}elseif($u->info['skills']>0 && $st['mg1']>=30){?>
-<TD>
-<IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
-<IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
-</TD>
-<?}?>
-</tr>
+                        <tr>
+                            <TD>&nbsp;&bull;&nbsp;���������� �������� ������, ���������:</TD>
+                            <TD width=40 class="skill" align="right" width=30
+                                id='m_sword_base'><?= $u->stats['a1'] ?></small><BR></TD>
+                            <TD width=60 noWrap><?= $nj ?></TD>
+                            <?php
+                            if ($u->info['skills'] && $st['a1'] < 30) { ?>
+                                <TD>
+                                    <IMG id="minus_m_sword" SRC=https://img.new-combats.com/i/minus.gif class=nonactive
+                                         ALT="���������" onMouseUp="ChangeAbility('m_sword', -1, <?= $st['a1'] ?>, 30)">&nbsp;
+                                    <IMG id="plus_m_sword" SRC=https://img.new-combats.com/i/plus.gif class=skill
+                                         ALT="���������" onMouseUp="ChangeAbility('m_sword', 1, <?= $st['a1'] ?>, 30)">
+                                </TD>
+                                <?php
+                            } elseif ($u->info['skills'] > 0 && $st['a1'] >= 30) { ?>
+                                <TD>
+                                    <IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
+                                    <IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
+                                </TD>
+                                <?php
+                            } ?>
+                        </tr>
 
-<tr>
-<TD>&nbsp;&bull;&nbsp;���������� �������� ������� �������: </TD>
-<TD width=40 class="skill" align="right" width=30 id='m_magic2_base'><?=$u->stats['mg2']?></small><BR></TD>
-<TD width=60 noWrap><?=$voda?></TD>
-<?if ($u->info['skills'] && $st['mg2']<30){?>
-<TD>
-<IMG id="minus_m_magic2"  SRC=https://img.new-combats.com/i/minus.gif class=nonactive ALT="���������" onMouseUp="ChangeAbility('m_magic2', -1, <?=$st['mg2']?>, 30)">&nbsp;
-<IMG id="plus_m_magic2"  SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������" onMouseUp="ChangeAbility('m_magic2', 1, <?=$st['mg2']?>, 30)">
-</TD>
-<? }elseif($u->info['skills']>0 && $st['mg2']>=30){?>
-<TD>
-<IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
-<IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
-</TD>
-<? } ?>
-</tr>
+                        <tr>
+                            <TD>&nbsp;&bull;&nbsp;���������� �������� ��������, ��������:</TD>
+                            <TD width=40 class="skill" align="right" width=30
+                                id='m_tohand_base'><?= $u->stats['a2'] ?></small><BR></TD>
+                            <TD width=60 noWrap><?= $top ?></TD>
+                            <?php
+                            if ($u->info['skills'] && $st['a2'] < 30) { ?>
+                                <TD>
+                                    <IMG id="minus_m_tohand" SRC=https://img.new-combats.com/i/minus.gif class=nonactive
+                                         ALT="���������"
+                                         onMouseUp="ChangeAbility('m_tohand', -1, <?= $st['a2'] ?>, 30)">&nbsp;
+                                    <IMG id="plus_m_tohand" SRC=https://img.new-combats.com/i/plus.gif class=skill
+                                         ALT="���������" onMouseUp="ChangeAbility('m_tohand', 1, <?= $st['a2'] ?>, 30)">
+                                </TD>
+                                <?php
+                            } elseif ($u->info['skills'] > 0 && $st['a2'] >= 30) { ?>
+                                <TD>
+                                    <IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
+                                    <IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
+                                </TD>
+                                <?php
+                            } ?>
+                        </tr>
 
-<tr>
-<TD>&nbsp;&bull;&nbsp;���������� �������� ������� ����: </TD>
-<TD width=40 class="skill" align="right" width=30 id='m_magic3_base'><?=$u->stats['mg3']?></small><BR></TD>
-<TD width=60 noWrap><?=$vozduh?></TD>
-<? if ($u->info['skills'] && $st['mg3']<30){?>
-<TD>
-<IMG id="minus_m_magic3"  SRC=https://img.new-combats.com/i/minus.gif class=nonactive ALT="���������" onMouseUp="ChangeAbility('m_magic3', -1, <?=$st['mg3']?>, 30)">&nbsp;
-<IMG id="plus_m_magic3"  SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������" onMouseUp="ChangeAbility('m_magic3', 1, <?=$st['mg3']?>, 30)">
-</TD>
-<? }elseif($u->info['skills']>0 && $st['mg3']>=30){?>
-<TD>
-<IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
-<IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
-</TD>
-<? } ?>
-</tr>
+                        <tr>
+                            <TD>&nbsp;&bull;&nbsp;���������� �������� ����������� ��������:</TD>
+                            <TD width=40 class="skill" align="right" width=30
+                                id='m_staff_base'><?= $u->stats['a5'] ?></small><BR></TD>
+                            <TD width=60 noWrap><?= $pos ?></TD>
+                            <?php
+                            if ($u->info['skills'] && $st['a5'] < 30) { ?>
+                                <TD>
+                                    <IMG id="minus_m_staff" SRC=https://img.new-combats.com/i/minus.gif class=nonactive
+                                         ALT="���������" onMouseUp="ChangeAbility('m_staff', -1, <?= $st['a5'] ?>, 30)">&nbsp;
+                                    <IMG id="plus_m_staff" SRC=https://img.new-combats.com/i/plus.gif class=skill
+                                         ALT="���������" onMouseUp="ChangeAbility('m_staff', 1, <?= $st['a5'] ?>, 30)">
+                                </TD>
+                                <?php
+                            } elseif ($u->info['skills'] > 0 && $st['a5'] >= 30) { ?>
+                                <TD>
+                                    <IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
+                                    <IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
+                                </TD>
+                                <?php
+                            } ?>
+                        </tr>
+                        <tr>
+                            <td colspan="4"><b>�����:<b></td>
+                        </tr>
 
-<tr>
-<TD>&nbsp;&bull;&nbsp;���������� �������� ������� �����: </TD>
-<TD width=40 class="skill" align="right" width=30 id='m_magic4_base'><?=$u->stats['mg4']?></small><BR></TD>
-<TD width=60 noWrap><?=$zemla?></TD>
-<?if ($u->info['skills'] && $st['mg4']<30){?>
-<TD>
-<IMG id="minus_m_magic4"  SRC=https://img.new-combats.com/i/minus.gif class=nonactive ALT="���������" onMouseUp="ChangeAbility('m_magic4', -1, <?=$st['mg4']?>, 30)">&nbsp;
-<IMG id="plus_m_magic4"  SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������" onMouseUp="ChangeAbility('m_magic4', 1, <?=$st['mg4']?>, 30)">
-</TD>
-<?}elseif($u->info['skills']>0 && $st['mg4']>=30){?>
-<TD>
-<IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
-<IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
-</TD>
-<?}?>
-</tr>
+                        <tr>
+                            <TD>&nbsp;&bull;&nbsp;���������� �������� ������� ����:</TD>
+                            <TD width=40 class="skill" align="right" width=30
+                                id='m_magic1_base'><?= $u->stats['mg1'] ?></small><BR></TD>
+                            <TD width=60 noWrap><?= $ogon ?></TD>
+                            <?php
+                            if ($u->info['skills'] && $st['mg1'] < 30) { ?>
+                                <TD>
+                                    <IMG id="minus_m_magic1" SRC=https://img.new-combats.com/i/minus.gif class=nonactive
+                                         ALT="���������"
+                                         onMouseUp="ChangeAbility('m_magic1', -1, <?= $st['mg1'] ?>, 30)">&nbsp;
+                                    <IMG id="plus_m_magic1" SRC=https://img.new-combats.com/i/plus.gif class=skill
+                                         ALT="���������"
+                                         onMouseUp="ChangeAbility('m_magic1', 1, <?= $st['mg1'] ?>, 30)">
+                                </TD>
+                                <?php
+                            } elseif ($u->info['skills'] > 0 && $st['mg1'] >= 30) { ?>
+                                <TD>
+                                    <IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
+                                    <IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
+                                </TD>
+                                <?php
+                            } ?>
+                        </tr>
 
-<!--<tr>
+                        <tr>
+                            <TD>&nbsp;&bull;&nbsp;���������� �������� ������� �������:</TD>
+                            <TD width=40 class="skill" align="right" width=30
+                                id='m_magic2_base'><?= $u->stats['mg2'] ?></small><BR></TD>
+                            <TD width=60 noWrap><?= $voda ?></TD>
+                            <?php
+                            if ($u->info['skills'] && $st['mg2'] < 30) { ?>
+                                <TD>
+                                    <IMG id="minus_m_magic2" SRC=https://img.new-combats.com/i/minus.gif class=nonactive
+                                         ALT="���������"
+                                         onMouseUp="ChangeAbility('m_magic2', -1, <?= $st['mg2'] ?>, 30)">&nbsp;
+                                    <IMG id="plus_m_magic2" SRC=https://img.new-combats.com/i/plus.gif class=skill
+                                         ALT="���������"
+                                         onMouseUp="ChangeAbility('m_magic2', 1, <?= $st['mg2'] ?>, 30)">
+                                </TD>
+                                <?php
+                            } elseif ($u->info['skills'] > 0 && $st['mg2'] >= 30) { ?>
+                                <TD>
+                                    <IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
+                                    <IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
+                                </TD>
+                                <?php
+                            } ?>
+                        </tr>
+
+                        <tr>
+                            <TD>&nbsp;&bull;&nbsp;���������� �������� ������� ����:</TD>
+                            <TD width=40 class="skill" align="right" width=30
+                                id='m_magic3_base'><?= $u->stats['mg3'] ?></small><BR></TD>
+                            <TD width=60 noWrap><?= $vozduh ?></TD>
+                            <?php
+                            if ($u->info['skills'] && $st['mg3'] < 30) { ?>
+                                <TD>
+                                    <IMG id="minus_m_magic3" SRC=https://img.new-combats.com/i/minus.gif class=nonactive
+                                         ALT="���������"
+                                         onMouseUp="ChangeAbility('m_magic3', -1, <?= $st['mg3'] ?>, 30)">&nbsp;
+                                    <IMG id="plus_m_magic3" SRC=https://img.new-combats.com/i/plus.gif class=skill
+                                         ALT="���������"
+                                         onMouseUp="ChangeAbility('m_magic3', 1, <?= $st['mg3'] ?>, 30)">
+                                </TD>
+                                <?php
+                            } elseif ($u->info['skills'] > 0 && $st['mg3'] >= 30) { ?>
+                                <TD>
+                                    <IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
+                                    <IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
+                                </TD>
+                                <?php
+                            } ?>
+                        </tr>
+
+                        <tr>
+                            <TD>&nbsp;&bull;&nbsp;���������� �������� ������� �����:</TD>
+                            <TD width=40 class="skill" align="right" width=30
+                                id='m_magic4_base'><?= $u->stats['mg4'] ?></small><BR></TD>
+                            <TD width=60 noWrap><?= $zemla ?></TD>
+                            <?php
+                            if ($u->info['skills'] && $st['mg4'] < 30) { ?>
+                                <TD>
+                                    <IMG id="minus_m_magic4" SRC=https://img.new-combats.com/i/minus.gif class=nonactive
+                                         ALT="���������"
+                                         onMouseUp="ChangeAbility('m_magic4', -1, <?= $st['mg4'] ?>, 30)">&nbsp;
+                                    <IMG id="plus_m_magic4" SRC=https://img.new-combats.com/i/plus.gif class=skill
+                                         ALT="���������"
+                                         onMouseUp="ChangeAbility('m_magic4', 1, <?= $st['mg4'] ?>, 30)">
+                                </TD>
+                                <?php
+                            } elseif ($u->info['skills'] > 0 && $st['mg4'] >= 30) { ?>
+                                <TD>
+                                    <IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
+                                    <IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
+                                </TD>
+                                <?php
+                            } ?>
+                        </tr>
+
+                        <!--<tr>
 <TD>&nbsp;&bull;&nbsp;���������� �������� ������ �����: </TD>
-<TD width=40 class="skill" align="right" width=30 id='m_magic5_base'><?=$u->stats['mg5']?></small><BR></TD>
-<TD width=60 noWrap><?=$svet?></TD>
-<?if ($u->info['skills'] && $st['mg5']<30){?>
+<TD width=40 class="skill" align="right" width=30 id='m_magic5_base'><?= $u->stats['mg5'] ?></small><BR></TD>
+<TD width=60 noWrap><?= $svet ?></TD>
+<?php
+                        if ($u->info['skills'] && $st['mg5'] < 30) { ?>
 <TD>
-<IMG id="minus_m_magic5"  SRC=https://img.new-combats.com/i/minus.gif class=nonactive ALT="���������" onMouseUp="ChangeAbility('m_magic5', -1, <?=$st['mg5']?>, 30)">&nbsp;
-<IMG id="plus_m_magic5"  SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������" onMouseUp="ChangeAbility('m_magic5', 1, <?=$st['mg5']?>, 30)">
+<IMG id="minus_m_magic5"  SRC=https://img.new-combats.com/i/minus.gif class=nonactive ALT="���������" onMouseUp="ChangeAbility('m_magic5', -1, <?= $st['mg5'] ?>, 30)">&nbsp;
+<IMG id="plus_m_magic5"  SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������" onMouseUp="ChangeAbility('m_magic5', 1, <?= $st['mg5'] ?>, 30)">
 </TD>
-<?}elseif($u->info['skills']>0 && $st['mg5']>=30){?>
+<?php
+                        } elseif ($u->info['skills'] > 0 && $st['mg5'] >= 30) { ?>
 <TD>
 <IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
 <IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
 </TD>
-<?}?>
+<?php
+                        } ?>
 </tr>
 
 <tr>
 <TD>&nbsp;&bull;&nbsp;���������� �������� ������ ����: </TD>
-<TD width=40 class="skill" align="right" width=30 id='m_magic6_base'><?=$u->stats['mg6']?></small><BR></TD>
-<TD width=60 noWrap><?=$seraya?></TD>
-<? if($u->info['skills'] && $st['mg6']<20){ ?>
+<TD width=40 class="skill" align="right" width=30 id='m_magic6_base'><?= $u->stats['mg6'] ?></small><BR></TD>
+<TD width=60 noWrap><?= $seraya ?></TD>
+<?php
+                        if ($u->info['skills'] && $st['mg6'] < 20) { ?>
 <TD>
-<IMG id="minus_m_magic6"  SRC=https://img.new-combats.com/i/minus.gif class=nonactive ALT="���������" onMouseUp="ChangeAbility('m_magic6', -1, <?=$st['mg6']?>, 30)">&nbsp;
-<IMG id="plus_m_magic6"  SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������" onMouseUp="ChangeAbility('m_magic6', 1, <?=$st['mg6']?>, 30)">
+<IMG id="minus_m_magic6"  SRC=https://img.new-combats.com/i/minus.gif class=nonactive ALT="���������" onMouseUp="ChangeAbility('m_magic6', -1, <?= $st['mg6'] ?>, 30)">&nbsp;
+<IMG id="plus_m_magic6"  SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������" onMouseUp="ChangeAbility('m_magic6', 1, <?= $st['mg6'] ?>, 30)">
 </TD>
-<? }elseif($u->info['skills']>0 && $st['mg6']>=30){?>
+<?php
+                        } elseif ($u->info['skills'] > 0 && $st['mg6'] >= 30) { ?>
 <TD>
 <IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
 <IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
 </TD>
-<? }?>
+<?php
+                        } ?>
 </tr>-->
 
-<tr>
-<TD>&nbsp;&bull;&nbsp;���������� �������� ����� ������: </TD>
-<TD width=40 class="skill" align="right" width=30 id='m_magic7_base'><?=$u->stats['mg7']?></small><BR></TD>
-<TD width=60 noWrap><?=$tma?></TD>
-<? if ($u->info['skills'] && $st['mg7']<30){ ?>
-<TD>
-<IMG id="minus_m_magic7"  SRC=https://img.new-combats.com/i/minus.gif class=nonactive ALT="���������" onMouseUp="ChangeAbility('m_magic7', -1, <?=$st['mg7']?>, 30)">&nbsp;
-<IMG id="plus_m_magic7"  SRC=https://img.new-combats.com/i/plus.gif class=skill ALT="���������" onMouseUp="ChangeAbility('m_magic7', 1, <?=$st['mg7']?>, 30)">
-</TD>
-<? }elseif($u->info['skills']>0 && $st['mg7']>=30){?>
-<TD>
-<IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
-<IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
-</TD>
-<? } ?>
-</tr>
-</table>
-<TABLE>
-<TR valign="middle">
-<TD><INPUT class="btn btn-success" type="button" value="���������" disabled id="save_button1" onClick="SaveAbility()"></TD>
-<TD><INPUT type="checkbox" onClick="ChangeButtonState(1)"></TD>
-</TR>
-</TABLE>
+                        <tr>
+                            <TD>&nbsp;&bull;&nbsp;���������� �������� ����� ������:</TD>
+                            <TD width=40 class="skill" align="right" width=30
+                                id='m_magic7_base'><?= $u->stats['mg7'] ?></small><BR></TD>
+                            <TD width=60 noWrap><?= $tma ?></TD>
+                            <?php
+                            if ($u->info['skills'] && $st['mg7'] < 30) { ?>
+                                <TD>
+                                    <IMG id="minus_m_magic7" SRC=https://img.new-combats.com/i/minus.gif class=nonactive
+                                         ALT="���������"
+                                         onMouseUp="ChangeAbility('m_magic7', -1, <?= $st['mg7'] ?>, 30)">&nbsp;
+                                    <IMG id="plus_m_magic7" SRC=https://img.new-combats.com/i/plus.gif class=skill
+                                         ALT="���������"
+                                         onMouseUp="ChangeAbility('m_magic7', 1, <?= $st['mg7'] ?>, 30)">
+                                </TD>
+                                <?php
+                            } elseif ($u->info['skills'] > 0 && $st['mg7'] >= 30) { ?>
+                                <TD>
+                                    <IMG SRC=https://img.new-combats.com/i/minus.gif class=nonactive>&nbsp;
+                                    <IMG SRC=https://img.new-combats.com/i/plus.gif class=nonactive>
+                                </TD>
+                                <?php
+                            } ?>
+                        </tr>
+                    </table>
+                    <TABLE>
+                        <TR valign="middle">
+                            <TD><INPUT class="btn btn-success" type="button" value="���������" disabled
+                                       id="save_button1" onClick="SaveAbility()"></TD>
+                            <TD><INPUT type="checkbox" onClick="ChangeButtonState(1)"></TD>
+                        </TR>
+                    </TABLE>
 
-</div>
-<div class=dtz ID=dL2>
-<BR>
-� ���� ������ ���� ������� ;)
-</div>
-<div class=dtz ID=dL3>
-<?
-/*---�����������---*/
-		foreach ($os as $k=>$v) {
-			$good=1;
-			if ($v["nlevel"] && $v["nlevel"]+$st[$k]>$u->info["level"]) $good=0;
-			if ($v["npower"] && $v["npower"]+($st[$k]*5)>$st['s4']) $good=0;
-			if ($v["nwis"] && $v["nwis"]+($st[$k]*5)>$st['s6']) $good=0; 
-			if ($good) {
-				if ($st[$k]<5) echo "<BR>&bull; <A href=\"?skills=1&rz=3&".$v['opt']."=1\" onclick=\"return confirm('�� �������, ��� ������ ������� ����������� &quot;".$v['name']."&quot;?')\">".$v['name']."".($st[$k]>0?" - ".($st[$k]+1):"")."</A><BR>
-				<SMALL>".$v['descr']." ".$v["bonus".($st[$k]+1)]."</SMALL><BR>";
-			}
-		}
-	echo "<br>";
-	echo "
-    <b>��������� �����������:</b><br>";
-	foreach ($os as $k=>$v) {
-		if ($st[$k]) echo "&bull; ".$v['name']." ".($st[$k]>1?" - ".$st[$k]."":"")."<br>";
-	}
-/*---�����������---*/
-?>
-</div>
-<div class="dtz" ID=dL4>
-<script type="text/javascript" src="js/jquery.js"></script>
-<SCRIPT>
-var p_name;
+                </div>
+                <div class=dtz ID=dL2>
+                    <BR>
+                    � ���� ������ ���� ������� ;)
+                </div>
+                <div class=dtz ID=dL3>
+                    <?php
+                    /*---�����������---*/
+                    foreach ($os as $k => $v) {
+                        $good = 1;
+                        if ($v["nlevel"] && $v["nlevel"] + $st[$k] > $u->info["level"]) {
+                            $good = 0;
+                        }
+                        if ($v["npower"] && $v["npower"] + ($st[$k] * 5) > $st['s4']) {
+                            $good = 0;
+                        }
+                        if ($v["nwis"] && $v["nwis"] + ($st[$k] * 5) > $st['s6']) {
+                            $good = 0;
+                        }
+                        if ($good) {
+                            if ($st[$k] < 5) {
+                                echo "<BR>&bull; <A href=\"?skills=1&rz=3&" . $v['opt'] . "=1\" onclick=\"return confirm('�� �������, ��� ������ ������� ����������� &quot;" . $v['name'] . "&quot;?')\">" . $v['name'] . "" . ($st[$k] > 0 ? " - " . ($st[$k] + 1) : "") . "</A><BR>
+				<SMALL>" . $v['descr'] . " " . $v["bonus" . ($st[$k] + 1)] . "</SMALL><BR>";
+                            }
+                        }
+                    }
+                    echo "<br>";
+                    echo "<b>��������� �����������:</b><br>";
+                    foreach ($os as $k => $v) {
+                        if ($st[$k]) {
+                            echo "&bull; " . $v['name'] . " " . ($st[$k] > 1 ? " - " . $st[$k] : "") . "<br>";
+                        }
+                    }
+                    /*---�����������---*/
+                    ?>
+                </div>
+                <div class="dtz" ID=dL4>
+                    <script type="text/javascript" src="js/jquery.js"></script>
+                    <SCRIPT>
+                        var p_name;
 
-function redirectto (s) {
-	location = s;
-}
-<? if(!isset($_GET['p_raz'])) { ?>
-var p_raz = "all";
-<? }else{ echo 'var p_raz = "'.htmlspecialchars($_GET['p_raz']).'";'; } ?>
+                        function redirectto(s) {
+                            location = s;
+                        }
+                        <?php if(!isset($_GET['p_raz'])) { ?>
+                        var p_raz = "all";
+                        <?php }else {
+                            echo 'var p_raz = "' . htmlspecialchars($_GET['p_raz']) . '";';
+                        } ?>
 
-function show_div(o) {
-	p_raz = o;
-	$('.pwqall').css({'display':'none'});
-	$('.pwq'+o).css({'display':''});
-}
+                        function show_div(o) {
+                            p_raz = o;
+                            $('.pwqall').css({'display': 'none'});
+                            $('.pwq' + o).css({'display': ''});
+                        }
 
-</SCRIPT>
-<table border=0 cellspacing=0 width="100%" cellpadding=0 ><tr valign="top">
-  <td valign="top" width="100%">
-<?
-if(isset($_GET['savePriems'])) {
-	$_GET['savePriems'] = htmlspecialchars(substr($_GET['savePriems'],0,11),NULL,'cp1251');
-	$sp = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `complects_priem` WHERE `uid` = "'.$u->info['id'].'" LIMIT 16'));
-	if($sp[0] >= 15) {
-		$re = '������ ��������� ����� 15 ���������� �������';
-	}elseif(str_replace(' ','',$_GET['savePriems']) != '') {
-		$cmpl = mysql_fetch_array(mysql_query('SELECT `id` FROM `complects_priem` WHERE `uid` = "'.$u->info['id'].'" AND `name` = "'.mysql_real_escape_string($_GET['savePriems']).'" LIMIT 1'));
-		if(isset($cmpl['id'])) { 
-			$re = '������ ����������� �������� ������� "'.$_GET['savePriems'].'"';
-			mysql_query('UPDATE `complects_priem` SET `priems` = "'.$u->info['priems'].'" WHERE `id` = "'.$cmpl['id'].'" LIMIT 1');
-		}else{
-			$re = '������ ������ �������� ������� "'.$_GET['savePriems'].'"';
-			mysql_query('INSERT INTO `complects_priem` (`priems`,`uid`,`name`) VALUES ("'.$u->info['priems'].'","'.$u->info['id'].'","'.mysql_real_escape_string($_GET['savePriems']).'")');
-		}
-	}else{
-		$re = '�� ������� �������� ���������';
-	}
-	if($re != '') {
-		echo '<br>&nbsp; <font color="red"><b>'.$re.'</b></font><br><br>';
-	}
-}
-?>
-<B>��������� ������:</B><BR>
-<?
-//������� ������
-$priem->seeMy(1);
-?><br>
-<B>����� ��� ������:</B>
-<TABLE cellpadding=0 cellspacing=0><TR><TD>
-<div style="">
-<?
-$priem->seePriems(1);
-?>
-</div>
-</div>
-</TD></TR></TABLE></DIV></td><td valign="top" align=right width=1>
+                    </SCRIPT>
+                    <table border=0 cellspacing=0 width="100%" cellpadding=0>
+                        <tr valign="top">
+                            <td valign="top" width="100%">
+                                <?php
+                                if (isset($_GET['savePriems'])) {
+                                    $_GET['savePriems'] = htmlspecialchars(
+                                        substr($_GET['savePriems'], 0, 11), null, 'cp1251'
+                                    );
+                                    $sp = mysql_fetch_array(
+                                        mysql_query(
+                                            'SELECT COUNT(`id`) FROM `complects_priem` WHERE `uid` = "' . $u->info['id'] . '" LIMIT 16'
+                                        )
+                                    );
+                                    if ($sp[0] >= 15) {
+                                        $re = '������ ��������� ����� 15 ���������� �������';
+                                    } elseif (str_replace(' ', '', $_GET['savePriems']) != '') {
+                                        $cmpl = mysql_fetch_array(
+                                            mysql_query(
+                                                'SELECT `id` FROM `complects_priem` WHERE `uid` = "' . $u->info['id'] . '" AND `name` = "' . mysql_real_escape_string(
+                                                    $_GET['savePriems']
+                                                ) . '" LIMIT 1'
+                                            )
+                                        );
+                                        if (isset($cmpl['id'])) {
+                                            $re = '������ ����������� �������� ������� "' . $_GET['savePriems'] . '"';
+                                            mysql_query(
+                                                'UPDATE `complects_priem` SET `priems` = "' . $u->info['priems'] . '" WHERE `id` = "' . $cmpl['id'] . '" LIMIT 1'
+                                            );
+                                        } else {
+                                            $re = '������ ������ �������� ������� "' . $_GET['savePriems'] . '"';
+                                            mysql_query(
+                                                'INSERT INTO `complects_priem` (`priems`,`uid`,`name`) VALUES ("' . $u->info['priems'] . '","' . $u->info['id'] . '","' . mysql_real_escape_string(
+                                                    $_GET['savePriems']
+                                                ) . '")'
+                                            );
+                                        }
+                                    } else {
+                                        $re = '�� ������� �������� ���������';
+                                    }
+                                    echo !$re ?: "<br> <b style='color:red;'>$re</b><br><br>";
+                                }
+                                ?>
+                                <B>��������� ������:</B><BR>
+                                <?php $priem->seeMy(1); ?><br>
+                                <B>����� ��� ������:</B>
+                                <div>
+                                    <?php $priem->seePriems(1); ?>
+                                </div>
+                            </td>
+                            <td valign="top" align=right width=1>
+                                <FIELDSET>
+                                    <LEGEND>���������</LEGEND>
+                                    <SMALL>
+                                        <NOBR>
+                                            <A href="#" onclick='show_div("all"); return(false)'>���</A>
+                                            <BR>
+                                            <A href="#" onclick='show_div("hit"); return(false)'>������ �����</A>
+                                            <BR>
+                                            <A href="#" onclick='show_div("block"); return(false)'>������ ������</A>
+                                            <BR>
+                                            <A href="#" onclick='show_div("counter"); return(false)'>������
+                                                �����������</A>
+                                            <BR>
+                                            <A href="#" onclick='show_div("krit"); return(false)'>������ �����������
+                                                ������</A>
+                                            <BR>
+                                            <A href="#" onclick='show_div("parry"); return(false)'>������
+                                                �����������</A>
+                                            <BR>
+                                            <A href="#" onclick='show_div("multi"); return(false)'>�����-������</A>
+                                            <BR>
+                                            <A href="#" onclick='show_div("hp"); return(false)'>������ �����</A>
+                                            <BR>
+                                            <A href="#" onclick='show_div("blood"); return(false)'>������ ������</A>
+                                            <BR>
+                                            <A href="#" onclick='show_div("spirit"); return(false)'>������ ���� ����</A>
+                                            <BR>
+                                            <A href="#" onclick='show_div("wis_fire"); return(false)'>����������
+                                                ����</A>
+                                            <BR>
+                                            <A href="#" onclick='show_div("wis_water"); return(false)'>����������
+                                                ����</A>
+                                            <BR>
+                                            <A href="#" onclick='show_div("wis_air"); return(false)'>����������
+                                                �������</A>
+                                            <BR>
+                                            <A href="#" onclick='show_div("wis_earth"); return(false)'>����������
+                                                �����</A>
+                                            <BR>
+                                            <A href="#" onclick='show_div("wis_light"); return(false)'>���������� �����
+                                                �����</A>
+                                            <BR>
+                                            <A href="#" onclick='show_div("wis_gray"); return(false)'>���������� �����
+                                                �����</A>
+                                            <BR>
+                                            <A href="#" onclick='show_div("wis_dark"); return(false)'>���������� �����
+                                                ����</A><BR>
+                                        </NOBR>
+                                    </SMALL>
+                                </FIELDSET>
+                                <SCRIPT>show_div(p_raz);</SCRIPT>
+                            </td>
+                            <td valign="top" align="right">
+                                <table width="200" align=right cellpadding=0 cellspacing=0>
+                                    <tr>
+                                        <form name=F1 action="?skills=1&rz=4" method="GET">
+                                            <input type="hidden" name="skills" value="1">
+                                            <input type="hidden" name="rz" value="4">
+                                            <td>
+                                                <FIELDSET>
+                                                    <LEGEND>���������� �����</LEGEND>
 
-<FIELDSET><LEGEND>���������</LEGEND><SMALL><NOBR>
-<A href="#" onclick='show_div("all"); return(false)'>���</A>
-               <BR>
-<A href="#" onclick='show_div("hit"); return(false)'>������ �����</A>
-               <BR>
-<A href="#" onclick='show_div("block"); return(false)'>������ ������</A>
-               <BR>
-<A href="#" onclick='show_div("counter"); return(false)'>������ �����������</A>
-               <BR>
-<A href="#" onclick='show_div("krit"); return(false)'>������ ����������� ������</A>
-               <BR>
-<A href="#" onclick='show_div("parry"); return(false)'>������ �����������</A>
-               <BR>
-<A href="#" onclick='show_div("multi"); return(false)'>�����-������</A>
-               <BR>
-<A href="#" onclick='show_div("hp"); return(false)'>������ �����</A>
-               <BR>
-<A href="#" onclick='show_div("blood"); return(false)'>������ ������</A>
-               <BR>
-<A href="#" onclick='show_div("spirit"); return(false)'>������ ���� ����</A>
-               <BR>
-<A href="#" onclick='show_div("wis_fire"); return(false)'>���������� ����</A>
-               <BR>
-<A href="#" onclick='show_div("wis_water"); return(false)'>���������� ����</A>
-               <BR>
-<A href="#" onclick='show_div("wis_air"); return(false)'>���������� �������</A>
-               <BR>
-<A href="#" onclick='show_div("wis_earth"); return(false)'>���������� �����</A>
-               <BR>
-<A href="#" onclick='show_div("wis_light"); return(false)'>���������� ����� �����</A>
-               <BR>
-<A href="#" onclick='show_div("wis_gray"); return(false)'>���������� ����� �����</A>
-               <BR>
-<A href="#" onclick='show_div("wis_dark"); return(false)'>���������� ����� ����</A><BR></FIELDSET></NOBR></SMALL>
-<SCRIPT>show_div(p_raz);</SCRIPT></td><td valign="top" align="right">
-<table width="200" align=right cellpadding=0 cellspacing=0><tr>
-<form name=F1 action="?skills=1&rz=4" method="GET">
-<input type="hidden" name="skills" value="1">
-<input type="hidden" name="rz" value="4">
-<td>
-<FIELDSET><LEGEND>���������� �����</LEGEND>
+                                                    &nbsp;<INPUT TYPE=radio ID=A1 NAME=all value=0 <?php
+                                                    if ($_GET['all'] == 0) {
+                                                        echo 'checked="checked"';
+                                                    } ?> onClick="form.submit()"> <LABEL FOR=A1>���������
+                                                        ���</LABEL><BR>
+                                                    &nbsp;<INPUT TYPE=radio ID=A2 NAME=all value=1 <?php
+                                                    if ($_GET['all'] == 1) {
+                                                        echo 'checked="checked"';
+                                                    } ?> onClick="form.submit()"> <LABEL FOR=A2>���</LABEL>
 
-&nbsp;<INPUT TYPE=radio ID=A1 NAME=all value=0 <? if($_GET['all'] == 0) { echo 'checked="checked"'; } ?> onClick="form.submit()"> <LABEL FOR=A1>��������� ���</LABEL><BR>
-&nbsp;<INPUT TYPE=radio ID=A2 NAME=all value=1 <? if($_GET['all'] == 1) { echo 'checked="checked"'; } ?> onClick="form.submit()"> <LABEL FOR=A2>���</LABEL>
+                                                </FIELDSET>
+                                                <BR>
+                                                <a style='font-size:10px'
+                                                   href="/main.php?skills=1&rz=4&all=<?= $_GET['all'] ?>&clear_abil=1">��������</A>
+                                                <BR>
+                                                <A style='font-size:10px' href="javascript:void(0)"
+                                                   onClick="top.savePriems();">���������
+                                                    �����</a><br>
+                                                <p style="margin-left: 10px; font-size:10px;" align="left">
+                                                    <?php
+                                                    $sp = mysql_query(
+                                                        'SELECT * FROM `complects_priem` WHERE `uid` = "' . $u->info['id'] . '" LIMIT 10'
+                                                    );
+                                                    while ($pl = mysql_fetch_array($sp)) {
+                                                        echo '<a onclick="if(confirm(\'������� �����  ?\')){location=\'main.php?skills=1&rz=4&all=&rnd=' . $code . '&delcop=' . $pl['id'] . '\'}" href="javascript:void(0)"><img src="https://' . $c['img'] . '/i/clear.gif" width="13" height="13"></a> <a href="?skills=1&rz=4&all=&rnd=' . $code . '&usecopr=' . $pl['id'] . '">������������ &quot;' . $pl['name'] . '&quot;</a><br>';
+                                                    }
+                                                    ?>
+                                                </p>
+                                            </td>
+                                        </form>
+                                    </tr>
+                                </table>
+                            </td>
+                            <td>&nbsp;</td>
+                        </tr>
+                    </table>
+                </div>
+                <div class="dtz" ID=dL5>
+                    <div style="margin:5px;">
+                        <SMALL>
+                        </SMALL>
+                        <?php
+                        //D5D5D5 , C7C7C7
+                        //�������� � �������
+                        $clr = 'D5';
+                        $ae = '';
 
-</FIELDSET>
-<BR>
-<a style='font-size:10px' href="/main.php?skills=1&rz=4&all=<?=$_GET['all']?>&clear_abil=1">��������</A>
-               <BR>
-<A style='font-size:10px' href="javascript:void(0)" onClick="top.savePriems();">��������� �����</a><br>
-<p style="margin-left: 10px; font-size:10px;" align="left">
-<?
-$sp = mysql_query('SELECT * FROM `complects_priem` WHERE `uid` = "'.$u->info['id'].'" LIMIT 10');
-while($pl = mysql_fetch_array($sp)) {
-	echo '<a onclick="if(confirm(\'������� �����  ?\')){location=\'main.php?skills=1&rz=4&all=&rnd='.$code.'&delcop='.$pl['id'].'\'}" href="javascript:void(0)"><img src="https://'.$c['img'].'/i/clear.gif" width="13" height="13"></a> <a href="?skills=1&rz=4&all=&rnd='.$code.'&usecopr='.$pl['id'].'">������������ &quot;'.$pl['name'].'&quot;</a><br>';
-}
-?>
-</p>
+                        //�������
+                        $i = 0;
+                        while ($i < count($u->stats['effects'])) {
+                            if (isset($u->stats['effects'][$i])) {
+                                if ($clr == 'C7') {
+                                    $clr = 'D5';
+                                } else {
+                                    $clr = 'C7';
+                                }
+                                $v1 = '';
+                                $v2 = '';
+                                $v3 = $u->lookStats($u->stats['effects'][$i]['data']);
+                                //<FONT color=#A00000>-??</FONT>
+                                $j = 0;
+                                while ($j < count($u->items['add'])) {
+                                    if (isset($v3['add_' . $u->items['add'][$j]])) {
+                                        $v1 .= '&nbsp;&bull; ' . $u->is[$u->items['add'][$j]] . '<br>';
+                                        $v4 = $v3['add_' . $u->items['add'][$j]];
+                                        if ($v4 > 0) {
+                                            $v4 = '+' . $v4;
+                                        } elseif ($v4 < 0) {
+                                            $v4 = '<FONT color=#A00000>' . $v4 . '</FONT>';
+                                        }
+                                        $v2 .= $v4 . '<br>';
+                                    }
+                                    $j++;
+                                }
+                                if ($v1 == '') {
+                                    $v1 = '??';
+                                }
+                                if ($v2 == '') {
+                                    $v2 = '??';
+                                }
 
-</td>
-</form>
-</tr></table>
+                                //$btnse = '<a href="javascript:void(0);" onclick="if(confirm(\'��������� ������ &quot;'.$u->stats['effects'][$i]['name'].'&quot;?\')){ top.frames[\'main\'].location = \'/main.php?skills=1&p_raz=all&rz=5&all=&endeffectplease='.$u->stats['effects'][$i]['id'].'\';}"><small>���������</small></a>';
 
-</td><td>&nbsp;</td>
-</tr></table>
-</div>
-<div class="dtz" ID=dL5>
-<div style="margin:5px;">
-<SMALL>
-</SMALL>
-<?
-//D5D5D5 , C7C7C7
-//�������� � �������
-$clr = 'D5';
-$ae = '';
+                                $btnset = true;
 
-//�������
-$i = 0;
-while($i<count($u->stats['effects']))
-{
-	if(isset($u->stats['effects'][$i]))
-	{
-		if($clr=='C7')
-		{
-			$clr = 'D5';
-		}else{
-			$clr = 'C7';	
-		}
-		$v1 = '';
-		$v2 = '';
-		$v3 = $u->lookStats($u->stats['effects'][$i]['data']);
-		//<FONT color=#A00000>-??</FONT>
-		$j = 0;
-		while($j<count($u->items['add']))
-		{
-			if(isset($v3['add_'.$u->items['add'][$j]]))
-			{
-				$v1 .= '&nbsp;&bull; '.$u->is[$u->items['add'][$j]].'<br>';
-				$v4 = $v3['add_'.$u->items['add'][$j]];
-				if($v4>0)
-				{
-					$v4 = '+'.$v4;
-				}elseif($v4<0)
-				{
-					$v4 = '<FONT color=#A00000>'.$v4.'</FONT>';
-				}
-				$v2 .= $v4.'<br>';
-			}
-			$j++;
-		}
-		if($v1=='')
-		{
-			$v1 = '??';	
-		}
-		if($v2=='')
-		{
-			$v2 = '??';
-		}
-		
-		//$btnse = '<a href="javascript:void(0);" onclick="if(confirm(\'��������� ������ &quot;'.$u->stats['effects'][$i]['name'].'&quot;?\')){ top.frames[\'main\'].location = \'/main.php?skills=1&p_raz=all&rz=5&all=&endeffectplease='.$u->stats['effects'][$i]['id'].'\';}"><small>���������</small></a>';
-		
-		$btnset = true;
-		
-		$bsp = strripos($u->stats['effects'][$i]['data'], '-');
-		if( $bsp == true ) {
-			$btnset = false;
-		}
-		
-		$bsp = strripos($u->stats['effects'][$i]['data'], '|nofastfinisheff=1');
-		if( $bsp == true ) {
-			$btnset = false;
-		}
-		
-		if( $btnset == false ) {
-			$btnse = '&nbsp; <small>--</small> &nbsp;';
-		}
-		
-		if(isset($_GET['endeffectplease']) && $_GET['endeffectplease'] == $u->stats['effects'][$i]['id'] && $u->stats['effects'][$i]['id'] > 0 && $btnset == true) {
-			mysql_query('UPDATE `eff_users` SET `timeUse` = 0 WHERE `id` = "'.$u->stats['effects'][$i]['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1');
-			echo '<div><font color=red><b>������ &quot;'.$u->stats['effects'][$i]['name'].'&quot; ��� ������������� ��������.</b></font></div>';
-			if($clr=='C7')
-			{
-				$clr = 'D5';
-			}else{
-				$clr = 'C7';	
-			}
-		}else{		
-			$ae .= '<TR bgcolor=#'.$clr.$clr.$clr.'>
-			<TD>'.$v1.'</TD>
-			<TD align=right>'.$v2.'</TD>
-			<TD style=\'padding: 1,5,1,5\' align=right>'.$u->timeOut($u->stats['effects'][$i]['timeUse']+$u->stats['effects'][$i]['actionTime']-time()).'</TD>
-			<TD style=\'padding: 1,5,1,5\' align=right><small>&quot;'.$u->stats['effects'][$i]['name'].'&quot;</small></TD>
-			<TD><center>'.$btnse.'</center></TD>
+                                $bsp = strripos($u->stats['effects'][$i]['data'], '-');
+                                if ($bsp == true) {
+                                    $btnset = false;
+                                }
+
+                                $bsp = strripos($u->stats['effects'][$i]['data'], '|nofastfinisheff=1');
+                                if ($bsp == true) {
+                                    $btnset = false;
+                                }
+
+                                if ($btnset == false) {
+                                    $btnse = '&nbsp; <small>--</small> &nbsp;';
+                                }
+
+                                if (isset($_GET['endeffectplease']) && $_GET['endeffectplease'] == $u->stats['effects'][$i]['id'] && $u->stats['effects'][$i]['id'] > 0 && $btnset == true) {
+                                    mysql_query(
+                                        'UPDATE `eff_users` SET `timeUse` = 0 WHERE `id` = "' . $u->stats['effects'][$i]['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
+                                    );
+                                    echo '<div><font color=red><b>������ &quot;' . $u->stats['effects'][$i]['name'] . '&quot; ��� ������������� ��������.</b></font></div>';
+                                    if ($clr == 'C7') {
+                                        $clr = 'D5';
+                                    } else {
+                                        $clr = 'C7';
+                                    }
+                                } else {
+                                    $ae .= '<TR bgcolor=#' . $clr . $clr . $clr . '>
+			<TD>' . $v1 . '</TD>
+			<TD align=right>' . $v2 . '</TD>
+			<TD style=\'padding: 1,5,1,5\' align=right>' . $u->timeOut(
+                                            $u->stats['effects'][$i]['timeUse'] + $u->stats['effects'][$i]['actionTime'] - time(
+                                            )
+                                        ) . '</TD>
+			<TD style=\'padding: 1,5,1,5\' align=right><small>&quot;' . $u->stats['effects'][$i]['name'] . '&quot;</small></TD>
+			<TD><center>' . $btnse . '</center></TD>
 			</TR>';
-		}
-	}
-	$i++;
-}
+                                }
+                            }
+                            $i++;
+                        }
 
-//����� �� ������
-$efs = mysql_query('SELECT * FROM `users_ico` WHERE `uid`="'.mysql_real_escape_string($u->info['id']).'" AND (`endTime` > "'.time().'" OR `endTime` = 0)');
-while($e = mysql_fetch_array($efs)) {
-		if($clr=='C7')
-		{
-			$clr = 'D5';
-		}else{
-			$clr = 'C7';	
-		}
-		$v1 = '';
-		$v2 = '';
-		$v3 = $u->lookStats($e['bonus']);
-		//<FONT color=#A00000>-??</FONT>
-		$j = 0;
-		while($j<count($u->items['add']))
-		{
-			if(isset($v3['add_'.$u->items['add'][$j]]))
-			{
-				$v1 .= '&nbsp;&bull; '.$u->is[$u->items['add'][$j]].'<br>';
-				$v4 = $v3['add_'.$u->items['add'][$j]];
-				if($v4>0)
-				{
-					$v4 = '+'.$v4;
-				}elseif($v4<0)
-				{
-					$v4 = '<FONT color=#A00000>'.$v4.'</FONT>';
-				}
-				$v2 .= $v4.'<br>';
-			}
-			$j++;
-		}
-		if($v1=='')
-		{
-			$v1 = '??';	
-		}
-		if($v2=='')
-		{
-			$v2 = '??';
-		}
-		
-		//$btnse = '<a href="/main.php?skills=1&p_raz=all&rz=5&all=&endeffectplease='.$e['id'].'">��������</a>';
-		$btnse = '&nbsp; <small>--</small> &nbsp;';
-		
-		if( isset($_GET['hideico']) && $_GET['hideico'] == $e['id'] ) {
-			mysql_query('UPDATE `users_ico` SET `see` = 0 WHERE `id` = "'.$e['id'].'" LIMIT 1');
-			$e['see'] = 0;
-		}elseif( isset($_GET['showico']) && $_GET['showico'] == $e['id'] ) {
-			mysql_query('UPDATE `users_ico` SET `see` = 1 WHERE `id` = "'.$e['id'].'" LIMIT 1');
-			$e['see'] = 1;
-		}
-		
-		/*if( $e['see'] == 1 ) {
-			$btnse = '&nbsp; <small><a href="/main.php?skills=1&p_raz=all&rz=5&all=&hideico='.$e['id'].'">������ �� ���.</a></small> &nbsp;';
-		}else{
-			$btnse = '&nbsp; <small><a href="/main.php?skills=1&p_raz=all&rz=5&all=&showico='.$e['id'].'">�������� � ���.</a></small> &nbsp;';
-		}*/
-		
-		$ae .= '<TR bgcolor=#'.$clr.$clr.$clr.'>
-		<TD>'.$v1.'</TD>
-		<TD align=right>'.$v2.'</TD>
-		<TD style=\'padding: 1,5,1,5\' align=right>'.$u->timeOut($e['endTime']-time()).'</TD>
+                        //����� �� ������
+                        $efs = mysql_query(
+                            'SELECT * FROM `users_ico` WHERE `uid`="' . mysql_real_escape_string(
+                                $u->info['id']
+                            ) . '" AND (`endTime` > "' . time() . '" OR `endTime` = 0)'
+                        );
+                        while ($e = mysql_fetch_array($efs)) {
+                            if ($clr == 'C7') {
+                                $clr = 'D5';
+                            } else {
+                                $clr = 'C7';
+                            }
+                            $v1 = '';
+                            $v2 = '';
+                            $v3 = $u->lookStats($e['bonus']);
+                            //<FONT color=#A00000>-??</FONT>
+                            $j = 0;
+                            while ($j < count($u->items['add'])) {
+                                if (isset($v3['add_' . $u->items['add'][$j]])) {
+                                    $v1 .= '&nbsp;&bull; ' . $u->is[$u->items['add'][$j]] . '<br>';
+                                    $v4 = $v3['add_' . $u->items['add'][$j]];
+                                    if ($v4 > 0) {
+                                        $v4 = '+' . $v4;
+                                    } elseif ($v4 < 0) {
+                                        $v4 = '<FONT color=#A00000>' . $v4 . '</FONT>';
+                                    }
+                                    $v2 .= $v4 . '<br>';
+                                }
+                                $j++;
+                            }
+                            if ($v1 == '') {
+                                $v1 = '??';
+                            }
+                            if ($v2 == '') {
+                                $v2 = '??';
+                            }
+
+                            //$btnse = '<a href="/main.php?skills=1&p_raz=all&rz=5&all=&endeffectplease='.$e['id'].'">��������</a>';
+                            $btnse = '&nbsp; <small>--</small> &nbsp;';
+
+                            if (isset($_GET['hideico']) && $_GET['hideico'] == $e['id']) {
+                                mysql_query('UPDATE `users_ico` SET `see` = 0 WHERE `id` = "' . $e['id'] . '" LIMIT 1');
+                                $e['see'] = 0;
+                            } elseif (isset($_GET['showico']) && $_GET['showico'] == $e['id']) {
+                                mysql_query('UPDATE `users_ico` SET `see` = 1 WHERE `id` = "' . $e['id'] . '" LIMIT 1');
+                                $e['see'] = 1;
+                            }
+
+                            /*if( $e['see'] == 1 ) {
+                            $btnse = '&nbsp; <small><a href="/main.php?skills=1&p_raz=all&rz=5&all=&hideico='.$e['id'].'">������ �� ���.</a></small> &nbsp;';
+                        }else{
+                            $btnse = '&nbsp; <small><a href="/main.php?skills=1&p_raz=all&rz=5&all=&showico='.$e['id'].'">�������� � ���.</a></small> &nbsp;';
+                        }*/
+
+                            $ae .= '<TR bgcolor=#' . $clr . $clr . $clr . '>
+		<TD>' . $v1 . '</TD>
+		<TD align=right>' . $v2 . '</TD>
+		<TD style=\'padding: 1,5,1,5\' align=right>' . $u->timeOut($e['endTime'] - time()) . '</TD>
 		<TD style=\'padding: 1,5,1,5\' align=right><small><img ';
-		if( $e['type'] == 2 ) {
-			$ae .= 'width="30" style="float:left"';
-		}
-		$ae .= ' src="https://img.new-combats.com/'.$e['img'].'"> &quot;'.$e['text'].'&quot;</small></TD>
-		<TD><center>'.$btnse.'</center></TD>
+                            if ($e['type'] == 2) {
+                                $ae .= 'width="30" style="float:left"';
+                            }
+                            $ae .= ' src="https://img.new-combats.com/' . $e['img'] . '"> &quot;' . $e['text'] . '&quot;</small></TD>
+		<TD><center>' . $btnse . '</center></TD>
 	</TR>';
-}
+                        }
 
 
-if($ae!='')
-{
-?>
-<TABLE border="0" cellpadding=3 cellspacing=1>
-<TR bgcolor=#A5A5A5>
-	<TD><B>��������������</B></TD>
-    <TD align=right><B>��.</B></TD>
-    <TD align=right><B>�����</B></TD>
-    <TD align=right ><B>�����������</B></TD>
-    <TD align=right ><B>��������</B></TD>
-</TR>
-<?
-echo $ae;	
-?>
-</TABLE>
-<br>
-<?
-}
+                        if ($ae != '') {
+                            ?>
+                            <TABLE border="0" cellpadding=3 cellspacing=1>
+                                <TR bgcolor=#A5A5A5>
+                                    <TD><B>��������������</B></TD>
+                                    <TD align=right><B>��.</B></TD>
+                                    <TD align=right><B>�����</B></TD>
+                                    <TD align=right><B>�����������</B></TD>
+                                    <TD align=right><B>��������</B></TD>
+                                </TR>
+                                <?php
+                                echo $ae;
+                                ?>
+                            </TABLE>
+                            <br>
+                            <?php
+                        }
 
-$ae = '';
+                        $ae = '';
 
-$sp = mysql_query('SELECT * FROM `eff_users` WHERE `v1` LIKE "pgb%" AND `delete` = "0" AND `deactiveTime` > '.time().' AND `uid` = "'.$u->info['id'].'" ORDER BY `timeUse` DESC');
-while($pl = mysql_fetch_array($sp)) {
-	$tp = (int)str_replace('pgb','',$pl['v1']);
-	$lvlp = explode('[',$pl['name']); 
-	$lvlp = explode(']',$lvlp[1]);
-	$lvlp = $lvlp[0]; 
-	$v = $magic->pgpar[$tp];
-	$ae .= '&bull; '.$v[0].' ['.$lvlp.'], ��� '.$u->timeOut($pl['timeUse']-time()).', ������ ����������� ����� '.$u->timeOut($pl['deactiveTime']-time()).'<br>';
-}
+                        $sp = mysql_query(
+                            'SELECT * FROM `eff_users` WHERE `v1` LIKE "pgb%" AND `delete` = "0" AND `deactiveTime` > ' . time(
+                            ) . ' AND `uid` = "' . $u->info['id'] . '" ORDER BY `timeUse` DESC'
+                        );
+                        while ($pl = mysql_fetch_array($sp)) {
+                            $tp = (int)str_replace('pgb', '', $pl['v1']);
+                            $lvlp = explode('[', $pl['name']);
+                            $lvlp = explode(']', $lvlp[1]);
+                            $lvlp = $lvlp[0];
+                            $v = $magic->pgpar[$tp];
+                            $ae .= '&bull; ' . $v[0] . ' [' . $lvlp . '], ��� ' . $u->timeOut(
+                                    $pl['timeUse'] - time()
+                                ) . ', ������ ����������� ����� ' . $u->timeOut($pl['deactiveTime'] - time()) . '<br>';
+                        }
 
-if($ae != '') {
-	echo '<br><b>�����������:</b><br>'.$ae.'<br><br>';
-}
-/*if ($u->info['level'] > 9)
-	{
-	$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;'));
-		if (!isset($check['id']))
-		{	
-		echo '<br>&nbsp;<b>����� �� ������:</b>&nbsp;<b style="color:#940101">��������.</b><br><br>';
-		}
-		else
-		{
-		echo '<br>&nbsp;<b>����� �� ������:</b>&nbsp;<b style="color:#940101">'.date('d.m.Y H:i',($check['time']+10800)).'.</b><br><br>';	
-		}
-	}*/
-$psh = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars` = "psh0" AND `time` > '.(time()-7200).' LIMIT 1'));
-if(isset($psh['id']))
-{
-	if($clr=='C7')
-	{
-		$clr = 'D5';
-	}else{
-		$clr = 'C7';	
-	}
-	echo '<br>&nbsp;<b>����� �� ����������:</b> '.$u->timeOut(($psh['time']+60*60*3)-time()).'<br><br>';
-}
+                        if ($ae != '') {
+                            echo '<br><b>�����������:</b><br>' . $ae . '<br><br>';
+                        }
+                        /*if ($u->info['level'] > 9)
+                    {
+                    $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;'));
+                        if (!isset($check['id']))
+                        {
+                        echo '<br>&nbsp;<b>����� �� ������:</b>&nbsp;<b style="color:#940101">��������.</b><br><br>';
+                        }
+                        else
+                        {
+                        echo '<br>&nbsp;<b>����� �� ������:</b>&nbsp;<b style="color:#940101">'.date('d.m.Y H:i',($check['time']+10800)).'.</b><br><br>';
+                        }
+                    }*/
+                        $psh = mysql_fetch_array(
+                            mysql_query(
+                                'SELECT * FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` = "psh0" AND `time` > ' . (time(
+                                    ) - 7200) . ' LIMIT 1'
+                            )
+                        );
+                        if (isset($psh['id'])) {
+                            if ($clr == 'C7') {
+                                $clr = 'D5';
+                            } else {
+                                $clr = 'C7';
+                            }
+                            echo '<br>&nbsp;<b>����� �� ����������:</b> ' . $u->timeOut(
+                                    ($psh['time'] + 60 * 60 * 3) - time()
+                                ) . '<br><br>';
+                        }
 
 
+                        ?>
+                        &nbsp;<b>�������:</b>
+                        <br>
+                        <?php
+                        /* ������ ������ */
+                        $b = [];
+                        $st = [];
 
-?>
-&nbsp;<b>�������:</b>
-<br>
-<?
-/* ������ ������ */
-$b = array();
-$st = array();
+                        //������ ������
+                        //������ ������
+                        //����
+                        //����
+                        if ($u->stats['s1'] > 24 && $u->stats['s1'] < 50) {
+                            $st[1]['m2'] += 15;
+                        }
+                        if ($u->stats['s1'] > 49 && $u->stats['s1'] < 75) {
+                            $st[1]['pa2'] += 2;
+                            $st[1]['m2'] += 35;
+                        }
+                        if ($u->stats['s1'] > 74 && $u->stats['s1'] < 100) {
+                            $st[1]['pa2'] += 5;
+                            $st[1]['m2'] += 50;
+                        }
+                        if ($u->stats['s1'] > 99 && $u->stats['s1'] < 125) {
+                            $st[1]['pa2'] += 8;
+                            $st[1]['m2'] += 80;
+                        }
+                        if ($u->stats['s1'] > 124 && $u->stats['s1'] < 150) {
+                            $st[1]['pa2'] += 12;
+                            $st[1]['m2'] += 105;
+                        }
+                        if ($u->stats['s1'] > 149 && $u->stats['s1'] < 175) {
+                            $st[1]['pa2'] += 17;
+                            $st[1]['m7'] += 2;
+                        }
+                        if ($u->stats['s1'] > 174 && $u->stats['s1'] < 200) {
+                            $st[1]['pa2'] += 23;
+                            $st[1]['m7'] += 5;
+                        }
+                        if ($u->stats['s1'] > 199) {
+                            $st[1]['pa2'] += 30;
+                            $st[1]['m7'] += 7;
+                        }
+                        //��������
+                        if ($u->stats['s2'] > 24 && $u->stats['s2'] < 50) {
+                            $st[2]['pa1'] += 2;
+                            $st[2]['m4'] += 35;
+                        }
+                        if ($u->stats['s2'] > 49 && $u->stats['s2'] < 75) {
+                            $st[2]['pa1'] += 5;
+                            $st[2]['m2'] += 40;
+                            $st[2]['m4'] += 75;
+                        }
+                        if ($u->stats['s2'] > 74 && $u->stats['s2'] < 100) {
+                            $st[2]['pa1'] += 8;
+                            $st[2]['m2'] += 65;
+                            $st[2]['m4'] += 90;
+                        }
+                        if ($u->stats['s2'] > 99 && $u->stats['s2'] < 125) {
+                            $st[2]['pa1'] += 12;
+                            $st[2]['m2'] += 75;
+                            $st[2]['m4'] += 105;
+                        }
+                        if ($u->stats['s2'] > 124 && $u->stats['s2'] < 150) {
+                            $st[2]['pa1'] += 17;
+                            $st[2]['m2'] += 85;
+                            $st[2]['m4'] += 105;
+                            $st[2]['m15'] += 1;
+                        }
+                        if ($u->stats['s2'] > 149 && $u->stats['s2'] < 175) {
+                            $st[2]['pa1'] += 20;
+                            $st[2]['m2'] += 110;
+                            $st[2]['m4'] += 115;
+                            $$st[2]['m15'] += 2;
+                        }
+                        if ($u->stats['s2'] > 174 && $u->stats['s2'] < 200) {
+                            $st[2]['pa1'] += 23;
+                            $st[2]['m2'] += 145;
+                            $st[2]['m4'] += 145;
+                            $st[2]['m15'] += 3;
+                        }
+                        if ($u->stats['s2'] > 199) {
+                            $st[2]['pa1'] += 30;
+                            $st[2]['m2'] += 165;
+                            $st[2]['m4'] += 165;
+                            $st[2]['m15'] += 5;
+                        }
+                        //��������
+                        if ($u->stats['s3'] > 24 && $u->stats['s3'] < 50) {
+                            $st[3]['pa4'] += 2;
+                            $st[3]['m3'] += 2;
+                            $st[3]['m1'] += 25;
+                        }
+                        if ($u->stats['s3'] > 49 && $u->stats['s3'] < 75) {
+                            $st[3]['pa4'] += 5;
+                            $st[3]['m3'] += 5;
+                            $st[3]['m1'] += 55;
+                        }
+                        if ($u->stats['s3'] > 74 && $u->stats['s3'] < 100) {
+                            $st[3]['pa4'] += 8;
+                            $st[3]['m3'] += 10;
+                            $st[3]['m1'] += 75;
+                            $st[3]['m5'] += 25;
+                        }
+                        if ($u->stats['s3'] > 99 && $u->stats['s3'] < 125) {
+                            $st[3]['pa4'] += 12;
+                            $st[3]['m3'] += 15;
+                            $st[3]['m1'] += 105;
+                            $st[3]['m5'] += 35;
+                        }
+                        if ($u->stats['s3'] > 124 && $u->stats['s3'] < 150) {
+                            $st[3]['pa4'] += 17;
+                            $st[3]['m3'] += 20;
+                            $st[3]['m1'] += 125;
+                            $st[3]['m5'] += 45;
+                            $st[3]['m14'] += 1;
+                        }
+                        if ($u->stats['s3'] > 149 && $u->stats['s3'] < 175) {
+                            $st[3]['pa4'] += 20;
+                            $st[3]['m3'] += 30;
+                            $st[3]['m1'] += 145;
+                            $st[3]['m5'] += 50;
+                            $st[3]['m14'] += 2;
+                        }
+                        if ($u->stats['s3'] > 174 && $u->stats['s3'] < 200) {
+                            $st[3]['pa4'] += 23;
+                            $st[3]['m3'] += 35;
+                            $st[3]['m1'] += 165;
+                            $st[3]['m5'] += 55;
+                            $st[3]['m14'] += 3;
+                        }
+                        if ($u->stats['s3'] > 199) {
+                            $st[3]['pa4'] += 30;
+                            $st[3]['m3'] += 40;
+                            $st[3]['m1'] += 185;
+                            $st[3]['m5'] += 65;
+                            $st[3]['m14'] += 5;
+                        }
+                        //������������
+                        if ($u->stats['s4'] > 0) {
+                            $st[4]['hpAll'] += 30;
+                        }
+                        if ($u->stats['s4'] > 24 && $u->stats['s4'] < 50) {
+                            $st[4]['hpAll'] += 50;
+                        }
+                        if ($u->stats['s4'] > 49 && $u->stats['s4'] < 75) {
+                            $st[4]['hpAll'] += 100;
+                        }
+                        if ($u->stats['s4'] > 74 && $u->stats['s4'] < 100) {
+                            $st[4]['hpAll'] += 175;
+                        }
+                        if ($u->stats['s4'] > 99 && $u->stats['s4'] < 125) {
+                            $st[4]['hpAll'] += 250;
+                        }
+                        if ($u->stats['s4'] > 124 && $u->stats['s4'] < 150) {
+                            $st[4]['hpAll'] += 400;
+                            $st[4]['za'] += 25;
+                            $st[4]['zm'] += 25;
+                        }
+                        if ($u->stats['s4'] > 149 && $u->stats['s4'] < 175) {
+                            $st[4]['hpAll'] += 450;
+                            $st[4]['za'] += 50;
+                            $st[4]['zm'] += 50;
+                        }
+                        if ($u->stats['s4'] > 174 && $u->stats['s4'] < 200) {
+                            $st[4]['hpAll'] += 600;
+                            $st[4]['za'] += 100;
+                            $st[4]['zm'] += 100;
+                        }
+                        if ($u->stats['s4'] > 199) {
+                            $st[4]['hpAll'] += 850;
+                            $st[4]['za'] += 125;
+                            $st[4]['zm'] += 125;
+                        }
+                        //��������
+                        if ($u->stats['s5'] > 24 && $u->stats['s5'] < 50) {
+                            $st[5]['m11'] += 10;
+                        }
+                        if ($u->stats['s5'] > 49 && $u->stats['s5'] < 75) {
+                            $st[5]['m11'] += 15;
+                        }
+                        if ($u->stats['s5'] > 74 && $u->stats['s5'] < 100) {
+                            $st[5]['m11'] += 20;
+                        }
+                        if ($u->stats['s5'] > 99 && $u->stats['s5'] < 125) {
+                            $st[5]['m11'] += 25;
+                        }
+                        if ($u->stats['s5'] > 124 && $u->stats['s5'] < 150) {
+                            $st[5]['m11'] += 35;
+                        }
+                        if ($u->stats['s5'] > 149 && $u->stats['s5'] < 175) {
+                            $st[5]['m11'] += 50;
+                        }
+                        if ($u->stats['s5'] > 174 && $u->stats['s5'] < 200) {
+                            $st[5]['m11'] += 65;
+                            $st[5]['pzm'] += 2;
+                        }
+                        if ($u->stats['s5'] > 199) {
+                            $st[5]['m11'] += 65;
+                            $st[5]['pzm'] += 4;
+                        }
+                        //��������
+                        if ($u->stats['s6'] > 24 && $u->stats['s6'] < 50) {
+                            $st[6]['mpAll'] += 150;
+                            $st[6]['speedmp'] += 100;
+                        }
+                        if ($u->stats['s6'] > 49 && $u->stats['s6'] < 75) {
+                            $st[6]['mpAll'] += 200;
+                            $st[6]['speedmp'] += 200;
+                        }
+                        if ($u->stats['s6'] > 74 && $u->stats['s6'] < 100) {
+                            $st[6]['mpAll'] += 250;
+                            $st[6]['speedmp'] += 350;
+                        }
+                        if ($u->stats['s6'] > 99 && $u->stats['s6'] < 125) {
+                            $st[6]['mpAll'] += 350;
+                            $st[6]['speedmp'] += 500;
+                        }
+                        if ($u->stats['s6'] > 124 && $u->stats['s6'] < 150) {
+                            $st[6]['mpAll'] += 500;
+                            $st[6]['speedmp'] += 500;
+                            $st[6]['pzm'] += 2;
+                        }
+                        if ($u->stats['s6'] > 149 && $u->stats['s6'] < 175) {
+                            $st[6]['mpAll'] += 700;
+                            $st[6]['speedmp'] += 600;
+                            $st[6]['pzm'] += 3;
+                        }
+                        if ($u->stats['s6'] > 174 && $u->stats['s6'] < 200) {
+                            $st[6]['mpAll'] += 900;
+                            $st[6]['speedmp'] += 700;
+                            $st[6]['pzm'] += 5;
+                        }
+                        if ($u->stats['s6'] > 199) {
+                            $st[6]['mpAll'] += 900;
+                            $st[6]['speedmp'] += 700;
+                            $st[6]['pzm'] += 7;
+                        }
+                        $b8name = '';
+                        //����������
+                        //if($u->stats['s7']>24){ $b8name = '�������� ������'; $b[8] .= '&nbsp;&nbsp;&nbsp;&bull; ����� ����� ������ ���� ��� ����� &quot;���������� ������&quot;<img src="https://img.new-combats.com/i/eff/spirit_block25.gif"><br>'; }
+                        if ($u->stats['s7'] > 49) {
+                            $b8name = '�������� ���������';
+                            $b[8] .= '&nbsp;&nbsp;&nbsp;&bull; ������ ��� �� ��������� ��� ��������� �����  &quot;��������&quot;<img src="https://img.new-combats.com/i/eff/preservation.gif"><br>';
+                        }
+                        if ($u->stats['s7'] > 74) {
+                            $b8name = '���� ����';
+                            $b[8] .= '&nbsp;&nbsp;&nbsp;&bull; ����������� � �������� ������ ����� ������ ���� ���� <img src="https://img.new-combats.com/i/micro/spirit.gif"><br>';
+                        }
+                        if ($u->stats['s7'] > 99) {
+                            $b8name = '��������';
+                            $b[8] .= '&nbsp;&nbsp;&nbsp;&bull; ������ ������� ��� �� ���������� �������� ����������, ���������, �������� � ���� � ������� ���<br>';
+                        }
 
-	//������ ������
-			//������ ������
-		//����
-			//����
-			/*if($u->stats['s1']>24 && $u->stats['s1']<50){ $st[1]['m10']  += 5;  }
-			if($u->stats['s1']>49 && $u->stats['s1']<75){ $st[1]['m10']  += 10; }
-			if($u->stats['s1']>74 && $u->stats['s1']<100){ $st[1]['m10']  += 17; }
-			if($u->stats['s1']>99 && $u->stats['s1']<125){ $st[1]['m10']  += 25; }
-			if($u->stats['s1']>124 && $u->stats['s1']<150){ $st[1]['m10'] += 25; $st[1]['minAtack'] += 10; $st[1]['maxAtack'] += 10; }
-			if($u->stats['s1']>149 && $u->stats['s1']<175){ $st[1]['m10'] += 30; $st[1]['minAtack'] += 10; $st[1]['maxAtack'] += 10; }
-			if($u->stats['s1']>174){ $u->stats['m10'] += 30; $st[1]['minAtack'] += 15; $st[1]['maxAtack'] += 15; }*/
-		    if($u->stats['s1']>24 && $u->stats['s1']<50){  $st[1]['m2']  += 15; }
-			if($u->stats['s1']>49 && $u->stats['s1']<75){ $st[1]['pa2']  += 2; $st[1]['m2']  += 35; }
-			if($u->stats['s1']>74 && $u->stats['s1']<100){ $st[1]['pa2']  += 5; $st[1]['m2']  += 50; }
-			if($u->stats['s1']>99 && $u->stats['s1']<125){ $st[1]['pa2']  += 8; $st[1]['m2']  += 80;}
-			if($u->stats['s1']>124 && $u->stats['s1']<150){ $st[1]['pa2']  += 12; $st[1]['m2']  += 105; }
-			if($u->stats['s1']>149 && $u->stats['s1']<175){ $st[1]['pa2']  += 17; $st[1]['m7']  += 2; }
-			if($u->stats['s1']>174 && $u->stats['s1']<200){ $st[1]['pa2']  += 23; $st[1]['m7']  += 5; }
-			if($u->stats['s1']>199) { $st[1]['pa2']  += 30; $st[1]['m7']  += 7; }
-			//�������� 
-			/*if($u->stats['s2']>24 && $u->stats['s2']<50){ $st[2]['m7']  += 5;  }
-			if($u->stats['s2']>49 && $u->stats['s2']<75){ $st[2]['m7']  += 5; $st[2]['m4']  += 35; $st[2]['m2']  += 15; }
-			if($u->stats['s2']>74 && $u->stats['s2']<100){ $st[2]['m7']  += 15; $st[2]['m4']  += 35; $st[2]['m2']  += 15; }
-			if($u->stats['s2']>99 && $u->stats['s2']<125){ $st[2]['m7']  += 15; $st[2]['m4']  += 105; $st[2]['m2']  += 40; }
-			if($u->stats['s2']>124 && $u->stats['s2']<150) { $st[2]['m7']  += 15; $st[2]['m4']  += 105; $st[2]['m2']  += 40; $st[2]['m15'] += 5; }
-			if($u->stats['s2']>149 && $u->stats['s2']<175){ $st[2]['m7']  += 20; $st[2]['m4']  += 115; $st[2]['m2']  += 40; $st[2]['m15'] += 5; }
-			if($u->stats['s2']>174){ $st[2]['m7']  += 20; $st[2]['m4']  += 120; $st[2]['m2']  += 50; $st[2]['m15'] += 7; }*/
-			if($u->stats['s2']>24 && $u->stats['s2']<50){ $st[2]['pa1']  += 2; $st[2]['m4']  += 35; }
-			if($u->stats['s2']>49 && $u->stats['s2']<75){ $st[2]['pa1']  += 5; $st[2]['m2']  += 40; $st[2]['m4']  += 75; }
-			if($u->stats['s2']>74 && $u->stats['s2']<100){ $st[2]['pa1']  += 8; $st[2]['m2']  += 65; $st[2]['m4']  += 90; }
-			if($u->stats['s2']>99 && $u->stats['s2']<125){ $st[2]['pa1']  += 12; $st[2]['m2']  += 75; $st[2]['m4']  += 105; }
-			if($u->stats['s2']>124 && $u->stats['s2']<150) { $st[2]['pa1']  += 17; $st[2]['m2']  += 85; $st[2]['m4']  += 105; $st[2]['m15']  += 1; }
-			if($u->stats['s2']>149 && $u->stats['s2']<175){ $st[2]['pa1']  += 20; $st[2]['m2']  += 110; $st[2]['m4']  += 115; $$st[2]['m15']  += 2; }
-			if($u->stats['s2']>174 && $u->stats['s2']<200){ $st[2]['pa1']  += 23; $st[2]['m2']  += 145; $st[2]['m4']  += 145; $st[2]['m15']  += 3; }
-			if($u->stats['s2']>199){ $st[2]['pa1']  += 30; $st[2]['m2']  += 165; $st[2]['m4']  += 165; $st[2]['m15']  += 5; }
-			//��������
-			/*if($u->stats['s3']>24 && $u->stats['s3']<50){ $st[3]['m3'] += 10; }
-			if($u->stats['s3']>49 && $u->stats['s3']<75){ $st[3]['m3'] += 10; $st[3]['m1'] += 35; $st[3]['m5'] += 15; }
-			if($u->stats['s3']>74 && $u->stats['s3']<100){ $st[3]['m3'] += 25; $st[3]['m1'] += 35; $st[3]['m5'] += 15; }
-			if($u->stats['s3']>99 && $u->stats['s3']<125){ $st[3]['m3'] += 25; $st[3]['m1'] += 105; $st[3]['m5'] += 45; }
-			if($u->stats['s3']>124 && $u->stats['s3']<150){ $st[3]['m3'] += 25; $st[3]['m1'] += 105; $st[3]['m5'] += 45; $st[3]['m14'] += 5; }
-			if($u->stats['s3']>149 && $u->stats['s3']<175){ $st[3]['m3'] += 30; $st[3]['m1'] += 105; $st[3]['m5'] += 45; $st[3]['m14'] += 5; }
-			if($u->stats['s3']>174){ $st[3]['m3'] += 30; $st[3]['m1'] += 120; $st[3]['m5'] += 45; $st[3]['m14'] += 7; }*/
-			if($u->stats['s3']>24 && $u->stats['s3']<50){ $st[3]['pa4']+=2; $st[3]['m3'] += 2; $st[3]['m1'] += 25;}
-			if($u->stats['s3']>49 && $u->stats['s3']<75){ $st[3]['pa4']+=5; $st[3]['m3'] += 5; $st[3]['m1'] += 55; }
-			if($u->stats['s3']>74 && $u->stats['s3']<100){ $st[3]['pa4']+=8; $st[3]['m3'] += 10; $st[3]['m1'] += 75; $st[3]['m5'] += 25; }
-			if($u->stats['s3']>99 && $u->stats['s3']<125){ $st[3]['pa4']+=12; $st[3]['m3'] += 15; $st[3]['m1'] += 105; $st[3]['m5'] += 35; }
-			if($u->stats['s3']>124 && $u->stats['s3']<150){ $st[3]['pa4']+=17; $st[3]['m3'] += 20; $st[3]['m1'] += 125; $st[3]['m5'] += 45; $st[3]['m14'] += 1; }
-			if($u->stats['s3']>149 && $u->stats['s3']<175){ $st[3]['pa4']+=20; $st[3]['m3'] += 30; $st[3]['m1'] += 145; $st[3]['m5'] += 50; $st[3]['m14'] += 2; }
-			if($u->stats['s3']>174 && $u->stats['s3']<200){ $st[3]['pa4']+=23; $st[3]['m3'] += 35; $st[3]['m1'] += 165; $st[3]['m5'] += 55; $st[3]['m14'] += 3; }
-			if($u->stats['s3']>199){ $st[3]['pa4']+=30; $st[3]['m3'] += 40; $st[3]['m1'] += 185; $st[3]['m5'] += 65; $st[3]['m14'] += 5; }
-			//������������
-			/*if($u->stats['s4']>0){ $st['hpAll']   += 30;  }
-			if($u->stats['s4']>24 && $u->stats['s4']<50){ $st[4]['hpAll']  += 50;  }
-			if($u->stats['s4']>49 && $u->stats['s4']<75){ $st[4]['hpAll']  += 100; }
-			if($u->stats['s4']>74 && $u->stats['s4']<100){ $st[4]['hpAll']  += 175; }
-			if($u->stats['s4']>99 && $u->stats['s4']<125){ $st[4]['hpAll']  += 250; }
-			if($u->stats['s4']>124 && $u->stats['s4']<150){ $st[4]['hpAll'] += 250; $st[4]['za'] += 25; }
-			if($u->stats['s4']>149 && $u->stats['s4']<175){ $st[4]['hpAll'] += 350; $st[4]['za'] += 50; }
-			if($u->stats['s4']>174){ $st[4]['hpAll'] += 400; $st[4]['za'] += 100; }*/
-			if($u->stats['s4']>0){ $st[4]['hpAll']   += 30;  }
-			if($u->stats['s4']>24 && $u->stats['s4']<50){ $st[4]['hpAll']  += 50;  }
-			if($u->stats['s4']>49 && $u->stats['s4']<75){ $st[4]['hpAll']  += 100; }
-			if($u->stats['s4']>74 && $u->stats['s4']<100){ $st[4]['hpAll']  += 175; }
-			if($u->stats['s4']>99 && $u->stats['s4']<125){ $st[4]['hpAll']  += 250; }
-			if($u->stats['s4']>124 && $u->stats['s4']<150){ $st[4]['hpAll'] += 400; $st[4]['za'] += 25; $st[4]['zm'] += 25; }
-			if($u->stats['s4']>149 && $u->stats['s4']<175){ $st[4]['hpAll'] += 450; $st[4]['za'] += 50; $st[4]['zm'] += 50; }
-			if($u->stats['s4']>174 && $u->stats['s4']<200){ $st[4]['hpAll'] += 600; $st[4]['za'] += 100; $st[4]['zm'] += 100; }
-			if($u->stats['s4']>199){ $st[4]['hpAll'] += 850; $st[4]['za'] += 125; $st[4]['zm'] += 125; }
-			//�������� 
-			if($u->stats['s5']>24 && $u->stats['s5']<50){ $st[5]['m11'] += 10; }
-			if($u->stats['s5']>49 && $u->stats['s5']<75){ $st[5]['m11'] += 15;  }
-			if($u->stats['s5']>74 && $u->stats['s5']<100){ $st[5]['m11'] += 20; }
-			if($u->stats['s5']>99 && $u->stats['s5']<125){ $st[5]['m11'] += 25; }
-			if($u->stats['s5']>124 && $u->stats['s5']<150){ $st[5]['m11'] += 35;  }
-			if($u->stats['s5']>149 && $u->stats['s5']<175){ $st[5]['m11'] += 50; }
-			if($u->stats['s5']>174 && $u->stats['s5']<200){ $st[5]['m11'] += 65; $st[5]['pzm'] += 2;}
-			if($u->stats['s5']>199){ $st[5]['m11'] += 65; $st[5]['pzm'] += 4;}
-			//��������
-			if($u->stats['s6']>24 && $u->stats['s6']<50){ $st[6]['mpAll'] += 150; $st[6]['speedmp'] +=100; }
-			if($u->stats['s6']>49 && $u->stats['s6']<75){ $st[6]['mpAll'] += 200; $st[6]['speedmp'] +=200; }
-			if($u->stats['s6']>74 && $u->stats['s6']<100){ $st[6]['mpAll'] += 250; $st[6]['speedmp'] += 350; }
-			if($u->stats['s6']>99 && $u->stats['s6']<125){ $st[6]['mpAll'] += 350; $st[6]['speedmp'] += 500; }
-			if($u->stats['s6']>124 && $u->stats['s6']<150) { $st[6]['mpAll'] += 500; $st[6]['speedmp'] += 500; $st[6]['pzm'] += 2; }
-			if($u->stats['s6']>149 && $u->stats['s6']<175){ $st[6]['mpAll'] += 700; $st[6]['speedmp'] += 600; $st[6]['pzm'] += 3; }
-			if($u->stats['s6']>174 && $u->stats['s6']<200){ $st[6]['mpAll'] += 900; $st[6]['speedmp'] += 700; $st[6]['pzm'] += 5; }
-			if($u->stats['s6']>199){ $st[6]['mpAll'] += 900; $st[6]['speedmp'] += 700; $st[6]['pzm'] += 7; }			
-			$b8name = '';
-		//����������
-			//if($u->stats['s7']>24){ $b8name = '�������� ������'; $b[8] .= '&nbsp;&nbsp;&nbsp;&bull; ����� ����� ������ ���� ��� ����� &quot;���������� ������&quot;<img src="https://img.new-combats.com/i/eff/spirit_block25.gif"><br>'; }
-			if($u->stats['s7']>49){ $b8name = '�������� ���������'; $b[8] .= '&nbsp;&nbsp;&nbsp;&bull; ������ ��� �� ��������� ��� ��������� �����  &quot;��������&quot;<img src="https://img.new-combats.com/i/eff/preservation.gif"><br>'; }
-			if($u->stats['s7']>74){ $b8name = '���� ����'; $b[8] .= '&nbsp;&nbsp;&nbsp;&bull; ����������� � �������� ������ ����� ������ ���� ���� <img src="https://img.new-combats.com/i/micro/spirit.gif"><br>'; }
-			if($u->stats['s7']>99){ $b8name = '��������'; $b[8] .= '&nbsp;&nbsp;&nbsp;&bull; ������ ������� ��� �� ���������� �������� ����������, ���������, �������� � ���� � ������� ���<br>'; }
+                        //����� �������
+                        $i = 1;
+                        while ($i <= 8) {
+                            if (isset($st[$i])) {
+                                $j = 0;
+                                while ($j < count($u->items['add'])) {
+                                    if (isset($st[$i][$u->items['add'][$j]])) {
+                                        $vr = $st[$i][$u->items['add'][$j]];
+                                        if ($vr > 0) {
+                                            $vr = '+' . $vr;
+                                        }
+                                        $b[$i] .= '&nbsp;&nbsp;&nbsp;&bull; ' . $u->is[$u->items['add'][$j]] . ': ' . $vr . '<br>';
+                                    }
+                                    $j++;
+                                }
+                            }
+                            $i++;
+                        }
 
-	//����� �������
-	$i = 1;
-	while($i<=8)
-	{
-		if(isset($st[$i]))
-		{
-			$j = 0;
-			while($j<count($u->items['add']))
-			{
-				if(isset($st[$i][$u->items['add'][$j]]))
-				{
-					$vr = $st[$i][$u->items['add'][$j]];
-					if($vr>0)
-					{
-						$vr = '+'.$vr;
-					}
-					$b[$i] .= '&nbsp;&nbsp;&nbsp;&bull; '.$u->is[$u->items['add'][$j]].': '.$vr.'<br>';
-				}
-				$j++;
-			}
-		}
-		$i++;
-	}
-	
-	
-/* ���������� ��������� */
-$coms = array();
-$cl = mysql_query('SELECT `im`.`name`,`im`.`2h`,`im`.`id`,`iu`.`data` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`inOdet`!="0" AND `iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0"');
-while($pl = mysql_fetch_array($cl))
-{
-	$sts = explode('|',$pl['data']);
-	$i = 0; $ste = ''; $sti = array();
-	while($i<count($sts))
-	{
-		$ste = explode('=',$sts[$i]);
-		if(isset($ste[1]))
-		{
-			$sti[$ste[0]] += intval($ste[1]);
-		}
-		$i++;
-	}
-	if(isset($sti['complect']))
-	{
-		$coms[count($coms)]['id'] = $sti['complect'];
-		if(!isset($coms['com'][$sti['complect']]))
-		{
-			$coms['com'][$sti['complect']] = 0;	
-			$coms['new'][count($coms['new'])] = $sti['complect'];	
-		}
-		$coms['com'][$sti['complect']]++;
-		if($pl['2h']>0) {
-			$coms['com'][$sti['complect']]++;
-		}
-	}
-	if(isset($sti['complect2']))
-	{
-		$coms[count($coms)]['id'] = $sti['complect2'];
-		if(!isset($coms['com'][$sti['complect2']]))
-		{
-			$coms['com'][$sti['complect2']] = 0;	
-			$coms['new'][count($coms['new'])] = $sti['complect2'];	
-		}
-		$coms['com'][$sti['complect2']]++;
-		if($pl['2h']>0) {
-			$coms['com'][$sti['complect2']]++;
-		}
-	}	
-}
 
-if(count($coms['new']) > 0) {
-	$cmss = '';
-	$i = 0;
-	while($i < count($coms['new'])) {
-		if($coms['new'][$i] > 0) {
-			$spc = mysql_query('SELECT * FROM `complects` WHERE `com` = "'.$coms['new'][$i].'" AND `x` <= "'.$coms['com'][$coms['new'][$i]].'" ORDER BY `x` DESC LIMIT 1');
-			while($plc = mysql_fetch_array($spc)) {
-				$cmss .= '&nbsp;&nbsp; &bull; '.$plc['name'].' ';
-				if($coms['com'][$coms['new'][$i]] >= $plc['x']) {
-					$cmss .= '<font color=green>['.$coms['com'][$coms['new'][$i]].'/'.$plc['x'].']</font>';
-				}else{
-					$cmss .= '['.$coms['com'][$coms['new'][$i]].'/'.$plc['x'].']';
-				}
-				$cmss .= '<br>';
-				
-						$ia = $u->items['add'];
-				
-						//��������� �������� ���������
-						$cmss .= '<small style="color:grey">';
-						$ij = 0;
-						$sti = $u->lookStats($plc['data']);
-						while($ij<count($ia))
-						{
-							if(isset($ia[$ij]) && isset($sti[$ia[$ij]]))
-							{
-								//$st[$ia[$ij]] += $sti[$ia[$ij]];
-								$mad   = $sti[$ia[$ij]];
-								if($mad > 0) {
-									$mad = '+'.$mad;
-								}
-								$cmss .= '&nbsp; &nbsp; &nbsp; &nbsp; &bull; '.$u->is[$ia[$ij]].': '.$mad.'<br>';
-							}
-							$ij++;
-						}
-						$cmss .= '</small>';
-			}					
-		}
-		$i++;
-	}
-	if($cmss != '') {
-		echo '&nbsp;&nbsp;&nbsp;<b>��������</b>:<br>'.$cmss.'<br>';
-	}
-}
+                        /* ���������� ��������� */
+                        $coms = [];
+                        $cl = mysql_query(
+                            'SELECT `im`.`name`,`im`.`2h`,`im`.`id`,`iu`.`data` FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`inOdet`!="0" AND `iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0"'
+                        );
+                        while ($pl = mysql_fetch_array($cl)) {
+                            $sts = explode('|', $pl['data']);
+                            $i = 0;
+                            $ste = '';
+                            $sti = [];
+                            while ($i < count($sts)) {
+                                $ste = explode('=', $sts[$i]);
+                                if (isset($ste[1])) {
+                                    $sti[$ste[0]] += intval($ste[1]);
+                                }
+                                $i++;
+                            }
+                            if (isset($sti['complect'])) {
+                                $coms[count($coms)]['id'] = $sti['complect'];
+                                if (!isset($coms['com'][$sti['complect']])) {
+                                    $coms['com'][$sti['complect']] = 0;
+                                    $coms['new'][count($coms['new'])] = $sti['complect'];
+                                }
+                                $coms['com'][$sti['complect']]++;
+                                if ($pl['2h'] > 0) {
+                                    $coms['com'][$sti['complect']]++;
+                                }
+                            }
+                            if (isset($sti['complect2'])) {
+                                $coms[count($coms)]['id'] = $sti['complect2'];
+                                if (!isset($coms['com'][$sti['complect2']])) {
+                                    $coms['com'][$sti['complect2']] = 0;
+                                    $coms['new'][count($coms['new'])] = $sti['complect2'];
+                                }
+                                $coms['com'][$sti['complect2']]++;
+                                if ($pl['2h'] > 0) {
+                                    $coms['com'][$sti['complect2']]++;
+                                }
+                            }
+                        }
 
-/*
-if(isset($sti['complect']))
-{
-	$coms[count($coms)+1]['id'] = $sti['complect'];
-	if(!isset($coms['com'][$sti['complect']]))
-	{
-		$coms['com'][$sti['complect']] = 0;	
-	}
-	$coms['com'][$sti['complect']]++;
-}
-//������ ����������
-$i = 1;
-while($i<=count($coms['com']))
-{
-	if(isset($coms[$i]))
-	{
-		//$coms[$i]['id'] - id ���������, $j - ���-�� ��������� ������� ���������
-		$j = $coms['com'][$coms[$i]['id']];
-		$com = mysql_fetch_array(mysql_query('SELECT * FROM `complects` WHERE `com` = "'.((int)$coms[$i]['id']).'" 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))
-			{
-				if(isset($ia[$ij]) && isset($sti[$ia[$ij]]))
-				{
-					$st[$ia[$ij]] += $sti[$ia[$ij]];
-				}
-				$ij++;
-			}	
-		}
-	}
-	$i++;
-}
-*/
-	
-if(isset($b[1]))
-{
-if($u->stats['s1'] > 99) {
-	echo '&nbsp;&nbsp;&nbsp;<b>���� ������� </b>:<br>'.$b[1].'<br>';
-}else{
-	echo '&nbsp;&nbsp;&nbsp;<b>���� ��������</b>:<br>'.$b[1].'<br>';
-	}
-}
-if(isset($b[2]))
-{
-if($u->stats['s2'] > 99) {
-echo '&nbsp;&nbsp;&nbsp;<b>�������� ������</b>:<br>'.$b[2].'<br>';	
-}else{
-	echo '&nbsp;&nbsp;&nbsp;<b>�������� ����</b>:<br>'.$b[2].'<br>';
-     } 
-}
-if(isset($b[3]))
-{
-if($u->stats['s3'] > 99) {
-	echo '&nbsp;&nbsp;&nbsp;<b>��������</b>:<br>'.$b[3].'<br>';
-}else{
-	echo '&nbsp;&nbsp;&nbsp;<b>������������</b>:<br>'.$b[3].'<br>';
-    }
-}
-if(isset($b[4]))
-{
-	if($u->stats['s4'] > 99) {
-	echo '&nbsp;&nbsp;&nbsp;<b>�������� ����</b>:<br>'.$b[4].'<br>';
-	}else{
-	echo '&nbsp;&nbsp;&nbsp;<b>�������� ����</b>:<br>'.$b[4].'<br>';
-	}
-}
-if(isset($b[5]))
-{
-	if($u->stats['s5'] > 99) {
-		echo '&nbsp;&nbsp;&nbsp;<b>������� �����</b>:<br>'.$b[5].'<br>';
-	}else{
-	echo '&nbsp;&nbsp;&nbsp;<b>�����</b>:<br>'.$b[5].'<br>';
-	}
-}
-if(isset($b[6]))
-{
-	if($u->stats['s6'] > 99) {
-		echo '&nbsp;&nbsp;&nbsp;<b>������� ��������</b>:<br>'.$b[6].'<br>';
-	}else{
-	echo '&nbsp;&nbsp;&nbsp;<b>���� ��������</b>:<br>'.$b[6].'<br>';
-	}
-}
-if(isset($b[8]))
-{
-	echo '&nbsp;&nbsp;&nbsp;<b>'.$b8name.'</b>:<br>'.$b[8].'<br>';
-}
-?>
-</div>
-</div>
-</div>
-<div class=dtz ID=dL6>
-<div style="padding:5px;">
-<BR>
-<?
-$qsee = '';
-$qx = 0;
-$rating = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_reting_list` WHERE `uid` = "'.$u->info['id'].'" ORDER BY `id` DESC LIMIT 1'));
-$rating2 = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_reting_list` WHERE `uid` = "'.$u->info['id'].'" AND `id` < "'.$rating['id'].'" ORDER BY `id` DESC LIMIT 1'));
-//
-$rtns = ($rating['pos']-$rating2['pos']);
-if( $rtns == 0) {
-	$rtns = '<font color=grey>0</font>';
-}elseif( $rtns > 0 ) {
-	$rtns = '<img src="https://img.new-combats.com/uprt2.png" width="7" height="7"><font color=green>+'.$rtns.'</font>';
-}else{
-	$rtns = '<img src="https://img.new-combats.com/uprt.png" width="7" height="7"><font color=maroon>'.$rtns.'</font>';
-}
-echo '<b>�������:</b> '.round($rating['global']/(12345+$u->info['level']),2).' <sup>(�����: '.round($rating['global']/(12345+$u->info['level']),2).')</sup><br><b>������� � ����:</b> <a href="https://new-combats.com/rating_pers/id'.$u->info['id'].'#'.$u->info['id'].'" target="_blank">'.$rating['pos'].'</a> <sup>'.$rtns.'</sup>';
-/*if( $u->info['level'] >= 2 ) {
-	$tmon = array(
-		2 => 1,
-		3 => 1,
-		4 => 1,
-		5 => 1,
-		6 => 1,
-		7 => 2,
-		8 => 3,
-		9 => 3,
-		10 => 5,
-		11 => 5
-	);
-	$tmon = $tmon[$u->info['level']];
-	$xhp = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `battle` WHERE `id` IN ( SELECT `battle_id` FROM `battle_last` WHERE `uid` = "'.$u->info['id'].'" ) AND `priz` > 0 AND `time` > "'.strtotime(date('d.m.Y')).'"'));
-	$xhp = $xhp[0];
-	if( $xhp < 1 ) {
-		$xhp = 0;
-	}elseif( $xhp > 96 ) {
-		$xhp = 96;
-	}
-	$tmstrt = '';
-	if( date('i') >= 35 ) {
-		$tmstrt .= date('H',time()+3600).':00';
-	}else{
-		$tmstrt .= date('H',time()).':30';
-	}
-	if( date('i') < 5 || (date('i') > 29 && date('i') < 35) ) {
-		$tmstrt = '<b>��� ������! (������� ������� ������)</b>';
-	}else{
-		$tmstrt = '�������� � '.$tmstrt;
-	}
-	if( $xhp < 1 ) {
-		$xhp = 0;
-	}elseif( $xhp > 96 ) {
-		$xhp = 96;
-	}
-	echo '<br><b>�������� ����� �� �������:</b> ('.$xhp.'/96)<br>�� ��������� �������� ����, ������� '.$tmstrt.', �� ������ �������� <a href="https://new-combats.com/item/4754&rnd=1" target="_blank">�������� �����</a> (x'.floor(($tmon*(1+$xhp))/2).').';
-}*/
-echo '<br>���� ���������: <b><font colol=grey>'.$u->stats['prckr'].' ��.</font></b>';
-echo '<hr>';
+                        if (is_array($coms['new']) && count($coms['new']) > 0) {
+                            $cmss = '';
+                            $i = 0;
+                            while ($i < count($coms['new'])) {
+                                if ($coms['new'][$i] > 0) {
+                                    $spc = mysql_query(
+                                        'SELECT * FROM `complects` WHERE `com` = "' . $coms['new'][$i] . '" AND `x` <= "' . $coms['com'][$coms['new'][$i]] . '" ORDER BY `x` DESC LIMIT 1'
+                                    );
+                                    while ($plc = mysql_fetch_array($spc)) {
+                                        $cmss .= '&nbsp;&nbsp; &bull; ' . $plc['name'] . ' ';
+                                        if ($coms['com'][$coms['new'][$i]] >= $plc['x']) {
+                                            $cmss .= '<font color=green>[' . $coms['com'][$coms['new'][$i]] . '/' . $plc['x'] . ']</font>';
+                                        } else {
+                                            $cmss .= '[' . $coms['com'][$coms['new'][$i]] . '/' . $plc['x'] . ']';
+                                        }
+                                        $cmss .= '<br>';
 
-//���������� ������ ������� �������
-$sp = mysql_query('SELECT * FROM `actions` WHERE `vars` LIKE "%start_quest%" AND `vals` = "go" AND `uid` = "'.$u->info['id'].'" LIMIT 100');
-while($pl = mysql_fetch_array($sp))
-{
-	$pq = mysql_fetch_array(mysql_query('SELECT * FROM `quests` WHERE `id` = "'.str_replace('start_quest','',$pl['vars']).'" LIMIT 1'));
-	$qsee .= '<a href="main.php?skills=1&rz=6&end_qst_now='.$pq['id'].'"><img src="https://img.new-combats.com/i/clear.gif" title="���������� �� �������"></a> <b>'.$pq['name'].'</b><div style="padding-left:15px;padding-bottom:5px;border-bottom:1px solid grey"><small>'.$pq['info'].'<br>'.$q->info($pq).'</small></div><br>';
-	$qx++;
-}
+                                        $ia = $u->items['add'];
 
-if($qsee == '')
-{
-	$qsee = '� ��������� � ��� ��� �� ������ �������';
-}else{
-	$qsee .= '<small>* � ������� �� ����������� � �������� ������� �������� ������, � ������ ������� ����������� � NPS, ������� � �.�. �������� �������</small>';
-}
+                                        //��������� �������� ���������
+                                        $cmss .= '<small style="color:grey">';
+                                        $ij = 0;
+                                        $sti = $u->lookStats($plc['data']);
+                                        while ($ij < count($ia)) {
+                                            if (isset($ia[$ij]) && isset($sti[$ia[$ij]])) {
+                                                //$st[$ia[$ij]] += $sti[$ia[$ij]];
+                                                $mad = $sti[$ia[$ij]];
+                                                if ($mad > 0) {
+                                                    $mad = '+' . $mad;
+                                                }
+                                                $cmss .= '&nbsp; &nbsp; &nbsp; &nbsp; &bull; ' . $u->is[$ia[$ij]] . ': ' . $mad . '<br>';
+                                            }
+                                            $ij++;
+                                        }
+                                        $cmss .= '</small>';
+                                    }
+                                }
+                                $i++;
+                            }
+                            if ($cmss != '') {
+                                echo '&nbsp;&nbsp;&nbsp;<b>��������</b>:<br>' . $cmss . '<br>';
+                            }
+                        }
 
-if( $qx >= 0 ) {
+                        if (isset($b[1])) {
+                            if ($u->stats['s1'] > 99) {
+                                echo '&nbsp;&nbsp;&nbsp;<b>���� ������� </b>:<br>' . $b[1] . '<br>';
+                            } else {
+                                echo '&nbsp;&nbsp;&nbsp;<b>���� ��������</b>:<br>' . $b[1] . '<br>';
+                            }
+                        }
+                        if (isset($b[2])) {
+                            if ($u->stats['s2'] > 99) {
+                                echo '&nbsp;&nbsp;&nbsp;<b>�������� ������</b>:<br>' . $b[2] . '<br>';
+                            } else {
+                                echo '&nbsp;&nbsp;&nbsp;<b>�������� ����</b>:<br>' . $b[2] . '<br>';
+                            }
+                        }
+                        if (isset($b[3])) {
+                            if ($u->stats['s3'] > 99) {
+                                echo '&nbsp;&nbsp;&nbsp;<b>��������</b>:<br>' . $b[3] . '<br>';
+                            } else {
+                                echo '&nbsp;&nbsp;&nbsp;<b>������������</b>:<br>' . $b[3] . '<br>';
+                            }
+                        }
+                        if (isset($b[4])) {
+                            if ($u->stats['s4'] > 99) {
+                                echo '&nbsp;&nbsp;&nbsp;<b>�������� ����</b>:<br>' . $b[4] . '<br>';
+                            } else {
+                                echo '&nbsp;&nbsp;&nbsp;<b>�������� ����</b>:<br>' . $b[4] . '<br>';
+                            }
+                        }
+                        if (isset($b[5])) {
+                            if ($u->stats['s5'] > 99) {
+                                echo '&nbsp;&nbsp;&nbsp;<b>������� �����</b>:<br>' . $b[5] . '<br>';
+                            } else {
+                                echo '&nbsp;&nbsp;&nbsp;<b>�����</b>:<br>' . $b[5] . '<br>';
+                            }
+                        }
+                        if (isset($b[6])) {
+                            if ($u->stats['s6'] > 99) {
+                                echo '&nbsp;&nbsp;&nbsp;<b>������� ��������</b>:<br>' . $b[6] . '<br>';
+                            } else {
+                                echo '&nbsp;&nbsp;&nbsp;<b>���� ��������</b>:<br>' . $b[6] . '<br>';
+                            }
+                        }
+                        if (isset($b[8])) {
+                            echo '&nbsp;&nbsp;&nbsp;<b>' . $b8name . '</b>:<br>' . $b[8] . '<br>';
+                        }
+                        ?>
+                    </div>
+                </div>
+                </div>
+                <div class=dtz ID=dL6>
+                    <div style="padding:5px;">
+                        <BR>
+                        <?php
+                        $qsee = '';
+                        $qx = 0;
+                        $rating = mysql_fetch_array(
+                            mysql_query(
+                                'SELECT * FROM `aaa_reting_list` WHERE `uid` = "' . $u->info['id'] . '" ORDER BY `id` DESC LIMIT 1'
+                            )
+                        );
+                        $rating2 = mysql_fetch_array(
+                            mysql_query(
+                                'SELECT * FROM `aaa_reting_list` WHERE `uid` = "' . $u->info['id'] . '" AND `id` < "' . $rating['id'] . '" ORDER BY `id` DESC LIMIT 1'
+                            )
+                        );
+                        //
+                        $rtns = ($rating['pos'] - $rating2['pos']);
+                        if ($rtns == 0) {
+                            $rtns = '<font color=grey>0</font>';
+                        } elseif ($rtns > 0) {
+                            $rtns = '<img src="https://img.new-combats.com/uprt2.png" width="7" height="7"><font color=green>+' . $rtns . '</font>';
+                        } else {
+                            $rtns = '<img src="https://img.new-combats.com/uprt.png" width="7" height="7"><font color=maroon>' . $rtns . '</font>';
+                        }
+                        echo '<b>�������:</b> ' . round(
+                                $rating['global'] / (12345 + $u->info['level']), 2
+                            ) . ' <sup>(�����: ' . round(
+                                $rating['global'] / (12345 + $u->info['level']), 2
+                            ) . ')</sup><br><b>������� � ����:</b> <a href="https://new-combats.com/rating_pers/id' . $u->info['id'] . '#' . $u->info['id'] . '" target="_blank">' . $rating['pos'] . '</a> <sup>' . $rtns . '</sup>';
 
-$testdq = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars`= "day_quest" LIMIT 1'));
-if (isset($testdq['id']))
-{
-	$zadID=$testdq['vals'];
-}
-else
-{
-	$zadID=-1;
-}
+                        echo '<br>���� ���������: <b><font colol=grey>' . $u->stats['prckr'] . ' ��.</font></b>';
+                        echo '<hr>';
 
-if ($zadID==1)
-{
-	
-	$daytext= '<font color=black>��� ���� ������� � ����� ���������</font>';
-	
-}elseif($zadID==2)
-{
-	$daytext= '<font color=black>������������� � 10 ����������� ���������.</font>';
-	
-}elseif($zadID==3)
-{
-	$daytext= '<font color=black>���������� � 2 ����� ���������� �� ��������� ��������!</font>';
+                        //���������� ������ ������� �������
+                        $sp = mysql_query(
+                            'SELECT * FROM `actions` WHERE `vars` LIKE "%start_quest%" AND `vals` = "go" AND `uid` = "' . $u->info['id'] . '" LIMIT 100'
+                        );
+                        while ($pl = mysql_fetch_array($sp)) {
+                            $pq = mysql_fetch_array(
+                                mysql_query(
+                                    'SELECT * FROM `quests` WHERE `id` = "' . str_replace(
+                                        'start_quest', '', $pl['vars']
+                                    ) . '" LIMIT 1'
+                                )
+                            );
+                            $qsee .= '<a href="main.php?skills=1&rz=6&end_qst_now=' . $pq['id'] . '"><img src="https://img.new-combats.com/i/clear.gif" title="���������� �� �������"></a> <b>' . $pq['name'] . '</b><div style="padding-left:15px;padding-bottom:5px;border-bottom:1px solid grey"><small>' . $pq['info'] . '<br>' . $q->info(
+                                    $pq
+                                ) . '</small></div><br>';
+                            $qx++;
+                        }
 
-}elseif($zadID==4)
-{
-	$daytext= '<font color=black>�������� ������� � ����������� ���� 100000 �����!</font>';
+                        if ($qsee == '') {
+                            $qsee = '� ��������� � ��� ��� �� ������ �������';
+                        } else {
+                            $qsee .= '<small>* � ������� �� ����������� � �������� ������� �������� ������, � ������ ������� ����������� � NPS, ������� � �.�. �������� �������</small>';
+                        }
 
-}elseif($zadID==5)
-{
-	$daytext= '<font color=black>������� ������ ���������!</font>';
-	
-}elseif($zadID==6)
-{
-	$daytext= '<font color=black>������� � ����� �����!</font>';
-	
-}elseif($zadID==7)
-{
-	$daytext= '<font color=black>��������� 3 ����� �������� �������.</font>';
-	
-}elseif($zadID==8)
-{
-	$daytext= '<font color=black>������� � ����� ������.</font>';
-}elseif($zadID==0)
-{
-	$daytext= '<font color=black>�� ��� ��������� ���������� �������</font>';
-}else
-{
-	$daytext= '<font color=black>�� ��� �� �������� ���������� �������</font>';
-}
-?>
-<FIELDSET>
-<font color="#660000"><LEGEND><B>������� ���������� �������: </B></LEGEND></font>
-<?=$daytext?>
-<BR>
-</FIELDSET>
-<BR>
-<FIELDSET>
-<font color="#660000"><LEGEND><B>������� �������� �������: </B>[<?=$qx?>/28]</LEGEND></font>
-<?=$qsee?>
-<BR>
-</FIELDSET>
-<BR>
-<?
-}
+                        if ($qx >= 0) {
 
-$sp = mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars` LIKE "psh_qt_%" AND `time` > '.(time()-86400).' ');
-while( $pl = mysql_fetch_array($sp) ) {
-	$ic1 = str_replace('psh_qt_','',$pl['vars']);
-	echo '<fieldset>&nbsp; <img height="19" width="34" src="https://img.new-combats.com/i/city_ico2/'.$ic1.'.gif"> <b>�������� �� ��������� ������� � '.$u->city_name[$ic1].'</b> '.$u->timeOut((86400+$pl['time'])-time()).'</fieldset><br>';
-}
-//������
-$dungeon_timeout = $u->testAction('`uid` = "'.$u->info['id'].'" AND `vars` = "psh0" AND `time` > '.(time()-60*60*3).' LIMIT 1',1);
-if($dungeon_timeout['vars']=="psh0"){
-echo '<center><b>�������� �� ��������� ����������: '.$u->timeOut(60*60*2-time()+$dungeon_timeout['time']).'</center></b><br>';	
-}
-?>
-<br>
-<?
-if($u->rep['repcapitalcity']>0){ ?>
-&bull; <B>Capital city</B> - <?=$u->rep_zv(2,$u->rep['repcapitalcity'])?><BR>
-<? } if($u->rep['repangelscity']>0){ ?>
-&bull; <B>Angels city</B> - <?=$u->rep_zv(3,$u->rep['repangelscity'])?><BR>
-<? } if($u->rep['repdemonscity']>0){ ?>
-&bull; <B>Demons city</B> - <?=$u->rep_zv(4,$u->rep['repdemonscity'])?><BR>
-<? } if($u->rep['repmooncity']>0){ ?>
-&bull; <B>Moon city</B> - <?=$u->rep_zv(8,$u->rep['repmooncity'])?><BR>
-<? } if($u->rep['repsandcity']>0){ ?>
-&bull; <B>Sand city</B> - <?=$u->rep_zv(6,$u->rep['repsandcity'])?><BR>
-<? } if($u->rep['repsuncity']>0){ ?>
-&bull; <B>Sun city</B> - <?=$u->rep_zv(7,$u->rep['repsuncity'])?><BR>
-<? } if($u->rep['repemeraldscity']>0){ ?>
-&bull; <B>Emeralds city</B> - <?=$u->rep_zv(7,$u->rep['repemeraldscity'])?><BR>
-<? } if($u->rep['repdevilscity']>0){ ?>
-&bull; <B>Devils city</B> - <?=$u->rep_zv(7,$u->rep['repdevilscity'])?><BR>
-<? } if($u->rep['rep1']>0){ ?>
-&bull; <B>���� ������</B> - <?=$u->rep_zv(1,$u->rep['rep1'])?><BR>
-<? } if($u->rep['rep2']>0){ ?>
-&bull; <B>������ �����</B> - <?=$u->rep_zv(5,$u->rep['rep2'])?><BR>
-<? } if($u->rep['repdreamscity']>0){ ?>
-&bull; <B>��������</B> - <?=$u->rep_zv(9,$u->rep['repdreamscity'])?><BR>
-<?}?>
-<? if($u->rep['repabandonedplain']>0){ ?>
-&bull; <B>���� �������</B> - <?=$u->rep_zv(10,$u->rep['repabandonedplain'])?><BR>
-<?}?>
-<BR>
-<?
-$sf = $u->testAction('`uid` = "'.$u->info['id'].'" AND `time` >= '.strtotime('now 00:00:00').' AND `vars` = "statistic_today" LIMIT 1',1);
-if(isset($sf['id']))
-{
-	$sfe = $u->lookStats($sf['vals']);
-	$sf[0] = $u->info['exp']-$sfe['e'];
-	$sf[1] = $u->info['win']-$sfe['w'];
-	$sf[2] = $u->info['lose']-$sfe['l'];
-	$sf[3] = $u->info['nich']-$sfe['n'];
-	unset($sfe);
-}else{
-	$sf = array(0=>0,1=>0,2=>0,3=>0);	
-}
-?>
-&nbsp; &nbsp; &nbsp; <B>�� �������</B><BR>
-&bull; �������� �����: <? echo $sf[0]; ?><BR>
-&bull; �������� �����: <? echo $sf[1]; ?><BR>
-&bull; ��������� ����: <? echo $sf[2]; ?><BR>
-&bull; ������: <? echo $sf[3]; ?><BR>
-&bull; �������� �������� ������: <? echo $u->info['ang_g']; ?><BR>
-</div>
-</div>
-<? if($znn!=''){ ?>
-<div class=dtz ID=dL7>
-<?=$znn;?>
-</div>
-<? }
+                            $testdq = mysql_fetch_array(
+                                mysql_query(
+                                    'SELECT * FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars`= "day_quest" LIMIT 1'
+                                )
+                            );
+                            if (isset($testdq['id'])) {
+                                $zadID = $testdq['vals'];
+                            } else {
+                                $zadID = -1;
+                            }
 
-if( $u->info['ability'] == 0 && $u->info['fnq'] > 1 ) {
-	$u->info['marker'] .= '1';
-}
+                            if ($zadID == 1) {
 
-?>
-<SCRIPT>
-setlevel('L<? if(isset($rzsee)){ echo $rzsee; }else{ echo 1; } ?>');
-</SCRIPT>
-</TABLE>
+                                $daytext = '<font color=black>��� ���� ������� � ����� ���������</font>';
+
+                            } elseif ($zadID == 2) {
+                                $daytext = '<font color=black>������������� � 10 ����������� ���������.</font>';
+
+                            } elseif ($zadID == 3) {
+                                $daytext = '<font color=black>���������� � 2 ����� ���������� �� ��������� ��������!</font>';
+
+                            } elseif ($zadID == 4) {
+                                $daytext = '<font color=black>�������� ������� � ����������� ���� 100000 �����!</font>';
+
+                            } elseif ($zadID == 5) {
+                                $daytext = '<font color=black>������� ������ ���������!</font>';
+
+                            } elseif ($zadID == 6) {
+                                $daytext = '<font color=black>������� � ����� �����!</font>';
+
+                            } elseif ($zadID == 7) {
+                                $daytext = '<font color=black>��������� 3 ����� �������� �������.</font>';
+
+                            } elseif ($zadID == 8) {
+                                $daytext = '<font color=black>������� � ����� ������.</font>';
+                            } elseif ($zadID == 0) {
+                                $daytext = '<font color=black>�� ��� ��������� ���������� �������</font>';
+                            } else {
+                                $daytext = '<font color=black>�� ��� �� �������� ���������� �������</font>';
+                            }
+                            ?>
+                            <FIELDSET>
+                                <font color="#660000">
+                                    <LEGEND><B>������� ���������� �������: </B></LEGEND>
+                                </font>
+                                <?= $daytext ?>
+                                <BR>
+                            </FIELDSET>
+                            <BR>
+                            <FIELDSET>
+                                <font color="#660000">
+                                    <LEGEND><B>������� �������� �������: </B>[<?= $qx ?>/28]</LEGEND>
+                                </font>
+                                <?= $qsee ?>
+                                <BR>
+                            </FIELDSET>
+                            <BR>
+                            <?php
+                        }
+
+                        $sp = mysql_query(
+                            'SELECT * FROM `actions` WHERE `uid` = "' . $u->info['id'] . '" AND `vars` LIKE "psh_qt_%" AND `time` > ' . (time(
+                                ) - 86400) . ' '
+                        );
+                        while ($pl = mysql_fetch_array($sp)) {
+                            $ic1 = str_replace('psh_qt_', '', $pl['vars']);
+                            echo '<fieldset>&nbsp; <img height="19" width="34" src="https://img.new-combats.com/i/city_ico2/' . $ic1 . '.gif"> <b>�������� �� ��������� ������� � ' . $u->city_name[$ic1] . '</b> ' . $u->timeOut(
+                                    (86400 + $pl['time']) - time()
+                                ) . '</fieldset><br>';
+                        }
+                        //������
+                        $dungeon_timeout = $u->testAction(
+                            '`uid` = "' . $u->info['id'] . '" AND `vars` = "psh0" AND `time` > ' . (time(
+                                ) - 60 * 60 * 3) . ' LIMIT 1',
+                            1
+                        );
+                        if ($dungeon_timeout['vars'] == "psh0") {
+                            echo '<center><b>�������� �� ��������� ����������: ' . $u->timeOut(
+                                    60 * 60 * 2 - time() + $dungeon_timeout['time']
+                                ) . '</center></b><br>';
+                        }
+                        ?>
+                        <br>
+                        <?php
+                        if ($u->rep['repcapitalcity'] > 0) { ?>
+                            &bull; <B>Capital city</B> - <?= $u->rep_zv(2, $u->rep['repcapitalcity']) ?><BR>
+                            <?php
+                        }
+                        if ($u->rep['repangelscity'] > 0) { ?>
+                            &bull; <B>Angels city</B> - <?= $u->rep_zv(3, $u->rep['repangelscity']) ?><BR>
+                            <?php
+                        }
+                        if ($u->rep['repdemonscity'] > 0) { ?>
+                            &bull; <B>Demons city</B> - <?= $u->rep_zv(4, $u->rep['repdemonscity']) ?><BR>
+                            <?php
+                        }
+                        if ($u->rep['repmooncity'] > 0) { ?>
+                            &bull; <B>Moon city</B> - <?= $u->rep_zv(8, $u->rep['repmooncity']) ?><BR>
+                            <?php
+                        }
+                        if ($u->rep['repsandcity'] > 0) { ?>
+                            &bull; <B>Sand city</B> - <?= $u->rep_zv(6, $u->rep['repsandcity']) ?><BR>
+                            <?php
+                        }
+                        if ($u->rep['repsuncity'] > 0) { ?>
+                            &bull; <B>Sun city</B> - <?= $u->rep_zv(7, $u->rep['repsuncity']) ?><BR>
+                            <?php
+                        }
+                        if ($u->rep['repemeraldscity'] > 0) { ?>
+                            &bull; <B>Emeralds city</B> - <?= $u->rep_zv(7, $u->rep['repemeraldscity']) ?><BR>
+                            <?php
+                        }
+                        if ($u->rep['repdevilscity'] > 0) { ?>
+                            &bull; <B>Devils city</B> - <?= $u->rep_zv(7, $u->rep['repdevilscity']) ?><BR>
+                            <?php
+                        }
+                        if ($u->rep['rep1'] > 0) { ?>
+                            &bull; <B>���� ������</B> - <?= $u->rep_zv(1, $u->rep['rep1']) ?><BR>
+                            <?php
+                        }
+                        if ($u->rep['rep2'] > 0) { ?>
+                            &bull; <B>������ �����</B> - <?= $u->rep_zv(5, $u->rep['rep2']) ?><BR>
+                            <?php
+                        }
+                        if ($u->rep['repdreamscity'] > 0) { ?>
+                            &bull; <B>��������</B> - <?= $u->rep_zv(9, $u->rep['repdreamscity']) ?><BR>
+                            <?php
+                        } ?>
+                        <?php
+                        if ($u->rep['repabandonedplain'] > 0) { ?>
+                            &bull; <B>���� �������</B> - <?= $u->rep_zv(10, $u->rep['repabandonedplain']) ?><BR>
+                            <?php
+                        } ?>
+                        <BR>
+                        <?php
+                        $sf = $u->testAction(
+                            '`uid` = "' . $u->info['id'] . '" AND `time` >= ' . strtotime(
+                                'now 00:00:00'
+                            ) . ' AND `vars` = "statistic_today" LIMIT 1',
+                            1
+                        );
+                        if (isset($sf['id'])) {
+                            $sfe = $u->lookStats($sf['vals']);
+                            $sf[0] = $u->info['exp'] - $sfe['e'];
+                            $sf[1] = $u->info['win'] - $sfe['w'];
+                            $sf[2] = $u->info['lose'] - $sfe['l'];
+                            $sf[3] = $u->info['nich'] - $sfe['n'];
+                            unset($sfe);
+                        } else {
+                            $sf = [0 => 0, 1 => 0, 2 => 0, 3 => 0];
+                        }
+                        ?>
+                        &nbsp; &nbsp; &nbsp; <B>�� �������</B><BR>
+                        &bull; �������� �����: <?php
+                        echo $sf[0]; ?><BR>
+                        &bull; �������� �����: <?php
+                        echo $sf[1]; ?><BR>
+                        &bull; ��������� ����: <?php
+                        echo $sf[2]; ?><BR>
+                        &bull; ������: <?php
+                        echo $sf[3]; ?><BR>
+                        &bull; �������� �������� ������: <?php
+                        echo $u->info['ang_g']; ?><BR>
+                    </div>
+                </div>
+                <?php
+                if ($znn != '') { ?>
+                    <div class=dtz ID=dL7>
+                        <?= $znn; ?>
+                    </div>
+                    <?php
+                }
+
+                if ($u->info['ability'] == 0 && $u->info['fnq'] > 1) {
+                    $u->info['marker'] .= '1';
+                }
+
+                ?>
+                <SCRIPT>
+                    setlevel('L<?php if (isset($rzsee)) {
+                        echo $rzsee;
+                    } else {
+                        echo 1;
+                    } ?>');
+                </SCRIPT>
+        </TABLE>
 </TABLE>
 <!--������� ���-->
 </BODY>
diff --git a/modules_data/_zv.php b/modules_data/_zv.php
index 9e529b95..33c40bba 100644
--- a/modules_data/_zv.php
+++ b/modules_data/_zv.php
@@ -16,7 +16,7 @@ if( $_GET['r'] == 3 || $_GET['r'] == 8 ) {
 if($u->info['inTurnir'] > 0 && $u->info['inUser'] == 0 && $u->info['room'] == 318) {
   die('<script>location="main.php";</script>');
 }
-include('_incl_data/class/__zv.php');
+$zv = new FightRequest();
 $js_5356 = sprintf("top.lafstReg[%d] = 0; top.startHpRegen(\"main\",%d,%d,%d,%d,%d,%d,%d,%d,%d,1);",
     $u->info['id'], $u->info['id'], 0+$u->stats['hpNow'], 0+$u->stats['hpAll'],
     0+$u->stats['mpNow'], 0+$u->stats['mpAll'], time() - $u->info['regHP'], time() - $u->info['regMP'],
@@ -37,7 +37,7 @@ table.wfix { table-layout: fixed; width: 100%; }
 .firsttd {width: 70px;}
 </style>
 <TABLE class="wfix" cellspacing=1 cellpadding=3>
-<TR><TD colspan=8 align=right>
+<TR><TD colspan=<?= $u->info['level'] == 0 ? '4' : '6' ?> align=right>
 <div style="float:left"><?= $zv->userInfo() ?></div>
 <div style="float:right;">
   <INPUT class="btn" onClick="location='main.php?zayvka&r=<?= $_GET['r'] ?>&rnd=<?= $code ?>';" TYPE=button name=tmp value="��������">
@@ -211,11 +211,11 @@ if(isset($_POST['btl_go'])) {
 }
 
 if($zv->error != '') {
-  echo '<font color="red"><b>'.$zv->error.'</b></font><br />';
+  echo '<b style="color: red">'.$zv->error.'</b><br />';
 }
 
-if($test_s != '') {
-  echo '<font color="red"><b>'.$test_s.'</b></font><br />';
+if($zv->test_s != '') {
+  echo '<b style="color: red">'.$zv->test_s.'</b><br />';
 }
 ?>
 <table style="padding:2px;" width="100%" border="0" cellspacing="0" cellpadding="2">
diff --git a/modules_data/_zv2.php b/modules_data/_zv2.php
index 5ba23999..5b36189b 100644
--- a/modules_data/_zv2.php
+++ b/modules_data/_zv2.php
@@ -20,7 +20,7 @@ if(isset($_GET['r']))
 $u->info['referals'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `register_code` WHERE `uid` = "'.$u->info['id'].'" AND `time_finish` > 0 AND `end` = 0 LIMIT 1000'));			 
 $u->info['referals'] = $u->info['referals'][0];
 
-include('_incl_data/class/__zv.php');
+$zv = new FightRequest();
 
 ?>
 <script> var zv_Priem = 0; </script>
diff --git a/modules_data/btl_.php b/modules_data/btl_.php
index 1c2ffc1c..06ac74e6 100644
--- a/modules_data/btl_.php
+++ b/modules_data/btl_.php
@@ -1,783 +1,1183 @@
-<?
-if(!defined('GAME'))
-{
-	die();
+<?php
+if (!defined('GAME')) {
+    die();
 }
-?><?
 
 $old_battle = true;
 
-
-if( isset($_COOKIE['newbattle']) ) {
-	$old_battle = false;
-	include('btl_2.php');
-	die();
+if (isset($_COOKIE['newbattle'])) {
+    $old_battle = false;
+    include('btl_2.php');
+    die();
 }
 
 
-
 include('jx/battle/log_text.php');
 
-if( $old_battle == true ) {
-
-if(isset($btl_last['id']) && $u->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('<script>top.frames[\'main\'].location = "main.php";</script>');
+if ($u->info['battle'] == 0 || isset($_GET['bend'])) {
+    die('<script>top.frames[\'main\'].location = "main.php";</script>');
 }
 
-$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 && $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 '<script>var server_fight = "_vip";</script>';
-}else{*/
-	echo '<script>var server_fight = "";</script>';
-//}
+$allprice = typeBattle($allprice);
+if ($thisBattle['smert'] == 1) {
+    $allprice = [150, 150, '����������� ��������', '����������� ��������'];
+}
+
+echo '<script>var server_fight = "";</script>';
 ?>
 <script src="https://new-combats.com/js/jquery.js" type="text/javascript"></script>
 <link href="https://new-combats.com/btl_1.css" rel="stylesheet" type="text/css">
 <script>
 
-<!--
+    <!--
 
-//-->
-function maginfo(z,p,m,obj) {
-	var r = '';
-	r += '<b>'+$(obj).attr('magelogin')+'</b><br><br>';
-	r += '����: '+m+', ';
-	r += '������: '+z+', ';
-	r += '����������: '+p+'';
-	return r;	
-}
-<?
-if(isset($btl_last['id']) && ( $u->info['battle'] == 0 || $u->info['battle'] == $btl_last['battle']) ) {
-	echo 'var battleFinishData = "'.$u->info['battle_text'].'";';
-	//$u->info['battle_text'] = '';
-	
-	//$tites = mysql_fetch_assoc(mysql_query('SELECT `time_over` FROM `battle` WHERE `id` = "'.$btl_last['id'].'" LIMIT 1'));
-	// || ($tites['time_over'] !=0 && $tites['time_over'] < time()-10)
-	if( isset($_GET['finish'])) {
-		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'].'"');
-		header('location: main.php');
-		die();
-	}
-}else{
-	echo 'var battleFinishData = -1;';
-}
-?>
-var noErTmr;
-var smnpty = <?=(0+$u->info['smena'])?>;
-//var myTimer = setTimeout("document.getElementById('back_menu_down').click()", 250000);
-setInterval('top.c.noEr = 0;',1000);
-function mbsum(event)
-{
-	if( document.getElementById('back_menu_down').style.display != 'none' ){
-		setTimeout("document.getElementById('back_menu_down').click()", 1000);
-	}
-	if((event.keyCode==13 || event.keyCode==70) && top.c.noEr==0){ 
-		if( document.getElementById('mainpanel').style.display == 'none' ) {
-			// document.getElementById('reflesh_btn').setAttribute("class", "buttons btnnew btnnew2");
-			// document.getElementById('reflesh_btn').setAttribute("onclick", "");
-			// console.log("����� ������")
-			// document.getElementById('reflesh_btn').disabled = true
-			reflesht();
-			// top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
-				
-		}else{
-			
-		    if(document.getElementById('go_btn').disabled)
-			{
-				
-			}
-			else
-			{
-				atackt();
-				top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
-				document.getElementById('go_btn').setAttribute("class", "buttons inpBtl btnnew");
-			}
-			
-			
-			//atackt();
-			//top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
-			//document.getElementById('go_btn').setAttribute("class", "buttons inpBtl btnnew");
+    //-->
+    function maginfo(z, p, m, obj) {
+        var r = '';
+        r += '<b>' + $(obj).attr('magelogin') + '</b><br><br>';
+        r += '����: ' + m + ', ';
+        r += '������: ' + z + ', ';
+        r += '����������: ' + p + '';
+        return r;
+    }
+    <?php
+    if (isset($btl_last['id']) && ($u->info['battle'] == 0 || $u->info['battle'] == $btl_last['battle'])) {
+        echo 'var battleFinishData = "' . $u->info['battle_text'] . '";';
+        if (isset($_GET['finish'])) {
+            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'] . '"');
+            header('location: main.php');
+            die();
+        }
+    } else {
+        echo 'var battleFinishData = -1;';
+    }
+    ?>
+    var noErTmr;
+    var smnpty = <?=(0 + $u->info['smena'])?>;
+    setInterval('top.c.noEr = 0;', 1000);
 
-			
-		
-		}
-		
-	}
-	//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); 
-	}
-	
-	}
-	//numes
-	
-	/*
-	//Enter
-	if(event.keyCode==13 && top.c.noEr==0){ 
-		
-		if( document.getElementById('mainpanel').style.display == 'none' ) {
-			
-			if (document.getElementById('btn_down_img1').style.onclick != "")
-			{	
-				document.getElementById('btn_down_img1').setAttribute("onclick", "");
-				
-				reflesh();
-				top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
-				
-			}
-				
-		}else{
-		  if( document.getElementById('go_btn').style.display == '')
-			{
-			atack();
-			top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
-			}
-			
-		}
-		
-		 //top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
-	}
-	//space
-	if(event.keyCode==32 && top.c.noEr==0)
-	{
-	    //document.getElementById('btn_down_img1').setAttribute("onclick", "reflesh();");
-		if (document.getElementById('btn_down_img1').style.onclick != "")
-		{	
-			//document.getElementById('btn_down_img1').setAttribute("onclick", "");
-			
-			reflesh(); top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000); 
-			//event=[];
-		}
-	}*/
-	//numes
-	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);
-	}
-	
+    function mbsum(event) {
+        if (document.getElementById('back_menu_down').style.display != 'none') {
+            setTimeout("document.getElementById('back_menu_down').click()", 1000);
+        }
+        if ((event.keyCode == 13 || event.keyCode == 70) && top.c.noEr == 0) {
+            if (document.getElementById('mainpanel').style.display == 'none') {
+                reflesht();
+            } else {
+                if (document.getElementById('go_btn').disabled) {
+                } else {
+                    atackt();
+                    top.c.noEr = 1;
+                    clearTimeout(top.c.noErTmr);
+                    top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000);
+                    document.getElementById('go_btn').setAttribute("class", "buttons inpBtl btnnew");
+                }
+            }
+        }
+        //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);
+            }
+        }
 
-	/*sleep(1000).then(() => {
+        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) {
-			// 1.1
-			if($(test[i]).attr('pog') > 1 && $(test[i]).attr('stl') == 0) {
-				$(test[i]).attr('stl',1);
-				$(test[i]).html(`<span class="sp1">${$(test[i]).attr('pog')}</span><span class="sp4">${$(test[i]).attr('pog')}</span><span class="sp3">${$(test[i]).attr('pog')}</span><span class="sp2">${$(test[i]).attr('pog')}</span><div>${$(test[i]).attr('pog')}</div>${$(test[i]).html()}`);
-				
-			}else if($(test[i]).attr('col') > 1 && $(test[i]).attr('stl') == 0) {	
-				// 1.2
-				$(test[i]).attr('stl',1);
-				$(test[i]).html(`<span class="sp1">x${$(test[i]).attr('col')}</span><span class="sp4">x${$(test[i]).attr('col')}</span><span class="sp3">x${$(test[i]).attr('col')}</span><span class="sp2">x${$(test[i]).attr('col')}</span><div>x${$(test[i]).attr('col')}</div>${$(test[i]).html()}`);
-			}
-		} else i = -2;
-		i++;
-	}
-}
+    }
+
+    $(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) {
+                // 1.1
+                if ($(test[i]).attr('pog') > 1 && $(test[i]).attr('stl') == 0) {
+                    $(test[i]).attr('stl', 1);
+                    $(test[i]).html(`<span class="sp1">${$(test[i]).attr('pog')}</span><span class="sp4">${$(test[i]).attr('pog')}</span><span class="sp3">${$(test[i]).attr('pog')}</span><span class="sp2">${$(test[i]).attr('pog')}</span><div>${$(test[i]).attr('pog')}</div>${$(test[i]).html()}`);
+
+                } else if ($(test[i]).attr('col') > 1 && $(test[i]).attr('stl') == 0) {
+                    // 1.2
+                    $(test[i]).attr('stl', 1);
+                    $(test[i]).html(`<span class="sp1">x${$(test[i]).attr('col')}</span><span class="sp4">x${$(test[i]).attr('col')}</span><span class="sp3">x${$(test[i]).attr('col')}</span><span class="sp2">x${$(test[i]).attr('col')}</span><div>x${$(test[i]).attr('col')}</div>${$(test[i]).html()}`);
+                }
+            } else i = -2;
+            i++;
+        }
+    }
 </script>
 <div style="background-color:#e8e8e8">
-<script type="text/javascript" src="js/btl_info.js"></script>
-<script>
-$.ajaxSetup({cache: false});
-$(window).error(function(){
-  return true;
-});
-</script>
-<script src="https://img.new-combats.com/js/jx/jquery.form.js" type="text/javascript"></script>
-<script type="text/javascript" src="js/jquery.cookie.js"></script>
-<script type="text/javascript">
-var login = '<? echo $u->info['login']; ?>';
-var za = <? echo 0+$u->stats['zona']; ?>;
-var zb = <? echo 0+$u->stats['zonb']; ?>;
-var level = <? echo $u->info['level']; ?>;
+    <script type="text/javascript" src="js/btl_info.js"></script>
+    <script>
+        $.ajaxSetup({cache: false});
+        $(window).error(function () {
+            return true;
+        });
+    </script>
+    <script src="https://img.new-combats.com/js/jx/jquery.form.js" type="text/javascript"></script>
+    <script type="text/javascript" src="js/jquery.cookie.js"></script>
+    <script type="text/javascript">
+        var login = '<?php echo $u->info['login']; ?>';
+        var za = <?php echo 0 + $u->stats['zona']; ?>;
+        var zb = <?php echo 0 + $u->stats['zonb']; ?>;
+        var level = <?php echo $u->info['level']; ?>;
 
-function replaceAll(find, replace, str) {
-  return str.replace(new RegExp(find, 'g'), replace);
-}
-
-function explode( delimiter, string ) {
-
-	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() );
-}
-
-<?
-function convert($from, $to, $var)
-{
-    if (is_array($var))
-    {
-        $new = array();
-        foreach ($var as $key => $val)
-        {
-            $new[convert($from, $to, $key)] = convert($from, $to, $val);
+        function replaceAll(find, replace, str) {
+            return str.replace(new RegExp(find, 'g'), replace);
         }
-        $var = $new;
-    }
-    else if (is_string($var))
-    {
-        $var = iconv($from, $to, $var);
-    }
-    return $var;
-}
-function normJsonStr($str){
-    $str = preg_replace_callback('/\\\u([a-f0-9]{4})/i', create_function('$m', 'return chr(hexdec($m[1])-1072+224);'), $str);
-    //$str = iconv('cp1251', 'utf-8', $str);
-	return $str;
-}
-?>
 
-var log_text = <? echo normJsonStr(json_encode(convert('cp1251','utf-8',$log_text))); ?>;
-var youlogin = "<?=$u->info['login']?>";
+        function explode(delimiter, string) {
 
-function looklogrep(text,vars) {
-	
-	var vars = explode('||',vars);
-	var forYou = '';
-	var data = { };
-	var i = 0;
-	var j = {};
-	while(i != -1 ) {
-		if( vars[i] != undefined ) {
-			j = explode('=',vars[i]);
-			data[j[0]] = j[1];
-		}else{
-			i = -2;
-		}
-		i++;
-	}
-	
-	// 1.3
-    text = replaceAll('{tm1}',`<span class="date ${forYou}">${data['time1']}</span>`,text);
-	text = replaceAll('{u1}',`<span onClick="top.chat.addto(\'${data['login1']}\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'${data['login1']}\',event,\'chat\'); return false;" class="CSSteam${data['t1']}">${data['login1']}</span>`,text);
-	text = replaceAll('{u2}',`<span onClick="top.chat.addto(\'${data['login2']}\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'${data['login2']}\',event,\'chat\'); return false;" class="CSSteam${data['t2']}">${data['login2']}</span>`,text);
-	text = replaceAll('^^^^','=',text);
-	text = replaceAll('{pr}',`<b>${data['prm']}</b>`,text);
+            var emptyArray = {0: ''};
 
-	
-	var test_zb1 = [ 0 , 0 , 0 , 0 , 0 , 0];
-	var test_zb2 = [ 0 , 0 , 0 , 0 , 0 , 0];
-	i = 1;
-	j = data['bl2'];
-	while( i <= data['zb2'] ) {
-		test_zb1[ j ] = 1;
-		j++;
-		if( j > 5 ) {
-			j = 1;
-		}
-		i++;
-	}
-	
-	i = 1;
-	while( i <= 5 ) {
-		j = 1;
-		rej = '';
-		while( j <= 5 ) {
-			zab = '';
-			if( i == j ) {
-				zab += '1'; //a
-			}else{
-				zab += '0'; //a
-			}
-			if( test_zb1[ j ] == 1) {
-				zab += '1'; //b
-			}else{
-				zab += '0'; //b
-			}
-			rej += `<img src="https://img.new-combats.com/i/zones/${data['t2']}/${data['t1']}${zab}.gif">`;
-			j++;
-		}
-		text = replaceAll(`{zn2_${i++}}`,rej,text);
-		// i++;
-	}
-	
-	i = 1;
-	while( i <= 21 ) {
-		//������ R - ����� 1
-		if( log_text[data['s1']] != undefined ) {
-			if( log_text[data['s1']][i] != undefined ) {
-				r = log_text[data['s1']][i];
-				k = 0;
-				while( k != -1 ) {
-					if( r[k] != undefined ) {
-						text = replaceAll(`{1x${i}x${k}}`,'' + r[k] + '',text);
-					}else{
-						k = -2;
-					}
-					k++;
-				}
-			}
-		}
-		//������ R - ����� 2
-		if( log_text[data['s2']] != undefined ) {
-			if( log_text[data['s2']][i] != undefined ) {
-				r = log_text[data['s2']][i];
-				k = 0;
-				while( k != -1 ) {
-					if( r[k] != undefined ) {
-						text = replaceAll(`{2x${i}x${k}}`,'' + r[k] + '',text);
-					}else{
-						k = -2;
-					}
-					k++;
-				}
-			}
-		}
-		i++;
-	}
-	
-	//text = replaceAll('^^^^','=',text);
-	
-	/*text = replaceAll('{tm1}','<span class="date '+forYou+'">00:01</span>',text);
-	text = replaceAll('{tm2}','<span class="date '+forYou+'">00:02</span>',text);
-	text = replaceAll('{tm3}','<span class="date '+forYou+'">01.01.2015 00:01</span>',text);
-	text = replaceAll('{tm4}','<span class="date '+forYou+'">02.02.2015 00:02</span>',text);*/
-	
-	//��������� ������
-	text = replaceAll('{u1}',`<span onClick="top.chat.addto(\'${data['login1']}\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'${data['login1']}\',event,\'chat\'); return false;" class="CSSteam${data['t1']}">${data['login1']}</span>`,text);
-	text = replaceAll('{u2}',`<span onClick="top.chat.addto(\'${data['login2']}\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'${data['login2']}\',event,\'chat\'); return false;" class="CSSteam${data['t2']}">${data['login2']}</span>`,text);
-	
-	if( data['prm'] != undefined ) {
-		data['prm'] = replaceAll("rvnO","=",data['prm']);
-	}
-	
-	//data['prm'] = replaceAll('^^^^','=', data['prm'] );
-	
-	text = replaceAll('{pr}',`<b>${data['prm']}</b>`,text);
-	
-	text = replaceAll('^^^^','=',text);
-	
-	text = replaceAll('==','',text);
-	
-	if( ( data['login1'] == youlogin || data['login2'] == youlogin ) && youlogin != '' ) {
-		text = replaceAll('{fru}',' date2 ',text);
-	}else{
-		text = replaceAll('{fru}','',text);
-	}
-	
-	/*text = replaceAll('{tm1}','<span class="date '+forYou+'">00:01</span>',text);
-	text = replaceAll('{tm2}','<span class="date '+forYou+'">00:02</span>',text);
-	text = replaceAll('{tm3}','<span class="date '+forYou+'">01.01.2015 00:01</span>',text);
-	text = replaceAll('{tm4}','<span class="date '+forYou+'">02.02.2015 00:02</span>',text);*/
-	
-	return text;
-}
+            if (arguments.length != 2
+                || typeof arguments[0] == 'undefined'
+                || typeof arguments[1] == 'undefined') {
+                return null;
+            }
 
-</script>
-<script type="text/javascript" src="js/btl_mini.js"></script>
-<div id="hint4" class="ahint"></div>
-<style>
-html, body {
-	background-color:#e8e8e8;
-}
-</style>
-<div align="center" onMouseDown="top.hic();" onMouseOut="top.hic();">
-<table width="100%" bgcolor="#e8e8e8" border="0" cellspacing="0" cellpadding="1">
-<tr>
-        <td valign="top" width="260"><div id="player1">
-        </div>
-        <div align="right"></div></td>
-        <td valign="top"><div align="center">          
-          <table width="100%" height="15" border="0" cellspacing="0" cellpadding="0">
+            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());
+        }
+
+        <?php
+        function convert($from, $to, $var)
+        {
+            if (is_array($var)) {
+                $new = [];
+                foreach ($var as $key => $val) {
+                    $new[convert($from, $to, $key)] = convert($from, $to, $val);
+                }
+                $var = $new;
+            } else {
+                if (is_string($var)) {
+                    $var = iconv($from, $to, $var);
+                }
+            }
+            return $var;
+        }
+        function normJsonStr($str)
+        {
+            return preg_replace_callback(
+                '/\\\u([a-f0-9]{4})/i',
+                function ($m) {return chr(hexdec($m[1]) - 1072 + 224);},
+                $str
+            );
+            //deprecaded
+//            return preg_replace_callback(
+//                '/\\\u([a-f0-9]{4})/i',
+//                create_function('$m', 'return chr(hexdec($m[1])-1072+224);'),
+//                $str
+//            );
+        }
+        ?>
+
+        var log_text = <?php echo normJsonStr(json_encode(convert('cp1251', 'utf-8', $log_text))); ?>;
+        var youlogin = "<?=$u->info['login']?>";
+
+        function looklogrep(text, vars) {
+
+            var vars = explode('||', vars);
+            var forYou = '';
+            var data = {};
+            var i = 0;
+            var j = {};
+            while (i != -1) {
+                if (vars[i] != undefined) {
+                    j = explode('=', vars[i]);
+                    data[j[0]] = j[1];
+                } else {
+                    i = -2;
+                }
+                i++;
+            }
+
+            // 1.3
+            text = replaceAll('{tm1}', `<span class="date ${forYou}">${data['time1']}</span>`, text);
+            text = replaceAll('{u1}', `<span onClick="top.chat.addto(\'${data['login1']}\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'${data['login1']}\',event,\'chat\'); return false;" class="CSSteam${data['t1']}">${data['login1']}</span>`, text);
+            text = replaceAll('{u2}', `<span onClick="top.chat.addto(\'${data['login2']}\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'${data['login2']}\',event,\'chat\'); return false;" class="CSSteam${data['t2']}">${data['login2']}</span>`, text);
+            text = replaceAll('^^^^', '=', text);
+            text = replaceAll('{pr}', `<b>${data['prm']}</b>`, text);
+
+
+            var test_zb1 = [0, 0, 0, 0, 0, 0];
+            var test_zb2 = [0, 0, 0, 0, 0, 0];
+            i = 1;
+            j = data['bl2'];
+            while (i <= data['zb2']) {
+                test_zb1[j] = 1;
+                j++;
+                if (j > 5) {
+                    j = 1;
+                }
+                i++;
+            }
+
+            i = 1;
+            while (i <= 5) {
+                j = 1;
+                rej = '';
+                while (j <= 5) {
+                    zab = '';
+                    if (i == j) {
+                        zab += '1'; //a
+                    } else {
+                        zab += '0'; //a
+                    }
+                    if (test_zb1[j] == 1) {
+                        zab += '1'; //b
+                    } else {
+                        zab += '0'; //b
+                    }
+                    rej += `<img src="https://img.new-combats.com/i/zones/${data['t2']}/${data['t1']}${zab}.gif">`;
+                    j++;
+                }
+                text = replaceAll(`{zn2_${i++}}`, rej, text);
+                // i++;
+            }
+
+            i = 1;
+            while (i <= 21) {
+                //������ R - ����� 1
+                if (log_text[data['s1']] != undefined) {
+                    if (log_text[data['s1']][i] != undefined) {
+                        r = log_text[data['s1']][i];
+                        k = 0;
+                        while (k != -1) {
+                            if (r[k] != undefined) {
+                                text = replaceAll(`{1x${i}x${k}}`, '' + r[k] + '', text);
+                            } else {
+                                k = -2;
+                            }
+                            k++;
+                        }
+                    }
+                }
+                //������ R - ����� 2
+                if (log_text[data['s2']] != undefined) {
+                    if (log_text[data['s2']][i] != undefined) {
+                        r = log_text[data['s2']][i];
+                        k = 0;
+                        while (k != -1) {
+                            if (r[k] != undefined) {
+                                text = replaceAll(`{2x${i}x${k}}`, '' + r[k] + '', text);
+                            } else {
+                                k = -2;
+                            }
+                            k++;
+                        }
+                    }
+                }
+                i++;
+            }
+
+            //��������� ������
+            text = replaceAll('{u1}', `<span onClick="top.chat.addto(\'${data['login1']}\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'${data['login1']}\',event,\'chat\'); return false;" class="CSSteam${data['t1']}">${data['login1']}</span>`, text);
+            text = replaceAll('{u2}', `<span onClick="top.chat.addto(\'${data['login2']}\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'${data['login2']}\',event,\'chat\'); return false;" class="CSSteam${data['t2']}">${data['login2']}</span>`, text);
+
+            if (data['prm'] != undefined) {
+                data['prm'] = replaceAll("rvnO", "=", data['prm']);
+            }
+
+            text = replaceAll('{pr}', `<b>${data['prm']}</b>`, text);
+            text = replaceAll('^^^^', '=', text);
+            text = replaceAll('==', '', text);
+
+            if ((data['login1'] == youlogin || data['login2'] == youlogin) && youlogin != '') {
+                text = replaceAll('{fru}', ' date2 ', text);
+            } else {
+                text = replaceAll('{fru}', '', text);
+            }
+
+            return text;
+        }
+
+    </script>
+    <script type="text/javascript" src="js/btl_mini.js"></script>
+    <div id="hint4" class="ahint"></div>
+    <style>
+        html, body {
+            background-color: #e8e8e8;
+        }
+    </style>
+    <div align="center" onMouseDown="top.hic();" onMouseOut="top.hic();">
+        <table width="100%" bgcolor="#e8e8e8" border="0" cellspacing="0" cellpadding="1">
             <tr>
-              <td width="50%" valign="top"><div id="player1_login" style="float:left;"></div></td>
-              <td align="center"><h5><?
-              if( $thisBattle['type'] == 99 ) {
-				  echo str_replace(' ','&nbsp;',$allprice[3]);
-			  }else{
-				  echo str_replace(' ','&nbsp;',$allprice[2]);
-			  }
-			  ?></h5></td>
-              <td width="50%" valign="top"><div id="player2_login" style="float:right;"></div></td>
-            </tr>
-          </table>
-          <table border="0" align="center" style="margin-top:-15px;" cellpadding="0" cellspacing="3">
-            <tr>
-              <td height="20">
-              <div id="ref2" name="ref2"></div><div id="ref" name="ref"></div></td>
-            </tr>		
-		<tr>
-			<div id="error" style="display:none;"></div>	
-              <td><div id="pers_magic" align="center">
-                <table border="0" cellspacing="0" cellpadding="0">
-                  <tr>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    </tr>
-                </table>
-              </div></td>
-            </tr>
-            <tr>
-              <td><table border="0" align="center" cellpadding="0" cellspacing="1">
-                  <tr>
-                    <td align="center">
-                    <div id="ndfksdw">
-                     <table width="100%" id="mainpanel222" border="0" cellspacing="0" cellpadding="0">
-                        <tr>
-                          <td bgcolor="#A7A7A7"><div align="center"><strong>�����</strong></div></td>
-                          <td width="20" bgcolor="#A7A7A7"><div align="center" style="color:#A7A7A7;">-</div></td>
-                          <td bgcolor="#A7A7A7"><div align="center"><strong>������</strong></div></td>
-                        </tr>
-                      </table>
-                    
-                    <table width="100%" border="0" align="center" cellpadding="1" cellspacing="2" id="mainpanel">
-                          <tr>
-                            <td><div id="zatack1_1" class="crop"><a onclick="change_radio(1,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack2_1" class="crop"><a onclick="change_radio(2,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack3_1" class="crop"><a onclick="change_radio(3,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack4_1" class="crop"><a onclick="change_radio(4,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack5_1" class="crop"><a onclick="change_radio(5,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="select_atack(1,1);" style="cursor:default;" align="left">���� � ������</td>
-                            <td width="3" style="cursor:default;" onclick="select_atack(1,1);">&nbsp;</td>
-                            <td><div id="zblock1_1" class="crop"><a onclick="change_radio(1,1,'block',0);return false;" href="#"><img style="display:block;" id="block_1_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="change_radio(1,1,'block');" style="cursor:default;" align="left"><div id="txtb1_1">&nbsp;���� ������</div>
-                                <div id="txtb1_2">&nbsp;���� ������ � �����</div>
-                              <div id="txtb1_3">&nbsp;���� ������, ����� � ������</div></td>
-                          </tr>
-                          <tr>
-                            <td><div id="zatack1_2" class="crop"><a onclick="change_radio(1,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack2_2" class="crop"><a onclick="change_radio(2,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack3_2" class="crop"><a onclick="change_radio(3,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack4_2" class="crop"><a onclick="change_radio(4,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack5_2" class="crop"><a onclick="change_radio(5,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="select_atack(2,1);" style="cursor:default;" align="left">���� � �����</td>
-                            <td onclick="select_atack(2,1);" style="cursor:default;">&nbsp;</td>
-                            <td><div id="zblock1_2" class="crop"><a onclick="change_radio(1,2,'block',0);return false;" href="#"><img style="display:block;" id="block_1_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="change_radio(1,2,'block');" style="cursor:default;" align="left"><div id="txtb2_1">&nbsp;���� �����</div>
-                                <div id="txtb2_2">&nbsp;���� ����� � ������</div>
-                              <div id="txtb2_3">&nbsp;���� �����, ������ � �����</div></td>
-                          </tr>
-                          <tr>
-                            <td><div id="zatack1_3" class="crop"><a onclick="change_radio(1,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack2_3" class="crop"><a onclick="change_radio(2,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack3_3" class="crop"><a onclick="change_radio(3,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack4_3" class="crop"><a onclick="change_radio(4,3,'atack',0);return false;" href="#"><img id="atack_4_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack5_3" class="crop"><a onclick="change_radio(5,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="select_atack(3,1);" style="cursor:default;" align="left">���� � �����</td>
-                            <td onclick="select_atack(3,1);" style="cursor:default;">&nbsp;</td>
-                            <td><div id="zblock1_3" class="crop"><a onclick="change_radio(1,3,'block',0);return false;" href="#"><img style="display:block;" id="block_1_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="change_radio(1,3,'block');" style="cursor:default;" align="left"><div id="txtb3_1">&nbsp;���� ������</div>
-                                <div id="txtb3_2">&nbsp;���� ������ � �����</div>
-                              <div id="txtb3_3">&nbsp;���� ������, ����� � ���</div></td>
-                          </tr>
-                          <tr>
-                            <td><div id="zatack1_4" class="crop"><a onclick="change_radio(1,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack2_4" class="crop"><a onclick="change_radio(2,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack3_4" class="crop"><a onclick="change_radio(3,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack4_4" class="crop"><a onclick="change_radio(4,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack5_4" class="crop"><a onclick="change_radio(5,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="select_atack(4,1);" style="cursor:default;" align="left">���� � ����(���)</td>
-                            <td onclick="select_atack(4,1);" style="cursor:default;">&nbsp;</td>
-                            <td><div id="zblock1_4" class="crop"><a onclick="change_radio(1,4,'block',0);return false;" href="#"><img style="display:block;" id="block_1_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="change_radio(1,4,'block');" style="cursor:default;" align="left"><div id="txtb4_1">&nbsp;���� �����</div>
-                                <div id="txtb4_2">&nbsp;���� ����� � ���</div>
-                              <div id="txtb4_3">&nbsp;���� �����, ��� � ������</div></td>
-                          </tr>
-                          <tr>
-                            <td><div id="zatack1_5" class="crop"><a onclick="change_radio(1,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack2_5" class="crop"><a onclick="change_radio(2,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack3_5" class="crop"><a onclick="change_radio(3,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack4_5" class="crop"><a onclick="change_radio(4,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack5_5" class="crop"><a onclick="change_radio(5,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="select_atack(5,1);" style="cursor:default;" align="left">���� �� �����</td>
-                            <td onclick="select_atack(5,1);" style="cursor:default;">&nbsp;</td>
-                            <td><div id="zblock1_5" class="crop"><a onclick="change_radio(1,5,'block',0);return false;" href="#"><img style="display:block;" id="block_1_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="change_radio(1,5,'block');" style="cursor:default;" align="left"><div id="txtb5_1">&nbsp;���� ���</div>
-                                <div id="txtb5_2">&nbsp;���� ��� � ������</div>
-                              <div id="txtb5_3">&nbsp;���� ���, ������ � �����</div></td>
-                          </tr>
-                      </table>
+                <td valign="top" width="260">
+                    <div id="player1">
                     </div>
-				    <div id="ref_menu_down" align="center">
-                      <table width="100%" border="0" style="background-color:#f2f0f0;" align="center" cellpadding="0" cellspacing="0">
-                        <tr>
-                          <td width="5">&nbsp;</td>
-                          <td width="20" title="��������� ����" onclick="top.cb_radio_click($('#cr_rach_rc3'),3);"><script>top.slcbrc[3] = 1; if( top.slcbrc[3] == 0 ) { document.write(top.create_check('rc3','','off')); }else{ document.write(top.create_check('rc3','','on')); }</script></td>
-                          <td width="20" title="�� ���������� ����� ��� �����\�����" onclick="top.cb_radio_click($('#cr_rach_rc4'),4);"><script>if( top.slcbrc[4] == 0 ) { document.write(top.create_check('rc4','','off')); }else{ document.write(top.create_check('rc4','','on')); }</script></td>
-                          <td width="20">&nbsp;</td>
-                          <td align="center">
-                              <input name="fast_battle" id="fast_battle" type="hidden"/>
-                              <input name="auto_battle" id="auto_battle" type="hidden" />
-                          	  <button name="go_btn" type="button" id="go_btn" style="cursor:pointer;" class="buttons inpBtl btnnew" onclick="" disabled="disabled" >�����!!!</button>							  
-							  <button name="reflesh_btn" onClick="" type="button" id="reflesh_btn" style="cursor:pointer;display:none;" class="buttons inpBtl btnnew" title="��������" disabled="disabled">��������</button>                               
-                              <button name="back_menu_down" onClick="top.frames['main'].location='main.php?finish=<? echo microtime(); ?>';" type="button" id="back_menu_down" style="cursor:pointer;display:none;" class="buttons inpBtl btnnew" title="���������" >���������</button>
-                              <input name="save_zones" id="save_zones" type="hidden" />
-                          </td>
-                          <td width="20"><img <? if( $u->info['lider'] != $u->info['battle'] ) { ?>style="display:none;cursor:pointer;"<? }else{ ?>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" /></td>
-                          <!--<td width="20"><img <? if( $u->info['lider'] != $u->info['battle'] ) { ?>style="display:none;cursor:pointer;"<? }else{ ?>style="cursor:pointer;"<? } ?> onclick="top.leaderFight2();" id="btn_down_img4" style="cursor:pointer;" title="�����" src="https://img.new-combats.com/i/ico_kill_member1.gif" width="16" height="19" /></td>-->
-                          <td width="40"><div align="right"><img onclick="top.smena1();" id="btn_down_img2" style="cursor:pointer;" title="����� ���������� (3)" src="https://img.new-combats.com/i/ico_change.gif" width="16" height="19" />&nbsp;<img src="https://img.new-combats.com/i/ico_refresh.gif" name="btn_down_img1" width="16" height="19" id="btn_down_img1" style="cursor:pointer;" title="��������" onclick="reflesht();" /></div></td>
-                        </tr>
-                        <tr>
-                          <td height="1"></td>
-                          <td height="1"></td>
-                          <td height="1"></td>
-                          <td height="1"></td>
-                          <td height="1"><img style="display:block" src="https://<?=$c['img'];?>/1x1.gif" width="200" height="1" /></td>
-                          <td height="1"></td>
-                          <td height="1"></td>
-                          <td height="1"></td>
-                        </tr>
-                      </table>
+                    <div align="right"></div>
+                </td>
+                <td valign="top">
+                    <div align="center">
+                        <table width="100%" height="15" border="0" cellspacing="0" cellpadding="0">
+                            <tr>
+                                <td width="50%" valign="top">
+                                    <div id="player1_login" style="float:left;"></div>
+                                </td>
+                                <td align="center"><h5><?php
+                                        if ($thisBattle['type'] == 99) {
+                                            echo str_replace(' ', '&nbsp;', $allprice[3]);
+                                        } else {
+                                            echo str_replace(' ', '&nbsp;', $allprice[2]);
+                                        }
+                                        ?></h5></td>
+                                <td width="50%" valign="top">
+                                    <div id="player2_login" style="float:right;"></div>
+                                </td>
+                            </tr>
+                        </table>
+                        <table border="0" align="center" style="margin-top:-15px;" cellpadding="0" cellspacing="3">
+                            <tr>
+                                <td height="20">
+                                    <div id="ref2" name="ref2"></div>
+                                    <div id="ref" name="ref"></div>
+                                </td>
+                            </tr>
+                            <tr>
+                                <div id="error" style="display:none;"></div>
+                                <td>
+                                    <div id="pers_magic" align="center">
+                                        <table border="0" cellspacing="0" cellpadding="0">
+                                            <tr>
+                                                <td><img title="������ ���� ��������"
+                                                         src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                                <td><img title="������ ���� ��������"
+                                                         src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                                <td><img title="������ ���� ��������"
+                                                         src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                                <td><img title="������ ���� ��������"
+                                                         src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                                <td><img title="������ ���� ��������"
+                                                         src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                                <td><img title="������ ���� ��������"
+                                                         src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                                <td><img title="������ ���� ��������"
+                                                         src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                                <td><img title="������ ���� ��������"
+                                                         src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                                <td><img title="������ ���� ��������"
+                                                         src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                                <td><img title="������ ���� ��������"
+                                                         src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                            </tr>
+                                        </table>
+                                    </div>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td>
+                                    <table border="0" align="center" cellpadding="0" cellspacing="1">
+                                        <tr>
+                                            <td align="center">
+                                                <div id="ndfksdw">
+                                                    <table width="100%" id="mainpanel222" border="0" cellspacing="0"
+                                                           cellpadding="0">
+                                                        <tr>
+                                                            <td bgcolor="#A7A7A7">
+                                                                <div align="center"><strong>�����</strong></div>
+                                                            </td>
+                                                            <td width="20" bgcolor="#A7A7A7">
+                                                                <div align="center" style="color:#A7A7A7;">-</div>
+                                                            </td>
+                                                            <td bgcolor="#A7A7A7">
+                                                                <div align="center"><strong>������</strong></div>
+                                                            </td>
+                                                        </tr>
+                                                    </table>
+
+                                                    <table width="100%" border="0" align="center" cellpadding="1"
+                                                           cellspacing="2" id="mainpanel">
+                                                        <tr>
+                                                            <td>
+                                                                <div id="zatack1_1" class="crop"><a
+                                                                            onclick="change_radio(1,1,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_1_1"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack2_1" class="crop"><a
+                                                                            onclick="change_radio(2,1,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_2_1"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack3_1" class="crop"><a
+                                                                            onclick="change_radio(3,1,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_3_1"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack4_1" class="crop"><a
+                                                                            onclick="change_radio(4,1,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_4_1"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack5_1" class="crop"><a
+                                                                            onclick="change_radio(5,1,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_5_1"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td onclick="select_atack(1,1);" style="cursor:default;"
+                                                                align="left">���� � ������
+                                                            </td>
+                                                            <td width="3" style="cursor:default;"
+                                                                onclick="select_atack(1,1);">&nbsp;
+                                                            </td>
+                                                            <td>
+                                                                <div id="zblock1_1" class="crop"><a
+                                                                            onclick="change_radio(1,1,'block',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="block_1_1"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td onclick="change_radio(1,1,'block');"
+                                                                style="cursor:default;" align="left">
+                                                                <div id="txtb1_1">&nbsp;���� ������</div>
+                                                                <div id="txtb1_2">&nbsp;���� ������ � �����</div>
+                                                                <div id="txtb1_3">&nbsp;���� ������, ����� � ������
+                                                                </div>
+                                                            </td>
+                                                        </tr>
+                                                        <tr>
+                                                            <td>
+                                                                <div id="zatack1_2" class="crop"><a
+                                                                            onclick="change_radio(1,2,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_1_2"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack2_2" class="crop"><a
+                                                                            onclick="change_radio(2,2,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_2_2"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack3_2" class="crop"><a
+                                                                            onclick="change_radio(3,2,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_3_2"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack4_2" class="crop"><a
+                                                                            onclick="change_radio(4,2,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_4_2"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack5_2" class="crop"><a
+                                                                            onclick="change_radio(5,2,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_5_2"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td onclick="select_atack(2,1);" style="cursor:default;"
+                                                                align="left">���� � �����
+                                                            </td>
+                                                            <td onclick="select_atack(2,1);" style="cursor:default;">
+                                                                &nbsp;
+                                                            </td>
+                                                            <td>
+                                                                <div id="zblock1_2" class="crop"><a
+                                                                            onclick="change_radio(1,2,'block',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="block_1_2"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td onclick="change_radio(1,2,'block');"
+                                                                style="cursor:default;" align="left">
+                                                                <div id="txtb2_1">&nbsp;���� �����</div>
+                                                                <div id="txtb2_2">&nbsp;���� ����� � ������</div>
+                                                                <div id="txtb2_3">&nbsp;���� �����, ������ � �����</div>
+                                                            </td>
+                                                        </tr>
+                                                        <tr>
+                                                            <td>
+                                                                <div id="zatack1_3" class="crop"><a
+                                                                            onclick="change_radio(1,3,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_1_3"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack2_3" class="crop"><a
+                                                                            onclick="change_radio(2,3,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_2_3"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack3_3" class="crop"><a
+                                                                            onclick="change_radio(3,3,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_3_3"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack4_3" class="crop"><a
+                                                                            onclick="change_radio(4,3,'atack',0);return false;"
+                                                                            href="#"><img id="atack_4_3"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack5_3" class="crop"><a
+                                                                            onclick="change_radio(5,3,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_5_3"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td onclick="select_atack(3,1);" style="cursor:default;"
+                                                                align="left">���� � �����
+                                                            </td>
+                                                            <td onclick="select_atack(3,1);" style="cursor:default;">
+                                                                &nbsp;
+                                                            </td>
+                                                            <td>
+                                                                <div id="zblock1_3" class="crop"><a
+                                                                            onclick="change_radio(1,3,'block',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="block_1_3"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td onclick="change_radio(1,3,'block');"
+                                                                style="cursor:default;" align="left">
+                                                                <div id="txtb3_1">&nbsp;���� ������</div>
+                                                                <div id="txtb3_2">&nbsp;���� ������ � �����</div>
+                                                                <div id="txtb3_3">&nbsp;���� ������, ����� � ���</div>
+                                                            </td>
+                                                        </tr>
+                                                        <tr>
+                                                            <td>
+                                                                <div id="zatack1_4" class="crop"><a
+                                                                            onclick="change_radio(1,4,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_1_4"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack2_4" class="crop"><a
+                                                                            onclick="change_radio(2,4,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_2_4"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack3_4" class="crop"><a
+                                                                            onclick="change_radio(3,4,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_3_4"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack4_4" class="crop"><a
+                                                                            onclick="change_radio(4,4,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_4_4"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack5_4" class="crop"><a
+                                                                            onclick="change_radio(5,4,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_5_4"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td onclick="select_atack(4,1);" style="cursor:default;"
+                                                                align="left">���� � ����(���)
+                                                            </td>
+                                                            <td onclick="select_atack(4,1);" style="cursor:default;">
+                                                                &nbsp;
+                                                            </td>
+                                                            <td>
+                                                                <div id="zblock1_4" class="crop"><a
+                                                                            onclick="change_radio(1,4,'block',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="block_1_4"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td onclick="change_radio(1,4,'block');"
+                                                                style="cursor:default;" align="left">
+                                                                <div id="txtb4_1">&nbsp;���� �����</div>
+                                                                <div id="txtb4_2">&nbsp;���� ����� � ���</div>
+                                                                <div id="txtb4_3">&nbsp;���� �����, ��� � ������</div>
+                                                            </td>
+                                                        </tr>
+                                                        <tr>
+                                                            <td>
+                                                                <div id="zatack1_5" class="crop"><a
+                                                                            onclick="change_radio(1,5,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_1_5"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack2_5" class="crop"><a
+                                                                            onclick="change_radio(2,5,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_2_5"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack3_5" class="crop"><a
+                                                                            onclick="change_radio(3,5,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_3_5"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack4_5" class="crop"><a
+                                                                            onclick="change_radio(4,5,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_4_5"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td>
+                                                                <div id="zatack5_5" class="crop"><a
+                                                                            onclick="change_radio(5,5,'atack',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="atack_5_5"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td onclick="select_atack(5,1);" style="cursor:default;"
+                                                                align="left">���� �� �����
+                                                            </td>
+                                                            <td onclick="select_atack(5,1);" style="cursor:default;">
+                                                                &nbsp;
+                                                            </td>
+                                                            <td>
+                                                                <div id="zblock1_5" class="crop"><a
+                                                                            onclick="change_radio(1,5,'block',0);return false;"
+                                                                            href="#"><img style="display:block;"
+                                                                                          id="block_1_5"
+                                                                                          class="radio_off"
+                                                                                          src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                          width="36" height="18"/></a>
+                                                                </div>
+                                                            </td>
+                                                            <td onclick="change_radio(1,5,'block');"
+                                                                style="cursor:default;" align="left">
+                                                                <div id="txtb5_1">&nbsp;���� ���</div>
+                                                                <div id="txtb5_2">&nbsp;���� ��� � ������</div>
+                                                                <div id="txtb5_3">&nbsp;���� ���, ������ � �����</div>
+                                                            </td>
+                                                        </tr>
+                                                    </table>
+                                                </div>
+                                                <div id="ref_menu_down" align="center">
+                                                    <table width="100%" border="0" style="background-color:#f2f0f0;"
+                                                           align="center" cellpadding="0" cellspacing="0">
+                                                        <tr>
+                                                            <td width="5">&nbsp;</td>
+                                                            <td width="20" title="��������� ����"
+                                                                onclick="top.cb_radio_click($('#cr_rach_rc3'),3);">
+                                                                <script>top.slcbrc[3] = 1;
+                                                                    if (top.slcbrc[3] == 0) {
+                                                                        document.write(top.create_check('rc3', '', 'off'));
+                                                                    } else {
+                                                                        document.write(top.create_check('rc3', '', 'on'));
+                                                                    }</script>
+                                                            </td>
+                                                            <td width="20" title="�� ���������� ����� ��� �����\�����"
+                                                                onclick="top.cb_radio_click($('#cr_rach_rc4'),4);">
+                                                                <script>if (top.slcbrc[4] == 0) {
+                                                                        document.write(top.create_check('rc4', '', 'off'));
+                                                                    } else {
+                                                                        document.write(top.create_check('rc4', '', 'on'));
+                                                                    }</script>
+                                                            </td>
+                                                            <td width="20">&nbsp;</td>
+                                                            <td align="center">
+                                                                <input name="fast_battle" id="fast_battle"
+                                                                       type="hidden"/>
+                                                                <input name="auto_battle" id="auto_battle"
+                                                                       type="hidden"/>
+                                                                <button name="go_btn" type="button" id="go_btn"
+                                                                        style="cursor:pointer;"
+                                                                        class="buttons inpBtl btnnew" onclick=""
+                                                                        disabled="disabled">�����!!!
+                                                                </button>
+                                                                <button name="reflesh_btn" onClick="" type="button"
+                                                                        id="reflesh_btn"
+                                                                        style="cursor:pointer;display:none;"
+                                                                        class="buttons inpBtl btnnew" title="��������"
+                                                                        disabled="disabled">��������
+                                                                </button>
+                                                                <button name="back_menu_down"
+                                                                        onClick="top.frames['main'].location='main.php?finish=<?php
+                                                                        echo microtime(); ?>';" type="button"
+                                                                        id="back_menu_down"
+                                                                        style="cursor:pointer;display:none;"
+                                                                        class="buttons inpBtl btnnew" title="���������">
+                                                                    ���������
+                                                                </button>
+                                                                <input name="save_zones" id="save_zones" type="hidden"/>
+                                                            </td>
+                                                            <td width="20"><img <?php
+                                                                                if ($u->info['lider'] != $u->info['battle']) { ?>style="display:none;cursor:pointer;"
+                                                                                <?php
+                                                                                }else{ ?>style="cursor:pointer;"<?php
+                                                                } ?> 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"/></td>
+                                                            <!--<td width="20"><img <?php
+                                                            if ($u->info['lider'] != $u->info['battle']) { ?>style="display:none;cursor:pointer;"<?php
+                                                            } else { ?>style="cursor:pointer;"<?php
+                                                            } ?> onclick="top.leaderFight2();" id="btn_down_img4" style="cursor:pointer;" title="�����" src="https://img.new-combats.com/i/ico_kill_member1.gif" width="16" height="19" /></td>-->
+                                                            <td width="40">
+                                                                <div align="right"><img onclick="top.smena1();"
+                                                                                        id="btn_down_img2"
+                                                                                        style="cursor:pointer;"
+                                                                                        title="����� ���������� (3)"
+                                                                                        src="https://img.new-combats.com/i/ico_change.gif"
+                                                                                        width="16"
+                                                                                        height="19"/>&nbsp;<img
+                                                                            src="https://img.new-combats.com/i/ico_refresh.gif"
+                                                                            name="btn_down_img1" width="16" height="19"
+                                                                            id="btn_down_img1" style="cursor:pointer;"
+                                                                            title="��������" onclick="reflesht();"/>
+                                                                </div>
+                                                            </td>
+                                                        </tr>
+                                                        <tr>
+                                                            <td height="1"></td>
+                                                            <td height="1"></td>
+                                                            <td height="1"></td>
+                                                            <td height="1"></td>
+                                                            <td height="1"><img style="display:block"
+                                                                                src="https://<?= $c['img']; ?>/1x1.gif"
+                                                                                width="200" height="1"/></td>
+                                                            <td height="1"></td>
+                                                            <td height="1"></td>
+                                                            <td height="1"></td>
+                                                        </tr>
+                                                    </table>
+                                                </div>
+                                                <?php
+                                                if ($u->info['level'] == 0) { ?>
+                                                    <hr/>
+                                                    <center><font color="#333333"><small>������ ������� <b>�����!!!</b>
+                                                                ����� ������� ��������� ����</small></font></center>
+                                                    <hr/>
+                                                    <?php
+                                                } ?>
+                                            </td>
+                                        </tr>
+                                    </table>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td id="mainpanel2" style="height:128px; display:none;" align="center"></td>
+                            </tr>
+                            <tr>
+                                <td>
+                                    <div style="padding-top:0px;padding-bottom:10px;" align="center">
+                                        <table <?php
+                                        if ($u->info['level'] < 2) {
+                                            echo ' style="display:none;" ';
+                                        } ?> border="0" cellspacing="0" cellpadding="0">
+                                            <tr>
+                                                <td>
+                                                    <span title="���������� ����"
+                                                          style="margin-right:11px; font-size:9px;">
+                                                        <img onclick="startHintPriemsBattle()" width="8" height="8"
+                                                             src="https://img.new-combats.com/i/micro/hit.gif"/>
+                                                        <font id="tac1">
+                                                            <?php echo 0 + $u->info['tactic1']; ?>
+                                                        </font>
+                                                    </span>
+                                                </td>
+                                                <td>
+                                                    <span title="����������� ����"
+                                                          style="margin-right:11px; font-size:9px;">
+                                                        <img width="8" height="8"
+                                                             src="https://img.new-combats.com/i/micro/krit.gif"/>
+                                                        <font id="tac2">
+                                                            <?php echo 0 + $u->info['tactic2']; ?>
+                                                        </font>
+                                                    </span>
+                                                </td>
+                                                <td>
+                                                    <span title="����������� ���������"
+                                                          style="margin-right:11px; font-size:9px;">
+                                                        <img width="8" height="8"
+                                                             src="https://img.new-combats.com/i/micro/counter.gif"/>
+                                                        <font id="tac3">
+                                                            <?php echo 0 + $u->info['tactic3']; ?>
+                                                        </font>
+                                                    </span>
+                                                </td>
+                                                <td>
+                                                    <span title="�������� ����"
+                                                          style="margin-right:11px; font-size:9px;">
+                                                        <img width="8" height="8"
+                                                             src="https://img.new-combats.com/i/micro/block.gif"/>
+                                                        <font id="tac4">
+                                                            <?php echo 0 + $u->info['tactic4']; ?>
+                                                        </font>
+                                                    </span>
+                                                </td>
+                                                <td>
+                                                    <span title="�������� �����������"
+                                                          style="margin-right:11px; font-size:9px;">
+                                                        <img width="8" height="8"
+                                                             src="https://img.new-combats.com/i/micro/parry.gif"/>
+                                                        <font id="tac5">
+                                                            <?php echo 0 + $u->info['tactic5']; ?>
+                                                        </font>
+                                                    </span>
+                                                </td>
+                                                <td>
+                                                    <span title="���������� ����"
+                                                          style="margin-right:11px; font-size:9px;">
+                                                        <img width="8" height="8"
+                                                             src="https://img.new-combats.com/i/micro/hp.gif"/>
+                                                        <font id="tac6">
+                                                            <?php echo 0 + floor($u->info['tactic6']); ?>
+                                                        </font>
+                                                    </span>
+                                                </td>
+                                                <td>
+                                                    <span title="������� ����"
+                                                          style="margin-right:11px; font-size:9px;">
+                                                        <img width="7" height="8"
+                                                             src="https://img.new-combats.com/i/micro/spirit.gif"/>
+                                                        <font id="tac7">
+                                                            <?php
+                                                            if ($u->info['tactic7'] < 0) {
+                                                                $u->info['tactic7'] = 0;
+                                                            }
+                                                            echo 0 + $u->info['tactic7'];
+                                                            ?>
+                                                        </font>
+                                                    </span>
+                                                </td>
+                                            </tr>
+                                        </table>
+                                    </div>
+                                </td>
+                            </tr>
+                        </table>
+                        <table border="0" align="center" style="margin-top:-10px;" cellpadding="0" cellspacing="1">
+                            <tr align="center">
+                                <td>
+                                    <div id="priems" style="width:440px;"></div>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td>
+                                    <div style="display:none;" id="pers_priem" align="center"></div>
+                                </td>
+                            </tr>
+                        </table>
+                        <hr style="border-color:#333;"/>
                     </div>
-                    <? if($u->info['level'] == 0) { ?><hr />
-                    <center><font color="#333333"><small>������ ������� <b>�����!!!</b> ����� ������� ��������� ����</small></font></center><hr />
-                    <? } ?>
-                    </td>
-                  </tr>
-              </table>			  </td>
+                </td>
+                <td valign="top" width="260" align="right">
+                    <div id="player2">
+                        <div align="left"></div>
+                    </div>
+                </td>
             </tr>
+        </table>
+        <div id="allTeams0" align="center"><font id="teams"></font></div>
+        <table width="100%" border="0" cellspacing="0" cellpadding="0">
             <tr>
-              <td id="mainpanel2" style="height:128px; display:none;" align="center"></td>
-            </tr>
-             <tr>
-              <td><div style="padding-top:0px;padding-bottom:10px;" align="center">
-                  <table <? if($u->info['level'] < 2) { echo ' style="display:none;" '; } ?> border="0" cellspacing="0" cellpadding="0">
-                    <tr>
-                      <td><span title="���������� ����" style="margin-right:11px; font-size:9px;"><img onclick="startHintPriemsBattle()" width="8" height="8" src="https://img.new-combats.com/i/micro/hit.gif" /> <font id="tac1"><? echo 0+$u->info['tactic1']; ?></font></span></td>
-                      <td><span title="����������� ����" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/krit.gif" /> <font id="tac2"><? echo 0+$u->info['tactic2']; ?></font></span></td>
-                      <td><span title="����������� ���������" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/counter.gif" /> <font id="tac3"><? echo 0+$u->info['tactic3']; ?></font></span></td>
-                      <td><span title="�������� ����" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/block.gif" /> <font id="tac4"><? echo 0+$u->info['tactic4']; ?></font></span></td>
-                      <td><span title="�������� �����������" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/parry.gif" /> <font id="tac5"><? echo 0+$u->info['tactic5']; ?></font></span></td>
-                      <td><span title="���������� ����" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/hp.gif" /> <font id="tac6"><? echo 0+floor($u->info['tactic6']); ?></font></span></td>
-                      <td><span title="������� ����" style="margin-right:11px; font-size:9px;"><img width="7" height="8" src="https://img.new-combats.com/i/micro/spirit.gif" /> <font id="tac7"><? if($u->info['tactic7']<0){ $u->info['tactic7'] = 0; } echo 0+$u->info['tactic7']; ?></font></span></td>
-                    </tr>
-                  </table>
-              </div>
-              </td>
-              </tr>
-          </table>
-          <table border="0" align="center" style="margin-top:-10px;" cellpadding="0" cellspacing="1">
-				<tr align="center">
-				<td><div id="priems" style="width:440px;"></div></td>
-			</tr>
-            <tr>
-              <td><div style="display:none;" id="pers_priem" align="center"></div></td>
-            </tr>
-          </table>
-          <hr style="border-color:#333;" />
-        </div></td>	
-        <td valign="top" width="260" align="right"><div id="player2">
-          <div align="left"></div>
-        </div></td>
-    </tr>
-    </table>
-  <div id="allTeams0" align="center"><font id="teams"></font></div>
-    <table width="100%" border="0" cellspacing="0" cellpadding="0">
-      <tr>
-        <td width="260" valign="top">&nbsp;</td>
-        <td valign="top">
-        <hr />
-        <div align="center">
-        <font color="green"><b>�� ������ ������ ���� �������� �����: </b></font><b class="private">&nbsp;<span id="nabito"><? echo floor($u->info['battle_yron']); ?></span> HP&nbsp;</b><b style="color:blue">.</b><br />
-        <span style="display:">
-        <small style="display:none">(����: +<b><span id="expmaybe"><? echo floor($u->info['battle_exp']); ?></span> ��.</b>, ��� ����� ���������)</small>
+                <td width="260" valign="top">&nbsp;</td>
+                <td valign="top">
+                    <hr/>
+                    <div align="center">
+                        <font color="green"><b>�� ������ ������ ���� �������� �����: </b></font><b class="private">&nbsp;<span
+                                    id="nabito"><?php
+                                echo floor($u->info['battle_yron']); ?></span> HP&nbsp;</b><b
+                                style="color:blue">.</b><br/>
+                        <span style="display:">
+        <small style="display:none">(����: +<b><span id="expmaybe"><?php
+                    echo floor($u->info['battle_exp']); ?></span> ��.</b>, ��� ����� ���������)</small>
         </span>
-        </div>
-        <hr /></td>
-        <td width="260" valign="top"><div align="right"><a href="https://new-combats.com/logs.php?log=<? echo $u->info['battle']; ?>" target="blank_">��� ��� ��</a><br />
-        (��� ���� � ��������� <strong id="timer_out">NaN</strong> ���.)</div></td>
-      </tr>
-    </table>
-    <div class="st1222" id="volna"></div>
-    <table width="100%" border="0" cellspacing="0" cellpadding="0">
-      <tr>
-        <td width="260">&nbsp;</td>
-        <td><div style="font-size:12px;" id="battle_logg" align="left"></div><div align="left">������ ������ ���� ��� �������� <a href="https://new-combats.com/logs.php?log=<? echo $u->info['battle']; ?>" target="blank_">����� ��</a></div><br /></td>
-        <td width="260">&nbsp;</td>
-      </tr>
-    </table>
+                    </div>
+                    <hr/>
+                </td>
+                <td width="260" valign="top">
+                    <div align="right"><a href="https://new-combats.com/logs.php?log=<?php
+                        echo $u->info['battle']; ?>" target="blank_">��� ��� ��</a><br/>
+                        (��� ���� � ��������� <strong id="timer_out">NaN</strong> ���.)
+                    </div>
+                </td>
+            </tr>
+        </table>
+        <div class="st1222" id="volna"></div>
+        <table width="100%" border="0" cellspacing="0" cellpadding="0">
+            <tr>
+                <td width="260">&nbsp;</td>
+                <td>
+                    <div style="font-size:12px;" id="battle_logg" align="left"></div>
+                    <div align="left">������ ������ ���� ��� �������� <a
+                                href="https://new-combats.com/logs.php?log=<?php
+                                echo $u->info['battle']; ?>" target="blank_">����� ��</a></div>
+                    <br/></td>
+                <td width="260">&nbsp;</td>
+            </tr>
+        </table>
+    </div>
+    <!-- <script type="text/javascript" src="js/chat-engine.js"></script> -->
+
+    <script>// ���� ���� ���� js � ���� ����� �������, �� ��� ����� � ���� ���� ������ �� ������ ����� � �����, �� � �� ������� ������� �������,�� �� ������ ��� � �����
+        function atackt() { // � ���� �� ��� ��� ���
+            document.getElementById('go_btn').setAttribute("class", "buttons btnnew btnnew2");
+            document.getElementById('go_btn').setAttribute("onclick", "");
+            document.getElementById('go_btn').setAttribute("disabled", "disabled");
+            atack();
+            timedCount();
+        }
+
+        function reflesht() { // � ���� �� ��� ��� ���2
+            // console.log("����� � ���� �������") ������������� ������ ��� ������� �� �������
+            document.getElementById('reflesh_btn').setAttribute("class", "buttons btnnew btnnew2");
+            document.getElementById('reflesh_btn').setAttribute("onclick", "");
+            document.getElementById('reflesh_btn').setAttribute("disabled", "disabled");
+            document.getElementById('btn_down_img1').setAttribute("onclick", "");
+            document.getElementById('btn_down_img1').setAttribute("disabled", "disabled");
+            reflesh(true);
+            timedCount();
+        }
+
+        var cgo = 250;
+        var tgo;
+        var timer_is_on = 0;
+        timedCount(); //��� ��� ������ ����� ������ �����
+        function timedCount() { //reflesh_btn
+            document.getElementById('go_btn').setAttribute("class", "buttons btnnew btnnew2");
+            document.getElementById('go_btn').setAttribute("onclick", "");
+            document.getElementById("go_btn").innerHTML = '����!!!';// + cgo;
+            document.getElementById('go_btn').setAttribute("disabled", "disabled");
+            document.getElementById('reflesh_btn').setAttribute("class", "buttons btnnew btnnew2");
+            document.getElementById('reflesh_btn').setAttribute("onclick", "");
+            document.getElementById('reflesh_btn').setAttribute("disabled", "disabled");
+            document.getElementById("reflesh_btn").innerHTML = '���!!!';// + cgo;
+            document.getElementById('btn_down_img1').setAttribute("onclick", "");
+            document.getElementById('btn_down_img1').setAttribute("disabled", "disabled");
+
+            if (cgo > 0) {
+                tgo = setTimeout(timedCount, 100);
+                cgo = cgo - 10;
+            } else {
+
+                clearTimeout(tgo);
+                timer_is_on = 0;
+                cgo = 100; // ��������� �����
+
+                document.getElementById("go_btn").innerHTML = '�����!!!';
+                document.getElementById('go_btn').removeAttribute("disabled");
+                document.getElementById('go_btn').setAttribute("onclick", "atackt();");
+                document.getElementById("reflesh_btn").innerHTML = '��������';
+                // ��� ��� REMOVE
+                document.getElementById('reflesh_btn').removeAttribute("disabled");
+                document.getElementById('reflesh_btn').setAttribute("onclick", "reflesht();");
+                document.getElementById('btn_down_img1').setAttribute("onclick", "reflesht();");
+                document.getElementById('btn_down_img1').removeAttribute("disabled");
+            }
+        }
+
+        startCountdown();
+        genZoneAtack();
+        genZoneBlock();
+        refleshPoints();
+    </script>
+    <?php
+    $priem = new Priems();
+    $btl = new Battle();
+    include('jx/battle/refresh1.php'); ?>
 </div>
-<!-- <script type="text/javascript" src="js/chat-engine.js"></script> -->
-
-<script>// ���� ���� ���� js � ���� ����� �������, �� ��� ����� � ���� ���� ������ �� ������ ����� � �����, �� � �� ������� ������� �������,�� �� ������ ��� � �����
-function atackt(){ // � ���� �� ��� ��� ���
-	document.getElementById('go_btn').setAttribute("class", "buttons btnnew btnnew2");
-	document.getElementById('go_btn').setAttribute("onclick", "");
-    document.getElementById('go_btn').setAttribute("disabled","disabled");
-	atack(); 
-	timedCount();
-}
-function reflesht(){ // � ���� �� ��� ��� ���2
-	// console.log("����� � ���� �������") ������������� ������ ��� ������� �� �������
-	document.getElementById('reflesh_btn').setAttribute("class", "buttons btnnew btnnew2");
-
-
-	// console.log(document.getElementById('reflesh_btn').disabled)
-	document.getElementById('reflesh_btn').setAttribute("onclick", "");
-    document.getElementById('reflesh_btn').setAttribute("disabled","disabled");
-	document.getElementById('btn_down_img1').setAttribute("onclick", "");
-	document.getElementById('btn_down_img1').setAttribute("disabled","disabled");
-	// console.log("���")
-	reflesh(true); 
-	timedCount();
-}
-
-var cgo = 250;
-var tgo;
-var timer_is_on = 0;
-timedCount(); //��� ��� ������ ����� ������ �����
-function timedCount() { //reflesh_btn
-  document.getElementById('go_btn').setAttribute("class", "buttons btnnew btnnew2");
-  document.getElementById('go_btn').setAttribute("onclick", "");
-  document.getElementById("go_btn").innerHTML = '����!!!';// + cgo;
-  document.getElementById('go_btn').setAttribute("disabled","disabled");
-
-  
-  //   if (!document.getElementById('reflesh_btn').disabled) {
-//   }
-
-  document.getElementById('reflesh_btn').setAttribute("class", "buttons btnnew btnnew2");
-  document.getElementById('reflesh_btn').setAttribute("onclick", "");
-  document.getElementById('reflesh_btn').setAttribute("disabled","disabled");
-  document.getElementById("reflesh_btn").innerHTML = '���!!!';// + cgo;
-  document.getElementById('btn_down_img1').setAttribute("onclick", "");
-  document.getElementById('btn_down_img1').setAttribute("disabled","disabled");
-
-
-  if (cgo > 0)
-  {
-	 tgo = setTimeout(timedCount, 100);
-	 cgo = cgo - 10;	 
-  }
-  else
-  {
-	  
-		clearTimeout(tgo);
-		timer_is_on = 0;
-		cgo = 100; // ��������� �����
-
-		document.getElementById("go_btn").innerHTML = '�����!!!';
-		document.getElementById('go_btn').removeAttribute("disabled");
-		document.getElementById('go_btn').setAttribute("onclick", "atackt();");
-		document.getElementById("reflesh_btn").innerHTML = '��������';
-		// ��� ��� REMOVE 
-		document.getElementById('reflesh_btn').removeAttribute("disabled");
-		document.getElementById('reflesh_btn').setAttribute("onclick", "reflesht();"); 
-		document.getElementById('btn_down_img1').setAttribute("onclick", "reflesht();");
-		document.getElementById('btn_down_img1').removeAttribute("disabled");
-  }
-}
-
- startCountdown();
- genZoneAtack();
- genZoneBlock();
- refleshPoints();
-</script>
-<?
-include('_incl_data/class/_cron_.php');
-include('_incl_data/class/__battle.php');		
-include('jx/battle/refresh1.php'); ?>
-</div>
-<?
-
-}
-
-?>
diff --git a/modules_data/btl_2.php1 b/modules_data/btl_2.php1
index 128a4943..285818f3 100644
--- a/modules_data/btl_2.php1
+++ b/modules_data/btl_2.php1
@@ -6,7 +6,7 @@ if(!defined('GAME'))
 
 $old_battle = true;
 
-include('jx/battle/log_text.php');
+require_once('jx/battle/log_text.php');
 
 if( $old_battle == true ) {
 
diff --git a/modules_data/btl_bac.php b/modules_data/btl_bac.php
index 15d47fa2..dd0b21cb 100644
--- a/modules_data/btl_bac.php
+++ b/modules_data/btl_bac.php
@@ -17,17 +17,15 @@ if( isset($_COOKIE['newbattle']) ) {
 
 include('jx/battle/log_text.php');
 
-if( $old_battle == true ) {
-
+if(!$old_battle) {
+    return;
+}
 if(isset($btl_last['id']) && $u->info['battle'] == 0) {
 	$u->info['battle'] = $btl_last['battle'];
-	//die();
 }
 
 if($u->info['battle'] == 0 || isset($_GET['bend']))
 {
-	//header('location: main.php');
-	//die();
 	die('<script>top.frames[\'main\'].location = "main.php";</script>');
 }
 
@@ -52,12 +50,13 @@ function typeBattle($x) {
 	}
 	return $r;
 }
+
 $allprice = typeBattle($allprice);
 
 /*if( $u->info['admin'] > 0 ) {
 	echo '<script>var server_fight = "_vip";</script>';
 }else{*/
-	echo '<script>var server_fight = "";</script>';
+echo '<script>var server_fight = "";</script>';
 //}
 ?>
 <script src="https://new-combats.com/js/jquery.js" type="text/javascript"></script>
@@ -69,7 +68,7 @@ function maginfo(z,p,m,obj) {
 	r += '����: '+m+', ';
 	r += '������: '+z+', ';
 	r += '����������: '+p+'';
-	return r;	
+	return r;
 }
 <?
 if(isset($btl_last['id']) && ( $u->info['battle'] == 0 || $u->info['battle'] == $btl_last['battle']) ) {
@@ -92,7 +91,7 @@ setInterval('top.c.noEr = 0;',250);
 function mbsum(event)
 {
 	//Enter
-	if(event.keyCode==13 && top.c.noEr==0){ 
+	if(event.keyCode==13 && top.c.noEr==0){
 		if( document.getElementById('go_btn').style.display != 'none' || document.getElementById('reflesh_btn').style.display == '')
 		{
 		if( document.getElementById('mainpanel').style.display == 'none' ) {
@@ -225,17 +224,22 @@ function convert($from, $to, $var)
     return $var;
 }
 function normJsonStr($str){
-    $str = preg_replace_callback('/\\\u([a-f0-9]{4})/i', create_function('$m', 'return chr(hexdec($m[1])-1072+224);'), $str);
-    //$str = iconv('cp1251', 'utf-8', $str);
-	return $str;
+    return preg_replace_callback(
+        '/\\\u([a-f0-9]{4})/i',
+        function ($m) {return chr(hexdec($m[1]) - 1072 + 224);},
+        $str
+    );
+//    $str = preg_replace_callback('/\\\u([a-f0-9]{4})/i', create_function('$m', 'return chr(hexdec($m[1])-1072+224);'), $str);
+//    //$str = iconv('cp1251', 'utf-8', $str);
+//	return $str;
 }
 ?>
 
-var log_text = <? echo normJsonStr(json_encode(convert('cp1251','utf-8',$log_text))); ?>;
+var log_text = <? echo normJsonStr(json_encode(convert('cp1251', 'utf-8', $log_text))); ?>;
 var youlogin = "<?=$u->info['login']?>";
 
 function looklogrep(text,vars) {
-	
+
 	var vars = explode('||',vars);
 	var forYou = '';
 	var data = { };
@@ -250,14 +254,14 @@ function looklogrep(text,vars) {
 		}
 		i++;
 	}
-	
+
     text = replaceAll('{tm1}','<span class="date '+forYou+'">'+ data['time1'] +'</span>',text);
 	text = replaceAll('{u1}','<span onClick="top.chat.addto(\'' + data['login1'] + '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' + data['login1'] + '\',event,\'chat\'); return false;" class="CSSteam'+data['t1']+'">' + data['login1'] + '</span>',text);
 	text = replaceAll('{u2}','<span onClick="top.chat.addto(\'' + data['login2'] + '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' + data['login2'] + '\',event,\'chat\'); return false;" class="CSSteam'+data['t2']+'">' + data['login2'] + '</span>',text);
 	text = replaceAll('^^^^','=',text);
 	text = replaceAll('{pr}','<b>' + data['prm'] + '</b>',text);
 
-	
+
 	var test_zb1 = [ 0 , 0 , 0 , 0 , 0 , 0];
 	var test_zb2 = [ 0 , 0 , 0 , 0 , 0 , 0];
 	i = 1;
@@ -270,7 +274,7 @@ function looklogrep(text,vars) {
 		}
 		i++;
 	}
-	
+
 	i = 1;
 	while( i <= 5 ) {
 		j = 1;
@@ -293,7 +297,7 @@ function looklogrep(text,vars) {
 		text = replaceAll('{zn2_' + i + '}',rej,text);
 		i++;
 	}
-	
+
 	i = 1;
 	while( i <= 21 ) {
 		//������ R - ����� 1
@@ -328,41 +332,41 @@ function looklogrep(text,vars) {
 		}
 		i++;
 	}
-	
+
 	//text = replaceAll('^^^^','=',text);
-	
+
 	/*text = replaceAll('{tm1}','<span class="date '+forYou+'">00:01</span>',text);
 	text = replaceAll('{tm2}','<span class="date '+forYou+'">00:02</span>',text);
 	text = replaceAll('{tm3}','<span class="date '+forYou+'">01.01.2015 00:01</span>',text);
 	text = replaceAll('{tm4}','<span class="date '+forYou+'">02.02.2015 00:02</span>',text);*/
-	
+
 	//��������� ������
 	text = replaceAll('{u1}','<span onClick="top.chat.addto(\'' + data['login1'] + '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' + data['login1'] + '\',event,\'chat\'); return false;" class="CSSteam'+data['t1']+'">' + data['login1'] + '</span>',text);
 	text = replaceAll('{u2}','<span onClick="top.chat.addto(\'' + data['login2'] + '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' + data['login2'] + '\',event,\'chat\'); return false;" class="CSSteam'+data['t2']+'">' + data['login2'] + '</span>',text);
-	
+
 	if( data['prm'] != undefined ) {
 		data['prm'] = replaceAll("rvnO","=",data['prm']);
 	}
-	
+
 	//data['prm'] = replaceAll('^^^^','=', data['prm'] );
-	
+
 	text = replaceAll('{pr}','<b>' + data['prm'] + '</b>',text);
-	
+
 	text = replaceAll('^^^^','=',text);
-	
+
 	text = replaceAll('==','',text);
-	
+
 	if( ( data['login1'] == youlogin || data['login2'] == youlogin ) && youlogin != '' ) {
 		text = replaceAll('{fru}',' date2 ',text);
 	}else{
 		text = replaceAll('{fru}','',text);
 	}
-	
+
 	/*text = replaceAll('{tm1}','<span class="date '+forYou+'">00:01</span>',text);
 	text = replaceAll('{tm2}','<span class="date '+forYou+'">00:02</span>',text);
 	text = replaceAll('{tm3}','<span class="date '+forYou+'">01.01.2015 00:01</span>',text);
 	text = replaceAll('{tm4}','<span class="date '+forYou+'">02.02.2015 00:02</span>',text);*/
-	
+
 	return text;
 }
 
@@ -380,144 +384,147 @@ html, body {
         <td valign="top" width="260"><div id="player1">
         </div>
         <div align="right"></div></td>
-        <td valign="top"><div align="center">          
+        <td valign="top"><div align="center">
           <table width="100%" height="15" border="0" cellspacing="0" cellpadding="0">
             <tr>
               <td width="50%" valign="top"><div id="player1_login" style="float:left;"></div></td>
               <td align="center"><h5><?
-              if( $thisBattle['type'] == 99 ) {
-				  echo str_replace(' ','&nbsp;',$allprice[3]);
-			  }else{
-				  echo str_replace(' ','&nbsp;',$allprice[2]);
-			  }
-			  ?></h5></td>
-              <td width="50%" valign="top"><div id="player2_login" style="float:right;"></div></td>
-            </tr>
-          </table>
-          <table border="0" align="center" style="margin-top:-15px;" cellpadding="0" cellspacing="3">
-            <tr>
-              <td height="20">
-              <div id="ref2" name="ref2"></div><div id="ref" name="ref"></div></td>
-            </tr>		
-		<tr>
-			<div id="error" style="display:none;"></div>	
-              <td><div id="pers_magic" align="center">
-                <table border="0" cellspacing="0" cellpadding="0">
-                  <tr>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    </tr>
-                </table>
-              </div></td>
-            </tr>
-            <tr>
-              <td><table border="0" align="center" cellpadding="0" cellspacing="1">
-                  <tr>
-                    <td align="center">
-                    <div id="ndfksdw">
-                     <table width="100%" id="mainpanel222" border="0" cellspacing="0" cellpadding="0">
-                        <tr>
-                          <td bgcolor="#A7A7A7"><div align="center"><strong>�����</strong></div></td>
-                          <td width="20" bgcolor="#A7A7A7"><div align="center" style="color:#A7A7A7;">-</div></td>
-                          <td bgcolor="#A7A7A7"><div align="center"><strong>������</strong></div></td>
-                        </tr>
-                      </table>
-                    
-                    <table width="100%" border="0" align="center" cellpadding="1" cellspacing="2" id="mainpanel">
-                          <tr>
-                            <td><div id="zatack1_1" class="crop"><a onclick="change_radio(1,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack2_1" class="crop"><a onclick="change_radio(2,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack3_1" class="crop"><a onclick="change_radio(3,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack4_1" class="crop"><a onclick="change_radio(4,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack5_1" class="crop"><a onclick="change_radio(5,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="select_atack(1,1);" style="cursor:default;" align="left">���� � ������</td>
-                            <td width="3" style="cursor:default;" onclick="select_atack(1,1);">&nbsp;</td>
-                            <td><div id="zblock1_1" class="crop"><a onclick="change_radio(1,1,'block',0);return false;" href="#"><img style="display:block;" id="block_1_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="change_radio(1,1,'block');" style="cursor:default;" align="left"><div id="txtb1_1">&nbsp;���� ������</div>
-                                <div id="txtb1_2">&nbsp;���� ������ � �����</div>
-                              <div id="txtb1_3">&nbsp;���� ������, ����� � ������</div></td>
-                          </tr>
-                          <tr>
-                            <td><div id="zatack1_2" class="crop"><a onclick="change_radio(1,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack2_2" class="crop"><a onclick="change_radio(2,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack3_2" class="crop"><a onclick="change_radio(3,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack4_2" class="crop"><a onclick="change_radio(4,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack5_2" class="crop"><a onclick="change_radio(5,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="select_atack(2,1);" style="cursor:default;" align="left">���� � �����</td>
-                            <td onclick="select_atack(2,1);" style="cursor:default;">&nbsp;</td>
-                            <td><div id="zblock1_2" class="crop"><a onclick="change_radio(1,2,'block',0);return false;" href="#"><img style="display:block;" id="block_1_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="change_radio(1,2,'block');" style="cursor:default;" align="left"><div id="txtb2_1">&nbsp;���� �����</div>
-                                <div id="txtb2_2">&nbsp;���� ����� � ������</div>
-                              <div id="txtb2_3">&nbsp;���� �����, ������ � �����</div></td>
-                          </tr>
-                          <tr>
-                            <td><div id="zatack1_3" class="crop"><a onclick="change_radio(1,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack2_3" class="crop"><a onclick="change_radio(2,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack3_3" class="crop"><a onclick="change_radio(3,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack4_3" class="crop"><a onclick="change_radio(4,3,'atack',0);return false;" href="#"><img id="atack_4_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack5_3" class="crop"><a onclick="change_radio(5,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="select_atack(3,1);" style="cursor:default;" align="left">���� � �����</td>
-                            <td onclick="select_atack(3,1);" style="cursor:default;">&nbsp;</td>
-                            <td><div id="zblock1_3" class="crop"><a onclick="change_radio(1,3,'block',0);return false;" href="#"><img style="display:block;" id="block_1_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="change_radio(1,3,'block');" style="cursor:default;" align="left"><div id="txtb3_1">&nbsp;���� ������</div>
-                                <div id="txtb3_2">&nbsp;���� ������ � �����</div>
-                              <div id="txtb3_3">&nbsp;���� ������, ����� � ���</div></td>
-                          </tr>
-                          <tr>
-                            <td><div id="zatack1_4" class="crop"><a onclick="change_radio(1,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack2_4" class="crop"><a onclick="change_radio(2,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack3_4" class="crop"><a onclick="change_radio(3,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack4_4" class="crop"><a onclick="change_radio(4,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack5_4" class="crop"><a onclick="change_radio(5,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="select_atack(4,1);" style="cursor:default;" align="left">���� � ����(���)</td>
-                            <td onclick="select_atack(4,1);" style="cursor:default;">&nbsp;</td>
-                            <td><div id="zblock1_4" class="crop"><a onclick="change_radio(1,4,'block',0);return false;" href="#"><img style="display:block;" id="block_1_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="change_radio(1,4,'block');" style="cursor:default;" align="left"><div id="txtb4_1">&nbsp;���� �����</div>
-                                <div id="txtb4_2">&nbsp;���� ����� � ���</div>
-                              <div id="txtb4_3">&nbsp;���� �����, ��� � ������</div></td>
-                          </tr>
-                          <tr>
-                            <td><div id="zatack1_5" class="crop"><a onclick="change_radio(1,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack2_5" class="crop"><a onclick="change_radio(2,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack3_5" class="crop"><a onclick="change_radio(3,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack4_5" class="crop"><a onclick="change_radio(4,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack5_5" class="crop"><a onclick="change_radio(5,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="select_atack(5,1);" style="cursor:default;" align="left">���� �� �����</td>
-                            <td onclick="select_atack(5,1);" style="cursor:default;">&nbsp;</td>
-                            <td><div id="zblock1_5" class="crop"><a onclick="change_radio(1,5,'block',0);return false;" href="#"><img style="display:block;" id="block_1_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="change_radio(1,5,'block');" style="cursor:default;" align="left"><div id="txtb5_1">&nbsp;���� ���</div>
-                                <div id="txtb5_2">&nbsp;���� ��� � ������</div>
-                              <div id="txtb5_3">&nbsp;���� ���, ������ � �����</div></td>
-                          </tr>
-                      </table>
-                    </div>
-				    <div id="ref_menu_down" align="center">
-                      <table width="100%" border="0" style="background-color:#f2f0f0;" align="center" cellpadding="0" cellspacing="0">
-                        <tr>
-                          <td width="5">&nbsp;</td>
-                          <td width="20" title="��������� ����" onclick="top.cb_radio_click($('#cr_rach_rc3'),3);"><script>top.slcbrc[3] = 1; if( top.slcbrc[3] == 0 ) { document.write(top.create_check('rc3','','off')); }else{ document.write(top.create_check('rc3','','on')); }</script></td>
-                          <td width="20" title="�� ���������� ����� ��� �����\�����" onclick="top.cb_radio_click($('#cr_rach_rc4'),4);"><script>if( top.slcbrc[4] == 0 ) { document.write(top.create_check('rc4','','off')); }else{ document.write(top.create_check('rc4','','on')); }</script></td>
-                          <td width="20">&nbsp;</td>
-                          <td align="center">
-                              <input name="fast_battle" id="fast_battle" type="hidden"/>
-                              <input name="auto_battle" id="auto_battle" type="hidden" />
-                          <!--<button name="go_btn" type="button" id="go_btn" style="cursor:pointer;" class="btn" title="�����!!!" onclick="atack();">�����!!!</button>-->   
-							  <button name="go_btn" type="button" id="go_btn" style="cursor:pointer;" class="buttons inpBtl btnnew" title="�����!!!" onclick="atack();">�����!!!</button>							  
-                          <!--<button name="reflesh_btn" onClick="reflesh(true);" type="button" id="reflesh_btn" style="cursor:pointer;display:none;" class="btn" title="��������" >��������</button>-->
-							  <button name="reflesh_btn" onClick="reflesh(true);" type="button" id="reflesh_btn" style="cursor:pointer;display:none;" class="buttons inpBtl btnnew" title="��������" >��������</button>                               
-                              <button name="back_menu_down" onClick="top.frames['main'].location='main.php?finish=<? echo microtime(); ?>';" type="button" id="back_menu_down" style="cursor:pointer;display:none;" class="btn" title="���������" >���������</button>
+                      if( $thisBattle['type'] == 99 ) {
+                          echo str_replace(' ','&nbsp;',$allprice[3]);
+                      }else{
+                          echo str_replace(' ','&nbsp;',$allprice[2]);
+                      }
+                      ?></h5></td>
+<td width="50%" valign="top"><div id="player2_login" style="float:right;"></div></td>
+</tr>
+</table>
+<table border="0" align="center" style="margin-top:-15px;" cellpadding="0" cellspacing="3">
+<tr>
+<td height="20">
+<div id="ref2" name="ref2"></div><div id="ref" name="ref"></div></td>
+</tr>
+<tr>
+                    <div id="error" style="display:none;"></div>
+<td><div id="pers_magic" align="center">
+<table border="0" cellspacing="0" cellpadding="0">
+<tr>
+<td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
+<td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
+<td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
+<td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
+<td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
+<td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
+<td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
+<td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
+<td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
+<td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
+</tr>
+</table>
+</div></td>
+</tr>
+<tr>
+<td><table border="0" align="center" cellpadding="0" cellspacing="1">
+<tr>
+<td align="center">
+<div id="ndfksdw">
+<table width="100%" id="mainpanel222" border="0" cellspacing="0" cellpadding="0">
+<tr>
+<td bgcolor="#A7A7A7"><div align="center"><strong>�����</strong></div></td>
+<td width="20" bgcolor="#A7A7A7"><div align="center" style="color:#A7A7A7;">-</div></td>
+<td bgcolor="#A7A7A7"><div align="center"><strong>������</strong></div></td>
+</tr>
+</table>
+
+<table width="100%" border="0" align="center" cellpadding="1" cellspacing="2" id="mainpanel">
+<tr>
+<td><div id="zatack1_1" class="crop"><a onclick="change_radio(1,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack2_1" class="crop"><a onclick="change_radio(2,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack3_1" class="crop"><a onclick="change_radio(3,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack4_1" class="crop"><a onclick="change_radio(4,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack5_1" class="crop"><a onclick="change_radio(5,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td onclick="select_atack(1,1);" style="cursor:default;" align="left">���� � ������</td>
+<td width="3" style="cursor:default;" onclick="select_atack(1,1);">&nbsp;</td>
+<td><div id="zblock1_1" class="crop"><a onclick="change_radio(1,1,'block',0);return false;" href="#"><img style="display:block;" id="block_1_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td onclick="change_radio(1,1,'block');" style="cursor:default;" align="left"><div id="txtb1_1">&nbsp;���� ������</div>
+<div id="txtb1_2">&nbsp;���� ������ � �����</div>
+<div id="txtb1_3">&nbsp;���� ������, ����� � ������</div></td>
+</tr>
+<tr>
+<td><div id="zatack1_2" class="crop"><a onclick="change_radio(1,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack2_2" class="crop"><a onclick="change_radio(2,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack3_2" class="crop"><a onclick="change_radio(3,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack4_2" class="crop"><a onclick="change_radio(4,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack5_2" class="crop"><a onclick="change_radio(5,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td onclick="select_atack(2,1);" style="cursor:default;" align="left">���� � �����</td>
+<td onclick="select_atack(2,1);" style="cursor:default;">&nbsp;</td>
+<td><div id="zblock1_2" class="crop"><a onclick="change_radio(1,2,'block',0);return false;" href="#"><img style="display:block;" id="block_1_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td onclick="change_radio(1,2,'block');" style="cursor:default;" align="left"><div id="txtb2_1">&nbsp;���� �����</div>
+<div id="txtb2_2">&nbsp;���� ����� � ������</div>
+<div id="txtb2_3">&nbsp;���� �����, ������ � �����</div></td>
+</tr>
+<tr>
+<td><div id="zatack1_3" class="crop"><a onclick="change_radio(1,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack2_3" class="crop"><a onclick="change_radio(2,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack3_3" class="crop"><a onclick="change_radio(3,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack4_3" class="crop"><a onclick="change_radio(4,3,'atack',0);return false;" href="#"><img id="atack_4_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack5_3" class="crop"><a onclick="change_radio(5,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td onclick="select_atack(3,1);" style="cursor:default;" align="left">���� � �����</td>
+<td onclick="select_atack(3,1);" style="cursor:default;">&nbsp;</td>
+<td><div id="zblock1_3" class="crop"><a onclick="change_radio(1,3,'block',0);return false;" href="#"><img style="display:block;" id="block_1_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td onclick="change_radio(1,3,'block');" style="cursor:default;" align="left"><div id="txtb3_1">&nbsp;���� ������</div>
+<div id="txtb3_2">&nbsp;���� ������ � �����</div>
+<div id="txtb3_3">&nbsp;���� ������, ����� � ���</div></td>
+</tr>
+<tr>
+<td><div id="zatack1_4" class="crop"><a onclick="change_radio(1,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack2_4" class="crop"><a onclick="change_radio(2,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack3_4" class="crop"><a onclick="change_radio(3,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack4_4" class="crop"><a onclick="change_radio(4,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack5_4" class="crop"><a onclick="change_radio(5,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td onclick="select_atack(4,1);" style="cursor:default;" align="left">���� � ����(���)</td>
+<td onclick="select_atack(4,1);" style="cursor:default;">&nbsp;</td>
+<td><div id="zblock1_4" class="crop"><a onclick="change_radio(1,4,'block',0);return false;" href="#"><img style="display:block;" id="block_1_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td onclick="change_radio(1,4,'block');" style="cursor:default;" align="left"><div id="txtb4_1">&nbsp;���� �����</div>
+<div id="txtb4_2">&nbsp;���� ����� � ���</div>
+<div id="txtb4_3">&nbsp;���� �����, ��� � ������</div></td>
+</tr>
+<tr>
+<td><div id="zatack1_5" class="crop"><a onclick="change_radio(1,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack2_5" class="crop"><a onclick="change_radio(2,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack3_5" class="crop"><a onclick="change_radio(3,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack4_5" class="crop"><a onclick="change_radio(4,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td><div id="zatack5_5" class="crop"><a onclick="change_radio(5,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td onclick="select_atack(5,1);" style="cursor:default;" align="left">���� �� �����</td>
+<td onclick="select_atack(5,1);" style="cursor:default;">&nbsp;</td>
+<td><div id="zblock1_5" class="crop"><a onclick="change_radio(1,5,'block',0);return false;" href="#"><img style="display:block;" id="block_1_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
+<td onclick="change_radio(1,5,'block');" style="cursor:default;" align="left"><div id="txtb5_1">&nbsp;���� ���</div>
+<div id="txtb5_2">&nbsp;���� ��� � ������</div>
+<div id="txtb5_3">&nbsp;���� ���, ������ � �����</div></td>
+</tr>
+</table>
+</div>
+                            <div id="ref_menu_down" align="center">
+<table width="100%" border="0" style="background-color:#f2f0f0;" align="center" cellpadding="0" cellspacing="0">
+<tr>
+<td width="5">&nbsp;</td>
+<td width="20" title="��������� ����" onclick="top.cb_radio_click($('#cr_rach_rc3'),3);"><script>top.slcbrc[3] = 1; if( top.slcbrc[3] == 0 ) { document.write(top.create_check('rc3','','off')); }else{ document.write(top.create_check('rc3','','on')); }</script></td>
+<td width="20" title="�� ���������� ����� ��� �����\�����" onclick="top.cb_radio_click($('#cr_rach_rc4'),4);"><script>if( top.slcbrc[4] == 0 ) { document.write(top.create_check('rc4','','off')); }else{ document.write(top.create_check('rc4','','on')); }</script></td>
+<td width="20">&nbsp;</td>
+<td align="center">
+<input name="fast_battle" id="fast_battle" type="hidden"/>
+<input name="auto_battle" id="auto_battle" type="hidden" />
+<!--<button name="go_btn" type="button" id="go_btn" style="cursor:pointer;" class="btn" title="�����!!!" onclick="atack();">�����!!!</button>-->
+                                      <button name="go_btn" type="button" id="go_btn" style="cursor:pointer;" class="buttons inpBtl btnnew" title="�����!!!" onclick="atack();">�����!!!</button>
+<!--<button name="reflesh_btn" onClick="reflesh(true);" type="button" id="reflesh_btn" style="cursor:pointer;display:none;" class="btn" title="��������" >��������</button>-->
+                                      <button name="reflesh_btn" onClick="reflesh(true);" type="button" id="reflesh_btn" style="cursor:pointer;display:none;" class="buttons inpBtl btnnew" title="��������" >��������</button>
+<button name="back_menu_down" onClick="top.frames['main'].location='main.php?finish=<?
+                              echo microtime(); ?>';" type="button" id="back_menu_down" style="cursor:pointer;display:none;" class="btn" title="���������" >���������</button>
                               <input name="save_zones" id="save_zones" type="hidden" />
                           </td>
-                          <td width="20"><img <? if( $u->info['lider'] != $u->info['battle'] ) { ?>style="display:none;cursor:pointer;"<? }else{ ?>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" /></td>
-                          <!--<td width="20"><img <? if( $u->info['lider'] != $u->info['battle'] ) { ?>style="display:none;cursor:pointer;"<? }else{ ?>style="cursor:pointer;"<? } ?> onclick="top.leaderFight2();" id="btn_down_img4" style="cursor:pointer;" title="�����" src="https://img.new-combats.com/i/ico_kill_member1.gif" width="16" height="19" /></td>-->
+                          <td width="20"><img <?
+                                              if( $u->info['lider'] != $u->info['battle'] ) { ?>style="display:none;cursor:pointer;" <? }else{ ?>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" /></td>
+                                              <!--<td width="20"><img <?
+                          if( $u->info['lider'] != $u->info['battle'] ) { ?>style="display:none;cursor:pointer;"<? }else{ ?>style="cursor:pointer;"<? } ?> onclick="top.leaderFight2();" id="btn_down_img4" style="cursor:pointer;" title="�����" src="https://img.new-combats.com/i/ico_kill_member1.gif" width="16" height="19" /></td>-->
                           <td width="40"><div align="right"><img onclick="top.smena1();" id="btn_down_img2" style="cursor:pointer;" title="����� ���������� (3)" src="https://img.new-combats.com/i/ico_change.gif" width="16" height="19" />&nbsp;<img src="https://img.new-combats.com/i/ico_refresh.gif" name="btn_down_img1" width="16" height="19" id="btn_down_img1" style="cursor:pointer;" title="��������" onclick="reflesh();" /></div></td>
                         </tr>
                         <tr>
@@ -532,7 +539,8 @@ html, body {
                         </tr>
                       </table>
                     </div>
-                    <? if($u->info['level'] == 0) { ?><hr />
+                    <?
+                    if($u->info['level'] == 0) { ?><hr />
                     <center><font color="#333333"><small>������ ������� <b>�����!!!</b> ����� ������� ��������� ����</small></font></center><hr />
                     <? } ?>
                     </td>
@@ -544,77 +552,85 @@ html, body {
             </tr>
              <tr>
               <td><div style="padding-top:0px;padding-bottom:10px;" align="center">
-                  <table <? if($u->info['level'] < 2) { echo ' style="display:none;" '; } ?> border="0" cellspacing="0" cellpadding="0">
+                  <table <?
+                  if($u->info['level'] < 2) { echo ' style="display:none;" '; } ?> border="0" cellspacing="0" cellpadding="0">
                     <tr>
-                      <td><span title="���������� ����" style="margin-right:11px; font-size:9px;"><img onclick="startHintPriemsBattle()" width="8" height="8" src="https://img.new-combats.com/i/micro/hit.gif" /> <font id="tac1"><? echo 0+$u->info['tactic1']; ?></font></span></td>
-                      <td><span title="����������� ����" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/krit.gif" /> <font id="tac2"><? echo 0+$u->info['tactic2']; ?></font></span></td>
-                      <td><span title="����������� ���������" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/counter.gif" /> <font id="tac3"><? echo 0+$u->info['tactic3']; ?></font></span></td>
-                      <td><span title="�������� ����" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/block.gif" /> <font id="tac4"><? echo 0+$u->info['tactic4']; ?></font></span></td>
-                      <td><span title="�������� �����������" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/parry.gif" /> <font id="tac5"><? echo 0+$u->info['tactic5']; ?></font></span></td>
-                      <td><span title="���������� ����" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/hp.gif" /> <font id="tac6"><? echo 0+floor($u->info['tactic6']); ?></font></span></td>
-                      <td><span title="������� ����" style="margin-right:11px; font-size:9px;"><img width="7" height="8" src="https://img.new-combats.com/i/micro/spirit.gif" /> <font id="tac7"><? if($u->info['tactic7']<0){ $u->info['tactic7'] = 0; } echo 0+$u->info['tactic7']; ?></font></span></td>
-                    </tr>
-                  </table>
-              </div>
-              </td>
+                      <td><span title="���������� ����" style="margin-right:11px; font-size:9px;"><img onclick="startHintPriemsBattle()" width="8" height="8" src="https://img.new-combats.com/i/micro/hit.gif" /> <font id="tac1"><?
+                                  echo 0+$u->info['tactic1']; ?></font></span></td>
+                                  <td><span title="����������� ����" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/krit.gif" /> <font id="tac2"><?
+                                  echo 0+$u->info['tactic2']; ?></font></span></td>
+                                  <td><span title="����������� ���������" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/counter.gif" /> <font id="tac3"><?
+                                  echo 0+$u->info['tactic3']; ?></font></span></td>
+                                  <td><span title="�������� ����" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/block.gif" /> <font id="tac4"><?
+                                  echo 0+$u->info['tactic4']; ?></font></span></td>
+                                  <td><span title="�������� �����������" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/parry.gif" /> <font id="tac5"><?
+                                  echo 0+$u->info['tactic5']; ?></font></span></td>
+                                  <td><span title="���������� ����" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/hp.gif" /> <font id="tac6"><?
+                                  echo 0+floor($u->info['tactic6']); ?></font></span></td>
+                                  <td><span title="������� ����" style="margin-right:11px; font-size:9px;"><img width="7" height="8" src="https://img.new-combats.com/i/micro/spirit.gif" /> <font id="tac7"><?
+                                  if($u->info['tactic7']<0){ $u->info['tactic7'] = 0; }
+                                  echo 0+$u->info['tactic7']; ?></font></span></td>
+                                </tr>
+                              </table>
+                          </div>
+                          </td>
+                          </tr>
+                      </table>
+                      <table border="0" align="center" style="margin-top:-10px;" cellpadding="0" cellspacing="1">
+                            <tr align="center">
+                            <td><div id="priems" style="width:440px;"></div></td>
+                        </tr>
+                        <tr>
+                          <td><div style="display:none;" id="pers_priem" align="center"></div></td>
+                        </tr>
+                      </table>
+                      <hr style="border-color:#333;" />
+                    </div></td>
+                    <td valign="top" width="260" align="right"><div id="player2">
+                      <div align="left"></div>
+                    </div></td>
+                </tr>
+                </table>
+              <div id="allTeams0" align="center"><font id="teams"></font></div>
+                <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                  <tr>
+                    <td width="260" valign="top">&nbsp;</td>
+                    <td valign="top">
+                    <hr />
+                    <div align="center">
+                    <font color="green"><b>�� ������ ������ ���� �������� �����: </b></font><b class="private">&nbsp;<span id="nabito"><?
+                    echo floor($u->info['battle_yron']); ?></span> HP&nbsp;</b><b style="color:blue">.</b><br />
+                    <span style="display:">
+                    <small style="display:none">(����: +<b><span id="expmaybe"><?
+                    echo floor($u->info['battle_exp']); ?></span> ��.</b>, ��� ����� ���������)</small>
+                    </span>
+                    </div>
+                    <hr /></td>
+                    <td width="260" valign="top"><div align="right"><a href="https://new-combats.com/logs.php?log=<?
+                echo $u->info['battle']; ?>" target="blank_">��� ��� ��</a><br />
+                (��� ���� � ��������� <strong id="timer_out">NaN</strong> ���.)</div></td>
               </tr>
-          </table>
-          <table border="0" align="center" style="margin-top:-10px;" cellpadding="0" cellspacing="1">
-				<tr align="center">
-				<td><div id="priems" style="width:440px;"></div></td>
-			</tr>
-            <tr>
-              <td><div style="display:none;" id="pers_priem" align="center"></div></td>
-            </tr>
-          </table>
-          <hr style="border-color:#333;" />
-        </div></td>	
-        <td valign="top" width="260" align="right"><div id="player2">
-          <div align="left"></div>
-        </div></td>
-    </tr>
-    </table>
-  <div id="allTeams0" align="center"><font id="teams"></font></div>
-    <table width="100%" border="0" cellspacing="0" cellpadding="0">
-      <tr>
-        <td width="260" valign="top">&nbsp;</td>
-        <td valign="top">
-        <hr />
-        <div align="center">
-        <font color="green"><b>�� ������ ������ ���� �������� �����: </b></font><b class="private">&nbsp;<span id="nabito"><? echo floor($u->info['battle_yron']); ?></span> HP&nbsp;</b><b style="color:blue">.</b><br />
-        <span style="display:">
-        <small style="display:none">(����: +<b><span id="expmaybe"><? echo floor($u->info['battle_exp']); ?></span> ��.</b>, ��� ����� ���������)</small>
-        </span>
+            </table>
+            <div class="st1222" id="volna"></div>
+            <table width="100%" border="0" cellspacing="0" cellpadding="0">
+              <tr>
+                <td width="260">&nbsp;</td>
+                <td><div style="font-size:12px;" id="battle_logg" align="left"></div><div align="left">������ ������ ���� ��� �������� <a href="https://new-combats.com/logs.php?log=<?
+                echo $u->info['battle']; ?>" target="blank_">����� ��</a></div><br /></td>
+                <td width="260">&nbsp;</td>
+              </tr>
+            </table>
         </div>
-        <hr /></td>
-        <td width="260" valign="top"><div align="right"><a href="https://new-combats.com/logs.php?log=<? echo $u->info['battle']; ?>" target="blank_">��� ��� ��</a><br />
-        (��� ���� � ��������� <strong id="timer_out">NaN</strong> ���.)</div></td>
-      </tr>
-    </table>
-    <div class="st1222" id="volna"></div>
-    <table width="100%" border="0" cellspacing="0" cellpadding="0">
-      <tr>
-        <td width="260">&nbsp;</td>
-        <td><div style="font-size:12px;" id="battle_logg" align="left"></div><div align="left">������ ������ ���� ��� �������� <a href="https://new-combats.com/logs.php?log=<? echo $u->info['battle']; ?>" target="blank_">����� ��</a></div><br /></td>
-        <td width="260">&nbsp;</td>
-      </tr>
-    </table>
-</div>
-<!-- <script type="text/javascript" src="js/chat-engine.js"></script> -->
+        <!-- <script type="text/javascript" src="js/chat-engine.js"></script> -->
 
-<script>
- startCountdown();
- genZoneAtack();
- genZoneBlock();
- refleshPoints();
-</script>
-<?
-include('_incl_data/class/_cron_.php');
-include('_incl_data/class/__battle.php');		
+        <script>
+         startCountdown();
+         genZoneAtack();
+         genZoneBlock();
+         refleshPoints();
+        </script>
+        <?php
+        $priem = new Priems();
+        $btl = new Battle();
 include('jx/battle/refresh1.php'); ?>
 </div>
-<?
-
-}
-
-?>
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.'&nbsp;'; }
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 @@
-<?
-if(!defined('GAME'))
-{
-	die();
+<?php
+if (!defined('GAME')) {
+    die();
 }
 
-if($u->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 = '�������� ��� �����. ���������� ���� : <b>'.$exts.'</b>';
-            }
-        } else {
-            self::$error = '�������� ������ �����. ������������ ������ ����� <b>'.$max_mb.' ��</b>';
-        }
+    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 = '���� � ��������� &quot;'.$cnt['name'].'&quot; ��� ���������������.';
-	}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 = '���� � ��������� &quot;' . $cnt['name'] . '&quot; ��� ���������������.';
+    } 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 = '�� ������� ������ ������ �� ����������� ����� &quot;'.htmlspecialchars($_POST['clan_name'],NULL,'cp1251').'&quot;. ('.$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 = '�� ������� ������ ������ �� ����������� ����� &quot;' . htmlspecialchars(
+                    $_POST['clan_name'], null, 'cp1251'
+                ) . '&quot;. (' . $tr_money2 . '���.)';
+        } else {
+            $re = '��������� ������: ' . Uploader::$error;
+        }
+    }
 }
 
 ?>
-<style>
-body
-{
-	background-color:#E2E2E2;
-	background-image: url(https://img.new-combats.com/i/misc/showitems/dungeon.jpg);
-	background-repeat:no-repeat;background-position:top right;
-}
-</style>
-<table width="100%" border="0" cellspacing="0" cellpadding="0">
-  <tr>
-    <td><div style="padding-left:0px;" align="center">
-      <blockquote>
-        <h3>������ �� ����������� �����</h3>
-      </blockquote>
-    </div>
-        <?
-		if($re != '') {
-			echo '<font style="float:left" color="red"><b>'.$re.'</b></font>';
-		}
-		?>
-    </td>
-    <td width="200"><div align="right">
-      <table cellspacing="0" cellpadding="0">
+    <style>
+        body {
+            background-color: #E2E2E2;
+            background-image: url(https://img.new-combats.com/i/misc/showitems/dungeon.jpg);
+            background-repeat: no-repeat;
+            background-position: top right;
+        }
+    </style>
+    <table width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr>
-          <td width="100%">&nbsp;</td>
-          <td><table  border="0" cellpadding="0" cellspacing="0">
-              <tr align="right" valign="top">
-                <td><!-- -->
-                    <? echo $goLis; ?>
-                    <!-- -->
-                    <table border="0" cellspacing="0" cellpadding="0">
-                      <tr>
-                        <td nowrap="nowrap"><table width="100%"  border="0" cellpadding="0" cellspacing="1" bgcolor="#DEDEDE">
-                            <tr>
-                              <td bgcolor="#D3D3D3"><img src="https://img.new-combats.com/i/move/links.gif" width="9" height="7" /></td>
-                              <td bgcolor="#D3D3D3" nowrap="nowrap"><a href="javascript:void(0)" id="greyText" class="menutop" onClick="location='main.php?loc=1.180.0.11&rnd=<? echo $code; ?>';" title="<? thisInfRm('1.180.0.11',1); ?>">����������� �����</a></td>
-                            </tr>
-                        </table></td>
-                      </tr>
-                  </table></td>
-              </tr>
-          </table></td>
+            <td>
+                <div style="padding-left:0px;" align="center">
+                    <blockquote>
+                        <h3>������ �� ����������� �����</h3>
+                    </blockquote>
+                </div>
+                <?php
+                if ($re != '') {
+                    echo '<font style="float:left" color="red"><b>' . $re . '</b></font>';
+                }
+                ?>
+            </td>
+            <td width="200">
+                <div align="right">
+                    <table cellspacing="0" cellpadding="0">
+                        <tr>
+                            <td width="100%">&nbsp;</td>
+                            <td>
+                                <table border="0" cellpadding="0" cellspacing="0">
+                                    <tr align="right" valign="top">
+                                        <td><!-- -->
+                                            <?php echo $goLis; ?>
+                                            <!-- -->
+                                            <table border="0" cellspacing="0" cellpadding="0">
+                                                <tr>
+                                                    <td nowrap="nowrap">
+                                                        <table width="100%" border="0" cellpadding="0" cellspacing="1"
+                                                               bgcolor="#DEDEDE">
+                                                            <tr>
+                                                                <td bgcolor="#D3D3D3"><img
+                                                                            src="https://img.new-combats.com/i/move/links.gif"
+                                                                            width="9" height="7"/></td>
+                                                                <td bgcolor="#D3D3D3" nowrap="nowrap"><a
+                                                                            href="javascript:void(0)" id="greyText"
+                                                                            class="menutop"
+                                                                            onClick="location='main.php?loc=1.180.0.11&rnd=<?php echo $code; ?>';"
+                                                                            title="<?php thisInfRm(
+                                                                                '1.180.0.11', 1
+                                                                            ); ?>">����������� �����</a></td>
+                                                            </tr>
+                                                        </table>
+                                                    </td>
+                                                </tr>
+                                            </table>
+                                        </td>
+                                    </tr>
+                                </table>
+                            </td>
+                        </tr>
+                    </table>
+                </div>
+            </td>
         </tr>
-      </table>
-      </div></td>
-  </tr>
-</table>
-<?
-if( $u->info['clan'] > 0 ) {
-	$clan = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "'.$u->info['clan'].'" LIMIT 1'));
-?>
-�� ��� �������� � ����� <b><?=$clan['name']?></b> � �� ������ ������ ������ �� ����������� ������ �����.<br><br>
-<fieldset style="line-height:1.5em;border-color:#fff;">  
-	<legend><h3>�������� �����</h3></legend>
-    <?
-	if( $u->info['clan_prava'] == 'glava' ) {
-		echo '��� �� ����� �����, �� �� ������ �������� �!';
-	}else{
-		echo '��� �� ����� �����, �� ��� ����� ����� ����� �������� �!';
-	}
-	?>
-</fieldset>
-<? }else{ ?>
-<table width="100%" border="0" cellspacing="0" cellpadding="10">
-  <tr>
-    <td><p>���������� � ������: ������ (��� � ��������) 24�15, ����������� ��� GIF, ������ �� 30��.</p>
-    <p>    
-   	��������� ����������� ������:<br>
-    <img src="https://img.new-combats.com/i/align/align7.gif" width="12" height="15"> ����������� - 50 ���.<br> 
-    <img src="https://img.new-combats.com/i/align/align1.gif" width="12" height="15"> ������� - 50 ���.<br> 
-    <img src="https://img.new-combats.com/i/align/align3.gif" width="12" height="15"> ����� - 50 ���.<br> 
-    </p>
+    </table>
+<?php
+if ($u->info['clan'] > 0) {
+    $clan = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $u->info['clan'] . '" LIMIT 1'));
+    ?>
+    �� ��� �������� � ����� <b><?= $clan['name'] ?></b> � �� ������ ������ ������ �� ����������� ������ �����.<br><br>
+    <fieldset style="line-height:1.5em;border-color:#fff;">
+        <legend><h3>�������� �����</h3></legend>
+        <?php
+        if ($u->info['clan_prava'] == 'glava') {
+            echo '��� �� ����� �����, �� �� ������ �������� �!';
+        } else {
+            echo '��� �� ����� �����, �� ��� ����� ����� ����� �������� �!';
+        }
+        ?>
+    </fieldset>
+<?php } else { ?>
+    <table width="100%" border="0" cellspacing="0" cellpadding="10">
+        <tr>
+            <td><p>���������� � ������: ������ (��� � ��������) 24�15, ����������� ��� GIF, ������ �� 30��.</p>
+                <p>
+                    ��������� ����������� ������:<br>
+                    <img src="https://img.new-combats.com/i/align/align7.gif" width="12" height="15"> ����������� - 50
+                    ���.<br>
+                    <img src="https://img.new-combats.com/i/align/align1.gif" width="12" height="15"> ������� - 50
+                    ���.<br>
+                    <img src="https://img.new-combats.com/i/align/align3.gif" width="12" height="15"> ����� - 50
+                    ���.<br>
+                </p>
+                <p>
+                    ������ �� ����������� ������ ������� ����� �����, � �������� ������ ���� ��� ���� ����������� �����.
+                </p>
+            </td>
+        </tr>
+        <tr>
+            <td>
+                <form action="main.php?go_psh=1" method="post" enctype="multipart/form-data" name="form1" id="form1">
+                    <fieldset style="line-height:1.5em;border-color:#fff;">
+                        <legend><h3>������ �� ����������� �����</h3>
+                        </legend>
+                        <?php if (!isset($lzv['id'])) { ?>
+                            �������� ����� (������ ���������� ����� ��� �����, ���� �����):
+                            <input class="rd4" name="clan_name" type="text" value="" size="50" maxlength="50"/>
+                            <br/>
+                            ���� ���� (������������� ������ https://new-combats.com/):
+                            <input class="rd4" name="clan_site" type="text" value="https://new-combats.com/" size="50"
+                                   maxlength="50"/>
+                            <br/>
+                            ������
+                            <input type="file" name="clan_img1" id="clan_img1"/>
+                            <br/>
+                            ���������� �����
+                            <select class="rd4" name="clan_align">
+                                <option value="7">����������� (50 ���.)</option>
+                                <option value="3">������ (50 ���.)</option>
+                                <option value="1">������� (50 ���.)</option>
+                            </select>
+                            <br/>
+                            <input type="submit" name="button" id="button" class="btn" value="������ ������"/>
+                        <?php } else { ?>
+                            <?= date(
+                                'd.m.Y H:i', $lzv['time']
+                            ) ?> &nbsp; &nbsp; �� ��� ������ ������ �� ����������� ����� &quot;
+                            <b><?= $lzv['name'] ?></b>&quot;. �������� ������ �� �������������.
+                        <?php } ?>
+                    </fieldset>
+                </form>
+            </td>
+            <td>
+                <form action="main.php?go_psh=1" method="post" enctype="multipart/form-data" name="form2" id="form1">
+                    <fieldset style="line-height:1.5em;border-color:#fff;">
+                        <legend><h3>������ �� ���������� � ����</h3> <!--���--></legend>
+                        <?php
+                        $clnt = mysql_fetch_array(
+                            mysql_query('SELECT `clan_zv` FROM `users` WHERE `id` = "' . $u->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 . '<br>';
+                            echo '�������� ������������ ����� ������. ���� ������� ����� ��� ������ �������� �� ������ ������ ����.<br>';
+                        }
+                        ?>
+                        �������� ����:
+                        <br>
+                        <select class="rd4" name="clan_enter">
+                            <?php
+                            $sp = mysql_query('SELECT * FROM `clan` WHERE 1 ORDER BY `clan`.`exp` DESC');
+                            while ($pl = mysql_fetch_array($sp)) {
+
+                                echo '<option name="' . $pl['id'] . '" value="' . $pl['id'] . '">' . $pl['name'] . ' ' . alignc(
+                                        $pl['align']
+                                    ) . '</option>';
+                            }
+
+                            ?>
+                        </select>
+                        <br/><br/>
+                        <input type="submit" name="button2" id="button" class="btn" value="������ ������"/>
+                    </fieldset>
+                </form>
+            </td>
+        </tr>
+    </table>
+    <p>����������:</p>
     <p>
-    ������ �� ����������� ������ ������� ����� �����, � �������� ������ ���� ��� ���� ����������� �����.
+        ��� ������ ������ � ��� ��������� ����� ����������� ��� ����������� �����.<br>
+        � ������ ������ � ����������� ����� (�� ����� �������), ����������� ������������ ���������.<br>
+        ������������� ������ �������� � ����������� ��� ���������� ������.<br>
+        <b>��� ����������� �����, ����� ����� � ������� 60 ���� �� ����� ����� ���������� ��� ���������� �������
+            ������.</b>
     </p>
-    </td>
-  </tr>
-  <tr>
-    <td>
-	<form action="main.php?go_psh=1" method="post" enctype="multipart/form-data" name="form1" id="form1">
-      <fieldset style="line-height:1.5em;border-color:#fff;">  
-        <legend><h3>������ �� ����������� �����</h3>
-        </legend>
-        <? if(!isset($lzv['id'])) { ?>
-        �������� ����� (������ ���������� ����� ��� �����, ���� �����): 
-        <input class="rd4" name="clan_name" type="text" value="" size="50" maxlength="50" />
-        <br />
-        ���� ���� (������������� ������ https://new-combats.com/): 
-        <input class="rd4" name="clan_site" type="text" value="https://new-combats.com/" size="50" maxlength="50" />
-        <br />
-        ������ 
-        <input type="file" name="clan_img1" id="clan_img1" />
-        <br />
-        ���������� ����� 
-        <select class="rd4" name="clan_align">
-          <option value="7">����������� (50 ���.)</option>
-          <option value="3">������ (50 ���.)</option>
-          <option value="1">������� (50 ���.)</option>
-        </select>
-        <br />
-        <input type="submit" name="button" id="button" class="btn" value="������ ������" />
-        <? }else{ ?>
-        <?=date('d.m.Y H:i',$lzv['time'])?> &nbsp; &nbsp; �� ��� ������ ������ �� ����������� ����� &quot;<b><?=$lzv['name']?></b>&quot;. �������� ������ �� �������������.
-        <? } ?>
-      </fieldset>
-    </form>
-	</td>
-	<td>
-	<form action="main.php?go_psh=1" method="post" enctype="multipart/form-data" name="form2" id="form1">
-      <fieldset style="line-height:1.5em;border-color:#fff;">  
-        <legend><h3>������ �� ���������� � ����</h3> <!--���--></legend>
-		<?
-			$clnt = mysql_fetch_array(mysql_query('SELECT `clan_zv` FROM `users` WHERE `id` = "'.$u->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.'<br>';
-				echo '�������� ������������ ����� ������. ���� ������� ����� ��� ������ �������� �� ������ ������ ����.<br>';
-			}
-		?>
-        �������� ����: 
-        <br>
-		<select class="rd4" name="clan_enter">
-          <?
-		    $sp = mysql_query('SELECT * FROM `clan` WHERE 1 ORDER BY `clan`.`exp` DESC');
-			while($pl = mysql_fetch_array($sp)) 
-			{
-				
-				echo '<option name="'.$pl['id'].'" value="'.$pl['id'].'">'.$pl['name'].' '.alignc($pl['align']).'</option>';
-			}
-		  
-		  ?>
-		</select>
-        <br /><br />
-        <input type="submit" name="button2" id="button" class="btn" value="������ ������" />
-      </fieldset>
-    </form>
-	</td>
-  </tr>
-</table>
-<p>����������:</p>
-<p>
-��� ������ ������ � ��� ��������� ����� ����������� ��� ����������� �����.<br>
-� ������ ������ � ����������� ����� (�� ����� �������), ����������� ������������ ���������.<br>
-������������� ������ �������� � ����������� ��� ���������� ������.<br>
-<b>��� ����������� �����, ����� ����� � ������� 60 ���� �� ����� ����� ���������� ��� ���������� ������� ������.</b>
-</p>
-	<? } ?>
-<? } ?>
\ No newline at end of file
+<?php } ?>
\ 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 @@
 <?php
-if(!defined('GAME'))
-{
- die();
+if (!defined('GAME')) {
+    die();
 }
 
-if($u->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 '<font color="red"><b>�� �� ������ ������ ����� ����� ���� ��������� ������ &quot;������� �����&quot;</b></font>';
-		}
-	}else{
-		echo '<font color="red"><b>�� �� ������ ������ �����... ��������� ������ ������� � �����!</b></font>';
-	}
+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 '<b style="color: red">�� �� ������ ������ �����... ��������� ������ ������� � �����!</b>';
+    } 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 '<b style="color: red">�� �� ������ ������ ����� ����� ���� ��������� ������ &quot;������� �����&quot;</b>';
+        } elseif (!isset($zv)) {
+            $zv = new FightRequest();
+        }
+    }
 }
-
 ?>
-	<style type="text/css"> 
-	body
-	{
-		/*background-color:#E2E2E2;*/
-		background-image: url(https://img.new-combats.com/p_portal23.jpg);
-		background-repeat:no-repeat;background-position:top right;
-	}
-	.pH3			{ COLOR: #8f0000;  FONT-FAMILY: Arial;  FONT-SIZE: 12pt;  FONT-WEIGHT: bold; }
-	.class_ {
-		font-weight: bold;
-		color: #C5C5C5;
-		cursor:pointer;
-	}
-	.class_st {
-		font-weight: bold;
-		color: #659BA3;
-		cursor:pointer;
-	}
-	.class__ {
-		font-weight: bold;
-		color: #FFFFFF;
-		cursor:pointer;
-		background-color: #659BA3;
-	}
-	.class__st {
-		font-weight: bold;
-		color: #FFFFFF;
-		cursor:pointer;
-		background-color: #659BA3;
-		font-size: 10px;
-	}
-	.class_old {
-		font-weight: bold;
-		color: #919191;
-		cursor:pointer;
-	}
-	.class__old {
-		font-weight: bold;
-		color: #FFFFFF;
-		cursor:pointer;
-		background-color: #838383;
-		font-size: 10px;
-	}
-	
-	</style>
-	<div align="right"><? if($re!=''){ echo '<font color="red"><b>'.$re.'</b></font>'; } ?></div>
-	<div id="hint3" style="visibility:hidden"></div>
-	<TABLE style="" width="100%" cellspacing="0" cellpadding="0">
-	<tr><td valign="top"><div align="center" class="pH3">����� �����</div>
-	<td width="280" valign="top"><table cellspacing="0" cellpadding="0">
-		<tr>
-		  <td width="100%">&nbsp;</td>
-		  <td><table  border="0" cellpadding="0" cellspacing="0">
-			  <tr align="right" valign="top">
-				<td><!-- -->
-					<? echo $goLis; ?>
-					<!-- -->
-					<table border="0" cellspacing="0" cellpadding="0">
-					  <tr>
-						<td nowrap="nowrap"><table width="100%"  border="0" cellpadding="0" cellspacing="1" bgcolor="#DEDEDE">
-							<tr>
-							  <td bgcolor="#D3D3D3"><img src="https://img.new-combats.com/i/move/links.gif" width="9" height="7" /></td>
-							  <td bgcolor="#D3D3D3" nowrap="nowrap"><a href="#" id="greyText" class="menutop" onclick="location='main.php?loc=3.180.0.353&rnd=<? echo $code; ?>';" title="<? thisInfRm('3.180.0.353',1); ?>">����� ����� - 16</a></td>
-							</tr>
-							<tr>
-							  <td bgcolor="#D3D3D3"><img src="https://img.new-combats.com/i/move/links.gif" width="9" height="7" /></td>
-							  <td bgcolor="#D3D3D3" nowrap="nowrap"><a href="#" id="greyText" class="menutop" onclick="location='main.php?loc=3.180.0.270&rnd=<? echo $code; ?>';" title="<? thisInfRm('3.180.0.270',1); ?>">������� ������</a></td>
-							</tr>
-						</table></td>
-					  </tr>					  <tr>
-						<td nowrap="nowrap">&nbsp;</td>
-					  </tr>
-				  </table></td>
-			  </tr>
-		  </table></td>
-		</tr>
-	  </table>
-		<br />
-	<center></center></td>
-	</table>
-	<div id="textgo" style="visibility:hidden;"></div>
+    <style type="text/css">
+    body {
+        background-image: url(https://img.new-combats.com/p_portal23.jpg);
+        background-repeat: no-repeat;
+        background-position: top right;
+    }
+
+    .pH3 {
+        COLOR: #8f0000;
+        FONT-FAMILY: Arial, serif;
+        FONT-SIZE: 12pt;
+        FONT-WEIGHT: bold;
+    }
+
+    .class_ {
+        font-weight: bold;
+        color: #C5C5C5;
+        cursor: pointer;
+    }
+
+    .class_st {
+        font-weight: bold;
+        color: #659BA3;
+        cursor: pointer;
+    }
+
+    .class__ {
+        font-weight: bold;
+        color: #FFFFFF;
+        cursor: pointer;
+        background-color: #659BA3;
+    }
+
+    .class__st {
+        font-weight: bold;
+        color: #FFFFFF;
+        cursor: pointer;
+        background-color: #659BA3;
+        font-size: 10px;
+    }
+
+    .class_old {
+        font-weight: bold;
+        color: #919191;
+        cursor: pointer;
+    }
+
+    .class__old {
+        font-weight: bold;
+        color: #FFFFFF;
+        cursor: pointer;
+        background-color: #838383;
+        font-size: 10px;
+    }
+
+</style>
+<div style="text-align: right"><?php if (!empty($re)) {
+        echo '<b style="color: red">' . $re . '</b>';
+    } ?></div>
+<div id="hint3" style="visibility:hidden"></div>
+<TABLE style="" width="100%" cellspacing="0" cellpadding="0">
+    <tr>
+        <td valign="top">
+            <div align="center" class="pH3">����� �����</div>
+        <td width="280" valign="top">
+            <table cellspacing="0" cellpadding="0">
+                <tr>
+                    <td width="100%">&nbsp;</td>
+                    <td>
+                        <table border="0" cellpadding="0" cellspacing="0">
+                            <tr align="right" valign="top">
+                                <td><!-- -->
+                                    <?= $goLis; ?>
+                                        <!-- -->
+                                    <table border="0" cellspacing="0" cellpadding="0">
+                                        <tr>
+                                            <td nowrap="nowrap">
+                                                <table width="100%" border="0" cellpadding="0" cellspacing="1"
+                                                       bgcolor="#DEDEDE">
+                                                    <tr>
+                                                        <td bgcolor="#D3D3D3"><img
+                                                                    src="https://img.new-combats.com/i/move/links.gif"
+                                                                    width="9" height="7"/></td>
+                                                        <td bgcolor="#D3D3D3" nowrap="nowrap"><a href="#"
+                                                                                                 id="greyText"
+                                                                                                 class="menutop"
+                                                                                                 onclick="location='main.php?loc=3.180.0.353&rnd=<?= $code; ?>';"
+                                                                                                 title="<?php thisInfRm('3.180.0.353', 1); ?>">�����
+                                                                ����� - 16</a></td>
+                                                    </tr>
+                                                    <tr>
+                                                        <td bgcolor="#D3D3D3"><img
+                                                                    src="https://img.new-combats.com/i/move/links.gif"
+                                                                    width="9" height="7"/></td>
+                                                        <td bgcolor="#D3D3D3" nowrap="nowrap"><a href="#"
+                                                                                                 id="greyText"
+                                                                                                 class="menutop"
+                                                                                                 onclick="location='main.php?loc=3.180.0.270&rnd=<?= $code; ?>';"
+                                                                                                 title="<?php thisInfRm('3.180.0.270', 1); ?>">�������
+                                                                ������</a></td>
+                                                    </tr>
+                                                </table>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td nowrap="nowrap">&nbsp;</td>
+                                        </tr>
+                                    </table>
+                                </td>
+                            </tr>
+                        </table>
+                    </td>
+                </tr>
+            </table>
+            <br/>
+        </td>
+</table>
+<div id="textgo" style="visibility:hidden;"></div>
 <FORM method="post">
-    <input checked="checked" type="radio" name="level" value="8" <? if($u->info['level']<7){ echo 'disabled'; } ?>>
-    ������ � ����� ����� (<a href="breakchaos.php?level=8" target="_blank">���������� �������</a>)<br/>
-    <!--<input type="radio" name="level" value="9" <? if($u->info['level']<7){ echo 'disabled'; } ?>>
-    ������ ��� ������� (<a href="breakchaos.php?level=9" target="_blank">���������� �������</a>)<br/>
-    <input type="radio" name="level" value="10" <? if($u->info['level']<7){ echo 'disabled'; } ?>>
-    ������ ��� �������������� (<a href="breakchaos.php?level=10" target="_blank">���������� �������</a>)<br/>
-    <input type="radio" name="level" value="11" <? if($u->info['level']<7){ echo 'disabled'; } ?>>
-    ������ ��� ������� (<a href="breakchaos.php?level=11" target="_blank">���������� �������</a>)--><br/><br/> 
-    <INPUT type='submit' value='������ �����'>
-</FORM>	
-  <!--<p><b>������� ������� &laquo;����� �����&raquo;:</b><br />--><?
- /*- $i = 0; $sp = mysql_query('SELECT * FROM `izlom_rating` ORDER BY `voln` DESC LIMIT 50');
-  $uidz = array();
-  while($pl = mysql_fetch_array($sp))
-  {
-	  if(!isset($uidz[$pl['uid']]))
-	  {
-	  	$i++; $uidz[$pl['uid']] = $i;
-	  	$text .= $i.'. <span class="date">'.date('d.m.Y H:i',$pl['time']).'</span>, �����: <b>'.$pl['voln'].'</b>, '.$u->microLogin($pl['uid'],1).'<br>';
-	  }
-  }-*/
-  /*if(!isset($text))
-  {
-	 $text = '������� �����, ������ ����� �� ������� ����������...'; 
-  }
-  echo $text;
-  unset($text);*/
-  echo '</p>';
-  ?>				  
-<?
-}
-?>
\ No newline at end of file
+    <label>
+        <input checked="checked" type="radio" name="level" value="8" <?php if ($u->info['level'] < 7) {
+            echo 'disabled';
+        } ?>>
+        ������ � ����� ����� (<a href="breakchaos.php?level=8" target="_blank">���������� �������</a>)
+    </label>
+    <p><INPUT type='submit' value='������ �����'></p>
+</FORM>
diff --git a/modules_data/location/bank.php b/modules_data/location/bank.php
index 3bb4aeb0..c80ee5eb 100644
--- a/modules_data/location/bank.php
+++ b/modules_data/location/bank.php
@@ -44,11 +44,24 @@ if ($u->room['file'] == 'bank') {
 
     $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'));
+        $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'));
+            $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 {
@@ -58,29 +71,59 @@ if ($u->room['file'] == 'bank') {
                     $pp = [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']) . '")');
+                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 '<script>setTimeout(function(){alert("��� ��������� ������������ �������� ����� �� ' . date('d.m.y H:i', $u->info['allLock']) . '")},250);</script>';
+                echo '<script>setTimeout(function(){alert("��� ��������� ������������ �������� ����� �� ' . date(
+                        'd.m.y H:i', $u->info['allLock']
+                    ) . '")},250);</script>';
             } 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']) . '")');
+                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'])) {
-        $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'));
+        $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']) . '")');
+            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');
+            mysql_query(
+                'UPDATE `bank` SET `repass` = "' . (time(
+                    ) + 24 * 3600) . '" WHERE `id` = "' . $b_pass['id'] . '" LIMIT 1'
+            );
             $subject = '�������������� ������ �� ����� � ����� ��������� ' . $u->info['login'];
             $message = '����� �����: ' . getNum($b_pass['id']) . '<br>������: ' . $b_pass['pass'] .
                 '<br><br>� ���������,<br>������������� ����������� �����';
@@ -100,7 +143,10 @@ if ($u->room['file'] == 'bank') {
             } 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() . '","' . mysql_real_escape_string($pass) . '")');
+                $ins = mysql_query(
+                    'INSERT INTO `bank` (`uid`,`create`,`pass`) VALUES ("' . $u->info['id'] . '","' . time(
+                    ) . '","' . mysql_real_escape_string($pass) . '")'
+                );
                 if ($ins) {
                     $bank = mysql_insert_id();
                     if ($u->info['level'] < 8 && $_POST['rdn01'] == 2 && $c['zuby'] == true) {
@@ -108,9 +154,16 @@ if ($u->room['file'] == 'bank') {
                     } 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 = '���� �<b>' . getNum($bank) . '</b> ��� ������� ������.<br>������ �� �����: <b>' . $pass . '</b><br><small><br>(������� ������ ����� � ������� "���������� ������" ����� �����������)';
-                    $u->addDelo(3, $u->info['id'], '�� ������� ������� ���� �' . getNum($bank) . '', time(), $u->info['city'], 'Bank.System', 3, 0, '');
+                    $upd = mysql_query(
+                        'UPDATE `users` SET `money` = "' . $u->info['money'] . '",`money4` = "' . $u->info['money4'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
+                    );
+                    $re2 = '���� �<b>' . getNum(
+                            $bank
+                        ) . '</b> ��� ������� ������.<br>������ �� �����: <b>' . $pass . '</b><br><small><br>(������� ������ ����� � ������� "���������� ������" ����� �����������)';
+                    $u->addDelo(
+                        3, $u->info['id'], '�� ������� ������� ���� �' . getNum($bank) . '', time(), $u->info['city'],
+                        'Bank.System', 3, 0, ''
+                    );
                 } else {
                     $re2 = '���� ������� � ��������� ����������� �����.';
                 }
@@ -126,7 +179,9 @@ if ($u->room['file'] == 'bank') {
         }
     } 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');
+        mysql_query(
+            'UPDATE `bank` SET `useNow` = "0" WHERE `uid` = "' . $u->info['id'] . '" AND `useNow`!="0" LIMIT 1'
+        );
     }
 
     if ($u->info['allLock'] > time()) {
@@ -137,9 +192,21 @@ if ($u->room['file'] == 'bank') {
         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'));
+                $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'));
+                    $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);
@@ -149,29 +216,67 @@ if ($u->room['file'] == 'bank') {
                             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');
+                                $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 `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 = '�� ������ �������� <b>' . ($mn - $prc) . ' ���.</b> (�������� <b>' . $prc . ' ���.</b>) �� ���� �' . getNum($ub['id']) . ' ��������� &quot;<b>' . $ut['login'] . '</b>&quot;';
-                                    $u->addDelo(3, $ut['id'], '�������� <b>' . ($mn - $prc) . ' ���.</b> �� ����� �' . getNum($u->bank['id']) . ' �� ��������� &quot;' . $u->info['login'] . '&quot;, �������� <b>' . $prc . ' ���.</b> <i>(�����: ' . $ub['money1'] . ' ��., ' . $ub['money2'] . ' ���.)</i>', time(), $ut['city'], 'Bank.System', mysql_real_escape_string($mn - $prc), 0, $ub['id']);
-                                    $u->addDelo(3, $u->info['id'], '�������� <b>' . ($mn - $prc) . ' ���.</b> �� ���� �' . getNum($ub['id']) . ' ��������� &quot;' . $ut['login'] . '&quot;, �������� <b>' . $prc . ' ���.</b> <i>(�����: ' . $u->bank['money1'] . ' ��., ' . $u->bank['money2'] . ' ���.)</i>', time(), $u->info['city'], 'Bank.System', 0, mysql_real_escape_string($mn), $u->bank['id']);
+                                    mysql_query(
+                                        'UPDATE `bank` SET `money2` = "' . mysql_real_escape_string(
+                                            $ub['money2']
+                                        ) . '" WHERE `id` = "' . $ub['id'] . '" LIMIT 1'
+                                    );
+                                    $re2 = '�� ������ �������� <b>' . ($mn - $prc) . ' ���.</b> (�������� <b>' . $prc . ' ���.</b>) �� ���� �' . getNum(
+                                            $ub['id']
+                                        ) . ' ��������� &quot;<b>' . $ut['login'] . '</b>&quot;';
+                                    $u->addDelo(
+                                        3, $ut['id'], '�������� <b>' . ($mn - $prc) . ' ���.</b> �� ����� �' . getNum(
+                                             $u->bank['id']
+                                         ) . ' �� ��������� &quot;' . $u->info['login'] . '&quot;, �������� <b>' . $prc . ' ���.</b> <i>(�����: ' . $ub['money1'] . ' ��., ' . $ub['money2'] . ' ���.)</i>',
+                                        time(), $ut['city'], 'Bank.System', mysql_real_escape_string($mn - $prc), 0,
+                                        $ub['id']
+                                    );
+                                    $u->addDelo(
+                                        3, $u->info['id'],
+                                        '�������� <b>' . ($mn - $prc) . ' ���.</b> �� ���� �' . getNum(
+                                            $ub['id']
+                                        ) . ' ��������� &quot;' . $ut['login'] . '&quot;, �������� <b>' . $prc . ' ���.</b> <i>(�����: ' . $u->bank['money1'] . ' ��., ' . $u->bank['money2'] . ' ���.)</i>',
+                                        time(), $u->info['city'], 'Bank.System', 0, mysql_real_escape_string($mn),
+                                        $u->bank['id']
+                                    );
                                     $log = '&quot;' . $u->info['login'] . '&quot;&nbsp;[' . $u->info['level'] . '] ������� �� ������ ����������� ����� �' . $u->bank['id'] . ' �� ���� �' . $ub['id'] . ' � ��������� &quot;' . $ut['login'] . '&quot;&nbsp;[' . $ut['level'] . '] ' . ($mn - $prc) . ' ���.';
-                                    $u->addDelo(1, $u->info['id'], $log, time(), $u->info['city'], 'Bank.System', 0, 0, '');
+                                    $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 = '<img src=https://img.new-combats.com/i/align/align50.gif >';
                                         }
-                                        $text = '&quot;' . $alg . '[login:' . $u->info['login'] . ']&quot; �������' . ($u->info['sex'] == 0 ? "" : "�") . ' ��� <b>' . ($mn - $prc) . ' ���.</b> �� ������ ����������� ����� �' . getNum($u->bank['id']) . ' �� ��� ���������� ���� �' . getNum($ub['id']) . '.';
+                                        $text = '&quot;' . $alg . '[login:' . $u->info['login'] . ']&quot; �������' . ($u->info['sex'] == 0 ? "" : "�") . ' ��� <b>' . ($mn - $prc) . ' ���.</b> �� ������ ����������� ����� �' . 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')");
+                                        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 = '�� ������� ��������� ��������';
@@ -189,9 +294,21 @@ if ($u->room['file'] == 'bank') {
             } 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'));
+                    $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'));
+                        $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);
@@ -201,20 +318,51 @@ if ($u->room['file'] == 'bank') {
                                 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');
+                                    $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 = '�� ������ �������� <b>' . ($mn - $prc) . ' ��.</b> (�������� <b>' . $prc . ' ��.</b>) �� ���� �' . getNum($ub['id']) . ' ��������� &quot;<b>' . $ut['login'] . '</b>&quot;';
-                                        $u->addDelo(3, $ut['id'], '�������� <b>' . ($mn - $prc) . ' ��.</b> �� ����� �' . getNum($u->bank['id']) . ' �� ��������� &quot;' . $u->info['login'] . '&quot;, �������� <b>' . $prc . ' ��.</b> <i>(�����: ' . $ub['money1'] . ' ��., ' . $ub['money2'] . ' ���.)</i>', time(), $ut['city'], 'Bank.System', mysql_real_escape_string($mn - $prc), 0, $ub['id']);
-                                        $u->addDelo(3, $u->info['id'], '�������� <b>' . ($mn - $prc) . ' ��.</b> �� ���� �' . getNum($ub['id']) . ' ��������� &quot;' . $ut['login'] . '&quot;, �������� <b>' . $prc . ' ��.</b> <i>(�����: ' . $u->bank['money1'] . ' ��., ' . $u->bank['money2'] . ' ���.)</i>', time(), $u->info['city'], 'Bank.System', 0, mysql_real_escape_string($mn), $u->bank['id']);
+                                        mysql_query(
+                                            'UPDATE `bank` SET `money1` = "' . mysql_real_escape_string(
+                                                $ub['money1']
+                                            ) . '" WHERE `id` = "' . $ub['id'] . '" LIMIT 1'
+                                        );
+                                        $re2 = '�� ������ �������� <b>' . ($mn - $prc) . ' ��.</b> (�������� <b>' . $prc . ' ��.</b>) �� ���� �' . getNum(
+                                                $ub['id']
+                                            ) . ' ��������� &quot;<b>' . $ut['login'] . '</b>&quot;';
+                                        $u->addDelo(
+                                            3, $ut['id'],
+                                            '�������� <b>' . ($mn - $prc) . ' ��.</b> �� ����� �' . getNum(
+                                                $u->bank['id']
+                                            ) . ' �� ��������� &quot;' . $u->info['login'] . '&quot;, �������� <b>' . $prc . ' ��.</b> <i>(�����: ' . $ub['money1'] . ' ��., ' . $ub['money2'] . ' ���.)</i>',
+                                            time(), $ut['city'], 'Bank.System', mysql_real_escape_string($mn - $prc), 0,
+                                            $ub['id']
+                                        );
+                                        $u->addDelo(
+                                            3, $u->info['id'],
+                                            '�������� <b>' . ($mn - $prc) . ' ��.</b> �� ���� �' . getNum(
+                                                $ub['id']
+                                            ) . ' ��������� &quot;' . $ut['login'] . '&quot;, �������� <b>' . $prc . ' ��.</b> <i>(�����: ' . $u->bank['money1'] . ' ��., ' . $u->bank['money2'] . ' ���.)</i>',
+                                            time(), $u->info['city'], 'Bank.System', 0, mysql_real_escape_string($mn),
+                                            $u->bank['id']
+                                        );
                                         $log = '&quot;' . $u->info['login'] . '&quot;&nbsp;[' . $u->info['level'] . '] ������� �� ������ ����������� ����� �' . $u->bank['id'] . ' �� ���� �' . $ub['id'] . ' � ��������� &quot;' . $ut['login'] . '&quot;&nbsp;[' . $ut['level'] . '] ' . ($mn - $prc) . ' ��. ������������� ����� ' . $prc . ' ��. �� ������ �����.';
-                                        $u->addDelo(1, $u->info['id'], $log, time(), $u->info['city'], 'Bank.System', 0, 0, '');
+                                        $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 = '&quot;[login:' . $u->info['login'] . ']&quot; �������' . ($u->info['sex'] == 0 ? "" : "�") . ' ��� <b>' . ($mn - $prc) . ' ��.</b> �� ������ ����������� ����� �' . 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')");
+                                            $text = '&quot;[login:' . $u->info['login'] . ']&quot; �������' . ($u->info['sex'] == 0 ? "" : "�") . ' ��� <b>' . ($mn - $prc) . ' ��.</b> �� ������ ����������� ����� �' . 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 = '�� ������� ��������� ��������';
@@ -232,18 +380,25 @@ if ($u->room['file'] == 'bank') {
                 } 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) {
+            } 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 = $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 = '�� ������� �� ������ �������� ��� �� <b>' . ($sm_lim - $sm['vals']) . ' ���.</b>. (�������� ' . round((($sm_lim - $sm['vals']) * $noc), 2) . ' ��.), ������� ����� �� <b>' . $mne . ' ���.</b>.';
+                            $re2 = '�� ������� �� ������ �������� ��� �� <b>' . ($sm_lim - $sm['vals']) . ' ���.</b>. (�������� ' . round(
+                                    (($sm_lim - $sm['vals']) * $noc), 2
+                                ) . ' ��.), ������� ����� �� <b>' . $mne . ' ���.</b>.';
                         } else {
                             $re2 = '�� ������� �� ��������� ���� ����� ������ ��. �� ���. (' . $sm_lim . ' ���.)';
                         }
@@ -252,23 +407,46 @@ if ($u->room['file'] == 'bank') {
                             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');
+                                mysql_query(
+                                    'UPDATE `actions` SET `vals` = "' . ($sm['vals'] + $mne) . '" WHERE `id` = "' . $sm['id'] . '" LIMIT 1'
+                                );
                             }
                             $re2 = '�� ������� �������� <b>' . $mn . ' ��.</b> �� <b>' . $mne . ' ���.</b>';
                             $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 `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');
+                            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 = '&quot;' . $u->info['login'] . '&quot;&nbsp;[' . $u->info['level'] . '] ������� <b>' . $mn . ' ��.</b> �� <b>' . $mne . ' ���.</b>, ���������� ���� �' . $u->bank['id'] . '.';
                             $u->addDelo(1, $u->info['id'], $log, time(), $u->info['city'], 'Bank.System', 0, 0, '');
-                            $u->addDelo(3, $u->info['id'], '�� ������� �������� <b>' . ceil((int)($_POST['convert_sum2'] * 100 / 100)) . ' ��.</b> �� <b>' . $mne . ' ���.</b>, �������� <b>' . round((ceil((int)($_POST['convert_sum2'] * 100 / 100)) / 100 * 3 + 5), 2) . ' ��.</b> <i>(�����: ' . $u->bank['money1'] . ' ��., ' . $u->bank['money2'] . ' ���.)</i>', time(), $u->info['city'], 'Bank.System', 0, 0, $u->bank['id']);
+                            $u->addDelo(
+                                3, $u->info['id'], '�� ������� �������� <b>' . ceil(
+                                     (int)($_POST['convert_sum2'] * 100 / 100)
+                                 ) . ' ��.</b> �� <b>' . $mne . ' ���.</b>, �������� <b>' . round(
+                                     (ceil((int)($_POST['convert_sum2'] * 100 / 100)) / 100 * 3 + 5), 2
+                                 ) . ' ��.</b> <i>(�����: ' . $u->bank['money1'] . ' ��., ' . $u->bank['money2'] . ' ���.)</i>',
+                                time(), $u->info['city'], 'Bank.System', 0, 0, $u->bank['id']
+                            );
                         } else {
                             $re2 = '� ��� ��� <b>' . $mn . ' ��.</b> �� �����';
                         }
                     } else {
-                        $re2 = '����������� ����� ��� ������ ���������� ' . round((0.01 * ($noc * 1.03) + 5), 2) . ' ��.';
+                        $re2 = '����������� ����� ��� ������ ���������� ' . round(
+                                (0.01 * ($noc * 1.03) + 5), 2
+                            ) . ' ��.';
                     }
                 } else {
                     $re2 = '�� ������ ������ �������� �� ������� � ��������� ��� ��������.';
@@ -281,11 +459,22 @@ if ($u->room['file'] == 'bank') {
                     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');
+                        $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'], '�� �������� <b>' . $mn . ' ���.</b> �� <b>' . ($mn * $con) . ' ��.</b>, �������� <b>0 ��.</b> <i>(�����: ' . $u->bank['money1'] . ' ��., ' . $u->bank['money2'] . ' ���.)</i>', time(), $u->info['city'], 'Bank.System', 0, mysql_real_escape_string($mn * $con), $u->bank['id']);
+                            $u->addDelo(
+                                3, $u->info['id'],
+                                '�� �������� <b>' . $mn . ' ���.</b> �� <b>' . ($mn * $con) . ' ��.</b>, �������� <b>0 ��.</b> <i>(�����: ' . $u->bank['money1'] . ' ��., ' . $u->bank['money2'] . ' ���.)</i>',
+                                time(), $u->info['city'], 'Bank.System', 0, mysql_real_escape_string($mn * $con),
+                                $u->bank['id']
+                            );
                             $re2 = '�� ������ �������� <b>' . $mn . ' ���.</b> �� <b>' . ($mn * $con) . ' ��.</b>';
                         } else {
                             $re2 = '�� ������� ��������� ��������';
@@ -302,12 +491,24 @@ if ($u->room['file'] == 'bank') {
                     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');
+                        $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'], '�� ����� �� ����� <b>' . $mn . ' ��.</b>, �������� <b>0 ��.</b> <i>(�����: ' . $u->bank['money1'] . ' ��., ' . $u->bank['money2'] . ' ���.)</i>', time(), $u->info['city'], 'Bank.System', 0, 0, $u->bank['id']);
+                            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'],
+                                '�� ����� �� ����� <b>' . $mn . ' ��.</b>, �������� <b>0 ��.</b> <i>(�����: ' . $u->bank['money1'] . ' ��., ' . $u->bank['money2'] . ' ���.)</i>',
+                                time(), $u->info['city'], 'Bank.System', 0, 0, $u->bank['id']
+                            );
                             $re2 = '�� ������ ����� �� ����� <b>' . $mn . ' ��.</b>';
                         } else {
                             $re2 = '�� ������� ��������� ��������';
@@ -324,12 +525,24 @@ if ($u->room['file'] == 'bank') {
                     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');
+                        $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'], '�� ����� �� ����� <b>' . $mn . ' ���.</b>, �������� <b>0 ���.</b> <i>(�����: ' . $u->bank['money1'] . ' ��., ' . $u->bank['money2'] . ' ���.)</i>', time(), $u->info['city'], 'Bank.System', 0, 0, $u->bank['id']);
+                            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'],
+                                '�� ����� �� ����� <b>' . $mn . ' ���.</b>, �������� <b>0 ���.</b> <i>(�����: ' . $u->bank['money1'] . ' ��., ' . $u->bank['money2'] . ' ���.)</i>',
+                                time(), $u->info['city'], 'Bank.System', 0, 0, $u->bank['id']
+                            );
                             $re2 = '�� ������ ����� �� ����� <b>' . $mn . ' ���.</b>';
                         } else {
                             $re2 = '�� ������� ��������� ��������';
@@ -346,12 +559,24 @@ if ($u->room['file'] == 'bank') {
                     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');
+                        $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'], '�� �������� �� ���� <b>' . $mn . ' E��.</b>, �������� <b>0 ���.</b> <i>(�����: ' . $u->bank['money1'] . ' ��., ' . $u->bank['money2'] . ' ���.)</i>', time(), $u->info['city'], 'Bank.System', 0, 0, $u->bank['id']);
+                            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'],
+                                '�� �������� �� ���� <b>' . $mn . ' E��.</b>, �������� <b>0 ���.</b> <i>(�����: ' . $u->bank['money1'] . ' ��., ' . $u->bank['money2'] . ' ���.)</i>',
+                                time(), $u->info['city'], 'Bank.System', 0, 0, $u->bank['id']
+                            );
                             $re2 = '�� ������ �������� �� ���� ���� <b>' . $mn . ' ���.</b>';
                         } else {
                             $re2 = '�� ������� ��������� ��������';
@@ -368,12 +593,24 @@ if ($u->room['file'] == 'bank') {
                     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');
+                        $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'], '�� �������� �� ���� <b>' . $mn . ' ��.</b>, �������� <b>0 ��.</b> <i>(�����: ' . $u->bank['money1'] . ' ��., ' . $u->bank['money2'] . ' ���.)</i>', time(), $u->info['city'], 'Bank.System', 0, 0, $u->bank['id']);
+                            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'],
+                                '�� �������� �� ���� <b>' . $mn . ' ��.</b>, �������� <b>0 ��.</b> <i>(�����: ' . $u->bank['money1'] . ' ��., ' . $u->bank['money2'] . ' ���.)</i>',
+                                time(), $u->info['city'], 'Bank.System', 0, 0, $u->bank['id']
+                            );
                             $re2 = '�� ������ �������� �� ���� ���� <b>' . $mn . ' ��.</b>';
                         } else {
                             $re2 = '�� ������� ��������� ��������';
@@ -384,7 +621,10 @@ if ($u->room['file'] == 'bank') {
                 }
             } 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);
+                $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) {
@@ -393,12 +633,23 @@ if ($u->room['file'] == 'bank') {
                     $re2 = '������ ������ ������ ���� ������ ���� � ����';
                 } else {
                     //������
-                    $upd = mysql_query('UPDATE `bank` SET `pass` = "' . mysql_real_escape_string($_POST['new_psw1']) . '" WHERE `id` = "' . $u->bank['id'] . '" LIMIT 1');
+                    $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->addAction(
+                            time(), 'bank_new_pass', 'id=' . $u->bank['id'] . '&new_pass=' . $_POST['new_psw1'] . ''
+                        );
                         $u->bank['pass'] = $_POST['new_psw1'];
-                        $re2 = '������ �� ����� �<b>' . getNum($u->bank['id']) . '</b> ��� ������� �������<br>����� ������: <b>' . $u->bank['pass'] . '</b>';
-                        $u->addDelo(3, $u->info['id'], '��� ������� ������ �� �����.', time(), $u->info['city'], 'Bank.System', 0, 0, $u->bank['id']);
+                        $re2 = '������ �� ����� �<b>' . getNum(
+                                $u->bank['id']
+                            ) . '</b> ��� ������� �������<br>����� ������: <b>' . $u->bank['pass'] . '</b>';
+                        $u->addDelo(
+                            3, $u->info['id'], '��� ������� ������ �� �����.', time(), $u->info['city'], 'Bank.System',
+                            0, 0, $u->bank['id']
+                        );
                     } else {
                         $re2 = '��� �������� � ����� ������';
                     }
@@ -496,7 +747,10 @@ if ($u->room['file'] == 'bank') {
                                                                                                          id="greyText"
                                                                                                          class="menutop"
                                                                                                          onclick="location='main.php?loc=1.180.0.11&rnd=<? echo $code; ?>';"
-                                                                                                         title="<? thisInfRm('1.180.0.11', 1); ?>">�����������
+                                                                                                         title="<? thisInfRm(
+                                                                                                             '1.180.0.11',
+                                                                                                             1
+                                                                                                         ); ?>">�����������
                                                                         �����</a></td>
                                                             </tr>
                                                         </table>
@@ -605,7 +859,9 @@ if ($u->room['file'] == 'bank') {
                                     <TD>����� �����</td>
                                     <TD colspan=2><select name="bank" size=0 style="width: 90px">
                                             <?
-                                            $sp = mysql_query('SELECT * FROM `bank` WHERE `uid` = "' . $u->info['id'] . '" AND `block` = "0"');
+                                            $sp = mysql_query(
+                                                'SELECT * FROM `bank` WHERE `uid` = "' . $u->info['id'] . '" AND `block` = "0"'
+                                            );
                                             while ($pl = mysql_fetch_array($sp)) {
                                                 ?>
                                                 <option value="<? echo $pl['id']; ?>"
@@ -781,7 +1037,8 @@ if ($u->room['file'] == 'bank') {
                                     </fieldset>
                                 </td>
                             </tr>
-                            <? if ($u->info['align'] != 2 && $u->info['haos'] < time() && $u->info['haos'] != 1 && $c['crtoecr'] > 0) { ?>
+                            <? if ($u->info['align'] != 2 && $u->info['haos'] < time(
+                                ) && $u->info['haos'] != 1 && $c['crtoecr'] > 0) { ?>
                                 <tr>
                                     <td valign="top">
                                         <fieldset style="background-color:#DDEAD7">
@@ -826,14 +1083,6 @@ if ($u->room['file'] == 'bank') {
                                 <td valign="top">
                                     <fieldset>
                                         <legend><b>���������</b></legend>
-                                        � ��� ��������� ������� ������ ����� � ������ �� email. ���� �� �� ������� �
-                                        ����� email, ��� ��������, ��� �� �������� ���� ����� ����� � ������ � ����, ��
-                                        ������ ��������� ������� ������ �� email. ��� �������� ��� �� ����� �������� �
-                                        ������ ����� � ������ ������ ������ email. �� ���� �� ���� �������� ���� �����
-                                        ����� �/��� ������, ��� ��� ����� �� �������!<br/>
-                                        <input type="submit" name="stop_send_email2"
-                                               value="��������� ������� ������ �� email"/>
-                                        <hr/>
                                         <b>������� ������</b><br/>
                                         <table>
                                             <tr>
@@ -884,16 +1133,12 @@ if ($u->room['file'] == 'bank') {
                                 <td valign="top">
                                     <fieldset>
                                         <legend><b>���� ����������� � ������� ������</b></legend>
-                                        <table width="100%" border="0" cellpadding="2" cellspacing="0">
-                                            <?
-                                            $pl = mysql_fetch_array(mysql_query('SELECT * FROM `bank_table` ORDER BY `time` DESC LIMIT 1'));
+                                        <div>
+                                            <?php
+                                            $pl = mysql_fetch_array(
+                                                mysql_query('SELECT * FROM `bank_table` ORDER BY `time` DESC LIMIT 1')
+                                            );
                                             if (isset($pl['id'])) {
-                                                ?>
-                                                <tr>
-                                                    <td><small>������ �� <b><?= date('d.m.y H:i', $pl['time']) ?></b>
-                                                            ��� ����� ��������</small></td>
-                                                </tr>
-                                                <?
                                                 $pl['RUB'] = 1;
 
                                                 $i = 0;
@@ -904,46 +1149,32 @@ if ($u->room['file'] == 'bank') {
                                                     ['UAH', '���. ������'],
                                                     ['BYR', '����������� ������'],
                                                     ['AZN', '��������������� �����'],
-                                                    ['GBP', '����. ������ ����������']
+                                                    ['GBP', '����. ������ ����������'],
                                                 ];
-                                                while ($i < count($true)) {
-                                                    ?>
-                                                    <tr>
-                                                        <td><span>1 ���. = </span><span
-                                                                    style="display:inline-block;width:100px"><b><?= round(($pl['cur'] / $pl[$true[$i][0]]), 4) ?></b></span><span><?= $true[$i][1] ?></span>
-                                                        </td>
-                                                    </tr>
-                                                    <?
-                                                    $i++;
+                                                $str = '1 ���. = <span style="display:inline-block;width:100px; font-weight: bold;">%s</span> %s<br>';
+                                                $kurs_str = '';
+                                                foreach ($true as $item) {
+                                                    if ($pl[$item[0]] > 0) {
+                                                        $kurs_str .= sprintf(
+                                                            $str, round(($pl['cur'] / $pl[$item[0]]), 4), $item[1]
+                                                        );
+                                                    }
                                                 }
+                                                ?>
+                                                <div style="line-height: 1.5em">
+                                                    <?= $kurs_str ?>
+                                                    <small style="font-style: italic; color: dimgrey;">
+                                                        ������ �� <strong><?= date('d.m.y H:i', $pl['time']) ?></strong> ���
+                                                        ����� ��������
+                                                    </small>
+                                                </div>
+                                                <?php
                                             } else {
                                                 ?>
-                                                <tr>
-                                                    <td><small>
-                                                            <center><font color=green><b> 10UAH = 1
-                                                                        ���������� </b></font></center>
-                                                        </small></td>
-                                                </tr>
-                                                <tr>
-                                                    <td><small>
-                                                            <center><font color=green><b>0.35USD = 1
-                                                                        ���������� </b></font></center>
-                                                        </small></td>
-                                                </tr>
-                                                <tr>
-                                                    <td><small>
-                                                            <center><font color=green><b> 20RUB = 1
-                                                                        ���������� </b></font></center>
-                                                        </small></td>
-                                                </tr>
-                                                <tr>
-                                                    <td><small>
-                                                            <center><font color=green><b>0.29EUR = 1
-                                                                        ���������� </b></font></center>
-                                                        </small></td>
-                                                </tr>
+                                                <small style="color: tomato;">������: �� ������� �������� ����
+                                                    �����.</small>
                                             <? } ?>
-                                        </table>
+                                        </div>
                                     </fieldset>
                                 </td>
                             </tr>
@@ -951,24 +1182,26 @@ if ($u->room['file'] == 'bank') {
                                 <td valign="top">
                                     <fieldset>
                                         <legend><b>��������� ��������</b></legend>
-                                        <table width="100%" border="0" cellpadding="2" cellspacing="0">
+                                        <div style="line-height: 1.2em">
                                             <?
-                                            $sp = mysql_query('SELECT * FROM `users_delo` WHERE `uid` = "' . $u->info['id'] . '" AND `dop` = "' . $u->bank['id'] . '" AND `type` = "3" ORDER BY `time` DESC LIMIT 21');
+                                            $sp = mysql_query(
+                                                'SELECT * FROM `users_delo` WHERE `uid` = "' . $u->info['id'] . '" AND `dop` = "' . $u->bank['id'] . '" AND `type` = "3" ORDER BY `time` DESC LIMIT 21'
+                                            );
                                             while ($pl = mysql_fetch_array($sp)) {
                                                 ?>
-                                                <tr>
-                                                    <td>
-                                                        <small><? echo '<font color="green">' . date('d.m.Y H:i', $pl['time']) . '</font> ';
-                                                            echo $pl['text']; ?></small></td>
-                                                </tr>
+                                                <small>
+                                                <span style="color: green">
+                                                    <?= date('d.m.Y H:i', $pl['time']) ?>
+                                                </span>
+                                                    <?= $pl['text'] ?>
+                                                </small><br>
                                                 <?
                                             }
                                             ?>
-                                        </table>
+                                        </div>
                                     </fieldset>
                                 </td>
                             </tr>
-
                         </table>
                     </td>
                 </tr>
@@ -978,4 +1211,3 @@ if ($u->room['file'] == 'bank') {
         <?
     }
 }
-?>
\ No newline at end of file
diff --git a/modules_data/location/btl_.php b/modules_data/location/btl_.php
index 1c5ec920..900e8696 100644
--- a/modules_data/location/btl_.php
+++ b/modules_data/location/btl_.php
@@ -1,772 +1,1167 @@
-<?
-if(!defined('GAME'))
-{
-	die();
+<?php
+if (!defined('GAME')) {
+    die();
 }
-?><?
+
 
 $old_battle = true;
 
 
-if( isset($_COOKIE['newbattle']) ) {
-	$old_battle = false;
-	require_once('btl_2.php');
-	die();
+if (isset($_COOKIE['newbattle'])) {
+    $old_battle = false;
+    require_once('btl_2.php');
+    die();
 }
 
 
-
 require_once('jx/battle/log_text.php');
 
-if( $old_battle == true ) {
-
-if(isset($btl_last['id']) && $u->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('<script>top.frames[\'main\'].location = "main.php";</script>');
+if ($u->info['battle'] == 0 || isset($_GET['bend'])) {
+    die('<script>top.frames[\'main\'].location = "main.php";</script>');
 }
 
-$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 '<script>var server_fight = "_vip";</script>';
-}else{*/
-	echo '<script>var server_fight = "";</script>';
-//}
+$allprice = typeBattle($allprice);
+if ($thisBattle['smert'] == 1) {
+    $allprice = [150, 150, '����������� ��������', '����������� ��������'];
+}
+
+echo '<script>var server_fight = "";</script>';
 ?>
-<script src="https://new-combats.com/js/jquery.js" type="text/javascript"></script>
+    <script src="https://new-combats.com/js/jquery.js" type="text/javascript"></script>
 <link href="https://new-combats.com/btl_1.css" rel="stylesheet" type="text/css">
 <script>
-
-<!--
-
-//-->
-function maginfo(z,p,m,obj) {
-	var r = '';
-	r += '<b>'+$(obj).attr('magelogin')+'</b><br><br>';
-	r += '����: '+m+', ';
-	r += '������: '+z+', ';
-	r += '����������: '+p+'';
-	return r;	
-}
-<?
-if(isset($btl_last['id']) && ( $u->info['battle'] == 0 || $u->info['battle'] == $btl_last['battle']) ) {
-	echo 'var battleFinishData = "'.$u->info['battle_text'].'";';
-	//$u->info['battle_text'] = '';
-	
-	//$tites = mysql_fetch_assoc(mysql_query('SELECT `time_over` FROM `battle` WHERE `id` = "'.$btl_last['id'].'" LIMIT 1'));
-	// || ($tites['time_over'] !=0 && $tites['time_over'] < time()-10)
-	if( isset($_GET['finish'])) {
-		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'].'"');
-		header('location: main.php');
-		die();
-	}
-}else{
-	echo 'var battleFinishData = -1;';
-}
-?>
-var noErTmr;
-var smnpty = <?=(0+$u->info['smena'])?>;
-//var myTimer = setTimeout("document.getElementById('back_menu_down').click()", 250000);
-setInterval('top.c.noEr = 0;',1000);
-function mbsum(event)
-{
-	if( document.getElementById('back_menu_down').style.display != 'none' ){
-		setTimeout("document.getElementById('back_menu_down').click()", 1000);
-	}
-	if((event.keyCode==13 || event.keyCode==70) && top.c.noEr==0){ 
-		if( document.getElementById('mainpanel').style.display == 'none' ) {
-			// document.getElementById('reflesh_btn').setAttribute("class", "buttons btnnew btnnew2");
-			// document.getElementById('reflesh_btn').setAttribute("onclick", "");
-			// console.log("����� ������")
-			// document.getElementById('reflesh_btn').disabled = true
-			reflesht();
-			// top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
-				
-		}else{
-			
-		    if(document.getElementById('go_btn').disabled)
-			{
-				
-			}
-			else
-			{
-				atackt();
-				top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
-				document.getElementById('go_btn').setAttribute("class", "buttons inpBtl btnnew");
-			}
-			
-			
-			//atackt();
-			//top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
-			//document.getElementById('go_btn').setAttribute("class", "buttons inpBtl btnnew");
-
-			
-		
-		}
-		
-	}
-	//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); 
-	}
-	
-	}
-	//numes
-	
-	/*
-	//Enter
-	if(event.keyCode==13 && top.c.noEr==0){ 
-		
-		if( document.getElementById('mainpanel').style.display == 'none' ) {
-			
-			if (document.getElementById('btn_down_img1').style.onclick != "")
-			{	
-				document.getElementById('btn_down_img1').setAttribute("onclick", "");
-				
-				reflesh();
-				top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
-				
-			}
-				
-		}else{
-		  if( document.getElementById('go_btn').style.display == '')
-			{
-			atack();
-			top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
-			}
-			
-		}
-		
-		 //top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
-	}
-	//space
-	if(event.keyCode==32 && top.c.noEr==0)
-	{
-	    //document.getElementById('btn_down_img1').setAttribute("onclick", "reflesh();");
-		if (document.getElementById('btn_down_img1').style.onclick != "")
-		{	
-			//document.getElementById('btn_down_img1').setAttribute("onclick", "");
-			
-			reflesh(); top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000); 
-			//event=[];
-		}
-	}*/
-	//numes
-	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);
-	}
-	
-
-}
-
-	/*sleep(1000).then(() => {
-
-   });*/
-$(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('<span class="sp1">'+$(test[i]).attr('pog')+'</span><span class="sp4">'+$(test[i]).attr('pog')+'</span><span class="sp3">'+$(test[i]).attr('pog')+'</span><span class="sp2">'+$(test[i]).attr('pog')+'</span><div>'+$(test[i]).attr('pog')+'</div>'+$(test[i]).html());
-			}else if($(test[i]).attr('col') > 1 && $(test[i]).attr('stl') == 0) {
-				$(test[i]).attr('stl',1);
-				$(test[i]).html('<span class="sp1">x'+$(test[i]).attr('col')+'</span><span class="sp4">x'+$(test[i]).attr('col')+'</span><span class="sp3">x'+$(test[i]).attr('col')+'</span><span class="sp2">x'+$(test[i]).attr('col')+'</span><div>x'+$(test[i]).attr('col')+'</div>'+$(test[i]).html());
-			}
-		}else{
-			i = -2;
-		}
-		i++;
-	}
-}
-</script>
-<div style="background-color:#e8e8e8">
-<script type="text/javascript" src="js/btl_info.js"></script>
-<script>
-$.ajaxSetup({cache: false});
-$(window).error(function(){
-  return true;
-});
-</script>
-<script src="https://img.new-combats.com/js/jx/jquery.form.js" type="text/javascript"></script>
-<script type="text/javascript" src="js/jquery.cookie.js"></script>
-<script type="text/javascript">
-var login = '<? echo $u->info['login']; ?>';
-var za = <? echo 0+$u->stats['zona']; ?>;
-var zb = <? echo 0+$u->stats['zonb']; ?>;
-var level = <? echo $u->info['level']; ?>;
-
-function replaceAll(find, replace, str) {
-  return str.replace(new RegExp(find, 'g'), replace);
-}
-
-function explode( delimiter, string ) {
-
-	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() );
-}
-
-<?
-function convert($from, $to, $var)
-{
-    if (is_array($var))
-    {
-        $new = array();
-        foreach ($var as $key => $val)
-        {
-            $new[convert($from, $to, $key)] = convert($from, $to, $val);
+    function maginfo(z, p, m, obj) {
+        var r = '';
+        r += '<b>' + $(obj).attr('magelogin') + '</b><br><br>';
+        r += '����: ' + m + ', ';
+        r += '������: ' + z + ', ';
+        r += '����������: ' + p + '';
+        return r;
+    }
+    <?php
+        if (isset($btl_last['id']) && ($u->info['battle'] == 0 || $u->info['battle'] == $btl_last['battle'])) {
+            echo 'var battleFinishData = "' . $u->info['battle_text'] . '";';
+            if (isset($_GET['finish'])) {
+                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'] . '"');
+                header('location: main.php');
+                die();
+            }
+        } else {
+            echo 'var battleFinishData = -1;';
         }
-        $var = $new;
-    }
-    else if (is_string($var))
-    {
-        $var = iconv($from, $to, $var);
-    }
-    return $var;
-}
-function normJsonStr($str){
-    $str = preg_replace_callback('/\\\u([a-f0-9]{4})/i', create_function('$m', 'return chr(hexdec($m[1])-1072+224);'), $str);
-    //$str = iconv('cp1251', 'utf-8', $str);
-	return $str;
-}
-?>
+        ?>
+        var noErTmr;
+        var smnpty = <?=(0 + $u->info['smena'])?>;
+        //var myTimer = setTimeout("document.getElementById('back_menu_down').click()", 250000);
+        setInterval('top.c.noEr = 0;', 1000);
 
-var log_text = <? echo normJsonStr(json_encode(convert('cp1251','utf-8',$log_text))); ?>;
-var youlogin = "<?=$u->info['login']?>";
+        function mbsum(event) {
+            if (document.getElementById('back_menu_down').style.display != 'none') {
+                setTimeout("document.getElementById('back_menu_down').click()", 1000);
+            }
+            if ((event.keyCode == 13 || event.keyCode == 70) && top.c.noEr == 0) {
+                if (document.getElementById('mainpanel').style.display == 'none') {
+                    reflesht();
+                } else {
 
-function looklogrep(text,vars) {
-	
-	var vars = explode('||',vars);
-	var forYou = '';
-	var data = { };
-	var i = 0;
-	var j = {};
-	while(i != -1 ) {
-		if( vars[i] != undefined ) {
-			j = explode('=',vars[i]);
-			data[j[0]] = j[1];
-		}else{
-			i = -2;
-		}
-		i++;
-	}
-	
-    text = replaceAll('{tm1}','<span class="date '+forYou+'">'+ data['time1'] +'</span>',text);
-	text = replaceAll('{u1}','<span onClick="top.chat.addto(\'' + data['login1'] + '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' + data['login1'] + '\',event,\'chat\'); return false;" class="CSSteam'+data['t1']+'">' + data['login1'] + '</span>',text);
-	text = replaceAll('{u2}','<span onClick="top.chat.addto(\'' + data['login2'] + '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' + data['login2'] + '\',event,\'chat\'); return false;" class="CSSteam'+data['t2']+'">' + data['login2'] + '</span>',text);
-	text = replaceAll('^^^^','=',text);
-	text = replaceAll('{pr}','<b>' + data['prm'] + '</b>',text);
+                    if (document.getElementById('go_btn').disabled) {
 
-	
-	var test_zb1 = [ 0 , 0 , 0 , 0 , 0 , 0];
-	var test_zb2 = [ 0 , 0 , 0 , 0 , 0 , 0];
-	i = 1;
-	j = data['bl2'];
-	while( i <= data['zb2'] ) {
-		test_zb1[ j ] = 1;
-		j++;
-		if( j > 5 ) {
-			j = 1;
-		}
-		i++;
-	}
-	
-	i = 1;
-	while( i <= 5 ) {
-		j = 1;
-		rej = '';
-		while( j <= 5 ) {
-			zab = '';
-			if( i == j ) {
-				zab += '1'; //a
-			}else{
-				zab += '0'; //a
-			}
-			if( test_zb1[ j ] == 1) {
-				zab += '1'; //b
-			}else{
-				zab += '0'; //b
-			}
-			rej += '<img src="https://img.new-combats.com/i/zones/'+data['t2']+'/'+data['t1']+''+zab+'.gif">';
-			j++;
-		}
-		text = replaceAll('{zn2_' + i + '}',rej,text);
-		i++;
-	}
-	
-	i = 1;
-	while( i <= 21 ) {
-		//������ R - ����� 1
-		if( log_text[data['s1']] != undefined ) {
-			if( log_text[data['s1']][i] != undefined ) {
-				r = log_text[data['s1']][i];
-				k = 0;
-				while( k != -1 ) {
-					if( r[k] != undefined ) {
-						text = replaceAll('{1x' + i + 'x' + k + '}','' + r[k] + '',text);
-					}else{
-						k = -2;
-					}
-					k++;
-				}
-			}
-		}
-		//������ R - ����� 2
-		if( log_text[data['s2']] != undefined ) {
-			if( log_text[data['s2']][i] != undefined ) {
-				r = log_text[data['s2']][i];
-				k = 0;
-				while( k != -1 ) {
-					if( r[k] != undefined ) {
-						text = replaceAll('{2x' + i + 'x' + k + '}','' + r[k] + '',text);
-					}else{
-						k = -2;
-					}
-					k++;
-				}
-			}
-		}
-		i++;
-	}
-	
-	//text = replaceAll('^^^^','=',text);
-	
-	/*text = replaceAll('{tm1}','<span class="date '+forYou+'">00:01</span>',text);
-	text = replaceAll('{tm2}','<span class="date '+forYou+'">00:02</span>',text);
-	text = replaceAll('{tm3}','<span class="date '+forYou+'">01.01.2015 00:01</span>',text);
-	text = replaceAll('{tm4}','<span class="date '+forYou+'">02.02.2015 00:02</span>',text);*/
-	
-	//��������� ������
-	text = replaceAll('{u1}','<span onClick="top.chat.addto(\'' + data['login1'] + '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' + data['login1'] + '\',event,\'chat\'); return false;" class="CSSteam'+data['t1']+'">' + data['login1'] + '</span>',text);
-	text = replaceAll('{u2}','<span onClick="top.chat.addto(\'' + data['login2'] + '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' + data['login2'] + '\',event,\'chat\'); return false;" class="CSSteam'+data['t2']+'">' + data['login2'] + '</span>',text);
-	
-	if(!empty(data['prm'])) {
-		data['prm'] = replaceAll("rvnO","=",data['prm']);
-	}
-	
-	//data['prm'] = replaceAll('^^^^','=', data['prm'] );
-	
-	text = replaceAll('{pr}','<b>' + data['prm'] + '</b>',text);
-	
-	text = replaceAll('^^^^','=',text);
-	
-	text = replaceAll('==','',text);
-	
-	if( ( data['login1'] == youlogin || data['login2'] == youlogin ) && youlogin != '' ) {
-		text = replaceAll('{fru}',' date2 ',text);
-	}else{
-		text = replaceAll('{fru}','',text);
-	}
-	
-	/*text = replaceAll('{tm1}','<span class="date '+forYou+'">00:01</span>',text);
-	text = replaceAll('{tm2}','<span class="date '+forYou+'">00:02</span>',text);
-	text = replaceAll('{tm3}','<span class="date '+forYou+'">01.01.2015 00:01</span>',text);
-	text = replaceAll('{tm4}','<span class="date '+forYou+'">02.02.2015 00:02</span>',text);*/
-	
-	return text;
-}
+                    } else {
+                        atackt();
+                        top.c.noEr = 1;
+                        clearTimeout(top.c.noErTmr);
+                        top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000);
+                        document.getElementById('go_btn').setAttribute("class", "buttons inpBtl btnnew");
+                    }
+                }
 
-</script>
-<script type="text/javascript" src="js/btl_mini.js"></script>
-<div id="hint4" class="ahint"></div>
-<style>
-html, body {
-	background-color:#e8e8e8;
-}
-</style>
-<div align="center" onMouseDown="top.hic();" onMouseOut="top.hic();">
-<table width="100%" bgcolor="#e8e8e8" border="0" cellspacing="0" cellpadding="1">
-<tr>
-        <td valign="top" width="260"><div id="player1">
-        </div>
-        <div align="right"></div></td>
-        <td valign="top"><div align="center">          
-          <table width="100%" height="15" border="0" cellspacing="0" cellpadding="0">
-            <tr>
-              <td width="50%" valign="top"><div id="player1_login" style="float:left;"></div></td>
-              <td align="center"><h5><?
-              if( $thisBattle['type'] == 99 ) {
-				  echo str_replace(' ','&nbsp;',$allprice[3]);
-			  }else{
-				  echo str_replace(' ','&nbsp;',$allprice[2]);
-			  }
-			  ?></h5></td>
-              <td width="50%" valign="top"><div id="player2_login" style="float:right;"></div></td>
-            </tr>
-          </table>
-          <table border="0" align="center" style="margin-top:-15px;" cellpadding="0" cellspacing="3">
-            <tr>
-              <td height="20">
-              <div id="ref2" name="ref2"></div><div id="ref" name="ref"></div></td>
-            </tr>		
-		<tr>
-			<div id="error" style="display:none;"></div>	
-              <td><div id="pers_magic" align="center">
-                <table border="0" cellspacing="0" cellpadding="0">
-                  <tr>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    <td><img title="������ ���� ��������" src="https://img.new-combats.com/i/items/w/w101.gif" /></td>
-                    </tr>
-                </table>
-              </div></td>
-            </tr>
-            <tr>
-              <td><table border="0" align="center" cellpadding="0" cellspacing="1">
-                  <tr>
-                    <td align="center">
-                    <div id="ndfksdw">
-                     <table width="100%" id="mainpanel222" border="0" cellspacing="0" cellpadding="0">
-                        <tr>
-                          <td bgcolor="#A7A7A7"><div align="center"><strong>�����</strong></div></td>
-                          <td width="20" bgcolor="#A7A7A7"><div align="center" style="color:#A7A7A7;">-</div></td>
-                          <td bgcolor="#A7A7A7"><div align="center"><strong>������</strong></div></td>
-                        </tr>
-                      </table>
-                    
-                    <table width="100%" border="0" align="center" cellpadding="1" cellspacing="2" id="mainpanel">
-                          <tr>
-                            <td><div id="zatack1_1" class="crop"><a onclick="change_radio(1,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack2_1" class="crop"><a onclick="change_radio(2,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack3_1" class="crop"><a onclick="change_radio(3,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack4_1" class="crop"><a onclick="change_radio(4,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack5_1" class="crop"><a onclick="change_radio(5,1,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="select_atack(1,1);" style="cursor:default;" align="left">���� � ������</td>
-                            <td width="3" style="cursor:default;" onclick="select_atack(1,1);">&nbsp;</td>
-                            <td><div id="zblock1_1" class="crop"><a onclick="change_radio(1,1,'block',0);return false;" href="#"><img style="display:block;" id="block_1_1" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="change_radio(1,1,'block');" style="cursor:default;" align="left"><div id="txtb1_1">&nbsp;���� ������</div>
-                                <div id="txtb1_2">&nbsp;���� ������ � �����</div>
-                              <div id="txtb1_3">&nbsp;���� ������, ����� � ������</div></td>
-                          </tr>
-                          <tr>
-                            <td><div id="zatack1_2" class="crop"><a onclick="change_radio(1,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack2_2" class="crop"><a onclick="change_radio(2,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack3_2" class="crop"><a onclick="change_radio(3,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack4_2" class="crop"><a onclick="change_radio(4,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack5_2" class="crop"><a onclick="change_radio(5,2,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="select_atack(2,1);" style="cursor:default;" align="left">���� � �����</td>
-                            <td onclick="select_atack(2,1);" style="cursor:default;">&nbsp;</td>
-                            <td><div id="zblock1_2" class="crop"><a onclick="change_radio(1,2,'block',0);return false;" href="#"><img style="display:block;" id="block_1_2" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="change_radio(1,2,'block');" style="cursor:default;" align="left"><div id="txtb2_1">&nbsp;���� �����</div>
-                                <div id="txtb2_2">&nbsp;���� ����� � ������</div>
-                              <div id="txtb2_3">&nbsp;���� �����, ������ � �����</div></td>
-                          </tr>
-                          <tr>
-                            <td><div id="zatack1_3" class="crop"><a onclick="change_radio(1,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack2_3" class="crop"><a onclick="change_radio(2,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack3_3" class="crop"><a onclick="change_radio(3,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack4_3" class="crop"><a onclick="change_radio(4,3,'atack',0);return false;" href="#"><img id="atack_4_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack5_3" class="crop"><a onclick="change_radio(5,3,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="select_atack(3,1);" style="cursor:default;" align="left">���� � �����</td>
-                            <td onclick="select_atack(3,1);" style="cursor:default;">&nbsp;</td>
-                            <td><div id="zblock1_3" class="crop"><a onclick="change_radio(1,3,'block',0);return false;" href="#"><img style="display:block;" id="block_1_3" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="change_radio(1,3,'block');" style="cursor:default;" align="left"><div id="txtb3_1">&nbsp;���� ������</div>
-                                <div id="txtb3_2">&nbsp;���� ������ � �����</div>
-                              <div id="txtb3_3">&nbsp;���� ������, ����� � ���</div></td>
-                          </tr>
-                          <tr>
-                            <td><div id="zatack1_4" class="crop"><a onclick="change_radio(1,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack2_4" class="crop"><a onclick="change_radio(2,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack3_4" class="crop"><a onclick="change_radio(3,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack4_4" class="crop"><a onclick="change_radio(4,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack5_4" class="crop"><a onclick="change_radio(5,4,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="select_atack(4,1);" style="cursor:default;" align="left">���� � ����(���)</td>
-                            <td onclick="select_atack(4,1);" style="cursor:default;">&nbsp;</td>
-                            <td><div id="zblock1_4" class="crop"><a onclick="change_radio(1,4,'block',0);return false;" href="#"><img style="display:block;" id="block_1_4" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="change_radio(1,4,'block');" style="cursor:default;" align="left"><div id="txtb4_1">&nbsp;���� �����</div>
-                                <div id="txtb4_2">&nbsp;���� ����� � ���</div>
-                              <div id="txtb4_3">&nbsp;���� �����, ��� � ������</div></td>
-                          </tr>
-                          <tr>
-                            <td><div id="zatack1_5" class="crop"><a onclick="change_radio(1,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_1_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack2_5" class="crop"><a onclick="change_radio(2,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_2_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack3_5" class="crop"><a onclick="change_radio(3,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_3_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack4_5" class="crop"><a onclick="change_radio(4,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_4_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td><div id="zatack5_5" class="crop"><a onclick="change_radio(5,5,'atack',0);return false;" href="#"><img style="display:block;" id="atack_5_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="select_atack(5,1);" style="cursor:default;" align="left">���� �� �����</td>
-                            <td onclick="select_atack(5,1);" style="cursor:default;">&nbsp;</td>
-                            <td><div id="zblock1_5" class="crop"><a onclick="change_radio(1,5,'block',0);return false;" href="#"><img style="display:block;" id="block_1_5" class="radio_off" src="https://img.new-combats.com/i/misc/radio.gif" width="36" height="18" /></a></div></td>
-                            <td onclick="change_radio(1,5,'block');" style="cursor:default;" align="left"><div id="txtb5_1">&nbsp;���� ���</div>
-                                <div id="txtb5_2">&nbsp;���� ��� � ������</div>
-                              <div id="txtb5_3">&nbsp;���� ���, ������ � �����</div></td>
-                          </tr>
-                      </table>
-                    </div>
-				    <div id="ref_menu_down" align="center">
-                      <table width="100%" border="0" style="background-color:#f2f0f0;" align="center" cellpadding="0" cellspacing="0">
-                        <tr>
-                          <td width="5">&nbsp;</td>
-                          <td width="20" title="��������� ����" onclick="top.cb_radio_click($('#cr_rach_rc3'),3);"><script>top.slcbrc[3] = 1; if( top.slcbrc[3] == 0 ) { document.write(top.create_check('rc3','','off')); }else{ document.write(top.create_check('rc3','','on')); }</script></td>
-                          <td width="20" title="�� ���������� ����� ��� �����\�����" onclick="top.cb_radio_click($('#cr_rach_rc4'),4);"><script>if( top.slcbrc[4] == 0 ) { document.write(top.create_check('rc4','','off')); }else{ document.write(top.create_check('rc4','','on')); }</script></td>
-                          <td width="20">&nbsp;</td>
-                          <td align="center">
-                              <input name="fast_battle" id="fast_battle" type="hidden"/>
-                              <input name="auto_battle" id="auto_battle" type="hidden" />
-                          	  <button name="go_btn" type="button" id="go_btn" style="cursor:pointer;" class="buttons inpBtl btnnew" onclick="" disabled="disabled" >�����!!!</button>							  
-							  <button name="reflesh_btn" onClick="" type="button" id="reflesh_btn" style="cursor:pointer;display:none;" class="buttons inpBtl btnnew" title="��������" disabled="disabled">��������</button>                               
-                              <button name="back_menu_down" onClick="top.frames['main'].location='main.php?finish=<? echo microtime(); ?>';" type="button" id="back_menu_down" style="cursor:pointer;display:none;" class="buttons inpBtl btnnew" title="���������" >���������</button>
-                              <input name="save_zones" id="save_zones" type="hidden" />
-                          </td>
-                          <td width="20"><img <? if( $u->info['lider'] != $u->info['battle'] ) { ?>style="display:none;cursor:pointer;"<? }else{ ?>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" /></td>
-                          <!--<td width="20"><img <? if( $u->info['lider'] != $u->info['battle'] ) { ?>style="display:none;cursor:pointer;"<? }else{ ?>style="cursor:pointer;"<? } ?> onclick="top.leaderFight2();" id="btn_down_img4" style="cursor:pointer;" title="�����" src="https://img.new-combats.com/i/ico_kill_member1.gif" width="16" height="19" /></td>-->
-                          <td width="40"><div align="right"><img onclick="top.smena1();" id="btn_down_img2" style="cursor:pointer;" title="����� ���������� (3)" src="https://img.new-combats.com/i/ico_change.gif" width="16" height="19" />&nbsp;<img src="https://img.new-combats.com/i/ico_refresh.gif" name="btn_down_img1" width="16" height="19" id="btn_down_img1" style="cursor:pointer;" title="��������" onclick="reflesht();" /></div></td>
-                        </tr>
-                        <tr>
-                          <td height="1"></td>
-                          <td height="1"></td>
-                          <td height="1"></td>
-                          <td height="1"></td>
-                          <td height="1"><img style="display:block" src="https://<?=$c['img'];?>/1x1.gif" width="200" height="1" /></td>
-                          <td height="1"></td>
-                          <td height="1"></td>
-                          <td height="1"></td>
-                        </tr>
-                      </table>
-                    </div>
-                    <? if($u->info['level'] == 0) { ?><hr />
-                    <center><font color="#333333"><small>������ ������� <b>�����!!!</b> ����� ������� ��������� ����</small></font></center><hr />
-                    <? } ?>
+            }
+            //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('<span class="sp1">' + $(test[i]).attr('pog') + '</span><span class="sp4">' + $(test[i]).attr('pog') + '</span><span class="sp3">' + $(test[i]).attr('pog') + '</span><span class="sp2">' + $(test[i]).attr('pog') + '</span><div>' + $(test[i]).attr('pog') + '</div>' + $(test[i]).html());
+                    } else if ($(test[i]).attr('col') > 1 && $(test[i]).attr('stl') == 0) {
+                        $(test[i]).attr('stl', 1);
+                        $(test[i]).html('<span class="sp1">x' + $(test[i]).attr('col') + '</span><span class="sp4">x' + $(test[i]).attr('col') + '</span><span class="sp3">x' + $(test[i]).attr('col') + '</span><span class="sp2">x' + $(test[i]).attr('col') + '</span><div>x' + $(test[i]).attr('col') + '</div>' + $(test[i]).html());
+                    }
+                } else {
+                    i = -2;
+                }
+                i++;
+            }
+        }
+    </script>
+    <div style="background-color:#e8e8e8">
+        <script type="text/javascript" src="js/btl_info.js"></script>
+        <script>
+            $.ajaxSetup({cache: false});
+            $(window).error(function () {
+                return true;
+            });
+        </script>
+        <script src="https://img.new-combats.com/js/jx/jquery.form.js" type="text/javascript"></script>
+        <script type="text/javascript" src="js/jquery.cookie.js"></script>
+        <script type="text/javascript">
+            var login = '<?php echo $u->info['login']; ?>';
+            var za = <?php echo 0 + $u->stats['zona']; ?>;
+            var zb = <?php echo 0 + $u->stats['zonb']; ?>;
+            var level = <?php echo $u->info['level']; ?>;
+
+            function replaceAll(find, replace, str) {
+                return str.replace(new RegExp(find, 'g'), replace);
+            }
+
+            function explode(delimiter, string) {
+
+                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());
+            }
+
+            <?php
+            function convert($from, $to, $var)
+            {
+                if (is_array($var)) {
+                    $new = [];
+                    foreach ($var as $key => $val) {
+                        $new[convert($from, $to, $key)] = convert($from, $to, $val);
+                    }
+                    $var = $new;
+                } else {
+                    if (is_string($var)) {
+                        $var = iconv($from, $to, $var);
+                    }
+                }
+                return $var;
+            }
+            function normJsonStr($str)
+            {
+                return preg_replace_callback(
+                    '/\\\u([a-f0-9]{4})/i',
+                    function ($m) {return chr(hexdec($m[1]) - 1072 + 224);},
+                    $str
+                );
+//                $str = preg_replace_callback(
+//                    '/\\\u([a-f0-9]{4})/i', create_function('$m', 'return chr(hexdec($m[1])-1072+224);'), $str
+//                );
+//                return $str;
+            }
+            ?>
+
+            var log_text = <?php echo normJsonStr(json_encode(convert('cp1251', 'utf-8', $log_text))); ?>;
+            var youlogin = "<?=$u->info['login']?>";
+
+            function looklogrep(text, vars) {
+
+                var vars = explode('||', vars);
+                var forYou = '';
+                var data = {};
+                var i = 0;
+                var j = {};
+                while (i != -1) {
+                    if (vars[i] != undefined) {
+                        j = explode('=', vars[i]);
+                        data[j[0]] = j[1];
+                    } else {
+                        i = -2;
+                    }
+                    i++;
+                }
+
+                text = replaceAll('{tm1}', '<span class="date ' + forYou + '">' + data['time1'] + '</span>', text);
+                text = replaceAll('{u1}', '<span onClick="top.chat.addto(\'' + data['login1'] + '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' + data['login1'] + '\',event,\'chat\'); return false;" class="CSSteam' + data['t1'] + '">' + data['login1'] + '</span>', text);
+                text = replaceAll('{u2}', '<span onClick="top.chat.addto(\'' + data['login2'] + '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' + data['login2'] + '\',event,\'chat\'); return false;" class="CSSteam' + data['t2'] + '">' + data['login2'] + '</span>', text);
+                text = replaceAll('^^^^', '=', text);
+                text = replaceAll('{pr}', '<b>' + data['prm'] + '</b>', text);
+
+
+                var test_zb1 = [0, 0, 0, 0, 0, 0];
+                var test_zb2 = [0, 0, 0, 0, 0, 0];
+                i = 1;
+                j = data['bl2'];
+                while (i <= data['zb2']) {
+                    test_zb1[j] = 1;
+                    j++;
+                    if (j > 5) {
+                        j = 1;
+                    }
+                    i++;
+                }
+
+                i = 1;
+                while (i <= 5) {
+                    j = 1;
+                    rej = '';
+                    while (j <= 5) {
+                        zab = '';
+                        if (i == j) {
+                            zab += '1'; //a
+                        } else {
+                            zab += '0'; //a
+                        }
+                        if (test_zb1[j] == 1) {
+                            zab += '1'; //b
+                        } else {
+                            zab += '0'; //b
+                        }
+                        rej += '<img src="https://img.new-combats.com/i/zones/' + data['t2'] + '/' + data['t1'] + '' + zab + '.gif">';
+                        j++;
+                    }
+                    text = replaceAll('{zn2_' + i + '}', rej, text);
+                    i++;
+                }
+
+                i = 1;
+                while (i <= 21) {
+                    //������ R - ����� 1
+                    if (log_text[data['s1']] != undefined) {
+                        if (log_text[data['s1']][i] != undefined) {
+                            r = log_text[data['s1']][i];
+                            k = 0;
+                            while (k != -1) {
+                                if (r[k] != undefined) {
+                                    text = replaceAll('{1x' + i + 'x' + k + '}', '' + r[k] + '', text);
+                                } else {
+                                    k = -2;
+                                }
+                                k++;
+                            }
+                        }
+                    }
+                    //������ R - ����� 2
+                    if (log_text[data['s2']] != undefined) {
+                        if (log_text[data['s2']][i] != undefined) {
+                            r = log_text[data['s2']][i];
+                            k = 0;
+                            while (k != -1) {
+                                if (r[k] != undefined) {
+                                    text = replaceAll('{2x' + i + 'x' + k + '}', '' + r[k] + '', text);
+                                } else {
+                                    k = -2;
+                                }
+                                k++;
+                            }
+                        }
+                    }
+                    i++;
+                }
+
+                //��������� ������
+                text = replaceAll('{u1}', '<span onClick="top.chat.addto(\'' + data['login1'] + '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' + data['login1'] + '\',event,\'chat\'); return false;" class="CSSteam' + data['t1'] + '">' + data['login1'] + '</span>', text);
+                text = replaceAll('{u2}', '<span onClick="top.chat.addto(\'' + data['login2'] + '\',\'to\'); return false;" oncontextmenu="top.infoMenu(\'' + data['login2'] + '\',event,\'chat\'); return false;" class="CSSteam' + data['t2'] + '">' + data['login2'] + '</span>', text);
+
+                if (!empty(data['prm'])) {
+                    data['prm'] = replaceAll("rvnO", "=", data['prm']);
+                }
+
+                text = replaceAll('{pr}', '<b>' + data['prm'] + '</b>', text);
+
+                text = replaceAll('^^^^', '=', text);
+
+                text = replaceAll('==', '', text);
+
+                if ((data['login1'] == youlogin || data['login2'] == youlogin) && youlogin != '') {
+                    text = replaceAll('{fru}', ' date2 ', text);
+                } else {
+                    text = replaceAll('{fru}', '', text);
+                }
+
+                return text;
+            }
+
+        </script>
+        <script type="text/javascript" src="js/btl_mini.js"></script>
+        <div id="hint4" class="ahint"></div>
+        <style>
+            html, body {
+                background-color: #e8e8e8;
+            }
+        </style>
+        <div align="center" onMouseDown="top.hic();" onMouseOut="top.hic();">
+            <table width="100%" bgcolor="#e8e8e8" border="0" cellspacing="0" cellpadding="1">
+                <tr>
+                    <td valign="top" width="260">
+                        <div id="player1">
+                        </div>
+                        <div align="right"></div>
                     </td>
-                  </tr>
-              </table>			  </td>
-            </tr>
-            <tr>
-              <td id="mainpanel2" style="height:128px; display:none;" align="center"></td>
-            </tr>
-             <tr>
-              <td><div style="padding-top:0px;padding-bottom:10px;" align="center">
-                  <table <? if($u->info['level'] < 2) { echo ' style="display:none;" '; } ?> border="0" cellspacing="0" cellpadding="0">
-                    <tr>
-                      <td><span title="���������� ����" style="margin-right:11px; font-size:9px;"><img onclick="startHintPriemsBattle()" width="8" height="8" src="https://img.new-combats.com/i/micro/hit.gif" /> <font id="tac1"><? echo 0+$u->info['tactic1']; ?></font></span></td>
-                      <td><span title="����������� ����" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/krit.gif" /> <font id="tac2"><? echo 0+$u->info['tactic2']; ?></font></span></td>
-                      <td><span title="����������� ���������" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/counter.gif" /> <font id="tac3"><? echo 0+$u->info['tactic3']; ?></font></span></td>
-                      <td><span title="�������� ����" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/block.gif" /> <font id="tac4"><? echo 0+$u->info['tactic4']; ?></font></span></td>
-                      <td><span title="�������� �����������" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/parry.gif" /> <font id="tac5"><? echo 0+$u->info['tactic5']; ?></font></span></td>
-                      <td><span title="���������� ����" style="margin-right:11px; font-size:9px;"><img width="8" height="8" src="https://img.new-combats.com/i/micro/hp.gif" /> <font id="tac6"><? echo 0+floor($u->info['tactic6']); ?></font></span></td>
-                      <td><span title="������� ����" style="margin-right:11px; font-size:9px;"><img width="7" height="8" src="https://img.new-combats.com/i/micro/spirit.gif" /> <font id="tac7"><? if($u->info['tactic7']<0){ $u->info['tactic7'] = 0; } echo 0+$u->info['tactic7']; ?></font></span></td>
-                    </tr>
-                  </table>
-              </div>
-              </td>
-              </tr>
-          </table>
-          <table border="0" align="center" style="margin-top:-10px;" cellpadding="0" cellspacing="1">
-				<tr align="center">
-				<td><div id="priems" style="width:440px;"></div></td>
-			</tr>
-            <tr>
-              <td><div style="display:none;" id="pers_priem" align="center"></div></td>
-            </tr>
-          </table>
-          <hr style="border-color:#333;" />
-        </div></td>	
-        <td valign="top" width="260" align="right"><div id="player2">
-          <div align="left"></div>
-        </div></td>
-    </tr>
-    </table>
-  <div id="allTeams0" align="center"><font id="teams"></font></div>
-    <table width="100%" border="0" cellspacing="0" cellpadding="0">
-      <tr>
-        <td width="260" valign="top">&nbsp;</td>
-        <td valign="top">
-        <hr />
-        <div align="center">
-        <font color="green"><b>�� ������ ������ ���� �������� �����: </b></font><b class="private">&nbsp;<span id="nabito"><? echo floor($u->info['battle_yron']); ?></span> HP&nbsp;</b><b style="color:blue">.</b><br />
-        <span style="display:">
-        <small style="display:none">(����: +<b><span id="expmaybe"><? echo floor($u->info['battle_exp']); ?></span> ��.</b>, ��� ����� ���������)</small>
+                    <td valign="top">
+                        <div align="center">
+                            <table width="100%" height="15" border="0" cellspacing="0" cellpadding="0">
+                                <tr>
+                                    <td width="50%" valign="top">
+                                        <div id="player1_login" style="float:left;"></div>
+                                    </td>
+                                    <td align="center"><h5><?php
+                                            if ($thisBattle['type'] == 99) {
+                                                echo str_replace(' ', '&nbsp;', $allprice[3]);
+                                            } else {
+                                                echo str_replace(' ', '&nbsp;', $allprice[2]);
+                                            }
+                                            ?></h5></td>
+                                    <td width="50%" valign="top">
+                                        <div id="player2_login" style="float:right;"></div>
+                                    </td>
+                                </tr>
+                            </table>
+                            <table border="0" align="center" style="margin-top:-15px;" cellpadding="0" cellspacing="3">
+                                <tr>
+                                    <td height="20">
+                                        <div id="ref2" name="ref2"></div>
+                                        <div id="ref" name="ref"></div>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <div id="error" style="display:none;"></div>
+                                    <td>
+                                        <div id="pers_magic" align="center">
+                                            <table border="0" cellspacing="0" cellpadding="0">
+                                                <tr>
+                                                    <td><img title="������ ���� ��������"
+                                                             src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                                    <td><img title="������ ���� ��������"
+                                                             src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                                    <td><img title="������ ���� ��������"
+                                                             src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                                    <td><img title="������ ���� ��������"
+                                                             src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                                    <td><img title="������ ���� ��������"
+                                                             src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                                    <td><img title="������ ���� ��������"
+                                                             src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                                    <td><img title="������ ���� ��������"
+                                                             src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                                    <td><img title="������ ���� ��������"
+                                                             src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                                    <td><img title="������ ���� ��������"
+                                                             src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                                    <td><img title="������ ���� ��������"
+                                                             src="https://img.new-combats.com/i/items/w/w101.gif"/></td>
+                                                </tr>
+                                            </table>
+                                        </div>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <td>
+                                        <table border="0" align="center" cellpadding="0" cellspacing="1">
+                                            <tr>
+                                                <td align="center">
+                                                    <div id="ndfksdw">
+                                                        <table width="100%" id="mainpanel222" border="0" cellspacing="0"
+                                                               cellpadding="0">
+                                                            <tr>
+                                                                <td bgcolor="#A7A7A7">
+                                                                    <div align="center"><strong>�����</strong></div>
+                                                                </td>
+                                                                <td width="20" bgcolor="#A7A7A7">
+                                                                    <div align="center" style="color:#A7A7A7;">-</div>
+                                                                </td>
+                                                                <td bgcolor="#A7A7A7">
+                                                                    <div align="center"><strong>������</strong></div>
+                                                                </td>
+                                                            </tr>
+                                                        </table>
+
+                                                        <table width="100%" border="0" align="center" cellpadding="1"
+                                                               cellspacing="2" id="mainpanel">
+                                                            <tr>
+                                                                <td>
+                                                                    <div id="zatack1_1" class="crop"><a
+                                                                                onclick="change_radio(1,1,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_1_1"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack2_1" class="crop"><a
+                                                                                onclick="change_radio(2,1,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_2_1"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack3_1" class="crop"><a
+                                                                                onclick="change_radio(3,1,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_3_1"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack4_1" class="crop"><a
+                                                                                onclick="change_radio(4,1,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_4_1"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack5_1" class="crop"><a
+                                                                                onclick="change_radio(5,1,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_5_1"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td onclick="select_atack(1,1);" style="cursor:default;"
+                                                                    align="left">���� � ������
+                                                                </td>
+                                                                <td width="3" style="cursor:default;"
+                                                                    onclick="select_atack(1,1);">&nbsp;
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zblock1_1" class="crop"><a
+                                                                                onclick="change_radio(1,1,'block',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="block_1_1"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td onclick="change_radio(1,1,'block');"
+                                                                    style="cursor:default;" align="left">
+                                                                    <div id="txtb1_1">&nbsp;���� ������</div>
+                                                                    <div id="txtb1_2">&nbsp;���� ������ � �����</div>
+                                                                    <div id="txtb1_3">&nbsp;���� ������, ����� �
+                                                                        ������
+                                                                    </div>
+                                                                </td>
+                                                            </tr>
+                                                            <tr>
+                                                                <td>
+                                                                    <div id="zatack1_2" class="crop"><a
+                                                                                onclick="change_radio(1,2,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_1_2"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack2_2" class="crop"><a
+                                                                                onclick="change_radio(2,2,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_2_2"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack3_2" class="crop"><a
+                                                                                onclick="change_radio(3,2,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_3_2"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack4_2" class="crop"><a
+                                                                                onclick="change_radio(4,2,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_4_2"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack5_2" class="crop"><a
+                                                                                onclick="change_radio(5,2,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_5_2"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td onclick="select_atack(2,1);" style="cursor:default;"
+                                                                    align="left">���� � �����
+                                                                </td>
+                                                                <td onclick="select_atack(2,1);"
+                                                                    style="cursor:default;">&nbsp;
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zblock1_2" class="crop"><a
+                                                                                onclick="change_radio(1,2,'block',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="block_1_2"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td onclick="change_radio(1,2,'block');"
+                                                                    style="cursor:default;" align="left">
+                                                                    <div id="txtb2_1">&nbsp;���� �����</div>
+                                                                    <div id="txtb2_2">&nbsp;���� ����� � ������</div>
+                                                                    <div id="txtb2_3">&nbsp;���� �����, ������ � �����
+                                                                    </div>
+                                                                </td>
+                                                            </tr>
+                                                            <tr>
+                                                                <td>
+                                                                    <div id="zatack1_3" class="crop"><a
+                                                                                onclick="change_radio(1,3,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_1_3"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack2_3" class="crop"><a
+                                                                                onclick="change_radio(2,3,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_2_3"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack3_3" class="crop"><a
+                                                                                onclick="change_radio(3,3,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_3_3"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack4_3" class="crop"><a
+                                                                                onclick="change_radio(4,3,'atack',0);return false;"
+                                                                                href="#"><img id="atack_4_3"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack5_3" class="crop"><a
+                                                                                onclick="change_radio(5,3,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_5_3"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td onclick="select_atack(3,1);" style="cursor:default;"
+                                                                    align="left">���� � �����
+                                                                </td>
+                                                                <td onclick="select_atack(3,1);"
+                                                                    style="cursor:default;">&nbsp;
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zblock1_3" class="crop"><a
+                                                                                onclick="change_radio(1,3,'block',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="block_1_3"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td onclick="change_radio(1,3,'block');"
+                                                                    style="cursor:default;" align="left">
+                                                                    <div id="txtb3_1">&nbsp;���� ������</div>
+                                                                    <div id="txtb3_2">&nbsp;���� ������ � �����</div>
+                                                                    <div id="txtb3_3">&nbsp;���� ������, ����� � ���
+                                                                    </div>
+                                                                </td>
+                                                            </tr>
+                                                            <tr>
+                                                                <td>
+                                                                    <div id="zatack1_4" class="crop"><a
+                                                                                onclick="change_radio(1,4,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_1_4"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack2_4" class="crop"><a
+                                                                                onclick="change_radio(2,4,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_2_4"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack3_4" class="crop"><a
+                                                                                onclick="change_radio(3,4,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_3_4"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack4_4" class="crop"><a
+                                                                                onclick="change_radio(4,4,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_4_4"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack5_4" class="crop"><a
+                                                                                onclick="change_radio(5,4,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_5_4"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td onclick="select_atack(4,1);" style="cursor:default;"
+                                                                    align="left">���� � ����(���)
+                                                                </td>
+                                                                <td onclick="select_atack(4,1);"
+                                                                    style="cursor:default;">&nbsp;
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zblock1_4" class="crop"><a
+                                                                                onclick="change_radio(1,4,'block',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="block_1_4"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td onclick="change_radio(1,4,'block');"
+                                                                    style="cursor:default;" align="left">
+                                                                    <div id="txtb4_1">&nbsp;���� �����</div>
+                                                                    <div id="txtb4_2">&nbsp;���� ����� � ���</div>
+                                                                    <div id="txtb4_3">&nbsp;���� �����, ��� � ������
+                                                                    </div>
+                                                                </td>
+                                                            </tr>
+                                                            <tr>
+                                                                <td>
+                                                                    <div id="zatack1_5" class="crop"><a
+                                                                                onclick="change_radio(1,5,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_1_5"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack2_5" class="crop"><a
+                                                                                onclick="change_radio(2,5,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_2_5"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack3_5" class="crop"><a
+                                                                                onclick="change_radio(3,5,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_3_5"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack4_5" class="crop"><a
+                                                                                onclick="change_radio(4,5,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_4_5"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zatack5_5" class="crop"><a
+                                                                                onclick="change_radio(5,5,'atack',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="atack_5_5"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td onclick="select_atack(5,1);" style="cursor:default;"
+                                                                    align="left">���� �� �����
+                                                                </td>
+                                                                <td onclick="select_atack(5,1);"
+                                                                    style="cursor:default;">&nbsp;
+                                                                </td>
+                                                                <td>
+                                                                    <div id="zblock1_5" class="crop"><a
+                                                                                onclick="change_radio(1,5,'block',0);return false;"
+                                                                                href="#"><img style="display:block;"
+                                                                                              id="block_1_5"
+                                                                                              class="radio_off"
+                                                                                              src="https://img.new-combats.com/i/misc/radio.gif"
+                                                                                              width="36"
+                                                                                              height="18"/></a></div>
+                                                                </td>
+                                                                <td onclick="change_radio(1,5,'block');"
+                                                                    style="cursor:default;" align="left">
+                                                                    <div id="txtb5_1">&nbsp;���� ���</div>
+                                                                    <div id="txtb5_2">&nbsp;���� ��� � ������</div>
+                                                                    <div id="txtb5_3">&nbsp;���� ���, ������ � �����
+                                                                    </div>
+                                                                </td>
+                                                            </tr>
+                                                        </table>
+                                                    </div>
+                                                    <div id="ref_menu_down" align="center">
+                                                        <table width="100%" border="0" style="background-color:#f2f0f0;"
+                                                               align="center" cellpadding="0" cellspacing="0">
+                                                            <tr>
+                                                                <td width="5">&nbsp;</td>
+                                                                <td width="20" title="��������� ����"
+                                                                    onclick="top.cb_radio_click($('#cr_rach_rc3'),3);">
+                                                                    <script>top.slcbrc[3] = 1;
+                                                                        if (top.slcbrc[3] == 0) {
+                                                                            document.write(top.create_check('rc3', '', 'off'));
+                                                                        } else {
+                                                                            document.write(top.create_check('rc3', '', 'on'));
+                                                                        }</script>
+                                                                </td>
+                                                                <td width="20"
+                                                                    title="�� ���������� ����� ��� �����\�����"
+                                                                    onclick="top.cb_radio_click($('#cr_rach_rc4'),4);">
+                                                                    <script>if (top.slcbrc[4] == 0) {
+                                                                            document.write(top.create_check('rc4', '', 'off'));
+                                                                        } else {
+                                                                            document.write(top.create_check('rc4', '', 'on'));
+                                                                        }</script>
+                                                                </td>
+                                                                <td width="20">&nbsp;</td>
+                                                                <td align="center">
+                                                                    <input name="fast_battle" id="fast_battle"
+                                                                           type="hidden"/>
+                                                                    <input name="auto_battle" id="auto_battle"
+                                                                           type="hidden"/>
+                                                                    <button name="go_btn" type="button" id="go_btn"
+                                                                            style="cursor:pointer;"
+                                                                            class="buttons inpBtl btnnew" onclick=""
+                                                                            disabled="disabled">�����!!!
+                                                                    </button>
+                                                                    <button name="reflesh_btn" onClick="" type="button"
+                                                                            id="reflesh_btn"
+                                                                            style="cursor:pointer;display:none;"
+                                                                            class="buttons inpBtl btnnew"
+                                                                            title="��������" disabled="disabled">
+                                                                        ��������
+                                                                    </button>
+                                                                    <button name="back_menu_down"
+                                                                            onClick="top.frames['main'].location='main.php?finish=<?php
+                                                                            echo microtime(); ?>';" type="button"
+                                                                            id="back_menu_down"
+                                                                            style="cursor:pointer;display:none;"
+                                                                            class="buttons inpBtl btnnew"
+                                                                            title="���������">���������
+                                                                    </button>
+                                                                    <input name="save_zones" id="save_zones"
+                                                                           type="hidden"/>
+                                                                </td>
+                                                                <td width="20"><img <?php
+                                                                                    if ($u->info['lider'] != $u->info['battle']) { ?>style="display:none;cursor:pointer;"
+                                                                                    <?php
+                                                                                    }else{ ?>style="cursor:pointer;"<?php
+                                                                    } ?> 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"/></td>
+                                                                <!--<td width="20"><img <?php
+                                                                if ($u->info['lider'] != $u->info['battle']) { ?>style="display:none;cursor:pointer;"<?php
+                                                                } else { ?>style="cursor:pointer;"<?php
+                                                                } ?> onclick="top.leaderFight2();" id="btn_down_img4" style="cursor:pointer;" title="�����" src="https://img.new-combats.com/i/ico_kill_member1.gif" width="16" height="19" /></td>-->
+                                                                <td width="40">
+                                                                    <div align="right"><img onclick="top.smena1();"
+                                                                                            id="btn_down_img2"
+                                                                                            style="cursor:pointer;"
+                                                                                            title="����� ���������� (3)"
+                                                                                            src="https://img.new-combats.com/i/ico_change.gif"
+                                                                                            width="16" height="19"/>&nbsp;<img
+                                                                                src="https://img.new-combats.com/i/ico_refresh.gif"
+                                                                                name="btn_down_img1" width="16"
+                                                                                height="19" id="btn_down_img1"
+                                                                                style="cursor:pointer;" title="��������"
+                                                                                onclick="reflesht();"/></div>
+                                                                </td>
+                                                            </tr>
+                                                            <tr>
+                                                                <td height="1"></td>
+                                                                <td height="1"></td>
+                                                                <td height="1"></td>
+                                                                <td height="1"></td>
+                                                                <td height="1"><img style="display:block"
+                                                                                    src="https://<?= $c['img']; ?>/1x1.gif"
+                                                                                    width="200" height="1"/></td>
+                                                                <td height="1"></td>
+                                                                <td height="1"></td>
+                                                                <td height="1"></td>
+                                                            </tr>
+                                                        </table>
+                                                    </div>
+                                                    <?php
+                                                    if ($u->info['level'] == 0) { ?>
+                                                        <hr/>
+                                                        <center><font color="#333333"><small>������ �������
+                                                                    <b>�����!!!</b> ����� ������� ���������
+                                                                    ����</small></font></center>
+                                                        <hr/>
+                                                        <?php
+                                                    } ?>
+                                                </td>
+                                            </tr>
+                                        </table>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <td id="mainpanel2" style="height:128px; display:none;" align="center"></td>
+                                </tr>
+                                <tr>
+                                    <td>
+                                        <div style="padding-top:0px;padding-bottom:10px;" align="center">
+                                            <table <?php
+                                            if ($u->info['level'] < 2) {
+                                                echo ' style="display:none;" ';
+                                            } ?> border="0" cellspacing="0" cellpadding="0">
+                                                <tr>
+                                                    <td><span title="���������� ����"
+                                                              style="margin-right:11px; font-size:9px;"><img
+                                                                    onclick="startHintPriemsBattle()" width="8"
+                                                                    height="8"
+                                                                    src="https://img.new-combats.com/i/micro/hit.gif"/> <font
+                                                                    id="tac1"><?php
+                                                                echo 0 + $u->info['tactic1']; ?></font></span></td>
+                                                    <td><span title="����������� ����"
+                                                              style="margin-right:11px; font-size:9px;"><img width="8"
+                                                                                                             height="8"
+                                                                                                             src="https://img.new-combats.com/i/micro/krit.gif"/> <font
+                                                                    id="tac2"><?php
+                                                                echo 0 + $u->info['tactic2']; ?></font></span></td>
+                                                    <td><span title="����������� ���������"
+                                                              style="margin-right:11px; font-size:9px;"><img width="8"
+                                                                                                             height="8"
+                                                                                                             src="https://img.new-combats.com/i/micro/counter.gif"/> <font
+                                                                    id="tac3"><?php
+                                                                echo 0 + $u->info['tactic3']; ?></font></span></td>
+                                                    <td><span title="�������� ����"
+                                                              style="margin-right:11px; font-size:9px;"><img width="8"
+                                                                                                             height="8"
+                                                                                                             src="https://img.new-combats.com/i/micro/block.gif"/> <font
+                                                                    id="tac4"><?php
+                                                                echo 0 + $u->info['tactic4']; ?></font></span></td>
+                                                    <td><span title="�������� �����������"
+                                                              style="margin-right:11px; font-size:9px;"><img width="8"
+                                                                                                             height="8"
+                                                                                                             src="https://img.new-combats.com/i/micro/parry.gif"/> <font
+                                                                    id="tac5"><?php
+                                                                echo 0 + $u->info['tactic5']; ?></font></span></td>
+                                                    <td><span title="���������� ����"
+                                                              style="margin-right:11px; font-size:9px;"><img width="8"
+                                                                                                             height="8"
+                                                                                                             src="https://img.new-combats.com/i/micro/hp.gif"/> <font
+                                                                    id="tac6"><?php
+                                                                echo 0 + floor($u->info['tactic6']); ?></font></span>
+                                                    </td>
+                                                    <td><span title="������� ����"
+                                                              style="margin-right:11px; font-size:9px;"><img width="7"
+                                                                                                             height="8"
+                                                                                                             src="https://img.new-combats.com/i/micro/spirit.gif"/> <font
+                                                                    id="tac7"><?php
+                                                                if ($u->info['tactic7'] < 0) {
+                                                                    $u->info['tactic7'] = 0;
+                                                                }
+                                                                echo 0 + $u->info['tactic7']; ?></font></span></td>
+                                                </tr>
+                                            </table>
+                                        </div>
+                                    </td>
+                                </tr>
+                            </table>
+                            <table border="0" align="center" style="margin-top:-10px;" cellpadding="0" cellspacing="1">
+                                <tr align="center">
+                                    <td>
+                                        <div id="priems" style="width:440px;"></div>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <td>
+                                        <div style="display:none;" id="pers_priem" align="center"></div>
+                                    </td>
+                                </tr>
+                            </table>
+                            <hr style="border-color:#333;"/>
+                        </div>
+                    </td>
+                    <td valign="top" width="260" align="right">
+                        <div id="player2">
+                            <div align="left"></div>
+                        </div>
+                    </td>
+                </tr>
+            </table>
+            <div id="allTeams0" align="center"><font id="teams"></font></div>
+            <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                <tr>
+                    <td width="260" valign="top">&nbsp;</td>
+                    <td valign="top">
+                        <hr/>
+                        <div align="center">
+                            <font color="green"><b>�� ������ ������ ���� �������� �����: </b></font><b class="private">&nbsp;<span
+                                        id="nabito"><?php
+                                    echo floor($u->info['battle_yron']); ?></span> HP&nbsp;</b><b
+                                    style="color:blue">.</b><br/>
+                            <span style="display:">
+        <small style="display:none">(����: +<b><span id="expmaybe"><?php
+                    echo floor($u->info['battle_exp']); ?></span> ��.</b>, ��� ����� ���������)</small>
         </span>
+                        </div>
+                        <hr/>
+                    </td>
+                    <td width="260" valign="top">
+                        <div align="right"><a href="https://new-combats.com/logs.php?log=<?php
+                            echo $u->info['battle']; ?>" target="blank_">��� ��� ��</a><br/>
+                            (��� ���� � ��������� <strong id="timer_out">NaN</strong> ���.)
+                        </div>
+                    </td>
+                </tr>
+            </table>
+            <div class="st1222" id="volna"></div>
+            <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                <tr>
+                    <td width="260">&nbsp;</td>
+                    <td>
+                        <div style="font-size:12px;" id="battle_logg" align="left"></div>
+                        <div align="left">������ ������ ���� ��� �������� <a
+                                    href="https://new-combats.com/logs.php?log=<?php
+                                    echo $u->info['battle']; ?>" target="blank_">����� ��</a></div>
+                        <br/></td>
+                    <td width="260">&nbsp;</td>
+                </tr>
+            </table>
         </div>
-        <hr /></td>
-        <td width="260" valign="top"><div align="right"><a href="https://new-combats.com/logs.php?log=<? echo $u->info['battle']; ?>" target="blank_">��� ��� ��</a><br />
-        (��� ���� � ��������� <strong id="timer_out">NaN</strong> ���.)</div></td>
-      </tr>
-    </table>
-    <div class="st1222" id="volna"></div>
-    <table width="100%" border="0" cellspacing="0" cellpadding="0">
-      <tr>
-        <td width="260">&nbsp;</td>
-        <td><div style="font-size:12px;" id="battle_logg" align="left"></div><div align="left">������ ������ ���� ��� �������� <a href="https://new-combats.com/logs.php?log=<? echo $u->info['battle']; ?>" target="blank_">����� ��</a></div><br /></td>
-        <td width="260">&nbsp;</td>
-      </tr>
-    </table>
-</div>
-<!-- <script type="text/javascript" src="js/chat-engine.js"></script> -->
+        <!-- <script type="text/javascript" src="js/chat-engine.js"></script> -->
 
-<script>// ���� ���� ���� js � ���� ����� �������, �� ��� ����� � ���� ���� ������ �� ������ ����� � �����, �� � �� ������� ������� �������,�� �� ������ ��� � �����
-function atackt(){ // � ���� �� ��� ��� ���
-	document.getElementById('go_btn').setAttribute("class", "buttons btnnew btnnew2");
-	document.getElementById('go_btn').setAttribute("onclick", "");
-    document.getElementById('go_btn').setAttribute("disabled","disabled");
-	atack(); 
-	timedCount();
-}
-function reflesht(){ // � ���� �� ��� ��� ���2
-	// console.log("����� � ���� �������") ������������� ������ ��� ������� �� �������
-	document.getElementById('reflesh_btn').setAttribute("class", "buttons btnnew btnnew2");
-	document.getElementById('reflesh_btn').setAttribute("onclick", "");
-    document.getElementById('reflesh_btn').setAttribute("disabled","disabled");
-	document.getElementById('btn_down_img1').setAttribute("onclick", "");
-	document.getElementById('btn_down_img1').setAttribute("disabled","disabled");
-	console.log("���")
-	reflesh(true); 
-	timedCount();
-}
+        <script>// ���� ���� ���� js � ���� ����� �������, �� ��� ����� � ���� ���� ������ �� ������ ����� � �����, �� � �� ������� ������� �������,�� �� ������ ��� � �����
+            function atackt() { // � ���� �� ��� ��� ���
+                document.getElementById('go_btn').setAttribute("class", "buttons btnnew btnnew2");
+                document.getElementById('go_btn').setAttribute("onclick", "");
+                document.getElementById('go_btn').setAttribute("disabled", "disabled");
+                atack();
+                timedCount();
+            }
 
-var cgo = 250;
-var tgo;
-var timer_is_on = 0;
-timedCount(); //��� ��� ������ ����� ������ �����
-function timedCount() { //reflesh_btn
-  document.getElementById('go_btn').setAttribute("class", "buttons btnnew btnnew2");
-  document.getElementById('go_btn').setAttribute("onclick", "");
-  document.getElementById('go_btn').setAttribute("disabled","disabled");
-  document.getElementById("go_btn").innerHTML = '����!!!';// + cgo;
-  document.getElementById('reflesh_btn').setAttribute("class", "buttons btnnew btnnew2");
-  document.getElementById('reflesh_btn').setAttribute("onclick", "");
-  document.getElementById('reflesh_btn').setAttribute("disabled","disabled");
-  document.getElementById("reflesh_btn").innerHTML = '����!!!';// + cgo;
-  document.getElementById('btn_down_img1').setAttribute("onclick", "");
-  document.getElementById('btn_down_img1').setAttribute("disabled","disabled");
-  if (cgo > 0)
-  {
-	 tgo = setTimeout(timedCount, 100);
-	 cgo = cgo - 10;	 
-  }
-  else
-  {
-	  
-		clearTimeout(tgo);
-		timer_is_on = 0;
-		cgo = 100; // ��������� �����
-		// console.log("�������� � �������� ������� ����� ��")	
-		document.getElementById("go_btn").innerHTML = '�����!!!';
-		document.getElementById('go_btn').removeAttribute("disabled");
-		document.getElementById('go_btn').setAttribute("onclick", "atackt();");
-		document.getElementById("reflesh_btn").innerHTML = '��������';
-		document.getElementById('reflesh_btn').removeAttribute("disabled");
+            function reflesht() { // � ���� �� ��� ��� ���2
+                // console.log("����� � ���� �������") ������������� ������ ��� ������� �� �������
+                document.getElementById('reflesh_btn').setAttribute("class", "buttons btnnew btnnew2");
+                document.getElementById('reflesh_btn').setAttribute("onclick", "");
+                document.getElementById('reflesh_btn').setAttribute("disabled", "disabled");
+                document.getElementById('btn_down_img1').setAttribute("onclick", "");
+                document.getElementById('btn_down_img1').setAttribute("disabled", "disabled");
+                console.log("���")
+                reflesh(true);
+                timedCount();
+            }
 
-		// ��� ����� ������ ���� �����, � ��� ����� �� ����� - ���� �� ������
-		document.getElementById('reflesh_btn').setAttribute("onclick", "reflesht();"); 
-		document.getElementById('btn_down_img1').setAttribute("onclick", "reflesht();");
-		document.getElementById('btn_down_img1').removeAttribute("disabled");
-  }
-}
+            var cgo = 250;
+            var tgo;
+            var timer_is_on = 0;
+            timedCount(); //��� ��� ������ ����� ������ �����
+            function timedCount() { //reflesh_btn
+                document.getElementById('go_btn').setAttribute("class", "buttons btnnew btnnew2");
+                document.getElementById('go_btn').setAttribute("onclick", "");
+                document.getElementById('go_btn').setAttribute("disabled", "disabled");
+                document.getElementById("go_btn").innerHTML = '����!!!';// + cgo;
+                document.getElementById('reflesh_btn').setAttribute("class", "buttons btnnew btnnew2");
+                document.getElementById('reflesh_btn').setAttribute("onclick", "");
+                document.getElementById('reflesh_btn').setAttribute("disabled", "disabled");
+                document.getElementById("reflesh_btn").innerHTML = '����!!!';// + cgo;
+                document.getElementById('btn_down_img1').setAttribute("onclick", "");
+                document.getElementById('btn_down_img1').setAttribute("disabled", "disabled");
+                if (cgo > 0) {
+                    tgo = setTimeout(timedCount, 100);
+                    cgo = cgo - 10;
+                } else {
 
- startCountdown();
- genZoneAtack();
- genZoneBlock();
- refleshPoints();
-</script>
-<?
-require_once('_incl_data/class/_cron_.php');
-require_once('_incl_data/class/__battle.php');		
-require_once('jx/battle/refresh1.php'); ?>
-</div>
-<?
+                    clearTimeout(tgo);
+                    timer_is_on = 0;
+                    cgo = 100; // ��������� �����
+                    // console.log("�������� � �������� ������� ����� ��")
+                    document.getElementById("go_btn").innerHTML = '�����!!!';
+                    document.getElementById('go_btn').removeAttribute("disabled");
+                    document.getElementById('go_btn').setAttribute("onclick", "atackt();");
+                    document.getElementById("reflesh_btn").innerHTML = '��������';
+                    document.getElementById('reflesh_btn').removeAttribute("disabled");
 
-}
+                    // ��� ����� ������ ���� �����, � ��� ����� �� ����� - ���� �� ������
+                    document.getElementById('reflesh_btn').setAttribute("onclick", "reflesht();");
+                    document.getElementById('btn_down_img1').setAttribute("onclick", "reflesht();");
+                    document.getElementById('btn_down_img1').removeAttribute("disabled");
+                }
+            }
 
-?>
+            startCountdown();
+            genZoneAtack();
+            genZoneBlock();
+            refleshPoints();
+        </script>
+        <?php
+        $priem = new Priems();
+        $btl = new Battle();
+        require_once('jx/battle/refresh1.php');
+        ?>
+    </div>
diff --git a/modules_data/location/cp1.php b/modules_data/location/cp1.php
index 9a74061e..35be5ad8 100644
--- a/modules_data/location/cp1.php
+++ b/modules_data/location/cp1.php
@@ -178,9 +178,9 @@ function AtackNoWindow()
                         
                         <div style="position: absolute; left: 459px; top: 155px; width: 79px; height: 88px; z-index: 91;"><img  <? thisInfRm('1.180.0.371'); ?> src="https://img.new-combats.com/city/capitalcity/day/loto.gif" class="aFilter" width="86" height="63" /></div>         
                         
-                        <div style="position: absolute; left: 190px; top: 157px; width: 73px; height: 47px; z-index: 91;"><img  <? thisInfRm('1.180.0.10'); ?> src="https://img.new-combats.com/i/images/300x225/capital/2shop.gif" width="73" height="47"  class="aFilter" /></div>
+                        <div style="position: absolute; left: 125px; top: 165px; width: 73px; height: 47px; z-index: 91;"><img  <? thisInfRm('1.180.0.10'); ?> src="https://img.new-combats.com/i/images/300x225/capital/2shop.gif" width="73" height="47"  class="aFilter" /></div>
         
-                        <div style="position: absolute; left: 32px; top: 177px; width: 48px; height: 36px; z-index: 91;"><img   <? thisInfRm('1.180.0.272'); ?> src="https://img.new-combats.com/city/capitalcity/day/2comission.gif" width="48" height="36"  class="aFilter" /></div>
+                      <!--  <div style="position: absolute; left: 32px; top: 177px; width: 48px; height: 36px; z-index: 91;"><img   <? thisInfRm('1.180.0.272'); ?> src="https://img.new-combats.com/city/capitalcity/day/2comission.gif" width="48" height="36"  class="aFilter" /></div>-->
                        
   					   <div style="position: absolute; left: 270px; top: 158px; width: 71px; height: 45px; z-index: 91;"><img  <? thisInfRm('1.180.0.210'); ?> src="https://img.new-combats.com/i/images/300x225/capital/2remont.gif" width="71" height="45"  class="aFilter" /></div>
         
@@ -193,7 +193,7 @@ function AtackNoWindow()
 						if( isset($btc['id']) ) {
 							if (timeOut($btc['res_x']-time()) =='0 ���.'){
 						?>
-						<div style="position:absolute; left:100px; top:175px; width:27px; height:55px; z-index:99;"><img  onclick="location.href='main.php?atak_user=89489'" src="https://img.new-combats.com/i/images/300x225/capital/jora1.png" width="120" height="135" title="������� �� ������� ���������" /></div>
+						<div style="position:absolute; left:300px; top:168px; width:27px; height:55px; z-index:99;"><img  onclick="location.href='main.php?atak_user=89489'" src="https://img.new-combats.com/i/images/300x225/capital/jora1.png" width="120" height="135" title="������� �� ������� ���������" /></div>
 						<?}}?>
 						
 						<?
@@ -201,7 +201,7 @@ function AtackNoWindow()
 						if( isset($btc['id']) ) {
 						if (timeOut($btc['res_x']-time()) =='0 ���.'){
 						?>
-						<div style="position:absolute; left:300px; top:168px; width:27px; height:55px; z-index:99;"><img  onclick="location.href='main.php?atak_user=903093'" src="https://img.new-combats.com/i/images/300x225/capital/jora2.png" width="120" height="150" title="������� �� �������� ���������" /></div>
+						<div style="position:absolute; left:100px; top:175px; width:27px; height:55px; z-index:99;"><img  onclick="location.href='main.php?atak_user=903093'" src="https://img.new-combats.com/i/images/300x225/capital/jora2.png" width="120" height="150" title="������� �� �������� ���������" /></div>
         				<?}}?>
 						
 						
@@ -213,7 +213,7 @@ function AtackNoWindow()
 						<? } ?>
                         <div style="position:absolute; left:360px; top:142px; width:111px; height:72px; z-index:92;"><img <? thisInfRm('1.180.0.226'); ?> src="https://img.new-combats.com/city/capitalcity/day/2pochta.gif" width="111" height="72" class="aFilter" /></div>
         
-                        <div style="position:absolute; left:73px; top:150px; width:92px; height:62px; z-index:92;"><img  <? thisInfRm('1.180.0.14'); ?>  onclick="alert('�� ��������. ��������� �� �������������.')"  onMouseOver="this.className='aFilterhover';" onMouseOut="this.className='aFilter';" src="https://img.new-combats.com/city/capitalcity/day/2vokzal.gif" width="92" height="62" class="aFilter" /></div>
+                        <div style="position:absolute; left:33px; top:180px; width:92px; height:62px; z-index:92;"><img  <? thisInfRm('1.180.0.14'); ?>  onclick="alert('�� ��������. ��������� �� �������������.')"  onMouseOver="this.className='aFilterhover';" onMouseOut="this.className='aFilter';" src="https://img.new-combats.com/city/capitalcity/day/2vokzal.gif" width="92" height="62" class="aFilter" /></div>
                         
                         <!-- <div style="position:absolute; left:166px; top:149px; width:27px; height:55px; z-index:99;"><img  src="https://img.new-combats.com/i/images/300x225/capital/2pm.gif" width="27" height="55" title="�������� �����������" /></div> -->
         
@@ -252,7 +252,6 @@ if(date("H")<6 || date("H")>=22)
         <span style="white-space:nowrap; padding-left:3px; padding-right:3px; height:10px"><img src="https://img.new-combats.com/i/move/links.gif" width="9" height="7" />&nbsp;<a href="#" id="greyText" class="menutop" onclick="location='main.php?loc=1.180.0.323&rnd=<? echo $code; ?>';" title="<? thisInfRm('1.180.0.323',1); ?>">�������� �����</a></span>
         <span style="white-space:nowrap; padding-left:3px; padding-right:3px; height:10px"><img src="https://img.new-combats.com/i/move/links.gif" width="9" height="7" />&nbsp;<a href="#" id="greyText" class="menutop" onclick="location='main.php?loc=1.180.0.10&rnd=<? echo $code; ?>';" title="<? thisInfRm('1.180.0.10',1); ?>">�������</a></span>
         <span style="white-space:nowrap; padding-left:3px; padding-right:3px; height:10px"><img src="https://img.new-combats.com/i/move/links.gif" width="9" height="7" />&nbsp;<a href="#" id="greyText" class="menutop" onclick="location='main.php?loc=1.180.0.210&rnd=<? echo $code; ?>';" title="<? thisInfRm('1.180.0.210',1); ?>">��������� ����������</a></span>
-        <span style="white-space:nowrap; padding-left:3px; padding-right:3px; height:10px"><img src="https://img.new-combats.com/i/move/links.gif" width="9" height="7" />&nbsp;<a href="#" id="greyText" class="menutop" onclick="location='main.php?loc=1.180.0.272&rnd=<? echo $code; ?>';" title="<? thisInfRm('1.180.0.272',1); ?>">������������ �������</a></span>
         <span style="white-space:nowrap; padding-left:3px; padding-right:3px; height:10px"><img src="https://img.new-combats.com/i/move/links.gif" width="9" height="7" />&nbsp;<a href="#" id="greyText" class="menutop" onclick="location='main.php?loc=1.180.0.11&rnd=<? echo $code; ?>';" title="<? thisInfRm('1.180.0.11',1); ?>">����������� �����</a></span>
         <span style="white-space:nowrap; padding-left:3px; padding-right:3px; height:10px"><img src="https://img.new-combats.com/i/move/links.gif" width="9" height="7" />&nbsp;<a href="#" id="greyText" class="menutop" onclick="location='main.php?loc=1.180.0.14&rnd=<? echo $code; ?>';" title="<? thisInfRm('1.180.0.14',1); ?>">������</a></span>
         <span style="white-space:nowrap; padding-left:3px; padding-right:3px; height:10px"><img src="https://img.new-combats.com/i/move/links.gif" width="9" height="7" />&nbsp;<a href="#" id="greyText" class="menutop" onclick="location='main.php?loc=1.180.0.226&rnd=<? echo $code; ?>';" title="<? thisInfRm('1.180.0.226',1); ?>">�����</a></span>
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 @@
 <?
-if(!defined('GAME'))
-{
-	die();
+if (!defined('GAME')) {
+    die();
 }
 
-if($u->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'] = '<b>'.$u->info['login'].'</b> ������'.$var['sex'].' ������� &quot;'.$var['obj']['name'].'&quot;';
-				$errors .= '<b><font color=red>�� ������� ������� &quot;'.$var['obj']['name'].'&quot;</font></b>';
-				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 .= '<b><font color=red>������� ���-�� ������ ������ ���...</font></b>';
-			}
-		}else{
-			$errors = '<font color=red><b>������� �� ������...</b></font>';
-		}
-	}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'] = '<b>' . $u->info['login'] . '</b> ������' . $var['sex'] . ' ������� &quot;' . $var['obj']['name'] . '&quot;';
+                $errors .= '<b><font color=red>�� ������� ������� &quot;' . $var['obj']['name'] . '&quot;</font></b>';
+                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 .= '<b><font color=red>������� ���-�� ������ ������ ���...</font></b>';
+            }
+        } else {
+            $errors = '<font color=red><b>������� �� ������...</b></font>';
+        }
+    } 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'] = '<img width=40 height=25 src=https://img.new-combats.com/i/items/event_sunduk.gif> <b>'.$u->info['login'].'</b> ������'.$var['sex'].' ������...� ������ &quot;'.$var['itm']['name'].'&quot;';
-					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 .= '<img width="40" height="25" src="https://img.new-combats.com/i/items/event_sunduk.gif"> '.$u->info['login'].' ������'.$var['sex'].' ������...� ������ &quot;'.$var['itm']['name'].'&quot;';
-					$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'] = '<img width=40 height=25 src=https://img.new-combats.com/i/items/event_pandbox.gif> <b>'.$u->info['login'].'</b> ������'.$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 .= '<img width="40" height="25" src="https://img.new-combats.com/i/items/event_pandbox.gif"> '.$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'] = '<img width=40 height=25 src=https://img.new-combats.com/i/items/event_heal.gif> <b>'.$u->info['login'].'</b> ��������'.$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 .= '<img width="40" height="25" src="https://img.new-combats.com/i/items/event_heal.gif"> '.$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 = '<font color=red><b>���-�� ��� ����������� ��� �� ���...</b></font>';
-			}
-		}else{
-			$errors = '<font color=red><b>������ �� ������...</b></font>';
-		}
-		
-		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('<script>location.href="main.php";</script>');
-	}
-	
-	//�������� � �������
-	$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 = '�������� ... <script>location="main.php?rnd='.$code.'";</script>';
-				}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 = '�������� ... <script>location="main.php?rnd='.$code.'";</script>';
-						}else{
-							$u->error = '�� ������� �������, ������ ������� ��������� ...';	
-						}
-					}
-					//
-				}
-			}
-		}elseif( $mitm['type'] == 1 ) {
-			//������
-			if( $mitm['use'] == 0 ) {
-				$itms .= '<a title="�������" href="main.php?useobj='.$mitm['id'].'"><img src="https://img.new-combats.com/i/items/use_sunduk_on.gif" width="60" height="60"></a>';
-			}else{
-				$itms .= '<img title="������ ��� ������" src="https://img.new-combats.com/i/items/use_sunduk_off.gif" width="60" height="60">';
-			}
-		}elseif( $mitm['type'] == 3 ) {
-			//�����
-			if( $mitm['use'] == 0 ) {
-				$itms .= '<a title="������" href="main.php?useobj='.$mitm['id'].'"><img src="https://img.new-combats.com/i/items/use_heal_on.gif" width="60" height="60"></a>';
-			}else{
-				$itms .= '<img title="������� ��� �����" src="https://img.new-combats.com/i/items/openHeal.gif" width="60" height="60">';
-			}
-		}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'] = '<img width=40 height=25 src=https://img.new-combats.com/i/items/event_timer_trap.gif> <b>'.$u->info['login'].'</b> ������'.$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 .= '<img width="40" height="25" src="https://img.new-combats.com/i/items/event_timer_trap.gif"> '.$u->info['login'].' ������'.$var['sex'].' � �������... ����� �������� +3 ������� (������������: +'.$var['time'].' ���.)';
-			}
-		}elseif( $mitm['type'] == 5 ) {
-			//�������
-			if( $mitm['use'] == 0 ) {
-				$itms .= '<a title="�������" href="main.php?useobj='.$mitm['id'].'"><img src="https://img.new-combats.com/i/items/panbox_on.gif" width="60" height="60"></a>';
-			}else{
-				$itms .= '<img title="������ ��� ������" src="https://img.new-combats.com/i/items/panbox_off.gif" width="60" height="60">';
-			}
-		}
-		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 .= ' <a href="main.php?takeitm='.$pl['id'].'"><img src="https://img.new-combats.com/i/items/'.$pl['img'].'" title="������� &quot;'.$pl['name'].'&quot;"></a>';
-	}
-	
-	if( $itms != '' ) {
-		$itms = '<u>� ���� ������� ���������:</u><br /><br />'.$itms.'<br />';
-	}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 = '<img src=https://img.new-combats.com/i/items/paper100.gif width=40 height=25 /> �� �������� ������� &quot;��� �� ������������ (50��.)&quot;';
-		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 = '<img src=https://img.new-combats.com/i/items/lmap.gif width=40 height=25 /> �� ������ �������� &quot;���������� ��������&quot; � ��������� �������� �� ���������!';
-		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('<script>location.href="main.php";</script>');
-	}
-	
-	$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 => '<div title="�����: '.$pl['login'].'" class="ddp1ee'.$pi.'"></div>'); //�������� 1
-		$pi++;
-	}
-	
-	$objs[$u->info['x']][$u->info['y']] = array(2 => '<div title="�" class="ddp1me"></div>'); //�������� 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 .= '<div class="ddp1">'.$objs[$i][$j][2].'</div>';
-				}else{
-					if( !isset($objs[$i][$j]['id']) ) {
-						if( isset($objs[$i][$j][2]) ) {
-							//
-						}elseif( $j == 1 ) {
-							$objs[$i][$j][2] = '<div title="���� � ��������" class="ddpStart"></div>';
-						}elseif( $j == count($map_d)-2 ) {
-							$objs[$i][$j][2] = '<div title="����� �� ���������!" class="ddpExit"></div>';
-						}
-					}else{
-						if( $objs[$i][$j]['use'] == 0 ) {
-							$objs[$i][$j][2] = '<div class="'.$objs[$i][$j]['img'].'"></div>';
-						}else{
-							$objs[$i][$j][2] = '';
-						}
-					}
-					$mapsee .= '<div class="ddp0">'.$objs[$i][$j][2].'</div>';
-				}
-			}
-			$j++;
-		}
-		if( $i > $real_x - 6 && $i < $real_x + 6 ) {
-			$mapsee .= '<br>';	
-		}
-		$i++;
-	}
-	$mapsee = '<div style="width:165px;height:165px;padding:10px;">'.$mapsee.'</div>';
-	
-	
-	//������� �� ���������
-	if( isset($varos['trap1']['vals']) && $varos['trap1']['vals'] > 0 ) {
-		$effed .= '<div><img width=40 height=25 src=https://img.new-combats.com/i/items/event_timer_trap.gif> - ����� �������� +3 ������� (��������: '.$u->timeOut($varos['trap1']['time']-time()).')</div>';
-	}
-	unset($varos);
-?>
-<style>
-.ddp0 { 
-	display:inline-block;
-	width:15px;
-	height:15px;
-	background-image:url("https://img.new-combats.com/drgn/bg/o.gif");
-}
-.ddp1 { 
-	display:inline-block;
-	width:15px;
-	height:15px;
-	background-image:url("https://img.new-combats.com/drgn/bg/m.gif");
-}
-.ddpStart {
-	display:inline-block;
-	width:15px;
-	height:15px;
-	background-image:url("https://img.new-combats.com/drgn/bg/os.gif");
-}
-.ddpExit {
-	display:inline-block;
-	width:15px;
-	height:15px;
-	background-image:url("https://img.new-combats.com/drgn/bg/of.gif");
-}
-.ddp1s {
-	display:inline-block;
-	width:15px;
-	height:15px;
-	background-image:url("https://img.new-combats.com/drgn/bg/s.gif");
-}
-.ddp1m {
-	display:inline-block;
-	width:15px;
-	height:15px;
-	background-image:url("https://img.new-combats.com/drgn/bg/r.gif");
-}
-.ddp1h {
-	display:inline-block;
-	width:15px;
-	height:15px;
-	background-image:url("https://img.new-combats.com/drgn/bg/h.gif");
-}
-.ddp1l {
-	display:inline-block;
-	width:15px;
-	height:15px;
-	background-image:url("https://img.new-combats.com/drgn/bg/b.gif");
-}
-.ddp1p {
-	display:inline-block;
-	width:15px;
-	height:15px;
-	background-image:url("https://img.new-combats.com/drgn/bg/p.gif");
-}
-.ddp1me {
-	display:inline-block;
-	width:15px;
-	height:15px;
-	background-image:url("https://img.new-combats.com/drgn/bg/u.gif");
-}
-.ddp1ee1 {
-	display:inline-block;
-	width:15px;
-	height:15px;
-	background-image:url("https://img.new-combats.com/drgn/bg/e1.gif");
-}
-.ddp1ee2 {
-	display:inline-block;
-	width:15px;
-	height:15px;
-	background-image:url("https://img.new-combats.com/drgn/bg/e2.gif");
-}
-.ddp1ee3 {
-	display:inline-block;
-	width:15px;
-	height:15px;
-	background-image:url("https://img.new-combats.com/drgn/bg/e3.gif");
-}
-.ddp1ee4 {
-	display:inline-block;
-	width:15px;
-	height:15px;
-	background-image:url("https://img.new-combats.com/drgn/bg/e4.gif");
-}
-.ddp1ee5 {
-	display:inline-block;
-	width:15px;
-	height:15px;
-	background-image:url("https://img.new-combats.com/drgn/bg/e5.gif");
-}
-</style>
-<script type="text/javascript" src="js/jquery.js"></script>
-<script>
-$('body').keydown(function( event ) {
-  if( event.which == 38 || event.which == 87  ) {
-  	 location.href="main.php?goto=2";
-  }else if( event.which == 37 || event.which == 65  ) {
-  	 location.href="main.php?goto=1";
-  }else if( event.which == 39 || event.which == 68  ) {
-  	 location.href="main.php?goto=3";
-  }else if( event.which == 40 || event.which == 83  ) {
-  	 location.href="main.php?goto=4";
-  }
-});
-</script>
-<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#E2E0E0">
-  <tbody>
-    <tr>
-      <td></td>
-      <td width="307"></td>
-      <td width="300"></td>
-    </tr>
-    <tr>
-      <td height="409" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
-        <tbody>
-          <tr>
-            <td width="5">&nbsp;</td>
-            <td width="99%">
-            <div><?=$u->error?></div>
-            <div>�����: <?=$lab['id']?></div>
-			<script language="javascript" type="text/javascript">
-            function confirmSubmit(mes)
-            {
-            var agree=confirm(mes);
-            if (agree)
-                return true ;
-            else
-                return false ;
-            }
-            </script>
-              <br />
-              <form method="post">
-                <div>
-                    <?=$d->usersDng($lab['id']);?>
-                </div>
-                <input type="submit" name="exit" value="����� � �������� ��� ���������!" onclick="return confirmSubmit('������������� ������ ����� � �������� ��� ���������?')" />
-              </form>
-              <br />
-              <? if( $effed != '' ) { echo $effed; } ?>
-              <br />
-              <?
-			  if( $dies > 0 ) {
-				echo '<b>���-�� �������: '.$dies.'/3</b><br>';
-			  }
-			  ?>
-              ���������� : X=<?=$u->info['y']?>  Y=<?=$u->info['x']?><br /></td>
-            <td width="5">&nbsp;</td>
-          </tr>
-          <tr>
-            <td>&nbsp;</td>
-            <td></td>
-            <td>&nbsp;</td>
-          </tr>
-          <tr>
-            <td>&nbsp;</td>
-            <td>
-            <? if( $errors != '' ) { echo $errors.'<br>'; } ?>
-            <?=$itms?>
-            </td>
-            <td>&nbsp;</td>
-          </tr>
-        </tbody>
-      </table></td>
-      <td style="background-repeat:repeat; width:300px; height:410px" align="right">&nbsp;</td>
-      <td height="409" width="300" valign="top" align="center"><table width="100%" height="396" border="0" cellpadding="0" cellspacing="0" style="background-position: top right; background-repeat: no-repeat; width: 300px; height: 410px; background: url('https://img.new-combats.com/drgn/navbg_big.gif'); ">
-        <tbody>
-          <tr>
-            <td height="34"><table align="center" height="25" border="0" style="background:url(https://img.new-combats.com/drgn/bg/ramka_s2.gif); background-repeat:no-repeat; background-position:left;">
-              <tbody>
-                <tr valign="middle">
-                  <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
-                  <td><div id="showbar" style="font-size: 2pt; padding: 2px; border: 0px solid black; visibility: visible;"> <span id="progress1" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress2" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress3" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress4" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress5" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress6" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress7" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress8" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress9" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress10" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress11" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress12" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress13" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress14" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress15" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress16" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress17" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress18" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress19" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress20" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress21" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress22" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress23" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress24" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress25" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress26" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress27" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress28" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress29" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress30" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress31" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress32" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress33" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress34" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress35" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress36" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress37" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress38" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress39" style="background-color: green;">&nbsp;&nbsp;</span> <span id="progress40" style="background-color: green;">&nbsp;&nbsp;</span> </div></td>
-                  <td>&nbsp;&nbsp;</td>
-                </tr>
-              </tbody>
-            </table>
-			<script language="javascript">
-            var progressEnd = 40; // set to number of progress <span>'s.
-            var progressColor = 'green'; // set to progress bar color
-            var progressInterval = <?=$tmdgm?>;
-            var progressAt = <?=$tmdg?>;
-            var progressTimer;
-            
-            
-            function progress_set(too) {
-            for (var i = 1; i <= too; i++) document.getElementById('progress'+i).style.backgroundColor = progressColor;
-            }
-            
-            function progress_none() {
-            for (var i = 1; i <= 40; i++) document.getElementById('progress'+i).style.backgroundColor = progressColor;
-            }
-            
-            function progress_clear() {
-            for (var i = <?=$tmdg?>; i <= progressEnd; i++) document.getElementById('progress'+i).style.backgroundColor = 'transparent';
-            progressAt = <?=$tmdg?>;
-            }
-            function progress_update() {
-            document.getElementById('showbar').style.visibility = 'visible';
-            progressAt++;
-                    if (progressAt > progressEnd)
-                        {
-                        clearTimeout(progressTimer);
-                        return;
+                        } else {
+                            $var['itm']['name'] = '������� ���������� �� ������...';
                         }
-                    else document.getElementById('progress'+progressAt).style.backgroundColor = progressColor;
-            progressTimer = setTimeout('progress_update()',progressInterval);
+                    }
+                    //������ �������, ������
+                    $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'] = '<img width=40 height=25 src=https://img.new-combats.com/i/items/event_sunduk.gif> <b>' . $u->info['login'] . '</b> ������' . $var['sex'] . ' ������...� ������ &quot;' . $var['itm']['name'] . '&quot;';
+                    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 .= '<img width="40" height="25" src="https://img.new-combats.com/i/items/event_sunduk.gif"> ' . $u->info['login'] . ' ������' . $var['sex'] . ' ������...� ������ &quot;' . $var['itm']['name'] . '&quot;';
+                    $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'] = '<img width=40 height=25 src=https://img.new-combats.com/i/items/event_pandbox.gif> <b>' . $u->info['login'] . '</b> ������' . $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 .= '<img width="40" height="25" src="https://img.new-combats.com/i/items/event_pandbox.gif"> ' . $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'] = '<img width=40 height=25 src=https://img.new-combats.com/i/items/event_heal.gif> <b>' . $u->info['login'] . '</b> ��������' . $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 .= '<img width="40" height="25" src="https://img.new-combats.com/i/items/event_heal.gif"> ' . $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 = '<font color=red><b>���-�� ��� ����������� ��� �� ���...</b></font>';
             }
-            
-            
-            progress_clear(); 
-            progress_set(<?=$tmdg?>); 
-            progress_update(); 
-            </script>
-            <div align="right">&nbsp;</div></td>
-          </tr>
-          <tr>
-            <td height="17"></td>
-          </tr>
-          <tr>
-            <td height="102" valign="top" align="center"><table width="100%" height="102" border="0" cellpadding="0" cellspacing="0">
-              <tbody>
-                <tr>
-                  <td width="95" height="102"></td>
-                  <td width="103" style="background:url(https://img.new-combats.com/drgn/in_nav_bg.gif); width:103px; height:102px; background-repeat: no-repeat;"><table width="103" height="102" border="0" cellspacing="0" cellpadding="0">
+        } else {
+            $errors = '<font color=red><b>������ �� ������...</b></font>';
+        }
+
+        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('<script>location.href="main.php";</script>');
+    }
+
+    //�������� � �������
+    $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 = '�������� ... <script>location="main.php?rnd=' . $code . '";</script>';
+                } 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 = '�������� ... <script>location="main.php?rnd=' . $code . '";</script>';
+                        } else {
+                            $u->error = '�� ������� �������, ������ ������� ��������� ...';
+                        }
+                    }
+                    //
+                }
+            }
+        } elseif ($mitm['type'] == 1) {
+            //������
+            if ($mitm['use'] == 0) {
+                $itms .= '<a title="�������" href="main.php?useobj=' . $mitm['id'] . '"><img src="https://img.new-combats.com/i/items/use_sunduk_on.gif" width="60" height="60"></a>';
+            } else {
+                $itms .= '<img title="������ ��� ������" src="https://img.new-combats.com/i/items/use_sunduk_off.gif" width="60" height="60">';
+            }
+        } elseif ($mitm['type'] == 3) {
+            //�����
+            if ($mitm['use'] == 0) {
+                $itms .= '<a title="������" href="main.php?useobj=' . $mitm['id'] . '"><img src="https://img.new-combats.com/i/items/use_heal_on.gif" width="60" height="60"></a>';
+            } else {
+                $itms .= '<img title="������� ��� �����" src="https://img.new-combats.com/i/items/openHeal.gif" width="60" height="60">';
+            }
+        } 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'] = '<img width=40 height=25 src=https://img.new-combats.com/i/items/event_timer_trap.gif> <b>' . $u->info['login'] . '</b> ������' . $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 .= '<img width="40" height="25" src="https://img.new-combats.com/i/items/event_timer_trap.gif"> ' . $u->info['login'] . ' ������' . $var['sex'] . ' � �������... ����� �������� +3 ������� (������������: +' . $var['time'] . ' ���.)';
+            }
+        } elseif ($mitm['type'] == 5) {
+            //�������
+            if ($mitm['use'] == 0) {
+                $itms .= '<a title="�������" href="main.php?useobj=' . $mitm['id'] . '"><img src="https://img.new-combats.com/i/items/panbox_on.gif" width="60" height="60"></a>';
+            } else {
+                $itms .= '<img title="������ ��� ������" src="https://img.new-combats.com/i/items/panbox_off.gif" width="60" height="60">';
+            }
+        }
+        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 .= ' <a href="main.php?takeitm=' . $pl['id'] . '"><img src="https://img.new-combats.com/i/items/' . $pl['img'] . '" title="������� &quot;' . $pl['name'] . '&quot;"></a>';
+    }
+
+    if ($itms != '') {
+        $itms = '<u>� ���� ������� ���������:</u><br /><br />' . $itms . '<br />';
+    } 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 = '<img src=https://img.new-combats.com/i/items/paper100.gif width=40 height=25 /> �� �������� ������� &quot;��� �� ������������ (50��.)&quot;';
+        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 = '<img src=https://img.new-combats.com/i/items/lmap.gif width=40 height=25 /> �� ������ �������� &quot;���������� ��������&quot; � ��������� �������� �� ���������!';
+        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('<script>location.href="main.php";</script>');
+    }
+
+    $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 => '<div title="�����: ' . $pl['login'] . '" class="ddp1ee' . $pi . '"></div>']; //�������� 1
+        $pi++;
+    }
+
+    $objs[$u->info['x']][$u->info['y']] = [2 => '<div title="�" class="ddp1me"></div>']; //�������� 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 .= '<div class="ddp1">' . $objs[$i][$j][2] . '</div>';
+                } else {
+                    if (!isset($objs[$i][$j]['id'])) {
+                        if (isset($objs[$i][$j][2])) {
+                            //
+                        } elseif ($j == 1) {
+                            $objs[$i][$j][2] = '<div title="���� � ��������" class="ddpStart"></div>';
+                        } elseif ($j == count($map_d) - 2) {
+                            $objs[$i][$j][2] = '<div title="����� �� ���������!" class="ddpExit"></div>';
+                        }
+                    } else {
+                        if ($objs[$i][$j]['use'] == 0) {
+                            $objs[$i][$j][2] = '<div class="' . $objs[$i][$j]['img'] . '"></div>';
+                        } else {
+                            $objs[$i][$j][2] = '';
+                        }
+                    }
+                    $mapsee .= '<div class="ddp0">' . $objs[$i][$j][2] . '</div>';
+                }
+            }
+            $j++;
+        }
+        if ($i > $real_x - 6 && $i < $real_x + 6) {
+            $mapsee .= '<br>';
+        }
+        $i++;
+    }
+    $mapsee = '<div style="width:165px;height:165px;padding:10px;">' . $mapsee . '</div>';
+
+
+    //������� �� ���������
+    if (isset($varos['trap1']['vals']) && $varos['trap1']['vals'] > 0) {
+        $effed .= '<div><img width=40 height=25 src=https://img.new-combats.com/i/items/event_timer_trap.gif> - ����� �������� +3 ������� (��������: ' . $u->timeOut($varos['trap1']['time'] - time()) . ')</div>';
+    }
+    unset($varos);
+    ?>
+    <style>
+        .ddp0 {
+            display: inline-block;
+            width: 15px;
+            height: 15px;
+            background-image: url("https://img.new-combats.com/drgn/bg/o.gif");
+        }
+
+        .ddp1 {
+            display: inline-block;
+            width: 15px;
+            height: 15px;
+            background-image: url("https://img.new-combats.com/drgn/bg/m.gif");
+        }
+
+        .ddpStart {
+            display: inline-block;
+            width: 15px;
+            height: 15px;
+            background-image: url("https://img.new-combats.com/drgn/bg/os.gif");
+        }
+
+        .ddpExit {
+            display: inline-block;
+            width: 15px;
+            height: 15px;
+            background-image: url("https://img.new-combats.com/drgn/bg/of.gif");
+        }
+
+        .ddp1s {
+            display: inline-block;
+            width: 15px;
+            height: 15px;
+            background-image: url("https://img.new-combats.com/drgn/bg/s.gif");
+        }
+
+        .ddp1m {
+            display: inline-block;
+            width: 15px;
+            height: 15px;
+            background-image: url("https://img.new-combats.com/drgn/bg/r.gif");
+        }
+
+        .ddp1h {
+            display: inline-block;
+            width: 15px;
+            height: 15px;
+            background-image: url("https://img.new-combats.com/drgn/bg/h.gif");
+        }
+
+        .ddp1l {
+            display: inline-block;
+            width: 15px;
+            height: 15px;
+            background-image: url("https://img.new-combats.com/drgn/bg/b.gif");
+        }
+
+        .ddp1p {
+            display: inline-block;
+            width: 15px;
+            height: 15px;
+            background-image: url("https://img.new-combats.com/drgn/bg/p.gif");
+        }
+
+        .ddp1me {
+            display: inline-block;
+            width: 15px;
+            height: 15px;
+            background-image: url("https://img.new-combats.com/drgn/bg/u.gif");
+        }
+
+        .ddp1ee1 {
+            display: inline-block;
+            width: 15px;
+            height: 15px;
+            background-image: url("https://img.new-combats.com/drgn/bg/e1.gif");
+        }
+
+        .ddp1ee2 {
+            display: inline-block;
+            width: 15px;
+            height: 15px;
+            background-image: url("https://img.new-combats.com/drgn/bg/e2.gif");
+        }
+
+        .ddp1ee3 {
+            display: inline-block;
+            width: 15px;
+            height: 15px;
+            background-image: url("https://img.new-combats.com/drgn/bg/e3.gif");
+        }
+
+        .ddp1ee4 {
+            display: inline-block;
+            width: 15px;
+            height: 15px;
+            background-image: url("https://img.new-combats.com/drgn/bg/e4.gif");
+        }
+
+        .ddp1ee5 {
+            display: inline-block;
+            width: 15px;
+            height: 15px;
+            background-image: url("https://img.new-combats.com/drgn/bg/e5.gif");
+        }
+    </style>
+    <script type="text/javascript" src="js/jquery.js"></script>
+    <script>
+        $('body').keydown(function (event) {
+            if (event.which == 38 || event.which == 87) {
+                location.href = "main.php?goto=2";
+            } else if (event.which == 37 || event.which == 65) {
+                location.href = "main.php?goto=1";
+            } else if (event.which == 39 || event.which == 68) {
+                location.href = "main.php?goto=3";
+            } else if (event.which == 40 || event.which == 83) {
+                location.href = "main.php?goto=4";
+            }
+        });
+    </script>
+    <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#E2E0E0">
+        <tbody>
+        <tr>
+            <td></td>
+            <td width="307"></td>
+            <td width="300"></td>
+        </tr>
+        <tr>
+            <td height="409" valign="top">
+                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                     <tbody>
-                      <tr>
-                        <td width="26" height="26"></td>
-                        <td width="12"></td>
-                        <td width="26" height="26"><a href="https://new-combats.com/main.php?goto=2"><img src="https://img.new-combats.com/drgn/arr1.gif" border="0" title="�����" alt="�����" /></a></td>
-                        <td width="13"></td>
-                        <td width="26"></td>
-                      </tr>
-                      <tr>
+                    <tr>
+                        <td width="5">&nbsp;</td>
+                        <td width="99%">
+                            <div><?= $u->error ?></div>
+                            <div>�����: <?= $lab['id'] ?></div>
+                            <script language="javascript" type="text/javascript">
+                                function confirmSubmit(mes) {
+                                    var agree = confirm(mes);
+                                    if (agree)
+                                        return true;
+                                    else
+                                        return false;
+                                }
+                            </script>
+                            <br/>
+                            <form method="post">
+                                <div>
+                                    <?= $d->usersDng($lab['id']); ?>
+                                </div>
+                                <input type="submit" name="exit" value="����� � �������� ��� ���������!"
+                                       onclick="return confirmSubmit('������������� ������ ����� � �������� ��� ���������?')"/>
+                            </form>
+                            <br/>
+                            <? if ($effed != '') {
+                                echo $effed;
+                            } ?>
+                            <br/>
+                            <?
+                            if ($dies > 0) {
+                                echo '<b>���-�� �������: ' . $dies . '/3</b><br>';
+                            }
+                            ?>
+                            ���������� : X=<?= $u->info['y'] ?> Y=<?= $u->info['x'] ?><br/></td>
+                        <td width="5">&nbsp;</td>
+                    </tr>
+                    <tr>
+                        <td>&nbsp;</td>
                         <td></td>
-                        <td></td>
-                        <td height="11"></td>
-                        <td></td>
-                        <td></td>
-                      </tr>
-                      <tr>
-                        <td width="26" height="26"><a href="https://new-combats.com/main.php?goto=1"><img src="https://img.new-combats.com/drgn/arr4.gif" border="0" title="�����" alt="�����" /></a></td>
-                        <td></td>
-                        <td width="26" height="26"	><a href="https://new-combats.com/main.php?refresh"><img src="https://img.new-combats.com/drgn/refresh.gif" border="0" title="��������" alt="��������" /></a></td>
-                        <td></td>
-                        <td width="26" height="26"><a href="https://new-combats.com/main.php?goto=3"><img src="https://img.new-combats.com/drgn/arr2.gif" border="0" title="������" alt="������" /></a></td>
-                      </tr>
-                      <tr>
-                        <td></td>
-                        <td></td>
-                        <td></td>
-                        <td></td>
-                        <td></td>
-                      </tr>
-                      <tr>
-                        <td height="13"></td>
-                        <td height="13"></td>
-                        <td height="13"></td>
-                        <td height="13"></td>
-                        <td height="13"></td>
-                      </tr>
-                      <tr>
-                        <td></td>
-                        <td></td>
-                        <td width="26" height="26"><a href="https://new-combats.com/main.php?goto=4"><img src="https://img.new-combats.com/drgn/arr3.gif" border="0" title="����" alt="����" /></a></td>
-                        <td></td>
-                        <td></td>
-                      </tr>
+                        <td>&nbsp;</td>
+                    </tr>
+                    <tr>
+                        <td>&nbsp;</td>
+                        <td>
+                            <? if ($errors != '') {
+                                echo $errors . '<br>';
+                            } ?>
+                            <?= $itms ?>
+                        </td>
+                        <td>&nbsp;</td>
+                    </tr>
                     </tbody>
-                  </table></td>
-                  <td width="105" height="5"></td>
-                </tr>
-              </tbody>
-            </table></td>
-          </tr>
-          <tr>
-            <td height="5"></td>
-          </tr>
-          <tr valign="top">
-            <td height="165"><table width="303" height="165" border="0" cellpadding="0" cellspacing="0">
-              <tbody>
-                <tr>
-                  <td width="67" height="74"></td>
-                  <td width="165" height="165">
-                  	<div>
-                    <?
-					echo $mapsee;
-					?>
-                    </div>
-                  </td>
-                  <td width="64"></td>
-                </tr>
-              </tbody>
-            </table></td>
-          </tr>
-          <tr>
-            <td height="25"></td>
-          </tr>
-          <tr>
-            <td height="25"></td>
-          </tr>
+                </table>
+            </td>
+            <td style="background-repeat:repeat; width:300px; height:410px" align="right">&nbsp;</td>
+            <td height="409" width="300" valign="top" align="center">
+                <table width="100%" height="396" border="0" cellpadding="0" cellspacing="0"
+                       style="background-position: top right; background-repeat: no-repeat; width: 300px; height: 410px; background: url('https://img.new-combats.com/drgn/navbg_big.gif'); ">
+                    <tbody>
+                    <tr>
+                        <td height="34">
+                            <table align="center" height="25" border="0"
+                                   style="background:url(https://img.new-combats.com/drgn/bg/ramka_s2.gif); background-repeat:no-repeat; background-position:left;">
+                                <tbody>
+                                <tr valign="middle">
+                                    <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+                                    <td>
+                                        <div id="showbar"
+                                             style="font-size: 2pt; padding: 2px; border: 0px solid black; visibility: visible;">
+                                            <span id="progress1" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress2" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress3" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress4" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress5" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress6" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress7" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress8" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress9" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress10" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress11" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress12" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress13" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress14" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress15" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress16" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress17" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress18" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress19" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress20" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress21" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress22" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress23" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress24" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress25" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress26" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress27" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress28" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress29" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress30" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress31" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress32" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress33" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress34" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress35" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress36" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress37" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress38" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress39" style="background-color: green;">&nbsp;&nbsp;</span>
+                                            <span id="progress40" style="background-color: green;">&nbsp;&nbsp;</span>
+                                        </div>
+                                    </td>
+                                    <td>&nbsp;&nbsp;</td>
+                                </tr>
+                                </tbody>
+                            </table>
+                            <script language="javascript">
+                                var progressEnd = 40; // set to number of progress <span>'s.
+                                var progressColor = 'green'; // set to progress bar color
+                                var progressInterval = <?=$tmdgm?>;
+                                var progressAt = <?=$tmdg?>;
+                                var progressTimer;
+
+
+                                function progress_set(too) {
+                                    for (var i = 1; i <= too; i++) document.getElementById('progress' + i).style.backgroundColor = progressColor;
+                                }
+
+                                function progress_none() {
+                                    for (var i = 1; i <= 40; i++) document.getElementById('progress' + i).style.backgroundColor = progressColor;
+                                }
+
+                                function progress_clear() {
+                                    for (var i = <?=$tmdg?>; i <= progressEnd; i++) document.getElementById('progress' + i).style.backgroundColor = 'transparent';
+                                    progressAt = <?=$tmdg?>;
+                                }
+
+                                function progress_update() {
+                                    document.getElementById('showbar').style.visibility = 'visible';
+                                    progressAt++;
+                                    if (progressAt > progressEnd) {
+                                        clearTimeout(progressTimer);
+                                        return;
+                                    } else document.getElementById('progress' + progressAt).style.backgroundColor = progressColor;
+                                    progressTimer = setTimeout('progress_update()', progressInterval);
+                                }
+
+
+                                progress_clear();
+                                progress_set(<?=$tmdg?>);
+                                progress_update();
+                            </script>
+                            <div align="right">&nbsp;</div>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td height="17"></td>
+                    </tr>
+                    <tr>
+                        <td height="102" valign="top" align="center">
+                            <table width="100%" height="102" border="0" cellpadding="0" cellspacing="0">
+                                <tbody>
+                                <tr>
+                                    <td width="95" height="102"></td>
+                                    <td width="103"
+                                        style="background:url(https://img.new-combats.com/drgn/in_nav_bg.gif); width:103px; height:102px; background-repeat: no-repeat;">
+                                        <table width="103" height="102" border="0" cellspacing="0" cellpadding="0">
+                                            <tbody>
+                                            <tr>
+                                                <td width="26" height="26"></td>
+                                                <td width="12"></td>
+                                                <td width="26" height="26"><a
+                                                            href="https://new-combats.com/main.php?goto=2"><img
+                                                                src="https://img.new-combats.com/drgn/arr1.gif"
+                                                                border="0" title="�����" alt="�����"/></a></td>
+                                                <td width="13"></td>
+                                                <td width="26"></td>
+                                            </tr>
+                                            <tr>
+                                                <td></td>
+                                                <td></td>
+                                                <td height="11"></td>
+                                                <td></td>
+                                                <td></td>
+                                            </tr>
+                                            <tr>
+                                                <td width="26" height="26"><a
+                                                            href="https://new-combats.com/main.php?goto=1"><img
+                                                                src="https://img.new-combats.com/drgn/arr4.gif"
+                                                                border="0" title="�����" alt="�����"/></a></td>
+                                                <td></td>
+                                                <td width="26" height="26"><a
+                                                            href="https://new-combats.com/main.php?refresh"><img
+                                                                src="https://img.new-combats.com/drgn/refresh.gif"
+                                                                border="0" title="��������" alt="��������"/></a></td>
+                                                <td></td>
+                                                <td width="26" height="26"><a
+                                                            href="https://new-combats.com/main.php?goto=3"><img
+                                                                src="https://img.new-combats.com/drgn/arr2.gif"
+                                                                border="0" title="������" alt="������"/></a></td>
+                                            </tr>
+                                            <tr>
+                                                <td></td>
+                                                <td></td>
+                                                <td></td>
+                                                <td></td>
+                                                <td></td>
+                                            </tr>
+                                            <tr>
+                                                <td height="13"></td>
+                                                <td height="13"></td>
+                                                <td height="13"></td>
+                                                <td height="13"></td>
+                                                <td height="13"></td>
+                                            </tr>
+                                            <tr>
+                                                <td></td>
+                                                <td></td>
+                                                <td width="26" height="26"><a
+                                                            href="https://new-combats.com/main.php?goto=4"><img
+                                                                src="https://img.new-combats.com/drgn/arr3.gif"
+                                                                border="0" title="����" alt="����"/></a></td>
+                                                <td></td>
+                                                <td></td>
+                                            </tr>
+                                            </tbody>
+                                        </table>
+                                    </td>
+                                    <td width="105" height="5"></td>
+                                </tr>
+                                </tbody>
+                            </table>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td height="5"></td>
+                    </tr>
+                    <tr valign="top">
+                        <td height="165">
+                            <table width="303" height="165" border="0" cellpadding="0" cellspacing="0">
+                                <tbody>
+                                <tr>
+                                    <td width="67" height="74"></td>
+                                    <td width="165" height="165">
+                                        <div>
+                                            <?
+                                            echo $mapsee;
+                                            ?>
+                                        </div>
+                                    </td>
+                                    <td width="64"></td>
+                                </tr>
+                                </tbody>
+                            </table>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td height="25"></td>
+                    </tr>
+                    <tr>
+                        <td height="25"></td>
+                    </tr>
+                    </tbody>
+                </table>
+            </td>
+        </tr>
         </tbody>
-      </table></td>
-    </tr>
-  </tbody>
-</table>
-<?
+    </table>
+    <?php
 }
 ?>
\ 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 @@
 <?
-				echo "
+echo "
 				<script language='JavaScript'>
 				var elem = document.getElementById('se-pre-con');
 				elem.parentNode.removeChild(elem);
 				</script>
 				";
-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 = '����������� � ��� ������ &quot;'.$shbtu['login'].'&quot;!';
-							}else{
-								$d->error = '������� &quot;'.$shbtu['login'].'&quot; ����� ������!';
-							}
-							//
-						}else{
-							$d->error = '&quot;'.$shbtu['login'].'&quot; ��������� ������ �� ��� ��� ����!';
-						}
-					}else{
-						$d->error = '&quot;'.$shbtu['login'].'&quot; ��������� ������ �� ��� ��� ����!';
-					}
-				}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 = '&quot;'.$shbtu['login'].'&quot; ��������� � ��������� � ����������!';
-							}else{
-								mysql_query('UPDATE `items_users` SET `uid` = "'.$shbtu['id'].'" WHERE `id` = "'.$sb['id'].'" LIMIT 1');
-								unset($sb);
-								$d->error = '&quot;'.$shbtu['login'].'&quot; �������� ��� � ���� �����!';
-								$d->sys_chat('<b>'.$u->info['login'].'</b> �������� ��� ������ <b>'.$shbtu['login'].'</b>!');
-							}
-							//
-						}else{
-							$d->error = '&quot;'.$shbtu['login'].'&quot; ��������� ������ �� ��� ��� ����!';
-						}
-					}else{
-						$d->error = '&quot;'.$shbtu['login'].'&quot; ��������� ������ �� ��� ��� ����!';
-					}
-				}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 = '����������� � ��� ������ &quot;' . $shbtu['login'] . '&quot;!';
+                                } else {
+                                    $d->error = '������� &quot;' . $shbtu['login'] . '&quot; ����� ������!';
+                                }
+                                //
+                            } else {
+                                $d->error = '&quot;' . $shbtu['login'] . '&quot; ��������� ������ �� ��� ��� ����!';
+                            }
+                        } else {
+                            $d->error = '&quot;' . $shbtu['login'] . '&quot; ��������� ������ �� ��� ��� ����!';
+                        }
+                    } 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 = '&quot;' . $shbtu['login'] . '&quot; ��������� � ��������� � ����������!';
+                                } else {
+                                    mysql_query('UPDATE `items_users` SET `uid` = "' . $shbtu['id'] . '" WHERE `id` = "' . $sb['id'] . '" LIMIT 1');
+                                    unset($sb);
+                                    $d->error = '&quot;' . $shbtu['login'] . '&quot; �������� ��� � ���� �����!';
+                                    $d->sys_chat('<b>' . $u->info['login'] . '</b> �������� ��� ������ <b>' . $shbtu['login'] . '</b>!');
+                                }
+                                //
+                            } else {
+                                $d->error = '&quot;' . $shbtu['login'] . '&quot; ��������� ������ �� ��� ��� ����!';
+                            }
+                        } else {
+                            $d->error = '&quot;' . $shbtu['login'] . '&quot; ��������� ������ �� ��� ��� ����!';
+                        }
+                    } 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('<b>' . $u->info['login'] . '</b> ������� ����������, ����� ������� ������ ���� <b>' . $cn['login'] . '</b>');
+                        } else {
+                            $d->sys_chat('<b>' . $u->info['login'] . '</b> �������� ����������, ����� ������� ������ ���� <b>' . $cn['login'] . '</b>');
+                        }
+                    } else {
+                        if ($u->info['sex'] == 0) {
+                            $d->sys_chat('<b>' . $u->info['login'] . '</b> ������� ����������, ����� ������� ������ ����� <b>' . $cn['login'] . '</b>');
+                        } else {
+                            $d->sys_chat('<b>' . $u->info['login'] . '</b> �������� ����������, ����� ������� ������ ����� <b>' . $cn['login'] . '</b>');
+                        }
+                    }
+                } else {
+                    if ($u->info['sex'] == 0) {
+                        $d->sys_chat('<b>' . $u->info['login'] . '</b> ������� ����������!');
+                    } else {
+                        $d->sys_chat('<b>' . $u->info['login'] . '</b> �������� ����������!');
+                    }
+                }
+            }
+
+            $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('<b>'.$u->info['login'].'</b> ������� ����������, ����� ������� ������ ���� <b>'.$cn['login'].'</b>');
-						}else{
-							$d->sys_chat('<b>'.$u->info['login'].'</b> �������� ����������, ����� ������� ������ ���� <b>'.$cn['login'].'</b>');
-						}
-					}else{
-						if( $u->info['sex'] == 0 ) {
-							$d->sys_chat('<b>'.$u->info['login'].'</b> ������� ����������, ����� ������� ������ ����� <b>'.$cn['login'].'</b>');
-						}else{
-							$d->sys_chat('<b>'.$u->info['login'].'</b> �������� ����������, ����� ������� ������ ����� <b>'.$cn['login'].'</b>');
-						}
-					}
-				}else{
-					if( $u->info['sex'] == 0 ) {
-						$d->sys_chat('<b>'.$u->info['login'].'</b> ������� ����������!');
-					}else{
-						$d->sys_chat('<b>'.$u->info['login'].'</b> �������� ����������!');
-					}
-				}
-			}
-			
-			$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 '<script type="text/javascript">window.location.href="main.php";</script>';
-			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 '<br><br><center>������� &quot;'.str_replace('.php','',$file[0]).'&quot; �� ����������, ��������� <a href="main.php?rnd='.$code.'">�����</a></center>';
-		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 '<br><br><center>������� &quot;' . str_replace('.php', '', $file[0]) . '&quot; �� ����������, ��������� <a href="main.php?rnd=' . $code . '">�����</a></center>';
+            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 '<br><br><center>������� &quot;'.str_replace('.php','',$file[0]).'&quot; �� ����������, ��������� <a href="main.php?rnd='.$code.'">�����</a></center>';
-		mysql_query('UPDATE `stats` SET `x` = "'.$file[1].'",`y` = "'.$file[2].'",`s` = "'.$file[3].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');	
-	}
-} else {
-?>
-<script type="text/javascript" src="js/jquery.js"></script>
-<script>
-<? if(!isset($_GET['ajax'])) { ?> //��� ������������
+    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 '<br><br><center>������� &quot;' . str_replace('.php', '', $file[0]) . '&quot; �� ����������, ��������� <a href="main.php?rnd=' . $code . '">�����</a></center>';
+            mysql_query('UPDATE `stats` SET `x` = "' . $file[1] . '",`y` = "' . $file[2] . '",`s` = "' . $file[3] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
+        }
+    } else {
+        ?>
+        <script type="text/javascript" src="js/jquery.js"></script>
+        <script>
+            <?php if(!isset($_GET['ajax'])) { ?> //��� ������������
 
-	// ��� ���������
-	
-setInterval('top.c.noEr = 0;',1000);
-$('body').keydown(function( event ) {
-  if((event.which == 38 || event.which == 87) && top.c.noEr==0) {
-	goToLoca(1,'������');
-	top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
-	
-  }else if((event.which == 37 || event.which == 65) && top.c.noEr==0) {
-  	 goToLoca(4,'������');
-	 top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
-  }else if((event.which == 39 || event.which == 68) && top.c.noEr==0) {
-  	 goToLoca(3,'�������');
-	 top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
-  }else if((event.which == 40 || event.which == 83)&& top.c.noEr==0) {
-  	 goToLoca(2,'����');
-	 top.c.noEr = 1; clearTimeout(top.c.noErTmr); top.c.noErTmr = setTimeout('top.c.noEr = 0;',1000);
-  }
-  else if(event.which == 70 || event.which == 13) {
-  	 /* //��� $u->info['x'] $u->info['y'] $u->info['dnow']
-	 $u->info['s'] = 1(������) 
-	 $u->info['s'] = 2(�����) 
-	 $u->info['s'] = 3(�����) 
+            // ��� ���������
+
+            setInterval('top.c.noEr = 0;', 1000);
+            $('body').keydown(function (event) {
+                if ((event.which == 38 || event.which == 87) && top.c.noEr == 0) {
+                    goToLoca(1, '������');
+                    top.c.noEr = 1;
+                    clearTimeout(top.c.noErTmr);
+                    top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000);
+
+                } else if ((event.which == 37 || event.which == 65) && top.c.noEr == 0) {
+                    goToLoca(4, '������');
+                    top.c.noEr = 1;
+                    clearTimeout(top.c.noErTmr);
+                    top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000);
+                } else if ((event.which == 39 || event.which == 68) && top.c.noEr == 0) {
+                    goToLoca(3, '�������');
+                    top.c.noEr = 1;
+                    clearTimeout(top.c.noErTmr);
+                    top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000);
+                } else if ((event.which == 40 || event.which == 83) && top.c.noEr == 0) {
+                    goToLoca(2, '����');
+                    top.c.noEr = 1;
+                    clearTimeout(top.c.noErTmr);
+                    top.c.noErTmr = setTimeout('top.c.noEr = 0;', 1000);
+                } else if (event.which == 70 || event.which == 13) {
+                    /* //��� $u->info['x'] $u->info['y'] $u->info['dnow']
+	 $u->info['s'] = 1(������)
+	 $u->info['s'] = 2(�����)
+	 $u->info['s'] = 3(�����)
 	 $u->info['s'] = 4(�����)
 	 */
-	 stor=<?echo $u->info['s'];?>;
-	 bott =0;
-	 if (stor==1)
-	 {
-		 <? 
-		 $bottem = mysql_fetch_assoc(mysql_query('SELECT `id2` FROM `dungeon_bots` WHERE `dn` = "'.$u->info['dnow'].'" AND `delete` = "0" AND `x` = "'.($u->info['x']).'" AND `y` = "'.($u->info['y']+1).'" LIMIT 1'));
-		 if (isset($bottem['id2']))
-		 {
-			 ?> bott = <?echo $bottem['id2'];?>;<?
-		 }
-		 ?>
-	 }
-	 else if(stor==2)
-	 {
-		 <? 
-		 $bottem = mysql_fetch_assoc(mysql_query('SELECT `id2` FROM `dungeon_bots` WHERE `dn` = "'.$u->info['dnow'].'" AND `delete` = "0" AND `x` = "'.($u->info['x']-1).'" AND `y` = "'.($u->info['y']).'" LIMIT 1'));
-		 if (isset($bottem['id2']))
-		 {
-			 ?> bott = <?echo $bottem['id2'];?>;<?
-		 }
-		 ?>
-	 }
-	 else if(stor==3)
-	 {
-		 <? 
-		 $bottem = mysql_fetch_assoc(mysql_query('SELECT `id2` FROM `dungeon_bots` WHERE `dn` = "'.$u->info['dnow'].'" AND `delete` = "0" AND `x` = "'.($u->info['x']).'" AND `y` = "'.($u->info['y']-1).'" LIMIT 1'));
-		 if (isset($bottem['id2']))
-		 {
-			 ?> bott = <?echo $bottem['id2'];?>;<?
-		 }
-		 ?>
-	 }
-	 else if(stor==4)
-	 {
-		 <? 
-		 $bottem = mysql_fetch_assoc(mysql_query('SELECT `id2` FROM `dungeon_bots` WHERE `dn` = "'.$u->info['dnow'].'" AND `delete` = "0" AND `x` = "'.($u->info['x']+1).'" AND `y` = "'.($u->info['y']).'" LIMIT 1'));
-		 if (isset($bottem['id2']))
-		 {
-			 ?> bott = <?echo $bottem['id2'];?>;<?
-		 }
-		 ?>
-	 }
+                    stor =<?echo $u->info['s'];?>;
+                    bott = 0;
+                    if (stor == 1) {
+                        <?
+                        $bottem = mysql_fetch_assoc(mysql_query('SELECT `id2` FROM `dungeon_bots` WHERE `dn` = "' . $u->info['dnow'] . '" AND `delete` = "0" AND `x` = "' . ($u->info['x']) . '" AND `y` = "' . ($u->info['y'] + 1) . '" LIMIT 1'));
+                        if (isset($bottem['id2']))
+                        {
+                        ?> bott = <?echo $bottem['id2'];?>;<?
+                        }
+                        ?>
+                    } else if (stor == 2) {
+                        <?
+                        $bottem = mysql_fetch_assoc(mysql_query('SELECT `id2` FROM `dungeon_bots` WHERE `dn` = "' . $u->info['dnow'] . '" AND `delete` = "0" AND `x` = "' . ($u->info['x'] - 1) . '" AND `y` = "' . ($u->info['y']) . '" LIMIT 1'));
+                        if (isset($bottem['id2']))
+                        {
+                        ?> bott = <?echo $bottem['id2'];?>;<?
+                        }
+                        ?>
+                    } else if (stor == 3) {
+                        <?
+                        $bottem = mysql_fetch_assoc(mysql_query('SELECT `id2` FROM `dungeon_bots` WHERE `dn` = "' . $u->info['dnow'] . '" AND `delete` = "0" AND `x` = "' . ($u->info['x']) . '" AND `y` = "' . ($u->info['y'] - 1) . '" LIMIT 1'));
+                        if (isset($bottem['id2']))
+                        {
+                        ?> bott = <?echo $bottem['id2'];?>;<?
+                        }
+                        ?>
+                    } else if (stor == 4) {
+                        <?
+                        $bottem = mysql_fetch_assoc(mysql_query('SELECT `id2` FROM `dungeon_bots` WHERE `dn` = "' . $u->info['dnow'] . '" AND `delete` = "0" AND `x` = "' . ($u->info['x'] + 1) . '" AND `y` = "' . ($u->info['y']) . '" LIMIT 1'));
+                        if (isset($bottem['id2']))
+                        {
+                        ?> bott = <?echo $bottem['id2'];?>;<?
+                        }
+                        ?>
+                    }
 
-	 if (bott != 0)
-	 {
-		window.location.href = "/main.php?atack="+bott+"&rnd=<? echo $code; ?>";
-	 }
-}else if(event.which == 32 || event.which == 90) {
-	itemtake=0;
-	<? $sp = mysql_fetch_assoc(mysql_query('SELECT `ish`.* FROM `dungeon_items` AS `ish` WHERE `ish`.`dn` = "'.$u->info['dnow'].'" 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 1')); 
-		if (isset($sp['id']))
-		{?>
-			itemtake = <?echo $sp['id'];?>;
-	  <?}?>
-	if (itemtake != 0)
-	 {
-		takeItem(itemtake);
-	 }
-  
-  }
-  if( event.which == 81) {
-  	Fast(1);
-	
-  }else if( event.which == 69 ) {
-	Fast(2);
+                    if (bott != 0) {
+                        window.location.href = "/main.php?atack=" + bott + "&rnd=<? echo $code; ?>";
+                    }
+                } else if (event.which == 32 || event.which == 90) {
+                    itemtake = 0;
+                    <? $sp = mysql_fetch_assoc(mysql_query('SELECT `ish`.* FROM `dungeon_items` AS `ish` WHERE `ish`.`dn` = "' . $u->info['dnow'] . '" 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 1'));
+                    if (isset($sp['id']))
+                    {?>
+                    itemtake = <?echo $sp['id'];?>;
+                    <?}?>
+                    if (itemtake != 0) {
+                        takeItem(itemtake);
+                    }
 
-	
-  }
-});
-<? } ?>
+                }
+                if (event.which == 81) {
+                    Fast(1);
 
-function dialogMenu(id,atk,talk,look,take,e,tmkt)
-{
-	var d = document.getElementById('deMenu');
-	if(d!=undefined)
-	{
-		if(e == undefined)
-    	{
-       		e = window.e;
-			
-    	}
-		d.innerHTML = '';
-		var t = '';
-		if(talk>0)
-		{
-			t += '<a href="main.php?talk='+talk+'&rnd=<? echo $code; ?>">������</a><br>';
-		}
-		if(atk==1)
-		{
-			if( tmkt == 0 ) {
-				t += '<a href="main.php?atack='+id+'&rnd=<? echo $code; ?>">�������</a><br>';
-			}else{
-				if( tmkt == 1 ) {
-					//�����
-					<? if(isset($sb['id'])) { ?>
-					t += '<a href="main.php?addpuck='+id+'&rnd=<? echo $code; ?>">�������� �����</a><br>';
-					<? }else{ ?>
-					t += '<i>��� ��������</i>';
-					<? } ?>
-				}else{
-					//������
-					t += '<a href="main.php?atack='+id+'&rnd=<? echo $code; ?>">�������</a><br>';
-				}
-			}
-			
-		}
-		if(look==1)
-		{
-			t += '��������<br>';
-		}
-		if(take==1)
-		{
-			t += '�������<br>';
-		}
-		d.innerHTML = t+'<small style="float:right;"><button style="border: solid 1pt #B0B0B0; font-family: MS Sans Serif; font-size: 10px; color: #191970; MARGIN-BOTTOM: 2px; MARGIN-TOP: 1px;" type="button" onClick="exitDem();">x</button></center>';
-		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';
-		}
-	}
-}
+                } else if (event.which == 69) {
+                    Fast(2);
 
-function exitDem()
-{
-	var d = document.getElementById('deMenu');
-	if(d!=undefined)
-	{
-		d.innerHTML = '';
-		d.style.display = 'none';
-		d.style.top = '0px';
-		d.style.right = '0px';
-	}
-}
 
-var objects = {};
-//i:{id,login,mapPoint,sex,obraz,type,users_p},
-var users   = {<? echo $d->genUsers(); ?>};
-var objs   = {<? echo $d->genObjects(); ?>};
-var items   = {};
-var actions = {};
-var dsee = <? echo 0+$d->gs; ?>;
-var 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'}
-var zmap = {5:894,8:0,12:0}
-var zfloor0 = {1:'',2:'',3:'',4:'',5:''};
-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)+m.innerHTML;
-			}
-		}
-		i++;
-	}
-	var i = 5;
-	while(i>=1)
-	{
-		if(zfloor0[i]!='')
-		{
-			document.getElementById('Floor0').innerHTML += zfloor0[i];
-		}
-		i--;
-	}
-}
-var dConfig={2:{1:{'top':54,'left':140,'w':80,'h':147},2:{'top':56,'left':92,'w':75,'h':137},3:{'top':51,'left':186,'w':75,'h':137},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 dialogMenu(id, atk, talk, look, take, e, tmkt) {
+                var d = document.getElementById('deMenu');
+                if (d != undefined) {
+                    if (e == undefined) {
+                        e = window.e;
 
-function addObj(v, mz) {
-  var r = '', rz = 0;
+                    }
+                    d.innerHTML = '';
+                    var t = '';
+                    if (talk > 0) {
+                        t += '<a href="main.php?talk=' + talk + '&rnd=<? echo $code; ?>">������</a><br>';
+                    }
+                    if (atk == 1) {
+                        if (tmkt == 0) {
+                            t += '<a href="main.php?atack=' + id + '&rnd=<? echo $code; ?>">�������</a><br>';
+                        } else {
+                            if (tmkt == 1) {
+                                //�����
+                                <? if(isset($sb['id'])) { ?>
+                                t += '<a href="main.php?addpuck=' + id + '&rnd=<? echo $code; ?>">�������� �����</a><br>';
+                                <? }else{ ?>
+                                t += '<i>��� ��������</i>';
+                                <? } ?>
+                            } else {
+                                //������
+                                t += '<a href="main.php?atack=' + id + '&rnd=<? echo $code; ?>">�������</a><br>';
+                            }
+                        }
 
-  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 (look == 1) {
+                        t += '��������<br>';
+                    }
+                    if (take == 1) {
+                        t += '�������<br>';
+                    }
+                    d.innerHTML = t + '<small style="float:right;"><button style="border: solid 1pt #B0B0B0; font-family: MS Sans Serif; font-size: 10px; color: #191970; MARGIN-BOTTOM: 2px; MARGIN-TOP: 1px;" type="button" onClick="exitDem();">x</button></center>';
+                    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';
+                    }
+                }
+            }
 
-  if(v[5] == dsee) {
-	rz -= 1;
-  }
+            function exitDem() {
+                var d = document.getElementById('deMenu');
+                if (d != undefined) {
+                    d.innerHTML = '';
+                    d.style.display = 'none';
+                    d.style.top = '0px';
+                    d.style.right = '0px';
+                }
+            }
 
-  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; }
+            var objects = {};
+            //i:{id,login,mapPoint,sex,obraz,type,users_p},
+            var users = {<? echo $d->genUsers(); ?>};
+            var objs = {<? echo $d->genObjects(); ?>};
+            var items = {};
+            var actions = {};
+            var dsee = <? echo 0 + $d->gs; ?>;
+            var 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'
+            }
+            var zmap = {5: 894, 8: 0, 12: 0}
+            var zfloor0 = {1: '', 2: '', 3: '', 4: '', 5: ''};
 
-	if(v[9] != 0) {
-	  new_left += Math.round(new_left/(100+(rz-1)*10)*v[9]+rz*0.25);
-	}
+            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) + m.innerHTML;
+                        }
+                    }
+                    i++;
+                }
+                var i = 5;
+                while (i >= 1) {
+                    if (zfloor0[i] != '') {
+                        document.getElementById('Floor0').innerHTML += zfloor0[i];
+                    }
+                    i--;
+                }
+            }
 
-	if(v[10] != 0) {
-	  new_top += Math.round(new_h/2+new_top/(100+(rz-1)*50)*v[10]-rz*3.3);
-	}	
+            var dConfig = {
+                2: {
+                    1: {'top': 54, 'left': 140, 'w': 80, 'h': 147},
+                    2: {'top': 56, 'left': 92, 'w': 75, 'h': 137},
+                    3: {'top': 51, 'left': 186, 'w': 75, 'h': 137},
+                    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
+                    }
+                }
+            }
 
-	if(rz == 4) {
-	  new_top += 3;
-	}
+            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}};
 
-	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];
-	  }
+            function addObj(v, mz) {
+                var r = '', rz = 0;
 
-	  if(v[11]['w'+rz] != undefined) {
-		new_w += v[11]['w'+rz];
-	  }
+                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[11]['h'+rz] != undefined) {
-		new_h += v[11]['h'+rz];
-	  }
+                if (v[5] == dsee) {
+                    rz -= 1;
+                }
 
-	  if(v[11]['rt'+rz] != undefined) {
-		new_top = v[11]['rt'+rz];
-	  }
+                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[11]['rl'+rz] != undefined) {
-		new_left = v[11]['rl'+rz];
-	  }
-	}
+                    if (v[9] != 0) {
+                        new_left += Math.round(new_left / (100 + (rz - 1) * 10) * v[9] + rz * 0.25);
+                    }
 
-	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 = 'takeObj('+v[0]+')';
-		}
-	  }
+                    if (v[10] != 0) {
+                        new_top += Math.round(new_h / 2 + new_top / (100 + (rz - 1) * 50) * v[10] - rz * 3.3);
+                    }
 
-	  zfloor0[rz] = '<img title="'+v[1]+'" onclick="'+actionNow+'" src="https://img.new-combats.com/1x1.gif" style="cursor: pointer; position: absolute; top: '+new_top+'px; left: '+new_left+'px; width: '+new_w+'px; height: '+new_h+'px;" />'+zfloor0[rz];			
-	} else {
-	  zfloor0[rz] = '<img title="'+v[1]+'" src="https://img.new-combats.com/1x1.gif" style="position: absolute; top: '+new_top+'px; left: '+new_left+'px; width: '+new_w+'px; height: '+new_h+'px;" />'+zfloor0[rz];
-	}
-	r = '<img title="obj" src="https://img.new-combats.com/i/sprites/'+v[4]+'" class="dObj" style="position: absolute; top: '+new_top+'px; left: '+new_left+'px; width: '+new_w+'px; height: '+new_h+'px;" />';
-	}
-	return r;
-}
+                    if (rz == 4) {
+                        new_top += 3;
+                    }
 
-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' || <?=$d->info['bsid'];?> > 0){
-				action = 'dialogMenu('+v[0]+','+v[8]+','+v[7]+',0,0,event,'+v[9]+');';
-			}
-			zfloor0[rz] += '<img title="'+v[1]+'" onClick="'+action+'" src="https://img.new-combats.com/1x1.gif" style="cursor:pointer;position:absolute;top:'+new_top+'px;left:'+new_left+'px;width:'+new_w+'px;height:'+new_h+'px;" />';			
-		}else{
-			zfloor0[rz] += '<img title="'+v[1]+'" src="https://img.new-combats.com/1x1.gif" style="position:absolute;top:'+new_top+'px;left:'+new_left+'px;width:'+new_w+'px;height:'+new_h+'px;" />';
-		}
-		r = '<img title="user" src="https://img.new-combats.com/chars/'+v[3]+'/'+v[4]+'.gif" class="dUser" style="position:absolute;top:'+new_top+'px;left:'+new_left+'px;width:'+new_w+'px;height:'+new_h+'px;" />';
-	}
-	return r;
-}
+                    if (v[11] != 0) {
+                        if (v[11]['t' + rz] != undefined) {
+                            new_top += v[11]['t' + rz];
+                        }
 
-var speedLoc  = 0, sLoc1 = 0, sLoc2 = 0, tgo  = 0, tgol = 0, gotoup777 = 0, gotext777 = '';
+                        if (v[11]['l' + rz] != undefined) {
+                            new_left += v[11]['l' + rz];
+                        }
 
-function cancelgoto() {
-  document.getElementById('gotext777').innerHTML = '';
-  gotoup777 = 0;
-  gotext777 = '';
-}
+                        if (v[11]['w' + rz] != undefined) {
+                            new_w += v[11]['w' + rz];
+                        }
 
-function goToLoca(id, ttl) {
-  if(tgo < 1) {
- /*$.ajax({
+                        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];
+                        }
+                    }
+
+                    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 = 'takeObj(' + v[0] + ')';
+                            }
+                        }
+
+                        zfloor0[rz] = '<img title="' + v[1] + '" onclick="' + actionNow + '" src="https://img.new-combats.com/1x1.gif" style="cursor: pointer; position: absolute; top: ' + new_top + 'px; left: ' + new_left + 'px; width: ' + new_w + 'px; height: ' + new_h + 'px;" />' + zfloor0[rz];
+                    } else {
+                        zfloor0[rz] = '<img title="' + v[1] + '" src="https://img.new-combats.com/1x1.gif" style="position: absolute; top: ' + new_top + 'px; left: ' + new_left + 'px; width: ' + new_w + 'px; height: ' + new_h + 'px;" />' + zfloor0[rz];
+                    }
+                    r = '<img title="obj" src="https://img.new-combats.com/i/sprites/' + v[4] + '" class="dObj" style="position: absolute; top: ' + new_top + 'px; left: ' + new_left + 'px; width: ' + new_w + 'px; height: ' + new_h + 'px;" />';
+                }
+                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' || <?=$d->info['bsid'];?> > 0) {
+                            action = 'dialogMenu(' + v[0] + ',' + v[8] + ',' + v[7] + ',0,0,event,' + v[9] + ');';
+                        }
+                        zfloor0[rz] += '<img title="' + v[1] + '" onClick="' + action + '" src="https://img.new-combats.com/1x1.gif" style="cursor:pointer;position:absolute;top:' + new_top + 'px;left:' + new_left + 'px;width:' + new_w + 'px;height:' + new_h + 'px;" />';
+                    } else {
+                        zfloor0[rz] += '<img title="' + v[1] + '" src="https://img.new-combats.com/1x1.gif" style="position:absolute;top:' + new_top + 'px;left:' + new_left + 'px;width:' + new_w + 'px;height:' + new_h + 'px;" />';
+                    }
+                    r = '<img title="user" src="https://img.new-combats.com/chars/' + v[3] + '/' + v[4] + '.gif" class="dUser" style="position:absolute;top:' + new_top + 'px;left:' + new_left + 'px;width:' + new_w + 'px;height:' + new_h + 'px;" />';
+                }
+                return r;
+            }
+
+            var speedLoc = 0, sLoc1 = 0, sLoc2 = 0, tgo = 0, tgol = 0, gotoup777 = 0, gotext777 = '';
+
+            function cancelgoto() {
+                document.getElementById('gotext777').innerHTML = '';
+                gotoup777 = 0;
+                gotext777 = '';
+            }
+
+            function goToLoca(id, ttl) {
+                if (tgo < 1) {
+                    /*$.ajax({
       url: "main.php?go="+id+"&rnd=<?=$code;?>&ajax=1",
       success: function(html) {
         $("body").html(html);
       }
 	});*/
-	// console.log(document.getElementById("divWindowImg"))
-	location.href = `/main.php?go=${id}&rnd=<?=$code;?>`;
+                    // console.log(document.getElementById("divWindowImg"))
+                    location.href = `/main.php?go=${id}&rnd=<?=$code;?>`;
 
-	// console.log()
-  } else {
-	  // ����� �����, ����� ����� �������� �� ������ ������/����� �� ����� ��������
-	//   console.log("�����")
- gotoup777 = id;
- gotext777 = ttl;
-  }
-}
+                    // console.log()
+                } else {
+                    // ����� �����, ����� ����� �������� �� ������ ������/����� �� ����� ��������
+                    //   console.log("�����")
+                    gotoup777 = id;
+                    gotext777 = ttl;
+                }
+            }
 
-function takeObj(objId) {
-  /*$.ajax({
+            function takeObj(objId) {
+                /*$.ajax({
     url: "main.php?take_obj="+objId+"&rnd=<?=$code;?>&ajax=1",
     cache: false,
     success: function(html) {
       $("body").html(html);
     }
   });*/
-  location.href = "/main.php?take_obj="+objId+"&rnd=<?=$code;?>";
-}
+                location.href = "/main.php?take_obj=" + objId + "&rnd=<?=$code;?>";
+            }
 
-function takeItem(itemId) {
-  /*$.ajax({
+            function takeItem(itemId) {
+                /*$.ajax({
     url: "main.php?take="+itemId+"&rnd=<?=$code;?>&ajax=1",
     cache: false,
     success: function(html) {
       $("body").html(html);
     }
   });*/
-  location.href = "/main.php?take="+itemId+"&rnd=<?=$code;?>";
-}
+                location.href = "/main.php?take=" + itemId + "&rnd=<?=$code;?>";
+            }
 
-function Fast(look) {
-  /*$.ajax({
+            function Fast(look) {
+                /*$.ajax({
     url: "main.php?look="+look+"&rnd=<?=$code;?>&ajax=1",
     cache: false,
     success: function(html) {
       $("body").html(html);
     }
   });*/
-  location.href = "/main.php?look="+look+"&rnd=<?=$code;?>";
-}
+                location.href = "/main.php?look=" + look + "&rnd=<?=$code;?>";
+            }
 
-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;
-	}
+            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;
-	}
+                    if (sLoc1 > 108) {
+                        sLoc1 = 108;
+                    }
 
-	line.style.width = `${sLoc1}px`;
+                    line.style.width = `${sLoc1}px`;
 
-	if(tgo > 0) {
-	  tgo -= 1;
-	//   console.log("����� �����")
-	  setTimeout('locGoLineDng()', 100);
-	} else {
-	  if(gotoup777 > 0) {
-		// ����� �� ������, ��� ��������, ����� ��� ��� � �������� ������
-		// ������ � ������ �������� �� ������ ���� ���������� ���� ���
-		location.href = `/main.php?go=${gotoup777}&rnd=<?=$code;?>`;
-	}
-	}
-	
-	var $DomGotext777 = document.getElementById('gotext777')
-	
-	if (gotoup777 > 0 && gotext777 != '' && $DomGotext777.innerHTML != `�� ��������� <b>${gotext777}</b> (<a href="javascript:void(0)" onclick="cancelgoto()">������</a>)`) {
-		$DomGotext777.innerHTML = `�� ��������� <b>${gotext777}</b> (<a href="javascript:void(0)" onclick="cancelgoto()">������</a>)`;
-		} else if ($DomGotext777.innerHTML != '' && gotoup777 == 0 && gotext777 == '') {
-			$DomGotext777.innerHTML = '';
-		}
-	}
-}
-<?
-$tmGo  = $u->info['timeGo']-time(); //������� ������ ��������
-$tmGol = $u->info['timeGo']-$u->info['timeGoL']; //������� ������ ���� �����
-echo 'var tgo = '.($tmGo*10).'; var tgol = '.($tmGol*10).';'; ?>
-</script>
-<link href="https://img.new-combats.com/css/dungeon_<? echo $d->point['css']; ?>.css" rel="stylesheet" type="text/css" />
-<style>
-.hintDm {
-	position:absolute;
-	background-color:#E4E4E4;
-	padding:5px;
-	border:1px solid #999;	
-	z-index:1;
-	width:70px;
-}
-.dUser { 
-	max-height:220px;
-	max-width:120px;
-	min-width:30px;
-	min-height:55px;
-	border:		0px solid;
-	padding:	0px;
-	margin:		0px;
-}
-.dObj {
-	border:		0px solid;
-	padding:	0px;
-	margin:		0px;
-}
-.test1 {
-	text-align: right;
-}
-#pline1 {
-	background-image:url(https://img.new-combats.com/wait3.gif);
-	height:9px;
-	z-index:1000;
-}
-</style>
-<div id="deMenu" class="hintDm" style="display:none;z-index:5000px;"></div>
-<div style="margin-right:1px;">
-<table width="100%" border="0" cellspacing="0" cellpadding="0">
-  <tr>
-    <td>
-<p style="float:left;">&nbsp;<? if(isset($d->error)){ echo '<font color="red">'.$d->error.'</font><br>'; } ?></p>
-<? if($d->info['bsid']==0 && $d->info['id2'] != 106){ ?><p style="float:right;"><a onClick="if(confirm('����� �� ������?')){ location.href = '/main.php?exitd=<? echo $code; ?>'; }" href="javascript:void(0)">�����</a></p><? } ?>
-    </td>
-    </tr>
-  <tr>
-    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
-      <tr>
-        <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
-          <tr>
-            <td valign="top"><div align="left">
-              <div id="users"><? if($d->info['bsid']==0){ echo $d->usersDng();
-		    if( $dies > 0 ) {
-			echo '<H4>���-�� �������: '.$dies.'</H4>';
-		    }
-			/*if($dies > 3) {
+                    if (tgo > 0) {
+                        tgo -= 1;
+                        //   console.log("����� �����")
+                        setTimeout('locGoLineDng()', 100);
+                    } else {
+                        if (gotoup777 > 0) {
+                            // ����� �� ������, ��� ��������, ����� ��� ��� � �������� ������
+                            // ������ � ������ �������� �� ������ ���� ���������� ���� ���
+                            location.href = `/main.php?go=${gotoup777}&rnd=<?=$code;?>`;
+                        }
+                    }
+
+                    var $DomGotext777 = document.getElementById('gotext777')
+
+                    if (gotoup777 > 0 && gotext777 != '' && $DomGotext777.innerHTML != `�� ��������� <b>${gotext777}</b> (<a href="javascript:void(0)" onclick="cancelgoto()">������</a>)`) {
+                        $DomGotext777.innerHTML = `�� ��������� <b>${gotext777}</b> (<a href="javascript:void(0)" onclick="cancelgoto()">������</a>)`;
+                    } else if ($DomGotext777.innerHTML != '' && gotoup777 == 0 && gotext777 == '') {
+                        $DomGotext777.innerHTML = '';
+                    }
+                }
+            }
+            <?
+            $tmGo = $u->info['timeGo'] - time(); //������� ������ ��������
+            $tmGol = $u->info['timeGo'] - $u->info['timeGoL']; //������� ������ ���� �����
+            echo 'var tgo = ' . ($tmGo * 10) . '; var tgol = ' . ($tmGol * 10) . ';'; ?>
+        </script>
+        <link href="https://img.new-combats.com/css/dungeon_<? echo $d->point['css']; ?>.css" rel="stylesheet"
+              type="text/css"/>
+        <style>
+            .hintDm {
+                position: absolute;
+                background-color: #E4E4E4;
+                padding: 5px;
+                border: 1px solid #999;
+                z-index: 1;
+                width: 70px;
+            }
+
+            .dUser {
+                max-height: 220px;
+                max-width: 120px;
+                min-width: 30px;
+                min-height: 55px;
+                border: 0px solid;
+                padding: 0px;
+                margin: 0px;
+            }
+
+            .dObj {
+                border: 0px solid;
+                padding: 0px;
+                margin: 0px;
+            }
+
+            .test1 {
+                text-align: right;
+            }
+
+            #pline1 {
+                background-image: url(https://img.new-combats.com/wait3.gif);
+                height: 9px;
+                z-index: 1000;
+            }
+        </style>
+        <div id="deMenu" class="hintDm" style="display:none;z-index:5000px;"></div>
+        <div style="margin-right:1px;">
+            <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                <tr>
+                    <td>
+                        <p style="float:left;">&nbsp;<? if (isset($d->error)) {
+                                echo '<font color="red">' . $d->error . '</font><br>';
+                            } ?></p>
+                        <? if ($d->info['bsid'] == 0 && $d->info['id2'] != 106) { ?><p style="float:right;"><a
+                                    onClick="if(confirm('����� �� ������?')){ location.href = '/main.php?exitd=<? echo $code; ?>'; }"
+                                    href="javascript:void(0)">�����</a></p><? } ?>
+                    </td>
+                </tr>
+                <tr>
+                    <td>
+                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                            <tr>
+                                <td valign="top">
+                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                                        <tr>
+                                            <td valign="top">
+                                                <div align="left">
+                                                    <div id="users"><? if ($d->info['bsid'] == 0) {
+                                                            echo $d->usersDng();
+                                                            if ($dies > 0) {
+                                                                echo '<H4>���-�� �������: ' . $dies . '</H4>';
+                                                            }
+                                                            /*if($dies > 3) {
 				mysql_query('UPDATE `users` set `room` = "321" WHERE `id` = "'.$u->info['id'].'" LIMIT1 ');
 			}*/
-		}else{
-		    if($d->info['id2'] != 15) {
-				//����� ��������� � �����������
-		    	echo '<H4>����� ���������:</H4>';
-		    	echo $d->usersDng();
-			}else{
-				echo '<H4>������� ����. �������: <font color=red>'.(0+$tm1win).'</font> - �����: <font color=blue>'.(0+$tm2win).'</font></H4>';
-				if( $dies > 0 ) {
-					echo '<H4>���-�� �������: '.$dies.'</H4>';
-				}
-				if(isset($sb['id'])) {
-					echo '<H4><font color=blue>����� � ���, ������� � � ������ ����������!</font></h4>';
-				}
-			}
-		}
-		//���������� ������ ������� �������
-		$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 .= '<small>�������: &nbsp; '.$pq['name'].' '.$q->infoDng($pq).'</small><br>';
-		    	$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 = '<table style="display:inline-block;" border="0" cellspacing="0" cellpadding="0" height="10"><tr><td valign="middle" width="120" style="padding-top:12px">
-  <div style="position:relative;"><div id="vhp-1234600000'.$pl['id'].'" title="���������� �������" align="left" class="seehp" style="position:absolute; top:-10px; width:120px; height:10px; z-index:12;"> '.$xrz.'/'.$r.'</div>
+                                                        } else {
+                                                            if ($d->info['id2'] != 15) {
+                                                                //����� ��������� � �����������
+                                                                echo '<H4>����� ���������:</H4>';
+                                                                echo $d->usersDng();
+                                                            } else {
+                                                                echo '<H4>������� ����. �������: <font color=red>' . (0 + $tm1win) . '</font> - �����: <font color=blue>' . (0 + $tm2win) . '</font></H4>';
+                                                                if ($dies > 0) {
+                                                                    echo '<H4>���-�� �������: ' . $dies . '</H4>';
+                                                                }
+                                                                if (isset($sb['id'])) {
+                                                                    echo '<H4><font color=blue>����� � ���, ������� � � ������ ����������!</font></h4>';
+                                                                }
+                                                            }
+                                                        }
+                                                        //���������� ������ ������� �������
+                                                        $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 .= '<small>�������: &nbsp; ' . $pq['name'] . ' ' . $q->infoDng($pq) . '</small><br>';
+                                                                $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 = '<table style="display:inline-block;" border="0" cellspacing="0" cellpadding="0" height="10"><tr><td valign="middle" width="120" style="padding-top:12px">
+  <div style="position:relative;"><div id="vhp-1234600000' . $pl['id'] . '" title="���������� �������" align="left" class="seehp" style="position:absolute; top:-10px; width:120px; height:10px; z-index:12;"> ' . $xrz . '/' . $r . '</div>
   <div title="���������� �������" class="hpborder" style="position:absolute; top:-10px; width:120px; height:9px; z-index:13;"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
-  <div class="hp_3 senohp" style="height:9px; width:120px; position:absolute; top:-10px; z-index:11;" id="lhp-1234600000'.$pl['id'].'"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
+  <div class="hp_3 senohp" style="height:9px; width:120px; position:absolute; top:-10px; z-index:11;" id="lhp-1234600000' . $pl['id'] . '"><img src="https://img.new-combats.com/1x1.gif" height="9" width="1"></div>
   <div title="���������� �������" class="hp_none" style="position:absolute; top:-10px; width:120px; height:10px; z-index:10;"><img src="https://img.new-combats.com/1x1.gif" height="10"></div>
-</div></td></tr></table><br><script>top.startHpRegen("main",-1234600000'.$pl['id'].','.$xrz.','.$r.',0,0,0,0,0,0,1);</script>';
+</div></td></tr></table><br><script>top.startHpRegen("main",-1234600000' . $pl['id'] . ',' . $xrz . ',' . $r . ',0,0,0,0,0,0,1);</script>';
 
-			$qsee .= '<small>�������: &nbsp; '.$pl['info'].' '.$r.'</small><br>';
-		}
-		if( $qsee != '' ) {
-		    echo '<br><br>'.$qsee;
-		}
-		?></div>
-              <div id="items"><? echo $d->itemsMap(); ?></div>
-			  <div id="information"><? if(isset($d->information)){ echo $d->information; } ?></div>
-            </div>
-			<?
-			if($u->info['admin'] > 0){
-				#echo $d->genObjects();  
-			}
-			?>
-			</td>
-            <td width="530" height="260" valign="top" style="background-image:url(https://img.new-combats.com/maze_layer.jpg); background-repeat:no-repeat;"><div style="position:relative;">
-			
-              <div style="position:absolute;z-index:1;left:397px;top:0px;">
-                <div id="pline1" style="width:1px;"> </div>
-              </div>
-              <div style="position:absolute; z-index:50; left: 374px; top: 110px;">
-              	<img src="https://img.new-combats.com/podzem-map.png" />
-              </div>
-              <div id="minimap" style="position:absolute; left: 374px; top: 110px;">
-                <table border="0" align="center" cellpadding="0" cellspacing="0" style="border:1px solid #333333">
-					<?
-					$i = 1;
-					$htmlv = '';
-					while($i<=8)
-					{
-						$htmlv .= '<tr>';
-						$j = 1;
-						$htmlv2 = '';
-						while($j<=9)
-						{
-							$htmlv2 = '<td width="15" height="15" align="center" valign="middle" align="center" style="margin:1px;" id="min_'.($u->info['x']+(4-$j)).'_'.($u->info['y']+(4-$i)).'"></td>'.$htmlv2;
-							$j++;
-						}
-                        $htmlv .= $htmlv2.'</tr>';
-						$i++;
-					}
-					echo $htmlv;
-					unset($htmlv,$htmlv2);
-					?>
-                    <style>
-					.u_rot1 {
-						-webkit-transform: rotate(-180deg);
-						-moz-transform: rotate(-180deg);
-						filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=6);
-						-o-transform: rotate(60deg);
-					}
-					.u_rot4 {
-						-webkit-transform: rotate(-90deg);
-						-moz-transform: rotate(-90deg);
-						filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
-						-o-transform: rotate(30deg);
-					}
-					.u_rot3 {
-						
-					}
-					.u_rot2 {
-						-webkit-transform: rotate(-270deg);
-						-moz-transform: rotate(-270deg);
-						filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=9);
-						-o-transform: rotate(90deg);
-					}
-					.dBot {
-						display:inline-block; 
-						height: 18px;
-						width:10px;
-						z-index:99;
-						position:absolute;
-						top: -8px;
-						left: -6px;
-						//background-image:url("https://img.new-combats.com/drgn/bg/r.gif");
-					}
-					</style>
-                </table>
-                  <script>
-                  <?
-				  //������� ����-�����
-				$i = 0;
-				$uxy = array();
-				if($u->room['name']!='����� ������'){
-					$sp = mysql_query('SELECT `u`.`login`,`u`.`id`,`s`.`x`,`s`.`y`,`s`.`s` FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `s`.`dnow` = "'.$u->info['dnow'].'" AND `u`.`id` != "'.$u->info['id'].'" LIMIT 10');
-					while($pl = mysql_fetch_array($sp)){
-						$uxy[$pl['x'].'_'.$pl['y']] = $pl;
-					}
-				}
-if( $u->info['admin'] > 0 ||  $d->id_dng == 106 ) {
-				$bxy = array();
-				if($u->room['name']!='����� ������'){
-$sp = mysql_query('SELECT `db`.*, `tb`.`login`, `tb`.`obraz`, `tb`.`sex` FROM `dungeon_bots` as `db` LEFT JOIN `test_bot` as `tb` ON `tb`.`id`=`db`.`id_bot`
-				  WHERE `db`.`dn` = "'.$u->info['dnow'].'" AND `db`.`delete`=0 AND
-				  (`db`.`x` >= '.($u->info['x']-5).' AND `db`.`x` <= '.($u->info['x']+5).') AND
-				  (`db`.`y` >= '.($u->info['y']-5).' AND `db`.`y` <= '.($u->info['y']+5).') 
-				  LIMIT 100');
-					while($pl = mysql_fetch_array($sp)){
-						$bxy[$pl['x'].'_'.$pl['y']] = $pl;
-					} 
-				}
-}
-				
-				$sp = mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "'.$d->id_dng.'" AND (`x` >= '.($u->info['x']-5).' AND `x` <= '.($u->info['x']+5).') AND (`y` >= '.($u->info['y']-5).' AND `y` <= '.($u->info['y']+5).')  ORDER BY `y` ASC , `x` ASC LIMIT 100');
-				
-				$rzn = array(0=>'top',3=>'right',2=>'bottom',1=>'left');
-
-				$sb1 = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_obj` WHERE `name` LIKE "%�����%" AND `dn` = "'.$d->info['id'].'" LIMIT 1'));
-				
-				while($pl = mysql_fetch_array($sp)) {
-					$css  = '"background-image":"url(https://img.new-combats.com/fon555.png)",';
-					$j = 0;
-					
-					while($j<=4){
-						if($pl['st'][$j]==1){
-							$css .= '"border-'.$rzn[$j].'":"1px solid #303030",';
-						}else{
-							$css .= '"margin-'.$rzn[$j].'":"1px",';
-						}
-						$j++;
-					}
-					
-					if( $sb1['x'] == $pl['x'] && $sb1['y'] == $pl['y'] ) {
-						echo '$("#min_'.$pl['x'].'_'.$pl['y'].'").html("<img class=\"u_rot'.$u->info['s'].'\" title=\"�����!\" style=\"margin:2px 3px 3px 2px;background-image:url(https://img.new-combats.com/i/move/shb.gif)\" src=\"https://img.new-combats.com/1x1.gif\" width=\"7\" height=\"7\">");';
-					}elseif( $u->info['x'] == $pl['x'] && $u->info['y'] == $pl['y'] ) {
-						if($d->info['id2'] == 15 ) {
-							$tmbth = 4;
-							$tm = mysql_fetch_array(mysql_query('SELECT * FROM `katok_now` WHERE `clone` = "'.$u->info['id'].'" LIMIT 1'));
-							if($tm['team'] == 1) {
-								$tmbth = 1;
-							}elseif($tm['team'] == 2) {
-								$tmbth = 2;
-							}
-							echo '$("#min_'.$pl['x'].'_'.$pl['y'].'").html("<img class=\"u_rot'.$u->info['s'].'\" title=\"��� ��\" style=\"margin:2px 3px 3px 2px;background-image:url(https://img.new-combats.com/i/move/p'.$tmbth.'/d0.gif)\" src=\"https://img.new-combats.com/1x1.gif\" width=\"7\" height=\"7\">");';
-						}else{
-							echo '$("#min_'.$pl['x'].'_'.$pl['y'].'").html("<img class=\"u_rot'.$u->info['s'].'\" title=\"��� ��\" style=\"margin:2px 3px 3px 2px;background-image:url(https://img.new-combats.com/i/move/p1/d0.gif)\" src=\"https://img.new-combats.com/1x1.gif\" width=\"7\" height=\"7\">");';
-						}
-					} elseif($d->info['id2'] == 15 ) {
-						$tmbth = 4;
-						$tm = mysql_fetch_array(mysql_query('SELECT * FROM `katok_now` WHERE `clone` = "'.$uxy[$pl['x'].'_'.$pl['y']]['id'].'" LIMIT 1'));
-						if($tm['team'] == 1) {
-							$tmbth = 1;
-						}elseif($tm['team'] == 2) {
-							$tmbth = 2;
-						}
-						$tbshin = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "'.$uxy[$pl['x'].'_'.$pl['y']]['id'].'" AND `item_id` = 4910 AND `delete` = 0 LIMIT 1'));
-						if(isset($tbshin['id'])) {
-							echo '$("#min_'.$pl['x'].'_'.$pl['y'].'").html("<img class=\"u_rot'.$u->info['s'].'\" title=\"�����!\" style=\"margin:2px 3px 3px 2px;background-image:url(https://img.new-combats.com/i/move/shb.gif)\" src=\"https://img.new-combats.com/1x1.gif\" width=\"7\" height=\"7\">");';
-						}else{
-							echo '$("#min_'.$uxy[$pl['x'].'_'.$pl['y']]['x'].'_'.$uxy[$pl['x'].'_'.$pl['y']]['y'].'").html("<img class=\"u_rot'.$uxy[$pl['x'].'_'.$pl['y']]['s'].'\" title=\"'.$uxy[$pl['x'].'_'.$pl['y']]['login'].'\" style=\"margin:2px 3px 3px 2px;background-image:url(https://img.new-combats.com/i/move/p'.$tmbth.'/d0.gif)\" src=\"https://img.new-combats.com/1x1.gif\" width=\"7\" height=\"7\">");';
-						}
-					}elseif( isset($uxy[$pl['x'].'_'.$pl['y']]) ) {
-						echo '$("#min_'.$uxy[$pl['x'].'_'.$pl['y']]['x'].'_'.$uxy[$pl['x'].'_'.$pl['y']]['y'].'").html("<img class=\"u_rot'.$uxy[$pl['x'].'_'.$pl['y']]['s'].'\" title=\"'.$uxy[$pl['x'].'_'.$pl['y']]['login'].'\" style=\"margin:2px 3px 3px 2px;background-image:url(https://img.new-combats.com/i/move/p4/d0.gif)\" src=\"https://img.new-combats.com/1x1.gif\" width=\"7\" height=\"7\">");';
-					} elseif( isset($bxy[$pl['x'].'_'.$pl['y']]) ) {
-						
-						$bobrz = $bxy[$pl['x'].'_'.$pl['y']]['obraz'];
-												
-						if( file_exists('../img.new-combats.com/chars/'.$bxy[$pl['x'].'_'.$pl['y']]['sex'].'/'.$bxy[$pl['x'].'_'.$pl['y']]['obraz'].'') ) {
-							$bobrz = str_replace('.png','.gif',$bobrz);
-						}else{
-							$bobrz = str_replace('.gif','.png',$bobrz);
-						}
-						
-						?> 
-$("#min_<?=$bxy[$pl['x'].'_'.$pl['y']]['x']?>_<?=$bxy[$pl['x'].'_'.$pl['y']]['y']?>").html("<div style='position:relative; display:inline-block; width:1px; height:1px;'><img class='dBot' title='<?=$bxy[$pl['x'].'_'.$pl['y']]['login']?>'  src='https://img.new-combats.com/chars/<?=$bxy[$pl['x'].'_'.$pl['y']]['sex']?>/<?=$bobrz?>'></div>");
-						<?
-					}
-					$css  = rtrim($css,',');
-					echo '$("#min_'.$pl['x'].'_'.$pl['y'].'").css({'.$css.'});';
-					$i++;
-				}
-				?>
-				</script>
-			</div>
-			<div style="position:absolute; z-index:50; left: 374px; top: 110px;">
-			  <img src="https://img.new-combats.com/podzem-map2.png" />
-			</div>
-            <img src="https://img.new-combats.com/g1.jpg" title="��������, X:<?=$u->info['x']?> ,Y:<?=$u->info['y']?>" width="31" height="18" id="g1" style="position: absolute; cursor:pointer; left: 435px; top: 53px;" />
-			<? if($d->testGone(3) > 0) { ?>
-			<img src="https://img.new-combats.com/g2.jpg" onclick="goToLoca(3,'�������');" width="27" height="48" id="g2" style="position:absolute;cursor:pointer; left: 492px; top: 40px;" />
-			<? } if($d->testGone(4)>0){ ?>
-			<img src="https://img.new-combats.com/g3.jpg" onclick="goToLoca(4,'������');" width="28" height="46" id="g3" style="position:absolute;cursor:pointer; left: 382px; top: 40px;" />
-			<? } if($d->testGone(2)>0){ ?>
-			<img src="https://img.new-combats.com/g4.jpg" onclick="goToLoca(2,'�����');" width="45" height="25" id="g4" style="position:absolute;cursor:pointer; left: 428px; top: 72px;" />
-			<? } if($d->testGone(1)>0){ ?>
-			<img src="https://img.new-combats.com/g5.jpg" onclick="goToLoca(1,'������');" width="46" height="26" id="g5" style="position:absolute;cursor:pointer; left: 428px; top: 26px;" />
-			<? } ?>
-            <img src="https://img.new-combats.com/g6.jpg" width="30" height="19" id="g6" style="position:absolute;cursor:pointer; left: 399px; top: 28px;" />
-		    <img src="https://img.new-combats.com/g7.jpg" width="24" height="19" id="g7" style="position:absolute;cursor:pointer; left: 476px; top: 28px;" />
-			<div id="Dungeon" class="Dungeon" align="center" style="width:352px;height:240px;padding:0px;margin:10px;">
-                <!-- / MAP \ -->
-                <div id="Floor0" class="Floor0">
-                  <div class="Floor1">
-                    <div class="<? if($pd[1]==1){ echo 'LeftSide4_1'; } ?>">
-                      <div class="<? if($pd[2]==1){ echo 'RightSide4_1'; } ?>">
-                        <div id="4_0r" class="<? if($pd[3]==1){ echo 'RightSide4_0'; } ?>">
-                          <div id="4_0l" class="<? if($pd[4]==1){ echo 'LeftSide4_0'; } ?>">
-                            <div id="3_2l" class="<? if($pd[5]==1){ echo 'LeftFront3_2'; } ?>">
-                              <div id="3_2r" class="<? if($pd[6]==1){ echo 'RightFront3_2'; } ?>">
-                                <div class="<? if($pd[7]==1){ echo 'LeftFront3_1'; } ?>">
-                                  <div class="<? if($pd[8]==1){ echo 'RightFront3_1'; } ?>">
-                                    <div id="3_1l" class="<? if($pd[10]==1){ echo 'LeftFront3_1'; } ?>">
-									  <div id="3_1f" class="<? if($pd[9]==1){ echo 'LeftFront3_0'; } ?>">
-                                        <div id="3_1r" class="<? if($pd[11]==1){ echo 'RightFront3_1'; } ?>">
-                                          <div class="<? if($pd[12]==1){ echo 'LeftSide3_0'; } ?>">
-                                            <div id="3_0l" class="<? if($pd[13]==1){ echo 'RightSide3_0'; } ?>">
-                                              <div id="2_1l" class="<? if($pd[14]==1){ echo 'LeftFront2_1'; } ?>">
-                                                <div id="2_1r" class="<? if($pd[15]==1){ echo 'RightFront2_1'; } ?>">
-                                                  <div id="2_1f" class="<? if($pd[16]==1){ echo 'LeftFront2_0'; } ?>">
-                                                    <div class="<? if($pd[17]==1){ echo 'LeftSide2_0'; } ?>">
-                                                      <div id="2_0l" class="<? if($pd[18]==1){ echo 'RightSide2_0'; } ?>">
-                                                        <div id="1_1l" class="<? if($pd[19]==1){ echo 'LeftFront1_1'; } ?>">
-                                                          <div id="1_1r" class="<? if($pd[20]==1){ echo 'RightFront1_1'; } ?>">
-                                                            <div id="1_1f" class="<? if($pd[21]==1){ echo 'LeftFront1_0'; } ?>">
-                                                              <div class="<? if($pd[22]==1){ echo 'LeftSide1_0'; } ?>">
-                                                                <div id="1_0l" class="<? if($pd[23]==1){ echo 'RightSide1_0'; } ?>">
-                                                                  <div sid="0_1l" class="<? if($pd[24]==1){ echo 'LeftFront0_1'; } ?>">
-                                                                    <div id="0_1r" class="<? if($pd[25]==1){ echo 'RightFront0_1'; } ?>">
-                                                                      <div id="0_0f" class="<? if($pd[26]==1){ echo 'LeftFront0_0'; } ?>">
-                                                                        <div class="<? if($pd[27]==1){ echo 'LeftSide0_0'; } ?>">
-                                                                          <div id="0_0l" class="<? if($pd[28]==1){ echo 'RightSide0_0'; } ?>">
-                                                                            <? if($u->info['admin']==0){ ?>
-                                                                            <div id="divWindowImg"><img src="https://img.new-combats.com/i/1x1.gif" usemap="#ObjectsMap" border="0" /></div>
-                                                                          </div>
-                                                                        </div>
-                                                                      </div>
-                                                                    </div>
-                                                                  </div>
-                                                                </div>
-                                                              </div>
-                                                            </div>
-                                                          </div>
-                                                        </div>
-                                                      </div>
-                                                    </div>
-                                                  </div>
+                                                            $qsee .= '<small>�������: &nbsp; ' . $pl['info'] . ' ' . $r . '</small><br>';
+                                                        }
+                                                        if ($qsee != '') {
+                                                            echo '<br><br>' . $qsee;
+                                                        }
+                                                        ?></div>
+                                                    <div id="items"><? echo $d->itemsMap(); ?></div>
+                                                    <div id="information"><? if (isset($d->information)) {
+                                                            echo $d->information;
+                                                        } ?></div>
                                                 </div>
-                                              </div>
-                                            </div>
-                                          </div>
-                                        </div>
-                                      </div>
-                                    </div>
-                                  </div>
-                                </div>
-                              </div>
-                            </div>
-                          </div>
-                        </div>
-                      </div>
-                    </div>
-                  </div>
-                </div>
-                <!-- / MAP \ -->
-                <span class="<? if($pd[28]==1){ echo 'RightSide0_0'; } ?>">
+                                                <?
+                                                if ($u->info['admin'] > 0) {
+                                                    #echo $d->genObjects();
+                                                }
+                                                ?>
+                                            </td>
+                                            <td width="530" height="260" valign="top"
+                                                style="background-image:url(https://img.new-combats.com/maze_layer.jpg); background-repeat:no-repeat;">
+                                                <div style="position:relative;">
+
+                                                    <div style="position:absolute;z-index:1;left:397px;top:0px;">
+                                                        <div id="pline1" style="width:1px;"></div>
+                                                    </div>
+                                                    <div style="position:absolute; z-index:50; left: 374px; top: 110px;">
+                                                        <img src="https://img.new-combats.com/podzem-map.png"/>
+                                                    </div>
+                                                    <div id="minimap"
+                                                         style="position:absolute; left: 374px; top: 110px;">
+                                                        <table border="0" align="center" cellpadding="0" cellspacing="0"
+                                                               style="border:1px solid #333333">
+                                                            <?
+                                                            $i = 1;
+                                                            $htmlv = '';
+                                                            while ($i <= 8) {
+                                                                $htmlv .= '<tr>';
+                                                                $j = 1;
+                                                                $htmlv2 = '';
+                                                                while ($j <= 9) {
+                                                                    $htmlv2 = '<td width="15" height="15" align="center" valign="middle" align="center" style="margin:1px;" id="min_' . ($u->info['x'] + (4 - $j)) . '_' . ($u->info['y'] + (4 - $i)) . '"></td>' . $htmlv2;
+                                                                    $j++;
+                                                                }
+                                                                $htmlv .= $htmlv2 . '</tr>';
+                                                                $i++;
+                                                            }
+                                                            echo $htmlv;
+                                                            unset($htmlv, $htmlv2);
+                                                            ?>
+                                                            <style>
+                                                                .u_rot1 {
+                                                                    -webkit-transform: rotate(-180deg);
+                                                                    -moz-transform: rotate(-180deg);
+                                                                    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=6);
+                                                                    -o-transform: rotate(60deg);
+                                                                }
+
+                                                                .u_rot4 {
+                                                                    -webkit-transform: rotate(-90deg);
+                                                                    -moz-transform: rotate(-90deg);
+                                                                    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
+                                                                    -o-transform: rotate(30deg);
+                                                                }
+
+                                                                .u_rot3 {
+
+                                                                }
+
+                                                                .u_rot2 {
+                                                                    -webkit-transform: rotate(-270deg);
+                                                                    -moz-transform: rotate(-270deg);
+                                                                    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=9);
+                                                                    -o-transform: rotate(90deg);
+                                                                }
+
+                                                                .dBot {
+                                                                    display: inline-block;
+                                                                    height: 18px;
+                                                                    width: 10px;
+                                                                    z-index: 99;
+                                                                    position: absolute;
+                                                                    top: -8px;
+                                                                    left: -6px;
+                                                                / / background-image: url("https://img.new-combats.com/drgn/bg/r.gif");
+                                                                }
+                                                            </style>
+                                                        </table>
+                                                        <script>
+                                                            <?
+                                                            //������� ����-�����
+                                                            $i = 0;
+                                                            $uxy = [];
+                                                            if ($u->room['name'] != '����� ������') {
+                                                                $sp = mysql_query('SELECT `u`.`login`,`u`.`id`,`s`.`x`,`s`.`y`,`s`.`s` FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `s`.`dnow` = "' . $u->info['dnow'] . '" AND `u`.`id` != "' . $u->info['id'] . '" LIMIT 10');
+                                                                while ($pl = mysql_fetch_array($sp)) {
+                                                                    $uxy[$pl['x'] . '_' . $pl['y']] = $pl;
+                                                                }
+                                                            }
+                                                            if ($u->info['admin'] > 0 || $d->id_dng == 106) {
+                                                                $bxy = [];
+                                                                if ($u->room['name'] != '����� ������') {
+                                                                    $sp = mysql_query('SELECT `db`.*, `tb`.`login`, `tb`.`obraz`, `tb`.`sex` FROM `dungeon_bots` as `db` LEFT JOIN `test_bot` as `tb` ON `tb`.`id`=`db`.`id_bot`
+				  WHERE `db`.`dn` = "' . $u->info['dnow'] . '" AND `db`.`delete`=0 AND
+				  (`db`.`x` >= ' . ($u->info['x'] - 5) . ' AND `db`.`x` <= ' . ($u->info['x'] + 5) . ') AND
+				  (`db`.`y` >= ' . ($u->info['y'] - 5) . ' AND `db`.`y` <= ' . ($u->info['y'] + 5) . ') 
+				  LIMIT 100');
+                                                                    while ($pl = mysql_fetch_array($sp)) {
+                                                                        $bxy[$pl['x'] . '_' . $pl['y']] = $pl;
+                                                                    }
+                                                                }
+                                                            }
+
+                                                            $sp = mysql_query('SELECT * FROM `dungeon_map` WHERE `id_dng` = "' . $d->id_dng . '" AND (`x` >= ' . ($u->info['x'] - 5) . ' AND `x` <= ' . ($u->info['x'] + 5) . ') AND (`y` >= ' . ($u->info['y'] - 5) . ' AND `y` <= ' . ($u->info['y'] + 5) . ')  ORDER BY `y` ASC , `x` ASC LIMIT 100');
+
+                                                            $rzn = [0 => 'top', 3 => 'right', 2 => 'bottom', 1 => 'left'];
+
+                                                            $sb1 = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_obj` WHERE `name` LIKE "%�����%" AND `dn` = "' . $d->info['id'] . '" LIMIT 1'));
+
+                                                            while($pl = mysql_fetch_array($sp)) {
+                                                            $css = '"background-image":"url(https://img.new-combats.com/fon555.png)",';
+                                                            $j = 0;
+
+                                                            while ($j <= 4) {
+                                                                if ($pl['st'][$j] == 1) {
+                                                                    $css .= '"border-' . $rzn[$j] . '":"1px solid #303030",';
+                                                                } else {
+                                                                    $css .= '"margin-' . $rzn[$j] . '":"1px",';
+                                                                }
+                                                                $j++;
+                                                            }
+
+                                                            if( $sb1['x'] == $pl['x'] && $sb1['y'] == $pl['y'] ) {
+                                                                echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"�����!\" style=\"margin:2px 3px 3px 2px;background-image:url(https://img.new-combats.com/i/move/shb.gif)\" src=\"https://img.new-combats.com/1x1.gif\" width=\"7\" height=\"7\">");';
+                                                            }elseif ($u->info['x'] == $pl['x'] && $u->info['y'] == $pl['y']) {
+                                                                if ($d->info['id2'] == 15) {
+                                                                    $tmbth = 4;
+                                                                    $tm = mysql_fetch_array(mysql_query('SELECT * FROM `katok_now` WHERE `clone` = "' . $u->info['id'] . '" LIMIT 1'));
+                                                                    if ($tm['team'] == 1) {
+                                                                        $tmbth = 1;
+                                                                    } elseif ($tm['team'] == 2) {
+                                                                        $tmbth = 2;
+                                                                    }
+                                                                    echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"��� ��\" style=\"margin:2px 3px 3px 2px;background-image:url(https://img.new-combats.com/i/move/p' . $tmbth . '/d0.gif)\" src=\"https://img.new-combats.com/1x1.gif\" width=\"7\" height=\"7\">");';
+                                                                } else {
+                                                                    echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"��� ��\" style=\"margin:2px 3px 3px 2px;background-image:url(https://img.new-combats.com/i/move/p1/d0.gif)\" src=\"https://img.new-combats.com/1x1.gif\" width=\"7\" height=\"7\">");';
+                                                                }
+                                                            } elseif ($d->info['id2'] == 15) {
+                                                                $tmbth = 4;
+                                                                $tm = mysql_fetch_array(mysql_query('SELECT * FROM `katok_now` WHERE `clone` = "' . $uxy[$pl['x'] . '_' . $pl['y']]['id'] . '" LIMIT 1'));
+                                                                if ($tm['team'] == 1) {
+                                                                    $tmbth = 1;
+                                                                } elseif ($tm['team'] == 2) {
+                                                                    $tmbth = 2;
+                                                                }
+                                                                $tbshin = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "' . $uxy[$pl['x'] . '_' . $pl['y']]['id'] . '" AND `item_id` = 4910 AND `delete` = 0 LIMIT 1'));
+                                                                if (isset($tbshin['id'])) {
+                                                                    echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").html("<img class=\"u_rot' . $u->info['s'] . '\" title=\"�����!\" style=\"margin:2px 3px 3px 2px;background-image:url(https://img.new-combats.com/i/move/shb.gif)\" src=\"https://img.new-combats.com/1x1.gif\" width=\"7\" height=\"7\">");';
+                                                                } else {
+                                                                    echo '$("#min_' . $uxy[$pl['x'] . '_' . $pl['y']]['x'] . '_' . $uxy[$pl['x'] . '_' . $pl['y']]['y'] . '").html("<img class=\"u_rot' . $uxy[$pl['x'] . '_' . $pl['y']]['s'] . '\" title=\"' . $uxy[$pl['x'] . '_' . $pl['y']]['login'] . '\" style=\"margin:2px 3px 3px 2px;background-image:url(https://img.new-combats.com/i/move/p' . $tmbth . '/d0.gif)\" src=\"https://img.new-combats.com/1x1.gif\" width=\"7\" height=\"7\">");';
+                                                                }
+                                                            }elseif (isset($uxy[$pl['x'] . '_' . $pl['y']])) {
+                                                                echo '$("#min_' . $uxy[$pl['x'] . '_' . $pl['y']]['x'] . '_' . $uxy[$pl['x'] . '_' . $pl['y']]['y'] . '").html("<img class=\"u_rot' . $uxy[$pl['x'] . '_' . $pl['y']]['s'] . '\" title=\"' . $uxy[$pl['x'] . '_' . $pl['y']]['login'] . '\" style=\"margin:2px 3px 3px 2px;background-image:url(https://img.new-combats.com/i/move/p4/d0.gif)\" src=\"https://img.new-combats.com/1x1.gif\" width=\"7\" height=\"7\">");';
+                                                            } elseif( isset($bxy[$pl['x'] . '_' . $pl['y']]) ) {
+
+                                                            $bobrz = $bxy[$pl['x'] . '_' . $pl['y']]['obraz'];
+
+                                                            if (file_exists('img.new-combats.com/chars/' . $bxy[$pl['x'] . '_' . $pl['y']]['sex'] . '/' . $bxy[$pl['x'] . '_' . $pl['y']]['obraz'] . '')) {
+                                                                $bobrz = str_replace('.png', '.gif', $bobrz);
+                                                            } else {
+                                                                $bobrz = str_replace('.gif', '.png', $bobrz);
+                                                            }
+
+                                                            ?>
+                                                            $("#min_<?=$bxy[$pl['x'] . '_' . $pl['y']]['x']?>_<?=$bxy[$pl['x'] . '_' . $pl['y']]['y']?>").html("<div style='position:relative; display:inline-block; width:1px; height:1px;'><img class='dBot' title='<?=$bxy[$pl['x'] . '_' . $pl['y']]['login']?>'  src='https://img.new-combats.com/chars/<?=$bxy[$pl['x'] . '_' . $pl['y']]['sex']?>/<?=$bobrz?>'></div>");
+                                                            <?
+                                                            }
+                                                            $css = rtrim($css, ',');
+                                                            echo '$("#min_' . $pl['x'] . '_' . $pl['y'] . '").css({' . $css . '});';
+                                                            $i++;
+                                                            }
+                                                            ?>
+                                                        </script>
+                                                    </div>
+                                                    <div style="position:absolute; z-index:50; left: 374px; top: 110px;">
+                                                        <img src="https://img.new-combats.com/podzem-map2.png"/>
+                                                    </div>
+                                                    <img src="https://img.new-combats.com/g1.jpg"
+                                                         title="��������, X:<?= $u->info['x'] ?> ,Y:<?= $u->info['y'] ?>"
+                                                         width="31" height="18" id="g1"
+                                                         style="position: absolute; cursor:pointer; left: 435px; top: 53px;"/>
+                                                    <? if ($d->testGone(3) > 0) { ?>
+                                                        <img src="https://img.new-combats.com/g2.jpg"
+                                                             onclick="goToLoca(3,'�������');" width="27" height="48"
+                                                             id="g2"
+                                                             style="position:absolute;cursor:pointer; left: 492px; top: 40px;"/>
+                                                    <? }
+                                                    if ($d->testGone(4) > 0) { ?>
+                                                        <img src="https://img.new-combats.com/g3.jpg"
+                                                             onclick="goToLoca(4,'������');" width="28" height="46"
+                                                             id="g3"
+                                                             style="position:absolute;cursor:pointer; left: 382px; top: 40px;"/>
+                                                    <? }
+                                                    if ($d->testGone(2) > 0) { ?>
+                                                        <img src="https://img.new-combats.com/g4.jpg"
+                                                             onclick="goToLoca(2,'�����');" width="45" height="25"
+                                                             id="g4"
+                                                             style="position:absolute;cursor:pointer; left: 428px; top: 72px;"/>
+                                                    <? }
+                                                    if ($d->testGone(1) > 0) { ?>
+                                                        <img src="https://img.new-combats.com/g5.jpg"
+                                                             onclick="goToLoca(1,'������');" width="46" height="26"
+                                                             id="g5"
+                                                             style="position:absolute;cursor:pointer; left: 428px; top: 26px;"/>
+                                                    <? } ?>
+                                                    <img src="https://img.new-combats.com/g6.jpg" width="30" height="19"
+                                                         id="g6"
+                                                         style="position:absolute;cursor:pointer; left: 399px; top: 28px;"/>
+                                                    <img src="https://img.new-combats.com/g7.jpg" width="24" height="19"
+                                                         id="g7"
+                                                         style="position:absolute;cursor:pointer; left: 476px; top: 28px;"/>
+                                                    <div id="Dungeon" class="Dungeon" align="center"
+                                                         style="width:352px;height:240px;padding:0px;margin:10px;">
+                                                        <!-- / MAP \ -->
+                                                        <div id="Floor0" class="Floor0">
+                                                            <div class="Floor1">
+                                                                <div class="<? if ($pd[1] == 1) {
+                                                                    echo 'LeftSide4_1';
+                                                                } ?>">
+                                                                    <div class="<? if ($pd[2] == 1) {
+                                                                        echo 'RightSide4_1';
+                                                                    } ?>">
+                                                                        <div id="4_0r" class="<? if ($pd[3] == 1) {
+                                                                            echo 'RightSide4_0';
+                                                                        } ?>">
+                                                                            <div id="4_0l" class="<? if ($pd[4] == 1) {
+                                                                                echo 'LeftSide4_0';
+                                                                            } ?>">
+                                                                                <div id="3_2l"
+                                                                                     class="<? if ($pd[5] == 1) {
+                                                                                         echo 'LeftFront3_2';
+                                                                                     } ?>">
+                                                                                    <div id="3_2r"
+                                                                                         class="<? if ($pd[6] == 1) {
+                                                                                             echo 'RightFront3_2';
+                                                                                         } ?>">
+                                                                                        <div class="<? if ($pd[7] == 1) {
+                                                                                            echo 'LeftFront3_1';
+                                                                                        } ?>">
+                                                                                            <div class="<? if ($pd[8] == 1) {
+                                                                                                echo 'RightFront3_1';
+                                                                                            } ?>">
+                                                                                                <div id="3_1l"
+                                                                                                     class="<? if ($pd[10] == 1) {
+                                                                                                         echo 'LeftFront3_1';
+                                                                                                     } ?>">
+                                                                                                    <div id="3_1f"
+                                                                                                         class="<? if ($pd[9] == 1) {
+                                                                                                             echo 'LeftFront3_0';
+                                                                                                         } ?>">
+                                                                                                        <div id="3_1r"
+                                                                                                             class="<? if ($pd[11] == 1) {
+                                                                                                                 echo 'RightFront3_1';
+                                                                                                             } ?>">
+                                                                                                            <div class="<? if ($pd[12] == 1) {
+                                                                                                                echo 'LeftSide3_0';
+                                                                                                            } ?>">
+                                                                                                                <div id="3_0l"
+                                                                                                                     class="<? if ($pd[13] == 1) {
+                                                                                                                         echo 'RightSide3_0';
+                                                                                                                     } ?>">
+                                                                                                                    <div id="2_1l"
+                                                                                                                         class="<? if ($pd[14] == 1) {
+                                                                                                                             echo 'LeftFront2_1';
+                                                                                                                         } ?>">
+                                                                                                                        <div id="2_1r"
+                                                                                                                             class="<? if ($pd[15] == 1) {
+                                                                                                                                 echo 'RightFront2_1';
+                                                                                                                             } ?>">
+                                                                                                                            <div id="2_1f"
+                                                                                                                                 class="<? if ($pd[16] == 1) {
+                                                                                                                                     echo 'LeftFront2_0';
+                                                                                                                                 } ?>">
+                                                                                                                                <div class="<? if ($pd[17] == 1) {
+                                                                                                                                    echo 'LeftSide2_0';
+                                                                                                                                } ?>">
+                                                                                                                                    <div id="2_0l"
+                                                                                                                                         class="<? if ($pd[18] == 1) {
+                                                                                                                                             echo 'RightSide2_0';
+                                                                                                                                         } ?>">
+                                                                                                                                        <div id="1_1l"
+                                                                                                                                             class="<? if ($pd[19] == 1) {
+                                                                                                                                                 echo 'LeftFront1_1';
+                                                                                                                                             } ?>">
+                                                                                                                                            <div id="1_1r"
+                                                                                                                                                 class="<? if ($pd[20] == 1) {
+                                                                                                                                                     echo 'RightFront1_1';
+                                                                                                                                                 } ?>">
+                                                                                                                                                <div id="1_1f"
+                                                                                                                                                     class="<? if ($pd[21] == 1) {
+                                                                                                                                                         echo 'LeftFront1_0';
+                                                                                                                                                     } ?>">
+                                                                                                                                                    <div class="<? if ($pd[22] == 1) {
+                                                                                                                                                        echo 'LeftSide1_0';
+                                                                                                                                                    } ?>">
+                                                                                                                                                        <div id="1_0l"
+                                                                                                                                                             class="<? if ($pd[23] == 1) {
+                                                                                                                                                                 echo 'RightSide1_0';
+                                                                                                                                                             } ?>">
+                                                                                                                                                            <div sid="0_1l"
+                                                                                                                                                                 class="<? if ($pd[24] == 1) {
+                                                                                                                                                                     echo 'LeftFront0_1';
+                                                                                                                                                                 } ?>">
+                                                                                                                                                                <div id="0_1r"
+                                                                                                                                                                     class="<? if ($pd[25] == 1) {
+                                                                                                                                                                         echo 'RightFront0_1';
+                                                                                                                                                                     } ?>">
+                                                                                                                                                                    <div id="0_0f"
+                                                                                                                                                                         class="<? if ($pd[26] == 1) {
+                                                                                                                                                                             echo 'LeftFront0_0';
+                                                                                                                                                                         } ?>">
+                                                                                                                                                                        <div class="<? if ($pd[27] == 1) {
+                                                                                                                                                                            echo 'LeftSide0_0';
+                                                                                                                                                                        } ?>">
+                                                                                                                                                                            <div id="0_0l"
+                                                                                                                                                                                 class="<? if ($pd[28] == 1) {
+                                                                                                                                                                                     echo 'RightSide0_0';
+                                                                                                                                                                                 } ?>">
+                                                                                                                                                                                <? if ($u->info['admin'] == 0){ ?>
+                                                                                                                                                                                <div id="divWindowImg">
+                                                                                                                                                                                    <img src="https://img.new-combats.com/i/1x1.gif"
+                                                                                                                                                                                         usemap="#ObjectsMap"
+                                                                                                                                                                                         border="0"/>
+                                                                                                                                                                                </div>
+                                                                                                                                                                            </div>
+                                                                                                                                                                        </div>
+                                                                                                                                                                    </div>
+                                                                                                                                                                </div>
+                                                                                                                                                            </div>
+                                                                                                                                                        </div>
+                                                                                                                                                    </div>
+                                                                                                                                                </div>
+                                                                                                                                            </div>
+                                                                                                                                        </div>
+                                                                                                                                    </div>
+                                                                                                                                </div>
+                                                                                                                            </div>
+                                                                                                                        </div>
+                                                                                                                    </div>
+                                                                                                                </div>
+                                                                                                            </div>
+                                                                                                        </div>
+                                                                                                    </div>
+                                                                                                </div>
+                                                                                            </div>
+                                                                                        </div>
+                                                                                    </div>
+                                                                                </div>
+                                                                            </div>
+                                                                        </div>
+                                                                    </div>
+                                                                </div>
+                                                            </div>
+                                                        </div>
+                                                        <!-- / MAP \ -->
+                                                        <span class="<? if ($pd[28] == 1) {
+                                                            echo 'RightSide0_0';
+                                                        } ?>">
                 <? } ?>
                 </span></div>
-            </div>
-            </td>
-          </tr>
-        </table>
-        <div id="gotext777" style="padding-top:5px;float:right;">&nbsp;</div>
-        </td>
-      </tr>
-    </table></td>
-  </tr>
-</table>
-</div>
-<script>
-genMap();
-locGoLineDng();
+                                                </div>
+                                            </td>
+                                        </tr>
+                                    </table>
+                                    <div id="gotext777" style="padding-top:5px;float:right;">&nbsp;</div>
+                                </td>
+                            </tr>
+                        </table>
+                    </td>
+                </tr>
+            </table>
+        </div>
+        <script>
+            genMap();
+            locGoLineDng();
 
-$("document").ready(function() {
+            $("document").ready(function () {
 
-  $('#g1').click(function() {
-   /* $.ajax({
+                $('#g1').click(function () {
+                    /* $.ajax({
       url: "main.php?ajax=1",
       cache: false,
       success: function(html) {
         $("body").html(html);
       }
     });*/
-	location.href="/main.php";
-  });
-  
-  $('#g6').click(function() {
-    /* $.ajax({
+                    location.href = "/main.php";
+                });
+
+                $('#g6').click(function () {
+                    /* $.ajax({
       url: "main.php?look=1&rnd=<?=$code;?>&ajax=1",
       cache: false,
       success: function(html) {
         $("body").html(html);
       }
     });*/
-	location.href="/main.php?look=1&rnd=<?=$code;?>";
-  });
-  
-  $('#g7').click(function() {
-    /*$.ajax({
+                    location.href = "/main.php?look=1&rnd=<?=$code;?>";
+                });
+
+                $('#g7').click(function () {
+                    /*$.ajax({
       url: "main.php?look=2&rnd=<?=$code;?>&ajax=1",
       cache: false,
       success: function(html) {
         $("body").html(html);
       }
     });*/
-	location.href="/main.php?look=2&rnd=<?=$code;?>";
-  });
-  
-});
-</script>
-<br /><br />
-<?
-if($u->info['admin'] == 1) {
-  echo '<form method="POST">X - <input type="text" name="g__x" autocomplete="off" value="'.$u->info['x'].'" size="4" /> Y - <input type="text" name="g__y" autocomplete="off" value="'.$u->info['y'].'" size="4" /> <input type="submit" value="�������" name="go_to_admin" /><br/><input id="restorbot" type="checkbox" name="g__restorebot" autocomplete="off" /> <label for="restorbot">������������ ������ ����� </label></form><br>
-  S:'.$u->info['s'].'';
-}
-?>
-<? } } ?>
\ No newline at end of file
+                    location.href = "/main.php?look=2&rnd=<?=$code;?>";
+                });
+
+            });
+        </script>
+        <br/><br/>
+        <?php
+        if ($u->info['admin'] == 1) {
+            echo '<form method="POST">X - <input type="text" name="g__x" autocomplete="off" value="' . $u->info['x'] . '" size="4" /> Y - <input type="text" name="g__y" autocomplete="off" value="' . $u->info['y'] . '" size="4" /> <input type="submit" value="�������" name="go_to_admin" /><br/><input id="restorbot" type="checkbox" name="g__restorebot" autocomplete="off" /> <label for="restorbot">������������ ������ ����� </label></form><br>
+  S:' . $u->info['s'] . '';
+        }
+        ?>
+    <? }
+} ?>
diff --git a/modules_data/location/elka.php b/modules_data/location/elka.php
index 3f152aa9..cdc35742 100644
--- a/modules_data/location/elka.php
+++ b/modules_data/location/elka.php
@@ -12,7 +12,7 @@ if((date('n',time())==2 && date('j',time())<=14))
 	$dy = 0;
 }
 $dt = date('Y',time())+$dy;
-$dt = 2022;
+$dt = 2023;
 
 if($u->room['file']=='elka')
 {
@@ -189,12 +189,12 @@ if($u->room['file']=='elka')
     <?
     $smt = $u->testAction('`uid` = "'.$u->info['id'].'" AND `time` > '.(time()-600).' AND `vars` = "use_cupNewYear" LIMIT 1',1);
 	?>
-    <a href="?use_cup=<? echo $code; ?>" <? if(isset($smt['id'])){ echo 'onClick="alert(\'������������ ���������� ����� ����� �� ���� ������ ���� � 10 �����\');return false;"'; } ?> /><img src="https://img.new-combats.com/cup2012.gif" style="padding:10px;<? if(isset($smt['id'])){ echo 'filter: alpha(opacity=35); -moz-opacity: 0.35; -khtml-opacity: 0.35; opacity: 0.35;'; } ?>" title="������ ��`���������� �����`"></a>
+    <a href="?use_cup=<? echo $code; ?>" <? if(isset($smt['id'])){ echo 'onClick="alert(\'������������ "���� ��������� ���" ����� �� ���� ������ ���� � 10 �����\');return false;"'; } ?> /><img src="https://img.new-combats.com/cup2012.gif" style="padding:10px;<? if(isset($smt['id'])){ echo 'filter: alpha(opacity=35); -moz-opacity: 0.35; -khtml-opacity: 0.35; opacity: 0.35;'; } ?>" title="������ ��`���� ��������� ���`"></a>
     <? 
 	if( date('m') == 12 ||  (date('m') == 1 && date('d') <= 8)) {
 	$pd = $u->testAction('`uid` = "'.$u->info['id'].'" AND `time` > '.(time()-600).' AND `vars` = "take_gift'.$dt.'" LIMIT 1',1);
 	?>
-	<a href="?take_gift=<? echo $code; ?>" <? if(isset($pd['id'])){ echo 'onClick="return false;"'; } ?> /><img src="https://img.new-combats.com/i/items/<? echo 'podarok'.($dt-1); ?>.gif" style="padding:10px;<? if(isset($pd['id'])){ echo 'filter: alpha(opacity=35); -moz-opacity: 0.35; -khtml-opacity: 0.35; opacity: 0.35;'; } ?>" title="����� `���������� ������� 2022`"></a> 
+	<a href="?take_gift=<? echo $code; ?>" <? if(isset($pd['id'])){ echo 'onClick="return false;"'; } ?> /><img src="https://img.new-combats.com/i/items/<? echo 'podarok'.($dt-1); ?>.gif" style="padding:10px;<? if(isset($pd['id'])){ echo 'filter: alpha(opacity=35); -moz-opacity: 0.35; -khtml-opacity: 0.35; opacity: 0.35;'; } ?>" title="����� `���������� ������� 2023`"></a> 
     <? } ?>
     </div>
 	</div>
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 @@
 <?php
-if(!defined('GAME'))
-{
- die();
+if (!defined('GAME')) {
+    die();
 }
 
-if($u->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 '<font color="red"><b>�� �� ������ ������ ����� ����� ���� ��������� ������ &quot;������� �����&quot;</b></font>';
-		}
-	}
+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 '<b style="color: red">�� �� ������ ������ ����� ����� ���� ��������� ������ &quot;������� �����&quot;</b>';
+    } 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 . '. <span class="date">' . date('d.m.Y H:i', $pl['time']) . '</span>, �����: <b>' . $pl['voln'] . '</b>, ' . $u->microLogin($pl['uid'], 1) . '<br>';
+}
+if (empty($text)) {
+    $text = '������� �����, ������ ����� �� ������� ����������...';
 }
 
 ?>
-	<style type="text/css"> 
-	
-	.pH3			{ COLOR: #8f0000;  FONT-FAMILY: Arial;  FONT-SIZE: 12pt;  FONT-WEIGHT: bold; }
-	.class_ {
-		font-weight: bold;
-		color: #C5C5C5;
-		cursor:pointer;
-	}
-	.class_st {
-		font-weight: bold;
-		color: #659BA3;
-		cursor:pointer;
-	}
-	.class__ {
-		font-weight: bold;
-		color: #FFFFFF;
-		cursor:pointer;
-		background-color: #659BA3;
-	}
-	.class__st {
-		font-weight: bold;
-		color: #FFFFFF;
-		cursor:pointer;
-		background-color: #659BA3;
-		font-size: 10px;
-	}
-	.class_old {
-		font-weight: bold;
-		color: #919191;
-		cursor:pointer;
-	}
-	.class__old {
-		font-weight: bold;
-		color: #FFFFFF;
-		cursor:pointer;
-		background-color: #838383;
-		font-size: 10px;
-	}
-	
-	</style>
-	<div align="right"><? if($re!=''){ echo '<font color="red"><b>'.$re.'</b></font>'; } ?></div>
-	<div id="hint3" style="visibility:hidden"></div>
-	<TABLE width="100%" cellspacing="0" cellpadding="0">
-	<tr><td valign="top"><div align="center" class="pH3">����� �����</div>
-	<td width="280" valign="top"><table cellspacing="0" cellpadding="0">
-		<tr>
-		  <td width="100%">&nbsp;</td>
-		  <td><table  border="0" cellpadding="0" cellspacing="0">
-			  <tr align="right" valign="top">
-				<td><!-- -->
-					<? echo $goLis; ?>
-					<!-- -->
-					<table border="0" cellspacing="0" cellpadding="0">
-					  <tr>
-						<td nowrap="nowrap"><table width="100%"  border="0" cellpadding="0" cellspacing="1" bgcolor="#DEDEDE">
-							<tr>
-							  <td bgcolor="#D3D3D3"><img src="https://img.new-combats.com/i/move/links.gif" width="9" height="7" /></td>
-							  <td bgcolor="#D3D3D3" nowrap="nowrap"><a href="#" id="greyText" class="menutop" onclick="location='main.php?loc=3.180.0.353&rnd=<? echo $code; ?>';" title="<? thisInfRm('3.180.0.353',1); ?>">����� ����� - 16</a></td>
-							</tr>
-							<tr>
-							  <td bgcolor="#D3D3D3"><img src="https://img.new-combats.com/i/move/links.gif" width="9" height="7" /></td>
-							  <td bgcolor="#D3D3D3" nowrap="nowrap"><a href="#" id="greyText" class="menutop" onclick="location='main.php?loc=3.180.0.270&rnd=<? echo $code; ?>';" title="<? thisInfRm('3.180.0.270',1); ?>">������� ������</a></td>
-							</tr>
-						</table></td>
-					  </tr>					  <tr>
-						<td nowrap="nowrap">&nbsp;</td>
-					  </tr>
-				  </table></td>
-			  </tr>
-		  </table></td>
-		</tr>
-	  </table>
-		<br />
-	<center></center></td>
-	</table>
-	<div id="textgo" style="visibility:hidden;"></div>
+<style type="text/css">
+
+    .pH3 {
+        COLOR: #8f0000;
+        FONT-FAMILY: Arial, serif;
+        FONT-SIZE: 12pt;
+        FONT-WEIGHT: bold;
+    }
+
+    .class_ {
+        font-weight: bold;
+        color: #C5C5C5;
+        cursor: pointer;
+    }
+
+    .class_st {
+        font-weight: bold;
+        color: #659BA3;
+        cursor: pointer;
+    }
+
+    .class__ {
+        font-weight: bold;
+        color: #FFFFFF;
+        cursor: pointer;
+        background-color: #659BA3;
+    }
+
+    .class__st {
+        font-weight: bold;
+        color: #FFFFFF;
+        cursor: pointer;
+        background-color: #659BA3;
+        font-size: 10px;
+    }
+
+    .class_old {
+        font-weight: bold;
+        color: #919191;
+        cursor: pointer;
+    }
+
+    .class__old {
+        font-weight: bold;
+        color: #FFFFFF;
+        cursor: pointer;
+        background-color: #838383;
+        font-size: 10px;
+    }
+
+    div.error {
+        color: red;
+        font-weight: bold;
+        text-align: right;
+    }
+</style>
+<div class="error"><?php if (!empty($re)) {
+        echo $re;
+    } ?></div>
+<div id="hint3" style="visibility:hidden"></div>
+<TABLE width="100%" cellspacing="0" cellpadding="0">
+    <tr>
+        <td valign="top">
+            <div align="center" class="pH3">����� �����</div>
+        <td width="280" valign="top">
+            <table cellspacing="0" cellpadding="0">
+                <tr>
+                    <td width="100%">&nbsp;</td>
+                    <td>
+                        <table border="0" cellpadding="0" cellspacing="0">
+                            <tr align="right" valign="top">
+                                <td><!-- -->
+                                    <?= $goLis; ?>
+                                    <!-- -->
+                                    <table border="0" cellspacing="0" cellpadding="0">
+                                        <tr>
+                                            <td nowrap="nowrap">
+                                                <table width="100%" border="0" cellpadding="0" cellspacing="1"
+                                                       bgcolor="#DEDEDE">
+                                                    <tr>
+                                                        <td bgcolor="#D3D3D3"><img
+                                                                    src="https://img.new-combats.com/i/move/links.gif"
+                                                                    width="9" height="7"/></td>
+                                                        <td bgcolor="#D3D3D3" nowrap="nowrap"><a href="#" id="greyText"
+                                                                                                 class="menutop"
+                                                                                                 onclick="location='main.php?loc=3.180.0.353&rnd=<?= $code; ?>';"
+                                                                                                 title="<?php thisInfRm('3.180.0.353', 1); ?>">�����
+                                                                ����� - 16</a></td>
+                                                    </tr>
+                                                    <tr>
+                                                        <td bgcolor="#D3D3D3"><img
+                                                                    src="https://img.new-combats.com/i/move/links.gif"
+                                                                    width="9" height="7"/></td>
+                                                        <td bgcolor="#D3D3D3" nowrap="nowrap"><a href="#" id="greyText"
+                                                                                                 class="menutop"
+                                                                                                 onclick="location='main.php?loc=3.180.0.270&rnd=<?= $code; ?>';"
+                                                                                                 title="<?php thisInfRm('3.180.0.270', 1); ?>">�������
+                                                                ������</a></td>
+                                                    </tr>
+                                                </table>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td nowrap="nowrap">&nbsp;</td>
+                                        </tr>
+                                    </table>
+                                </td>
+                            </tr>
+                        </table>
+                    </td>
+                </tr>
+            </table>
+            <br/>
+        </td>
+</table>
+<div id="textgo" style="visibility:hidden;"></div>
 <FORM method="post">
-    <input checked="checked" type="radio" name="level" value="7" <? if($u->info['level']<7){ echo 'disabled'; } ?>>
-    ������ � &laquo;����� �����&raquo;<br/>
+    <label>
+        <input checked="checked" type="radio" name="level" value="7" <?php if ($u->info['level'] < 7) {
+            echo 'disabled';
+        } ?>>
+        ������ � &laquo;����� �����&raquo;<br/>
+    </label>
     <INPUT type='submit' value='������ �����'>
-</FORM>	
-  <p><b>������� ������� &laquo;����� �����&raquo;:</b><br /><?
-  $i = 0; $sp = mysql_query('SELECT * FROM `izlom_rating` ORDER BY `voln` DESC LIMIT 50');
-  $uidz = array();
-  while($pl = mysql_fetch_array($sp))
-  {
-	  if(!isset($uidz[$pl['uid']]))
-	  {
-	  	$i++; $uidz[$pl['uid']] = $i;
-	  	$text .= $i.'. <span class="date">'.date('d.m.Y H:i',$pl['time']).'</span>, �����: <b>'.$pl['voln'].'</b>, '.$u->microLogin($pl['uid'],1).'<br>';
-	  }
-  }
-  if(!isset($text))
-  {
-	 $text = '������� �����, ������ ����� �� ������� ����������...'; 
-  }
-  echo $text;
-  unset($text);
-  ?></p>				  
-<?
-}
-?>
\ No newline at end of file
+</FORM>
+<p><strong>������� ������� &laquo;����� �����&raquo;:</strong><br/><?= $text ?></p>
\ No newline at end of file
diff --git a/modules_data/location/loto.php b/modules_data/location/loto.php
index 41575662..46c08200 100644
--- a/modules_data/location/loto.php
+++ b/modules_data/location/loto.php
@@ -308,18 +308,14 @@ $titm = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.
                             border: '4px solid transparent'
                         })
 
-                        var idItem = await response.text()
-
-                        idItem = idItem.match(/\b[0-9]{0,2}\b/)
-                        if (idItem[0]) {
-                            // ���� �������� �� ����� � ��������� �� 0 �� 29
-                            if (idItem[0] > 29) {
-                                return $button.textContent = "������, ������� F5!"
-                            }
-                            idItem = idItem[0]
-                        }
-                        else {
-                            return $button.textContent = "������, ������� F5!"
+                        var textFromResponse = await response.text()
+                        var resultRegexp = textFromResponse.match(/\b[0-9]{0,2}\b/);
+                        var idItem = '';
+                        
+                        if (resultRegexp && resultRegexp[0] && resultRegexp[0] >= 0 && resultRegexp[0] <= 29) {
+                            idItem = resultRegexp[0];
+                        } else {
+                            return ($button.textContent = '������, ������� F5!');
                         }
 
                         var elemRul = 0
@@ -367,14 +363,10 @@ $titm = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `uid` = "'.
                 var $tableItemChange = document.getElementById("tableItemChange")
 
                 $buttonsElements.onclick = function (event) {
-                    if ($tableItemChange.hidden) {
-                        $tableItemChange.hidden = !$tableItemChange.hidden
-                        event.target.textContent = "������ �����"
-                        return
-                    } 
+                    var contentIsHidden = $tableItemChange.hidden;
 
-                    $tableItemChange.hidden = !$tableItemChange.hidden
-                    event.target.textContent = "�������� � �����"
+                    $tableItemChange.hidden = !contentIsHidden;
+                    event.target.textContent = !contentIsHidden ? '�������� � �����' : '������ �����';
                 }
             </script>
             <style>
diff --git a/modules_data/location/loto2.php b/modules_data/location/loto2.php
index e83dd77d..1ed258d0 100644
--- a/modules_data/location/loto2.php
+++ b/modules_data/location/loto2.php
@@ -306,19 +306,15 @@ if($u->room['file']=='loto2')
                             method: "POST",
                             body: usedID
                         })
-                        var idItem = await response.text()
 
-
-                        idItem = idItem.match(/\b[0-9]{0,2}\b/)
-                        if (idItem[0]) {
-                            // ���� �������� �� ����� � ��������� �� 0 �� 29
-                            if (idItem[0] > 29) {
-                                return $button.textContent = "������, ������� F5!"
-                            }
-                            idItem = idItem[0]
-                        }
-                        else {
-                            return $button.textContent = "������, ������� F5!"
+                        var textFromResponse = await response.text()
+                        var resultRegexp = textFromResponse.match(/\b[0-9]{0,2}\b/);
+                        var idItem = '';
+                        
+                        if (resultRegexp && resultRegexp[0] && resultRegexp[0] >= 0 && resultRegexp[0] <= 29) {
+                            idItem = resultRegexp[0];
+                        } else {
+                            return ($button.textContent = '������, ������� F5!');
                         }
 
                         var elemRul = 0
@@ -366,14 +362,10 @@ if($u->room['file']=='loto2')
                 var $tableItemChange = document.getElementById("tableItemChange")
 
                 $buttonsElements.onclick = function (event) {
-                    if ($tableItemChange.hidden) {
-                        $tableItemChange.hidden = !$tableItemChange.hidden
-                        event.target.textContent = "������ �����"
-                        return
-                    } 
+                    var contentIsHidden = $tableItemChange.hidden;
 
-                    $tableItemChange.hidden = !$tableItemChange.hidden
-                    event.target.textContent = "�������� � �����"
+                    $tableItemChange.hidden = !contentIsHidden;
+                    event.target.textContent = !contentIsHidden ? '�������� � �����' : '������ �����';
                 }
             </script>
             <style>
diff --git a/modules_data/location/miloserdie.php b/modules_data/location/miloserdie.php
index 891e9dc0..25dc0782 100644
--- a/modules_data/location/miloserdie.php
+++ b/modules_data/location/miloserdie.php
@@ -35,7 +35,7 @@ if($_GET['get']=='10'  && $is_eff[0]==0){
    $u->info['admin']
    */
     
-	$datadd='|add_za='.rand(10,70).'|add_zm='.rand(10,70).'|add_m10='.rand(2,6).'|add_m11='.rand(2,6).'';
+	$datadd='|add_za='.rand(1,10).'|add_m10='.rand(1,5).'|add_m11='.rand(1,5).'';
     if(mysql_query("UPDATE `users` SET `money`=`money`+'10' where `id`='".$user['id']."'") and
         mysql_query('INSERT INTO `eff_users` (
 				`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`
diff --git a/modules_data/location/padalshik.php b/modules_data/location/padalshik.php
index 9d919f2c..12bc19d3 100644
--- a/modules_data/location/padalshik.php
+++ b/modules_data/location/padalshik.php
@@ -32,7 +32,7 @@ if($_GET['get']=='10'  && $is_eff[0]==0){
    $u->info['admin']
    */
     
-	$datadd='|add_m10='.rand(2,6).'|add_m11='.rand(2,6).'|add_m6='.rand(2,4).'|add_m7='.rand(2,4).'';
+	$datadd='|add_m10='.rand(1,2).'|add_m11='.rand(1,2).'|add_m6='.rand(1,2).'|add_m7='.rand(1,2).'';
 	if(mysql_query("UPDATE `users` SET `money`=`money`+'10' where `id`='".$user['id']."'") and
         mysql_query('INSERT INTO `eff_users` (
 				`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`
diff --git a/modules_data/location/remont.php b/modules_data/location/remont.php
index fea44483..b39e2e07 100644
--- a/modules_data/location/remont.php
+++ b/modules_data/location/remont.php
@@ -398,7 +398,7 @@ if($u->room['file']=='remont')
 					$ir['level'] = $po['tr_lvl'];
 				}
 
-				$pcena = 2000;
+				$pcena = 50;
 				if($u->stats['repair_r']>=1) {
 					$pcena = 0;
 				}
diff --git a/modules_data/location/spavedlivost.php b/modules_data/location/spavedlivost.php
index 1503df77..33e52e85 100644
--- a/modules_data/location/spavedlivost.php
+++ b/modules_data/location/spavedlivost.php
@@ -37,7 +37,7 @@ if($_GET['get']=='10'  && $is_eff[0]==0){
    $u->info['admin']
    */
     
-	$datadd='|add_m10='.rand(1,3).'|add_m11='.rand(1,3).'|add_m6='.rand(1,2).'|add_m7='.rand(1,2).'|add_za='.rand(5,35).'|add_zm='.rand(5,35).'';
+	$datadd='|add_m10='.rand(1,5).'|add_m11='.rand(1,5).'|add_m6='.rand(1,2).'|add_m7='.rand(1,2).'|add_za='.rand(5,10).'';
     if(mysql_query("UPDATE `users` SET `money`=`money`+'10' where `id`='".$user['id']."'") and
         mysql_query('INSERT INTO `eff_users` (
 				`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`
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 @@
-<?
+<?php
 if(!defined('GAME'))
 {
 	die();
 }
 
-if($u->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/stats_2.php b/modules_data/stats_2.php
index 10bd2054..18689c6e 100644
--- a/modules_data/stats_2.php
+++ b/modules_data/stats_2.php
@@ -9,7 +9,7 @@ if(!defined('GAME'))
 <tr><td>&nbsp;</td></tr>
   <tr>
     <td>
-<span style="font-size:12px;">
+<span id="statsOfPerson" style="font-size:12px;">
 ����: <? echo $u->stats['s1']; ?><br />
 ��������:&nbsp;<? echo $u->stats['s2']; ?><br />
 ��������:&nbsp;<? echo $u->stats['s3']; ?><br />
@@ -26,7 +26,9 @@ if($u->info['skills'] > 0 && $u->info['level'] > 0)
 echo '&bull;&nbsp;<a href="main.php?skills=1&side=1">��������</a><br />'; 
 } 
 ?>
-&nbsp;<br />
+&nbsp;<br /></span>
+
+<span id="anotherOfPerson" style="font-size:12px;">
 ����:&nbsp;<b><? echo $u->info['exp']; ?></b> (0)<br />
 �������:&nbsp;<? echo $u->info['level']; ?><br />
 �����:&nbsp;<? echo $u->info['win']; ?><br />
diff --git a/modules_data/titul.php b/modules_data/titul.php
index 46a99c8f..d9f3fb40 100644
--- a/modules_data/titul.php
+++ b/modules_data/titul.php
@@ -1,25 +1,22 @@
 <?php
 
 use Insallah\Achievements;
-use Insallah\Db;
 
 if (!defined('GAME')) {
     die();
 }
 
-if (empty($u)) {
-    $u = user::start();
-}
-
+$u = User::start();
 $a = new Achievements($u);
+$c = new Chat();
 $ai = $a->getCheckedInfo();
 
 if (isset($_GET['nagr'])) {
-    $nagrtxt = 'За выполненное достижение Вы получили ';
+    $nagrtxt = '�� ����������� ���������� �� �������� ';
 
     if ($a->hasNoTier4Access($_GET['nagr'])) {
-        $nagrtxt = 'Вы не можете получить эту награду на этом уровне!';
-    } elseif ( //бабка задание zb
+        $nagrtxt = '�� �� ������ �������� ��� ������� �� ���� ������!';
+    } elseif ( //����� ������� zb
         in_array($_GET['nagr'], [11, 12, 13, 14, 15]) &&
         in_array($ai['zb_n'], [0, 1, 2, 3, 4]) &&
         $ai['klaszb'] > $ai['zb_n']
@@ -27,8 +24,8 @@ if (isset($_GET['nagr'])) {
         $ai['zb_n'] += 1;
         $a->updateTier('zb');
         $a->givePrizeItems(10020, 'zb');
-        $nagrtxt .= 'Жетон успеха X' . $a->getData()['zb']['prize'][$ai['zb_n']];
-    } elseif ( //Хаот задание vx
+        $nagrtxt .= '����� ������ X' . $a->getData()['zb']['prize'][$ai['zb_n']];
+    } elseif ( //���� ������� vx
         in_array($_GET['nagr'], [21, 22, 23, 24, 25]) &&
         in_array($ai['vx_n'], [0, 1, 2, 3, 4]) &&
         $ai['klasvx'] > $ai['vx_n']
@@ -37,7 +34,7 @@ if (isset($_GET['nagr'])) {
         $a->updateTier('vx');
         $u->addEkr($a->getData()['vx']['prize'][$ai['vx_n']]);
         $nagrtxt .= $a->getData()['vx']['prize'][$ai['vx_n']] . $a->getData()['vx']['prize'][0];
-    } elseif ( //Сундуки трупожора snt
+    } elseif ( //������� ��������� snt
         in_array($_GET['nagr'], [31, 32, 33, 34, 35]) &&
         in_array($ai['snt_n'], [0, 1, 2, 3, 4]) &&
         $ai['klassnt'] > $ai['snt_n']
@@ -46,7 +43,7 @@ if (isset($_GET['nagr'])) {
         $a->updateTier('snt');
         $u->addEkr($a->getData()['snt']['prize'][$ai['snt_n']]);
         $nagrtxt .= $a->getData()['snt']['prize'][$ai['snt_n']] . $a->getData()['snt']['prize'][0];
-    } elseif ( //Руны 8 лвл. rp
+    } elseif ( //���� 8 ���. rp
         in_array($_GET['nagr'], [41, 42, 43, 44, 45]) &&
         in_array($ai['rp_n'], [0, 1, 2, 3, 4]) &&
         $ai['klasrp'] > $ai['rp_n']
@@ -54,8 +51,8 @@ if (isset($_GET['nagr'])) {
         $ai['rp_n'] += 1;
         $a->updateTier('rp');
         $a->givePrizeItems(10038, 'rp');
-        $nagrtxt .= 'Плохие Заготовки X' . $a->getData()['rp']['prize'][$ai['rp_n']];
-    } elseif ( //Руны 9 лвл. rn
+        $nagrtxt .= '������ ��������� X' . $a->getData()['rp']['prize'][$ai['rp_n']];
+    } elseif ( //���� 9 ���. rn
         in_array($_GET['nagr'], [51, 52, 53, 54, 55]) &&
         in_array($ai['rn_n'], [0, 1, 2, 3, 4]) &&
         $ai['klasrn'] > $ai['rn_n']
@@ -63,8 +60,8 @@ if (isset($_GET['nagr'])) {
         $ai['rn_n'] += 1;
         $a->updateTier('rn');
         $a->givePrizeItems(10039, 'rn');
-        $nagrtxt .= 'Нормальные Заготовки X' . $a->getData()['rn']['prize'][$ai['rn_n']];
-    } elseif ( //Руны 10 лвл. rb
+        $nagrtxt .= '���������� ��������� X' . $a->getData()['rn']['prize'][$ai['rn_n']];
+    } elseif ( //���� 10 ���. rb
         in_array($_GET['nagr'], [61, 62, 63, 64, 65]) &&
         in_array($ai['rb_n'], [0, 1, 2, 3, 4]) &&
         $ai['klasrb'] > $ai['rb_n']
@@ -72,8 +69,8 @@ if (isset($_GET['nagr'])) {
         $ai['rb_n'] += 1;
         $a->updateTier('rb');
         $a->givePrizeItems(10040, 'rb');
-        $nagrtxt .= 'Идеальные Заготовки X' . $a->getData()['rb']['prize'][$ai['rb_n']];
-    } elseif ( //Героик pg
+        $nagrtxt .= '��������� ��������� X' . $a->getData()['rb']['prize'][$ai['rb_n']];
+    } elseif ( //������ pg
         in_array($_GET['nagr'], [71, 72, 73, 74, 75]) &&
         in_array($ai['pg_n'], [0, 1, 2, 3, 4]) &&
         $ai['klaspg'] > $ai['pg_n']
@@ -81,8 +78,8 @@ if (isset($_GET['nagr'])) {
         $ai['pg_n'] += 1;
         $a->updateTier('pg');
         $a->givePrizeItems(10020, 'pg');
-        $nagrtxt .= 'Жетон Успеха X' . $a->getData()['pg']['prize'][$ai['pg_n']];
-    } elseif ( //Продать бабушке найденные вещи в пещере bv
+        $nagrtxt .= '����� ������ X' . $a->getData()['pg']['prize'][$ai['pg_n']];
+    } elseif ( //������� ������� ��������� ���� � ������ bv
         in_array($_GET['nagr'], [81, 82, 83, 84, 85]) &&
         in_array($ai['bv_n'], [0, 1, 2, 3, 4]) &&
         $ai['klasbv'] > $ai['bv_n']
@@ -91,7 +88,7 @@ if (isset($_GET['nagr'])) {
         $a->updateTier('bv');
         $u->addKr($a->getData()['bv']['prize'][$ai['bv_n']]);
         $nagrtxt .= $a->getData()['bv']['prize'][$ai['bv_n']] . $a->getData()['bv']['prize'][0];
-    } elseif ( //Клан вар kw
+    } elseif ( //���� ��� kw
         in_array($_GET['nagr'], [91, 92, 93, 94, 95]) &&
         in_array($ai['kw_n'], [0, 1, 2, 3, 4]) &&
         $ai['klaskw'] > $ai['kw_n']
@@ -99,8 +96,8 @@ if (isset($_GET['nagr'])) {
         $ai['kw_n'] += 1;
         $a->updateTier('kw');
         $a->givePrizeItems(4917, 'kw');
-        $nagrtxt .= 'Клановый опыт +50000 X' . $a->getData()['kw']['prize'][$ai['kw_n']];
-    } elseif ( //Башня смерти задание bs
+        $nagrtxt .= '�������� ���� +50000 X' . $a->getData()['kw']['prize'][$ai['kw_n']];
+    } elseif ( //����� ������ ������� bs
         in_array($_GET['nagr'], [101, 102, 103, 104, 105]) &&
         in_array($ai['bs_n'], [0, 1, 2, 3, 4]) &&
         $ai['klasbs'] > $ai['bs_n']
@@ -109,7 +106,7 @@ if (isset($_GET['nagr'])) {
         $a->updateTier('bs');
         $u->addEkr($a->getData()['bs']['prize'][$ai['bs_n']]);
         $nagrtxt .= $a->getData()['bs']['prize'][$ai['bs_n']] . $a->getData()['bs']['prize'][0];
-    } elseif ( //Турниры победы trn
+    } elseif ( //������� ������ trn
         in_array($_GET['nagr'], [111, 112, 113, 114, 115]) &&
         in_array($ai['trn_n'], [0, 1, 2, 3, 4]) &&
         $ai['klastrn'] > $ai['trn_n']
@@ -119,10 +116,7 @@ if (isset($_GET['nagr'])) {
         $u->addEkr($a->getData()['trn']['prize'][$ai['trn_n']]);
         $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]);
-
+    $c->sendsys($nagrtxt, $u->info['login']);
 }
 
 ?>
@@ -155,12 +149,12 @@ if (isset($_GET['nagr'])) {
 </style>
 
 <div style="text-align: right;">
-    <input class="btn" type="button" value="Подсказка"
+    <input class="btn" type="button" value="���������"
            onclick="window.open('/encicl/help/titul.html', 'help', 'height=300,width=500,location=no,menubar=no,status=no,toolbar=no,scrollbars=yes')">
-    <input class="btn" type="button" value="Вернуться" onClick="top.frames['main'].location = 'main.php';" name=edit>
+    <input class="btn" type="button" value="���������" onClick="top.frames['main'].location = 'main.php';" name=edit>
 </div>
 
-<H3>Достижения</H3>
+<H3>����������</H3>
 
 <?= $a->getList(); ?>
 
diff --git a/modules_data/transfer.php.bac b/modules_data/transfer.php.bac
index 30055a96..0f596f95 100644
--- a/modules_data/transfer.php.bac
+++ b/modules_data/transfer.php.bac
@@ -10,7 +10,7 @@ if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')
 	define('GAME',true);	
 	require_once('_incl_data/__config.php');
 	require_once('_incl_data/class/__db_connect.php');
-	include('_incl_data/class/__user.php');
+	require_once('_incl_data/class/__user.php');
 	if(isset($u->tfer['id']) && $u->info['align'] != 2)
 	{
 		if($u->tfer['finish1']==0 && $u->tfer['finish2']==0)
diff --git a/mult.php b/mult.php
index a28efc8a..d7b4d78a 100644
--- a/mult.php
+++ b/mult.php
@@ -1,38 +1,34 @@
 <?php
-define('GAME',true);
+# Admin Only Area
+const 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']) && $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 .= '<font color="red"><b>'; }
-		$html .= $i.'. '.$u->microLogin($pl['id'],1).' ( '.$b1.' ��. / '.$b2.' ���. )<hr>';
-		if( $b1 < 1000 ) { $html .= '</b></font>'; }*/
-		//$i++;
-		if( $b1 < 1000 ) {
-			$html .= '<font color="red"><b>';
-			$html .= $i.'. '.$u->microLogin($pl['id'],1).' ( '.$b1.' ��. / '.$b2.' ���. )<hr>';
-			$html .= '</b></font>';
-			$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 .= '<font color="red"><b>';
+        $html .= $i . '. ' . $u->microLogin($pl['id'], 1) . ' ( ' . $b1 . ' ��. / ' . $b2 . ' ���. )<hr>';
+        $html .= '</b></font>';
+        $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 @@
 <?php
+# Admin Only Area
 header('Content-Type: text/html; charset=windows-1251');
-		
-define('GAME',true);
-include('_incl_data/__config.php');	
-include('_incl_data/class/__db_connect.php');	
-include('_incl_data/class/__user.php');
-	
-if( $u->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).' <br>';
-	}
+
+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) . ' <br>';
 }
-?>
\ No newline at end of file
diff --git a/myexp.php b/myexp.php
index 749aec16..b5beb0db 100644
--- a/myexp.php
+++ b/myexp.php
@@ -1,29 +1,34 @@
 <?php
-function GetRealIp(){
-	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'];
-}
-function var_info($vars, $d = false){
-    echo "<pre style='border: 1px solid gray;border-radius: 5px;padding: 3px 6px;background: #cecece;color: black;font-family: Arial;font-size: 12px;'>\n";
+
+use Insallah\Db;
+
+function var_info($vars, $d = false)
+{
+    echo "<pre style='
+            border: 1px solid gray;
+            border-radius: 5px;
+            padding: 3px 6px;
+            background: #cecece;
+            color: black;
+            font-family: Arial,serif;
+            font-size: 12px;
+        '>\n";
     var_dump($vars);
     echo "</pre>\n";
-    if ($d) exit();
+    if ($d) {
+        exit();
+    }
 }
-define('IP',GetRealIp());
 
+const GAME = true;
 include('_incl_data/__config.php');
-define('GAME',true);
 include('_incl_data/class/__db_connect.php');
-include('_incl_data/class/__user.php');
+define('IP', UserIp::get());
+$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'].'<br>';
-	}
+if (isset($u->info['id'])) {
+    $sp = Db::getRows('select battle_id, exp from battle_last where uid = ? order by id desc', [$u->info['id']]);
+    foreach ($sp as $row) {
+        echo '��� � ' . $row['battle_id'] . ' , ���� �� ������ ���: ' . $row['exp'] . '<br>';
+    }
 }
-
-?>
\ No newline at end of file
diff --git a/news_script/index.php b/news_script/index.php
index 6eeb9315..837fd78e 100644
--- a/news_script/index.php
+++ b/news_script/index.php
@@ -1,7 +1,7 @@
 <?php
 define('GAME',time());
 
-include('../_incl_data/class/__db_connect.php');
+require_once('../_incl_data/class/__db_connect.php');
 
 $url = explode('?', $_SERVER["REQUEST_URI"]);
 $url = explode('/', $url[0]);
diff --git a/obraz.php b/obraz.php
index 151ad59f..16853e24 100644
--- a/obraz.php
+++ b/obraz.php
@@ -1,352 +1,119 @@
 <?php
-define('GAME',time());
 
-include('_incl_data/class/__db_connect.php');
+use Insallah\Db;
 
-if(!isset($_GET['id'])) {
-	$urla = explode('?',$_SERVER["REQUEST_URI"]);
-	$url = explode('/',$urla[0]);
+define('GAME', time());
 
-	$_GET['id'] = round((int)$url[2]);
+require_once '_incl_data/__config.php';
+require_once '_incl_data/class/__db_connect.php';
+
+$urla = explode('?', $_SERVER["REQUEST_URI"]);
+$url = explode('/', $urla[0]);
+
+$rv = explode('i', $url[2]);
+$rv = (int)$rv[1];
+$sp = [];
+
+$str = '�������� ���� �� �������� �����, ����� ���������� ������<br>';
+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 and uid = 0',
+        [$sex]
+    );
+}
+if ($rv === 3) {
+    $sp = Db::getRows('select * from obraz where login != \'\' or uid != 0');
 }
 
-/* ������� */
-$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<count($di))
-	{
-		$de = explode('=',$di[$i]);
-		if(isset($de[0]))
-		{
-			$ist[$de[0]] = $de[1];
-		}
-		$i++;
-	}
-	return $ist;
+if (!empty($sp)) {
+    $str = '';
+    foreach ($sp as $itm) {
+        if (empty($itm['name'])) {
+            $itm['name'] = '����� �' . $itm['id'];
+        }
+        if (!empty($itm['uid'])) {
+            $itm['login'] = Db::getValue('select login from users where id = ?', [$itm['uid']]);
+        }
+        if (!empty($itm['login'])) {
+            $itm['name'] = $itm['login'];
+        }
+        $imgsrc = "/img.new-combats.com/i/obraz/{$itm['sex']}/{$itm['img']}";
+        $str .= <<<HTML
+<figure style="border:1px dashed grey; float: left; margin: 5px;">
+    <img src="$imgsrc" alt={$itm['name']} title={$itm['name']} width="120" height="220">
+    <figcaption style="text-align: center;">{$itm['name']}</figcaption>
+</figure>
+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] = '';
-}
- 
 ?>
 <!DOCTYPE HTML>
-<html>
+<html lang="ru">
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
-<title>����� ���������� ���� | ���������� <? if(isset($itm['id'])) { ?>| <?=$rz[$rt[$itm['type']]][1]?> | <?=$itm['name']?><? } ?></title>
-<link href="/main1.css" rel="stylesheet" type="text/css">
-<style type="text/css">
-.style6 {	color: #DFD3A3;
-	font-size: 9px;
-}
-.inup3 {
-	border: 1px dashed #D3CAA0;
-	font-size: 12px;
-
-}
-.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;
-}
-</style>
+    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
+    <title>����� ���������� ���� | ���������� �������</title>
+    <link rel="stylesheet" href="/main1.css">
+    <link rel="stylesheet" href="/css/obraz.css">
 </head>
-<body bgcolor="#000000" topmargin=0 leftmargin=0 marginheight=0 marginwidth=0>
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-  <tr valign=top>
-    <td><table width="100%" height="135"  border="0" cellpadding="0" cellspacing="0">
-        <tr>
-          <td background="https://new-combats.com/forum_script/img/line_capitalcity.jpg" scope="col" align=center><img style="display:block" src="https://new-combats.com/inx/newlogo3.jpg" width="924" height="135" border=0></td>
-        </tr>
-      </table></td>
-  </tr>
-</table>
-<? if(isset($itm['id'])) { ?>
-<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor='#3D3D3B'>
-  <tr valign=top>
-    <td></td>
-    <td align=center><SCRIPT>
-wsize=document.body.clientWidth;
-if (wsize >= 800 ) wsize=Math.floor(wsize*0.8);
-if (wsize < 700) wsize=700;
-document.write('<table cellspacing=0 cellpadding=0 bgcolor=#f2e5b1 border=0 width='+(wsize-20)+'>');
-</SCRIPT>
-  <tr valign=top>
-    <td width="29" rowspan=2 background="https://new-combats.com/forum_script/img/leftground.jpg"><img src="https://img.new-combats.com/i/encicl/pictlr_<?=$rz[$rt[$itm['type']]][0]?>.jpg" width="29" height="256"></td>
-    <td width="118" align="left"><img id="imleft" src="https://img.new-combats.com/i/encicl/pictl_<?=$rz[$rt[$itm['type']]][0]?>.jpg" width="118" height="257"><BR>
-    </td>
-    <td rowspan=2 align="left">     
-      <p><b>�</b> <a href="https://new-combats.com/shadow/">������</a> / <b><i><?=$itm['name']?></i></b>  
-      <h2><?=$itm['name']?></h2>
-      <img src="https://img.new-combats.com/i/encicl/ln3.jpg" width="400" height="1">
-      </p>
-    <? if( $img3dShow==false && (file_exists('../img.new-combats.com/chars/enc/big'.str_replace('.gif','',str_replace('.png','',$itm['img'])).'.jpg') == true) OR $img3dShow==true ) { ?>  
-	<div align="center"> 
-        <table width="323"  border="0" cellspacing="0" cellpadding="0">
-          <tr>
-            <td align="left"  width="12" height="10"><img style="display:block" src="https://img.new-combats.com/i/encicl/ll12_30.gif" width="12" height="10"></td>
-            <td width="100%" background="https://img.new-combats.com/i/encicl/ram12_34.gif"></td>
-            <td width="12" height="10" align="right"><img style="display:block" src="https://img.new-combats.com/i/encicl/ll12_30.gif" width="12" height="10"></td>
-          </tr>
-          <tr>
-            <td width="12" background="https://img.new-combats.com/i/encicl/line_left_13.gif">&nbsp;</td>
-            <td width="323"><img style="display:block" src="<? if( file_exists('../img.new-combats.com/chars/enc/'.$itm['sex'].'/big'.str_replace('.gif','',str_replace('.png','',$itm['img'])).'.jpg') == true ) { ?>https://img.new-combats.com/chars/enc/<?=$itm['sex']?>/big<?=str_replace('.gif','',str_replace('.png','',$itm['img']))?>.jpg<? }else{ ?>https://img.new-combats.com/chars/enc/back.jpg<? } ?>" alt="" width="323" height="600" border=1 id="bigim"></td>
-            <td width="12" background="https://img.new-combats.com/i/encicl/line_right_13.gif">&nbsp;</td>
-          </tr>
-          <tr>
-           		  <td align="left" width="12" height="10"><img style="display:block" src="https://img.new-combats.com/i/encicl/ll12_30.gif" width="12" height="10"></td>
-                  <td width="100%" style="background-image:url(https://img.new-combats.com/i/encicl/ram12_34down.gif); background-position:bottom"></td>
-                  <td width="12" align="right"><img style="display:block" src="https://img.new-combats.com/i/encicl/ll12_30.gif" width="12" height="10"></td>
-          </tr>
-        </table>
-	</div>
-	<? } ?>
-      <p align="center">&nbsp;</p>
-      <BR>
-      <table width="504" border="0" align=center cellpadding="0" cellspacing="0">
-        <tr>
-          <td align=left valign="top">
-	
-<table width="95%"  border="0" align="center" cellpadding="3" cellspacing="0" class="inup3">
-<tr>
-<td width="100%">
-<A HREF="?id=<?=$itm['id']?>" target=_blank><?=$itm['name']?></A>
-<BR><BR>
-<u>������� ������:</u><br><?=$itm['history']?>
-</td>
-</tr>
-</table>
+<body>
+<div class="header">
+    <img class="logo" src="https://new-combats.com/inx/newlogo3.jpg" alt="logo" title="logo">
+</div>
 
-	</tr>
-      </table>
-      <p>
-      <!-- End of text -->
-    <td style='padding-left: 3' align=right><img id="imright" height=144 src="https://img.new-combats.com/i/encicl/pict_<?=$rz[$rt[$itm['type']]][0]?>.jpg" width=139 border=0></td>
-    <td valign=top background="https://new-combats.com/forum_script/img/rightground.jpg">&nbsp;&nbsp;&nbsp;&nbsp;</td>
-  </tr>
-  <tr valign=top>
-    <td></td>
-    <td valign=center style="padding-bottom:50" align="right"><IMG height=236 src="https://img.new-combats.com/i/encicl/pictr_<?=$rz[$rt[$itm['type']]][0]?>.jpg" width=128 border=0></td>
-    <td width="23" valign=top background="https://new-combats.com/forum_script/img/rightground.jpg">&nbsp;</td>
-  </tr>
-</table>
-<? }else{
-	
-	$rv = explode('i',$url[2]);
-	$rv = (int)$rv[1];
-	//
-	$rname = '���������� ������� ����������� �����';
-	$html = '';
-	//
-	if( $rv > 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');
-		}
-		
-	}
-	
-	
-	
-?>
-<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor='#3D3D3B'>
-  <tr valign=top>
-    <td></td>
-    <td align=center><SCRIPT>
-wsize=document.body.clientWidth;
-if (wsize >= 800 ) wsize=Math.floor(wsize*0.8);
-if (wsize < 700) wsize=700;
-document.write('<table cellspacing=0 cellpadding=0 bgcolor=#f2e5b1 border=0 width='+(wsize-20)+'>');
-    </SCRIPT>
- 	  <tr valign=top>
-      <td width="29" rowspan=2 background="https://new-combats.com/forum_script/img/leftground.jpg"><img src="https://img.new-combats.com/i/encicl/obrzz_08.jpg" width="29" height="256"></td>
-      <td width="218" height="257" align="left"><img id="imleft2" src="https://img.new-combats.com/i/encicl/obrzz_04.jpg" width="118" height="257"><BR></td>
-    <td rowspan=2 align="left"><p><b>&raquo;</b> <a href="https://new-combats.com/shadow/">������</a> /
-      <h2><?=$rname?></h2>
-        <img src="https://img.new-combats.com/i/encicl/ln3.jpg" width="400" height="1">
-        </p>
-	  <?
-	  if( $rv == 0 ) {
-		 echo '�������� ���� �� �������� �����, ����� ���������� ������<br>'; 
-	  }else{
-		
-		
-		while( $itm = mysql_fetch_array($sp) ) {
-			if( $itm['name'] == '' ) {
-				$itm['name'] = '����� �'.$itm['id'];
-			}
-			?>
-	  <table width="120" style="float:left;" border="0" align=center cellpadding="0" cellspacing="0">
-	    <tr>
-	      <td align=left valign="top"><table width="95%"  border="0" align="center" cellpadding="3" cellspacing="0" class="inup3">
-	        <tr>
-	          <td align="center" valign="top" style='padding: 0,2,0,5'><A HREF="/shadow/<?=$itm['id']?>" target=_blank><?=$itm['name']?><br><br></A><a title="<?=$itm['name']?>" href="/shadow/<?=$itm['id']?>"><SPAN style='background-color: #E0E0E0'><img src="https://img.new-combats.com/i/obraz/<?=$itm['sex']?>/<?=$itm['img']?>" alt="<?=$itm['name']?>" name="image" border="0"></SPAN></a></td>
-	          </tr>
-	        </table>
-        </tr>
-      </table>
-	  <?
-		} 
-	  }
-	  ?>
-      <p align="center">&nbsp;</p>
-        <BR>
-        <p>
-          <!-- End of text -->
-    <td style='padding-left: 3' align=right><img id="imright2" height=144 src="https://img.new-combats.com/i/encicl/obrzz1.jpg" width=139 border=0></td>
-      <td valign=top background="https://new-combats.com/forum_script/img/rightground.jpg">&nbsp;&nbsp;&nbsp;&nbsp;</td>
-  </tr>
-  <tr valign=top>
-    <td valign="top">
-    
-    <!-- -->
-    
-    <b><span style="COLOR: #8f0000;  FONT-FAMILY: Arial;  FONT-SIZE: 11pt;">������ ����������</span></b><br>
-    <table width="100%" height="11" border="0" cellpadding="0" cellspacing="0">
+<table class="main">
+    <tr style="vertical-align: top;">
+        <td style="width: 29px; background-image: url(https://new-combats.com/forum_script/img/leftground.jpg);"
+            rowspan=2>
+            <img src="https://img.new-combats.com/i/encicl/obrzz_08.jpg" width="29" height="256" alt="">
+        </td>
+        <td style="width: 218px; height: 257px;">
+            <img id="imleft2" src="https://img.new-combats.com/i/encicl/obrzz_04.jpg" width="118" height="257" alt="">
+            <BR>
+        </td>
+        <td rowspan=2>
+            <h2>���������� ������� ����������� �����</h2>
+            <img src="https://img.new-combats.com/i/encicl/ln3.jpg" width="400" height="1" alt="hr"><br>
+            <?= $str ?>
+        </td>
+        <td style='padding-left: 3px; text-align: right;'>
+            <img id="imright2" height=144 src="https://img.new-combats.com/i/encicl/obrzz1.jpg" width=139 alt="">
+        </td>
+        <td style="vertical-align: top; background-image: url(https://new-combats.com/forum_script/img/rightground.jpg)">
+            &nbsp;&nbsp;&nbsp;&nbsp;
+        </td>
+    </tr>
     <tr>
-		<td width="12" align="left"><img src="https://img.new-combats.com/ram12_33.gif" width="12" height="11"></td>
-		<td style="background-image:url(https://img.new-combats.com/ram12_34.gif); background-repeat:repeat-x; background-position:0 2px;"></td>
-		<td width="13" align="right"><img src="https://img.new-combats.com/ram12_35.gif" width="13" height="11"></td>
-	</tr>
-    </table><br>
-    <b>�������</b><br>
-    &nbsp;&nbsp;&nbsp;&middot;&nbsp;<a href="/shadow/i1">�����������</a>&nbsp;<br>
-    <b>�������</b><br> 
-    &nbsp;&nbsp;&nbsp;&middot;&nbsp;<a href="/shadow/i2">�����������</a>&nbsp;<br>
-    <br><br><br> 
-    <!-- -->
-    
-    </td>
-    <td valign="bottom" style="padding-bottom:50" align="right"><IMG height=236 src="https://img.new-combats.com/i/encicl/pictr_subject.jpg" width=128 border=0></td>
-    <td width="23" valign=top background="https://new-combats.com/forum_script/img/rightground.jpg">&nbsp;</td>
-  </tr>
-</table>
-<? } ?>
-</td>
-<td></td>
-</tr>
-</table>
-<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor=#000000>
-  <TR>
-    <TD colspan=3 width="100%" height=13 background="https://img.new-combats.com/i/encicl/ln_footer.jpg"></TD>
-  </TR>
-  <tr valign=top>
-    <td width="20%"><div align="center">
-&nbsp;
-      </div></td>
-    <td align=center valign=middle><div align="center" style="padding: 5px 0px; height: 32px; box-sizing: border-box;"><NOBR><span class="style6">Copyright � <?=date('Y')?> �www.new-combats.com�</span></NOBR><br><Br></div></td>
-    <td width="20%"></td>
-  </tr>
+        <td style="vertical-align: top;">
+            <span style="color: #8f0000; font-weight: bold;">������ ����������</span>
+            <hr>
+            <strong>�������</strong><br>
+            <ul>
+                <li><a href="/shadow/i1">�����������</a></li>
+            </ul>
+            <br>
+            <strong>�������</strong><br>
+            <ul>
+                <li><a href="/shadow/i2">�����������</a></li>
+            </ul>
+            <br>
+            � <a href="/shadow/i3">�������</a>
+        </td>
+        <td style="padding-bottom:50px; text-align: right; vertical-align: bottom;">
+            <IMG height=236 src="https://img.new-combats.com/i/encicl/pictr_subject.jpg" width=128 alt="">
+        </td>
+        <td style="width: 23px; vertical-align: top; background-image: url(https://new-combats.com/forum_script/img/rightground.jpg);">
+            &nbsp;
+        </td>
+    </tr>
 </table>
+<div class="footer">Copyright � <?= date('Y') ?> �www.new-combats.com�</div>
 </body>
 </html>
diff --git a/online.php b/online.php
index 92e7655c..9d8e8730 100644
--- a/online.php
+++ b/online.php
@@ -1,11 +1,14 @@
 <?php
+
+use Insallah\Db;
+
 header('Content-Type: text/html; charset=windows-1251');
-define('GAME', true);
+const GAME = true;
 require_once '_incl_data/__config.php';
 require_once '_incl_data/class/__db_connect.php';
-require_once '_incl_data/class/__user.php';
-require_once '_incl_data/class/__filter_class.php';
-require_once '_incl_data/class/__chat_class.php';
+$u = User::start();
+$filter = new Filter();
+$chat = new Chat();
 
 if (
     !isset($u->info['id']) ||
@@ -21,34 +24,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 +64,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 +88,74 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
         $x = explode(" ", $buf);
         $newbuf = '';
         for ($j = 0; $j < count($x); $j++) {
-            $uname = '&lt;Внутренняя ссылка&gt;';
+            $uname = '&lt;���������� ������&gt;';
             //
             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 = '<font color=#831db7>&lt;Информация о &quot;' . $ulogin . '&quot;&gt;</font>';
+                    $uname = '<font color=#831db7>&lt;���������� � &quot;' . $ulogin . '&quot;&gt;</font>';
                 }
-            } elseif (strripos($x[$j], 'audio_1610649509.mp3')) { //ТУТ аудио
-                $uname = '<font color=#FF851B>&lt;Голосовое сообщение&gt;</font>';
+            } elseif (strripos($x[$j], 'audio_1610649509.mp3')) { //��� �����
+                $uname = '<font color=#FF851B>&lt;��������� ���������&gt;</font>';
             } 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 = '<font color=#5f9b00>&lt;Предмет &quot;' . $ulogin . '&quot;&gt;</font>';
+                    $uname = '<font color=#5f9b00>&lt;������� &quot;' . $ulogin . '&quot;&gt;</font>';
                 } else {
-                    $uname = '<font color=#5f9b00>&lt;Библиотека предметов&gt;</font>';
+                    $uname = '<font color=#5f9b00>&lt;���������� ���������&gt;</font>';
                 }
             } 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 = '<font color=#b57300>&lt;Новость &quot;' . $ulogin . '&quot;&gt;</font>';
+                    $uname = '<font color=#b57300>&lt;������� &quot;' . $ulogin . '&quot;&gt;</font>';
                 } else {
-                    $uname = '<font color=#b57300>&lt;Новостная лента&gt;</font>';
+                    $uname = '<font color=#b57300>&lt;��������� �����&gt;</font>';
                 }
             } 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 = '<font color=#4c6e00>&lt;Библиотека &quot;' . $ulogin . '&quot;&gt;</font>';
+                    $uname = '<font color=#4c6e00>&lt;���������� &quot;' . $ulogin . '&quot;&gt;</font>';
                 } else {
-                    $uname = '<font color=#4c6e00>&lt;Библиотека&gt;</font>';
+                    $uname = '<font color=#4c6e00>&lt;����������&gt;</font>';
                 }
             } elseif (strripos($x[$j], 'new-combats.com/forum')) {
                 $ulogin = explode('/forum?read=', $x[$j]);
@@ -131,29 +163,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 = '<font color=#0055b5>&lt;Форум &quot;' . $ulogin . '&quot;&gt;</font>';
+                    $uname = '<font color=#0055b5>&lt;����� &quot;' . $ulogin . '&quot;&gt;</font>';
                 } 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 = '<font color=#0055b5>&lt;Конференция форума &quot;' . $ulogin['name'] . '&quot;&gt;</font>';
+                        $uname = '<font color=#0055b5>&lt;����������� ������ &quot;' . $ulogin['name'] . '&quot;&gt;</font>';
                     } else {
-                        $uname = '<font color=#0055b5>&lt;Форум проекта&gt;</font>';
+                        $uname = '<font color=#0055b5>&lt;����� �������&gt;</font>';
                     }
                 }
             }
             //
             $newbuf .= preg_match
-            ("/(https:\\/\\/)?(new-combats+\\.com(([ \"'>\r\n\t])|(\\/([^ \"'>\r\n\t]*)?)))/",
-                $x[$j], $ok) ? str_replace($ok[2], "<small><a href=https://$ok[2] target=_blank ><i>" . $uname . "</i></a></small>",
-                    str_replace("https://", "", $x[$j])) . " " : $x[$j] . " ";
+            (
+                "/(https:\\/\\/)?(new-combats+\\.com(([ \"'>\r\n\t])|(\\/([^ \"'>\r\n\t]*)?)))/",
+                $x[$j], $ok
+            ) ? str_replace(
+                    $ok[2], "<small><a href=https://$ok[2] target=_blank ><i>" . $uname . "</i></a></small>",
+                    str_replace("https://", "", $x[$j])
+                ) . " " : $x[$j] . " ";
         }
         return $newbuf;
     }
@@ -187,9 +235,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 +256,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'] . '","<small>Вы наказаны за спам на 20 минут </small>","Black","1","1","0"]);';
+            $r['js'] .= 'chat.sendMsg(["new","' . time(
+                ) . '","6","","' . $u->info['login'] . '","<small>�� �������� �� ���� �� 20 ����� </small>","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 +287,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 +312,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'] . '","<small>Вы не можете отправлять так часто сообщения... </small>","Black","1","1","0"]);';
+        $r['js'] .= 'chat.sendMsg(["new","' . time(
+            ) . '","6","","' . $u->info['login'] . '","<small>�� �� ������ ���������� ��� ����� ���������... </small>","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'] . '","<small>Вы наказаны за флуд на 5 минут </small>","Black","1","1","0"]);';
+                $r['js'] .= 'chat.sendMsg(["new","' . time(
+                    ) . '","6","","' . $u->info['login'] . '","<small>�� �������� �� ���� �� 5 ����� </small>","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'] . '","<small>Вы не можете отправлять приват до достижения 150000 опыта.</small>","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'] . '","<small>�� �� ������ ���������� ������ �� ���������� 150000 �����.</small>","Black","1","1","0"]);';
 
     } else {
-        //Записываем данные
+        //���������� ������
         $msg['time'] = time();
         $msg['spam'] = 0;
         $msg['type'] = 1;
@@ -285,7 +357,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 +377,59 @@ 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 = Db::getRow('select id, admin from users where login = ? and admin > 0', [$msg['to']]);
                 if ($msg['type'] != 3) {
                     unset($admq);
                 }
             }
             if (!isset($admq['id'])) {
-                $msg['fspam'] = $filter->spamFiltr(str_replace('точка', '.', str_replace('ру', 'ru', $_POST['msg'])));
+                $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'] . '","<small>В нашем чате запрещается сообщать ссылки на атльтернативные проекты. Повторные попытки могут привести к блокировке персонажа.</small>","Black","1","1","0"]);';
+                    $r['js'] .= 'chat.sendMsg(["new","' . time(
+                        ) . '","6","","' . $u->info['login'] . '","<small>� ����� ���� ����������� �������� ������ �� ��������������� �������. ��������� ������� ����� �������� � ���������� ���������.</small>","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('%', '</b>,<b>', $msg['fspam']);
                         $msg['fspam'] = '<b>' . ltrim($msg['fspam'], '0</b>,<b>') . '</b>';
-                        $r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","<small>В нашем чате запрещается сообщать ссылки на атльтернативные проекты. Запрещенные слова: ' . $msg['fspam'] . '. Предупреждения [' . ($mban['vals'] + 1) . '/1]</small>","Black","1","1","0"]);';
+                        $r['js'] .= 'chat.sendMsg(["new","' . time(
+                            ) . '","6","","' . $u->info['login'] . '","<small>� ����� ���� ����������� �������� ������ �� ��������������� �������. ����������� �����: ' . $msg['fspam'] . '. �������������� [' . ($mban['vals'] + 1) . '/1]</small>","Black","1","1","0"]);';
                     } else {
-                        $r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","<small>В нашем чате запрещается сообщать ссылки на атльтернативные проекты. Вы наказаны за нарушение правил общения.</small>","Black","1","1","0"]);';
-                        mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $u->info['city'] . "','0','','','<b>Автоинформатор</b>: Персонаж " . $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 . ' &quot;' . $u->info['login'] . '&quot; <small><font color=red>Автоинформатор</font></small>: ' . $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'] . '","<small>� ����� ���� ����������� �������� ������ �� ��������������� �������. �� �������� �� ��������� ������ �������.</small>","Black","1","1","0"]);';
+                        mysql_query(
+                            "INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $u->info['city'] . "','0','','','<b>��������������</b>: �������� " . $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 . ' &quot;' . $u->info['login'] . '&quot; <small><font color=red>��������������</font></small>: ' . $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 +438,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'] . '","<b>Вас добавили в игнор</b>: Вы не можете отправлять сообщения персонажу &quot;' . htmlspecialchars($msg['to']) . '&quot;.","Black","1","1","0"]);';
+            $r['js'] .= 'chat.sendMsg(["new","' . time(
+                ) . '","6","","' . $u->info['login'] . '","<b>��� �������� � �����</b>: �� �� ������ ���������� ��������� ��������� &quot;' . htmlspecialchars(
+                    $msg['to']
+                ) . '&quot;.","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'] . '","<small>Вы не являетесь частью одного из <b>Кланов</b> и не можете общаться по этому каналу.</small>","Black","1","1","0"]);';
+                $r['js'] .= 'chat.sendMsg(["new","' . time(
+                    ) . '","6","","' . $u->info['login'] . '","<small>�� �� ��������� ������ ������ �� <b>������</b> � �� ������ �������� �� ����� ������.</small>","Black","1","1","0"]);';
                 $msg['cancel']++;
             } else {
                 $msg['to'] = 'k' . $u->info['clan'];
@@ -364,7 +464,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 +495,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'] . '","<small>Персонажа нет в данной комнате.</small>","Black","1","1","0"]);';
+                    $r['js'] .= 'chat.sendMsg(["new","' . time(
+                        ) . '","6","","' . $u->info['login'] . '","<small>��������� ��� � ������ �������.</small>","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 +537,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'] . '","<small><b>В целях борьбы против рекламы, общение в чате доступно с 8-го уровня.</b> </small>","red","1","1","0"]);';
+                        $r['js'] .= 'chat.sendMsg(["new","' . time(
+                            ) . '","6","","' . $u->info['login'] . '","<small><b>� ����� ������ ������ �������, ������� � ���� �������� � 8-�� ������.</b> </small>","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,62 +563,88 @@ 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 = [
-                            'Отстань попрошайка! ... Ищу анекдоты, интернет не маленький!',
-                            'Подожди... Сейчас что-нибудь найду',
-                            'Почти нашел...',
-                            'Вот один есть, но он не интересный...',
-                            'А свет на центральной площади тьму &quot;пинает&quot;... Эх...'
+                            '������� ����������! ... ��� ��������, �������� �� ���������!',
+                            '�������... ������ ���-������ �����',
+                            '����� �����...',
+                            '��� ���� ����, �� �� �� ����������...',
+                            '� ���� �� ����������� ������� ���� &quot;������&quot;... ��...',
                         ];
                         $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("<br>", "<br>&nbsp; &nbsp; ", $text_com);
                         $text_com = str_replace("<br />", "<br />&nbsp; &nbsp; ", $text_com);
                         $text_com = str_ireplace("\r\n", "", $text_com);
                         $text_com = str_replace("", "", $text_com);
-                        $text_com = '<font color=red><b>Анекдот</b></font>:<br>&nbsp; &nbsp; ' . $text_com . '<br>';
+                        $text_com = '<font color=red><b>�������</b></font>:<br>&nbsp; &nbsp; ' . $text_com . '<br>';
                     } 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;
+    $ar_all = '0';
     $usl = [];
     $cw = [];
     $usid = [];
@@ -518,7 +655,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 +709,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 +727,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,15 +742,18 @@ 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'];
                 $ar_lvl += $pl['level'];
-                $ar_all += $pl['align'] + $pl['clan'] + $pl['molch1'] + $pl['banned'] + $pl['battle'];
-                {
-                    $ar_all += 1;
-                }
+                //trigger_error('align:' . $pl['align'] . ' clan:' . $pl['clan'] . ' molch1:' . $pl['molch1'] . ' banned:' . $pl['banned'] . ' battle:' . $pl['battle']);
+                $ar_all .= $pl['align'] . $pl['clan'] . $pl['molch1'] . $pl['banned'] . $pl['battle'] . 1;
+
             }
             $r['xu']++;
         }
@@ -621,13 +769,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 +834,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 +848,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 +857,7 @@ while ($pl = mysql_fetch_array($sp)) {
         $pl['city'] = $u->info['city'];
     }
 
-    //Проверки на доступ к просмотру
+    //�������� �� ������ � ���������
     if (
         ((
                 (
@@ -737,14 +874,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 +915,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 +926,7 @@ while ($pl = mysql_fetch_array($sp)) {
         $see = 0;
     }
 
-    //Системное сообщение только в этой комнате
+    //��������� ��������� ������ � ���� �������
     if (
         $pl['type'] == 6 &&
         $pl['room'] > 0 &&
@@ -806,17 +936,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 +964,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 +989,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'] = '<span style=\"padding:0 5px 0 5px;background-color:#FFC;\"><font color=red><small>[' . $noseein . ']</small></font> ' . $pl['text'] . '</span>';
             if ($u->info['admin'] > 0 || $modr == 1) {
@@ -872,7 +1002,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 +1021,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 +1038,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]', '<img src=https://img.new-combats.com/i/' . $reimg[1][$k] . ' height=19>', $pl['text']);
+                    $pl['text'] = str_replace(
+                        '[img[' . $reimg[1][$k] . ']][1]',
+                        '<img src=https://img.new-combats.com/i/' . $reimg[1][$k] . ' height=19>', $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] . ']]', '<img src=https://img.new-combats.com/i/' . $reimg[1][$k] . '>', $pl['text']);
+                    $pl['text'] = str_replace(
+                        '[img[' . $reimg[1][$k] . ']]', '<img src=https://img.new-combats.com/i/' . $reimg[1][$k] . '>',
+                        $pl['text']
+                    );
                     $k++;
                 }
             }
@@ -917,31 +1066,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] . ']', '<b oncontextmenu=\"return false;\" onClick=\"alert(\'Функция временно недоступна!\');\" style=\"cursor:pointer;\" class=\"itemsInfo\">Предмет</b>', $pl['text']);
+                    $pl['text'] = str_replace(
+                        'item[' . $reimg[1][$k] . ']',
+                        '<b oncontextmenu=\"return false;\" onClick=\"alert(\'������� �������� ����������!\');\" style=\"cursor:pointer;\" class=\"itemsInfo\">�������</b>',
+                        $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] . ']', '<b oncontextmenu=\"return false;\" onClick=\"alert(\'Функция временно недоступна!\');\" style=\"cursor:pointer;\" class=\"itemsInfo\">Аудио запись</b>', $pl['text']);
+                    $pl['text'] = str_replace(
+                        'item[' . $reimg[1][$k] . ']',
+                        '<b oncontextmenu=\"return false;\" onClick=\"alert(\'������� �������� ����������!\');\" style=\"cursor:pointer;\" class=\"itemsInfo\">����� ������</b>',
+                        $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] . ']', '<b oncontextmenu=\"return false;\" onClick=\"alert(\'Функция временно недоступна!\');\" style=\"cursor:pointer;\" class=\"itemsInfo\">Предмет</b>', $pl['text']);
+                    $pl['text'] = str_replace(
+                        'item [' . $reimg[1][$k] . ']',
+                        '<b oncontextmenu=\"return false;\" onClick=\"alert(\'������� �������� ����������!\');\" style=\"cursor:pointer;\" class=\"itemsInfo\">�������</b>',
+                        $pl['text']
+                    );
                     $k++;
                 }
             }
 
             if ($pl['type'] != 3 && ($pl['invis'] == 1 || $pl['invis'] > time())) {
                 if ($u->info['admin'] == 0) {
-                    $pl['login'] = '<b><i>Невидимка</i></b>';
+                    $pl['login'] = '<b><i>���������</i></b>';
                 } else {
-                    $pl['login'] = '<b><i>Невидимка</i></b></a> <small>(' . $pl['login'] . ')</small>';
+                    $pl['login'] = '<b><i>���������</i></b></a> <small>(' . $pl['login'] . ')</small>';
                 }
 
             }
@@ -950,7 +1111,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 +1123,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 +1152,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'] . '</b>[' . $usr['level'] . ']<b>");';
 }
 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 +1180,7 @@ if (isset($trf['id'])) {
     }
 }
 
-//Перекодируем строки
+//������������ ������
 if ($r['js'] != null) {
     $r['js'] = iconv('cp1251', 'utf-8', $r['js']);
 } else {
diff --git a/onlineList.js b/onlineList.js
index 128a10cc..7b9bdd6f 100644
--- a/onlineList.js
+++ b/onlineList.js
@@ -1,14 +1,14 @@
 var sml_img = { };
 
 Element.prototype.remove = function() {
-    this.parentElement.removeChild(this);
+	this.parentElement.removeChild(this);
 }
 NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {
-    for(var i = 0, len = this.length; i < len; i++) {
-        if(this[i] && this[i].parentElement) {
-            this[i].parentElement.removeChild(this[i]);
-        }
-    }
+	for(var i = 0, len = this.length; i < len; i++) {
+		if(this[i] && this[i].parentElement) {
+			this[i].parentElement.removeChild(this[i]);
+		}
+	}
 }
 
 var chat = {
@@ -49,8 +49,8 @@ var chat = {
 			delete this.ignoreList[login];
 			return
 			//msg
-		} 
-		
+		}
+
 		this.ignoreList.x++;
 		this.ignoreList[login] = this.ignoreList.x;
 		this.ignoreList.nms[this.ignoreList.x] = login;
@@ -74,11 +74,11 @@ var chat = {
 				'width':135,
 				'sound':this.getRandom(8,10),
 				'height':99,
-				'zad':3	
+				'zad':3
 			};
 			frc.left -= 35;
 		}
-		
+
 		if( frc.name != undefined ) {
 			this.sendSound( frc.sound );
 			var obj = top.frames.main.document.getElementById('frvrks');
@@ -87,7 +87,7 @@ var chat = {
 				var i = 1;
 				while( i <= frc.x ) {
 					newhtml += `<img style="display:none" id="frvanim_${this.feerverk_id}_img${i}" width="${frc.width}" height="${frc.height}" src="https://img.new-combats.com/fw/${frc.name}/${i}.gif">`;
-                    i++;
+					i++;
 				}
 				newhtml = `<div id="frvanim_${this.feerverk_id}" style="z-index:5000;position:absolute;width:${frc.width}px;height:${frc.height}px;left:${frc.left}px;top:${frc.top}px;">${newhtml}</div>`;
 				$(obj).append(newhtml);
@@ -137,7 +137,7 @@ var chat = {
 	lookSmiles: function () {
 		if ($('#chbtn8').attr('class') == 'db cp chatBtn8_1') {
 			return this.lookSmilesWork('', 'chatBtn8_2')
-		}  
+		}
 		return this.lookSmilesWork('none', 'chatBtn8_1')
 	},
 	lookSmilesWork: function (display, className) {
@@ -150,13 +150,13 @@ var chat = {
 		$(elemId).attr('class', `db cp ${className}`);
 		this[method] = count;
 	},
-	
+
 	// ������ �����
 	// 1
 	filterMsg: function () {
 		if ($('#chbtn1').attr('class') == 'db cp chatBtn1_1') {
 			return this.greyButton_work('#chbtn1', 'chatBtn1_2', "filter", 1)
-		} 
+		}
 		return this.greyButton_work('#chbtn1', 'chatBtn1_1', "filter", 0)
 	},
 
@@ -172,7 +172,7 @@ var chat = {
 		$.cookie('citySys', 0);
 		return
 	},
-	
+
 	// ������ ��������������
 	// 3
 	soundChat: function () {
@@ -180,7 +180,7 @@ var chat = {
 			return this.greyButton_work('#chbtn7', 'chatBtn7_2', "sound", 1)
 		} else if ($('#chbtn7').attr('class') == 'db cp chatBtn7_2') {
 			return this.greyButton_work('#chbtn7', 'chatBtn7_3', "sound", 2)
-		} 
+		}
 		return this.greyButton_work('#chbtn7', 'chatBtn7_1', "sound", 0)
 	},
 
@@ -189,47 +189,47 @@ var chat = {
 	translitChat: function () {
 		if ($('#chbtn6').attr('class') == 'db cp chatBtn6_1') {
 			return this.greyButton_work('#chbtn6', 'chatBtn6_2', "translit", 1)
-		} 
+		}
 		return this.greyButton_work('#chbtn6', 'chatBtn6_1', "translit", 0)
-	}, 
+	},
 
 	subValSend: '',
-    subSend: async function () {
-        if ($('#textmsg').val() != '') {
-            if ($('#textmsg').val() != this.subValSend) {
-                if (this.nozpros == 0) {
-                    this.trmb();
-                    var textmsg = $('#textmsg').val();
+	subSend: async function () {
+		if ($('#textmsg').val() != '') {
+			if ($('#textmsg').val() != this.subValSend) {
+				if (this.nozpros == 0) {
+					this.trmb();
+					var textmsg = $('#textmsg').val();
 
-                    if (cb_date[cb_select] == 7 && (textmsg.match(/to *\[(.*?)\].*/i) || textmsg.match(/private *\[(.*?)\].*/i))) {
-                        for (var cb in cb_date) {
-                            if (cb_date[cb] == 5) {
+					if (cb_date[cb_select] == 7 && (textmsg.match(/to *\[(.*?)\].*/i) || textmsg.match(/private *\[(.*?)\].*/i))) {
+						for (var cb in cb_date) {
+							if (cb_date[cb] == 5) {
 								open_cb(cb, null);
-                            }
-                        }
-                    }
-                    if (typeof window.online_send_jqxhr == "undefined" || window.online_jqxhr.readyState === 4) {
-                        window.online_send_jqxhr = $.post('online.php?r' + c.rnd + '&cas' + ((new Date().getTime()) + Math.random()), {
-                        	msg: textmsg,
-                        	key: this.key,
-                        	mid: this.msg_id,
-                        	rndo: c.rnd,
-                        	cb: cb_date[cb_select]
-                        }, function (data) {
-                        	chat.clearText();
-                        	chat.fc();
+							}
+						}
+					}
+					if (typeof window.online_send_jqxhr == "undefined" || window.online_jqxhr.readyState === 4) {
+						window.online_send_jqxhr = $.post('online.php?r' + c.rnd + '&cas' + ((new Date().getTime()) + Math.random()), {
+							msg: textmsg,
+							key: this.key,
+							mid: this.msg_id,
+							rndo: c.rnd,
+							cb: cb_date[cb_select]
+						}, function (data) {
+							chat.clearText();
+							chat.fc();
 							chat.genchatData(data, 1);
 							chat.scrollNow(true)
-                        });
-                    }
-                }
-            }
-        }
-    },
+						});
+					}
+				}
+			}
+		}
+	},
 	addto:function(login, type2) {
 		var loginaddT = login;
 		var s = '';
-		if($('#'+$(this.inObj).attr('id')).attr('id') == undefined) {		
+		if($('#'+$(this.inObj).attr('id')).attr('id') == undefined) {
 			$('#textmsg').focus();
 			s = $('#textmsg').val();
 		} else $(this.inObj).focus();
@@ -241,13 +241,13 @@ var chat = {
 		} else if(s.match(reg551) == null) {
 			type = "private";
 		}
-		var type3 = 'to';	
+		var type3 = 'to';
 		var reg2 = new RegExp(""+type+"(\\s*)\\[(.*?)\\]","");
 		var cs = s.replace(reg2,""+type+"$1[,$2,]");
 		var slogin = login.replace(/([\^.*{}$%?\[\]+|\/\(\)])/g,"\\$1");
 		var reg = new RegExp(""+type+"\\s*\\[.*,\\s*"+slogin+"\\s*,.*\\]","");
 		var result = '';
-		var reg3 = new RegExp(""+type+"\\s*\\[(.*?)\\]","");				
+		var reg3 = new RegExp(""+type+"\\s*\\[(.*?)\\]","");
 		while(res = s.match(reg3)) {
 			// result += res[1]+',';
 			result += `${res[1]},`;
@@ -271,7 +271,7 @@ var chat = {
 				if (type2 == 'to') {
 					if (test1 != null) type2 = 'private';
 				}
-				
+
 				if (loginaddT == 'klan' && type2 == 'private') {
 					if (login == 'klan, ') {
 						s = type2 + ' [klan] to [' + prob + '' + str + '' + prob + ']' + space + s;
@@ -280,12 +280,12 @@ var chat = {
 					}
 				}
 				else {s = type2+' ['+prob+''+login+str+''+prob+']'+space+s;}
-			} else {				
+			} else {
 				if(type3 == 'to') type3 = "private";
 				s = type3+' ['+prob+''+str+''+prob+']'+space+s;
 			}
 		} else s = login+str;
-		
+
 		if (this.inObj != null && $('#main').contents().find(`#${this.inObj.id}`).attr('id') != undefined) {
 			$('#main').contents().find(`#${this.inObj.id}`).val(s);
 		} else if ($('#' + $(this.inObj).attr('id')).attr('id') == undefined) {
@@ -302,53 +302,53 @@ var chat = {
 	reMoney: function () {
 		$('#moneyGM').html(`${top.c.money} ��.`);
 	},
-    testTimer: function (n) {
-        clearTimeout(this.t);
-        if ($.cookie('btl') != this.btl) {
-            if ($.cookie('btl') > 0) {
-                this.sendSound(2);
-                if (top.frames['main'].smnpty == undefined) {
+	testTimer: function (n) {
+		clearTimeout(this.t);
+		if ($.cookie('btl') != this.btl) {
+			if ($.cookie('btl') > 0) {
+				this.sendSound(2);
+				if (top.frames['main'].smnpty == undefined) {
 					top.frames['main'].location.href = "main.php";
-				} 
-            }
-            this.btl = $.cookie('btl');
-        }
-        if (this.rtime != this.ct[$.cookie('chatCfg0')] && this.ct[$.cookie('chatCfg0')] != undefined) {
-            this.rtime = this.ct[$.cookie('chatCfg0')];
-            if (this.time > this.rtime) this.time = this.rtime;
-        }
-        if (this.rtime >= 5 || this.r == 0) //was >- 30 lakris fix
-        {
-            if (this.time < 1) {
-                var aot = {
-                	0: 0,
-                	1: 1,
-                	2: 0
-                };
-                if ($('#chcf10').attr('checked') == true) aot[2] = 1;
-                if ($('#autoRefOnline').attr('checked') == true || this.r == 0 || n != false) {
-                    aot[0] = 1;
-                }
-                if (this.nozpros == 0) {
-                    
-                    if (typeof window.online_jqxhr == "undefined" || window.online_jqxhr.readyState === 4) {
-                        window.online_jqxhr = $.getJSON(`online.php?r${c.rnd}&cas${((new Date().getTime()) + Math.random())}`, {key: this.key, mid: this.msg_id, r1: aot[0], r2: aot[1], r3: aot[2], rndo: c.rnd}, function (data) {
-                            if (data.rnd != null) {
-                                chat.genchatData(data);
-                                if (data.key != undefined) chat.saveData = data;
-                                this.g++;
-                                c.rnd = data.rnd;
-                            }
-                        });
-                    }
-                }
-                this.time = 5;
-                this.r++;
-            } else this.time--;
-            this.t = setTimeout('chat.testTimer(false);clearTimeout(this.t);', 1000);
-        }
-    },
-	
+				}
+			}
+			this.btl = $.cookie('btl');
+		}
+		if (this.rtime != this.ct[$.cookie('chatCfg0')] && this.ct[$.cookie('chatCfg0')] != undefined) {
+			this.rtime = this.ct[$.cookie('chatCfg0')];
+			if (this.time > this.rtime) this.time = this.rtime;
+		}
+		if (this.rtime >= 5 || this.r == 0) //was >- 30 lakris fix
+		{
+			if (this.time < 1) {
+				var aot = {
+					0: 0,
+					1: 1,
+					2: 0
+				};
+				if ($('#chcf10').attr('checked') == true) aot[2] = 1;
+				if ($('#autoRefOnline').attr('checked') == true || this.r == 0 || n != false) {
+					aot[0] = 1;
+				}
+				if (this.nozpros == 0) {
+
+					if (typeof window.online_jqxhr == "undefined" || window.online_jqxhr.readyState === 4) {
+						window.online_jqxhr = $.getJSON(`online.php?r${c.rnd}&cas${((new Date().getTime()) + Math.random())}`, {key: this.key, mid: this.msg_id, r1: aot[0], r2: aot[1], r3: aot[2], rndo: c.rnd}, function (data) {
+							if (data.rnd != null) {
+								chat.genchatData(data);
+								if (data.key != undefined) chat.saveData = data;
+								this.g++;
+								c.rnd = data.rnd;
+							}
+						});
+					}
+				}
+				this.time = 5;
+				this.r++;
+			} else this.time--;
+			this.t = setTimeout('chat.testTimer(false);clearTimeout(this.t);', 1000);
+		}
+	},
+
 	gUser:function(data,ol) {
 		var rt = '';
 
@@ -371,11 +371,11 @@ var chat = {
 			}
 			else rt = `<b>${rt}</b>`;
 			if(data[13]!=0) rt = `<span class="uCss${data[13]}">${rt}</span>`;
-			
+
 			if (data[10] > 0) {
 				rt = `<s onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'�������� ��� ������������\',event,3,1,1,2,\'\')">${rt}</s>`;
 			}
-			
+
 			if (data[8] != 0)  data_work(8)
 			else if (data[9] != 0) data_work(9)
 
@@ -388,11 +388,11 @@ var chat = {
 			{
 				rt = `<a href="/clan/${data[4]}" title="${data[4]}" target="_blank"><img width="24" height="15" src="https://${c.img}/i/clan/${data[4]}.gif"></a>${rt}`;
 			}
-			
-			if( data[16] > 0 ) rtData(16) 
-			
+
+			if( data[16] > 0 ) rtData(16)
+
 			rtData(3)
-						
+
 			if(c.lvl>-1)
 			{
 				if(c.city==data[6])
@@ -443,7 +443,7 @@ var chat = {
 			$(`#molch${id}`).html(this.timeOut(this.mlch[id]));
 			this.t_all[id] = setTimeout(`chat.refMolch(${id})`, 1000);
 			return
-		} 
+		}
 		$(`#img_molch${id}`).remove();
 		return delete this.mlch[id], this.t_all;
 	},
@@ -451,7 +451,7 @@ var chat = {
 	fc: function () {
 		$('#textmsg').focus();
 	},
-	
+
 	timeOut: function (v) {
 
 		msPerDay = '';
@@ -500,13 +500,13 @@ var chat = {
 				$('#textmsg').focus();
 				return
 			}
-		} 
+		}
 		return $('#textmsg').val('');
 	},
 	scrollNow: function (userTrue) {
 
 		var $chat_list = document.getElementById("chat_list")
-		
+
 		var $countChatList = $chat_list.scrollHeight - $chat_list.scrollTop
 		if ($countChatList < $chat_list.offsetHeight + 60) {
 			return $chat_list.scrollBy(0, $chat_list.scrollHeight)
@@ -517,7 +517,7 @@ var chat = {
 	sendMsg:function(data) {
 		var msg_see = 1;
 		var global_type = 0;
-		
+
 		if( data[5] != undefined ) {
 			if( data[5].substring(0,7) == 'global:' ) {
 				global_type = 1;
@@ -525,203 +525,203 @@ var chat = {
 			}
 		}
 		if (data[0] == 'new') {
-		    data[0] = `new_msg_ ${this.newmsg++}`;
+			data[0] = `new_msg_ ${this.newmsg++}`;
 		}
-        if (data[2] == 'delete') this.deleteMessage(data[0]);
-        else if (data['d'] > 0) this.deleteMessage(data['d']);
+		if (data[2] == 'delete') this.deleteMessage(data[0]);
+		else if (data['d'] > 0) this.deleteMessage(data['d']);
 		else if (data['s'] > 0) this.deleteMessage(data['s']);
 		else if(data[0]!=undefined && top.document.getElementById(`msg_${data[0]}`) == undefined)
 		{
 			var msg  = '';
-				if(data[0]!=0)
+			if(data[0]!=0)
+			{
+				if(top.c.admin > 0) {
+					if(data[12] == 1) {
+						msg += '<small style="color:red;text-decoration:blink"> <b>un</b>active </small>';
+					}
+				}
+				if(data[3]!='')
 				{
-					if(top.c.admin > 0) {
-						if(data[12] == 1) {
-							msg += '<small style="color:red;text-decoration:blink"> <b>un</b>active </small>';
-						}
-					}
-					if(data[3]!='')
-					{
-						if(data[16] > 0) {
-							msg += `[<a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'���������\',event,\'chat\'); return false;" onClick="chat.addto(\'���������\',\'to\')">${data[3]}</a>]`;
-						}else{
-							msg += `[<a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'${data[3]}\',event,\'chat\'); return false;" onClick="chat.addto(\'${data[3]}\',\'to\')">${data[3]}</a>]`;
-						}
-						if(chat.ignoreList[data[3]]!=undefined) msg_see = 0;
+					if(data[16] > 0) {
+						msg += `[<a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'���������\',event,\'chat\'); return false;" onClick="chat.addto(\'���������\',\'to\')">${data[3]}</a>]`;
+					}else{
+						msg += `[<a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'${data[3]}\',event,\'chat\'); return false;" onClick="chat.addto(\'${data[3]}\',\'to\')">${data[3]}</a>]`;
 					}
+					if(chat.ignoreList[data[3]]!=undefined) msg_see = 0;
+				}
+				if(data[4]!='')
+				{
+					var forYou = 0;
+					//��� ��� �����
+
+					//���� ��������, ������ �������
 					if(data[4]!='')
 					{
-						var forYou = 0;
-						//��� ��� �����
-						
-						//���� ��������, ������ �������
-						if(data[4]!='')
+						var to = '',to2 = '',arr = data[4].split(','),i = 0,vl = '';
+						//��� ���� ������
+						while(i!=-1)
 						{
-							var to = '',to2 = '',arr = data[4].split(','),i = 0,vl = '';								
-							//��� ���� ������
-							while(i!=-1)
+							if(arr[i]!=undefined)
 							{
-								if(arr[i]!=undefined)
-								{
-									vl = this.trim(arr[i]);
-									if (vl.toLowerCase() == top.c.login.toLowerCase()) {
-										forYou++;
-									}
-									if (vl.toLowerCase() == top.c.login.toLowerCase()) {
-										vl = this.trim(data[3]);
-									}
-									if (i > 0) {
-										to += ', ';
-										to2 += ', ';
-									}
-									if (data[3] != '') {
-										to += `<span style="cursor:pointer" onclick="chat.addto(\'${vl}\',\'private\');" oncontextmenu="top.infoMenu(\'${this.trim(arr[i])}\',event,\'chat\'); return false;">${this.trim(arr[i])}</span>`;
-
-										if (this.trim(arr[i].toLowerCase()) != top.c.login.toLowerCase()) {
-											to2 += this.trim(arr[i]);
-										} else {
-											if (data[2] == 2) to2 += this.trim(arr[i]);
-											else to2 += this.trim(vl);
-										}
-									}
-								} else i = -2;
-								i++;
-							}
-						}
-						
-						if(data[2] == 6 || data[2] == 8) {
-							var zmlogin = new RegExp("\\[login:(.*?)\\]","");	
-							var reflcd = new RegExp("\\[reflesh_main_zv_priem:(.*?)\\]","");	
-							if (data[5].match(zmlogin) != null) {
-								zmlogin = data[5].match(zmlogin)[1];
-								data[5] = data[5].replace(`[login:${zmlogin}]`, `<a onMouseDown="top.loginGo(\'${zmlogin}\',event);" oncontextmenu="top.infoMenu(\'${zmlogin}\',event,\'chat\'); return false;" title="${zmlogin}" style="cursor:pointer;" onClick="chat.multiAddto(\'${zmlogin}\',\'to\');">${zmlogin}</a>`);
-							}
-							if (data[5].match(reflcd) != null) {
-								reflcd = data[5].match(reflcd)[1];
-								data[5] = data[5].replace(`[reflesh_main_zv_priem:${reflcd}]`, '');
-							}
-						}
-						
-						//�������� ������ ���� ���������� ���������
-						if (data[2] == 6) {
-							//������ ��������, ��������
-							msg += ' <span style="color:red">��������!</span> ';
-						} else if (data[2] == 2)
-						{
-							if (forYou > 0) {
-								msg += ` <span style="color:${data[6]}"><b>to [${to2}]</b></span>`;
-							} else {
-								msg += ` <span style="color:${data[6]}">to [${to2}]</span>`;
-							}
-						}else if(data[2]==3)
-						{
-							if (this.trim(data[3].toLowerCase()) == top.c.login.toLowerCase()) {
-								forYou++;
-							}
-							if (data[3] != '') {
-								if (data[4] == 'klan' && data[2] == 3) {
-									msg += ' <span class="klan"><span style="cursor:pointer" onclick="chat.multiaddto(\'klan\',\'private\');">private [klan]</span></span>';
-								} else if (data[4] == 'paladins' && data[2] == 3) {
-									msg += ' <span class="klan"><span style="cursor:pointer" onclick="chat.multiaddto(\'paladins\',\'private\');">private [paladins]</span></span>';
-								} else if (data[4] == 'tarmans' && data[2] == 3) {
-									msg += ' <span class="klan"><span style="cursor:pointer" onclick="chat.multiaddto(\'tarmans\',\'private\');">private [tarmans]</span></span>';
-								} else {
-									msg += ` <span class="private"><span style="cursor:pointer" onclick="chat.multiaddto(\'${to2}\',\'private\');">private [ </span>${to}<span style="cursor:pointer" onclick="chat.multiAddto(\'${to2}\',\'private\');"> ]</span></span>`;
+								vl = this.trim(arr[i]);
+								if (vl.toLowerCase() == top.c.login.toLowerCase()) {
+									forYou++;
 								}
-							}
-						}						
-					}
-					msg += ' ';
-				} 
-				
-				data[5] = this.replaceAll(data[5],"[s1;]",'"');
-				data[5] = this.replaceAll(data[5],"[s2;]",'\'');
-				data[5] = this.replaceAll(data[5],"[s3;]",'<');
-				data[5] = this.replaceAll(data[5],"[s4;]",'>');
-				
-				
-				if ($.cookie('chatCfg2') != 0) {
-					data[5] = chat.testSmile(data[5]);
-				}
-				
-				if (data[6] != 'Black' && data[6] != '') {
-					msg += `<font color="${data[6]}">${data[5]}</font>`;
-				} else msg += data[5];
-				
-				if(data[2] == 21) {						
-					//e text
-					var text = `[loginfrom] ${data[5]}`;
-					var ftps = `<i><a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'${data[3]}\',event,\'chat\'); return false;" onClick="chat.addto(\'${data[3]}\',\'to\')">${data[3]}</a></i>`;
-					var mblogin = new RegExp("\\[login:(.*?)\\]","");
-					text = text.replace('[loginfrom]',ftps);
-					if(text.match(mblogin)!=null)
-					{
-						mblogin = text.match(mblogin)[1];
-						text = text.replace(`[login:${mblogin}]`,`<i><a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'${mblogin}\',event,\'chat\'); return false;" onClick="chat.addto(\'${mblogin}\',\'to\')">${mblogin}</a></i>`);
-					}
-					msg = `<i>${text}</i>`;			
-				}
-				if(data[1]>0)
-				{
-					var td = new Date((parseInt(data[1]))*1000);
-					td = [td,null,null,null];
-					td[1] = td[0].getHours();
-					td[2] = td[0].getMinutes();
-					td[3] = td[0].getSeconds(); 
-					td[4] = td[0].getDay(); 
-					td[5] = td[0].getMonth();
-					td[6] = td[0].getYear();
-					var j = 1;
-					while (j < 6) {
-						if (td[j] < 10) td[j] = `0${td[j]}`;
-						j++;
-					}
-					
-					var cls = forYou > 0 ? 'date2' : 'date'
-					if (data[11] > 0) {
-						msg = `<font style="cursor:help" color="red" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'����������� ������� �� ��������� ������ �������<br>��������� ����������� �������� ��������� ����� � ���������� ����.\',event,3,1,1,3,\'\')"> <b>!</b> </font>${msg}`;
-					}
-					if (data[10] > 0) {
-						msg = `<font style="cursor:help" color="green" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'��� ���������� ���������, ��� ����� ���� ���������� �� ����� �������<br>��������� ����������� �������� ��������� ����� � ���������� ����.\',event,3,1,1,3,\'\')"> <b>G</b> </font>${msg}`;
-					}
-					var msg22  = '<span ';
-					if(top.c.admin > 0) {
-						msg22 += `oncontextmenu="chat.deleteMessage(${data[0]});
-						return false;" `;
+								if (vl.toLowerCase() == top.c.login.toLowerCase()) {
+									vl = this.trim(data[3]);
+								}
+								if (i > 0) {
+									to += ', ';
+									to2 += ', ';
+								}
+								if (data[3] != '') {
+									to += `<span style="cursor:pointer" onclick="chat.addto(\'${vl}\',\'private\');" oncontextmenu="top.infoMenu(\'${this.trim(arr[i])}\',event,\'chat\'); return false;">${this.trim(arr[i])}</span>`;
+
+									if (this.trim(arr[i].toLowerCase()) != top.c.login.toLowerCase()) {
+										to2 += this.trim(arr[i]);
+									} else {
+										if (data[2] == 2) to2 += this.trim(arr[i]);
+										else to2 += this.trim(vl);
+									}
+								}
+							} else i = -2;
+							i++;
+						}
 					}
 
-					// �����������!!!
-					if( data[8] == 2 ) {
-						if( data[14] == undefined ) {
-							data[14] = '--:--';
+					if(data[2] == 6 || data[2] == 8) {
+						var zmlogin = new RegExp("\\[login:(.*?)\\]","");
+						var reflcd = new RegExp("\\[reflesh_main_zv_priem:(.*?)\\]","");
+						if (data[5].match(zmlogin) != null) {
+							zmlogin = data[5].match(zmlogin)[1];
+							data[5] = data[5].replace(`[login:${zmlogin}]`, `<a onMouseDown="top.loginGo(\'${zmlogin}\',event);" oncontextmenu="top.infoMenu(\'${zmlogin}\',event,\'chat\'); return false;" title="${zmlogin}" style="cursor:pointer;" onClick="chat.multiAddto(\'${zmlogin}\',\'to\');">${zmlogin}</a>`);
 						}
-						if( data[14] == '--:--' && data[1] > 0 ) {
-							data[14] = data[1];
-							var date14 = new Date(data[14]*1000);
-							data[14] = `${date14.getHours()}:${date14.getMinutes()}`;
+						if (data[5].match(reflcd) != null) {
+							reflcd = data[5].match(reflcd)[1];
+							data[5] = data[5].replace(`[reflesh_main_zv_priem:${reflcd}]`, '');
+						}
+					}
+
+					//�������� ������ ���� ���������� ���������
+					if (data[2] == 6) {
+						//������ ��������, ��������
+						msg += ' <span style="color:red">��������!</span> ';
+					} else if (data[2] == 2)
+					{
+						if (forYou > 0) {
+							msg += ` <span style="color:${data[6]}"><b>to [${to2}]</b></span>`;
+						} else {
+							msg += ` <span style="color:${data[6]}">to [${to2}]</span>`;
+						}
+					}else if(data[2]==3)
+					{
+						if (this.trim(data[3].toLowerCase()) == top.c.login.toLowerCase()) {
+							forYou++;
+						}
+						if (data[3] != '') {
+							if (data[4] == 'klan' && data[2] == 3) {
+								msg += ' <span class="klan"><span style="cursor:pointer" onclick="chat.multiaddto(\'klan\',\'private\');">private [klan]</span></span>';
+							} else if (data[4] == 'paladins' && data[2] == 3) {
+								msg += ' <span class="klan"><span style="cursor:pointer" onclick="chat.multiaddto(\'paladins\',\'private\');">private [paladins]</span></span>';
+							} else if (data[4] == 'tarmans' && data[2] == 3) {
+								msg += ' <span class="klan"><span style="cursor:pointer" onclick="chat.multiaddto(\'tarmans\',\'private\');">private [tarmans]</span></span>';
+							} else {
+								msg += ` <span class="private"><span style="cursor:pointer" onclick="chat.multiaddto(\'${to2}\',\'private\');">private [ </span>${to}<span style="cursor:pointer" onclick="chat.multiAddto(\'${to2}\',\'private\');"> ]</span></span>`;
+							}
 						}
-						msg22 += `class="${cls}">${data[14]}</span> `;
-					}else{
-						if( data[13] == undefined ) {
-							data[13] = '--:--';
-						}
-						if( data[13] == '--:--' && data[1] > 0 ) {
-							data[13] = data[1];
-							var date13 = new Date(data[13]*1000);
-							data[13] = `${date13.getHours()}:${date13.getMinutes()}`;
-						}
-						msg22 += `class="${cls}">${data[13]}</span> `;
 					}
-					msg = msg22+msg;
 				}
-				this.msgcount++;
-				
+				msg += ' ';
+			}
+
+			data[5] = this.replaceAll(data[5],"[s1;]",'"');
+			data[5] = this.replaceAll(data[5],"[s2;]",'\'');
+			data[5] = this.replaceAll(data[5],"[s3;]",'<');
+			data[5] = this.replaceAll(data[5],"[s4;]",'>');
+
+
+			if ($.cookie('chatCfg2') != 0) {
+				data[5] = chat.testSmile(data[5]);
+			}
+
+			if (data[6] != 'Black' && data[6] != '') {
+				msg += `<font color="${data[6]}">${data[5]}</font>`;
+			} else msg += data[5];
+
+			if(data[2] == 21) {
+				//e text
+				var text = `[loginfrom] ${data[5]}`;
+				var ftps = `<i><a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'${data[3]}\',event,\'chat\'); return false;" onClick="chat.addto(\'${data[3]}\',\'to\')">${data[3]}</a></i>`;
+				var mblogin = new RegExp("\\[login:(.*?)\\]","");
+				text = text.replace('[loginfrom]',ftps);
+				if(text.match(mblogin)!=null)
+				{
+					mblogin = text.match(mblogin)[1];
+					text = text.replace(`[login:${mblogin}]`,`<i><a href="javascript:void(0)" oncontextmenu="top.infoMenu(\'${mblogin}\',event,\'chat\'); return false;" onClick="chat.addto(\'${mblogin}\',\'to\')">${mblogin}</a></i>`);
+				}
+				msg = `<i>${text}</i>`;
+			}
+			if(data[1]>0)
+			{
+				var td = new Date((parseInt(data[1]))*1000);
+				td = [td,null,null,null];
+				td[1] = td[0].getHours();
+				td[2] = td[0].getMinutes();
+				td[3] = td[0].getSeconds();
+				td[4] = td[0].getDay();
+				td[5] = td[0].getMonth();
+				td[6] = td[0].getYear();
+				var j = 1;
+				while (j < 6) {
+					if (td[j] < 10) td[j] = `0${td[j]}`;
+					j++;
+				}
+
+				var cls = forYou > 0 ? 'date2' : 'date'
+				if (data[11] > 0) {
+					msg = `<font style="cursor:help" color="red" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'����������� ������� �� ��������� ������ �������<br>��������� ����������� �������� ��������� ����� � ���������� ����.\',event,3,1,1,3,\'\')"> <b>!</b> </font>${msg}`;
+				}
+				if (data[10] > 0) {
+					msg = `<font style="cursor:help" color="green" onmouseout="top.hic()" onmousedown="top.hic()" onmouseover="top.hi(this,\'��� ���������� ���������, ��� ����� ���� ���������� �� ����� �������<br>��������� ����������� �������� ��������� ����� � ���������� ����.\',event,3,1,1,3,\'\')"> <b>G</b> </font>${msg}`;
+				}
+				var msg22  = '<span ';
+				if(top.c.admin > 0) {
+					msg22 += `oncontextmenu="chat.deleteMessage(${data[0]});
+						return false;" `;
+				}
+
+				// �����������!!!
+				if( data[8] == 2 ) {
+					if( data[14] == undefined ) {
+						data[14] = '--:--';
+					}
+					if( data[14] == '--:--' && data[1] > 0 ) {
+						data[14] = data[1];
+						var date14 = new Date(data[14]*1000);
+						data[14] = `${date14.getHours()}:${date14.getMinutes()}`;
+					}
+					msg22 += `class="${cls}">${data[14]}</span> `;
+				}else{
+					if( data[13] == undefined ) {
+						data[13] = '--:--';
+					}
+					if( data[13] == '--:--' && data[1] > 0 ) {
+						data[13] = data[1];
+						var date13 = new Date(data[13]*1000);
+						data[13] = `${date13.getHours()}:${date13.getMinutes()}`;
+					}
+					msg22 += `class="${cls}">${data[13]}</span> `;
+				}
+				msg = msg22+msg;
+			}
+			this.msgcount++;
+
 			msg = `<span class="m0c1" id="msg_${data[0]}">${msg}<br></span>`;
-			
+
 			if (forYou > 0 && this.sound > 0 && this.trim(data[3].toLowerCase()) != top.c.login.toLowerCase()) {
 				this.sendSound(1);
 			}
-			
+
 			if(msg_see == 1)
 			{
 				if(this.trim(data[3].toLowerCase()) == top.c.login.toLowerCase() || forYou == 1 || this.filter == 0)
@@ -731,7 +731,7 @@ var chat = {
 						this.feerverk( data[15] );
 						this.feerverk( data[15] );
 					}
-					
+
 					if( top.des == 1 ) {
 						if( data[2] < 4 || global_type == 1 ) {
 							//������� ���
@@ -766,7 +766,7 @@ var chat = {
 					v = i;
 					i = -2;
 				}
-			} 
+			}
 			else i = -2;
 			i++;
 		}
@@ -838,7 +838,7 @@ var chat = {
 		var p1 = new RegExp("private\\s*\\[(.*?)\\]", "");
 		var t1 = new RegExp("to\\s*\\[(.*?)\\]", "");
 		var newstr = '';
-		
+
 		if (str.match(p1) != null) this.convert_work(p1)
 		else if (str.match(t1) != null) this.convert_work(t1)
 
@@ -847,24 +847,24 @@ var chat = {
 		newstr += str;
 		return newstr;
 	},
-    sendSound: function (s) {
+	sendSound: function (s) {
 		var svolm = 100;
 		if (this.sound == 0) svolm = 0
 		else if (this.sound == 1) svolm = 25;
-        else if (this.sound == 2) svolm = 100;
+		else if (this.sound == 2) svolm = 100;
 
-        var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
-        
-        if (isInternetExplorer && window.document["Sound"] && typeof window.document["Sound"].SetVariable !== "undefined") {
-            window.document["Sound"].SetVariable("Volume", svolm);
-            window.document["Sound"].SetVariable("Sndplay", s);
-		} 
+		var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
+
+		if (isInternetExplorer && window.document["Sound"] && typeof window.document["Sound"].SetVariable !== "undefined") {
+			window.document["Sound"].SetVariable("Volume", svolm);
+			window.document["Sound"].SetVariable("Sndplay", s);
+		}
 		else if(document.getElementById('Sound2') && typeof document.getElementById('Sound2').SetVariable !== "undefined") {
-            document.getElementById('Sound2').SetVariable("Volume", svolm);
-            document.getElementById('Sound2').SetVariable("Sndplay", s);
-        }
-        
-    },
+			document.getElementById('Sound2').SetVariable("Volume", svolm);
+			document.getElementById('Sound2').SetVariable("Sndplay", s);
+		}
+
+	},
 	getSwf:function(val) {
 		var M$ =  navigator.appName.indexOf("Microsoft")!=-1
 		return (M$ ? window : document)[val]
@@ -920,11 +920,11 @@ var chat = {
 		}
 		//���� ���� JS
 		if (data.js != '') eval(data.js);
-		if(data.rnd!=undefined) c.rnd = data.rnd; 
+		if(data.rnd!=undefined) c.rnd = data.rnd;
 		if (data.rn != undefined) {
 			if ($('#chcf10').attr('checked') == true) {
 				$('#roomName').html(`${data.rn}<br><small>����� ������: ${data.xu}</small>`);
-			} 
+			}
 			else $('#roomName').html(`${data.rn} (${data.xu})`);
 		}
 		if(data.key!=undefined)	this.key = data.key;
diff --git a/page/lib.php b/page/lib.php
index 1046c654..1f4872c9 100644
--- a/page/lib.php
+++ b/page/lib.php
@@ -91,7 +91,7 @@ if( !isset($url[2]) || $url[2] == '' ) {
 			}else{
 				
 				 if( isset($_FILES['filename']) ) {
-					 include('html/class.upload.php');
+					 require_once('html/class.upload.php');
 					 $handle = new upload($_FILES['filename']);
 					 $count = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `uid` = "'.$u->info['id'].'" AND `time` > '.(time()-60).' LIMIT 1'));
 					 if( $count > 3 && $u->info['admin'] == 0 ) {
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 @@
 <?php
+# Admin Only Area
 /*
 
 	���� ��� ��������� ������.
@@ -6,44 +7,62 @@
 
 */
 
-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/bot.logic.php');
+$u = User::start();
 
 
-if( $u->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('<script>window.close();</script>');
-			}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('<script>window.close();</script>');
-			}
-			echo '<form method="post" action="?pid='.$itm['id'].'"><b>����� �������: '.$itm['id'].'</b><br><textarea name="newdata" rows="20" cols="100">'.$itm['text'].'</textarea><br><input type="submit" value="���������"></form><div><a href="?pid='.((int)$_GET['pid']).'&delete=true">������� �������� �������</a></div>';
-		}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('<script>window.close();</script>');
-			}elseif(isset($_GET['delete']) && $_GET['delete'] == 'true') {
-				//������� ���� �������� �������
-				mysql_query('DELETE FROM `dungeon_dlg` WHERE `id` = "'.mysql_real_escape_string($itm['id']).'" LIMIT 1');
-				die('<script>window.close();</script>');
-			}
-			echo '<form method="post" action="?pid='.$itm['id'].'"><b>����� �������� ������: '.$itm['id'].'</b><br><textarea name="newdata" rows="3" cols="100">'.$itm['text'].'</textarea><br>��������:<textarea name="newdata2" rows="5" cols="100">'.$itm['action'].'</textarea><br>�������:<textarea name="newdata3" rows="5" cols="100">'.$itm['tr'].'</textarea><br>��������� ������: <input name="newdata4" type="text" value="'.$itm['sort'].'"><br><input type="submit" value="���������"></form><div><a href="?pid='.((int)$_GET['pid']).'&delete=true">������� ������� ������</a></div>';
-		}
-	}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('<script>window.close();</script>');
+        } 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('<script>window.close();</script>');
+        }
+        echo '<form method="post" action="?pid=' . $itm['id'] . '"><b>����� �������: ' . $itm['id'] . '</b><br><textarea name="newdata" rows="20" cols="100">' . $itm['text'] . '</textarea><br><input type="submit" value="���������"></form><div><a href="?pid=' . ((int)$_GET['pid']) . '&delete=true">������� �������� �������</a></div>';
+    } 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('<script>window.close();</script>');
+        } elseif (isset($_GET['delete']) && $_GET['delete'] == 'true') {
+            //������� ���� �������� �������
+            mysql_query(
+                'DELETE FROM `dungeon_dlg` WHERE `id` = "' . mysql_real_escape_string($itm['id']) . '" LIMIT 1'
+            );
+            die('<script>window.close();</script>');
+        }
+        echo '<form method="post" action="?pid=' . $itm['id'] . '"><b>����� �������� ������: ' . $itm['id'] . '</b><br><textarea name="newdata" rows="3" cols="100">' . $itm['text'] . '</textarea><br>��������:<textarea name="newdata2" rows="5" cols="100">' . $itm['action'] . '</textarea><br>�������:<textarea name="newdata3" rows="5" cols="100">' . $itm['tr'] . '</textarea><br>��������� ������: <input name="newdata4" type="text" value="' . $itm['sort'] . '"><br><input type="submit" value="���������"></form><div><a href="?pid=' . ((int)$_GET['pid']) . '&delete=true">������� ������� ������</a></div>';
+    }
+} else {
+    echo '������ �� ������.';
 }
-	
-?>
\ No newline at end of file
diff --git a/recaptchalib.php b/recaptchalib.php
index 7b7992c6..c79d0db5 100644
--- a/recaptchalib.php
+++ b/recaptchalib.php
@@ -1,129 +1,135 @@
-<?php

-/**

- * This is a PHP library that handles calling reCAPTCHA.

- *    - Documentation and latest version

- *          https://developers.google.com/recaptcha/docs/php

- *    - Get a reCAPTCHA API Key

- *          https://www.google.com/recaptcha/admin/create

- *    - Discussion group

- *          http://groups.google.com/group/recaptcha

- *

- * @copyright Copyright (c) 2014, Google Inc.

- * @link      http://www.google.com/recaptcha

- *

- * Permission is hereby granted, free of charge, to any person obtaining a copy

- * of this software and associated documentation files (the "Software"), to deal

- * in the Software without restriction, including without limitation the rights

- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell

- * copies of the Software, and to permit persons to whom the Software is

- * furnished to do so, subject to the following conditions:

- *

- * The above copyright notice and this permission notice shall be included in

- * all copies or substantial portions of the Software.

- *

- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE

- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,

- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN

- * THE SOFTWARE.

- */

-/**

- * A ReCaptchaResponse is returned from checkAnswer().

- */

-class ReCaptchaResponse

-{

-    public $success;

-    public $errorCodes;

-}

-class ReCaptcha

-{

-    private static $_signupUrl = "https://www.google.com/recaptcha/admin";

-    private static $_siteVerifyUrl =

-        "https://www.google.com/recaptcha/api/siteverify?";

-    private $_secret;

-    private static $_version = "php_1.0";

-    /**

-     * Constructor.

-     *

-     * @param string $secret shared secret between site and ReCAPTCHA server.

-     */

-    function ReCaptcha($secret)

-    {

-        if ($secret == null || $secret == "") {

-            die("To use reCAPTCHA you must get an API key from <a href='"

-                . self::$_signupUrl . "'>" . self::$_signupUrl . "</a>");

-        }

-        $this->_secret=$secret;

-    }

-    /**

-     * Encodes the given data into a query string format.

-     *

-     * @param array $data array of string elements to be encoded.

-     *

-     * @return string - encoded request.

-     */

-    private function _encodeQS($data)

-    {

-        $req = "";

-        foreach ($data as $key => $value) {

-            $req .= $key . '=' . urlencode(stripslashes($value)) . '&';

-        }

-        // Cut the last '&'

-        $req=substr($req, 0, strlen($req)-1);

-        return $req;

-    }

-    /**

-     * Submits an HTTP GET to a reCAPTCHA server.

-     *

-     * @param string $path url path to recaptcha server.

-     * @param array  $data array of parameters to be sent.

-     *

-     * @return array response

-     */

-    private function _submitHTTPGet($path, $data)

-    {

-        $req = $this->_encodeQS($data);

-        $response = file_get_contents($path . $req);

-        return $response;

-    }

-    /**

-     * Calls the reCAPTCHA siteverify API to verify whether the user passes

-     * CAPTCHA test.

-     *

-     * @param string $remoteIp   IP address of end user.

-     * @param string $response   response string from recaptcha verification.

-     *

-     * @return ReCaptchaResponse

-     */

-    public function verifyResponse($remoteIp, $response)

-    {

-        // Discard empty solution submissions

-        if ($response == null || strlen($response) == 0) {

-            $recaptchaResponse = new ReCaptchaResponse();

-            $recaptchaResponse->success = false;

-            $recaptchaResponse->errorCodes = 'missing-input';

-            return $recaptchaResponse;

-        }

-        $getResponse = $this->_submitHttpGet(

-            self::$_siteVerifyUrl,

-            array (

-                'secret' => $this->_secret,

-                'remoteip' => $remoteIp,

-                'v' => self::$_version,

-                'response' => $response

-            )

-        );

-        $answers = json_decode($getResponse, true);

-        $recaptchaResponse = new ReCaptchaResponse();

-        if (trim($answers ['success']) == true) {

-            $recaptchaResponse->success = true;

-        } else {

-            $recaptchaResponse->success = false;

-            $recaptchaResponse->errorCodes = $answers [error-codes];

-        }

-        return $recaptchaResponse;

-    }

-}

-?>
\ No newline at end of file
+<?php
+/**
+ * This is a PHP library that handles calling reCAPTCHA.
+ *    - Documentation and latest version
+ *          https://developers.google.com/recaptcha/docs/php
+ *    - Get a reCAPTCHA API Key
+ *          https://www.google.com/recaptcha/admin/create
+ *    - Discussion group
+ *          http://groups.google.com/group/recaptcha
+ *
+ * @copyright Copyright (c) 2014, Google Inc.
+ * @link      http://www.google.com/recaptcha
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/**
+ * A ReCaptchaResponse is returned from checkAnswer().
+ */
+class ReCaptchaResponse
+{
+    public $success;
+    public $errorCodes;
+}
+
+class ReCaptcha
+{
+    private static $_signupUrl = "https://www.google.com/recaptcha/admin";
+    private static $_siteVerifyUrl =
+        "https://www.google.com/recaptcha/api/siteverify?";
+    private $_secret;
+    private static $_version = "php_1.0";
+
+    /**
+     * Constructor.
+     *
+     * @param string $secret shared secret between site and ReCAPTCHA server.
+     */
+    function __construct($secret)
+    {
+        if ($secret == null || $secret == "") {
+            die(
+                "To use reCAPTCHA you must get an API key from <a href='"
+                . self::$_signupUrl . "'>" . self::$_signupUrl . "</a>"
+            );
+        }
+        $this->_secret = $secret;
+    }
+
+    /**
+     * Encodes the given data into a query string format.
+     *
+     * @param array $data array of string elements to be encoded.
+     *
+     * @return string - encoded request.
+     */
+    private function _encodeQS($data)
+    {
+        $req = "";
+        foreach ($data as $key => $value) {
+            $req .= $key . '=' . urlencode(stripslashes($value)) . '&';
+        }
+        // Cut the last '&'
+        $req = substr($req, 0, strlen($req) - 1);
+        return $req;
+    }
+
+    /**
+     * Submits an HTTP GET to a reCAPTCHA server.
+     *
+     * @param string $path url path to recaptcha server.
+     * @param array  $data array of parameters to be sent.
+     *
+     * @return array response
+     */
+    private function _submitHTTPGet($path, $data)
+    {
+        $req = $this->_encodeQS($data);
+        return file_get_contents($path . $req);
+    }
+
+    /**
+     * Calls the reCAPTCHA siteverify API to verify whether the user passes
+     * CAPTCHA test.
+     *
+     * @param string $remoteIp IP address of end user.
+     * @param string $response response string from recaptcha verification.
+     *
+     * @return ReCaptchaResponse
+     */
+    public function verifyResponse($remoteIp, $response)
+    {
+        // Discard empty solution submissions
+        if ($response == null || strlen($response) == 0) {
+            $recaptchaResponse = new ReCaptchaResponse();
+            $recaptchaResponse->success = false;
+            $recaptchaResponse->errorCodes = 'missing-input';
+            return $recaptchaResponse;
+        }
+        $getResponse = $this->_submitHttpGet(
+            self::$_siteVerifyUrl,
+            [
+                'secret' => $this->_secret,
+                'remoteip' => $remoteIp,
+                'v' => self::$_version,
+                'response' => $response,
+            ]
+        );
+        $answers = json_decode($getResponse, true);
+        $recaptchaResponse = new ReCaptchaResponse();
+        if (trim($answers ['success'])) {
+            $recaptchaResponse->success = true;
+        } else {
+            $recaptchaResponse->success = false;
+            $recaptchaResponse->errorCodes = $answers [error - codes];
+        }
+        return $recaptchaResponse;
+    }
+}
diff --git a/recovery.php b/recovery.php
index 136047d1..9a762817 100644
--- a/recovery.php
+++ b/recovery.php
@@ -1,106 +1,115 @@
 <?php
-
-define('GAME',true);
+# Admin Only Area
+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');
+$u = User::start();
 
-if(!isset($u->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 '�����: <b>'.$us['login'].'</b> ['.$us['level'].', ��:'.$st['upLevel'].']<br>���������� �� '.$_GET['exp'].' ����� (�������: '.$lvn['nextLevel'].' , ���: '.$lvn['upLevel'].').<hr>';
-	//
-	$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 '<br>����� ������: '.($lvn['nextLevel']-$us['level']).'<br>';
-	echo '<br>����� ������: '. $r[0];
-	echo '<br>����� ������: '. $r[1];
-	echo '<br>����� �������: '. $r[2];
-	echo '<br>����� ������������: '. $r[3];
-	echo '<br>����� ����: '. $r[4];
-	echo '<br>����� �����: '. $r[5];
-	echo '<br>';
-	//
-	echo '<hr>';
-	//
-	$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 '<hr><a href="/recovery.php?id='.$_GET['id'].'&exp='.$_GET['exp'].'&good">��������!</a>';
-	}
-	//
+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 '�����: <b>' . $us['login'] . '</b> [' . $us['level'] . ', ��:' . $st['upLevel'] . ']<br>���������� �� ' . $_GET['exp'] . ' ����� (�������: ' . $lvn['nextLevel'] . ' , ���: ' . $lvn['upLevel'] . ').<hr>';
+//
+$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 '<br>����� ������: ' . ($lvn['nextLevel'] - $us['level']) . '<br>';
+echo '<br>����� ������: ' . $r[0];
+echo '<br>����� ������: ' . $r[1];
+echo '<br>����� �������: ' . $r[2];
+echo '<br>����� ������������: ' . $r[3];
+echo '<br>����� ����: ' . $r[4];
+echo '<br>����� �����: ' . $r[5];
+echo '<br>';
+//
+echo '<hr>';
+//
+$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 '<hr><a href="/recovery.php?id=' . $_GET['id'] . '&exp=' . $_GET['exp'] . '&good">��������!</a>';
 }
-?>
\ 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 @@
 <?php
-define('GAME',true);
+const GAME = true;
 
 include('_incl_data/__config.php');
 include('_incl_data/class/__db_connect.php');
-include('_incl_data/class/__chat_class.php');
-include('_incl_data/class/__filter_class.php');
+$chat = new Chat();
+$r = new UserRegister();
+$filter = new Filter();
 
-if( isset($_POST['ajax_reg']) ) {	
-	include('_incl_data/class/__reg.php');
-	include('_incl_data/class/__user.php');
-	if( isset($u->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($i<count($nologin))
-					{
-						if(preg_match("/".$nologin[$i]."/i",$filter->mystr($reg_d[0])))
-						{
-							$error = '��������, ����������, ������ ���.<br>'; $_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 ��������.<br>'; $_POST['step'] = 1;
-					}
-					if(strlen($reg_d[0])<2) 
-					{ 
-						$error = '����� ������ ��������� �� ����� 2 ��������.<br>'; $_POST['step'] = 1;
-					}
-					//���� �������
-					$er = $r->en_ru($reg_d[0]);
-					if($er==true)
-					{
-						$error = '� ������ ��������� ������������ ������ ����� ������ �������� �������� ��� �����������. ������ ���������.<br>'; $_POST['step'] = 1;
-					}
-					//����������� �������
-					if(strpos($sr,$reg_d[0]))
-					{
-						$error = '����� �������� ����������� �������.<br>'; $_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].' ��� �����, �������� ������.<br>'; $_POST['step'] = 1;
-					}
-					//�����������
-					if(substr_count($reg_d[0],' ')+substr_count($reg_d[0],'-')+substr_count($reg_d[0],'_')>2)
-					{
-						$error = '�� ����� ���� ������������ ������������ (������, ����, ������ �������������).<br>'; $_POST['step'] = 1;
-					}
-					$reg_d[0] = trim($reg_d[0],' ');	
-					
-					//��������� ������
-					if(strlen($reg_d[1])<6 || strlen($reg_d[1])>30)
-					{
-						$error = '����� ������ �� ����� ���� ������ 6 �������� ��� ����� 30 ��������.<br>'; $_POST['step'] = 2;
-					}
-					if($reg_d[1]!=$reg_d[2])
-					{
-						$error = '� ������ ������ ����� ������ ������, ��� ��������. �� ������ ��� �� ��� ����� �������, ������ ������������.<br>'; $_POST['step'] = 2;
-					}
-					if(preg_match('/'.$reg_d[0].'/i',$reg_d[1]))
-					{
-						$error = '������ �������� �������� ������.<br>'; $_POST['step'] = 2;
-					}
-					if( $reg_d[1] != $reg_d[2] ) {
-						$error = '������ �� ���������.<br>'; $_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-��.<br>'; $_POST['step'] = 3;
-					}
-					
-					if(!preg_match('#^[a-z0-9.!\#$%&\'*+-/=?^_`{|}~]+@([0-9.]+|([^\s]+\.+[a-z]{2,6}))$#si', $reg_d[3]))
-					{
-						$error = '�� ������� ���� ��������� E-mail.<br>'; $_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 = '������ � ��������� ��� ��������.<br>'; $_POST['step'] = 4;
-					}
-					
-					if($reg_d[15]!=1 && $reg_d[15]!=2)
-					{
-						$error = '�� ������� �� ������ ���.<br>'; $_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 = '��������, ����������, ������ ���.<br>';
+                $_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 ��������.<br>';
+            $_POST['step'] = 1;
+        }
+        if (strlen($reg_d[0]) < 2) {
+            $error = '����� ������ ��������� �� ����� 2 ��������.<br>';
+            $_POST['step'] = 1;
+        }
+        //���� �������
+        $er = $r->en_ru($reg_d[0]);
+        if ($er) {
+            $error = '� ������ ��������� ������������ ������ ����� ������ �������� �������� ��� �����������. ������ ���������.<br>';
+            $_POST['step'] = 1;
+        }
+        //����������� �������
+        if (strpos($sr, $reg_d[0])) {
+            $error = '����� �������� ����������� �������.<br>';
+            $_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] . ' ��� �����, �������� ������.<br>';
+            $_POST['step'] = 1;
+        }
+        //�����������
+        if (substr_count($reg_d[0], ' ') + substr_count($reg_d[0], '-') + substr_count($reg_d[0], '_') > 2) {
+            $error = '�� ����� ���� ������������ ������������ (������, ����, ������ �������������).<br>';
+            $_POST['step'] = 1;
+        }
+        $reg_d[0] = trim($reg_d[0], ' ');
+
+        //��������� ������
+        if (strlen($reg_d[1]) < 6 || strlen($reg_d[1]) > 30) {
+            $error = '����� ������ �� ����� ���� ������ 6 �������� ��� ����� 30 ��������.<br>';
+            $_POST['step'] = 2;
+        }
+        if ($reg_d[1] != $reg_d[2]) {
+            $error = '� ������ ������ ����� ������ ������, ��� ��������. �� ������ ��� �� ��� ����� �������, ������ ������������.<br>';
+            $_POST['step'] = 2;
+        }
+        if (preg_match('/' . $reg_d[0] . '/i', $reg_d[1])) {
+            $error = '������ �������� �������� ������.<br>';
+            $_POST['step'] = 2;
+        }
+        if ($reg_d[1] != $reg_d[2]) {
+            $error = '������ �� ���������.<br>';
+            $_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-��.<br>';
+            $_POST['step'] = 3;
+        }
+
+        if (!preg_match('#^[a-z0-9.!\#$%&\'*+-/=?^_`{|}~]+@([0-9.]+|([^\s]+\.+[a-z]{2,6}))$#si', $reg_d[3])) {
+            $error = '�� ������� ���� ��������� E-mail.<br>';
+            $_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 = '������ � ��������� ��� ��������.<br>';
+            $_POST['step'] = 4;
+        }
+
+        if ($reg_d[15] != 1 && $reg_d[15] != 2) {
+            $error = '�� ������� �� ������ ���.<br>';
+            $_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 = '<b>'.$reg_d[0].'</b>, ���� � ��� �������� ����������� � ����������� ������, ��������� �� ��������� ������ - <a href=https://new-combats.com/library/noobguide/ target=_blank >www.new-combats.com/library/noobguide</a> ';
-			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 = '��� ������ �������� � ���� ���������. ���� ������ �������� ���� �� �������, ���������� ��� � ��������� ������. �������� ��������� � ��������� �����>> ������ ������, ������������ &quot;������ ��������&quot;, ������� ���� ���� +300 000 �����, 8�� �������, � �������� ����� �� ���������� � ������ ������ � ���� � ������� ���� �����������. ����� ����, ��� ����� ������ ������, �� ������������ ���� �������, � ����: �������� ��������� +15, ������� �������, � ������ ������ -����- , ������� �������� ������� ���� � ��� ������� �� 99% �� ���������, � ������ ���� �� ������ ������� ��������! ���� ��������, ����� ����������� ����� ����� ��������. �� ������������ ������ �������, �������� �� ��������: ������� ���������� ����� �� ����������� ������� (��������� <a href=https://events.new-combats.com/?paged=0&st=13 target=_blank >events.new-combats.com</a> ). �� ���� ������� ��������, �� ������ ������ ���������� ���������� ������ �����';
-			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 = '����������� ������ �������! �������!<br>����� 3 ���. �� ������ �������������� � ����!<script>setTimeout(\'top.location.href="/bk"\',2000);</script>';
-		}
-		
-		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 ������ ��������� ����������� ���������� �� ����, ��� ��� � ���. ���������� �����.<br>��� ����������� <b>'.$lr['login'].'</b> ��������� �� ������: <a href="/reg.php?enter">����������������</a>');
-		}else{
-			error('������� � ������ IP ��� ��������������� ��������. � ������ IP ������ ��������� ����������� ���������� �� ����, ��� ��� � ���. ���������� �����.<br>');
-		}
-	}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 = '<b>' . $reg_d[0] . '</b>, ���� � ��� �������� ����������� � ����������� ������, ��������� �� ��������� ������ - <a href=https://new-combats.com/library/noobguide/ target=_blank >www.new-combats.com/library/noobguide</a> ';
+            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 = '����������� ������ �������! �������!<br>����� 3 ���. �� ������ �������������� � ����!<script>setTimeout(\'top.location.href="/bk"\',2000);</script>';
+        }
+
+        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 ������ ��������� ����������� ���������� �� ����, ��� ��� � ���. ���������� �����.<br>��� ����������� <b>' . $lr['login'] . '</b> ��������� �� ������: <a href="/reg.php?enter">����������������</a>'
+            );
+        } else {
+            error(
+                '������� � ������ IP ��� ��������������� ��������. � ������ IP ������ ��������� ����������� ���������� �� ����, ��� ��� � ���. ���������� �����.<br>'
+            );
+        }
+    } 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('������� �� �����������!<br><script>function test(){ top.location.href="https://new-combats.com/bk"; } setTimeout("test()",1000);</script>');
-				*/
-			}
-			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..3bd06691 100644
--- a/register.php
+++ b/register.php
@@ -1,9 +1,12 @@
-<?
-define('GAME', true);
-include('_incl_data/__config.php');
-include('_incl_data/class/__db_connect.php');
-include('_incl_data/class/__chat_class.php');
-include('_incl_data/class/__filter_class.php');
+<?php
+
+use Insallah\Db;
+
+const GAME = true;
+require_once('_incl_data/__config.php');
+require_once('_incl_data/class/__db_connect.php');
+$chat = new Chat();
+$filter = new Filter();
 require_once '_incl_data/mails.php';
 
 function getIp()
@@ -11,7 +14,7 @@ function getIp()
     $keys = [
         'HTTP_CLIENT_IP',
         'HTTP_X_FORWARDED_FOR',
-        'REMOTE_ADDR'
+        'REMOTE_ADDR',
     ];
     foreach ($keys as $key) {
         if (!empty($_SERVER[$key])) {
@@ -44,7 +47,7 @@ function en_ru($txt)
 {
     $g = false;
     $en = preg_match("/^(([0-9a-zA-Z _-])+)$/i", $txt);
-    $ru = preg_match("/^(([0-9а-яА-Я _-])+)$/i", $txt);
+    $ru = preg_match("/^(([0-9�-��-� _-])+)$/i", $txt);
     if (($ru && $en) || (!$ru && !$en)) {
         $g = true;
     }
@@ -56,50 +59,67 @@ function hasGoodCode($code, $email)
     $q = 'select 1 from secure_code where `code` = %d and email = %s order by id desc limit 1';
     $check = mysql_fetch_row(mysql_query(sprintf($q, (int)$code, $email)));
     if ($check[0] !== 1) {
-        return 'Неверный код безопасности (Проверте пробелы и сам код в последнем емеиле)';
+        return '�������� ��� ������������ (�������� ������� � ��� ��� � ��������� ������)';
     }
     return 1;
 }
 
 function error_check($id, $str_u, $name = 0)
 {
-
     //***************************************************
     session_start();
     $error = '';
-    if ($id == 1 && !empty($str_u)) // Проверка логина
+    if ($id == 1 && !empty($str_u)) // �������� ������
     {
-        $nologin = [0 => 'ангел', 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 . '<br> Пример правильного никнейма: Петя Убиватор, Коля, xalop. <br> Пример неправильного никнейма: )))), kolя)=-/.';
+            $error = '����� ������ ��������� �� ����� 20 ��������.';
+            $error = $error . '<br> ������ ����������� ��������: ���� ��������, ����, xalop. <br> ������ ������������� ��������: )))), kol�)=-/.';
         }
         if (strlen($str_u) < 4) {
-            $error = 'Логин должен содержать не менее 4 символов.';
-            $error = $error . '<br> Пример правильного никнейма: Петя Убиватор, Коля, xalop. <br> Пример неправильного никнейма: )))), kolя)=-/.';
+            $error = '����� ������ ��������� �� ����� 4 ��������.';
+            $error = $error . '<br> ������ ����������� ��������: ���� ��������, ����, xalop. <br> ������ ������������� ��������: )))), kol�)=-/.';
         }
-        //Один алфавит
+        //���� �������
         $er = en_ru($str_u);
         if ($er) {
-            $error = 'В логине разрешено использовать только буквы одного алфавита русского или английского. Нельзя смешивать.';
-            $error = $error . '<br> Пример правильного никнейма: Петя Убиватор, Коля, xalop. <br> Пример неправильного никнейма: )))), kolя)=-/.';
+            $error = '� ������ ��������� ������������ ������ ����� ������ �������� �������� ��� �����������. ������ ���������.';
+            $error = $error . '<br> ������ ����������� ��������: ���� ��������, ����, xalop. <br> ������ ������������� ��������: )))), kol�)=-/.';
         }
-        //Разделители
+        //�����������
         if (substr_count($str_u, ' ') + substr_count($str_u, '-') + substr_count($str_u, '_') > 2) {
-            $error = 'Не более двух разделителей одновременно (пробел, тире, нижнее подчеркивание).';
-            $error = $error . '<br> Пример правильного никнейма: Петя Убиватор, Коля, xalop. <br> Пример неправильного никнейма: )))), kolя)=-/.';
+            $error = '�� ����� ���� ������������ ������������ (������, ����, ������ �������������).';
+            $error = $error . '<br> ������ ����������� ��������: ���� ��������, ����, xalop. <br> ������ ������������� ��������: )))), 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);
@@ -111,27 +131,27 @@ function error_check($id, $str_u, $name = 0)
             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'));
             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 = '<br>Возможно использовать только сервисы почты:<br>';
+            $tx = '<br>�������� ������������ ������ ������� �����:<br>';
             $sp = mysql_query('SELECT * FROM `trust_email`');
             while ($pl = mysql_fetch_array($sp)) {
                 $emailtest = $pl['email'];
@@ -142,12 +162,11 @@ 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.<br>';
+            $error = '�� ������� ���� ��������� E-mail.<br>';
         }
         if ($error != '') {
             $gd[4] = $error;
@@ -157,47 +176,47 @@ 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);
+        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'));
         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 . '<br>Пример правильного пароля: Parol228, Kotik111, Pswerd112.<br>Пример неправильного пароля: parol228, kotik.';
+            $error = '����� ������ �� ����� ���� ������ 8 �������� ��� ����� 30 ��������.';
+            $error = $error . '<br>������ ����������� ������: Parol228, Kotik111, Pswerd112.<br>������ ������������� ������: parol228, kotik.';
         }
         if ($str_u != $name) {
-            $error = 'В анкете пароль нужно ввести дважды, для проверки. Во второй раз вы его ввели неверно, будьте внимательнее.';
-            $error = $error . '<br>Пример правильного пароля: Parol228, Kotik111, Pswerd112.<br>Пример неправильного пароля: parol228, kotik.';
+            $error = '� ������ ������ ����� ������ ������, ��� ��������. �� ������ ��� �� ��� ����� �������, ������ ������������.';
+            $error = $error . '<br>������ ����������� ������: Parol228, Kotik111, Pswerd112.<br>������ ������������� ������: parol228, kotik.';
         }
-        if (!preg_match('/[a-zа-я]+/', $str_u)) {
-            $error = 'Пароль не содержит букв нижнего регитра а..я/a..z.';
-            $error = $error . '<br>Пример правильного пароля: Parol228, Kotik111, Pswerd112.<br>Пример неправильного пароля: parol228, kotik.';
-        } elseif (!preg_match('/[A-ZА-Я]+/', $str_u)) {
-            $error = 'Пароль не содержит букв верхнего регитра А..Я/A..Z .';
-            $error = $error . '<br>Пример правильного пароля: Parol228, Kotik111, Pswerd112.<br>Пример неправильного пароля: parol228, kotik.';
+        if (!preg_match('/[a-z�-�]+/', $str_u)) {
+            $error = '������ �� �������� ���� ������� ������� �..�/a..z.';
+            $error = $error . '<br>������ ����������� ������: Parol228, Kotik111, Pswerd112.<br>������ ������������� ������: parol228, kotik.';
+        } elseif (!preg_match('/[A-Z�-�]+/', $str_u)) {
+            $error = '������ �� �������� ���� �������� ������� �..�/A..Z .';
+            $error = $error . '<br>������ ����������� ������: Parol228, Kotik111, Pswerd112.<br>������ ������������� ������: parol228, kotik.';
         } else {
             if (!preg_match('/[0-9]+/', $str_u)) {
-                $error = 'Пароль не содержит цифр.';
-                $error = $error . '<br>Пример правильного пароля: Parol228, Kotik111, Pswerd112.<br>Пример неправильного пароля: parol228, kotik.';
+                $error = '������ �� �������� ����.';
+                $error = $error . '<br>������ ����������� ������: Parol228, Kotik111, Pswerd112.<br>������ ������������� ������: parol228, kotik.';
             }
         }
     }
 
 
     //***************************************************
-    return $error ? '<div class="visible_class"><h4>' . $error . '</h4></div>' : '';
+    return $error ?: '';
 }
 
 if ($_SERVER['HTTP_USER_AGENT'] != '' &&
@@ -209,29 +228,28 @@ if ($_SERVER['HTTP_USER_AGENT'] != '' &&
     <!DOCTYPE html>
     <head>
         <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"/>
-        <title>Регистрация - создай персонажа в игре Новый «Бойцовский клуб» </title>
+        <title>����������� - ������ ��������� � ���� ����� ����������� ���� </title>
         <meta name="description"
-              content="Пройдите простую регистрацию и станьте участником ? браузерной онлайн игры-легенды БК. Боец, мы ждем тебя в наших рядах, поэтому заводи аккаунт скорей. "/>
+              content="�������� ������� ����������� � ������� ���������� ? ���������� ������ ����-������� ��. ����, �� ���� ���� � ����� �����, ������� ������ ������� ������. "/>
     </head>
     <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"/>
 
     <style>
         body {
-            background: #000;
-            background-image: url(werhr.jpg); /* Путь к фоновому рисунку */
-            background-position: top, bottom, left, right;; /* Положение фона */
-            background-repeat: no-repeat; /* Отменяем повторение фона */
+            /* ���� � �������� ������� */
+            /* ��������� ���� */
+            /* �������� ���������� ���� */
+            background: #000 url(/werhr.jpg) no-repeat center center fixed;
 
         }
 
         .visible_class {
-            background-image: url(script.png); /* Путь к фоновому рисунку */
+            background-image: url(script.png); /* ���� � �������� ������� */
             background-size: 100% 100%;
-            margin: 0;
             position: absolute;
             top: 45%;
             left: 50%;
-            margin-right: -50%;
+            margin: 0 -50% 0 0;
             #min-width: 600px;
             min-height: 200px;
             transform: translate(-50%, -50%)
@@ -276,7 +294,7 @@ if ($_SERVER['HTTP_USER_AGENT'] != '' &&
         .visible_class h3 {
 
             text-align: center;
-            text-shadow: #000 0 0 10px; /* Свечение голубого цвета */
+            text-shadow: #000 0 0 10px; /* �������� �������� ����� */
             color: #FFF;
             margin-top: 20px;
             margin-left: 50px;
@@ -328,11 +346,10 @@ if ($_SERVER['HTTP_USER_AGENT'] != '' &&
         }
 
         .visible_class_s {
-            margin: 0;
             position: absolute;
             top: 80%;
             left: 50%;
-            margin-right: -50%;
+            margin: 0 -50% 0 0;
             transform: translate(-50%, -50%)
         }
 
@@ -352,7 +369,7 @@ if ($_SERVER['HTTP_USER_AGENT'] != '' &&
         .form_radio_btn label {
             display: inline-block;
             cursor: pointer;
-            padding: 0px 15px;
+            padding: 0 15px;
             line-height: 34px;
             border: 1px solid #EEE;
             color: #EEE;
@@ -419,13 +436,15 @@ if ($_SERVER['HTTP_USER_AGENT'] != '' &&
             left: 100%;
         }
     </style>
+	
     <form action="register.php" method="post">
 
-    <?
+
+    <?php
     if (isset($_GET['ref']) || isset($_POST['ref'])) {
         ?>
         <div class="invisible_class">
-            <p><input type="text" name="ref" value="<?
+            <p><input type="text" name="ref" value="<?php
                 if (isset($_GET['ref'])) {
                     print_r($_GET['ref']);
                 } else {
@@ -434,228 +453,246 @@ if ($_SERVER['HTTP_USER_AGENT'] != '' &&
 
                 ?>"/></p>
         </div>
-        <?
+        <?php
     }
     if (!isset ($_POST['nick_u'])) {
         ?>
         <div class="visible_class">
             <p>
-            <h3>Введите никнейм для Вашего персонажа </h3><input type="text" name="nick_u"
-                                                                 value="Введите ваш nickname"/></p>
+            <h3>������� ������� ��� ������ ��������� </h3>
+            <input type="text" name="nick_u" placeholder="������� ��� nickname"/></p>
         </div>
-        <?
+        <?php
     } elseif (isset ($_POST['nick_u']) && error_check(1, $_POST['nick_u']) != "") {
         ?>
         <div class="visible_class">
             <p>
-            <h3>Введите никнейм для Вашего персонажа </h3><input type="text" name="nick_u"
-                                                                 value="<? print_r($_POST['nick_u']); ?>"/></p>
-            <h4><? echo error_check(1, $_POST['nick_u']); ?></h4>
+            <h3>������� ������� ��� ������ ��������� </h3>
+            <input type="text" name="nick_u" value="<?php
+            print_r($_POST['nick_u']); ?>"/></p>
+            <h4><?php
+                echo error_check(1, $_POST['nick_u']); ?></h4>
         </div>
-        <?
+        <?php
     } else {
         ?>
         <div class="invisible_class">
-            <p> Имя вашего персонажа (login): <input type="text" name="nick_u"
-                                                     value="<? print_r($_POST['nick_u']); ?>"/></p>
+            <p> ��� ������ ��������� (login): <input type="text" name="nick_u" value="<?php
+                print_r($_POST['nick_u']); ?>"/></p>
         </div>
-        <?
+        <?php
     } ?>
-    <?
+    <?php
     if (empty($_POST['email_u']) && !empty($_POST['nick_u']) == true && error_check(1, $_POST['nick_u']) == "") {
         ?>
         <div class="visible_class">
             <p>
-            <h3>Введите ваш действующий и настоящий "Email" адрес </h3><input type="text" name="email_u"
-                                                                              value="Введите ваш email"/></p>
+            <h3>������� ��� ����������� � ��������� "Email" ����� </h3>
+            <input type="text" name="email_u" placeholder="������� ��� email"/></p>
             <p>
-            <h3>Внимание! Не используйте несуществующие "Email" адреса, а так же проверяйте то, какой эмеил вы вводите,
-                ибо перед стартом игры, вам необходимо будет подтвердить ваш эмеил адрес.</h3></p>
-            <p>
-            <h3>Ваш "Email" Адрес не будет использоваться нигде и служит исключительно для того, чтобы вы смогли
-                восстановить пароль от своего персонажа, а так же для получения новостной рассылки.</h3></p>
+            <h3>��������! ��������� ����� "����", ������, ������ � ����� ������������� ����� ������� ����.</h3></p>
         </div>
-        <?
+        <?php
     } elseif (isset ($_POST['email_u']) && error_check(2, $_POST['email_u']) != "") {
         ?>
         <div class="visible_class">
             <p>
-            <h3>Введите ваш действующий и настоящий "Email" адрес </h3><input type="text" name="email_u"
-                                                                              value="<? print_r($_POST['email_u']); ?>"/></p>
-            <h4><? echo error_check(2, $_POST['email_u']); ?></h4>
+            <h3>������� ��� ����������� � ��������� "Email" ����� </h3>
+            <input type="text" name="email_u" value="<?php
+            print_r($_POST['email_u']); ?>"/></p>
+            <h4><?php
+                echo error_check(2, $_POST['email_u']); ?></h4>
         </div>
-        <?
+        <?php
     } else {
         ?>
         <div class="invisible_class">
-            <p><input type="text" name="email_u" value="<? print_r($_POST['email_u']); ?>"/></p>
+            <p><input type="text" name="email_u" value="<?php
+                print_r($_POST['email_u']); ?>"/></p>
         </div>
 
-        <?
+        <?php
     } ?>
 
 
-    <?
+    <?php
     if (empty($_POST['secure_code']) && !empty($_POST['email_u']) && error_check(2, $_POST['email_u']) == "" && error_check(3, $_POST['email_u'], $_POST['nick_u']) == "") {
         ?>
         <div class="visible_class">
             <p>
-            <h3>Войдите на "Email": <? print_r($_POST['email_u']) ?> и проверьте почту, <br> вам пришло письмо с кодом
-                подтверждения, скопируйте его и вставьте сюда: </h3><input type="text" name="secure_code"
-                                                                           value="CODE"/></p>
+            <h3>������� �� "Email": <?php
+                print_r($_POST['email_u']) ?> � ��������� �����, <br> ��� ������ ������ � �����
+                �������������, ���������� ��� � �������� ����: </h3>
+            <input type="text" name="secure_code" placeholder="����������� ���"/></p>
         </div>
-        <?
+        <?php
     } elseif (isset ($_POST['secure_code']) && error_check(4, $_POST['secure_code'], $_POST['email_u']) != "") {
         ?>
         <div class="visible_class">
             <p>
-            <h3>Войдите на "Email": <? print_r($_POST['email_u']) ?> и проверьте почту, <br>вам пришло письмо с кодом
-                подтверждения, скопируйте его и вставьте сюда: </h3><input type="text" name="secure_code"
-                                                                           value="CODE"/></p>
-            <h4><? echo error_check(4, $_POST['secure_code'], $_POST['email_u']); ?></h4>
+            <h3>������� �� "Email": <?php
+                print_r($_POST['email_u']) ?> � ��������� �����, <br>��� ������ ������ � �����
+                �������������, ���������� ��� � �������� ����: </h3>
+            <input type="text" name="secure_code" value="����������� ���"/></p>
+            <h4><?php
+                echo error_check(4, $_POST['secure_code'], $_POST['email_u']); ?></h4>
         </div>
-        <?
+        <?php
     } else {
         ?>
         <div class="invisible_class">
-            <p><input type="text" name="secure_code" value="<? print_r($_POST['secure_code']); ?>"/></p>
+            <p><input type="text" name="secure_code" value="<?php
+                print_r($_POST['secure_code']); ?>"/></p>
         </div>
 
-        <?
+        <?php
     } ?>
 
-    <?
+    <?php
     if ((empty($_POST['pass1_u']) || empty($_POST['pass2_u'])) && !empty($_POST['secure_code']) && error_check(4, $_POST['secure_code'], $_POST['email_u']) == "") {
         ?>
         <div class="visible_class">
             <p>
-            <h3>Придумайте пароль для Вашего персонажа </h3><input type="password" name="pass1_u" value=""/></p>
+            <h3>���������� ������ ��� ������ ��������� </h3>
+            <input type="password" name="pass1_u" value=""/></p>
             <p>
-            <h3>Подтвердите придуманный пароль для Вашего персонажа </h3><input type="password" name="pass2_u"
-                                                                                value=""/></p><br>
+            <h3>����������� ����������� ������ ��� ������ ��������� </h3>
+            <input type="password" name="pass2_u" value=""/></p><br>
             <p>
-            <h3>Пароль должен состоять с букв верхнего и нижнего регистра, а так же, помимо букв, необходимо добавить и
-                цифры для надёжности.</h3></p>
+            <h3>������ ������ �������� � ���� �������� � ������� ��������, � ��� ��, ������ ����, ���������� �������� �
+                ����� ��� ���������.</h3></p>
         </div>
-        <?
+        <?php
     } elseif (!empty($_POST['pass1_u']) && !empty($_POST['secure_code']) && error_check(5, $_POST['pass1_u'], $_POST['pass2_u']) != "") {
         ?>
         <div class="visible_class">
             <p>
-            <h3>Придумайте пароль для Вашего персонажа </h3><input type="password" name="pass1_u"
-                                                                   value="<? print_r($_POST['pass1_u']); ?>"/></p>
+            <h3>���������� ������ ��� ������ ��������� </h3>
+            <input type="password" name="pass1_u" value="<?php
+            print_r($_POST['pass1_u']); ?>"/></p>
             <p>
-            <h3>Подтвердите придуманный пароль для Вашего персонажа </h3><input type="password" name="pass2_u"
-                                                                                value="<? print_r($_POST['pass2_u']); ?>"/></p>
+            <h3>����������� ����������� ������ ��� ������ ��������� </h3>
+            <input type="password" name="pass2_u" value="<?php
+            print_r($_POST['pass2_u']); ?>"/></p>
             <p>
-            <h3>Пароль должен состоять с букв верхнего и нижнего регистра, а так же, помимо букв, необходимо добавить и
-                цифры для надёжности.</h3></p>
-            <h4><? echo error_check(5, $_POST['pass1_u'], $_POST['pass2_u']); ?></h4><br>
+            <h3>������ ������ �������� � ���� �������� � ������� ��������, � ��� ��, ������ ����, ���������� �������� �
+                ����� ��� ���������.</h3></p>
+            <h4><?= error_check(5, $_POST['pass1_u'], $_POST['pass2_u']); ?></h4><br>
         </div>
-        <?
+        <?php
     } else {
         ?>
         <div class="invisible_class">
-            <p><input type="password" name="pass1_u" value="<? print_r($_POST['pass1_u']); ?>"/></p>
-            <p><input type="password" name="pass2_u" value="<? print_r($_POST['pass2_u']); ?>"/></p>
+            <p><input type="password" name="pass1_u" value="<?php
+                print_r($_POST['pass1_u']); ?>"/></p>
+            <p><input type="password" name="pass2_u" value="<?php
+                print_r($_POST['pass2_u']); ?>"/></p>
         </div>
-        <?
+        <?php
     } ?>
 
-    <?
+    <?php
     if (empty($_POST['pol_u']) && !empty($_POST['pass1_u']) && !empty($_POST['pass2_u']) && error_check(5, $_POST['pass1_u'], $_POST['pass2_u']) == "") {
         ?>
         <div class="visible_class">
             <p>
-            <h3>Выберите пол вашего персонажа:</h3>
+            <h3>�������� ��� ������ ���������:</h3>
             <select name="pol_u" size="2" multiple>
-                <option value="10">Мужской</option>
-                <option value="11">Женский</option>
+                <option value="10">�������</option>
+                <option value="11">�������</option>
             </select></p>
         </div>
-        <?
+        <?php
     } else {
         ?>
         <div class="invisible_class">
             <select name="pol_u" size="2" multiple>
-                <option selected value="<? print_r($_POST['pol_u']); ?>"></option>
-                <option value="<? print_r($_POST['pol_u']); ?>"></option>
+                <option selected value="<?php
+                print_r($_POST['pol_u']); ?>"></option>
+                <option value="<?php
+                print_r($_POST['pol_u']); ?>"></option>
             </select></p>
         </div>
-        <?
+        <?php
     } ?>
 
-    <?
+    <?php
     if (empty($_POST['bday_u']) && !empty($_POST['pol_u'])) {
         ?>
         <div class="visible_class">
-            <h3>Укажите дату вашего рождения:</h3>
+            <h3>������� ���� ������ ��������:</h3>
             <input type="date" id="start" name="bday_u" value="1980-01-01" max="2003-01-01">
         </div>
-        <?
+        <?php
     } else {
         ?>
         <div class="invisible_class">
-            <input type="date" id="start" name="bday_u" value="<? print_r($_POST['bday_u']); ?>">
+            <input type="date" id="start" name="bday_u" value="<?php
+            print_r($_POST['bday_u']); ?>">
         </div>
-        <?
+        <?php
     } ?>
 
-    <?
+    <?php
     if (empty($_POST['class_u']) && !empty($_POST['bday_u'])) {
         ?>
         <div class="visible_class">
             <p>
-            <h3>Выберите игровой класс для вашего персонажа:</h3></p>
+            <h3>�������� ������� ����� ��� ������ ���������:</h3></p>
             <p>
-            <h3>Внимание! Выбор игрового класса не влияет на игру в целом и нигде не фиксируется или же используется,
-                это необходимо для того, чтобы ваш персонаж получил нужные предметы в начале игры, а так же нужные
-                баффы.</h3></p>
+            <h3>��������! ����� �������� ������ �� ������ �� ���� � ����� � ����� �� ����������� ��� �� ������������,
+                ��� ���������� ��� ����, ����� ��� �������� ������� ������ �������� � ������ ����, � ��� �� ������
+                �����.</h3></p>
             <div style="margin-left: 23%;">
                 <div class="form_radio_btn">
                     <p><input name="class_u" type="radio" value="1" id="radio-1" checked> <label
-                                for="radio-1">Топорщик</label></p>
+                                for="radio-1">��������</label></p>
                 </div>
                 <div class="form_radio_btn">
-                    <p><input name="class_u" type="radio" value="2" id="radio-2"> <label for="radio-2">Уворотчик</label>
+                    <p><input name="class_u" type="radio" value="2" id="radio-2"> <label for="radio-2">���������</label>
                     </p>
                 </div>
                 <div class="form_radio_btn">
-                    <p><input name="class_u" type="radio" value="3" id="radio-3"> <label for="radio-3">Танк</label></p>
+                    <p><input name="class_u" type="radio" value="3" id="radio-3"> <label for="radio-3">����</label></p>
                 </div>
                 <div class="form_radio_btn">
-                    <p><input name="class_u" type="radio" value="4" id="radio-4"> <label for="radio-4">Критовик</label>
+                    <p><input name="class_u" type="radio" value="4" id="radio-4"> <label for="radio-4">��������</label>
                     </p>
                 </div>
                 <div class="form_radio_btn">
-                    <p><input name="class_u" type="radio" value="5" id="radio-5"> <label for="radio-5">Маг
-                            Воздуха</label></p>
+                    <p><input name="class_u" type="radio" value="5" id="radio-5"> <label for="radio-5">���
+                            �������</label></p>
                 </div>
                 <div class="form_radio_btn">
-                    <p><input name="class_u" type="radio" value="6" id="radio-6"> <label for="radio-6">Маг Огня</label>
+                    <p><input name="class_u" type="radio" value="6" id="radio-6"> <label for="radio-6">��� ����</label>
                     </p>
                 </div>
                 <div class="form_radio_btn">
-                    <p><input name="class_u" type="radio" value="7" id="radio-7"> <label for="radio-7">Маг Земли</label>
+                    <p><input name="class_u" type="radio" value="7" id="radio-7"> <label for="radio-7">��� �����</label>
                     </p>
                 </div>
                 <div class="form_radio_btn">
-                    <p><input name="class_u" type="radio" value="8" id="radio-8"> <label for="radio-8">Маг Воды</label>
+                    <p><input name="class_u" type="radio" value="8" id="radio-8"> <label for="radio-8">��� ����</label>
+                    </p>
+                </div>
+                <div class="form_radio_btn">
+                    <p><input name="class_u" type="radio" value="9" id="radio-9"> <label for="radio-9">�����������</label>
                     </p>
                 </div>
             </div>
             <p>
-            <h3>Внимание! Выбрав класс персонажа вы автоматически соглашаетесь с <a
-                        href='https://new-combats.com/encicl/law2.html'>правилами и законами</a> игрового мира </h3></p>
+            <h3>��������! ������ ����� ��������� �� ������������� ������������ � <a
+                        href='https://new-combats.com/encicl/law2.html'>��������� � ��������</a> �������� ���� </h3></p>
             <br>
         </div>
-        <?
+		
+        <?php
     }
     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');
-        //Создаем персонажа
+        $u = User::start();
+        //������� ���������
         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'])) {
@@ -665,570 +702,208 @@ if ($_SERVER['HTTP_USER_AGENT'] != '' &&
             }
             unset($ref);
         }
+
         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`
+		`activ`,`mail`,`bithday`,`sex`,`fnq`,`battle`,`design`,`molch2`,`level`, `hobby`, `clan_zv`
 		) VALUES (
 			"",
-			"0",
-			"1",
+			0,
+			1,
 			"' . mysql_real_escape_string($_POST['nick_u']) . '",
-			"' . mysql_real_escape_string(0 + (int)$_POST['ref']) . '",
+			"' . (int)$_POST['ref'] . '",
 			"' . mysql_real_escape_string(md5($_POST['pass1_u'])) . '",
-			"' . mysql_real_escape_string(getIp()) . '",
-			"' . mysql_real_escape_string(getIp()) . '",
+			"' . getIp() . '",
+			"' . getIp() . '",
 			"capitalcity",
 			"capitalcity",
-			"9",
+			9,
 			"' . time() . '",			
-			"0",
+			0,
 			"' . mysql_real_escape_string($_POST['email_u']) . '",
-			"' . mysql_real_escape_string(date('d.m.Y', strtotime($_POST['bday_u']))) . '",
+			"' . 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"
+			0,
+			0,
+			1,
+			"' . (time() + 86400) . '",
+			8,
+			"",
+			0
 		)');
 
         $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'] . '. Отправляемся драться в хаоты, если нет заявок, создайте бой, дополнительно купите зверя и не забывайте выходить на центральную площать убивать Трупожора своего уровня!Приятной игры. ';
+                //�������� ��������� �� $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 = 'Приветствую <b>' . $_POST['nick_u'] . '</b>. Отправляемся драться в хаоты, если нет заявок, создайте бой, дополнительно купите зверя и не забывайте выходить на центральную площать убивать Трупожора своего уровня!Приятной игры.';
+                //�� ���� ��� ������, ����� ����� ������ ����������� :)
+                $text = '����������� <b>' . $_POST['nick_u'] . '</b>.<b>� ��������� �� ������� ������, � ������� ���� ��������������!������������� ������� � ����� � �� ��������� ���� ���������� �������!';
                 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 = 'Приветствую <b>'.$_POST['nick_u'].'</b>. Крайне рекомендую прочесть мини гайд по ссылке 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)
+            //�����
+            if ($_POST['class_u'] == 1) {
+                //������ ������
+                $us = add_effn($uid, 1); // ����
+                $us = add_effn($uid, 20); // ����������
+                //�����
+                mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uid . "','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',-75,-9,100000)");
+                $re = $u->addItem(6433, $uid);
+                Db::sql('update items_users set `1price` = (select price_1 from items_shop where items_shop.item_id = ? and sid = 1) where id = ?', [6433, $re]);
+                //��������� ������
+                mysql_query('UPDATE `users` SET `money` = `money`200 WHERE `id` = "' . $uid . '" LIMIT 1');//������������ ����� 2244 - 2101
+                //������
+            } elseif ($_POST['class_u'] == 2) {
+                //������ ������ �������
+                $us = add_effn($uid, 8); // �����
+                $us = add_effn($uid, 20); // ����������
+                mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uid . "','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',-75,-9,100000)");
+                $re = $u->addItem(6431, $uid);
+                Db::sql('update items_users set `1price` = (select price_1 from items_shop where items_shop.item_id = ? and sid = 1) where id = ?', [6431, $re]);
+                //��������� ��������
+                mysql_query('UPDATE `users` SET `money` = `money`200 WHERE `id` = "' . $uid . '" LIMIT 1');//������������ ����� 2244 - 1972
+                //����
+            } elseif ($_POST['class_u'] == 3) {
+                //������ ������
+                $us = add_effn($uid, 1); // ����
+                $us = add_effn($uid, 20); // ����������
+                mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uid . "','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(6432, $uid);
+                Db::sql('update items_users set `1price` = (select price_1 from items_shop where items_shop.item_id = ? and sid = 1) where id = ?', [6432, $re]);
+                //��������� ��������
+                mysql_query('UPDATE `users` SET `money` = `money`200 WHERE `id` = "' . $uid . '" LIMIT 1');//������������ ����� 2244 - 2101
+                //����
+            } elseif ($_POST['class_u'] == 4)//����
             {
-                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, 7); // ����
+                $us = add_effn($uid, 20); // ����������
+                mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uid . "','s1=24|s2=15|s3=29|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(6430, $uid);
+                Db::sql('update items_users set `1price` = (select price_1 from items_shop where items_shop.item_id = ? and sid = 1) where id = ?', [6430, $re]);
+                //��������� ������ ��� ������
+                mysql_query('UPDATE `users` SET `money` = `money`200 WHERE `id` = "' . $uid . '" LIMIT 1');//������������ ����� 2244 - 1988
+                //������
+            } elseif ($_POST['class_u'] == 5)//������
             {
-                //кастим эфекты
-                $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); // Маг уселок
-
-
+                //������ ������
+                $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); // Маг уселок
-
+                $re = $u->addItem(6435, $uid);
+                Db::sql('update items_users set `1price` = (select price_1 from items_shop where items_shop.item_id = ? and sid = 1) where id = ?', [6435, $re]);
+                // ��������� ������
+                mysql_query('UPDATE `users` SET `money` = `money`200 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); // Маг уселок
-
+                $re = $u->addItem(6447, $uid);
+                Db::sql('update items_users set `1price` = (select price_1 from items_shop where items_shop.item_id = ? and sid = 1) where id = ?', [6447, $re]);
+                //��������� ��������
+                mysql_query('UPDATE `users` SET `money` = `money`200 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); // Маг уселок
+                $re = $u->addItem(6436, $uid);
+                Db::sql('update items_users set `1price` = (select price_1 from items_shop where items_shop.item_id = ? and sid = 1) where id = ?', [6436, $re]);
+                //��������� ��������
+                mysql_query('UPDATE `users` SET `money` = `money`200 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
+                $re = $u->addItem(6448, $uid);
+                Db::sql('update items_users set `1price` = (select price_1 from items_shop where items_shop.item_id = ? and sid = 1) where id = ?', [6448, $re]);
+                //��������� ������
+                mysql_query('UPDATE `users` SET `money` = `money`200 WHERE `id` = "' . $uid . '" LIMIT 1');//������������ ����� 2244 - 1988
+                //�����������
+            } elseif ($_POST['class_u'] == 9) {
+                //������ ������ �������
+                $us = add_effn($uid, 8); // �����
+                $us = add_effn($uid, 20); // ����������
+                mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uid . "','s1=15|s2=23|s3=30|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',-75,-9,100000)");
+                $re = $u->addItem(6530, $uid);
+                Db::sql('update items_users set `1price` = (select price_1 from items_shop where items_shop.item_id = ? and sid = 1) where id = ?', [6530, $re]);
+                //��������� ��������
+                mysql_query('UPDATE `users` SET `money` = `money`200 WHERE `id` = "' . $uid . '" LIMIT 1');//������������ ����� 2244 - 1972
             }
-
-            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);
+                $re = $u->addItem(4811, $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']) . '")');
+			(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` = "' . $uid . '" AND `ip`!="' . getIp() . '" ORDER BY `id` LIMIT 1'));
+            $ppl = mysql_query('SELECT * FROM `logs_auth` WHERE `ip`!="" AND (`ip` = "' . getIp() . '" OR `ip`="' . $ipm1['ip'] . '" OR `ip`="' . $_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("INSERT INTO `logs_auth` (`uid`,`ip`,`browser`,`type`,`time`,`depass`) VALUES ('" . $uid . "','" . getIp() . "','" . $_SERVER['HTTP_USER_AGENT'] . "','1','" . time() . "','')");
 
-            //Обновяем таблицы
-            mysql_query("UPDATE `users` SET `online`='" . time() . "',`ip` = '" . mysql_real_escape_string(getIp()) . "' WHERE `uid` = '" . $uid . "' LIMIT 1");
+            //�������� �������
+            mysql_query("UPDATE `users` SET `online`='" . time() . "',`ip` = '" . 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.');
+            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') ||
+                !setcookie('registrationModal', 'true', (time() + 60 * 60 * 24 * 7), '', 'new-combats.com')
+            ) {
+                die('������ ���������� cookie.');
             } else {
-
-                die('Спасибо за регистрацию в игровом мире Бойцовского Клуба, желаем вам побед и долгой игры.
-В случае вопросов по игре, Вам будет доступен общий чат!<br><script>function test(){ top.location.href="https://new-combats.com/bk"; } setTimeout("test()",100);</script>');
-
+                Db::sql('insert into users_learning_status (uid) values (?)', [$uid]);
+                die('������� �� ����������� � ������� ���� ����������� �����, ������ ��� ����� � ������ ����.
+� ������ �������� �� ����, ��� ����� �������� ����� ���!<br><script>function test(){ top.location.href="https://new-combats.com/bk"; } setTimeout("test()",100);</script>');
             }
-
-            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 {
         ?>
-        <div class="visible_class_s">
-            <p><input class="box" type="submit"/></p>
-        </div>
+        <div class="visible_class_s"><p><input class="box" type="submit"></p></div>
         </form>
-
-        <?
+		
+        <?php
     }
-}
\ No newline at end of file
+}
diff --git a/repass.php b/repass.php
index 24db37a3..96046158 100644
--- a/repass.php
+++ b/repass.php
@@ -7,26 +7,13 @@ if (isset($_GET['login'])) {
     $_POST['relogin'] = $_GET['login'];
 }
 
-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());
-
 if (isset($_POST['relogin'])) {
     $_POST['relogin'] = htmlspecialchars($_POST['relogin'], null, 'cp1251');
 
-    include('_incl_data/__config.php');
     define('GAME', true);
-    include('_incl_data/class/__db_connect.php');
+    require_once('_incl_data/__config.php');
+    require_once('_incl_data/class/__db_connect.php');
+    define('IP', UserIp::get());
 
     $usr = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `login` = "' . mysql_real_escape_string($_POST['relogin']) . '" LIMIT 1'));
     if (isset($usr['id'])) {
@@ -34,12 +21,12 @@ if (isset($_POST['relogin'])) {
         if ($usr['admin'] == 0 && $usr['banned'] == 0) {
             $step = 2;
             if (isset($_POST['redate'])) {
-                //Третий шаг
+                //������ ���
                 $lst_psw = mysql_fetch_array(mysql_query('SELECT * FROM `repass` WHERE `uid` = "' . $usr['id'] . '" AND `time` > ' . (time() - 24 * 60 * 60) . ' AND `type` = "1" LIMIT 1'));
                 if (isset($lst_psw['id'])) {
-                    $error = 'Высылать пароль можно не более одного раза в сутки.';
+                    $error = '�������� ������ ����� �� ����� ������ ���� � �����.';
                 } elseif (str_replace('0', '', $_POST['redate']) == str_replace('0', '', $usr['bithday']) && ($_POST['reanswer'] == $usr['q1'] || $usr['q1'] == '')) {
-                    $error = '<br><br><br>Пароль от персонажа &quot;' . $usr['login'] . '&quot; был успешно выслан на E-mail указанный при регистрации! <br><br><br>';
+                    $error = '<br><br><br>������ �� ��������� &quot;' . $usr['login'] . '&quot; ��� ������� ������ �� E-mail ��������� ��� �����������! <br><br><br>';
                     $re = mysql_fetch_array(mysql_query('SELECT * FROM `logs_auth` WHERE `uid` = "' . $usr['id'] . '" AND `type` = "0" AND `depass` != "" ORDER BY `id` DESC LIMIT 1'));
                     if ($u['securetime'] < $c['securetime']) {
                         unset($re);
@@ -48,14 +35,14 @@ if (isset($_POST['relogin'])) {
                         $sm = ['a', 'b', 'c', 'd', 'e', 'f', 'x', 'd', 'f', 'X', 'e', 'ER', 'XX', 'X'];
                         $re['depass'] = $sm[rand(0, 12)] . rand(0, 9) . $sm[rand(0, 12)] . rand(0, 9) . $sm[rand(0, 12)] . rand(0, 9) . $sm[rand(0, 12)] . rand(0, 9) . $sm[rand(0, 12)] . rand(0, 9);
                     }
-                    $title = 'Восстановление пароля от "' . $usr['login'] . '".';
-                    $txt = 'Добрый день.<br>';
-                    $txt .= 'С IP-адреса - <b>' . IP . '</b>, был запрошен пароль для вашего персонажа.<br>Если это не Вы, просто удалите это письмо.<br><br>';
-                    $txt .= 'Ваш логин: <b>' . $usr['login'] . '</b><br>';
-                    $txt .= 'Ваш пароль: ' . $re['depass'] . '<br><br>';
-                    $txt .= 'Отвечать на данное письмо не нужно.<br><br>';
-                    $txt .= 'С уважением,<br>';
-                    $txt .= 'Администрация Бойцовского Клуба';
+                    $title = '�������������� ������ �� "' . $usr['login'] . '".';
+                    $txt = '������ ����.<br>';
+                    $txt .= '� IP-������ - <b>' . IP . '</b>, ��� �������� ������ ��� ������ ���������.<br>���� ��� �� ��, ������ ������� ��� ������.<br><br>';
+                    $txt .= '��� �����: <b>' . $usr['login'] . '</b><br>';
+                    $txt .= '��� ������: ' . $re['depass'] . '<br><br>';
+                    $txt .= '�������� �� ������ ������ �� �����.<br><br>';
+                    $txt .= '� ���������,<br>';
+                    $txt .= '������������� ����������� �����';
 
                     $mail = mails($usr['mail'], $txt, $title);
                     if ($mail === 1) {
@@ -67,14 +54,14 @@ if (isset($_POST['relogin'])) {
                     }
                     unset($mail);
                 } else {
-                    $error = 'Неверный ответ на секретный вопрос или неверно указан день рождения.';
+                    $error = '�������� ����� �� ��������� ������ ��� ������� ������ ���� ��������.';
                 }
             }
         } else {
-            $error = 'Персонажу "' . $_POST['relogin'] . '" запрещена высылка пароля!';
+            $error = '��������� "' . $_POST['relogin'] . '" ��������� ������� ������!';
         }
     } else {
-        $error = 'Логин "' . htmlspecialchars($_POST['relogin'], null, 'cp1251') . '" не найден в базе.';
+        $error = '����� "' . htmlspecialchars($_POST['relogin'], null, 'cp1251') . '" �� ������ � ����.';
     }
 }
 
@@ -83,11 +70,11 @@ if (isset($_POST['relogin'])) {
 <html lang="ru-RU">
 <head>
     <meta charset="windows-1251"/>
-    <title>Восстановление пароля от персонажа Бойцовский Клуб</title>
+    <title>�������������� ������ �� ��������� ���������� ����</title>
     <meta name="keywords"
-          content="бойцовский клуб игра, бойцовский клуб играть, игра бойцовский клуб, старый бойцовский Клуб, бойцовский клуб онлайн игра, бойцовский клуб браузерная игра, играть в бойцовский клуб, игра бк, бк игра, старый бк, играть в бк, бк онлайн игра, новый бк, Легендарный Бойцовский Клуб, легендарный бк, combats, комбатс, combats ru, combats com, OldBK, oldbk ru, oldbk com, олдбк, old bk, олд бк, mycombats, rebk, recombats, oldcombats, obk2">
+          content="���������� ���� ����, ���������� ���� ������, ���� ���������� ����, ������ ���������� ����, ���������� ���� ������ ����, ���������� ���� ���������� ����, ������ � ���������� ����, ���� ��, �� ����, ������ ��, ������ � ��, �� ������ ����, ����� ��, ����������� ���������� ����, ����������� ��, combats, �������, combats ru, combats com, OldBK, oldbk ru, oldbk com, �����, old bk, ��� ��, mycombats, rebk, recombats, oldcombats, obk2">
     <meta name="description"
-          content="На этой страничке игроки могут восстановить свой игровой пароль в браузерной игре Новый Бойцовский Клуб"/>
+          content="�� ���� ��������� ������ ����� ������������ ���� ������� ������ � ���������� ���� ����� ���������� ����"/>
     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
     <link href="homepage/index.css" type="text/css" rel="stylesheet">
 </head>
@@ -121,7 +108,7 @@ if (isset($_POST['relogin'])) {
                 <tr>
                     </td>
                     <td height="150" align="center" valign="middle" class="menu">
-                        <p><b>Забыли пароль от своего персонажа?</b></p>
+                        <p><b>������ ������ �� ������ ���������?</b></p>
                         <p>&nbsp;<?
                             if ($error != '') {
                                 echo '<font color="red"><b>' . $error . '</b></font>';
@@ -132,18 +119,18 @@ if (isset($_POST['relogin'])) {
                             if ($step == 1) { ?>
                                 <table width="400" border="0" cellpadding="0" cellspacing="0">
                                     <tr>
-                                        <td>Укажите логин персонажа:</td>
-                                        <td><input onfocus="if ( 'Логин' == value ) { value = ''; } "
-                                                   onblur="if ( '' == value ) { value = 'Логин'; } " value="Логин"
+                                        <td>������� ����� ���������:</td>
+                                        <td><input onfocus="if ( '�����' == value ) { value = ''; } "
+                                                   onblur="if ( '' == value ) { value = '�����'; } " value="�����"
                                                    maxlength="40" style="padding:3px" name="relogin" type="text"
                                                    class="inup" id="relogin"></td>
                                     </tr>
                                 </table><br>
-                                <input type="submit" class="btn" value="Перейти к следующему шагу">
+                                <input type="submit" class="btn" value="������� � ���������� ����">
                             <? } elseif ($step == 2) { ?>
                                 <table width="400" border="0" cellpadding="0" cellspacing="0">
                                     <tr>
-                                        <td>Логин персонажа:</td>
+                                        <td>����� ���������:</td>
                                         <td>
                                             <input value="<?= $_POST['relogin'] ?>" disabled maxlength="40"
                                                    style="padding:3px" type="text" class="inup">
@@ -153,29 +140,29 @@ if (isset($_POST['relogin'])) {
                                     <?
                                     if ($usr['a1'] != '') { ?>
                                         <tr>
-                                            <td>Ваш вопрос:</td>
+                                            <td>��� ������:</td>
                                             <td>&nbsp;<b><?= $usr['a1'] ?></b></td>
                                         </tr>
                                         <tr>
-                                            <td>Ваш ответ:</td>
+                                            <td>��� �����:</td>
                                             <td><input value="<?= $_POST['reanswer'] ?>" name="reanswer" maxlength="30"
                                                        style="padding:3px" type="text" class="inup"></td>
                                         </tr>
                                     <? } ?>
                                     <tr>
-                                        <td>Ваш день рождения:</td>
+                                        <td>��� ���� ��������:</td>
                                         <td><input value="<?= $_POST['redate'] ?>" name="redate" maxlength="10"
                                                    style="padding:3px" type="text" class="inup"></td>
                                     </tr>
                                 </table>
-                                <small class="testro">(день рождения вы указывали при регистрации персонажа в формате
+                                <small class="testro">(���� �������� �� ��������� ��� ����������� ��������� � �������
                                     dd.mm.yyyy)</small>
                                 <br>
                                 <br>
                                 <br>
                                 <input type="button" onclick="top.location.href='https://new-combats.com/repass.php'"
-                                       class="btn" value="Вернуться">
-                                <input type="submit" class="btn" value="Выслать пароль на E-mail">
+                                       class="btn" value="���������">
+                                <input type="submit" class="btn" value="������� ������ �� E-mail">
                             <? } ?>
                         </form>
                         <br><br><br><br>
@@ -183,7 +170,7 @@ if (isset($_POST['relogin'])) {
                 </tr>
             </table>
             <div align="center" class="menu">
-                <a href="https://new-combats.com/">Вернутся на главную страницу</a>
+                <a href="https://new-combats.com/">�������� �� ������� ��������</a>
             </div>
         </td>
     </tr>
@@ -192,7 +179,7 @@ if (isset($_POST['relogin'])) {
     </tr>
     <tr>
         <td height="50" align="center"><span
-                    class="testro">&laquo;Старый Бойцовский Клуб&raquo; &nbsp; &nbsp; 2018-<?= date('Y') ?> &copy; Браузерная онлайн игра</span>
+                    class="testro">&laquo;������ ���������� ����&raquo; &nbsp; &nbsp; 2018-<?= date('Y') ?> &copy; ���������� ������ ����</span>
         </td>
     </tr>
 </table>
diff --git a/reting_clans.php b/reting_clans.php
index f3ce70e1..3bdf4cf6 100644
--- a/reting_clans.php
+++ b/reting_clans.php
@@ -1,7 +1,7 @@
 <?
 define('GAME',true);
-include('_incl_data/__config.php');
-include('_incl_data/class/__db_connect.php');
+require_once('_incl_data/__config.php');
+require_once('_incl_data/class/__db_connect.php');
 
 $url = explode('?', $_SERVER["REQUEST_URI"]);
 $url = explode('/', $url[0]);
diff --git a/reting_clans_cron.php b/reting_clans_cron.php
index 5e811db3..77ef5924 100644
--- a/reting_clans_cron.php
+++ b/reting_clans_cron.php
@@ -10,8 +10,8 @@ if(getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1') {
 	}
 }
 	define('GAME',true);
-	include('_incl_data/__config.php');
-	include('_incl_data/class/__db_connect.php');
+	require_once('_incl_data/__config.php');
+	require_once('_incl_data/class/__db_connect.php');
 
 	$add_exp_list = array();
 	$all_exp_list = array();
diff --git a/reting_pers.php b/reting_pers.php
index a6128a73..6252e78b 100644
--- a/reting_pers.php
+++ b/reting_pers.php
@@ -1,8 +1,8 @@
-<?
-define('GAME',true);
+<?php
+const GAME = true;
 include('_incl_data/__config.php');
 include('_incl_data/class/__db_connect.php');
-include('_incl_data/class/__user.php');
+$u = User::start();
 
 $url = explode('?', $_SERVER["REQUEST_URI"]);
 $url = explode('/', $url[0]);
@@ -29,11 +29,8 @@ A:hover, A:active {  color: red; text-decoration: none;}
 
 body {
 	background-color: #000000;
-	margin-left: 0px;
-	margin-top: 0px;
-	margin-right: 0px;
-	margin-bottom: 0px;
-	font-family: Tahoma, Arial, Helvetica, sans-serif;
+    margin: 0;
+    font-family: Tahoma, Arial, Helvetica, sans-serif;
 	font-size: 12pt;
 	color: #000000; }
 
@@ -42,7 +39,6 @@ body {
 	font-size: 9pt;
 	font-weight: bold;}
 td.text {
-/*background-image:url(https://new-combats.com/new/register/bgtext.jpg);*/
 background-position:right top;
 background-repeat:no-repeat;
 }
diff --git a/reting_pers_cron.php b/reting_pers_cron.php
index eefba15c..82d7d5ad 100644
--- a/reting_pers_cron.php
+++ b/reting_pers_cron.php
@@ -10,8 +10,8 @@ if(getIP() != $_SERVER['SERVER_ADDR'] && getIP() != '127.0.0.1') {
 	}
 }
 define('GAME',true);
-include('_incl_data/__config.php');
-include('_incl_data/class/__db_connect.php');
+require_once('_incl_data/__config.php');
+require_once('_incl_data/class/__db_connect.php');
 
 //if(isset($_GET['test'])) {
 	
diff --git a/ruin_characteristics.php b/ruin_characteristics.php
index d0b5f37b..6d2c64f8 100644
--- a/ruin_characteristics.php
+++ b/ruin_characteristics.php
@@ -1,214 +1,264 @@
 <?php
-function GetRealIp(){
-	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'];
-}
-
-define('IP',GetRealIp());
+const GAME = true;
 
 include('_incl_data/__config.php');
-define('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');
+define('IP', UserIp::get());
+$u = User::start();
+
 
 $free_stats = 125;
 
-if($u->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('��� ���������� ������������ ���������.<br>��������������� � ������� ��������.');
+if ($u->info['activ'] > 0) {
+    die('��� ���������� ������������ ���������.<br>��������������� � ������� ��������.');
 }
 
-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 = '������� &quot;'.$_POST['set_name'].'&quot; ��� ������� �����������!';
-		}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 = '������� &quot;' . $_POST['set_name'] . '&quot; ��� ������� �����������!';
+        } 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 = '������� &quot;'.$_POST['set_name'].'&quot; ��� ������.';
-		}
-	}
-}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 = '������� &quot;'.$set_x['name'].'&quot; ��� ���������� �� ���������.';
-	}
-}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 = '������� &quot;'.$set_x['name'].'&quot; ��� �����.';
-	}
+				"' . $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 = '������� &quot;' . $_POST['set_name'] . '&quot; ��� ������.';
+        }
+    }
+} 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 = '������� &quot;' . $set_x['name'] . '&quot; ��� ���������� �� ���������.';
+    }
+} 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 = '������� &quot;' . $set_x['name'] . '&quot; ��� �����.';
+    }
 }
 
 ?>
 <!doctype html>
 <html>
 <head>
-<meta charset="windows-1251">
-<title>������ ���������� ���� - ������� �������������</title>
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
-<script type="text/javascript" src="js/jquery.js"></script>
-<script>
-var free_stats = <?=$free_stats?>;
-function test_free() {
-	var i = 1;
-	var a = 0;
-	while( i <= 6 ) {
-		a += Number($('#s'+i).val());
-		i++;
-	}
-	$('#free_s').val( free_stats - a );
-	if( free_stats - a > 0 ) {
-		$('#result_ch').html('');
-	}else if( free_stats - a == 0 ) {
-		$('#result_ch').html('&nbsp;&nbsp;<font color="green"><b>������ ����� ���������</b></font>');
-	}else{
-		$('#result_ch').html('&nbsp;&nbsp;<font color="red"><b>������������ �������������!</b></font>');
-	}
-}
-</script>
+    <meta charset="windows-1251">
+    <title>������ ���������� ���� - ������� �������������</title>
+    <link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
+    <script type="text/javascript" src="js/jquery.js"></script>
+    <script>
+        var free_stats = <?=$free_stats?>;
+
+        function test_free() {
+            var i = 1;
+            var a = 0;
+            while (i <= 6) {
+                a += Number($('#s' + i).val());
+                i++;
+            }
+            $('#free_s').val(free_stats - a);
+            if (free_stats - a > 0) {
+                $('#result_ch').html('');
+            } else if (free_stats - a == 0) {
+                $('#result_ch').html('&nbsp;&nbsp;<font color="green"><b>������ ����� ���������</b></font>');
+            } else {
+                $('#result_ch').html('&nbsp;&nbsp;<font color="red"><b>������������ �������������!</b></font>');
+            }
+        }
+    </script>
 </head>
 
 <body>
 <h3>������� �������������</h3><br>
 <?
-if( $u->error != '' ) {
-	echo '<div><font color="red"><b>'.$u->error.'</b></font></div><br>';
+if ($u->error != '') {
+    echo '<div><font color="red"><b>' . $u->error . '</b></font></div><br>';
 }
 ?>
-����� �� ��������� ������� � �����? ��������� ���� �����  ���, ��� �� ������, � ���������� � �������! ��������� �� ��������� �������, ���������� ���. �� ������ ��������� �� �������� �������� � ������ ��  �� ������� �� �������!
+����� �� ��������� ������� � �����? ��������� ���� ����� ���, ��� �� ������, � ���������� � �������! ��������� ��
+��������� �������, ���������� ���. �� ������ ��������� �� �������� �������� � ������ �� �� ������� �� �������!
 <br><br>
 <table style="border:1px solid #000;" width="100%" border="0" cellspacing="0" cellpadding="5">
-  <tr>
-    <td style="border-right:1px solid #000;" bgcolor="#b5b5b5">��������</td>
-    <td style="border-right:1px solid #000;" bgcolor="#b5b5b5">�� ���������</td>
-    <td bgcolor="#b5b5b5">�������</td>
-  </tr>
-  <?
-  $j = 0;
-  $sp = mysql_query('SELECT * FROM `ruine_sets` WHERE `uid` = "'.$u->info['id'].'" ORDER BY `time` DESC');
-  while( $pl = mysql_fetch_array($sp) ) {
-  ?>
-  <tr>
-    <td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#d2d0d1"><?=$pl['name']?></td>
-    <td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#d2d0d1">
-	<? if( $pl['use'] == 0 ) { ?>
-    <a href="https://new-combats.com/ruin_characteristics.php?use=<?=$pl['id']?>">����������</a>
-    <? }else{ ?>
-    <b><font color="red">�� ���������</font></b>
-    <? } ?></td>
-    <td style="border-top:1px solid #000;" bgcolor="#d2d0d1"><a href="https://new-combats.com/ruin_characteristics.php?delete=<?=$pl['id']?>">�������</a></td>
-  </tr>
-  <? $j++; }  ?>
+    <tr>
+        <td style="border-right:1px solid #000;" bgcolor="#b5b5b5">��������</td>
+        <td style="border-right:1px solid #000;" bgcolor="#b5b5b5">�� ���������</td>
+        <td bgcolor="#b5b5b5">�������</td>
+    </tr>
+    <?
+    $j = 0;
+    $sp = mysql_query('SELECT * FROM `ruine_sets` WHERE `uid` = "' . $u->info['id'] . '" ORDER BY `time` DESC');
+    while ($pl = mysql_fetch_array($sp)) {
+        ?>
+        <tr>
+            <td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#d2d0d1"><?= $pl['name'] ?></td>
+            <td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#d2d0d1">
+                <?
+                if ($pl['use'] == 0) { ?>
+                    <a href="https://new-combats.com/ruin_characteristics.php?use=<?= $pl['id'] ?>">����������</a>
+                <?
+                } else { ?>
+                    <b><font color="red">�� ���������</font></b>
+                <?
+                } ?></td>
+            <td style="border-top:1px solid #000;" bgcolor="#d2d0d1"><a
+                        href="https://new-combats.com/ruin_characteristics.php?delete=<?= $pl['id'] ?>">�������</a></td>
+        </tr>
+        <?
+        $j++;
+    } ?>
 </table>
-<? 
-if( $j == 0 ) {
-	echo '<div style="padding:5px;border-left:1px solid #000;border-right:1px solid #000;border-bottom:1px solid #000;background-color:#d2d0d1;" align="center">��� ����������� ��������</div>'; 
+<?
+if ($j == 0) {
+    echo '<div style="padding:5px;border-left:1px solid #000;border-right:1px solid #000;border-bottom:1px solid #000;background-color:#d2d0d1;" align="center">��� ����������� ��������</div>';
 }
 ?>
 <br>
-<input type="button" value="��������" class="btnnew" onClick="location.href='https://new-combats.com/ruin_characteristics.php';">
+<input type="button" value="��������" class="btnnew"
+       onClick="location.href='https://new-combats.com/ruin_characteristics.php';">
 <br><br>
 <hr>
 <br>
 <form method="post" action="https://new-combats.com/ruin_characteristics.php">
-��������: <input name="set_name" type="text" value="" class="textnew" style="width:144px;"><br><br>
-<table style="border:1px solid #000;" width="100%" border="0" cellspacing="0" cellpadding="5">
-  <tr>
-    <td style="border-right:1px solid #000;" width="200" bgcolor="#B5B5B5">��������������</td>
-    <td bgcolor="#B5B5B5">��������</td>
-  </tr>
-  <tr>
-    <td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">����</td>
-    <td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input onKeyUp="test_free();" onKeyDown="test_free();" id="s1" name="s1" type="text" value="" class="textnew" style="width:44px;"></td>
-  </tr>
-  <tr>
-    <td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">��������</td>
-    <td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input onKeyUp="test_free();" onKeyDown="test_free();" id="s2" name="s2" type="text" value="" class="textnew" style="width:44px;"></td>
-  </tr>
-  <tr>
-    <td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">��������</td>
-    <td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input onKeyUp="test_free();" onKeyDown="test_free();" id="s3" name="s3" type="text" value="" class="textnew" style="width:44px;"></td>
-  </tr>
-  <tr>
-    <td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">������������</td>
-    <td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input onKeyUp="test_free();" onKeyDown="test_free();" id="s4" name="s4" type="text" value="" class="textnew" style="width:44px;"></td>
-  </tr> 
-  <tr>
-    <td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">���������</td>
-    <td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input onKeyUp="test_free();" onKeyDown="test_free();" id="s5" name="s5" type="text" value="" class="textnew" style="width:44px;"></td>
-  </tr>
-  <tr>
-    <td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">��������</td>
-    <td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input onKeyUp="test_free();" onKeyDown="test_free();" id="s6" name="s6" type="text" value="" class="textnew" style="width:44px;"></td>
-  </tr>
-  <tr>
-    <td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">��������� ������</td>
-    <td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input  id="free_s" disabled="disabled" type="text" value="<?=$free_stats?>" class="textnew" style="width:44px;"><span id="result_ch"></span></td>
-  </tr>
-</table>
-<br>
-<input type="submit" value="��������� / ��������" class="btnnew">
+    ��������: <input name="set_name" type="text" value="" class="textnew" style="width:144px;"><br><br>
+    <table style="border:1px solid #000;" width="100%" border="0" cellspacing="0" cellpadding="5">
+        <tr>
+            <td style="border-right:1px solid #000;" width="200" bgcolor="#B5B5B5">��������������</td>
+            <td bgcolor="#B5B5B5">��������</td>
+        </tr>
+        <tr>
+            <td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">����</td>
+            <td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input onKeyUp="test_free();"
+                                                                            onKeyDown="test_free();" id="s1" name="s1"
+                                                                            type="text" value="" class="textnew"
+                                                                            style="width:44px;"></td>
+        </tr>
+        <tr>
+            <td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">��������</td>
+            <td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input onKeyUp="test_free();"
+                                                                            onKeyDown="test_free();" id="s2" name="s2"
+                                                                            type="text" value="" class="textnew"
+                                                                            style="width:44px;"></td>
+        </tr>
+        <tr>
+            <td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">��������</td>
+            <td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input onKeyUp="test_free();"
+                                                                            onKeyDown="test_free();" id="s3" name="s3"
+                                                                            type="text" value="" class="textnew"
+                                                                            style="width:44px;"></td>
+        </tr>
+        <tr>
+            <td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">������������</td>
+            <td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input onKeyUp="test_free();"
+                                                                            onKeyDown="test_free();" id="s4" name="s4"
+                                                                            type="text" value="" class="textnew"
+                                                                            style="width:44px;"></td>
+        </tr>
+        <tr>
+            <td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">���������</td>
+            <td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input onKeyUp="test_free();"
+                                                                            onKeyDown="test_free();" id="s5" name="s5"
+                                                                            type="text" value="" class="textnew"
+                                                                            style="width:44px;"></td>
+        </tr>
+        <tr>
+            <td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">��������</td>
+            <td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input onKeyUp="test_free();"
+                                                                            onKeyDown="test_free();" id="s6" name="s6"
+                                                                            type="text" value="" class="textnew"
+                                                                            style="width:44px;"></td>
+        </tr>
+        <tr>
+            <td style="border-right:1px solid #000;border-top:1px solid #000;" bgcolor="#D2D0D1">��������� ������</td>
+            <td style="border-top:1px solid #000;" bgcolor="#D2D0D1"><input id="free_s" disabled="disabled" type="text"
+                                                                            value="<?= $free_stats ?>" class="textnew"
+                                                                            style="width:44px;"><span
+                        id="result_ch"></span></td>
+        </tr>
+    </table>
+    <br>
+    <input type="submit" value="��������� / ��������" class="btnnew">
 </form>
 <script>test_free();</script>
 </body>
diff --git a/ruins.php b/ruins.php
index a5006665..f7d26d38 100644
--- a/ruins.php
+++ b/ruins.php
@@ -1,8 +1,7 @@
-<?
-define('GAME',true);
+<?php
+const GAME = true;
 include('_incl_data/__config.php');
 include('_incl_data/class/__db_connect.php');
-include('_incl_data/class/__user.php');
 
 $url = explode('?',$_SERVER["REQUEST_URI"]);
 $url = explode('/',$url[0]);
@@ -21,13 +20,13 @@ $ru = mysql_fetch_array(mysql_query('SELECT * FROM `ruine_now` WHERE `id` = "'.m
 <link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
 <title>��� ���� ������� �����</title>
 </head>
-<body style="padding-top:0px; margin-top:7px; height:100%; background-color:#dedede;">
+<body style="padding-top:0; margin-top:7px; height:100%; background-color:#dedede;">
 <script type="text/javascript" src="js/jquery.js"></script>
 
 <center style="float:right"><a class="btnnew" href="https://new-combats.com/ruins/<?=$ru['id']?>">��������</a></center>
 
 <h3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#<?=$ru['id']?> ������� ������ � ������ �����</h3>
-<?
+<?php
 $html = ''; $i = 0;
 $sp = mysql_query('SELECT * FROM `ruine_logs` WHERE `tid` = "'.$ru['id'].'" ORDER BY `time` DESC');
 while( $pl = mysql_fetch_array($sp) ) {
@@ -45,21 +44,5 @@ echo $html; $html = '';
 <div align="right"><font style="color:#999;" size="1" face="verdana" color="black"><hr style="border-color:#CCC;">������ ���������� ���� &copy; <?=date('Y')?>, �www.new-combats.com�� &nbsp; &nbsp; </font></div>
 <br /><br />
 
-<div align="right"><div style="display:none"><!--LiveInternet counter--><script type="text/javascript"><!--
-        document.write("<a href='//www.liveinternet.ru/click' "+
-        "target=_blank><img style='display:inline-block; vertical-align:bottom;' src='//counter.yadro.ru/hit?t25.10;r"+
-        escape(document.referrer)+((typeof(screen)=="undefined")?"":
-        ";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?
-        screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+
-        ";"+Math.random()+
-        "' alt='' title='LiveInternet: �������� ����� ����������� ��"+
-        " �������' "+
-        "border='0' width='88' height='15'><\/a>")
-        //--></script><!--/LiveInternet-->
-        <!-- Rating@Mail.ru counter -->
-        <
-        <!-- //Rating@Mail.ru counter -->
-        <!-- Rating@Mail.ru logo -->
-        
-        <!-- //Rating@Mail.ru logo --></div></div></body>
+</body>
 </html>
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 = '<i>����������� ���� ������</i>';
-					}
-					
-					
-					mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','".$u->info['city']."','".$u->info['room']."','','','<small>[<b><font color=0066ff>������</font></b>] ����� <b>".mysql_real_escape_string($u->info['login'])."</b> ������ ������: ".(0+((int)$_GET['coin'])).".00 ���. �� ".$stvka.", ���� �".$gid['id']."</small>','".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($i<count($pos))
-			{
-				testCoin($gid['id'],$pos[$i]);
-				$i++;
-			}
-	
-	if($add==true)
-	{
-		//������� ����� ����
-		$gid2 = array('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 = 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($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'],'&quot;<font color=red>Casino.'.$u->info['city'].'</font>&quot;: ������� '.$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','������','','����� <b>".$pl['login']."</b> ������� <b>".$nmn.".00</b> ���.','".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 = '<i>����������� ���� ������</i>';
+                    }
+
+
+                    mysql_query(
+                        "INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $u->info['city'] . "','" . $u->info['room'] . "','','','<small>[<b><font color=0066ff>������</font></b>] ����� <b>" . mysql_real_escape_string(
+                            $u->info['login']
+                        ) . "</b> ������ ������: " . (0 + ((int)$_GET['coin'])) . ".00 ���. �� " . $stvka . ", ���� �" . $gid['id'] . "</small>','" . 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'],
+                            '&quot;<font color=red>Casino.' . $u->info['city'] . '</font>&quot;: ������� ' . $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','','','<small>[<b><font color=0066ff>������</font></b>] ����� <b>".mysql_real_escape_string($infu['login'])."</b> ������� <b>".$u_w[1][$u_w[0][$i]].".00</b> ����., ������: ".(0+$u_w[3][$u_w[0][$i]]).".00 ����., ���� �".$u_w[2][$i]."</small>','".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','','','<small>[<b><font color=0066ff>������</font></b>] ����� <b>" . mysql_real_escape_string(
+                        $infu['login']
+                    ) . "</b> ������� <b>" . $u_w[1][$u_w[0][$i]] . ".00</b> ����., ������: " . (0 + $u_w[3][$u_w[0][$i]]) . ".00 ����., ���� �" . $u_w[2][$i] . "</small>','" . 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 @@
 <?php
 
-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 ($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 = '<i>����������� ���� ������</i>';
-					}
-					
-					
-					mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','".$u->info['city']."','".$u->info['room']."','','','<small>[<b><font color=0066ff>������</font></b>] ����� <b>".mysql_real_escape_string($u->info['login'])."</b> ������ ������: ".(0+((int)$_GET['coin'])).".00 ��. �� ".$stvka.", ���� �".$gid['id']."</small>','".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($i<count($pos))
-			{
-				testCoin($gid['id'],$pos[$i]);
-				$i++;
-			}
-	
-	if($add==true)
-	{
-		//������� ����� ����
-		$gid2 = array('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 = 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($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'],'&quot;<font color=red>Casino.'.$u->info['city'].'</font>&quot;: ������� '.$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','������','','����� <b>".$pl['login']."</b> ������� <b>".$nmn.".00</b> ��.','".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 = '<i>����������� ���� ������</i>';
+                    }
+
+
+                    mysql_query(
+                        "INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $u->info['city'] . "','" . $u->info['room'] . "','','','<small>[<b><font color=0066ff>������</font></b>] ����� <b>" . mysql_real_escape_string(
+                            $u->info['login']
+                        ) . "</b> ������ ������: " . (0 + ((int)$_GET['coin'])) . ".00 ��. �� " . $stvka . ", ���� �" . $gid['id'] . "</small>','" . 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'],
+                            '&quot;<font color=red>Casino.' . $u->info['city'] . '</font>&quot;: ������� ' . $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','������','','����� <b>".$pl['login']."</b> ������� <b>".$nmn.".00</b> ��.','".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','','','<small>[<b><font color=0066ff>������</font></b>] ����� <b>".mysql_real_escape_string($infu['login'])."</b> ������� <b>".$u_w[1][$u_w[0][$i]].".00</b> ���., ������: ".(0+$u_w[3][$u_w[0][$i]]).".00 ���., ���� �".$u_w[2][$i]."</small>','".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','','','<small>[<b><font color=0066ff>������</font></b>] ����� <b>" . mysql_real_escape_string(
+                        $infu['login']
+                    ) . "</b> ������� <b>" . $u_w[1][$u_w[0][$i]] . ".00</b> ���., ������: " . (0 + $u_w[3][$u_w[0][$i]]) . ".00 ���., ���� �" . $u_w[2][$i] . "</small>','" . 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 @@
 <?php
-function GetRealIp(){
-	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'];
+function GetRealIp()
+{
+    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'];
 }
-function var_info($vars, $d = false){
+
+function var_info($vars, $d = false)
+{
     echo "<pre style='border: 1px solid gray;border-radius: 5px;padding: 3px 6px;background: #cecece;color: black;font-family: Arial;font-size: 12px;'>\n";
     var_dump($vars);
     echo "</pre>\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']).'���.<br>';
-				}
-			}
-			if(isset($i1['id']) || !isset($i3['id'])) {
-				//������� i2 �� ��������
-				echo '[������� '.$i2['id'].' � ��������]<br>';
-				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']) . '���.<br>';
+                }
+            }
+            if (isset($i1['id']) || !isset($i3['id'])) {
+                //������� i2 �� ��������
+                echo '[������� ' . $i2['id'] . ' � ��������]<br>';
+                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('����������� � ����, ������ �������.<br>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']];
 
 
 ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
 <html>
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
-<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
-<meta http-equiv=Cache-Control Content=no-cache>
-<meta http-equiv=PRAGMA content=NO-CACHE>
-<meta http-equiv=Expires Content=0>
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
-<link href="/sss_css.css" rel="stylesheet" type="text/css">
+    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"/>
+    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
+    <meta http-equiv=Cache-Control Content=no-cache>
+    <meta http-equiv=PRAGMA content=NO-CACHE>
+    <meta http-equiv=Expires Content=0>
+    <link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
+    <link href="/sss_css.css" rel="stylesheet" type="text/css">
 </head>
-<body style="padding-top:0px; margin-top:7px; background-color:#E2E0E0;"><script type="text/javascript" src="js/jquery.js"></script>
-<h3 style="font-size:25px;"><?=season::$yy[3]?> �����, <?=season::$date['Y']?></h3>
-<table width="912" border="0" align="center" cellpadding="0" cellspacing="0" class="sss_bg<?=season::$date['m']?>">
-  <tr>
-    <td style="min-height:450px;">
-    <!-- -->
-    <?
-	if( $rz == 1 ) {
-		//�������� �������
-		$html = '';
-		$sp = mysql_query('SELECT * FROM `sss_m` WHERE `s` = "'.mysql_real_escape_string(season::$date['m']).'"');
-		while( $pl = mysql_fetch_array($sp) ) {
-			if( $pl['dd'] > season::$date['d'] ) {
-				//������ ��� �������
-				$html .= '<div onClick="location.href=\'seasons.php?rz=2&mis='.$pl['id'].'\';"	 style="background-image:url(https://img.new-combats.com/ss_boss0.png);" class="sss_block_m">'.
-				'<div class="sss_block_m_in2" align="center"><small>���� ��������</small><br>'.$pl['dd'].'.'.season::$date['m'].'.'.season::$date['Y'].'</div>'.
-				'</div>';
-			}else{
-				//�������� ������
-				$html .= '<div onClick="location.href=\'seasons.php?rz=2&mis='.$pl['id'].'\';" style="background-image:url(https://img.new-combats.com/'.$pl['img'].');" class="sss_block_m">'.
-				'<div class="sss_block_m_in">����������!</div>'.
-				'</div>';
-			}
-		}
-		if( $html == '' ) {
-			$html = '��� ������ ��� �������� ������';	
-		}
-		echo '<div align="center">' . $html . '</div>';
-	}elseif( $rz == 2 ) {
-		//�������� ������
-		$html = '';
-		season::data( $_GET['mis'] );
-		if( !isset(season::$m['id']) ) {
-			$html = '������ ��� �������� ������ �� �������';	
-		}else{
-			if( season::$m['dd'] > season::$date['d'] ) {
-				//������ ��� �������
-				$html .= '<div onClick="location.href=\'seasons.php?rz=2&mis='.season::$m['id'].'\';" style="background-image:url(https://img.new-combats.com/ss_boss0.png);" class="sss_block_m">'.
-				'<div class="sss_block_m_in2" align="center"><small>���� ��������</small><br>'.season::$m['dd'].'.'.season::$date['m'].'.'.season::$date['Y'].'</div>'.
-				'</div>';
-			}else{
-				//�������� ������
-				$html .= '<div onClick="location.href=\'seasons.php?rz=2&mis='.season::$m['id'].'\';" style="float:left;background-image:url(https://img.new-combats.com/'.season::$m['img'].');" class="sss_block_m">'.
-				'<div class="sss_block_m_in3">&nbsp;<small>��������� �������:<br>0 / ??</small></div>'.
-				'</div>';
-				//������� � ������
-				$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 .= '<div style="float:right;padding-top:25px;"';
-					if( $nogo == true ) {
-						$html .= ' class="graysc"';
-					}
-					$html .= '>';
-					//
-					$html .= '<div align="left" class="sss_mis_div">';
-					$html .= '<img src="https://img.new-combats.com/ss_ico'.$pl['type'].'.png">';
-					$html .= '<div style="float:right;width:530px;color:#efefef;" align="left">';
-											
-					$html .= '<div style="width:500px;margin-top:10px;height:50px;"><small>' . $pl['info'] . '</small></div>';
-						
-					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 .= '<div class="sss_line1"><div style="width:'.round($qe/$pl['var']*300).'px;" class="sss_line2"></div></div>';
-						if( $qe == $pl['var'] ) {
-							$html .= ' <button onclick="location.href=\'seasons.php?rz=2&mis='.round((int)$_GET['mis']).'&endq='.$pl['id'].'\';" class="sss_btn1">���������</button>';
-						}
-						$html .= ' &nbsp; '.$qe.' / '.$pl['var'].'';
-					}
-					
-					if( $f == 1 ) {
-						$ends[$i] = true;
-						$html .= '<b style="color:#efefef"><img src="https://img.new-combats.com/i/ico/wins.gif"> ������� ���������.</b>';
-					}elseif( $nogo == true ) {
-						$html .= '<i style="color:#ffa5a5"><img src="https://img.new-combats.com/i/ico/draw.gif"> ������� ���������� ����������� �������.</i>';
-					}
-						
-					$html .= '</div>';
-					$html .= '</div>';
-					//
-					$html .= '</div>';
-					$i++;
-				}
-			}
-		}
-		echo '<div align="center">' . $html . '</div>';
-	}
-	?>
-    <!-- -->
-    </td>
-  </tr>
+<body style="padding-top:0px; margin-top:7px; background-color:#E2E0E0;">
+<script type="text/javascript" src="js/jquery.js"></script>
+<h3 style="font-size:25px;"><?= Season::$yy[3] ?> �����, <?= Season::$date['Y'] ?></h3>
+<table width="912" border="0" align="center" cellpadding="0" cellspacing="0" class="sss_bg<?= Season::$date['m'] ?>">
+    <tr>
+        <td style="min-height:450px;">
+            <!-- -->
+            <?
+            if ($rz == 1) {
+                //�������� �������
+                $html = '';
+                $sp = mysql_query(
+                    'SELECT * FROM `sss_m` WHERE `s` = "' . mysql_real_escape_string(Season::$date['m']) . '"'
+                );
+                while ($pl = mysql_fetch_array($sp)) {
+                    if ($pl['dd'] > Season::$date['d']) {
+                        //������ ��� �������
+                        $html .= '<div onClick="location.href=\'seasons.php?rz=2&mis=' . $pl['id'] . '\';"	 style="background-image:url(https://img.new-combats.com/ss_boss0.png);" class="sss_block_m">' .
+                            '<div class="sss_block_m_in2" align="center"><small>���� ��������</small><br>' . $pl['dd'] . '.' . Season::$date['m'] . '.' . Season::$date['Y'] . '</div>' .
+                            '</div>';
+                    } else {
+                        //�������� ������
+                        $html .= '<div onClick="location.href=\'seasons.php?rz=2&mis=' . $pl['id'] . '\';" style="background-image:url(https://img.new-combats.com/' . $pl['img'] . ');" class="sss_block_m">' .
+                            '<div class="sss_block_m_in">����������!</div>' .
+                            '</div>';
+                    }
+                }
+                if ($html == '') {
+                    $html = '��� ������ ��� �������� ������';
+                }
+                echo '<div align="center">' . $html . '</div>';
+            } elseif ($rz == 2) {
+                //�������� ������
+                $html = '';
+                Season::data($_GET['mis']);
+                if (!isset(Season::$m['id'])) {
+                    $html = '������ ��� �������� ������ �� �������';
+                } else {
+                    if (Season::$m['dd'] > Season::$date['d']) {
+                        //������ ��� �������
+                        $html .= '<div onClick="location.href=\'seasons.php?rz=2&mis=' . Season::$m['id'] . '\';" style="background-image:url(https://img.new-combats.com/ss_boss0.png);" class="sss_block_m">' .
+                            '<div class="sss_block_m_in2" align="center"><small>���� ��������</small><br>' . Season::$m['dd'] . '.' . Season::$date['m'] . '.' . Season::$date['Y'] . '</div>' .
+                            '</div>';
+                    } else {
+                        //�������� ������
+                        $html .= '<div onClick="location.href=\'seasons.php?rz=2&mis=' . Season::$m['id'] . '\';" style="float:left;background-image:url(https://img.new-combats.com/' . Season::$m['img'] . ');" class="sss_block_m">' .
+                            '<div class="sss_block_m_in3">&nbsp;<small>��������� �������:<br>0 / ??</small></div>' .
+                            '</div>';
+                        //������� � ������
+                        $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 .= '<div style="float:right;padding-top:25px;"';
+                            if ($nogo == true) {
+                                $html .= ' class="graysc"';
+                            }
+                            $html .= '>';
+                            //
+                            $html .= '<div align="left" class="sss_mis_div">';
+                            $html .= '<img src="https://img.new-combats.com/ss_ico' . $pl['type'] . '.png">';
+                            $html .= '<div style="float:right;width:530px;color:#efefef;" align="left">';
+
+                            $html .= '<div style="width:500px;margin-top:10px;height:50px;"><small>' . $pl['info'] . '</small></div>';
+
+                            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 .= '<div class="sss_line1"><div style="width:' . round(
+                                        $qe / $pl['var'] * 300
+                                    ) . 'px;" class="sss_line2"></div></div>';
+                                if ($qe == $pl['var']) {
+                                    $html .= ' <button onclick="location.href=\'seasons.php?rz=2&mis=' . round(
+                                            (int)$_GET['mis']
+                                        ) . '&endq=' . $pl['id'] . '\';" class="sss_btn1">���������</button>';
+                                }
+                                $html .= ' &nbsp; ' . $qe . ' / ' . $pl['var'] . '';
+                            }
+
+                            if ($f == 1) {
+                                $ends[$i] = true;
+                                $html .= '<b style="color:#efefef"><img src="https://img.new-combats.com/i/ico/wins.gif"> ������� ���������.</b>';
+                            } elseif ($nogo == true) {
+                                $html .= '<i style="color:#ffa5a5"><img src="https://img.new-combats.com/i/ico/draw.gif"> ������� ���������� ����������� �������.</i>';
+                            }
+
+                            $html .= '</div>';
+                            $html .= '</div>';
+                            //
+                            $html .= '</div>';
+                            $i++;
+                        }
+                    }
+                }
+                echo '<div align="center">' . $html . '</div>';
+            }
+            ?>
+            <!-- -->
+        </td>
+    </tr>
 </table>
 </body>
 </html>
diff --git a/settings.php b/settings.php
index f3ea2c39..f7bf275c 100644
--- a/settings.php
+++ b/settings.php
@@ -1,271 +1,376 @@
-<?
+<?php
 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');
+$u = User::start();
+$filter = new Filter();
 ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="https://www.w3.org/1999/xhtml">
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
-<title>���������� ���� - ���������</title>
-<link href="https://new-combats.com/i/move/design3.css" rel="stylesheet" type="text/css">
-<link rel=stylesheet type="text/css" href="https://new-combats.com/i/main.css">
-<META Http-Equiv=Cache-Control Content="no-cache, max-age=0, must-revalidate, no-store">
-<meta http-equiv=PRAGMA content=NO-CACHE>
-<META Http-Equiv=Expires Content=0>
-<!--<style type="text/css">
-img.pnged {
-behavior:	url(/pngbehavior.htc);
-}
-</style>-->
-<style type="text/css">
-.left{
-float:left;
-padding-right:30px;
-}
-<!--
-@import url(https://fonts.googleapis.com/css?family=Philosopher&subset=latin,cyrillic);
-body, td {  font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12pt; color: #000000 }
+    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"/>
+    <title>���������� ���� - ���������</title>
+    <link href="https://new-combats.com/i/move/design3.css" rel="stylesheet" type="text/css">
+    <link rel=stylesheet type="text/css" href="https://new-combats.com/i/main.css">
+    <META Http-Equiv=Cache-Control Content="no-cache, max-age=0, must-revalidate, no-store">
+    <meta http-equiv=PRAGMA content=NO-CACHE>
+    <META Http-Equiv=Expires Content=0>
 
-A {  font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12pt; color: #decdb9;}
-a:link { color: #decdb9; text-decoration: none}
-A:visited { color: #decdb9; text-decoration: none}
-A:hover, A:active {  color: #f3e9dd; text-decoration: none;}
+    <style type="text/css">
+        .left {
+            float: left;
+            padding-right: 30px;
+        }
 
-body {
-	background-color: #000000;
-	margin-left: 0px;
-	margin-top: 0px;
-	margin-right: 0px;
-	margin-bottom: 0px;
-	font-family: Tahoma, Arial, Helvetica, sans-serif;
-	font-size: 12pt;
-	color: #000000; }
+        <!--
+        @import url(https://fonts.googleapis.com/css?family=Philosopher&subset=latin,cyrillic);
+        body, td {
+            font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
+            font-size: 12pt;
+            color: #000000
+        }
 
-	.nicname {
-	color: #bfa178;
-	font-size: 9pt;
-	font-weight: bold;}
-td.text {
-/*background-image:url(https://new-combats.com/new/register/bgtext.jpg);*/
-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;}
+        A {
+            font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
+            font-size: 12pt;
+            color: #decdb9;
+        }
 
-	.levels {
-	color: #bfa178;
-	font-family: Tahoma, Arial, Helvetica, sans-serif;
-	font-size: 7pt; }
+        a:link {
+            color: #decdb9;
+            text-decoration: none
+        }
 
-	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;}
+        A:visited {
+            color: #decdb9;
+            text-decoration: none
+        }
 
-input { font-size: 12px;}
+        A:hover, A:active {
+            color: #f3e9dd;
+            text-decoration: none;
+        }
 
--->
-</style>
-<script src="https://new-combats.com/new/register/flash.js" type="text/javascript"></script>
-<script type="text/javascript">
-<!--
-function MM_preloadImages() { //v3.0
-  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
-    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
-    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
-}
-function MM_swapImgRestore() { //v3.0
-  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
-}
-function MM_findObj(n, d) { //v4.01
-  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
-    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
-  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
-  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
-  if(!x && d.getElementById) x=d.getElementById(n); return x;
-}
-function MM_swapImage() { //v3.0
-  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a</dngth-2);i+=3)
-   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
-}
-//-->
-</script>
+        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;
+        }
+
+        -->
+    </style>
+    <script src="https://new-combats.com/new/register/flash.js" type="text/javascript"></script>
+    <script type="text/javascript">
+        function MM_preloadImages() { //v3.0
+            var d = document;
+            if (d.images) {
+                if (!d.MM_p) d.MM_p = new Array();
+                var i, j = d.MM_p.length, a = MM_preloadImages.arguments;
+                for (i = 0; i < a.length; i++)
+                    if (a[i].indexOf("#") != 0) {
+                        d.MM_p[j] = new Image;
+                        d.MM_p[j++].src = a[i];
+                    }
+            }
+        }
+
+        function MM_swapImgRestore() { //v3.0
+            var i, x, a = document.MM_sr;
+            for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
+        }
+
+        function MM_findObj(n, d) { //v4.01
+            var p, i, x;
+            if (!d) d = document;
+            if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
+                d = parent.frames[n.substring(p + 1)].document;
+                n = n.substring(0, p);
+            }
+            if (!(x = d[n]) && d.all) x = d.all[n];
+            for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
+            for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
+            if (!x && d.getElementById) x = d.getElementById(n);
+            return x;
+        }
+
+        function MM_swapImage() { //v3.0
+            var i, j = 0, x, a = MM_swapImage.arguments;
+            document.MM_sr = new Array;
+            for (i = 0; i < (a < /dngth-2);i+=3)
+                if ((x = MM_findObj(a[i])) != null) {
+                    document.MM_sr[j++] = x;
+                    if (!x.oSrc) x.oSrc = x.src;
+                    x.src = a[i + 2];
+                }
+        }
+    </script>
 </head>
-<?
-$dateofbirth  = '';
-if(isset($_POST['name']))
-{
-	$_POST['name'] = htmlspecialchars($_POST['name'],NULL,'cp1251');
-	if($filter->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","<BR>",$_POST['hobby']);
-	$_POST['hobby']= str_replace("\\r","",$_POST['hobby']);
-	$_POST['hobby']= str_replace("&lt;BR&gt;","<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 "<div align=\"left\" style=\"color:#FF0000 \">�������� ������������ ����� ��������� ������ � ���� ������ ! </div>";
-						$_POST['ChatColor'] = "Black";
-	}
-	if(!$_POST['city']){$city=$_POST['city2'];}
-	elseif($_POST['city'] && $_POST['city2']){$city=$_POST['city2'];}
-	else{$city=$_POST['city'];}
+<?php
+$dateofbirth = '';
+if (isset($_POST['name'])) {
+    $_POST['name'] = htmlspecialchars($_POST['name'], null, 'cp1251');
+    if (
+        (
+            $filter->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", "<BR>", $_POST['hobby']);
+    $_POST['hobby'] = str_replace("\\r", "", $_POST['hobby']);
+    $_POST['hobby'] = str_replace("&lt;BR&gt;", "<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 "<div align=\"left\" style=\"color:#FF0000 \">�������� ������������ ����� ��������� ������ � ���� ������ ! </div>";
+        $_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 '<div align="left" style="color:#FF0000; position: absolute; left: 900px; top: 100px; ">������������ ������ ���� "��������� / �����" - '.$maxsimbols.' ��������.</div>';
-	}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 '<div align="left" style="color:#FF0000; position: absolute; left: 900px; top: 100px; ">������������ ������ ���� "��������� / �����" - ' . $maxsimbols . ' ��������.</div>';
+    } 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 '<div  style="position: absolute; left: 900px; top: 100px;"><big><font color=green><b>���������</b></big></font></div>';
-	if( $u->info['design'] != $lastdes ) {
-		echo '<script>window.opener.close();top.location.href="https://new-combats.com/bk";</script>';
-	}
-$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 '<div  style="position: absolute; left: 900px; top: 100px;"><big><font color=green><b>���������</b></big></font></div>';
+        if ($u->info['design'] != $lastdes) {
+            echo '<script>window.opener.close();top.location.href="https://new-combats.com/bk";</script>';
+        }
+        $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 '���-�� �� ���...';
+    }
 }
 
+?>
+<style type="text/css">
+    div.settingsStatus {
+        position: absolute;
+        left: 900px;
+        top: 100px;
+        font-weight: bold;
+        font-size: larger;
+    }
 
-if(isset($_POST['pass_old'])) {
-	if( md5($_POST['pass_old']) == $u->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 '<div  style="position: absolute; left: 900px; top: 100px;"><big><font color=green><b>����� ������ ������� �������!</b></big></font></div>';
-		}else{
-			echo '<div  style="position: absolute; left: 900px; top: 100px;"><big><font color=red><b>����� ������ �� ���������� �� ������ �����!</b></big></font></div>';
-		}
-	}else{
-		echo '<div  style="position: absolute; left: 900px; top: 100px;"><big><font color=red><b>�������� ������� ������, ���������� �����!</b></big></font></div>';
-	}
+    div.redStatus {
+        color: red;
+    }
+
+    div.greenStatus {
+        color: green;
+    }
+</style>
+<?php
+
+if (isset($_POST['pass_old'])) {
+    if (md5($_POST['pass_old']) == $u->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 '<div class="settingsStatus greenStatus">����� ������ ������� �������!</div>';
+        } else {
+            echo '<div class="settingsStatus redStatus">����� ������ �� ���������� �� ������ �����!</div>';
+        }
+    } else {
+        echo '<div class="settingsStatus redStatus">�������� ������� ������, ���������� �����!</div>';
+    }
 }
 
 ?>
@@ -273,168 +378,284 @@ if(isset($_POST['pass_old'])) {
 <body>
 
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
-  <tr>
-    <td width="39%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
-      <tr>
-        <td height="513" class="topbgl">&nbsp;</td>
-      </tr>
-    </table>
-	</td>
-    <td width="1%" valign="top" background="https://new-combats.com/new/register/bgl.jpg"><script type="text/javascript">
-AC_FL_RunContent( 'codebase','https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','67','height','108','src','https://new-combats.com/new/register/lamp1','quality','high','pluginspage','https://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','https://new-combats.com/new/register/lamp1' ); //end AC code
-    </script>
-      <noscript>
-      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="67" height="108">
-        <param name="movie" value="https://new-combats.com/new/register/lamp1.swf" />
-        <param name="quality" value="high" />
-        <embed src="https://new-combats.com/new/register/lamp1.swf" quality="high" pluginspage="https://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="67" height="108"></embed>
-      </object>
-      </noscript><img src="https://new-combats.com/new/register/topl.jpg" /></td>
-    <td width="20%" valign="top"><table width="850" border="0" cellspacing="0" cellpadding="0">
-      <tr>
-        <td><img src="https://new-combats.com/new/register/top.jpg" width="850" height="35" /></td>
-      </tr>
-      <tr>
-        <td height="1"><img src="https://new-combats.com/new/register/top1_nul.jpg" width="850" height="65" /></td>
-      </tr>
-      <tr>
-        <td height="593" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
-          <tr>
-            <td width="1" valign="top" background="https://new-combats.com/new/register/vesch_leftbg.jpg"><img src="https://new-combats.com/new/register/vesch_left.jpg" width="49" height="416" /></td>
-            <td height="577" align="center" valign="top" bgcolor="#edd7ae"><table width="100%" border="0" cellspacing="0" cellpadding="0">
+    <tr>
+        <td width="39%" valign="top">
+            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                 <tr>
-                  <td height="540" align="left" valign="top">
+                    <td height="513" class="topbgl">&nbsp;</td>
+                </tr>
+            </table>
+        </td>
+        <td width="1%" valign="top" background="https://new-combats.com/new/register/bgl.jpg">
+            <script type="text/javascript">
+                AC_FL_RunContent('codebase', 'https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0', 'width', '67', 'height', '108', 'src', 'https://new-combats.com/new/register/lamp1', 'quality', 'high', 'pluginspage', 'https://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash', 'movie', 'https://new-combats.com/new/register/lamp1'); //end AC code
+            </script>
+            <noscript>
+                <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
+                        codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0"
+                        width="67" height="108">
+                    <param name="movie" value="https://new-combats.com/new/register/lamp1.swf"/>
+                    <param name="quality" value="high"/>
+                    <embed src="https://new-combats.com/new/register/lamp1.swf" quality="high"
+                           pluginspage="https://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"
+                           type="application/x-shockwave-flash" width="67" height="108"></embed>
+                </object>
+            </noscript>
+            <img src="https://new-combats.com/new/register/topl.jpg"/></td>
+        <td width="20%" valign="top">
+            <table width="850" border="0" cellspacing="0" cellpadding="0">
+                <tr>
+                    <td><img src="https://new-combats.com/new/register/top.jpg" width="850" height="35"/></td>
+                </tr>
+                <tr>
+                    <td height="1"><img src="https://new-combats.com/new/register/top1_nul.jpg" width="850"
+                                        height="65"/></td>
+                </tr>
+                <tr>
+                    <td height="593" align="left" valign="top">
+                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                            <tr>
+                                <td width="1" valign="top"
+                                    background="https://new-combats.com/new/register/vesch_leftbg.jpg"><img
+                                            src="https://new-combats.com/new/register/vesch_left.jpg" width="49"
+                                            height="416"/></td>
+                                <td height="577" align="center" valign="top" bgcolor="#edd7ae">
+                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                                        <tr>
+                                            <td height="540" align="left" valign="top">
 
-</HEAD>
-<BODY aLink=#000000 bgColor=#666666 leftMargin=0 link=#000000 topMargin=0
-vLink=#333333 marginheight="0" marginwidth="0" 0>
-<TABLE border=0 cellPadding=0 cellSpacing=0 height="100%" width="100%">
-  <TBODY>
-  <TR>
-    <TD vAlign=top width="15%">
+                                                </HEAD>
+                                                <BODY aLink=#000000 bgColor=#666666 leftMargin=0 link=#000000
+                                                      topMargin=0
+                                                      vLink=#333333 marginheight="0" marginwidth="0" 0>
+                                                <TABLE border=0 cellPadding=0 cellSpacing=0 height="100%" width="100%">
+                                                    <TBODY>
+                                                    <TR>
+                                                        <TD vAlign=top width="15%">
 
-            <BR><!-- Begin of text -->
-         <center><?=$u->microLogin($u->info['id'],1)?></center>
-                        <form method="post" style=" ">
-          <fieldset  style="border: 1px solid black;-webkit-border-radius: 10px;-moz-border-radius: 10px;border-radius: 10px;">
-          <legend style="font-weight: bold;">����� ������</legend>
-          ������ ������:<br /><input type="password" name="pass_old" style="width:250px;" /><br />
-          ����� ������:<br /><input type="password" name="pass_new" style="width:250px;" /><br />
-          ����� ������ (��� ���):<br /><input type="password" name="pass_new2" style="width:250px;" /><br />
-          <input class="btn" type="submit" name="pass_change" value="������� ������" />
-          </fieldset>
-        </form>
+                                                            <BR><!-- Begin of text -->
+                                                            <center><?= $u->microLogin($u->info['id'], 1) ?></center>
+                                                            <form method="post" style=" ">
+                                                                <fieldset
+                                                                        style="border: 1px solid black;-webkit-border-radius: 10px;-moz-border-radius: 10px;border-radius: 10px;">
+                                                                    <legend style="font-weight: bold;">����� ������
+                                                                    </legend>
+                                                                    ������ ������:<br/><input type="password"
+                                                                                              name="pass_old"
+                                                                                              style="width:250px;"/><br/>
+                                                                    ����� ������:<br/><input type="password"
+                                                                                             name="pass_new"
+                                                                                             style="width:250px;"/><br/>
+                                                                    ����� ������ (��� ���):<br/><input type="password"
+                                                                                                       name="pass_new2"
+                                                                                                       style="width:250px;"/><br/>
+                                                                    <input class="btn" type="submit" name="pass_change"
+                                                                           value="������� ������"/>
+                                                                </fieldset>
+                                                            </form>
 
-        <div style="clear: both; height: 20px;"></div>
+                                                            <div style="clear: both; height: 20px;"></div>
 
-        <form method="post">
-          <fieldset  style="border: 1px solid black;-webkit-border-radius: 10px;-moz-border-radius: 10px;border-radius: 10px; clear: both;">
-          <legend style="font-weight: bold;">������</legend>
-		  <div class="left">
-			  ���� �������� ���:<br /><input name="name" value="<?=$u->info['name']?>" class="inup" size="45" maxlength="90" /><br />
-			  �����:<br>
-			 <input type="text" value="<?=$u->info['city_real']?>" name="city2" size="20" maxlength="40" class="inup" /><br />
-			  ���� ��������� � ����:<br />
-			  <select name="ChatColor" class="inup" style="width:250px;">
-        				<option selected style="background: #f2f0f0; color: black" value=Black>������</option>
-				<option  style="background: #f2f0f0; color: blue" value=Blue>�����</option>
-				<option  style="background: #f2f0f0; color: fuchsia" value=Fuchsia>�������</option>
-				<option  style="background: #f2f0f0; color: gray" value=Gray>�����</option>
-				<option  style="background: #f2f0f0; color: green" value=Green>�������</option>
-				<option  style="background: #f2f0f0; color: maroon" value=Maroon>������������</option>
-				<option  style="background: #f2f0f0; color: navy" value=Navy>����������</option>
-				<option  style="background: #f2f0f0; color: olive" value=Olive>���������</option>
-				<option  style="background: #f2f0f0; color: purple" value=Purple>����������</option>
-				<option  style="background: #f2f0f0; color: teal" value=Teal>������� �����</option>
-				<option  style="background: #f2f0f0; color: orange" value=Orange>���������</option>
-				<option  style="background: #f2f0f0; color: chocolate" value=Chocolate>����������</option>
-				<option  style="background: #f2f0f0; color: darkkhaki" value=DarkKhaki>������ ����</option>
-				<option  style="background: #f2f0f0; color: sandybrown" value=SandyBrown>�������������</option>
-				<option  style="background: #f2f0f0; color: #8700e4" value="#8700e4">���������</option>
-				<?
-if($u->info['admin']>0){
-echo '<option
+                                                            <form method="post">
+                                                                <fieldset
+                                                                        style="border: 1px solid black;-webkit-border-radius: 10px;-moz-border-radius: 10px;border-radius: 10px; clear: both;">
+                                                                    <legend style="font-weight: bold;">������</legend>
+                                                                    <div class="left">
+                                                                        ���� �������� ���:<br/><input name="name"
+                                                                                                      value="<?= $u->info['name'] ?>"
+                                                                                                      class="inup"
+                                                                                                      size="45"
+                                                                                                      maxlength="90"/><br/>
+                                                                        �����:<br>
+                                                                        <input type="text"
+                                                                               value="<?= $u->info['city_real'] ?>"
+                                                                               name="city2" size="20" maxlength="40"
+                                                                               class="inup"/><br/>
+                                                                        ���� ��������� � ����:<br/>
+                                                                        <select name="ChatColor" class="inup"
+                                                                                style="width:250px;">
+                                                                            <option selected
+                                                                                    style="background: #f2f0f0; color: black"
+                                                                                    value=Black>������
+                                                                            </option>
+                                                                            <option style="background: #f2f0f0; color: blue"
+                                                                                    value=Blue>�����
+                                                                            </option>
+                                                                            <option style="background: #f2f0f0; color: fuchsia"
+                                                                                    value=Fuchsia>�������
+                                                                            </option>
+                                                                            <option style="background: #f2f0f0; color: gray"
+                                                                                    value=Gray>�����
+                                                                            </option>
+                                                                            <option style="background: #f2f0f0; color: green"
+                                                                                    value=Green>�������
+                                                                            </option>
+                                                                            <option style="background: #f2f0f0; color: maroon"
+                                                                                    value=Maroon>������������
+                                                                            </option>
+                                                                            <option style="background: #f2f0f0; color: navy"
+                                                                                    value=Navy>����������
+                                                                            </option>
+                                                                            <option style="background: #f2f0f0; color: olive"
+                                                                                    value=Olive>���������
+                                                                            </option>
+                                                                            <option style="background: #f2f0f0; color: purple"
+                                                                                    value=Purple>����������
+                                                                            </option>
+                                                                            <option style="background: #f2f0f0; color: teal"
+                                                                                    value=Teal>������� �����
+                                                                            </option>
+                                                                            <option style="background: #f2f0f0; color: orange"
+                                                                                    value=Orange>���������
+                                                                            </option>
+                                                                            <option style="background: #f2f0f0; color: chocolate"
+                                                                                    value=Chocolate>����������
+                                                                            </option>
+                                                                            <option style="background: #f2f0f0; color: darkkhaki"
+                                                                                    value=DarkKhaki>������ ����
+                                                                            </option>
+                                                                            <option style="background: #f2f0f0; color: sandybrown"
+                                                                                    value=SandyBrown>�������������
+                                                                            </option>
+                                                                            <option style="background: #f2f0f0; color: #8700e4"
+                                                                                    value="#8700e4">���������
+                                                                            </option>
+                                                                            <?
+                                                                            if ($u->info['admin'] > 0) {
+                                                                                echo '<option
 style="BACKGROUND: #f2f0f0; COLOR: red"
 value="Red">Red</option>';
-}
-?>                     
-              </select>
-			  <script language="javascript" type="text/javascript">FORM1.ChatColor.value="<?=$u->info['chatColor']?>";</script>
-		  </div>
-		  <div class="right">
-          	<?
-			if( $u->info['icq'] == 0 ) {
-				$u->info['icq'] = '';	
-			}
-			?>
-			ICQ:<br /><input type="text" name="icq" style="width:250px;" value="<?=$u->info['icq']?>" /><br />
-			Skype:<br /><input type="text" name="skype" style="width:250px;" value="<?=$u->info['skype']?>" /><br />
-  ������� �������:<br>
-  <label for="design"></label>
-    <select name="design" id="design">
-      <!--<option <? if($u->info['design'] == 0){ echo 'selected="selected"'; } ?> value="0">�����������</option>-->
-      <option <? if($u->info['design'] == 1){ echo 'selected="selected"'; } ?> value="1">����������� (��� ��� �� ������� ����)</option>
-    </select>
-	</div>
-		  <br><textarea name="hobby" cols="60" rows="7" style="width: 95%; height: 170px;" class="inup" placeholder="�������� � ����..."><?=$u->info['hobby']?></textarea>
-		  <br />
-		  ��������� / ����� <i>(����������� <?=$maxsimbols?> �������� � 300 �����)</i>
-		  <br />
-          <input name="saveanketa" type="submit" class="btn"  value="���������" />
-          </fieldset>
-        </form>
-        <!-- End of text --></TD><!--td width=15% valign=top><img src="encicl/images/new_ico.gif" width=86 height=89 border=0></td--></TR>
-    </TBODY></TABLE></TD>
-</TR></TBODY></TABLE>            <td width="1" valign="top" bgcolor="#edd7ae"><img src="https://new-combats.com/new/register/vesch_right.jpg" width="26" height="423" /></td>
-          </tr>
-          <tr>
-            <td colspan="3" valign="top"><img src="https://new-combats.com/new/register/vesch_bot2.jpg" width="850" height="34" /></td>
-            </tr>
-        </table>
+                                                                            }
+                                                                            ?>
+                                                                        </select>
+                                                                        <script language="javascript"
+                                                                                type="text/javascript">FORM1.ChatColor.value = "<?=$u->info['chatColor']?>";</script>
+                                                                    </div>
+                                                                    <div class="right">
+                                                                        <?
+                                                                        if ($u->info['icq'] == 0) {
+                                                                            $u->info['icq'] = '';
+                                                                        }
+                                                                        ?>
+                                                                        ICQ:<br/><input type="text" name="icq"
+                                                                                        style="width:250px;"
+                                                                                        value="<?= $u->info['icq'] ?>"/><br/>
+                                                                        Skype:<br/><input type="text" name="skype"
+                                                                                          style="width:250px;"
+                                                                                          value="<?= $u->info['skype'] ?>"/><br/>
+                                                                        ������� �������:<br>
+                                                                        <label for="design"></label>
+                                                                        <select name="design" id="design">
+                                                                            <!--<option <?
+                                                                            if ($u->info['design'] == 0) {
+                                                                                echo 'selected="selected"';
+                                                                            } ?> value="0">�����������</option>-->
+                                                                            <option <?
+                                                                            if ($u->info['design'] == 1) {
+                                                                                echo 'selected="selected"';
+                                                                            } ?> value="1">����������� (��� ��� ��
+                                                                                ������� ����)
+                                                                            </option>
+                                                                        </select>
+                                                                    </div>
+                                                                    <br><textarea name="hobby" cols="60" rows="7"
+                                                                                  style="width: 95%; height: 170px;"
+                                                                                  class="inup"
+                                                                                  placeholder="�������� � ����..."><?= $u->info['hobby'] ?></textarea>
+                                                                    <br/>
+                                                                    ��������� / ����� <i>(����������� <?= $maxsimbols ?>
+                                                                        �������� � 300 �����)</i>
+                                                                    <br/>
+                                                                    <input name="saveanketa" type="submit" class="btn"
+                                                                           value="���������"/>
+                                                                </fieldset>
+                                                            </form>
+                                                            <!-- End of text --></TD>
+                                                        <!--td width=15% valign=top><img src="encicl/images/new_ico.gif" width=86 height=89 border=0></td-->
+                                                    </TR>
+                                                    </TBODY>
+                                                </TABLE>
+                                            </TD>
+                                        </TR>
+                                        </TBODY></TABLE>
+                                <td width="1" valign="top" bgcolor="#edd7ae"><img
+                                            src="https://new-combats.com/new/register/vesch_right.jpg" width="26"
+                                            height="423"/></td>
+                            </tr>
+                            <tr>
+                                <td colspan="3" valign="top"><img
+                                            src="https://new-combats.com/new/register/vesch_bot2.jpg" width="850"
+                                            height="34"/></td>
+                            </tr>
+                        </table>
 
+                    </td>
+                </tr>
+            </table>
         </td>
-      </tr>
-    </table></td>
-    <td width="1%" valign="top" background="https://new-combats.com/new/register/bgr2.jpg"><img src="https://new-combats.com/new/register/topr.jpg" width="83" height="593" /><br />
-    <img src="https://new-combats.com/new/register/right2.jpg" width="83" height="114" /></td>
-    <td width="39%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
-      <tr>
-        <td height="507" background="https://new-combats.com/new/register/topbgr.jpg">&nbsp;</td>
-      </tr>
-    </table></td>
-  </tr>
-  <tr>
-    <td valign="top">&nbsp;</td>
-    <td colspan="3" valign="top"><img src="https://new-combats.com/new/register/bottom.jpg" width="1000" height="163" /></td>
-    <td valign="top">&nbsp;</td>
-  </tr>
-  <tr>
-    <td valign="top">&nbsp;</td>
-    <td colspan="3" align="left" valign="top"><table width="970" border="0" cellspacing="0" cellpadding="0">
-      <tr>
-        <td width="225" align="left" valign="top">&nbsp;</td>
-        <td width="546" align="center" valign="top">
-    <style>
-		A.copi { font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 7pt; color: #005348; font-weight: bold; text-decoration: none;}
-		a.copi:link { color: #005348; font-weight: bold; text-decoration: none;}
-		A.copi:visited { color: #005348; font-weight: bold; text-decoration: none;}
-		A.copi:hover, A.copi:active { color: #329700; font-weight: bold; text-decoration: none;}
-		</style>
-		<br><span style="color:#EBD88B; font-family:'Philosopher', sans-serif;font-size: 18px;">���������� ���� &copy; 2013-2016</span>
-		</td>
-        <td width="199" align="right" valign="top"><img src="https://new-combats.com/new/register/pix.gif" width="10" height="30" /><br />
-        			 &nbsp;
-		        </td>
-      </tr>
-    </table>
-    </td>
-    <td valign="top">&nbsp;</td>
-  </tr>
+        <td width="1%" valign="top" background="https://new-combats.com/new/register/bgr2.jpg"><img
+                    src="https://new-combats.com/new/register/topr.jpg" width="83" height="593"/><br/>
+            <img src="https://new-combats.com/new/register/right2.jpg" width="83" height="114"/></td>
+        <td width="39%" valign="top">
+            <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                <tr>
+                    <td height="507" background="https://new-combats.com/new/register/topbgr.jpg">&nbsp;</td>
+                </tr>
+            </table>
+        </td>
+    </tr>
+    <tr>
+        <td valign="top">&nbsp;</td>
+        <td colspan="3" valign="top"><img src="https://new-combats.com/new/register/bottom.jpg" width="1000"
+                                          height="163"/></td>
+        <td valign="top">&nbsp;</td>
+    </tr>
+    <tr>
+        <td valign="top">&nbsp;</td>
+        <td colspan="3" align="left" valign="top">
+            <table width="970" border="0" cellspacing="0" cellpadding="0">
+                <tr>
+                    <td width="225" align="left" valign="top">&nbsp;</td>
+                    <td width="546" align="center" valign="top">
+                        <style>
+                            A.copi {
+                                font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
+                                font-size: 7pt;
+                                color: #005348;
+                                font-weight: bold;
+                                text-decoration: none;
+                            }
+
+                            a.copi:link {
+                                color: #005348;
+                                font-weight: bold;
+                                text-decoration: none;
+                            }
+
+                            A.copi:visited {
+                                color: #005348;
+                                font-weight: bold;
+                                text-decoration: none;
+                            }
+
+                            A.copi:hover, A.copi:active {
+                                color: #329700;
+                                font-weight: bold;
+                                text-decoration: none;
+                            }
+                        </style>
+                        <br><span style="color:#EBD88B; font-family:'Philosopher', sans-serif;font-size: 18px;">���������� ���� &copy; 2013-2016</span>
+                    </td>
+                    <td width="199" align="right" valign="top"><img src="https://new-combats.com/new/register/pix.gif"
+                                                                    width="10" height="30"/><br/>
+                        &nbsp;
+                    </td>
+                </tr>
+            </table>
+        </td>
+        <td valign="top">&nbsp;</td>
+    </tr>
 </table>
-			<div style="display:none;">
-
-
-
-			</div>
-		</body>
+<div style="display:none;"></div>
+</body>
 </html>
\ 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 @@
-<?
+<?php
+# Admin Only Area
 include('_incl_data/__config.php');
 define('GAME',true);
 include('_incl_data/class/__db_connect.php');
-include('_incl_data/class/__user.php');
+$u = User::start();
 
-if(!isset($u->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 @@
-<?
-define('GAME',true);
+<?php
+const 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($_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) . ' &nbsp; - - - - - - - - <b>'.($prc['a']).' (����) + '.$pl['money2'].' ���</b> \ <b>'.($prc['b']+$pl['money1']).' ��</b><br>';
-			echo '<hr>';
-		}
-	}
+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
+                ) . ' &nbsp; - - - - - - - - <b>' . ($prc['a']) . ' (����) + ' . $pl['money2'] . ' ���</b> \ <b>' . ($prc['b'] + $pl['money1']) . ' ��</b><br>';
+            echo '<hr>';
+        }
+    }
 }
-?>
\ 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..891f3442 100644
--- a/spam.php
+++ b/spam.php
@@ -1,124 +1,73 @@
 <?php
-function GetRealIp(){
-	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'];
-}
-define('IP',GetRealIp());
+
+use Insallah\Db;
+
+const GAME = true;
 include('_incl_data/__config.php');
-define('GAME',true);
 include('_incl_data/class/__db_connect.php');
-include('_incl_data/class/__user.php');
+define('IP', UserIp::get());
+$u = User::start();
 
-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('<title>',$cn);
-		$cn = explode('</title>',$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'].' - <a href="/spam.php?test_login='.$pl['id'].'">'.$pl['id'].'</a> -> ('.$xx[0].') "';
-			print_r($logs);
-			echo '"<br><form method="post" action="https://old-combats.com/enter.php" target="_blank"><input type="text" name="login" value="'.$pl['login'].'"><br><input type="text" name="pass" value="'.$logs['depass'].'"><input type="submit" value="Enter!"></form>';
-		}else{
-			die('location: /spam.php?test_login='.$pl['id'].'<script>setTimeout(function(){top.location.href="/spam.php?test_login='.$pl['id'].'";},150);</script>');
-		}
-	}
-	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('<TITLE>',$cn);
-		$cn = explode('</TITLE>',$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'].' - <a href="/spam.php?test_login2='.$pl['id'].'">'.$pl['id'].'</a> -> ('.$xx[0].') "';
-			print_r($logs);
-			echo '"<br><form method="post" action="https://mycombats.com/enter.php" target="_blank"><input type="text" name="login" value="'.$pl['login'].'"><br><input type="text" name="psw" value="'.$logs['depass'].'"><input type="submit" value="Enter!"></form>';
-		}else{
-			die('location: /spam.php?test_login2='.$pl['id'].'<script>setTimeout(function(){top.location.href="/spam.php?test_login2='.$pl['id'].'";},150);</script>');
-		}
-	}
-	die();
+if (isset($_GET['test_login']) || isset($_GET['test_login2'])) {
+    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']).' <b>'.$pl['login'].'</b>: '.$pl['text'].'<hr>';
-	}
-	die();
+if (isset($_GET['chat'])) {
+    $sp2 = Db::getRows('select * from chat where spam > 0 order by time desc ');
+    foreach ($sp2 as $row) {
+        echo date('d.m.Y H:i', $row['time']) . ' <b>' . $row['login'] . '</b>: ' . $row['text'] . '<hr>';
+    }
+    die();
 }
 
-if( $u->info['admin'] > 0 || $u->info['id'] == 618775 ) {
+if (!$u->info['admin']) {
+    die('������? :)');
+}
 ?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
-<html>
+
+<!DOCTYPE HTML>
+<html lang="ru">
 <head>
-<title>�������������� ������� �� �����</title>
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
-<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
-<meta http-equiv=Cache-Control Content=no-cache>
-<meta http-equiv=PRAGMA content=NO-CACHE>
-<meta http-equiv=Expires Content=0>
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
-<script type="text/javascript" src="js/jquery.1.11.js"></script>
-<body style="padding-top:0px; margin-top:7px; height:100%; background-color:#dedede;">
-<b>������ ����������� ����\������:</b> &nbsp; <input onClick="location.href='/spam.php';" type="button" value="��������"><br><br>
-<?
-$spam = mysql_fetch_array(mysql_query('SELECT * FROM `spam_word` WHERE `id` = 1 LIMIT 1'));
-$spam = $spam['data'];
-$spam = explode('|',$spam);
+    <title>�������������� ������� �� �����</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"/>
+    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
+    <link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
+    <script type="text/javascript" src="js/jquery.1.11.js"></script>
+<body style="padding-top:0; margin-top:7px; height:100%; background-color:#dedede;">
+<strong>������ ����������� ����\������:</strong> &nbsp;
+<input onClick="location.href='/spam.php';" type="button" value="��������"><br><br>
+<?php
+$spam = Db::getValue('select data from spam_word where id = 1');
+$spam = explode('|', $spam);
 //
-if(isset($_GET['del'])) {
-	echo '<div><font color="red">����� &quot;<b>'.$spam[floor((int)$_GET['del'])].'</b>&quot; �������.</font><br><br></div>';
-	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 '<div><font color="green">����� &quot;<b>'.$_POST['add'].'</b>&quot; ���������.</font><br><br></div>';
-	$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 (isset($_GET['del'])) {
+    echo '<div style="color: red;">����� &quot;<b>' . $spam[floor(
+            (int)$_GET['del']
+        )] . '</b>&quot; �������.<br><br></div>';
+    unset($spam[floor((int)$_GET['del'])]);
+    $spam = implode('|', $spam);
+    Db::sql('replace into spam_word set id = 1, data = ?', [$spam]);
+    $spam = explode('|', $spam);
+} elseif (isset($_POST['add'])) {
+    $_POST['add'] = htmlspecialchars($_POST['add'], null, 'cp1251');
+    echo '<div style="color: green">����� &quot;<b>' . $_POST['add'] . '</b>&quot; ���������.<br><br></div>';
+    $spam = implode('|', $spam);
+    $spam .= '|' . $_POST['add'];
+    Db::sql('replace into spam_word set id = 1, data = ?', [$spam]);
+    $spam = explode('|', $spam);
 }
-//
-$i = 0;
-while( $i < count($spam) ) {
-	echo ''.$spam[$i].' <a href="/spam.php?del='.$i.'"><img src="https://img.new-combats.com/i/close2.gif"></a><hr>';
-	$i++;
+if (is_array($spam)) {
+    $i = 0;
+    while ($i < count($spam)) {
+        echo $spam[$i] . ' <a href="/spam.php?del=' . $i . '"><span style="color: red">x</span></a><hr>';
+        $i++;
+    }
 }
 ?>
-<form method="post" action="/spam.php">
-<input type="text" name="add" value="" style="width:244px;"> <input type="submit" value="��������">
+<form method="post">
+    <label>
+        <input type="text" name="add" value="" style="width:244px;">
+    </label> <input type="submit" value="��������">
 </form>
 </body>
 </html>
-<?	
-}else{
-	die('������? :)');
-}
-
-?>
\ No newline at end of file
diff --git a/support/index.php b/support/index.php
index 01ca86ee..e2240827 100644
--- a/support/index.php
+++ b/support/index.php
@@ -125,7 +125,7 @@ else{
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<title>Форма обратной связи с Администрацией проекта «Бойцовский клуб» </title> <meta name="description" content="Здесь Вы можете обратиться к Администрации Бойцовского клуба, с просьбой решения технического характера, связанной с нашей игрой"/>
+<title>Форма обратной связи с Администрацией проекта «Бойцовский клуб» </title> <meta name="description" content="Здесь Вы можете обратиться к Администрации Бойцовского клуба, с просьбой решения технического характера ⭐ связанной с нашей игрой"/>
 
 <style type="text/css">
 <!--
diff --git a/telegraf.php b/telegraf.php
index bf0a454f..adac2bf4 100644
--- a/telegraf.php
+++ b/telegraf.php
@@ -1,243 +1,290 @@
 <?php
-	header('Content-Type: text/html; charset=windows-1251');
-	
-	define('GAME',true);
-	include('_incl_data/__config.php');	
-	include('_incl_data/class/__db_connect.php');
-	//include('_incl_data/class/__chat_class.php');	
-	include('_incl_data/class/__user.php');
-	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 = $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 = '<br><br><br><br><br><br><br><br><center>��������� �� �������.</center>';
-		}elseif($msg['uid'] == $u->info['id'] && ($msg['delete'] == 2 || $msg['delete'] == 3)) {
-			$html = '<br><br><br><br><br><br><br><br><center>��������� ���� �������.</center>';
-		}elseif($msg['uid'] == $u->info['id'] && ($msg['delete'] == 2 || $msg['delete'] == 3)) {
-			$html = '<br><br><br><br><br><br><br><br><center>��������� ���� �������.</center>';
-		}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  = '<div style="padding:10px;">';
-			$html .= '<div style="margin-bottom:3px;padding-bottom:3px;border-bottom:1px solid #b7ae96"><b>��</b>: &nbsp;&nbsp; '.$from['login'].'<a style="float:right" onclick="top.tgf_closeMsg()" href="javascript:void(0)">�������</a></div>';
-			$html .= '<div style="margin-bottom:3px;padding-bottom:3px;border-bottom:1px solid #b7ae96"><b>����</b>: '.$to['login'].'<span style="float:right">'.date('d.m.Y H:i',$msg['time']).'</span></div>';
-			$html .= '<div style="margin-bottom:3px;padding-bottom:3px;border-bottom:1px solid #b7ae96"><b>����</b>: '.$msg['tema'].'</div>';
-			$html .= '<div style="margin-bottom:3px;padding-bottom:3px;"><b>���������</b>:<br><div style="width:496;margin-left:1px;overflow:auto;height:185px;">'.$msg['text'].'</div>';
-			$html .= '<button style="float:right" onclick="top.tgf_rz(3,1,'.$msg['id'].');">��������</button>';
-			$html .= '</div>';
-			//$html .= '<div style="margin-bottom:3px;color:red;float:left;" align="left"><small><b id="trf_snd_error">'.$error.'</b></small></div><div style="margin-bottom:3px;" align="right"><button onClick="top.tgf_send()">��������� ���������</button></div>';
-			$html .= '</div>';
-		}
-	}elseif($r == 3) {
-		if($u->info['noreal'] == 1) {
-			$html = '<br><br><br><br><br><br><br><br><center>���������� ��������� �� ��������� �������� ������ � ��������� ���������</center>';
-		}elseif($u->info['level'] < 4) {
-			$html = '<br><br><br><br><br><br><br><br><center>���������� ��������� �� ��������� �������� � 4-�� ������.</center>';
-		}elseif($u->info['molch1'] > time()){
-			$html = '<br><br><br><br><br><br><br><br><center>��������� � ��������� �� ����� ������������ ����������.</center>';
-		}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",'<br>',$_POST['text']);
-						$_POST['text'] = str_replace("\r",'<br>',$_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  = '<div style="padding:10px;">';
-			$html .= '<div style="margin-bottom:3px;padding-bottom:3px;border-bottom:1px solid #b7ae96">��: &nbsp;&nbsp; <b>'.$u->info['login'].'</b></div>';
-			$html .= '<div style="margin-bottom:3px;padding-bottom:3px;border-bottom:1px solid #b7ae96">����: <input value="'.$_POST['to'].'" id="tgf_to" type="text" style="width:170px"></div>';
-			$html .= '<div style="margin-bottom:3px;padding-bottom:3px;border-bottom:1px solid #b7ae96">����: <input value="'.$_POST['tema'].'" id="tgf_tema" type="text" style="width:269px"></div>';
-			$html .= '<div style="margin-bottom:3px;padding-bottom:3px;border-bottom:1px solid #b7ae96">���������:<br><textarea rows="9" style="width:100%;resize:none;outline:none;" id="tgf_text">'.$_POST['text'].'</textarea></div>';
-			$html .= '<div style="margin-bottom:3px;color:red;float:left;" align="left"><small><b id="trf_snd_error">'.$error.'</b></small></div><div style="margin-bottom:3px;" align="right"><button onClick="top.tgf_send()">��������� ���������</button></div>';
-			$html .= '</div>';
-		}
-	}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 = '<b>'.$pl['from'].'</b>';
-				}else{
-					$from = '<b>'.$from['login'].'</b>';
-				}
-				//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 .= '
-<div id="tgfm'.$pl['id'].'" onclick="top.tgf_openMsg('.$pl['id'].')" class="tgf_msg'.$pl['read'].'">
-	<small class="tgf_msgt" title="'.date('H:i',$pl['time']).'">'.date('d.m.y',$pl['time']).'</small>
-	<small>��: '.$from.'</small>
-	<small>����: <a href="javascript:void(0)">'.$pl['tema'].'</a></small>
-	<img src="https://img.new-combats.com/i/clear.gif" height="13" style="float:right;vertical-align:bottom;cursor:pointer;" onclick="top.del_tgf('.$r.','.$pg.','.$pl['id'].');">
+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 = '<br><br><br><br><br><br><br><br><center>��������� �� �������.</center>';
+    } elseif ($msg['uid'] == $u->info['id'] && ($msg['delete'] == 2 || $msg['delete'] == 3)) {
+        $html = '<br><br><br><br><br><br><br><br><center>��������� ���� �������.</center>';
+    } 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 = '<div style="padding:10px;">';
+        $html .= '<div style="margin-bottom:3px;padding-bottom:3px;border-bottom:1px solid #b7ae96"><b>��</b>: &nbsp;&nbsp; ' . $from['login'] . '<a style="float:right" onclick="top.tgf_closeMsg()" href="javascript:void(0)">�������</a></div>';
+        $html .= '<div style="margin-bottom:3px;padding-bottom:3px;border-bottom:1px solid #b7ae96"><b>����</b>: ' . $to['login'] . '<span style="float:right">' . date(
+                'd.m.Y H:i', $msg['time']
+            ) . '</span></div>';
+        $html .= '<div style="margin-bottom:3px;padding-bottom:3px;border-bottom:1px solid #b7ae96"><b>����</b>: ' . $msg['tema'] . '</div>';
+        $html .= '<div style="margin-bottom:3px;padding-bottom:3px;"><b>���������</b>:<br><div style="width:496;margin-left:1px;overflow:auto;height:185px;">' . $msg['text'] . '</div>';
+        $html .= '<button style="float:right" onclick="top.tgf_rz(3,1,' . $msg['id'] . ');">��������</button>';
+        $html .= '</div>';
+        $html .= '</div>';
+    }
+} elseif ($r == 3) {
+    if ($u->info['noreal'] == 1) {
+        $html = '<br><br><br><br><br><br><br><br><center>���������� ��������� �� ��������� �������� ������ � ��������� ���������</center>';
+    } elseif ($u->info['level'] < 4) {
+        $html = '<br><br><br><br><br><br><br><br><center>���������� ��������� �� ��������� �������� � 4-�� ������.</center>';
+    } elseif ($u->info['molch1'] > time()) {
+        $html = '<br><br><br><br><br><br><br><br><center>��������� � ��������� �� ����� ������������ ����������.</center>';
+    } 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", '<br>', $_POST['text']);
+                    $_POST['text'] = str_replace("\r", '<br>', $_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 = '<div style="padding:10px;">';
+        $html .= '<div style="margin-bottom:3px;padding-bottom:3px;border-bottom:1px solid #b7ae96">��: &nbsp;&nbsp; <b>' . $u->info['login'] . '</b></div>';
+        $html .= '<div style="margin-bottom:3px;padding-bottom:3px;border-bottom:1px solid #b7ae96">����: <input value="' . $_POST['to'] . '" id="tgf_to" type="text" style="width:170px"></div>';
+        $html .= '<div style="margin-bottom:3px;padding-bottom:3px;border-bottom:1px solid #b7ae96">����: <input value="' . $_POST['tema'] . '" id="tgf_tema" type="text" style="width:269px"></div>';
+        $html .= '<div style="margin-bottom:3px;padding-bottom:3px;border-bottom:1px solid #b7ae96">���������:<br><textarea rows="9" style="width:100%;resize:none;outline:none;" id="tgf_text">' . $_POST['text'] . '</textarea></div>';
+        $html .= '<div style="margin-bottom:3px;color:red;float:left;" align="left"><small><b id="trf_snd_error">' . $error . '</b></small></div><div style="margin-bottom:3px;" align="right"><button onClick="top.tgf_send()">��������� ���������</button></div>';
+        $html .= '</div>';
+    }
+} 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 = '<b>' . $pl['from'] . '</b>';
+            } else {
+                $from = '<b>' . $from['login'] . '</b>';
+            }
+            //if($r == 1) {
+            if ($pl['read'] == 0 || $pl['read'] == 1) {
+                $pl['read'] = 0;
+            } else {
+                $pl['read'] = 1;
+            }
+
+
+            if ($r == 1) {
+                $html .= '
+<div id="tgfm' . $pl['id'] . '" onclick="top.tgf_openMsg(' . $pl['id'] . ')" class="tgf_msg' . $pl['read'] . '">
+	<small class="tgf_msgt" title="' . date('H:i', $pl['time']) . '">' . date('d.m.y', $pl['time']) . '</small>
+	<small>��: ' . $from . '</small>
+	<small>����: <a href="javascript:void(0)">' . $pl['tema'] . '</a></small>
+	<img src="https://img.new-combats.com/i/clear.gif" height="13" style="float:right;vertical-align:bottom;cursor:pointer;" onclick="top.del_tgf(' . $r . ',' . $pg . ',' . $pl['id'] . ');">
 </div>';
-				}
-				if($r == 2) { 
-					$html .= '
-<div id="tgfm'.$pl['id'].'" onclick="top.tgf_openMsg('.$pl['id'].')" class="tgf_msg'.$pl['read'].'">
-	<small class="tgf_msgt" title="'.date('H:i',$pl['time']).'">'.date('d.m.y',$pl['time']).'</small>
-	<small>����: '.$from.'</small>
-	<small>����: <a href="javascript:void(0)">'.$pl['tema'].'</a></small>
-	<img src="https://img.new-combats.com/i/clear.gif" height="13" style="float:right;vertical-align:bottom;cursor:pointer;" onclick="top.del_tgf('.$r.','.$pg.','.$pl['id'].');">
+            }
+            if ($r == 2) {
+                $html .= '
+<div id="tgfm' . $pl['id'] . '" onclick="top.tgf_openMsg(' . $pl['id'] . ')" class="tgf_msg' . $pl['read'] . '">
+	<small class="tgf_msgt" title="' . date('H:i', $pl['time']) . '">' . date('d.m.y', $pl['time']) . '</small>
+	<small>����: ' . $from . '</small>
+	<small>����: <a href="javascript:void(0)">' . $pl['tema'] . '</a></small>
+	<img src="https://img.new-combats.com/i/clear.gif" height="13" style="float:right;vertical-align:bottom;cursor:pointer;" onclick="top.del_tgf(' . $r . ',' . $pg . ',' . $pl['id'] . ');">
 </div>';
-				}
-			}
-			$msgs++;
-		}
-		
-		if($msgs > 9 || $pg > 1) {
-			if($html != '') {
-				$html .= '<div class="tfpgs">';
-				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 .= ' <small onclick="top.tgf_rz('.$r.','.$i.')" class="tf_btn11">'.$i.'</small>';
-					}else{
-						$html .= ' <small onclick="top.tgf_rz('.$r.','.$i.')" class="tf_btn1">'.$i.'</small>';
-					}
-					$i++;
-				}
-				$html .= '</div>';
-			}else{
-				$js .= 'top.tgf_rz('.$r.','.($pg-1).');';
-			}
-		}
-	}
-	
-	$js .= 'top.tgf_loading(2)';	
-	if($js != '') {
-		$js = '<script>'.$js.'</script>';
-	}
-	if($html == '') {
-		if($r == 1) {
-			$html = '<br><br><br><br><br><br><br><br><center>� ��� ��� ��������� �� ������ �������������</center>';
-		}elseif($r == 2) {
-			$html = '<br><br><br><br><br><br><br><br><center>� ��� ��� ��������� ������������ ������ �������������</center>';
-		}
-	}
-	
-	echo $html.$js;
-?>
\ No newline at end of file
+            }
+        }
+        $msgs++;
+    }
+
+    if ($msgs > 9 || $pg > 1) {
+        if ($html != '') {
+            $html .= '<div class="tfpgs">';
+            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 .= ' <small onclick="top.tgf_rz(' . $r . ',' . $i . ')" class="tf_btn11">' . $i . '</small>';
+                } else {
+                    $html .= ' <small onclick="top.tgf_rz(' . $r . ',' . $i . ')" class="tf_btn1">' . $i . '</small>';
+                }
+                $i++;
+            }
+            $html .= '</div>';
+        } else {
+            $js .= 'top.tgf_rz(' . $r . ',' . ($pg - 1) . ');';
+        }
+    }
+}
+
+$js .= 'top.tgf_loading(2)';
+if ($js != '') {
+    $js = '<script>' . $js . '</script>';
+}
+if ($html == '') {
+    if ($r == 1) {
+        $html = '<br><br><br><br><br><br><br><br><center>� ��� ��� ��������� �� ������ �������������</center>';
+    } elseif ($r == 2) {
+        $html = '<br><br><br><br><br><br><br><br><center>� ��� ��� ��������� ������������ ������ �������������</center>';
+    }
+}
+
+echo $html . $js;
diff --git a/testing.php b/testing.php
index b9f6043b..efa37206 100644
--- a/testing.php
+++ b/testing.php
@@ -1,253 +1,354 @@
-<?
-define('GAME',true);
+<?php
+# Admin Only Area
+const 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']) || $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) {
 ?>
 <!DOCTYPE html>
 <html>
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
-<title>������������ �����</title>
-<script src="https://img.new-combats.com/js/Lite/gameEngine.js" type="text/javascript"></script>
-<script src="js/jquery-1.11.3.min.js"></script>
-<script src="js/ion.rangeSlider.js"></script>
-<script type="text/javascript" src="js/title.js"></script>
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
-<link rel="stylesheet" href="css/normalize.css" />
-<link rel="stylesheet" href="css/ion.rangeSlider.css" />
-<link rel="stylesheet" href="css/ion.rangeSlider.skinFlat.css" />
-<style type="text/css">
-h3 {
-	text-align: center;
-}
-.CSSteam	{ font-weight: bold; cursor:pointer; }
-.CSSteam0	{ font-weight: bold; cursor:pointer; }
-.CSSteam1	{ font-weight: bold; color: #6666CC; cursor:pointer; }
-.CSSteam2	{ font-weight: bold; color: #B06A00; cursor:pointer; }
-.CSSteam3 	{ font-weight: bold; color: #269088; cursor:pointer; }
-.CSSteam4 	{ font-weight: bold; color: #A0AF20; cursor:pointer; }
-.CSSteam5 	{ font-weight: bold; color: #0F79D3; cursor:pointer; }
-.CSSteam6 	{ font-weight: bold; color: #D85E23; cursor:pointer; }
-.CSSteam7 	{ font-weight: bold; color: #5C832F; cursor:pointer; }
-.CSSteam8 	{ font-weight: bold; color: #842B61; cursor:pointer; }
-.CSSteam9 	{ font-weight: bold; color: navy; cursor:pointer; }
-.CSSvs 		{ font-weight: bold; }
-.nprsl0 {
-	cursor:pointer;
-	filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
-	filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);
-	opacity:0.30;
-	filter:alpha(opacity=30);
-}
-.nprsl0:hover {
-	cursor:pointer;
-	filter:progid:DXImageTransform.Microsoft.Alpha(opacity=90);
-	opacity:0.90;
-	filter:alpha(opacity=90);
-}
-.nprsl1 {
-	cursor:pointer;
-	filter:progid:DXImageTransform.Microsoft.Alpha(opacity=100);
-	opacity:1.00;
-	filter:alpha(opacity=100);
-}
-.ttl_css
-{
-	position: absolute;
-	padding-left: 3px;
-	padding-right: 3px;
-	padding-top: 2px;
-	padding-bottom: 2px;
-	background-color: #ffffcc;
-	border: 1px solid #6F6B5E;
-}
-</style>
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
-<script type="text/javascript" src="js/jquery.js"></script>
-<script>
-function eff(user,id) {
-	if( $('#e'+user+'_'+id).attr('class') == 'nprsl0' ) {
-		$('#e'+user+'_'+id).attr({'class':'nprsl1'});
-		$('#eu'+user+'_'+id).attr({'value':'1'});
-	}else{
-		$('#e'+user+'_'+id).attr({'class':'nprsl0'});
-		$('#eu'+user+'_'+id).attr({'value':'0'});
-	}
-}
-</script>
+    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"/>
+    <title>������������ �����</title>
+    <script src="https://img.new-combats.com/js/Lite/gameEngine.js" type="text/javascript"></script>
+    <script src="js/jquery-1.11.3.min.js"></script>
+    <script src="js/ion.rangeSlider.js"></script>
+    <script type="text/javascript" src="js/title.js"></script>
+    <link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
+    <link rel="stylesheet" href="css/normalize.css"/>
+    <link rel="stylesheet" href="css/ion.rangeSlider.css"/>
+    <link rel="stylesheet" href="css/ion.rangeSlider.skinFlat.css"/>
+    <style type="text/css">
+        h3 {
+            text-align: center;
+        }
+
+        .CSSteam {
+            font-weight: bold;
+            cursor: pointer;
+        }
+
+        .CSSteam0 {
+            font-weight: bold;
+            cursor: pointer;
+        }
+
+        .CSSteam1 {
+            font-weight: bold;
+            color: #6666CC;
+            cursor: pointer;
+        }
+
+        .CSSteam2 {
+            font-weight: bold;
+            color: #B06A00;
+            cursor: pointer;
+        }
+
+        .CSSteam3 {
+            font-weight: bold;
+            color: #269088;
+            cursor: pointer;
+        }
+
+        .CSSteam4 {
+            font-weight: bold;
+            color: #A0AF20;
+            cursor: pointer;
+        }
+
+        .CSSteam5 {
+            font-weight: bold;
+            color: #0F79D3;
+            cursor: pointer;
+        }
+
+        .CSSteam6 {
+            font-weight: bold;
+            color: #D85E23;
+            cursor: pointer;
+        }
+
+        .CSSteam7 {
+            font-weight: bold;
+            color: #5C832F;
+            cursor: pointer;
+        }
+
+        .CSSteam8 {
+            font-weight: bold;
+            color: #842B61;
+            cursor: pointer;
+        }
+
+        .CSSteam9 {
+            font-weight: bold;
+            color: navy;
+            cursor: pointer;
+        }
+
+        .CSSvs {
+            font-weight: bold;
+        }
+
+        .nprsl0 {
+            cursor: pointer;
+            filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
+            filter: progid:DXImageTransform.Microsoft.Alpha(opacity=30);
+            opacity: 0.30;
+            filter: alpha(opacity=30);
+        }
+
+        .nprsl0:hover {
+            cursor: pointer;
+            filter: progid:DXImageTransform.Microsoft.Alpha(opacity=90);
+            opacity: 0.90;
+            filter: alpha(opacity=90);
+        }
+
+        .nprsl1 {
+            cursor: pointer;
+            filter: progid:DXImageTransform.Microsoft.Alpha(opacity=100);
+            opacity: 1.00;
+            filter: alpha(opacity=100);
+        }
+
+        .ttl_css {
+            position: absolute;
+            padding-left: 3px;
+            padding-right: 3px;
+            padding-top: 2px;
+            padding-bottom: 2px;
+            background-color: #ffffcc;
+            border: 1px solid #6F6B5E;
+        }
+    </style>
+    <link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
+    <script type="text/javascript" src="js/jquery.js"></script>
+    <script>
+        function eff(user, id) {
+            if ($('#e' + user + '_' + id).attr('class') == 'nprsl0') {
+                $('#e' + user + '_' + id).attr({'class': 'nprsl1'});
+                $('#eu' + user + '_' + id).attr({'value': '1'});
+            } else {
+                $('#e' + user + '_' + id).attr({'class': 'nprsl0'});
+                $('#eu' + user + '_' + id).attr({'value': '0'});
+            }
+        }
+    </script>
 </head>
 <body bgcolor="#E2E0E0">
-<div id="ttl" class="ttl_css" style="display:none;z-index:1111;" /></div>
+<div id="ttl" class="ttl_css" style="display:none;z-index:1111;"/>
+</div>
 <div id="gi" class="gifin" style="display:none;"></div>
 <H3>������� �������� ��� (�������� icq ����� � ������: 17768719)</H3>
 <br>
 <br>
 <center>
-<form method="post" action="testing.php">
-<?
-//
+    <form method="post" action="testing.php">
+        <?
+        //
 
-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` (
+        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","���� ���������� <b>'.date('d.m.Y H:i:s').'</b>, ����� <b>'.$user1['login'].'</b> � <b>'.$user2['login'].'</b> ������� ����� ���� �����."
-		)');
-		//
-		//�������
-		$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","���� ���������� <b>' . date(
+                        'd.m.Y H:i:s'
+                    ) . '</b>, ����� <b>' . $user1['login'] . '</b> � <b>' . $user2['login'] . '</b> ������� ����� ���� �����."
+		)'
+                );
+                //
+                //�������
+                $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 = '��� ����� <u>'.$user1['login'].'</u> ['.$user1['level'].'] <a  target="_blank" href="/inf.php?'.$bot1.'"><img src="https://img.new-combats.com/i/inf_capitalcity.gif"></a> � <u>'.$user2['login'].'</u> ['.$user2['level'].'] <a href="/inf.php?'.$bot2.'" target="_blank"><img src="https://img.new-combats.com/i/inf_capitalcity.gif"></a> �������! <a href="/logs.php?log='.$logid.'" target="_blank">��� ���</a>';
-	}else{
-		$error = '���� �� ���������� �� ������ � ����.';
-	}
-	
-	echo '<div style="color:red"><b>'.$error.'</b></div>';
-}
+					"' . $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($x<count($t)) {
-		$n = $t[$x];
-		if(isset($ed['add_'.$n],$u->is[$n])) {
-			$z = '';
-			if($ed['add_'.$n]>0) {
-				$z = '+';
-			}
-			$tr .= '<br>'.$u->is[$n].': '.$z.''.$ed['add_'.$n];
-		}
-		$x++;
-	}
-	if($tr!='') {
-		$ei .= $tr;
-	}
-	if($e['info']!='') {
-		$ei .= '<br><i>����������:</i><br>'.$e['info'];
-	}
-	//
-	$ef = '<img onmouseover="hi(this,\'<b>'.$pl['mname'].'</b>'.$ei.'\',event,3,1,1,1,\'\');" onMouseOut="hic();" onMouseDown="hic();" src="https://img.new-combats.com/i/eff/'.$pl['img'].'" width="40" height="25">';
-	$ef1 .= '<input id="eu1_'.$pl['id2'].'" name="eu1_'.$pl['id2'].'" value="0" type="hidden"><span class="nprsl0" id="e1_'.$pl['id2'].'" onclick="eff(1,'.$pl['id2'].');">'.$ef.'</span>';
-	$ef2 .= '<input id="eu2_'.$pl['id2'].'" name="eu2_'.$pl['id2'].'" value="0" type="hidden"><span class="nprsl0" id="e2_'.$pl['id2'].'" onclick="eff(2,'.$pl['id2'].');">'.$ef.'</span>';
-}
-//
-$dv = '';
-$da = '';
-$dv .= '<select style="font-size:12px;" name="botadminatack2"><option value="0">------ �������� ����� �� ������ ------</option>';
-$sp_m = mysql_query('SELECT * FROM `users` WHERE `icq` = "17768719" ORDER BY `id` ASC');
-while($pl_m = mysql_fetch_array($sp_m) ) {
-	$dv .= '<option value="'.$pl_m['id'].'">'.$pl_m['id'].' [ '.$pl_m['align'].' ] - '.$pl_m['login'].' ['.$pl_m['level'].']</option>';
-	$da .= '<option value="'.$pl_m['id'].'">'.$pl_m['id'].' [ '.$pl_m['align'].' ] - '.$pl_m['login'].' ['.$pl_m['level'].']</option>';
-}
-$dv .= '</select>';
-$da = '<select style="font-size:12px;" name="botadminatack1"><option value="0">------ �������� ����� �� ������ ------</option>'.$da.'</select>';
-?>
-<table width="700" border="0" cellpadding="10" cellspacing="10">
-  <tr>
-    <td width="350" align="center" valign="middle">&nbsp;
-      <p>
-        <?=$da?>
-        &nbsp;</p>
-      <p>&nbsp;</p></td>
-    <td align="center" valign="middle">&nbsp; <b>������</b> &nbsp;</td>
-    <td width="350" align="center" valign="middle">&nbsp;
-      <p>
-        <?=$dv?>
-        &nbsp;</p>
-      <p>&nbsp;</p></td>
-  </tr>
-  <tr>
-    <td align="center" valign="middle"><?=$ef1?></td>
-    <td align="center" valign="middle">&nbsp;<b style="color:#03C">�������<br></b>&nbsp;</td>
-    <td align="center" valign="middle"><?=$ef2?></td>
-  </tr>
-  <tr>
-    <td align="center" valign="middle">&nbsp;</td>
-    <td align="center" valign="middle"><br><br><input class="btnnew" type="submit" value="������!"></td>
-    <td align="center" valign="middle">&nbsp;</td>
-  </tr>
-  </table>
-<br>
-</form>
+                $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 = '��� ����� <u>' . $user1['login'] . '</u> [' . $user1['level'] . '] <a  target="_blank" href="/inf.php?' . $bot1 . '"><img src="https://img.new-combats.com/i/inf_capitalcity.gif"></a> � <u>' . $user2['login'] . '</u> [' . $user2['level'] . '] <a href="/inf.php?' . $bot2 . '" target="_blank"><img src="https://img.new-combats.com/i/inf_capitalcity.gif"></a> �������! <a href="/logs.php?log=' . $logid . '" target="_blank">��� ���</a>';
+            } else {
+                $error = '���� �� ���������� �� ������ � ����.';
+            }
+
+            echo '<div style="color:red"><b>' . $error . '</b></div>';
+        }
+
+        //
+        $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 .= '<br>' . $u->is[$n] . ': ' . $z . '' . $ed['add_' . $n];
+                }
+                $x++;
+            }
+            if ($tr != '') {
+                $ei .= $tr;
+            }
+            if ($e['info'] != '') {
+                $ei .= '<br><i>����������:</i><br>' . $e['info'];
+            }
+            //
+            $ef = '<img onmouseover="hi(this,\'<b>' . $pl['mname'] . '</b>' . $ei . '\',event,3,1,1,1,\'\');" onMouseOut="hic();" onMouseDown="hic();" src="https://img.new-combats.com/i/eff/' . $pl['img'] . '" width="40" height="25">';
+            $ef1 .= '<input id="eu1_' . $pl['id2'] . '" name="eu1_' . $pl['id2'] . '" value="0" type="hidden"><span class="nprsl0" id="e1_' . $pl['id2'] . '" onclick="eff(1,' . $pl['id2'] . ');">' . $ef . '</span>';
+            $ef2 .= '<input id="eu2_' . $pl['id2'] . '" name="eu2_' . $pl['id2'] . '" value="0" type="hidden"><span class="nprsl0" id="e2_' . $pl['id2'] . '" onclick="eff(2,' . $pl['id2'] . ');">' . $ef . '</span>';
+        }
+        //
+        $dv = '';
+        $da = '';
+        $dv .= '<select style="font-size:12px;" name="botadminatack2"><option value="0">------ �������� ����� �� ������ ------</option>';
+        $sp_m = mysql_query('SELECT * FROM `users` WHERE `icq` = "17768719" ORDER BY `id` ASC');
+        while ($pl_m = mysql_fetch_array($sp_m)) {
+            $dv .= '<option value="' . $pl_m['id'] . '">' . $pl_m['id'] . ' [ ' . $pl_m['align'] . ' ] - ' . $pl_m['login'] . ' [' . $pl_m['level'] . ']</option>';
+            $da .= '<option value="' . $pl_m['id'] . '">' . $pl_m['id'] . ' [ ' . $pl_m['align'] . ' ] - ' . $pl_m['login'] . ' [' . $pl_m['level'] . ']</option>';
+        }
+        $dv .= '</select>';
+        $da = '<select style="font-size:12px;" name="botadminatack1"><option value="0">------ �������� ����� �� ������ ------</option>' . $da . '</select>';
+        ?>
+        <table width="700" border="0" cellpadding="10" cellspacing="10">
+            <tr>
+                <td width="350" align="center" valign="middle">&nbsp;
+                    <p>
+                        <?= $da ?>
+                        &nbsp;</p>
+                    <p>&nbsp;</p></td>
+                <td align="center" valign="middle">&nbsp; <b>������</b> &nbsp;</td>
+                <td width="350" align="center" valign="middle">&nbsp;
+                    <p>
+                        <?= $dv ?>
+                        &nbsp;</p>
+                    <p>&nbsp;</p></td>
+            </tr>
+            <tr>
+                <td align="center" valign="middle"><?= $ef1 ?></td>
+                <td align="center" valign="middle">&nbsp;<b style="color:#03C">�������<br></b>&nbsp;</td>
+                <td align="center" valign="middle"><?= $ef2 ?></td>
+            </tr>
+            <tr>
+                <td align="center" valign="middle">&nbsp;</td>
+                <td align="center" valign="middle"><br><br><input class="btnnew" type="submit" value="������!"></td>
+                <td align="center" valign="middle">&nbsp;</td>
+            </tr>
+        </table>
+        <br>
+    </form>
 </center>
 </body>
 </html>
-<? } ?>
\ No newline at end of file
diff --git a/testrand.php b/testrand.php
deleted file mode 100644
index cc658c5e..00000000
--- a/testrand.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?

-$i=0;

-while($i<=130)

-{

-	

-	$ri=round(sqrt(2*$i*25));

-	

-	echo 'Zn: '.$i.' / Result: '.$ri. "<br>";

-	$i++;

-}

-

-?>
\ No newline at end of file
diff --git a/testtime.php b/testtime.php
deleted file mode 100644
index 0dedce87..00000000
--- a/testtime.php
+++ /dev/null
@@ -1,7 +0,0 @@
-<? 

-echo time();

-echo "<br>";

-echo date('w');

-echo "<br>";

-echo date('m');

-?>
\ No newline at end of file
diff --git a/testtimerm.php b/testtimerm.php
deleted file mode 100644
index 891de514..00000000
--- a/testtimerm.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE html>

-<html>

-<body>

-

-<button onclick="atack()" id="go_btn">go</button>

-

-<script>

-var cgo = 100;

-var tgo;

-var timer_is_on = 0;

-timedCount();

-function timedCount() {

-  document.getElementById("go_btn").innerHTML = cgo;

-  if (cgo > 0)

-  {

-	 tgo = setTimeout(timedCount, 50);

-	 cgo = cgo - 10;	 

-  }

-  else

-  {

-		clearTimeout(tgo);

-		timer_is_on = 0;

-		document.getElementById("go_btn").innerHTML = 'go!!!';

-  }

-}

-

-function stopCount() {

-  clearTimeout(tgo);

-  timer_is_on = 0;

-}

-</script>

-

-</body>

-</html>
\ No newline at end of file
diff --git a/time.php b/time.php
deleted file mode 100644
index 4edec48d..00000000
--- a/time.php
+++ /dev/null
@@ -1 +0,0 @@
-<?echo time();?>
\ 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 @@
-<?
-define('GAME',true);
-include('_incl_data/__config.php');
-include('_incl_data/class/__db_connect.php');
-include('_incl_data/class/__user.php');
+<?php
+const GAME = true;
+include_once '_incl_data/__config.php';
+include_once '_incl_data/class/__db_connect.php';
 
-$r = ''; $p = ''; $b = '<table width="100%" cellpadding="0" cellspacing="0" border="0">
+$r = '';
+$p = '';
+$b = '<table width="100%" cellpadding="0" cellspacing="0" border="0">
   <tbody>
     <tr valign="top">
       <td valign="bottom" nowrap="" title=""><input onClick="location=location;" style="padding:5px;" type="submit" name="analiz2" value="��������"></td>
     </tr>
   </tbody>
 </table>';
-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 = '<br><br><center>������ ����� ���������� ����� ������� ��������� � ��������� �������� ...</center>';
-}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 .= '<br><span class="date'.$datesb.'">'.date('d.m.y H:i',$pl['time']).'</span> '.$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 = '<br><br><center>������ ����� ���������� ����� ������� ��������� � ��������� �������� ...</center>';
+} 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 .= '<br><span class="date' . $datesb . '">' . date('d.m.y H:i', $pl['time']) . '</span> ' . $pl['text'] . '';
+    }
 }
 ?>
 <!DOCTYPE html>
 <html>
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
-<title>�����: ������ � ����� ������</title>
-<script src="https://img.new-combats.com/js/Lite/gameEngine.js" type="text/javascript"></script>
-<link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
-<style type="text/css">
-h3 {
-	text-align: center;
-}
-.CSSteam	{ font-weight: bold; cursor:pointer; }
-.CSSteam0	{ font-weight: bold; cursor:pointer; }
-.CSSteam1	{ font-weight: bold; color: #6666CC; cursor:pointer; }
-.CSSteam2	{ font-weight: bold; color: #B06A00; cursor:pointer; }
-.CSSteam3 	{ font-weight: bold; color: #269088; cursor:pointer; }
-.CSSteam4 	{ font-weight: bold; color: #A0AF20; cursor:pointer; }
-.CSSteam5 	{ font-weight: bold; color: #0F79D3; cursor:pointer; }
-.CSSteam6 	{ font-weight: bold; color: #D85E23; cursor:pointer; }
-.CSSteam7 	{ font-weight: bold; color: #5C832F; cursor:pointer; }
-.CSSteam8 	{ font-weight: bold; color: #842B61; cursor:pointer; }
-.CSSteam9 	{ font-weight: bold; color: navy; cursor:pointer; }
-.CSSvs 		{ font-weight: bold; }
-</style>
+    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"/>
+    <title>�����: ������ � ����� ������</title>
+    <script src="https://img.new-combats.com/js/Lite/gameEngine.js" type="text/javascript"></script>
+    <link href="https://img.new-combats.com/css/main.css" rel="stylesheet" type="text/css">
+    <style type="text/css">
+        h3 {
+            text-align: center;
+        }
+
+        .CSSteam {
+            font-weight: bold;
+            cursor: pointer;
+        }
+
+        .CSSteam0 {
+            font-weight: bold;
+            cursor: pointer;
+        }
+
+        .CSSteam1 {
+            font-weight: bold;
+            color: #6666CC;
+            cursor: pointer;
+        }
+
+        .CSSteam2 {
+            font-weight: bold;
+            color: #B06A00;
+            cursor: pointer;
+        }
+
+        .CSSteam3 {
+            font-weight: bold;
+            color: #269088;
+            cursor: pointer;
+        }
+
+        .CSSteam4 {
+            font-weight: bold;
+            color: #A0AF20;
+            cursor: pointer;
+        }
+
+        .CSSteam5 {
+            font-weight: bold;
+            color: #0F79D3;
+            cursor: pointer;
+        }
+
+        .CSSteam6 {
+            font-weight: bold;
+            color: #D85E23;
+            cursor: pointer;
+        }
+
+        .CSSteam7 {
+            font-weight: bold;
+            color: #5C832F;
+            cursor: pointer;
+        }
+
+        .CSSteam8 {
+            font-weight: bold;
+            color: #842B61;
+            cursor: pointer;
+        }
+
+        .CSSteam9 {
+            font-weight: bold;
+            color: navy;
+            cursor: pointer;
+        }
+
+        .CSSvs {
+            font-weight: bold;
+        }
+    </style>
 </head>
 
 <body bgcolor="#E2E0E0">
 <H3> ����� ������. ����� � �������. &nbsp; <a href="https://www.new-combats.com/">www.new-combats.com</a></H3>
-<? if( $notowerlog == false ) { ?>
-�������� ����: <b><?=$log['m']?> ��.</b>
+<? if (!$notowerlog) { ?>
+    �������� ����: <b><?= $log['m'] ?> ��.</b>
 <? }
 echo $r; ?>
 </body>
diff --git a/transfer.php b/transfer.php
index 66f9bcec..c3f2b80c 100644
--- a/transfer.php
+++ b/transfer.php
@@ -1,386 +1,449 @@
 <?php
-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('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');
-if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')
-{
-	define('GAME',true);	
-	include('_incl_data/__config.php');
-	include('_incl_data/class/__db_connect.php');
-	include('_incl_data/class/__user.php');
-	
-	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 = 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'],'&quot;<font color="green">System.transfer.MONEY</font>&quot;: �������� '.$mn1.' ��. ��������� &quot;'.$inf[$u->tfer['uid2']]['login'].'&quot; ('.$inf[$u->tfer['uid2']]['id'].').',time(),$u->info['city'],'System.transfer',0,0);
-								$u->addDelo(2,$inf[$u->tfer['uid2']]['id'],'&quot;<font color="green">System.transfer.MONEY</font>&quot;: �������� '.$mn1.' ��. �� ��������� &quot;'.$inf[$u->tfer['uid1']]['login'].'&quot; ('.$inf[$u->tfer['uid1']]['id'].').',time(),$u->info['city'],'System.transfer',0,0);
-							}else{
-								$u->addDelo(2,$inf[$u->tfer['uid1']]['id'],'&quot;<font color="green">System.transfer.MONEY</font>&quot;: �������� '.$mn1.' ��. ��������� &quot;'.$inf[$u->tfer['uid2']]['login'].'&quot; ('.$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'],'&quot;<font color="green">System.transfer.MONEY</font>&quot;: �������� '.$mn2.' ��. ��������� &quot;'.$inf[$u->tfer['uid1']]['login'].'&quot; ('.$inf[$u->tfer['uid1']]['id'].').',time(),$u->info['city'],'System.transfer',0,0);
-								$u->addDelo(2,$inf[$u->tfer['uid1']]['id'],'&quot;<font color="green">System.transfer.MONEY</font>&quot;: �������� '.$mn2.' ��. �� ��������� &quot;'.$inf[$u->tfer['uid2']]['login'].'&quot; ('.$inf[$u->tfer['uid2']]['id'].').',time(),$u->info['city'],'System.transfer',0,0);
-							}else{
-								$u->addDelo(2,$inf[$u->tfer['uid2']]['id'],'&quot;<font color="green">System.transfer.MONEY</font>&quot;: �������� '.$mn2.' ��. ��������� &quot;'.$inf[$u->tfer['uid1']]['login'].'&quot; ('.$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,'&quot;<font color="green">System.transfer</font>&quot;: ������� &quot;<b>'.$pl['name'].'</b> (���������: '.$pl['1price'].' ��. , '.$pl['2price'].' ���.) (x'.$x.')&quot; [itm:'.$pl['id'].'] '.$i_s.' ��� ������� ��������� &quot;'.$us['login'].'&quot;('.$pl['uid'].'), ��� ��������: '.$pl['inTransfer'].'.',time(),$u->info['city'],'System.transfer',0,0);
-							$u->addDelo(2,$pl['uid'],'&quot;<font color="green">System.transfer</font>&quot;: �������� &quot;'.$uus['login'].'&quot;('.$uus['id'].') ������� ������� &quot;<b>'.$pl['name'].'</b> '.$i_s.' (���������: '.$pl['1price'].' ��. , '.$pl['2price'].' ���.) (x'.$x.')&quot; [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 = '<tr><td align="center" bgcolor="#e2e0e0">�����</td></tr>';
-					}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 .= '<img width="13" height="13" onClick="cancelitm('.$pl['id'].');" class="clr" src="https://img.new-combats.com/i/clear.gif" />';
-						}
-						$r .= '<a href="items_info.php?id='.$pl['item_id'].'&rnd='.$code.'" target="_blank">'.$pl['name'].''.$x.'</a><br>';
-						if($pl['inTransfer']==1)
-						{
-							$r .= '<img width="16" height="18" title="���� ������� ����� �������" src="https://img.new-combats.com/i/podarok.gif" />';
-						}else{
-							$r .= '<small style="font-size:10px">(�����: 1��.)</small>';
-						}
-						$r = '<table width="100%" border="0" cellspacing="0" cellpadding="5"><tr><td width="50" align="center"><img src="https://img.new-combats.com/i/items/'.$pl['img'].'" class="tfii"/></td><td valign="top" class="tfid">'.$r.'</td></tr></table>';
-						$r = '<div class="tfitm'.$cl.'">'.$r.'</div>';
-						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] = '&nbsp;';	
-					}
-					if($itm[2]=='')
-					{
-						$itm[2] = '&nbsp;';	
-					}
-					
-					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 '<script>'.$js.'</script>';	
-			}
-		}else{
-			echo '<script>location="main.php?transfer&rnd='.$code.'";</script>';	
-		}
-	}else{
-		echo '<script>location="main.php?transfer&exit_transfer&rnd='.$code.'";</script>';	
-	}
+    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'],
+                                    '&quot;<font color="green">System.transfer.MONEY</font>&quot;: �������� ' . $mn1 . ' ��. ��������� &quot;' . $inf[$u->tfer['uid2']]['login'] . '&quot; (' . $inf[$u->tfer['uid2']]['id'] . ').',
+                                    time(), $u->info['city'], 'System.transfer', 0, 0
+                                );
+                                $u->addDelo(
+                                    2, $inf[$u->tfer['uid2']]['id'],
+                                    '&quot;<font color="green">System.transfer.MONEY</font>&quot;: �������� ' . $mn1 . ' ��. �� ��������� &quot;' . $inf[$u->tfer['uid1']]['login'] . '&quot; (' . $inf[$u->tfer['uid1']]['id'] . ').',
+                                    time(), $u->info['city'], 'System.transfer', 0, 0
+                                );
+                            } else {
+                                $u->addDelo(
+                                    2, $inf[$u->tfer['uid1']]['id'],
+                                    '&quot;<font color="green">System.transfer.MONEY</font>&quot;: �������� ' . $mn1 . ' ��. ��������� &quot;' . $inf[$u->tfer['uid2']]['login'] . '&quot; (' . $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'],
+                                    '&quot;<font color="green">System.transfer.MONEY</font>&quot;: �������� ' . $mn2 . ' ��. ��������� &quot;' . $inf[$u->tfer['uid1']]['login'] . '&quot; (' . $inf[$u->tfer['uid1']]['id'] . ').',
+                                    time(), $u->info['city'], 'System.transfer', 0, 0
+                                );
+                                $u->addDelo(
+                                    2, $inf[$u->tfer['uid1']]['id'],
+                                    '&quot;<font color="green">System.transfer.MONEY</font>&quot;: �������� ' . $mn2 . ' ��. �� ��������� &quot;' . $inf[$u->tfer['uid2']]['login'] . '&quot; (' . $inf[$u->tfer['uid2']]['id'] . ').',
+                                    time(), $u->info['city'], 'System.transfer', 0, 0
+                                );
+                            } else {
+                                $u->addDelo(
+                                    2, $inf[$u->tfer['uid2']]['id'],
+                                    '&quot;<font color="green">System.transfer.MONEY</font>&quot;: �������� ' . $mn2 . ' ��. ��������� &quot;' . $inf[$u->tfer['uid1']]['login'] . '&quot; (' . $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,
+                                '&quot;<font color="green">System.transfer</font>&quot;: ������� &quot;<b>' . $pl['name'] . '</b> (���������: ' . $pl['1price'] . ' ��. , ' . $pl['2price'] . ' ���.) (x' . $x . ')&quot; [itm:' . $pl['id'] . '] ' . $i_s . ' ��� ������� ��������� &quot;' . $us['login'] . '&quot;(' . $pl['uid'] . '), ��� ��������: ' . $pl['inTransfer'] . '.',
+                                time(), $u->info['city'], 'System.transfer', 0, 0
+                            );
+                            $u->addDelo(
+                                2, $pl['uid'],
+                                '&quot;<font color="green">System.transfer</font>&quot;: �������� &quot;' . $uus['login'] . '&quot;(' . $uus['id'] . ') ������� ������� &quot;<b>' . $pl['name'] . '</b> ' . $i_s . ' (���������: ' . $pl['1price'] . ' ��. , ' . $pl['2price'] . ' ���.) (x' . $x . ')&quot; [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 = '<tr><td align="center" bgcolor="#e2e0e0">�����</td></tr>';
+                    } 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 .= '<img width="13" height="13" onClick="cancelitm(' . $pl['id'] . ');" class="clr" src="https://img.new-combats.com/i/clear.gif" />';
+                        }
+                        $r .= '<a href="items_info.php?id=' . $pl['item_id'] . '&rnd=' . $code . '" target="_blank">' . $pl['name'] . '' . $x . '</a><br>';
+                        if ($pl['inTransfer'] == 1) {
+                            $r .= '<img width="16" height="18" title="���� ������� ����� �������" src="https://img.new-combats.com/i/podarok.gif" />';
+                        } else {
+                            $r .= '<small style="font-size:10px">(�����: 1��.)</small>';
+                        }
+                        $r = '<table width="100%" border="0" cellspacing="0" cellpadding="5"><tr><td width="50" align="center"><img src="https://img.new-combats.com/i/items/' . $pl['img'] . '" class="tfii"/></td><td valign="top" class="tfid">' . $r . '</td></tr></table>';
+                        $r = '<div class="tfitm' . $cl . '">' . $r . '</div>';
+                        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] = '&nbsp;';
+                    }
+                    if ($itm[2] == '') {
+                        $itm[2] = '&nbsp;';
+                    }
+
+                    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 '<script>' . $js . '</script>';
+            }
+        } else {
+            echo '<script>location="main.php?transfer&rnd=' . $code . '";</script>';
+        }
+    } else {
+        echo '<script>location="main.php?transfer&exit_transfer&rnd=' . $code . '";</script>';
+    }
 }
-?>
\ No newline at end of file