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 e148e520..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'] = ''; +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 @@ -94,3 +31,9 @@ spl_autoload_register(function ($className) { } } }); + +$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 @@ + __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/Battle.php b/_incl_data/class/Battle.php deleted file mode 100644 index 3d1061b3..00000000 --- a/_incl_data/class/Battle.php +++ /dev/null @@ -1,11785 +0,0 @@ -users[$this->uids[$u1]]['login']); - $v_z = 0 + $this->stats[$this->uids[$u2]]['zm' . $type]; // - $v_p = 0 + round(($this->stats[$this->uids[$u1]]['pzm' . $type] + $this->stats[$this->uids[$u1]]['pzm']) * 0.4); // - $v_m = 0 + $this->stats[$this->uids[$u1]]['pm' . $type]; // - // - return ' magelogin=' . $v_l . ' onMouseOver=top.hi(this,maginfo(' . $v_z . ',' . $v_p . ',' . $v_m . ',this),event,3,1,1,1,null); onMouseOut=top.hic(); onMouseDown=top.hic(); '; - } - - public function typeBattle($x) - { - $r = [0, 0, ' ', ' ']; - if ($x < 50000) { - // - } elseif ($x >= 50000 && $x < 100000) { - $r = [25, 50, ' ', ' ']; - } elseif ($x < 500000) { - $r = [50, 75, ' ', ' ']; - } elseif ($x < 1000000) { - $r = [75, 100, ' ', ' ']; - } elseif ($x < 2500000) { - $r = [100, 125, ' ', ' ']; - } elseif ($x >= 5000000) { - $r = [150, 150, ' ', ' ']; - } - return $r; - } - - public $mncolor = [ - 1 => '006699', - 2 => '006699', - 3 => '006699', - 4 => '006699', - 5 => '006699', - 6 => '006699', - 7 => '006699', - ]; // - public $mcolor = [ - 1 => 'A00000', - 2 => '008080', - 3 => '0000FF', - 4 => 'A52A2A', - 5 => '006699', - 6 => '006699', - 7 => '006699', - ]; // - public $mname = [ - '' => 1, - '' => 2, - '' => 3, - '' => 4, - '' => 5, - '' => 6, - '' => 7, - ]; - public $prm = [ - /* - act: 1 - - 2 - - type_of: 1 - - 2 - - 3 - - 4 - - 5 - - */ - 1 => ['name' => '', 'act' => 1, 'type_of' => 5], - 2 => ['name' => '', 'act' => 2, 'type_of' => 3], - 4 => ['name' => ' ', 'act' => 2, 'type_of' => 3], - 7 => ['name' => ' ', 'act' => 1, 'type_of' => 4], - - - 290 => ['name' => ' ', 'act' => 1, 'type_of' => 4], - - // - //291 => array( 'name' => ' ', 'act' => 2, 'type_of' => 4 ), - - // - 294 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 295 => ['name' => '', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 296 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 297 => ['name' => '', 'act' => 2, 'type_of' => 0, 'moment' => 3], - 298 => ['name' => ' ', 'act' => 2, 'type_of' => 3], - // - - 141 => ['name' => ' ', 'act' => 2, 'type_of' => 4], - 147 => ['name' => ' ', 'act' => 2, 'type_of' => 4], - 148 => ['name' => ' ', 'act' => 2, 'type_of' => 4], - 149 => ['name' => ' ', 'act' => 2, 'type_of' => 4], - 150 => ['name' => ' ', 'act' => 2, 'type_of' => 4], - - - 142 => ['name' => ' ', 'act' => 2, 'type_of' => 4], - 144 => ['name' => ' ', 'act' => 2, 'type_of' => 4], - 146 => ['name' => ' ', 'act' => 2, 'type_of' => 4], - 145 => ['name' => ' ', 'act' => 2, 'type_of' => 4], - - 8 => ['name' => ' ', 'act' => 1, 'type_of' => 1], - 9 => ['name' => ' ', 'act' => 2, 'type_of' => 3], - 10 => ['name' => '', 'act' => 1, 'type_of' => 1], - 11 => ['name' => ' ', 'act' => 2, 'type_of' => 3], - - 45 => ['name' => ' ', 'act' => 1, 'type_of' => 4], - - 47 => ['name' => ' ', 'act' => 2, 'type_of' => 2], - 48 => ['name' => ' ', 'act' => 1, 'type_of' => 1], - 49 => ['name' => ' ', 'act' => 1, 'type_of' => 1], - 138 => ['name' => ' ', 'act' => 2, 'type_of' => 3], - 140 => ['name' => ' ', 'act' => 1, 'type_of' => 4], - 193 => ['name' => ' ', 'act' => 2, 'type_of' => 3], - //204 => array( 'name' => '', 'act' => 2 , 'type_of' => 5 ), - 204 => ['name' => '', 'act' => 2, 'type_of' => 0, 'moment' => 3], - 211 => ['name' => ' ', 'act' => 1, 'type_of' => 4], - 213 => ['name' => ' ', 'act' => 1, 'type_of' => 4], - 215 => ['name' => ' ', 'act' => 1, 'type_of' => 1], - 216 => ['name' => ' ', 'act' => 2, 'type_of' => 2], - 217 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 3], - 219 => ['name' => ' ', 'act' => 2, 'type_of' => 3], - 220 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 3], - 222 => ['name' => ' ', 'act' => 2, 'type_of' => 3], - 225 => ['name' => ' ', 'act' => 1, 'type_of' => 4], - 226 => ['name' => '', 'act' => 1, 'type_of' => 4], - 231 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 3], - 234 => ['name' => '', 'act' => 2, 'type_of' => 4], - 235 => ['name' => ' ', 'act' => 2, 'type_of' => 3], - 342 => ['name' => ' ', 'act' => 0, 'type_of' => 0], - 343 => ['name' => '', 'act' => 0, 'type_of' => 0], - - 237 => ['name' => ' ', 'act' => 2, 'type_of' => 3 /*, 'moment' => 3*/], - - 239 => ['name' => ' ', 'act' => 2, 'type_of' => 3], - 240 => ['name' => ' ', 'act' => 2, 'type_of' => 5] - - // - , - 21 => ['name' => ' [4]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 73 => ['name' => ' [5]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 74 => ['name' => ' [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 75 => ['name' => ' [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 76 => ['name' => ' [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 77 => ['name' => ' [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 78 => ['name' => ' [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 79 => ['name' => ' [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - - // - , - 22 => ['name' => ' [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 80 => ['name' => ' [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 81 => ['name' => ' [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 82 => ['name' => ' [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 83 => ['name' => ' [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 84 => ['name' => ' [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - - // - , - 36 => ['name' => ' [5]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 85 => ['name' => ' [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 86 => ['name' => ' [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 87 => ['name' => ' [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 88 => ['name' => ' [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 89 => ['name' => ' [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 90 => ['name' => ' [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - - // - , - 23 => ['name' => ' [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 70 => ['name' => ' [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 71 => ['name' => ' [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 72 => ['name' => ' [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - - // - , - 269 => ['name' => ' [8]', 'act' => 2, 'type_of' => 9] - , - 276 => ['name' => ' [9]', 'act' => 2, 'type_of' => 9] - , - 277 => ['name' => ' [10]', 'act' => 2, 'type_of' => 9] - - // - , - 270 => ['name' => ' ', 'act' => 2, 'type_of' => 5, 'type_sec' => 5] - - // - , - 280 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - - // - , - 281 => ['name' => ' ', 'act' => 2, 'type_of' => 5] - - // - , - 282 => ['name' => ' ', 'act' => 2, 'type_of' => 5] - - // - // - - // - , - 24 => ['name' => '', 'act' => 2, 'type_of' => 0, 'moment' => 3] - - // - , - 210 => ['name' => ' [4]', 'act' => 2, 'type_of' => 8] - , - 209 => ['name' => ' [7]', 'act' => 2, 'type_of' => 8] - , - 208 => ['name' => ' [8]', 'act' => 2, 'type_of' => 8] - , - 207 => ['name' => ' [9]', 'act' => 2, 'type_of' => 8] - , - 206 => ['name' => ' [10]', 'act' => 2, 'type_of' => 8] - , - 284 => ['name' => ' [11]', 'act' => 2, 'type_of' => 8] - - // - , - 175 => ['name' => ' [7]', 'act' => 2, 'type_of' => 8] - , - 176 => ['name' => ' [8]', 'act' => 2, 'type_of' => 8] - , - 177 => ['name' => ' [9]', 'act' => 2, 'type_of' => 8] - , - 178 => ['name' => ' [10]', 'act' => 2, 'type_of' => 8] - , - 179 => ['name' => ' [11]', 'act' => 2, 'type_of' => 8] - - // - // - - // - , - 42 => ['name' => ' [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 121 => ['name' => ' [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 122 => ['name' => ' [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 123 => ['name' => ' [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 124 => ['name' => ' [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 125 => ['name' => ' [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - - // - , - 249 => ['name' => ' ', 'act' => 2, 'type_of' => 4] - - // - , - 248 => ['name' => ' ', 'act' => 2, 'type_of' => 4] - - // - , - 251 => ['name' => ': ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 252 => ['name' => ': ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - - // - // - - // - , - 273 => ['name' => ' [10]', 'act' => 1, 'type_of' => 4] - , - 286 => ['name' => ' [9]', 'act' => 1, 'type_of' => 4] - , - 287 => ['name' => ' [8]', 'act' => 1, 'type_of' => 4] - , - 288 => ['name' => ' [7]', 'act' => 1, 'type_of' => 4] - - // - , - 255 => ['name' => ' ', 'act' => 2, 'type_of' => 8] - - // - // - - // - , - 337 => ['name' => ' ', 'act' => 2, 'type_of' => 5] - - // - , - 33 => ['name' => ' [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 56 => ['name' => ' [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 57 => ['name' => ' [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 58 => ['name' => ' [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 59 => ['name' => ' [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 60 => ['name' => ' [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - - // - , - 245 => ['name' => ' ', 'act' => 2, 'type_of' => 9] - // - , - 327 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 3] - , - 328 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 329 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 330 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 331 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 332 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 333 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 3] - , - 334 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 335 => [ - 'name' => ' ', - 'act' => 2, - 'type_of' => 0, - 'moment' => 0, - 'moment_end' => 3, - ] - //1 , - , - 299 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 300 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 301 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 302 => ['name' => '', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 303 => ['name' => ' ', 'act' => 2, 'type_of' => 4] - , - 304 => ['name' => ' !', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3] - , - 305 => ['name' => '', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - ]; - - // - public function saveLogs($id, $type) - { - if ($type == 'all') { - $type = ''; - mysql_query('INSERT INTO `battle_logs_save` SELECT `id`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type` FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` <= ' . ($this->hodID) . ''); - } else { - mysql_query('INSERT INTO `battle_logs_save` SELECT `id`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type` FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` <= ' . ($this->hodID - 5) . ''); - } - mysql_query('DELETE FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" ' . $type . ''); - mysql_query('DELETE FROM `battle_stat` WHERE `battle` < "' . ($this->info['id'] - 100) . '" '); - mysql_query('DELETE FROM `battle_actions` WHERE `btl` = "' . $this->info['id'] . '" '); - //mysql_query('OPTIMIZE TABLE `battle_logs`'); - //mysql_query('OPTIMIZE TABLE `battle_stat`'); - //mysql_query('OPTIMIZE TABLE `battle_actions`'); - } - - public function hphe($uid, $hp, $false_t7 = false) - { - global $u; - if (!isset($this->stats[$this->uids[$uid]])) { - echo 'WARNING! ! !'; - } else { - $hpnow = floor($this->stats[$this->uids[$uid]]['hpNow']); - $hpall = $this->stats[$this->uids[$uid]]['hpAll']; - if ($hp > 0) { - // - if ($hpnow + $hp > $hpall) { - $hpli = $hpnow + $hp - $hpall; - $hp -= $hpli; - } - if (isset($this->stats[$this->uids[$uid]]['min_heal_proc']) && $this->stats[$this->uids[$uid]]['min_heal_proc'] < -99) { - $hp = 0; - } else { - $hp = $hp / 100 * (100 + $this->stats[$this->uids[$uid]]['min_heal_proc']); - } - // - if ($false_t7 == false) { - if ($this->users[$this->uids[$uid]]['tactic7'] <= 0) { - $hp = 0; - $this->users[$this->uids[$uid]]['tactic7'] = 0; - $this->stats[$this->uids[$uid]]['tactic7'] = $this->users[$this->uids[$uid]]['tactic7']; - } else { - $gdhh = round($hp / $this->stats[$this->uids[$uid]]['hpAll'] * 10, 2); - if ($gdhh == 0) { - $gdhh = 0.01; - } - - $gdhd = round($this->users[$this->uids[$uid]]['tactic7'] / $gdhh * 100); - - $this->users[$this->uids[$uid]]['tactic7'] = round(($this->users[$this->uids[$uid]]['tactic7'] - $gdhh), - 2); - if ($this->users[$this->uids[$uid]]['tactic7'] < 0) { - $this->users[$this->uids[$uid]]['tactic7'] = 0; - } - $this->stats[$this->uids[$uid]]['tactic7'] = $this->users[$this->uids[$uid]]['tactic7']; - if ($gdhd < 100) { - $hp = floor($hp / 100 * $gdhd); - } - } - } - } elseif ($hp < 0) { - // - if ($hpnow + $hp < 0) { - $hpli = $hpnow + $hp; - $hp += -($hpli); - } - } - - if ($this->stats[$this->uids[$uid]]['hpNow'] < 1) { - $hp = 0; - } - - $this->stats[$this->uids[$uid]]['last_hp'] = -$hp; - mysql_query('UPDATE `stats` SET - `last_hp` = "' . $this->users[$this->uids[$uid]]['last_hp'] . '", - `tactic7` = "' . $this->users[$this->uids[$uid]]['tactic7'] . '" - WHERE `id` = "' . $uid . '" LIMIT 1'); - } - - return floor($hp); - } - - public function deleffm($pid, $uid, $id) - { - if ($id > 0) { - if (!mysql_query('DELETE FROM `eff_users` WHERE `id` = "' . mysql_real_escape_string($id) . '" AND `v1` = "priem" AND `v2` != "0" LIMIT 1')) { - echo '[* [' . $id . ',' . $pid . ',' . $uid . ']]'; - } - } else { - if (!mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . mysql_real_escape_string($uid) . '" AND `v1` = "priem" AND `v2` = "' . $pid . '"')) { - } - } - //echo '['.$id.','.$pid.','.$uid.']'; - } - - - public $e, // () - $cached = false, // - $expCoef = 0, # % - $aBexp = 0, // - $mainStatus = 1, // (1 - , 2 - , 3 - . ) - $info = [], // - $users = [], // - $stats = [], // - $uids = [], // id stats users id = 555 , $uids[555] users \ stats - $atacks = [], // () - $ga = [], // uid $ga[ {id } ][ {id } ] - $ag = [], // uid $ga[ {id } ][ {id } ] - $na = 1, // - $np = 1, // - $nm = 1, // - $hodID = 0, - $stnZbVs = 0, - $bots = [], // ID - $iBots = [], // i - $stnZb = [], - $uAtc = [ - 'id' => 0, - 'a' => [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0], - 'b' => 0, - ], // - $lg_itm = [ - 0 => [ - '', - ' ', - '', - '', - '', - ' ', - ' ', - '', - ], - 1 => ['', ' ', ' ', ' '], - 2 => [' ', '', ' ', '', ' '], - 3 => ['', '', ' ', '', ' ', ' '], - 4 => [ - '', - '', - '', - ' ', - ' ', - ' ', - ' ', - ' ', - ], - 5 => [' ', '', ' ', ' ', ' '], - 22 => [''], - ], // - $lg_zon = [ - 1 => [ - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ], - 2 => [' ', ' ', ' ', ' ', ' '], - 3 => [' ', ' ', ' ', ' '], - 4 => [' < >', ' ', ' ', ' ', ' '], - 5 => [' ', ' ', ' ', ' ', ' '], - ]; // - public $is = [], $items = []; - - // ... - public $uclearc = [], $ucleari = []; - - public function clear_cache($uid) - { - if ($uid > 0 && !isset($this->uclearc[$uid])) { - $this->uclearc[$uid] = true; - $this->ucleari[] = $uid; - } - } - - public function clear_cache_start() - { - $i = 0; - while ($i < count($this->ucleari)) { - mysql_query('DELETE FROM `battle_cache` WHERE `uid` = "' . mysql_real_escape_string($this->ucleari[$i]) . '"'); - $i++; - } - } - - // - public function testYronPriemAttack($pid, $u1, $u2, $hp) - { - // 1 2 pid hp . - - /* - - */ - // - $eff = $this->stats[$this->uids[$u2]]['effects']; - $j = 0; - while ($j <= count($eff)) { - if (isset($eff[$j]) && $eff[$j]['id_eff'] == 22 && $eff[$j]['v1'] == 'priem' && $eff[$j]['v2'] > 0) { - // id $eff[$j]['v2'] - if ($eff[$j]['v2'] == 140 || $eff[$j]['v2'] == 211 || $eff[$j]['v2'] == 45) { //|| $eff[$j]['v2'] == 45 - // = 1 , 0 - $hp['y'] = -1; - $hp['r'] = 1; - $hp['k'] = 2; - $hp['m_y'] = 1; - $hp['m_k'] = 2; - } - } - $j++; - } - unset($eff); - - return $hp; - } - - // . - public function magKrit($l2, $t) - { - $r = 0; - $r = $l2 * 2 - 7; - if ($r > $t) { - // ( , 2 ) 6% - //250 . 1% - //$r = -1; , -- - $r = 0; - } else { - // 3% - $r = ceil($t * 0.75); - if ($r > 30) { - $r = 30; - } - if (rand(0, 10000) < $r * 100) { - // - $r = 1; - } else { - $r = 0; - } - } - return $r; - } - - - // - public function hpRef() - { - } - - // - public function testExp($y, $s1, $s2, $id1, $id2) - { - global $u, $c; - - - // - $oplevel = [ // . - 0 => 1, - 1 => 1, - 2 => 1, - 3 => 1, - 4 => 2, - 5 => 2, - 6 => 2, - 7 => 2, - 8 => 3, - 9 => 4, - 10 => 5, - 11 => 6, - 12 => 7, - 13 => 50, - 14 => 75, - ]; - - if ($y < 0) { - $y = 0; - } - if ($s2['hpNow'] < 0) { - //echo '[f]'; - $y = 0; - } - if ($s2['hpNow'] < $y) { - //echo '[d]'; - $y = $s2['hpNow']; - } - if ($y < 0) { /*echo '[r]';*/ - $y = 0; - } - // - // $addExp = 0+(($y/$s2['hpAll'])*100); - $addExp = 0 + ($y * $oplevel[$this->users[$this->uids[$s2['id']]]['level']]); - if ($s2['hpAll'] - $y <= 0) { - //echo '[a]'; - $addExp = 100; - } - - //if($this->users[$this->uids[$s2['id']]]['host_reg'] == 'real_bot_user') { - // $addExp = floor($addExp*0.76); - //} - - if ($addExp < 0) { - $addExp = 0; - } - if ($s2['levels'] != 'undefined' && $this->users[$this->uids[$s2['id']]]['pass'] != 'saintlucia') { - //$doexp = mysql_fetch_array(mysql_query('SELECT SUM(`items_main`.`price1`) FROM `items_users`,`items_main` WHERE `items_users`.`inOdet` > 0 AND `items_main`.`inSlot` < 50 AND `items_users`.`uid` = "'.$id2.'" AND `items_users`.`delete` = 0 AND `items_main`.`id` = `items_users`.`item_id` ORDER BY `items_main`.`inSlot` ASC LIMIT 50')); - //if($doexp[0]>0) { - // $doexp = floor($doexp[0]/15); - //}else{ - // $doexp = 0; - //} - //$doexp = floor(($this->users[$this->uids[$id2]]['btl_cof']-$this->users[$this->uids[$id1]]['btl_cof']*0.80)/5); - /*if( $this->users[$this->uids[$id2]]['btl_cof'] > $this->users[$this->uids[$s2['id']]]['level']*350 ) { - // - $doexp = floor($this->users[$this->uids[$s2['id']]]['level']*350 + ($this->users[$this->uids[$id2]]['btl_cof']/20)); - }else{ - // - $doexp = floor(($this->users[$this->uids[$id2]]['btl_cof'])); - }*/ - - if ($doexp < 0) { - $doexp = 0; - } - //$addExp = $addExp*(1+($s2['levels']['expBtlMax']+$s2['irka'])+($doexp*1.01/10))/100; - /* - $bmxx = $s2['levels']['expBtlMax']; - - if ($s2['levels']['bprice'] == 0) - { - $bmxx = round( $bmxx * $s2['prckr']); - } - else - { - $bmxx = round( $bmxx * ( $s2['prckr'] / $s2['levels']['bprice'] ) ); - } - - if( $bmxx < $s2['levels']['expBtlMax'] / 2 ) { - $bmxx = round($s2['levels']['expBtlMax']/5); - } - - if( $this->info['type'] == 1 ) { - $addExp = $addExp*($bmxx/10)/100; - }else{ - $xty = 0; - - // $xty = ($s2['reting']-$s1['reting']/2); - // if( $xty < 0 ) { - // $xty = 0; - // } - - $addExp = $addExp*(($bmxx+$xty))/100; - }*/ - - - //echo '( : '.$s2['levels']['expBtlMax'].')'; - // - if ($this->info['razdel'] != 5 && $c['exp_limit_many'] == true) { - $texp = mysql_fetch_array(mysql_query('SELECT COUNT(`a`.`id`) FROM `battle_users` AS `a` WHERE `a`.`uid` = "' . $id1 . '" AND `a`.`battle` IN ( SELECT `b`.`battle` FROM `battle_users` AS `b` WHERE `b`.`uid` = "' . $id2 . '" AND `b`.`team` != `a`.`team` AND `b`.`time` > "' . (time() - 86400) . '" ) LIMIT 1')); - $texp = $texp[0]; - // - if ($texp > 5) { - $addExp = $addExp * 0.00; - } elseif ($texp > 4) { - $addExp = $addExp * 0.50; - } elseif ($texp > 3) { - $addExp = $addExp * 0.75; - } elseif ($texp > 2) { - $addExp = $addExp * 1.00; - } elseif ($texp > 1) { - $addExp = $addExp * 1.00; - } else { - $addExp = $addExp * 1.00; - } - } - // - if ($this->users[$this->uids[$s2['id']]]['bot'] > 0) { - //$addExp = round($addExp/5); - } - unset($doexp); - } else { - $addExp = 0; - } - - /* - if($s1['level'] > $s2['level']){ - $minProc = 100 - 33*( $s1['level']-$s2['level'] ); - if($minProc < 1) { - $minProc = 1; - } - $addExp = round($addExp/100*$minProc); - } - */ - - if ($this->users[$this->uids[$s2['id']]]['bot_id'] == 0 && $this->stats[$this->uids[$s2['id']]]['itmslvl'] == 0) { - //$addExp = 0; - } - - if ($this->info['typeBattle'] == 9) { - // - // 8 - /*if( $this->users[$this->uids[$s1['id']]]['level'] > $this->users[$this->uids[$s2['id']]]['level'] ) { - if( $this->users[$this->uids[$s2['id']]]['level'] <= 8 ) { - $addExp = 0; - } - }*/ - } - - return $addExp; - } - - // \ - public function takeExp($id, $y, $id1, $id2, $mgregen = false, $nobattle_uron = false) - { - global $u; - if (isset($this->users[$this->uids[$id]])) { - $s1 = $this->stats[$this->uids[$id1]]; - $s2 = $this->stats[$this->uids[$id2]]; - if ($id1 != $id2) { - $e = $this->testExp($y, $s1, $s2, $id1, $id2); - } else { - $e = 0; - } - /* - if( $this->users[$this->uids[$id1]]['level'] > $this->users[$this->uids[$id2]]['level'] ) { - $rez = $this->users[$this->uids[$id1]]['level']-$this->users[$this->uids[$id2]]['level']; - $e = round($e/100*(21-$rez*3)); - if( $e < 0 ) { - $e = 0; - } - }*/ - - if ((int)$this->users[$this->uids[$id1]]['bot_id'] == 0 && $this->users[$this->uids[$id1]]['dnow'] != 0 && $this->info['dungeon'] != 1) { - $dun_limitForLevel = [ // . - 4 => 750, - 5 => 1500, - 6 => 3500, - 7 => 8000, - 8 => 25000, - 9 => 50000, - 10 => 75000, - 11 => 125000, - 12 => 250000, - 13 => 500000, - 14 => 750000, - ]; - $dun_expFactor = [ // . - 4 => 5, - 5 => 5, - 6 => 5, - 7 => 5, - 8 => 5, - 9 => 3, - 10 => 1, - 11 => 1, - 12 => 1, - 13 => 1, - 14 => 1, - ]; - - if (isset($dun_expFactor[(int)$this->users[$this->uids[$id1]]['level']])) { - $e = $e * $dun_expFactor[(int)$this->users[$this->uids[$id1]]['level']]; - } - if ($this->info['dungeon'] > 1 && $this->users[$this->uids[$id1]]['battle'] > 0) { // - $dun_exp = []; // . - $rep = mysql_fetch_array(mysql_query('SELECT `dungeonexp`,`id` FROM `rep` WHERE `id` = "' . $this->users[$this->uids[$id1]]['id'] . '" LIMIT 1')); - $rep = explode(',', $rep['dungeonexp']); - foreach ($rep as $key => $val) { - $val = explode('=', $val); - if (isset($val[0]) && isset($val[1]) && $val[0] != '' && $val[1] != 0) { - $dun_exp[(int)$val[0]] = (int)$val[1]; - } // - } - unset($rep); - - if (!isset($dun_exp[$this->info['dungeon']])) { - $dun_exp[$this->info['dungeon']] = 0; - } - if (!isset($dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']])) { // , . - $e = 0; - } elseif ( - isset($dun_exp[$this->info['dungeon']]) && - $dun_exp[$this->info['dungeon']] >= $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] - ) { // , . - $e = 0; - } elseif ( - isset($dun_exp[$this->info['dungeon']]) && - $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] > $dun_exp[$this->info['dungeon']] - ) { // . - if (($dun_exp[$this->info['dungeon']] + $e) > $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']]) { - // , . - $e = abs($e - abs($dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] - ($e + $dun_exp[$this->info['dungeon']]))); - $dun_exp[$this->info['dungeon']] += $e; - } elseif ($dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] > ($dun_exp[$this->info['dungeon']] + $e)) { - // , . - $e = $e; - $dun_exp[$this->info['dungeon']] += $e; - } else { - $e = 0; - } - } else { // . - $e = 0; - } - } else { - $e = $e; - } // . - if ($this->info['dungeon'] == 102 && (int)$this->users[$this->uids[$id1]]['bot_id'] == 0) { - $e = floor($e * 0.002); - } - } - /* - if( (int)$this->users[$this->uids[$id1]]['bot_id'] == 0 && $this->users[$this->uids[$id1]]['dnow'] != 0 && $this->info['dungeon'] != 1 ) { - if($this->users[$this->uids[$id1]]['level'] >= 7 ) { - $itmsCfc = ($s1['itmsCfc']+$s2['itmsCfc'])/26; - $itmsCfc = round($itmsCfc,5); - $e = $e*$itmsCfc; - } - }*/ - - $this->users[$this->uids[$id1]]['battle_exp'] += floor($e);//round($e,5); - //echo '[['.$id1.']+'.$e.']'; - // - if ($mgregen == false && $nobattle_uron == false) { - $this->users[$this->uids[$id1]]['battle_yron'] += floor($y); - if ($this->stats[$this->uids[$id1]]['notactic'] != 1) { - if ($s2['hpAll'] <= 1000) { - if ($this->stats[$this->uids[$id2]]['this_animal'] == 0) { - $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / $s2['hpAll'] * 100), - 10); - } else { - $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / $s2['hpAll'] * 100), - 10) / 3; - } - } else { - if ($this->stats[$this->uids[$id2]]['this_animal'] == 0) { - $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / 1000 * 100), 10); - } else { - $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / 1000 * 100), 10) / 3; - } - } - } - } - - //if($y != 0) { - // $this->users[$this->uids[$id1]]['tactic6'] = -$y; - //} - //if($u->info['admin'] > 0 ) { - // echo '['.$id1.' '.$id2.' +'.$y.' +'.$e.' ]'; - //} - - $upd = mysql_query('UPDATE `stats` SET `last_hp` = "' . $this->users[$this->uids[$id1]]['last_hp'] . '",`tactic6` = "' . $this->users[$this->uids[$id1]]['tactic6'] . '",`battle_yron` = "' . $this->users[$this->uids[$id1]]['battle_yron'] . '",`battle_exp` = "' . $this->users[$this->uids[$id1]]['battle_exp'] . '" WHERE `id` = "' . ((int)$id1) . '" LIMIT 1'); - if (!$upd) { - echo '[ ]'; - } else { - $this->stats[$this->uids[$id1]]['battle_exp'] = $this->users[$this->uids[$id1]]['battle_exp']; - $this->clear_cache($id1); - $this->stats[$this->uids[$id1]]['tactic6'] = $this->users[$this->uids[$id1]]['tactic6']; - if ($id1 == $u->info['id']) { - $u->info['tactic6'] = $this->users[$this->uids[$id1]]['tactic6']; - $u->stats['tactic6'] = $this->users[$this->uids[$id1]]['tactic6']; - $u->info['battle_exp'] = $this->users[$this->uids[$id1]]['battle_exp']; - $u->info['battle_yron'] = $this->users[$this->uids[$id1]]['battle_yron']; - $u->info['notactic'] = $this->users[$this->uids[$id1]]['notactic']; - $u->stats['notactic'] = $this->users[$this->uids[$id1]]['notactic']; - } - } - unset($s1, $s2); - } - } - - // - public function takeYronNow($uid, $y) - { - global $u; - if (!is_numeric($y) || !is_numeric($uid)) { - return; - } - (int)$y = floor($y); - $this->users[$this->uids[$uid]]['battle_yron'] += $y; - $this->stats[$this->uids[$uid]]['battle_yron'] += $y; - if ($uid == $u->info['id']) { - $u->info['battle_yron'] += $y; - $u->stats['battle_yron'] += $y; - } - mysql_query("UPDATE stats SET battle_yron = battle_yron + $y WHERE id = " . $uid); - } - - //JS - public function myInfo($id, $t) - { - global $c, $u; - if (isset($this->users[$this->uids[$id]]) || $u->info['id'] == $id) { - if ($u->info['id'] == $id || ($u->info['enemy'] == $id && $id > 0)) { - // - $this->users[$this->uids[$id]] = mysql_fetch_array(mysql_query('SELECT - - `u`.`zag`,`u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`, - `u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money2`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`, - `u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`, - `u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`activ`,`u`.`stopexp`,`u`.`real`, - - `st`.* - - FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = "' . $id . '" LIMIT 1')); - $this->stats[$this->uids[$id]] = $u->getStats($this->users[$this->uids[$id]], 0, 0, false, false, true); - $this->stats[$this->uids[$id]]['items'] = $this->stats[$this->uids[$id]]['items']; - $this->stats[$this->uids[$id]]['effects'] = $this->stats[$this->uids[$id]]['effects']; - /* - $ur = $this->users[$this->uids[$id]]; - $st = $this->stats[$this->uids[$id]]; - $itm = $this->stats[$this->uids[$id]]['items']; - $eff = $this->stats[$this->uids[$id]]['effects']; - */ - } - - //ssecho '['.$id.' -> '.$this->users[$this->uids[$id]]['last_hp'].']'; - - $ur = $this->users[$this->uids[$id]]; - $st = $this->stats[$this->uids[$id]]; - $itm = $this->stats[$this->uids[$id]]['items']; - $eff = $this->stats[$this->uids[$id]]['effects']; - $ef = ''; - $i = 0; - //effs_hide.gif - if ($u->info['seff'] < 1) { - //$ef .= '
'; - $ef .= '
\',event,3,1,1,1,\'\');\" onmouseout=\"top.hic();\" onmousedown=\"top.hic();\">
'; - - while ($i != -1) { - $nseef = 0; - if ($this->users[$this->uids[$ur['id']]]['id'] != $u->info['id'] && $ur['id'] != 0) { - if ($this->stats[$this->uids[$ur['id']]]['seeAllEff'] != 1) { - $nseef = 1; - if ($eff[$i]['v1'] == 'priem') { - $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1')); - } - if (isset($eff[$i]['priem']['id']) && $eff[$i]['priem']['neg'] == 1) { - $nseef = 0; - } - } - } - - if (isset($eff[$i]) && $eff[$i] != 'delete') { - if ($nseef == 0) { - $ei = '' . $eff[$i]['name'] . ''; - if ($eff[$i]['x'] > 1) { - //$ei .= ' [x'.$eff[$i]['x'].'] '; - $ei .= ' x' . $eff[$i]['x'] . ' '; - } - if ($eff[$i]['type1'] > 0 && $eff[$i]['type1'] < 7) { - $ei .= ' ()'; - } elseif (($eff[$i]['type1'] > 6 && $eff[$i]['type1'] < 11) || $eff[$i]['type1'] == 16) { - $ei .= ' ()'; - } elseif ($eff[$i]['type1'] == 14) { - $ei .= ' ()'; - } elseif ($eff[$i]['type1'] == 15) { - $ei .= ' ()'; - } elseif ($eff[$i]['type1'] == 17) { - $ei .= ' ()'; - } elseif ($eff[$i]['type1'] == 18 || $eff[$i]['type1'] == 19) { - $ei .= ' ()'; - } elseif ($eff[$i]['type1'] == 20) { - $ei .= ' ()'; - } elseif ($eff[$i]['type1'] == 22) { - $ei .= ' ()'; - } else { - $ei .= ' ()'; - } - $ei .= '
'; - - $out = ''; - $time_still = ($eff[$i]['timeUse'] + ($eff[$i]['timeAce'] - $eff[$i]['timeUse']) + $eff[$i]['actionTime']); - if ($eff[$i]['timeAce'] == 0) { - $time_still += $eff[$i]['timeUse']; - } - $time_still -= time(); - if ($eff[$i]['bp'] == 0 && $eff[$i]['timeUse'] != 77) { - if ($eff[$i]['type1'] != 13) { - /*$tmp = floor($time_still/2592000); - $id=0; - if ($tmp > 0) { - $id++; - if ($id<3) {$out .= $tmp." . ";} - $time_still = $time_still-$tmp*2592000; - } - $tmp = floor($time_still/604800); - if ($tmp > 0) { - $id++; - if ($id<3) {$out .= $tmp." . ";} - $time_still = $time_still-$tmp*604800; - } - $tmp = floor($time_still/86400); - if ($tmp > 0) { - $id++; - if ($id<3) {$out .= $tmp." . ";} - $time_still = $time_still-$tmp*86400; - } - $tmp = floor($time_still/3600); - if ($tmp > 0) { - $id++; - if ($id<3) {$out .= $tmp." . ";} - $time_still = $time_still-$tmp*3600; - } - $tmp = floor($time_still/60); - if ($tmp > 0) { - $id++; - if ($id<3) {$out .= $tmp." . ";} - } - if($out=='') - { - $out = $time_still.' .'; - }*/ - $ei .= ': ' . $u->timeOut($time_still) . ''; - } - } else { - if ($eff[$i]['timeUse'] != 77 && $eff[$i]['hod'] < 1) { - $ei .= ': ' . $u->timeOut($time_still) . ''; - //$ei .= ': '.$out.'
'; - } elseif ($eff[$i]['hod'] >= 0) { - $ei .= ': ' . $eff[$i]['hod'] . ''; - } - } - - if ($eff[$i]['user_use'] != '') { - if ($this->users[$this->uids[$eff[$i]['user_use']]]['login2'] != '') { - $ei .= '
: ' . $this->users[$this->uids[$eff[$i]['user_use']]]['login2'] . ''; - } elseif ($this->users[$this->uids[$eff[$i]['user_use']]]['login'] != '') { - $ei .= '
: ' . $this->users[$this->uids[$eff[$i]['user_use']]]['login'] . ''; - } - } - - // - $tr = ''; - $ti = $u->items['add']; - $x = 0; - $ed = $u->lookStats($eff[$i]['data']); - while ($x < count($ti)) { - $n = $ti[$x]; - if (isset($ed['add_' . $n], $u->is[$n]) && $n != 'pog') { - $z = ''; - if ($ed['add_' . $n] > 0) { - $z = '+'; - } - $tr .= '
' . $u->is[$n] . ': ' . $z . '' . $ed['add_' . $n]; - } - $x++; - } - - if ($ed['add_mib1'] != 0) { - if ($ed['add_mab1'] != 0) { - $tr .= '
: ' . $ed['add_mib1'] . '-' . $ed['add_mab1'] . ''; - } else { - $m1l = $ed['add_mib1']; - if ($m1l > 0) { - $m1l = '+' . $m1l; - } - $tr .= '
: ' . $m1l . ''; - } - } - if ($ed['add_mib2'] != 0) { - if ($ed['add_mab2'] != 0) { - $tr .= '
: ' . $ed['add_mib2'] . '-' . $ed['add_mab2'] . ''; - } else { - $m1l = $ed['add_mib2']; - if ($m1l > 0) { - $m1l = '+' . $m1l; - } - $tr .= '
: ' . $m1l . ''; - } - } - if ($ed['add_mib3'] != 0) { - if ($ed['add_mab3'] != 0) { - $tr .= '
: ' . $ed['add_mib3'] . '-' . $ed['add_mab3'] . ''; - } else { - $m1l = $ed['add_mib3']; - if ($m1l > 0) { - $m1l = '+' . $m1l; - } - $tr .= '
: ' . $m1l . ''; - } - } - if ($ed['add_mib4'] != 0) { - if ($ed['add_mab4'] != 0) { - $tr .= '
: ' . $ed['add_mib4'] . '-' . $ed['add_mab4'] . ''; - } else { - $m1l = $ed['add_mib4']; - if ($m1l > 0) { - $m1l = '+' . $m1l; - } - $tr .= '
: ' . $m1l . ''; - } - } - - $efix = 0; - if (isset($ed['add_pog2']) && $ed['add_pog2'] > 0) { - $efix = $ed['add_pog2']; - } - if (isset($ed['add_pog'])) { - $tr .= '
' . $ed['add_pog'] . ' . '; - } - if (isset($ed['add_pog2'])) { - $tr .= '
' . $ed['add_pog2'] . ' . (' . $ed['add_pog2p'] . '%)'; - } - - if ($tr != '') { - $ei .= $tr; - } - if ($eff[$i]['info'] != '') { - $ei .= '
:
' . $eff[$i]['info']; - } - - //$ef .= ''; - $ef .= '
'; - unset($efix); - } - } elseif ($eff[$i] != 'delete') { - $i = -2; - } - $i++; - } - } else { - $ef .= '
\',event,3,1,1,1,\'\');\" onmouseout=\"top.hic();\" onmousedown=\"top.hic();\">
'; - } - if ($st['itmslvl'] == 0 && $ur['bot_id'] == 0) { - //$ef .= '
()
: \">
'; - } - - $ca = ''; - if ($ur['clan'] > 0) { - $cl = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $ur['clan'] . '" LIMIT 1')); - if (isset($cl['id'])) { - $ca = ''; - } - } - if ($ur['align'] > 0) { - $ca = '' . $ca; - } - if ($ur['login2'] == '') { - $ur['login2'] = $ur['login']; - } - if (floor($st['hpNow']) > $st['hpAll']) { - $st['hpNow'] = $st['hpAll']; - } - if (floor($st['mpNow']) > $st['mpAll']) { - $st['mpNow'] = $st['mpAll']; - } - $stsua = '' . $ur['login2'] . ''; - $stsua .= '
: ' . $st['s1']; - $stsua .= '
: ' . $st['s2']; - $stsua .= '
: ' . $st['s3']; - $stsua .= '
: ' . $st['s4']; - if ($st['s5'] != 0) { - $stsua .= '
: ' . $st['s5']; - } - if ($st['s6'] != 0) { - $stsua .= '
: ' . $st['s6']; - } - if ($st['s7'] != 0) { - $stsua .= '
: ' . $st['s7']; - } - if ($u->info['admin'] > 0) { - if (isset($ur['align']) && $ur['align'] == 9) { - $align = $ur['align']; - } else { - $align = $ur['align']; - } - } - $tp_img = [ - 1 => 4, - 2 => 5, - 14 => 6, - 3 => 7, - 5 => 8, - 7 => 9, - 17 => 10, - 16 => 11, - 13 => 12, - 10 => 13, - 9 => 14, - 8 => 15, - 11 => 17, // 2 - 12 => 18 // 3 - ]; - $info = 'info_reflesh(' . $t . ',' . $ur['id'] . ',"' . $ca . '' . $ur['login2'] . ' [' . $ur['level'] . '] ","' . $ur['obraz'] . '",' . floor($st['hpNow']) . ',' . floor($st['hpAll']) . ',' . floor($st['mpNow']) . ',' . floor($st['mpAll']) . ',0,' . $ur['sex'] . ',"' . $ef . '","' . $stsua . '", "' . $align . '", "' . $ur['zag'] . '");shpb();'; - $i = 0; - while ($i < count($itm)) { - // - if (isset($st['items_img'][$tp_img[$itm[$i]['inOdet']]])) { - $itm[$i]['img'] = $st['items_img'][$tp_img[$itm[$i]['inOdet']]]; - } - // - $ttl = '' . $itm[$i]['name'] . ''; - $td = $u->lookStats($itm[$i]['data']); - $lvar = ''; - if ($td['add_hpAll'] > 0) { - if ($td['add_hpAll'] > 0) { - $td['add_hpAll'] = '+' . $td['add_hpAll']; - } - $lvar .= '
: ' . $td['add_hpAll'] . ''; - } - if ($td['sv_yron_max'] > 0 || $td['sv_yron_min'] > 0) { - $lvar .= '
: ' . (0 + $td['sv_yron_min']) . '-' . (0 + $td['sv_yron_max']) . ''; - } - if ($td['add_mab1'] > 0) { - if ($td['add_mib1'] == $td['add_mab1'] && $pl['geniration'] == 1) { - $m1l = '+'; - if ($td['add_mab1'] < 0) { - $m1l = ''; - } - $lvar .= '
: ' . $m1l . '' . (0 + $td['add_mab1']) . ''; - } else { - $lvar .= '
: ' . (0 + $td['add_mib1']) . '-' . (0 + $td['add_mab1']) . ''; - } - } - if ($td['add_mab2'] > 0) { - if ($td['add_mib2'] == $td['add_mab2'] && $pl['geniration'] == 1) { - $m1l = '+'; - if ($td['add_mab2'] < 0) { - $m1l = ''; - } - $lvar .= '
: ' . $m1l . '' . (0 + $td['add_mab2']) . ''; - } else { - $lvar .= '
: ' . (0 + $td['add_mib2']) . '-' . (0 + $td['add_mab2']) . ''; - } - } - if ($td['add_mab3'] > 0) { - if ($td['add_mib3'] == $td['add_mab3'] && $pl['geniration'] == 1) { - $m1l = '+'; - if ($td['add_mab3'] < 0) { - $m1l = ''; - } - $lvar .= '
: ' . $m1l . '' . (0 + $td['add_mab3']) . ''; - } else { - $lvar .= '
: ' . (0 + $td['add_mib3']) . '-' . (0 + $td['add_mab3']) . ''; - } - } - if ($td['add_mab4'] > 0) { - if ($td['add_mib4'] == $td['add_mab4'] && $pl['geniration'] == 1) { - $m1l = '+'; - if ($td['add_mab4'] < 0) { - $m1l = ''; - } - $lvar .= '
: ' . $m1l . '' . (0 + $td['add_mab4']) . ''; - } else { - $lvar .= '
: ' . (0 + $td['add_mib4']) . '-' . (0 + $td['add_mab4']) . ''; - } - } - if ($itm[$i]['iznosMAX'] > 0) { - if ($itm[$i]['iznosMAXi'] == 999999999) { - $lvar .= '
: '; - } else { - $lvar .= '
: ' . floor($itm[$i]['iznosNOW']) . '/' . floor($itm[$i]['iznosMAX']); - } - } - $ttl .= $lvar; - $ccv = ''; - - if ($itm[$i]['magic_inci'] != '' || $itm[$i]['magic_inc'] != '') { - if ($itm[$i]['magic_inc'] == '') { - $itm[$i]['magic_inc'] = $itm[$i]['magic_inci']; - } - $mgi = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . $itm[$i]['magic_inc'] . '" AND `type1` = "12345" LIMIT 1')); - if (isset($mgi['id2'])) { - $mgilog = ''; - $ccv .= 'top.useMagicBattle(\'' . $mgi['mname'] . '\',' . $itm[$i]['id'] . ',\'' . $mgi['img'] . '\',1,2);'; - } - } - - $info .= 'abitms(' . (0 + $t) . ',' . (0 + $itm[$i]['uid']) . ',' . (0 + $itm[$i]['id']) . ',' . (0 + $itm[$i]['inOdet']) . ',"' . $itm[$i]['name'] . '","' . $ttl . '","' . $itm[$i]['img'] . '","' . $ccv . '");'; - $i++; - } - - return $info; - } else { - return false; - } - } - - // - public function testUsersLive() - { - $r = false; - $tl = 0; - $i = 0; - $j = 0; - while ($i < count($this->uids)) { - if ($this->stats[$i]['id'] > 0) { - if (floor($this->stats[$i]['hpNow']) < 1) { - $this->stats[$i]['hpNow'] = 0; - } - $hp[$this->users[$i]['team']] += floor($this->stats[$i]['hpNow']); - if (!isset($tml[$this->users[$i]['team']]) && floor($this->stats[$i]['hpNow']) >= 1) { - $tml[$this->users[$i]['team']] = 1; - $tmv[$j] = $this->users[$i]['team']; - $tl++; - } - } - $i++; - } - if ($tl > 1) { - $r = true; - } - return $r; - } - - // - public function miniLogAdd($user, $text) - { - $txt = $text; - $vLog = 'at1=00000||at2=00000||zb1=0||zb2=0||bl1=0||bl2=0||time1=' . time() . '||time2=' . time() . '||s1=' . $user['sex'] . '||t1=' . $user['team'] . '||login1=' . $user['login'] . '||'; - $mas1 = [ - 'time' => time(), - 'battle' => $this->info['id'], - 'id_hod' => ($this->hodID + 1), - 'text' => '', - 'vars' => $vLog, - 'zona1' => '', - 'zonb1' => '', - 'zona2' => '', - 'zonb2' => '', - 'type' => '1', - ]; - $mas1['text'] = $txt; - $this->add_log($mas1); - } - - // - public function testFinish() - { - global $u; - // - mysql_query('START TRANSACTION;'); - // - $test = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `team_win` = -1 LIMIT 1 FOR UPDATE')); - //mysql_query('UPDATE `battle` SET `testfinish` = "'.$u->info['id'].'" WHERE `id` = "'.$this->info['id'].'" LIMIT 1'); - // - mysql_query('COMMIT;'); - // - if ($this->info['team_win'] == -1 && isset($test['id'])) { - $hp = []; - $tml = []; - $tmv = []; - $tl = 0; - $i = 0; - $j = 0; - while ($i < count($this->uids)) { - if ($this->stats[$i]['id'] > 0) { - if (floor($this->stats[$i]['hpNow']) < 1) { - $this->stats[$i]['hpNow'] = 0; - } - $hp[$this->users[$i]['team']] += floor($this->stats[$i]['hpNow']); - if (!isset($tml[$this->users[$i]['team']]) && floor($this->stats[$i]['hpNow']) >= 1) { - $tml[$this->users[$i]['team']] = 1; - $tmv[$j] = $this->users[$i]['team']; - $tl++; - } - } - $i++; - } - - if ($tl <= 1) { - //. - $tmHpNow = []; - $tmNow = []; - $sp = mysql_query('SELECT `u`.`login`,`u`.`id`,`u`.`battle`,`s`.`team`,`s`.`hpNow` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `u`.`battle` = "' . $this->info['id'] . '"'); - while ($pl = mysql_fetch_array($sp)) { - if (!isset($tmHpNow[$pl['team']])) { - $tmHpNow[$pl['team']] = 0; - $tmNow[] = $pl['team']; - } - $hpTm = floor($pl['hpNow']); - if ($hpTm < 0) { - $hpTm = 0; - } - if ($hpTm > 0) { - $tmHpNow[$pl['team']] += $pl['hpNow']; - } - } - $gdj = 0; - $i = 0; - while ($i < count($tmNow)) { - if (isset($tmNow[$i])) { - $j = $tmNow[$i]; - if ($tmHpNow[$j] > 0) { - $gdj++; - } - } - $i++; - } - if ($gdj > 1) { - $tl = $gdj; - echo ' ... ( )'; - } - } - - if ($tl <= 1) { - // , - , - - $i = 0; - $tmwin = 0; - while ($i < count($tmv)) { - if ($tmv[$i] >= 1 && $tml[$tmv[$i]] > 0) { - $tmwin = $tmv[$i]; - } - $i++; - } - - if ($this->info['izlom'] == 0) { - $rs = ''; - $ts = []; - $tsi = 0; - if ($this->info['id'] > 0) { - // - unset($this->users, $this->stats, $this->uids, $this->bots, $this->iBots); - $trl = mysql_query('SELECT `u`.`no_ip`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`money3`,`u`.`money2`,`u`.`bot_id` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $this->info['id'] . '" ORDER BY `st`.`bot` DESC'); - $ir = 0; - $bi = 0; - $this->users = null; - $this->stats = null; - $this->uids = null; - $this->bots = null; - $this->iBots = null; - while ($pl = mysql_fetch_array($trl)) { - // - if ($pl['login2'] == '') { - $pl['login2'] = $pl['login']; - } - $this->users[$ir] = $pl; - $this->uids[$pl['id']] = $ir; - if ($pl['bot'] > 0) { - $this->bots[$bi] = $pl['id']; - $this->iBots[$pl['id']] = $bi; - $bi++; - } - // - $this->stats[$ir] = $u->getStats($pl, 0, 0, false, false, true); - $ir++; - } - } - } elseif (!isset($this->uids[$u->info['id']])) { - $rs = ''; - $ts = []; - $tsi = 0; - if ($this->info['id'] > 0) { - // - $trl = mysql_query('SELECT `u`.`no_ip`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`bot_id`,`u`.`money3`,`u`.`money2` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = "' . $this->info['id'] . '" LIMIT 1'); - $pl = mysql_fetch_array($trl); - // - if ($pl['login2'] == '') { - $pl['login2'] = $pl['login']; - } - $this->users[count($this->users)] = $pl; - $this->uids[$pl['id']] = $ir; - if ($pl['bot'] > 0) { - $this->bots[count($this->bots)] = $pl['id']; - $this->iBots[$pl['id']] = $bi; - } - // - $this->stats[count($this->stats)] = $u->getStats($pl, 0, 0, false, false, true); - } - } - - - if ($this->info['izlom'] > 0 && $tmwin == 1) { - // - $i = 0; - $dlt = ''; - $dlt2 = ''; - $sp = mysql_query('SELECT `users`.`id`,`stats`.`bot`,`stats`.`team` FROM `users`,`stats` WHERE `users`.`battle` = "' . $this->info['id'] . '" AND `stats`.`id` = `users`.`id` LIMIT 250'); - while ($pl = mysql_fetch_array($sp)) { - if ($pl['bot'] == 1 && $pl['team'] != $u->info['team']) { - $dlt .= ' `id`="' . $pl['id'] . '" OR'; - $dlt2 .= ' `uid`="' . $pl['id'] . '" OR'; - $i++; - } - } - - if ($i > 0) { - $dlt = trim($dlt, 'OR'); - $dlt2 = trim($dlt2, 'OR'); - mysql_query('DELETE FROM `users` WHERE ' . $dlt . ' LIMIT ' . $i); - mysql_query('DELETE FROM `stats` WHERE ' . $dlt . ' LIMIT ' . $i); - mysql_query('DELETE FROM `items_users` WHERE ' . $dlt2 . ' LIMIT ' . ($i * 100)); - mysql_query('DELETE FROM `eff_users` WHERE ' . $dlt2 . ' LIMIT ' . ($i * 100)); - } - - unset($i, $dlt, $dlt2); - - $j = 0; - $k = 0; - $obr = 0; - - // , - if ($this->get_chanse(20) == true) { - // - if ($this->info['izlomLvl'] == 8) { - $bots = [ - ' ', - ' ', - '', - ' ', - ' ', - ]; - //$bots = array( ' ' ); - } - $logins_bot = []; - // - echo '
...
'; - // - $id2 = rand(0, (count($bots) - 1)); - $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); - $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, - round($this->info['izlomRoundSee'])); - if (isset($id['id']) && $bot != false) { - // - $btxt = ''; - if ($id['align'] > 0) { - $btxt = $btxt . ''; - } - if ($id['clan'] > 0) { - $btxt = $btxt . ''; - } - $btxt = $btxt . '{u1}[' . $id['level'] . ']'; - if ($id['sex'] == 1) { - $btxt = $btxt . ' .'; - } else { - $btxt = $btxt . ' .'; - } - $this->miniLogAdd([ - 'login' => $id['login'], - 'sex' => $id['sex'], - 'team' => 0, - ], '{tm1} ' . $btxt); - // - $logins_bot = $bot['logins_bot']; - mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - $u->addAction(time(), 'win_bot_' . $id['id'], '', $this->users[$i]['id']); - if (rand(0, 10000) < 1500) { - $obr++; - } - $j++; - } - } else { - // - if ($this->info['izlomLvl'] == 8) { - $bots = [ - '', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ]; - } - $logins_bot = []; - // - $id2 = rand(0, (count($bots) - 1)); - $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); - $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, - ($this->info['izlomRoundSee'] * 2)); - if (isset($id['id']) && $bot != false) { - // - $btxt = ''; - if ($id['align'] > 0) { - $btxt = $btxt . ''; - } - if ($id['clan'] > 0) { - $btxt = $btxt . ''; - } - $btxt = $btxt . '{u1}[' . $id['level'] . ']'; - if ($id['sex'] == 1) { - $btxt = $btxt . ' .'; - } else { - $btxt = $btxt . ' .'; - } - $this->miniLogAdd([ - 'login' => $id['login'], - 'sex' => $id['sex'], - 'team' => 0, - ], '{tm1} ' . $btxt); - // - $logins_bot = $bot['logins_bot']; - mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - if (rand(0, 10000) < 1500) { - $obr++; - } - $j++; - } - // - $id2 = rand(0, (count($bots) - 1)); - $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); - $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, $this->info['izlomRoundSee']); - if (isset($id['id']) && $bot != false) { - // - $btxt = ''; - if ($id['align'] > 0) { - $btxt = $btxt . ''; - } - if ($id['clan'] > 0) { - $btxt = $btxt . ''; - } - $btxt = $btxt . '{u1}[' . $id['level'] . ']'; - if ($id['sex'] == 1) { - $btxt = $btxt . ' .'; - } else { - $btxt = $btxt . ' .'; - } - $this->miniLogAdd([ - 'login' => $id['login'], - 'sex' => $id['sex'], - 'team' => 0, - ], '{tm1} ' . $btxt); - // - $logins_bot = $bot['logins_bot']; - mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - if (rand(0, 10000) < 1500) { - $obr++; - } - $j++; - } - // - if (rand(0, 100) < 70) { - $id2 = rand(0, (count($bots) - 1)); - $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); - $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, - $this->info['izlomRoundSee']); - if (isset($id['id']) && $bot != false) { - // - $btxt = ''; - if ($id['align'] > 0) { - $btxt = $btxt . ''; - } - if ($id['clan'] > 0) { - $btxt = $btxt . ''; - } - $btxt = $btxt . '{u1}[' . $id['level'] . ']'; - if ($id['sex'] == 1) { - $btxt = $btxt . ' .'; - } else { - $btxt = $btxt . ' .'; - } - $this->miniLogAdd([ - 'login' => $id['login'], - 'sex' => $id['sex'], - 'team' => 0, - ], '{tm1} ' . $btxt); - // - $logins_bot = $bot['logins_bot']; - mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - if (rand(0, 10000) < 1500) { - $obr++; - } - $j++; - } - } - // 10 = +1 - $irb = floor($this->info['izlomRoundSee'] / 10); - while ($irb > 0) { - // - if (rand(0, 100) < 20) { - $id2 = rand(0, (count($bots) - 1)); - $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); - $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, - $this->info['izlomRoundSee']); - if (isset($id['id']) && $bot != false) { - // - $btxt = ''; - if ($id['align'] > 0) { - $btxt = $btxt . ''; - } - if ($id['clan'] > 0) { - $btxt = $btxt . ''; - } - $btxt = $btxt . '{u1}[' . $id['level'] . ']'; - if ($id['sex'] == 1) { - $btxt = $btxt . ' .'; - } else { - $btxt = $btxt . ' .'; - } - $this->miniLogAdd([ - 'login' => $id['login'], - 'sex' => $id['sex'], - 'team' => 0, - ], '{tm1} ' . $btxt); - // - $logins_bot = $bot['logins_bot']; - mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - if (rand(0, 10000) < 1500) { - $obr++; - } - $j++; - } - } - $irb--; - } - } - // - unset($logins_bot); - // - // - // - /*if( true == false ) { - $mz = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `izlom` WHERE `izlom` = "'.$this->info['izlom'].'" AND `level` = "'.$this->info['izlomLvl'].'" LIMIT 50')); - $mz = $mz[0]; - $pz = $this->info['izlomRound']+rand(1,3); - if($pz/$mz>1){ - $zz = floor($pz/$mz); - $pz = $pz-($zz*$mz); - } - $iz = mysql_fetch_array(mysql_query('SELECT * FROM `izlom` WHERE `izlom` = "'.$this->info['izlom'].'" AND `level` = "'.$this->info['izlomLvl'].'" AND `round` = "'.$pz.'" LIMIT 1')); - $i = 0; $bots = $iz['bots']; $bots = explode('|',$bots); $j = 0; $k = 0; $obr = 0; - $logins_bot = array(); - while($i0) - { - $k = $u->addNewbot($bots[$i],NULL,NULL,$logins_bot); - if($k!=false) - { - $logins_bot = $k['logins_bot']; - $upd = mysql_query('UPDATE `users` SET `battle` = "'.$this->info['id'].'" WHERE `id` = "'.$k['id'].'" LIMIT 1'); - if($upd) - { - $upd = mysql_query('UPDATE `stats` SET `team` = "2" WHERE `id` = "'.$k['id'].'" LIMIT 1'); - if($upd) - { - $j++; if(rand(0,10000) < 1500){ $obr++; } - } - } - } - } - $i++; - } - unset($logins_bot); - }*/ - // - // - // - if ($j == 0) { - // - $this->finishBattle($tml, $tmv, null, $tl); - $fin1 = mysql_query('INSERT INTO `izlom_rating` (`uid`,`time`,`voln`,`level`,`bots`,`rep`,`obr`,`btl`) VALUES ("' . $u->info['id'] . '","' . time() . '","' . $this->info['izlomRoundSee'] . '","' . $this->info['izlomLvl'] . '","0","0","' . ($this->info['izlomObr'] - $this->info['izlomObrNow']) . '","' . $this->info['id'] . '")'); - } else { - $this->info['izlomRound'] = $iz['round']; - mysql_query('UPDATE `battle` SET `izlomObrNow` = ' . $obr . ',`izlomObr` = `izlomObr` + ' . $obr . ',`timeout` = (`timeout`+5),`izlomRound` = "' . ($this->info['izlomRound'] + 1) . '",`izlomRoundSee` = `izlomRoundSee`+1 WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - $this->stats[$this->uids[$u->info['id']]]['hpNow'] += $this->stats[$this->uids[$u->info['id']]]['hpAll'] * 0.25; - $this->stats[$this->uids[$u->info['id']]]['mpNow'] += $this->stats[$this->uids[$u->info['id']]]['mpAll'] * 0.25; - $this->users[$this->uids[$u->info['id']]]['hpNow'] = $this->stats[$this->uids[$u->info['id']]]['hpAll']; - $this->users[$this->uids[$u->info['id']]]['mpNow'] = $this->stats[$this->uids[$u->info['id']]]['mpAll']; - $vLog = 'at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] . '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] . '||bl1=' . $this->atacks[$id]['b' . $a] . '||bl2=' . $this->atacks[$id]['b' . $b] . '||time1=' . $this->atacks[$id]['time'] . '||time2=' . $this->atacks[$id]['time2'] . '||s2=' . $this->users[$this->uids[$u2]]['sex'] . '||s1=' . $this->users[$this->uids[$u1]]['sex'] . '||t2=' . $this->users[$this->uids[$u2]]['team'] . '||t1=' . $this->users[$this->uids[$u1]]['team'] . '||login1=' . $this->users[$this->uids[$u1]]['login2'] . '||login2=' . $this->users[$this->uids[$u2]]['login2'] . ''; - - $mas = [ - 'text' => '', - 'time' => time(), - 'vars' => '', - 'battle' => $this->info['id'], - 'id_hod' => ($this->hodID + 1), - 'vars' => $vLog, - 'type' => 1, - ]; - if ($u->info['sex'] == 1) { - $mas['text'] = '' . date('H:i') . ' ' . $u->info['login'] . ' "".'; - } else { - $mas['text'] = '' . date('H:i') . ' ' . $u->info['login'] . ' "".'; - } - if ($u->stats['hpNow'] < $u->stats['hpAll']) { - $hpSks = floor(($u->stats['hpAll'] * ((rand(15, 25)) / 100))); - if ($hpSks > floor($u->stats['hpAll'] - $u->stats['hpNow'])) { - $hpSks = floor($u->stats['hpAll'] - $u->stats['hpNow']); - } - $mas['text'] .= ' +' . $hpSks . ''; - } else { - $hpSks = 0; - $mas['text'] .= ' --'; - } - $mas['text'] .= ' [' . floor($u->info['hpNow'] + $hpSks) . '/' . $u->stats['hpAll'] . ']'; - $this->add_log($mas); - - mysql_query('UPDATE `stats` SET `hpNow` = "' . ($u->info['hpNow'] + ($u->stats['hpAll'] * ((rand(15, - 25)) / 100))) . '",`mpNow` = "' . ($u->info['mpNow'] + ($u->stats['mpAll'] * 0.25)) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - } - } else { - // - $this->finishBattle($tml, $tmv, null, $tl); - if ($this->info['izlom'] > 0) { - $fin1 = mysql_query('INSERT INTO `izlom_rating` (`uid`,`time`,`voln`,`level`,`bots`,`rep`,`obr`,`btl`) VALUES ("' . $u->info['id'] . '","' . time() . '","' . $this->info['izlomRoundSee'] . '","' . $this->info['izlomLvl'] . '","0","0","' . ($this->info['izlomObr'] - $this->info['izlomObrNow']) . '","' . $this->info['id'] . '")'); - } - } - if (isset($fin1)) { - mysql_query('INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","31","23","' . $u->info['id'] . '"," ","nofastfinisheff=1","' . time() . '")'); - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $u->info['city'] . "','" . $u->info['room'] . "','','" . $u->info['login'] . "',' ""x" . (($this->info['izlomObr'] - $this->info['izlomObrNow']) * 7) . "','" . time() . "','6','0')"); - $i01 = 1; - while ($i01 <= (($this->info['izlomObr'] - $this->info['izlomObrNow'])) * 7) { - $u->addItem(1226, $u->info['id'], '|sudba=' . $u->info['login']); - $i01++; - } - mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $u->info['id'] . '","' . time() . '","capitalcity","' . $u->info['room'] . '","izlom"," ","","")'); - unset($fin1); - } - } - } else { - mysql_query('START TRANSACTION;'); - $test = mysql_fetch_array(mysql_query('SELECT `id`,`team_win`, `testfinish` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `team_win` != -1 LIMIT 1 FOR UPDATE')); - mysql_query('COMMIT;'); - if (isset($test['id'])) { - $this->finishBattle(null, null, 10, $tl); - } - } - // - //mysql_query('UPDATE `battle` SET `testfinish` = "0" WHERE `id` = "'.$this->info['id'].'" LIMIT 1'); - } - - // - public function finishBattle($t, $v, $nl, $tl) - { - global $magic, $u, $q, $c; - mysql_query('LOCK TABLES users,stats,battle,battle_last,battle_end,chat WRITE'); - $frtu = false; - $test = mysql_fetch_array(mysql_query('SELECT `id`,`team_win`,`testfinish` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `team_win` != -1 LIMIT 1;')); - if ($test['testfinish'] != -1) { //$frtu == false - $trtt = mysql_query('UPDATE `battle` SET `testfinish` = "-1" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - $relbf = $this->info['team_win']; - if ($nl != 10) { - $i = 0; - $dnr = 0; - if ($this->info['team_win'] == -1) { - $this->info['team_win'] = 0; - while ($i < count($v)) { - if ($v[$i] >= 1 && $t[$v[$i]] > 0) { - $this->info['team_win'] = $v[$i]; - } - $i++; - } - } - } - - - // - $t = mysql_query('SELECT `u`.`stopexp`,`u`.`twink`,`u`.`city`,`u`.`room`,`u`.`no_ip`,`u`.`pass`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`bot_id`,`u`.`money3`,`u`.`money2` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $this->info['id'] . '"'); - $i = 0; - $bi = 0; - while ($pl = mysql_fetch_array($t)) { - // - if ($pl['login2'] == '') { - $pl['login2'] = $pl['login']; - } - $this->users[$i] = $pl; - $this->uids[$pl['id']] = $i; - if ($pl['bot'] > 0) { - $this->bots[$bi] = $pl['id']; - $this->iBots[$pl['id']] = $bi; - $bi++; - } - // - $this->stats[$i] = $u->getStats($pl, 0, 0, false, false, true); - $i++; - } - unset($pl, $t); - - if ($this->info['time_over'] == 0) { - $tststrt = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `time_over` = "0" LIMIT 1')); - if (isset($tststrt['id'])) { - if ($this->info['inTurnir'] == 0 || $this->info['type'] == 500) { - mysql_query('UPDATE `battle` SET `time_over` = "' . time() . '",`team_win` = "' . $this->info['team_win'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - } - mysql_query('UPDATE `battle_stat` SET `team_win` = "' . $this->info['team_win'] . '" WHERE `battle_id` = "' . $this->info['id'] . '"'); - // - $i = 0; - $vl = ''; - $vtvl = ''; - $relu = 0; - while ($i < count($this->users)) { - /*if( $this->user[$i]['clon'] == 0 && $this->user[$i]['bot'] == 0 ) { - $relu++; - }*/ - $vl .= '("' . $this->users[$i]['login'] . '","' . $this->users[$i]['city'] . '","' . $this->info['id'] . '","' . $this->users[$i]['id'] . '","' . time() . '","' . $this->users[$i]['team'] . '","' . $this->users[$i]['level'] . '","' . $this->users[$i]['align'] . '","' . $this->users[$i]['clan'] . '","' . $this->users[$i]['exp'] . '","' . $this->users[$i]['bot'] . '","' . $this->users[$i]['money'] . '","' . $this->users[$i]['money2'] . '","' . $this->users[$i]['money3'] . '"),'; - if ($this->users[$i]['team'] == $this->info['team_win'] && $this->info['team_win'] > 0) { - $vtvl .= '' . $this->users[$i]['login'] . ', '; - } - $i++; - } - - $this->info['players_c'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `users` WHERE `login` NOT LIKE "%(%" AND `battle` = "' . $this->info['id'] . '" LIMIT 1')); - $this->info['players_c'] = $this->info['players_c'][0]; - - mysql_query('UPDATE `battle` SET `players_c` = "' . $this->info['players_c'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - - if ($vtvl != '') { - $vtvl = rtrim($vtvl, ', '); - $vtvl = str_replace('"', '\\\\\"', $vtvl); - $this->hodID++; - $vLog = 'time1=' . time(); - $mass = [ - 'time' => time(), - 'battle' => $this->info['id'], - 'id_hod' => $this->hodID, - 'text' => 'test', - 'vars' => $vLog, - 'zona1' => '', - 'zonb1' => '', - 'zona2' => '', - 'zonb2' => '', - 'type' => '1', - ]; - $vtvl = ' , ' . $vtvl . '.'; - $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); - } else { - $this->info['players_cc'] = mysql_fetch_array(mysql_query('SELECT COUNT(`u`.`id`) FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `s`.`hpNow` > 0 AND `u`.`battle` = "' . $this->info['id'] . '" AND `s`.`team` != "' . $u->info['team'] . '" LIMIT 1')); - $this->info['players_cc'] = $this->info['players_cc'][0]; - $this->info['players_cc2'] = mysql_fetch_array(mysql_query('SELECT COUNT(`u`.`id`) FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `s`.`hpNow` >= 1 AND `u`.`battle` = "' . $this->info['id'] . '" AND `s`.`team` != "' . $u->info['team'] . '" LIMIT 1')); - $this->info['players_cc2'] = $this->info['players_cc2'][0]; - $inf_test = ', users: ' . $this->info['players_cc'] . ' and ' . $this->info['players_cc2'] . ''; - $this->hodID++; - $vLog = 'time1=' . time(); - $mass = [ - 'time' => time(), - 'battle' => $this->info['id'], - 'id_hod' => $this->hodID, - 'text' => 'test', - 'vars' => $vLog, - 'zona1' => '', - 'zonb1' => '', - 'zona2' => '', - 'zonb2' => '', - 'type' => '1', - ]; - $vtvl = ' , .'; - $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); - } - - $this->saveLogs($this->info['id'], 'all'); - //$this->hodID++; - - if ($this->info['type'] == 99) { - //$this->hodID++; - $vLog = 'time1=' . time(); - $mass = [ - 'time' => time(), - 'battle' => $this->info['id'], - 'id_hod' => $this->hodID, - 'text' => 'test', - 'vars' => $vLog, - 'zona1' => '', - 'zonb1' => '', - 'zona2' => '', - 'zonb2' => '', - 'type' => '1', - ]; - $vtvl = ' ...'; - $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); - $i = 0; - $vtvl = ''; - $tr_nm = [ - 1 => '', - 2 => '', - 3 => '', - 4 => '', - ]; - while ($i < count($this->users)) { - if ($this->users[$i]['team'] != $this->info['team_win']) { - $tr_pl = mysql_fetch_array(mysql_query('SELECT `id`,`v1` FROM `eff_users` WHERE `id_eff` = 4 AND `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = "0" ORDER BY `v1` DESC LIMIT 1')); - if (!isset($tr_pl['id']) || $tr_pl['v1'] < 3) { - if ($this->info['smert'] == 1) { - $tr_tp = 4; - } else { - $tr_tp = rand(1, 3); - } - if (isset($tr_pl['id'])) { - $tr_tp = rand(($tr_pl['v1'] + 1), 3); - } - if ($this->users[$i]['sex'] == 1) { - $vtvl = '' . $this->users[$i]['login'] . ' : ' . $tr_nm[$tr_tp] . ' .
' . $vtvl; - } else { - $vtvl = '' . $this->users[$i]['login'] . ' : ' . $tr_nm[$tr_tp] . ' .
' . $vtvl; - } - $this->addTravm($this->users[$i]['id'], $tr_tp, rand(3, 5)); - } - } - $i++; - } - $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); - } - - if ($vl != '') { - $vl = rtrim($vl, ','); - mysql_query('INSERT INTO `battle_last` (`login`,`city`,`battle_id`,`uid`,`time`,`team`,`lvl`,`align`,`clan`,`exp`,`bot`,`money`,`money2`,`money3`) VALUES ' . $vl . ''); - } - - mysql_query('INSERT INTO `battle_end` (`battle_id`,`city`,`time`,`team_win`) VALUES ("' . $this->info['id'] . '","' . $this->info['city'] . '","' . $this->info['time_start'] . '","' . $this->info['team_win'] . '")'); - } - - - $vLog = 'time1=' . time(); - $mass = [ - 'time' => time(), - 'battle' => $this->info['id'], - 'id_hod' => $this->hodID, - 'text' => 'test', - 'vars' => $vLog, - 'zona1' => '', - 'zonb1' => '', - 'zona2' => '', - 'zonb2' => '', - 'type' => '1', - ]; - //$vtvl = ''; - //$ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("'.$mass['time'].'","'.$mass['battle'].'","'.$mass['id_hod'].'","'.$vtvl.'","'.$mass['vars'].'","'.$mass['zona1'].'","'.$mass['zonb1'].'","'.$mass['zona2'].'","'.$mass['zonb2'].'","'.$mass['type'].'")'); - $i = 0; - $vtvl = ''; - $tr_nm = [ - 1 => '', - 2 => '', - 3 => '', - 4 => '', - ]; - while ($i < count($this->users)) { - if ($this->users[$i]['team'] != $this->info['team_win'] && $this->info['team_win'] > 0) { - $tr_pl = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `v1` = "priem" AND `v2` = 292 AND `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = "0" LIMIT 1')); - - $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl2 . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); - - if (isset($tr_pl['id'])) { - if (rand(0, 100) < $tr_pl['data']) { - $tr_tp = rand(1, 3); - if (isset($tr_pl['id'])) { - $tr_tp = rand(($tr_pl['v1'] + 1), 3); - } - if ($this->users[$i]['sex'] == 1) { - $vtvl = '' . $this->users[$i]['login'] . ' (, : ' . $this->users[$this->uids[$tr_pl['user_use']]]['login'] . '): ' . $tr_nm[$tr_tp] . ' .
' . $vtvl; - } else { - $vtvl = '' . $this->users[$i]['login'] . ' (, : ' . $this->users[$this->uids[$tr_pl['user_use']]]['login'] . '): ' . $tr_nm[$tr_tp] . ' .
' . $vtvl; - } - $this->addTravm($this->users[$i]['id'], $tr_tp, rand(3, 5)); - } - } - } - $i++; - } - if ($vtvl != '') { - if ($this->info['type'] != 99) { - $vtvl2 = ' ...'; - $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl2 . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); - } - $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); - } - - // - if ($this->info['inTurnir'] > 0 && $this->info['dungeon'] != 15 && $u->info['room'] != 413) { - $bs = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "' . $this->info['inTurnir'] . '" LIMIT 1')); - $i = 0; - $j = 0; - while ($i < count($this->users)) { - if ($this->stats[$i]['hpNow'] < 1 && $this->users[$i]['clone'] == 0 && $this->stats[$i]['clone'] == 0) { - // - //echo '['.$this->users[$i]['login'].']'; - // - if ($this->users[$i]['sex'] == 0) { - $text .= '{u1} '; - } else { - $text .= '{u1} '; - } - // - $spik = mysql_query('SELECT `id`,`item_id` FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `delete` ="0"'); - while ($plik = mysql_fetch_array($spik)) { - /* - -1 - mysql_query('INSERT INTO `bs_items` (`x`,`y`,`bid`,`count`,`item_id`) VALUES ( - "'.$this->users[$i]['x'].'","'.$this->users[$i]['y'].'","'.$bs['id'].'","'.$bs['count'].'","'.$plik['item_id'].'" - )'); - */ - mysql_query('INSERT INTO `dungeon_items` (`dn`,`item_id`,`time`,`x`,`y`) VALUES ( - "' . $this->users[$i]['dnow'] . '","' . $plik['item_id'] . '","' . (time() - 600) . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '" - )'); - } - unset($spik, $plik); - // - $usrreal = ''; - $usr_real = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `login` = "' . $this->users[$i]['login'] . '" AND `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1')); - if (!isset($usr_real['id'])) { - $usr_real = $this->users[$i]; - } - if (isset($usr_real['id'])) { - $usrreal = ''; - if ($usr_real['align'] > 0) { - $usrreal .= ''; - } - if ($usr_real['clan'] > 0) { - $usrreal .= ''; - } - $usrreal .= '' . $usr_real['login'] . '[' . $usr_real['level'] . ']'; - } else { - $mereal = '[??]'; - } - $text = str_replace('{u1}', $usrreal, $text); - mysql_query('INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( - "1", "' . mysql_real_escape_string($text) . '", "' . time() . '", "' . $bs['id'] . '", "' . $bs['count'] . '", "' . $bs['city'] . '", - "' . round($bs['money'] * 0.85, 2) . '","' . $i . '" - )'); - // - // - mysql_query('DELETE FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `stats` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `actions` WHERE `uid` = "' . $this->users[$i]['id'] . '"'); - mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '"'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '"'); - mysql_query('DELETE FROM `users_delo` WHERE `uid` = "' . $this->users[$i]['id'] . '"'); - // - mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `login` = "' . $this->users[$i]['login'] . '" OR `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - // - mysql_query('UPDATE `bs_zv` SET `off` = "' . time() . '" WHERE `inBot` = "' . $this->users[$i]['id'] . '" AND `off` = "0" LIMIT 1'); - unset($text, $usrreal, $usr_real); - if ($this->users[$i]['pass'] != 'bstowerbot') { - $bs['users']--; - $bs['users_finish']++; - } else { - $bs['arhiv']--; - } - $j++; - } - $i++; - } - if ($j > 0) { - mysql_query('UPDATE `bs_turnirs` SET `arhiv` = "' . $bs['arhiv'] . '",`users` = "' . $bs['users'] . '",`users_finish` = "' . $bs['users_finish'] . '" WHERE `id` = "' . $bs['id'] . '" LIMIT 1'); - } - - unset($bs, $j); - } - - // - if ($this->info['type'] == 500 && isset($tststrt['id'])) { - // - - $i = 0; - while ($i < count($this->users)) { - if ($this->users[$i]['no_ip'] == 'trupojor') { - $mon = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_monsters` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 1')); - if (isset($mon['id'])) { - if ($this->info['team_win'] == 0) { - // - mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->stats[$i]['hpAll'] . '",`mpNow` = "' . $this->stats[$i]['mpAll'] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("! ' . mysql_real_escape_string(str_replace('{b}', - '' . $this->users[$i]['login'] . ' [' . $this->users[$i]['level'] . ']users[$i]['id'] . ' >', - $mon['nich_text'])) . ' ","' . $this->users[$i]['city'] . '","","6","1","' . time() . '")'); - } elseif ($this->info['team_win'] != $this->users[$i]['team']) { - // - $j = 0; - $usrwin = ''; - while ($j < count($this->users)) { - if ($this->users[$j]['no_ip'] != 'trupojor' && $this->users[$j]['bot'] == 0) { - if ($this->stats[$j]['hpNow'] > 0) { - $usrwin .= ', '; - if ($this->users[$j]['align'] > 0) { - $usrwin .= 'users[$j]['align'] . '.gif >'; - } - if ($this->users[$j]['clan'] > 0) { - $usrwin .= 'users[$j]['clan'] . '.gif >'; - } - $usrwin .= '' . $this->users[$j]['login'] . ' [' . $this->users[$j]['level'] . ']users[$j]['id'] . ' >'; - } - } - $j++; - } - if ($usrwin != '') { - $usrwin = ltrim($usrwin, ', '); - } else { - $usrwin = ' '; - } - - - mysql_query('UPDATE `users` SET `room` = "303" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - - /*$truptime=mysql_fetch_array(mysql_query('SELECT `s`.`id` , `s`.`res_x` FROM `stats` AS `s` WHERE `s`.`id` IN (SELECT `u`.`id` FROM `users` AS `u` WHERE `u`.`no_ip` = "trupojor") ORDER BY `s`.`res_x` DESC LIMIT 1')); - $truptimelast=$truptime['res_x']+2700; - if ($truptimelast > (time()+10080) || $truptimelast < time() ) - { - $truptimelast=time()+10080; - }*/ - // if ($this->users[$i]['level']>9) - // { - $truptimelast = time() + rand(1800, 3600); - //} - // else - // {$truptimelast=time()+10080;} - - - mysql_query('UPDATE `stats` SET `res_x` = "' . $truptimelast . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("! ' . mysql_real_escape_string(str_replace('{b}', - '' . $this->users[$i]['login'] . ' [' . $this->users[$i]['level'] . ']users[$i]['id'] . ' >', - str_replace('{u}', $usrwin, - $mon['win_text']))) . ' ","' . $this->users[$i]['city'] . '","","6","1","' . time() . '")'); - unset($usrwin); - } else { - // - if ($mon['win_back'] == 1) { - mysql_query('UPDATE `users` SET `room` = "303" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - } - mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->stats[$i]['hpAll'] . '",`mpNow` = "' . $this->stats[$i]['mpAll'] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("! ' . mysql_real_escape_string(str_replace('{b}', - '' . $this->users[$i]['login'] . ' [' . $this->users[$i]['level'] . ']users[$i]['id'] . ' >', - $mon['lose_text'])) . ' ","' . $this->users[$i]['city'] . '","","6","1","' . time() . '")'); - } - } - } - $i++; - } - } - } - - // - $i = 0; - $botsi = 0; - if (isset($tststrt['id'])) { - while ($i < count($this->users)) { - // - if ($this->info['type'] == 33) { - $plde = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1')); - if (isset($plde['mail']) && $plde['mail'] == "haot@new-combats.com") { - $pld = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1')); - - if (isset($pld['id'])) { - if ($this->users[$i]['battle_yron'] >= 500) { - $u->addItem(4754, $pld['id'], ''); - $u->addItem(4754, $pld['id'], ''); - $u->addItem(4754, $pld['id'], ''); - $u->addItem(4754, $pld['id'], ''); - $u->addItem(4754, $pld['id'], ''); - $pld['battle_text'] .= ' (x5). '; - mysql_query('UPDATE `users_achiv` SET `pg`= `pg`+1 WHERE `id` = "' . $pld['id'] . '" LIMIT 1'); - - - if ($this->users[$i]['team'] == $this->info['team_win']) { - if (rand(1, 100) <= 5) { - $u->addItem(10020, $pld['id'], ''); - $pld['battle_text'] .= ' . '; - } - } - } else { - $pld['battle_text'] .= ' . 500 .'; - } - - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $pld['city'] . "','" . $pld['room'] . "','','" . $pld['login'] . "','" . $pld['battle_text'] . "','-1','6','0')"); - mysql_query('DELETE FROM `stats` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); - mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - } - } - - unset ($plde, $pld); - } - - if ($this->users[$i]['bot'] == 1) { - $botsi++; - mysql_query('DELETE FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `stats` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); - } elseif ($this->users[$i]['bot'] == 2) { - $this->users[$i]['battle'] = 0; - mysql_query('UPDATE `users` SET `battle` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "0",`exp` = `exp` + `battle_exp`,`battle_exp` = "0",`battle_yron` = "0",`enemy` = "0", `timeGo` = "' . time() . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - //mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "0",`exp` = `exp` + `battle_exp`,`battle_exp` = "0",`timeGo` = "'.time().'" WHERE `id` = "'.$this->users[$i]['id'].'" LIMIT 1'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); - } elseif ($this->users[$i]['bot'] > 0) { - $this->users[$i]['battle'] = 0; - mysql_query('UPDATE `users` SET `battle` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "0",`exp` = `exp` + `battle_exp`,`battle_exp` = "0",`battle_yron` = "0",`enemy` = "0", `timeGo` = "' . time() . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100'); - } - if ($this->users[$i]['clone'] > 0 && $this->users[$i]['bot'] > 0 && isset($this->users[$this->uids[$this->users[$i]['clone']]]['id']) && $this->users[$this->uids[$this->users[$i]['clone']]]['team'] != $this->users[$i]['team']) { - // - if ($this->users[$this->uids[$this->users[$i]['clone']]]['team'] == $this->info['team_win']) { - $u->addAction(time(), 'win_bot_clone', '', $this->users[$i]['clone']); - } elseif ($this->info['team_win'] == 0) { - $u->addAction(time(), 'nich_bot_clone', '', $this->users[$i]['clone']); - } else { - $u->addAction(time(), 'lose_bot_clone', '', $this->users[$i]['clone']); - } - } elseif ($this->users[$i]['bot'] > 0 && $this->users[$i]['bot_id'] > 0) { - // - $j = 0; - while ($j < count($this->users)) { - if ($this->users[$j]['bot'] == 0 && $this->users[$j]['team'] != $this->users[$i]['team']) { - if ($this->users[$j]['team'] == $this->info['team_win']) { // if($this->users[$j]['team']==$this->info['team_win']){ - $u->addAction(time(), 'win_bot_' . $this->users[$i]['bot_id'], '', - $this->users[$j]['id']); - // - mysql_query('UPDATE `dialog_act` SET `now` = `now` + 1 WHERE `uid` = "' . $this->users[$j]['id'] . '" AND - ( `btl_bot` LIKE "' . $this->users[$i]['bot_id'] . '!%" OR `btl_bot` LIKE "%!' . $this->users[$i]['bot_id'] . '!%" ) - AND `val` != 1 - LIMIT 1'); - // - } elseif ($this->info['team_win'] == 0) { - $u->addAction(time(), 'nich_bot_' . $this->users[$i]['bot_id'], '', - $this->users[$j]['id']); - } else { - $u->addAction(time(), 'lose_bot_' . $this->users[$i]['bot_id'], '', - $this->users[$j]['id']); - } - } - $j++; - } - } - $i++; - } - } - - $botss = []; - if (true == true) { - if ($nl != 10) { - // - if ($this->info['dungeon'] > 0) { - if ($this->info['team_win'] == $u->info['team'] && $this->info['dungeon'] == 102) { - $j1 = mysql_fetch_array(mysql_query('SELECT * FROM `laba_obj` WHERE `type` = 2 AND `lib` = "' . $this->info['dn_id'] . '" AND `x` = "' . $this->info['x'] . '" AND `y` = "' . $this->info['y'] . '" LIMIT 1')); - if (isset($j1['id'])) { - mysql_query('DELETE FROM `laba_obj` WHERE `id` = "' . $j1['id'] . '" LIMIT 1'); - // - mysql_query('INSERT INTO `laba_obj` (`use`,`lib`,`time`,`type`,`x`,`y`,`vars`) VALUES ( - "0","' . $j1['lib'] . '","' . time() . '","6","' . $j1['x'] . '","' . $j1['y'] . '","' . (0 + $botsi) . '" - )'); - } - } elseif ($this->info['team_win'] == $u->info['team']) { - // , - $j1 = mysql_query('SELECT * FROM `dungeon_bots` WHERE `dn` = "' . $this->info['dn_id'] . '" AND `for_dn` = "0" AND `x` = "' . $this->info['x'] . '" AND `delete` = "0" AND `y`= "' . $this->info['y'] . '" LIMIT 100'); - while ($tbot = mysql_fetch_array($j1)) { - $j2 = 0; - while ($j2 < $tbot['colvo']) { - if (isset($tbot['id2'])) { - $tbot2 = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . $tbot['id_bot'] . '" LIMIT 1')); - $itms = explode('|', $tbot2['p_items']); - $tii = 0; - $testdrop = 0; - while ($tii < count($itms) && $testdrop == 0) { - $itmz = explode('=', $itms[$tii]); - if ($itmz[0] > 0) { - if (isset($itmz[2]) && $itmz[2] != '') { // $itmz[2] == quest888 - $questDrop = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `vars` LIKE "%' . $itmz[2] . '%" AND `vals` = "go" AND `uid` = "' . $u->info['id'] . '" LIMIT 1')); - } - if (isset($questDrop['id'])) { // , - } elseif (isset($itmz[2]) && $itmz[2] != '') { - $itmz[1] = 0; - } // , , 0 - unset($questDrop); - - // - if ($itmz[1] * 100000 >= rand(1, 10000000)) { - $tou = 0; // - /* */ - $itmnm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itmz[0] . '" LIMIT 1')); - $itmnm = $itmnm['name']; - - $rtxt = ' ' . $tbot2['login'] . ' "' . $itmnm . '" '; - mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[0]['city'] . "','" . $this->users[0]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')"); - - $ins = mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES ( - "' . $this->info['dn_id'] . '", - "' . $tou . '", - "' . $itmz[0] . '", - "' . time() . '", - "' . $this->info['x'] . '", - "' . $this->info['y'] . '")'); - if (!isset($questDrop['id'])) { - $testdrop = 1; // drop-drop //quest - } - } - } - $tii++; - } - } - $j2++; - } - // - // 1-15 , - if (date('m') == 9 && date('d') < 15) { - if ($this->get_chanse(99) == true) { - // - } elseif ($this->info['dungeon'] == 12 || $this->info['dungeon'] == 101) { - $tou = 0; // - /* */ - $itmz = [ - rand(4745, 4751), - 100, - ]; - // - $itmnm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itmz[0] . '" LIMIT 1')); - $itmnm = $itmnm['name']; - - $rtxt = ' ' . $tbot2['login'] . ' "' . $itmnm . '" '; - mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[0]['city'] . "','" . $this->users[0]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')"); - - $ins = mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES ( - "' . $this->info['dn_id'] . '", - "' . $tou . '", - "' . $itmz[0] . '", - "' . time() . '", - "' . $this->info['x'] . '", - "' . $this->info['y'] . '")'); - } - } - // - // , - - if (rand(1, 100) <= 99) { - // - } elseif ($this->info['dungeon'] == 12 || $this->info['dungeon'] == 3 || - $this->info['dungeon'] == 101 || $this->info['dungeon'] == 16 || - $this->info['dungeon'] == 9 || $this->info['dungeon'] == 10 || - $this->info['dungeon'] == 13 || $this->info['dungeon'] == 106) { - $tou = 0; // - // - $itmz = rand(3143, 3192); - // - $itmnm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itmz . '" LIMIT 1')); - $itmnm = $itmnm['name']; - - $rtxt = ' ' . $tbot2['login'] . ' "' . $itmnm . '" '; - mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[0]['city'] . "','" . $this->users[0]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')"); - - $ins = mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES ( - "' . $this->info['dn_id'] . '", - "' . $tou . '", - "' . $itmz . '", - "' . time() . '", - "' . $this->info['x'] . '", - "' . $this->info['y'] . '")'); - } - } - # mysql_query('UPDATE `dungeon_bots` SET `delete` = "'.time().'" WHERE `dn` = "'.$this->info['dn_id'].'" AND `for_dn` = "0" AND `x` = "'.$this->info['x'].'" AND `y`= "'.$this->info['y'].'" AND `delete` = "0" '); - mysql_query('UPDATE `dungeon_bots` SET `delete` = "' . time() . '" AND `inBattle` = "' . $this->info['id'] . '" WHERE `dn` = "' . $this->info['dn_id'] . '" AND `for_dn` = "0" AND `delete` = "0" '); - } else { - // RESTART - $dnr = 1; - if ($this->info['dungeon'] != 102) { - mysql_query('UPDATE `dungeon_bots` SET `inBattle` = "0" WHERE `dn` = "' . $this->info['dn_id'] . '" AND `for_dn` = "0" AND `x` = "' . $this->info['x'] . '" AND `y`= "' . $this->info['y'] . '"'); - } - } - } - } - - $gm = []; - $gms = []; - $bm = []; - $bms = []; - - // - // - - // - $i = $this->uids[$u->info['id']]; - - if ($this->info['team_win'] >= 0) { - // +100% - /* - if(date('w') == 0 || date('w') == 6) { - $this->stats[$i]['exp'] += 100; - } - */ - - /*if( date('d.m') == '15.05' ) { - // 40 (54, 40) - //$this->stats[$i]['exp'] += 100; - }elseif( date('d.m') == '13.06' ) { - // - //$this->stats[$i]['exp'] += 100; - }*/ - - if ($this->stats[$i]['pbe'] > 0) { - // - $this->expCoef += $this->stats[$i]['pbe']; - } - - if ($this->info['razdel'] == 5) { - if ($c['m'] >= 6 && $c['m'] <= 8) { - // - $this->expCoef += 5; - } elseif ($c['w'] == 0 || $c['w'] == 6) { - // - $this->expCoef += 5; - } - } - - $this->stats[$i]['exp'] += $this->expCoef; - - $this->stats[$i]['exp'] += $this->aBexp * $c['exp']; - - if ($this->stats[$i]['os4'] > 0) { - $this->stats[$i]['exp'] += $this->stats[$i]['os4']; - } - - /*if($this->stats[$i]['silver']>0) { - $this->stats[$i]['exp'] += 5*$this->stats[$i]['silver']; - if($this->stats[$i]['bonusexp'] > 1) { // ( ) - $this->stats[$i]['exp'] += 1000*$this->stats[$i]['bonusexp']; - } - //if($this->stats[$i]['speeden']>20) { // ( ) - //$this->stats[$i]['enNow'] += $this->stats[$i]['speeden']; - - //$upd2 = mysql_query('UPDATE `stats` SET `enNow` = "'.$this->users[$i]['enNow'].'" WHERE `id` = "'.$this->users[$i]['id'].'" LIMIT 1'); - //} - }*/ - - $act01 = 0; - $this->users[$i]['battle_exp'] = round($this->users[$i]['battle_exp'] + ($this->users[$i]['battle_exp'] / 100 * (1 + $this->info['addExp'] + $this->stats[$i]['exp']))); - - if ($this->info['type'] == 564) { - // - $this->users[$i]['battle_exp'] = 0; - } - - if ($this->info['dungeon'] == 104) { - $this->users[$i]['battle_exp'] = ($u->info['level'] * 2) * (count($this->uids) - 1); - } elseif ($this->info['dungeon'] > 0 && $this->users[$i]['dnow'] != 0 && $this->info['dungeon'] != 1 && $this->users[$i]['team'] == $this->info['team_win']) { - $dun_limitForLevel = [ - 4 => 750, - 5 => 1500, - 6 => 3500, - 7 => 8000, - 8 => 25000, - 9 => 50000, - 10 => 75000, - 11 => 100000, - 12 => 100000, - 13 => 100000, - 14 => 100000, - ]; - // . - - if ($this->users[$i]['battle_exp'] > 0) { - $dun_exp = []; // . - $rep = mysql_fetch_array(mysql_query('SELECT `dungeonexp`,`id` FROM `rep` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1')); - $rep = explode(',', $rep['dungeonexp']); - foreach ($rep as $key => $val) { - $val = explode('=', $val); // - if (isset($val[0]) && isset($val[1]) && $val[0] != '' && $val[1] != 0) { - $dun_exp[(int)$val[0]] = (int)$val[1]; - } - } - unset($rep); - } - - if (!isset($dun_exp[$this->info['dungeon']])) { - $dun_exp[$this->info['dungeon']] = 0; - } - - if (!isset($dun_limitForLevel[(int)$this->users[$i]['level']])) { // , . - $this->users[$i]['battle_exp'] = 0; - } elseif ( - isset($dun_exp[$this->info['dungeon']]) && - $dun_exp[$this->info['dungeon']] >= $dun_limitForLevel[(int)$this->users[$i]['level']] - ) { // , . - $this->users[$i]['battle_exp'] = 0; - } elseif ( - isset($dun_exp[$this->info['dungeon']]) && - $dun_limitForLevel[(int)$this->users[$i]['level']] > $dun_exp[$this->info['dungeon']] - ) { // . - if (($dun_exp[$this->info['dungeon']] + $this->users[$i]['battle_exp']) > $dun_limitForLevel[(int)$this->users[$i]['level']]) { - // , . - $this->users[$i]['battle_exp'] = abs($this->users[$i]['battle_exp'] - abs($dun_limitForLevel[(int)$this->users[$i]['level']] - ($this->users[$i]['battle_exp'] + $dun_exp[$this->info['dungeon']]))); - $dun_exp[$this->info['dungeon']] += $this->users[$i]['battle_exp']; - } elseif ($dun_limitForLevel[(int)$this->users[$i]['level']] > ($dun_exp[$this->info['dungeon']] + $this->users[$i]['battle_exp'])) { - // , . - $this->users[$i]['battle_exp'] = $this->users[$i]['battle_exp']; - $dun_exp[$this->info['dungeon']] += $this->users[$i]['battle_exp']; - } else { - $this->users[$i]['battle_exp'] = 0; - } - } else { // . - $this->users[$i]['battle_exp'] = 0; - } - - - if ($this->users[$i]['battle_exp'] > 0 && isset($dun_exp[$this->info['dungeon']]) && $dun_exp[$this->info['dungeon']] > 0) { - $dunexp = []; - foreach ($dun_exp as $key => $val) { - $dunexp[$key] = $key . '=' . $val; // - } - $dun_exp = implode(",", $dunexp); - mysql_query('UPDATE `rep` SET `dungeonexp` = "' . $dun_exp . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - unset($dunexp, $dun_exp); - } - unset($dun_limitForLevel); - } - - $sinf = ''; - if ($c['exp_mega'] == true) { - $this->users[$i]['battle_exp'] += floor($this->users[$i]['battle_exp'] / 100 * $c['exp_mega_val'][$this->users[$i]['level']]); - } - - /*if( $this->users[$i]['level'] < 8 ) { - $this->users[$i]['battle_exp'] = $this->users[$i]['battle_exp']*10; - }elseif( $this->users[$i]['level'] < 9 ) { - //$this->users[$i]['battle_exp'] = $this->users[$i]['battle_exp']*2; - }*/ - - if ($this->info['team_win'] == 0 && $this->info['type'] != 564) { - // - if ($this->info['razdel'] == 5) { - //mysql_query('INSERT INTO `users_reting` (`uid`,`time`,`val`) VALUES ( - //"'.$this->users[$i]['id'].'","'.time().'","10")'); - } - //$sinf .= ' '; - if ($this->users[$i]['level'] <= 1) { - $this->users[$i]['battle_exp'] = floor($this->users[$i]['battle_exp'] * 0.50); - } else { - //$this->users[$i]['battle_exp'] = 0; - $this->users[$i]['battle_exp'] = ceil($this->users[$i]['battle_exp'] * 0.10); - } - $this->users[$i]['nich'] += 1; - // - mysql_query('UPDATE `users` SET `swin` = 0, `slose` = 0 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - // - } elseif ($this->users[$i]['team'] == $this->info['team_win'] && $this->info['type'] != 564) { - // - if ($this->info['razdel'] == 5) { - //mysql_query('INSERT INTO `users_reting` (`uid`,`time`,`val`) VALUES ( - //"'.$this->users[$i]['id'].'","'.time().'","30")'); - } - //$sinf .= ' '; - $gm[$i] = $this->info['money']; - - $gms[$i] = $this->info['money3']; - - $this->users[$i]['win'] += 1; - $act01 = 1; - // - mysql_query('UPDATE `users` SET `swin` = `swin` + 1, `slose` = 0 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - // - } elseif ($this->info['type'] != 564) { - // - if ($this->info['razdel'] == 5) { - //mysql_query('INSERT INTO `users_reting` (`uid`,`time`,`val`) VALUES ( - //"'.$this->users[$i]['id'].'","'.time().'","10")'); - } - //$sinf .= ' '; - if ($this->users[$i]['level'] <= 1) { - $this->users[$i]['battle_exp'] = ceil($this->users[$i]['battle_exp'] * 0.33); - } else { - //$this->users[$i]['battle_exp'] = 0; - $this->users[$i]['battle_exp'] = ceil($this->users[$i]['battle_exp'] * 0.10); - } - $bm[$i] = $this->info['money']; - - $bms[$i] = $this->info['money3']; - - $this->users[$i]['lose'] += 1; - - mysql_query('UPDATE `users` SET `swin` = 0, `slose` = `slose` + 1 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - // - $act01 = 2; - } - if ($this->users[$i]['level'] < 4) { - //$this->users[$i]['battle_exp'] = $this->users[$i]['battle_exp']*3; - } - //$sinf .= ' '.$this->info['id'].'-'.$this->info['team_win'].'-'.$relbf.'-'.$this->users[$i]['team'].'-'.$tl .' '; - // - // - ( .) - if ($this->info['money3'] > 0 && isset($gms[$i]) && $this->info['type'] != 564) { - $mn = [ - 'l' => 0, // - 'w' => 0, // - 'm' => 0 // () - ]; - if ($act01 == 1) { - $mn['l'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" AND `team` != "' . $this->users[$i]['team'] . '" LIMIT 1')); - $mn['l'] = $mn['l'][0]; - $mn['w'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" AND `team` = "' . $this->users[$i]['team'] . '" LIMIT 1')); - $mn['w'] = $mn['w'][0]; - $mn['m'] = round(($mn['l'] * $this->info['money3']) / 100 * 87, 2); - $gms[$i] = round(($mn['m'] / $mn['w']), 2); - } - } - // - // - // - if ($act01 == 1) { - // - if ($this->users[$i]['dnow'] == 0) { - if ($this->users[$i]['hpNow'] < 1) { - $lom = 0.05; - } - } - } elseif ($act01 == 2) { - // - $lom = 0.55; - } else { - // - $lom = 0.05; - } - //$lom = round($lom*2.75,2); - $nlom = [0 => rand(0, 18), 1 => rand(0, 18), 2 => rand(0, 18), 3 => rand(0, 18)]; - if ($this->info['type'] == 564) { - $lom = 0; - } - if ($this->stats[$i]['silver'] >= 4) { - $lom = 0; - } - mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW`+' . $lom . ' WHERE `inOdet` < "18" AND `inOdet` > "0" AND `uid` = "' . $this->users[$i]['id'] . '" AND `inOdet`!="0" AND `inOdet`!=' . $nlom[0] . ' AND `inOdet`!=' . $nlom[1] . ' AND `inOdet`!=' . $nlom[2] . ' AND `inOdet`!=' . $nlom[3] . ' LIMIT 18'); - - $prc = ''; - if ($this->users[$i]['align'] == 2) { - $this->users[$i]['battle_exp'] = floor($this->users[$i]['battle_exp'] / 2); - } - if ($this->users[$i]['animal'] > 0) { - $ulan = $u->testAction('`uid` = "' . $this->users[$i]['id'] . '" AND `vars` = "animal_use' . $this->info['id'] . '" LIMIT 1', - 1); - if (isset($ulan['id']) && $this->users[$i]['team'] == $this->info['team_win'] && $this->users[$i]['level'] > $ulan['vals']) { - $a004 = mysql_fetch_array(mysql_query('SELECT `max_exp`,`name` FROM `users_animal` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `id` = "' . $this->users[$i]['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1')); - //33% , - $aexp = (round($this->users[$i]['battle_exp'] / 100 * 33)); - if ($aexp > $a004['max_exp']) { - $aexp = $a004['max_exp']; - } - unset($ulan); - // - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat` - ) VALUES ( - '1','" . $this->users[$i]['city'] . "','" . $this->users[$i]['room'] . "','','" . $this->users[$i]['login'] . "' - ,' "" . $a004['name'] . "" : " . $aexp . "','-1','6','0')"); - // - $upd = mysql_query('UPDATE `users_animal` SET `exp` = `exp` + ' . $aexp . ' WHERE `id` = "' . $this->users[$i]['animal'] . '" AND `level` < ' . $this->users[$i]['level'] . ' LIMIT 1'); - if ($upd) { - $this->users[$i]['battle_exp'] = round($this->users[$i]['battle_exp'] / 100 * 67); - $this->info['addExp'] -= 33.333; - } - } - } - - $prsusers = mysql_fetch_array(mysql_query('SELECT SUM(`price1`) FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" LIMIT 1')); - unset($prsusers); - $btlstatus = $this->typeBattle($prsusers[0]); - if ($this->info['smert'] == 1) { - $btlstatus = [150, 150, ' ', ' ']; - } - // - if ($this->stats[$i]['clanpos'] > 0) { - if ($this->stats[$i]['clanpos'] == 1) { - $this->info['addExp'] += 0; - } elseif ($this->stats[$i]['clanpos'] == 2) { - $this->info['addExp'] += 0; - } elseif ($this->stats[$i]['clanpos'] == 3) { - $this->info['addExp'] += 0; - } - } - - unset($r1); - // - if ($btlstatus[0] > 0) { - if ($this->info['type'] == 99) { - $this->info['addExp'] += $btlstatus[1]; - } else { - $this->info['addExp'] += $btlstatus[0]; - } - } - - if ($this->users[$i]['align'] == 2 || $this->users[$i]['haos'] > time()) { - $this->stats[$i]['exp'] = -($this->info['addExp'] + 50); - } - if ($this->info['addExp'] + $this->stats[$i]['exp'] != 0) { - $prc = ' (' . (100 + $this->info['addExp'] + $this->stats[$i]['exp']) . '%)'; - } - if ($this->info['money'] > 0) { - if (isset($gm[$i])) { - $prc .= ' ' . $gm[$i] . ' . .'; - $u->addDelo(4, $this->users[$i]['id'], - '"System.battle": ' . $gm[$i] . ' . ( ' . $this->info['id'] . ').', - time(), $this->info['city'], 'System.battle', 0, 0); - $this->users[$i]['money'] += $gm[$i]; - } elseif (isset($bm[$i])) { - $prc .= ' ' . $bm[$i] . ' . .'; - $u->addDelo(4, $this->users[$i]['id'], - '"System.battle": ' . $gm[$i] . ' . ( ' . $this->info['id'] . ').', - time(), $this->info['city'], 'System.battle', 0, 0); - $this->users[$i]['money'] -= $bm[$i]; - } - } - // - if ($c['money_haot'] == true && $this->users[$i]['exp'] <= 200000000) { - if ($act01 == 1 && $this->info['razdel'] == 5 && $this->users[$i]['level'] >= 8) { - // - $trexp = [ - 8 => 1200, - 9 => 3000, - 10 => 4500, - 11 => 12000, - 12 => 20000, - 13 => 30000, - 14 => 30000, - 15 => 30000, - 16 => 30000, - 17 => 30000, - 18 => 30000, - 19 => 30000, - 20 => 30000, - 21 => 30000, - ]; - $trexp = $trexp[$this->users[$i]['level']]; - - // - $trmn = [ - 8 => 1000, - 9 => 3000, - 10 => 2500, - 11 => 3000, - 12 => 3000, - 13 => 3000, - 14 => 3000, - 15 => 3000, - 16 => 3000, - 17 => 3000, - 18 => 3000, - 19 => 3000, - 20 => 3000, - 21 => 3000, - ]; - $trmn = $trmn[$this->users[$i]['level']]; - - // - $admn = [ - 8 => 0.05, //0.05 - 9 => 0.065, //0.065 - 10 => 0.075, //0.075 - 11 => 0.085, //0.085 - 12 => 0.1, //0.1 - 13 => 0.1, - 14 => 0.1, - 15 => 0.1, - 16 => 0.1, - 17 => 0.1, - 18 => 0.1, - 19 => 0.1, - 20 => 0.1, - 21 => 0.1, - ]; - $admn = $admn[$this->users[$i]['level']]; - - if ($c['m'] >= 6 && $c['m'] <= 8) { - // - if ($c['w'] == 0 || $c['w'] == 5 || $c['w'] == 6) { - // - $admn = $admn * 2; - } - } elseif ($c['w'] == 0 || $c['w'] == 5 || $c['w'] == 6) { - // - $admn = $admn * 2; - } - if ($this->users[$i]['battle_exp'] < $trexp) { - // - $prc .= ', 0 ( ).'; - //}elseif( $this->stats[$i]['prckr'] < $trmn ) { - // - //$prc .= ', 0 ( ).'; - } elseif ($admn > 0) { - if ($this->info['type'] != 33) { - $prc .= ', ' . $admn . ' .'; - } - $u->addDelo(4, $this->users[$i]['id'], - '"System.battle": ' . $admn . ' ( ' . $this->info['id'] . ').', - time(), $this->info['city'], 'System.battle', 0, 0); - $this->users[$i]['money2'] += $admn; - } - - //$bnsv = 0.50; - /* - if( $this->info['otmorozok_use'] > 0 ) { - $bnsv += 1; - } - if( $c['w'] == 0 || $c['w'] == 6 ) { - $bnsv += 0.50; - } - $admnb = round($bnsv+(($this->stats[$i]['prckr']/100)*$c['money_haot_proc']),2); - if($act01!=1) { - $admnb = round($admnb/10,2); - } - */ - /*$admnb = 0; - // - if( $admnb >= 0.01 ) { - $adexp = array( - 0 => 0, - 1 => 0, - 2 => 0, - 3 => 0, - 4 => 0, - 5 => 0, - 6 => 0, - 7 => 0, - 8 => 3000, - 9 => 5000, - 10 => 8000, - 11 => 12000, - 12 => 20000, - 13 => 30000, - 14 => 30000, - 15 => 30000, - 16 => 30000, - 17 => 30000, - 18 => 30000, - 19 => 30000, - 20 => 30000, - 21 => 30000 - ); - $adexp = $adexp[$this->users[$i]['level']]; - if( $adexp > 0 && $adexp > ) { - if($act01!=1) { - $adexp = round($adexp/10); - } - //$uzrbtl = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "'.$this->info['id'].'" AND `login` NOT LIKE "%(%)&" AND `align` != "" LIMIT 1')); - //$uzrbtl = $uzrbtl[0]; - if( $this->users[$i]['battle_exp'] < $adexp ) { - // .. - $prc .= ', 0 , .'; - }else{ - $prc .= ', '.$admnb.' .'; - $u->addDelo(4,$this->users[$i]['id'],'"System.battle": '.$admnb.' ( '.$this->info['id'].').',time(),$this->info['city'],'System.battle',0,0); - $this->users[$i]['money2'] += $admnb; - } - } - // - $minpsh = 0; - if($act01==1){ - // - $minpsh = 25; - }elseif($act01==2){ - // - $minpsh = 15; - }else{ - // - $minpsh = 15; - } - if( $c['w'] == 0 || $c['w'] == 6 ) { - $minpsh += 10; - } - if( $minpsh > 0 ) { - mysql_query('UPDATE `actions` SET `time` = `time` - "'.($minpsh*60).'" WHERE `vars` LIKE "psh0" AND `uid` = "'.$this->users[$i]['id'].'"'); - $prc .= ', '.$minpsh.' .'; - } - // - */ - } - } - // - if ($this->info['money3'] > 0) { - if (isset($gms[$i])) { - $prc .= ' ' . $gms[$i] . ' $. .'; - $u->addDelo(4, $this->users[$i]['id'], - '"System.battle": ' . $gms[$i] . ' $. ( ' . $this->info['id'] . ').', - time(), $this->info['city'], 'System.battle', 0, 0); - $this->users[$i]['money3'] += $gms[$i]; - mysql_query('UPDATE `users` SET `money3` = `money3` + "' . $gms[$i] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - } elseif (isset($bms[$i])) { - $prc .= ' ' . $bms[$i] . ' $. .'; - $u->addDelo(4, $this->users[$i]['id'], - '"System.battle": ' . $gms[$i] . ' $. ( ' . $this->info['id'] . ').', - time(), $this->info['city'], 'System.battle', 0, 0); - $this->users[$i]['money3'] -= $bms[$i]; - mysql_query('UPDATE `users` SET `money3` = `money3` - "' . $bms[$i] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - } - } - /*if($this->info['kingfight']==1 && $this->info['type'] != 564 ) { - // - if($this->info['team_win'] == 0) { - - }elseif($this->users[$i]['team'] == $this->info['team_win']){ - $bnks = mysql_fetch_array(mysql_query('SELECT * FROM `bank` WHERE `uid` = "'.$this->users[$i]['id'].'" ORDER BY `useNow` DESC LIMIT 1')); - if(isset($bnks['id'])) { - $bnks['msn'] = round($this->user[$i]['level']/50,2); - $bnks['msn'] = 0.15; - mysql_query('UPDATE `bank` SET `money2` = `money2` + "'.mysql_real_escape_string($bnks['msn']).'" WHERE `id` = "'.$bnks['id'].'" LIMIT 1'); - $prc .= ' : '.$bnks['msn'].' ., '.$bnks['id'].''; - - } - unset($bnks); - } - }*/ - - /* - 7 - 10800 - 8 - 36000 - 9 - 56000 - 10 - 86000 - if($this->users[$i]['battle_exp'] > (1+$this->users[$i]['level']*$this->users[$i]['level'])*4755) { - $this->users[$i]['battle_exp'] = (1+$this->users[$i]['level']*$this->users[$i]['level'])*4755; - } - */ - - //$lime = array(8=>18000,9=>28000,10=>84000,11=>150000); - $lime = [ - 8 => 18000, - 9 => 28000, - 10 => 84000, - 11 => 100, - 12 => 100, - 13 => 100, - 14 => 100, - 15 => 100, - 16 => 100, - 17 => 100, - 18 => 100, - 19 => 100, - 20 => 100, - 21 => 100, - ]; - - if ($this->users[$i]['level'] < 8) { - $lime = 5400; - } else { - $lime = $lime[$this->users[$i]['level']]; - } - - if ($this->stats[$i]['silver'] >= 5) { - $lime += round($lime); - } - - /*if( $this->stats[$i]['silver'] > 0 ) { - $lime += floor($lime/100*(10*$this->stats[$i]['silver'])); - }*/ - - if ($this->users[$i]['stopexp'] == 1) { - $lime = 0; - $this->users[$i]['battle_exp'] = 0; - } - - if ($lime < $this->users[$i]['battle_exp'] && $c['limitedexp'] == true) { - $this->users[$i]['battle_exp'] = $lime; - } - // - /*if( $this->users[$i]['battle_exp'] > 100 && $this->info[$i]['level'] == 6 ) { - $this->users[$i]['battle_exp'] = 100; - }*/ - // - unset($lime); - - - //if(100+$this->info['addExp']+$this->stats[$i]['exp'] > 1000) { - //$prc .= ' ( )'; - //} - - if ($btlstatus[0] > 0) { - if ($this->info['type'] == 99) { - $prc .= ' (' . $btlstatus[3] . ')'; - } else { - $prc .= ' (' . $btlstatus[2] . ')'; - } - } - - if ($this->info['dungeon'] == 1 && $this->users[$i]['team'] == $this->info['team_win']) { - // - $rep = mysql_fetch_array(mysql_query('SELECT `dl1`,`id` FROM `rep` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1')); - if ($rep['dl' . $this->info['dungeon']] > 0) { - $this->users[$i]['battle_exp'] += 3 * count($this->users); - if ($rep['dl' . $this->info['dungeon']] > $this->users[$i]['battle_exp']) { - $rep['dl' . $this->info['dungeon']] -= $this->users[$i]['battle_exp']; - } else { - $this->users[$i]['battle_exp'] = $rep['dl' . $this->info['dungeon']]; - $rep['dl' . $this->info['dungeon']] = 0; - } - mysql_query('UPDATE `rep` SET `dl' . $this->info['dungeon'] . '` = "' . $rep['dl' . $this->info['dungeon']] . '" WHERE `id` = "' . $rep['id'] . '" LIMIT 1'); - } else { - $this->users[$i]['battle_exp'] = 0; - } - } - - if ($this->users[$i]['battle_exp'] < 1) { - $this->users[$i]['battle_exp'] = 0; - } - - if ($this->users[$i]['battle_exp'] < 1 && $this->users[$i]['twink'] == 0) { - if ($this->info['money'] == 0 && $this->info['money3'] == 0 && $this->info['kingfight'] == 0 && (!isset($admnb) || $admnb == 0)) { - $prc = ''; - } - } - - if ($this->user[$i]['host_reg'] == 'real_bot_user') { - $this->users[$i]['battle_exp'] = round($this->users[$i]['battle_exp'] / 3); - } - - if ($sinf != '') { - $sinf = ' ( ' . $sinf . ' )'; - } - - /*if( $this->users[$i]['level'] >= 8 ) { - if( $this->users[$i]['battle_exp'] > 1000 ) { - $this->users[$i]['battle_exp'] = 1000; - } - }*/ - //-------------- 8-9-------------- - - - if ($this->users[$i]['level'] == 8 && $this->users[$i]['battle_exp'] >= 23000) { - $this->users[$i]['battle_exp'] = 23000; - }; - // if ($this->users[$i]['level']==9 ) {$this->users[$i]['battle_exp']=floor($this->users[$i]['battle_exp']/3);}; - if ($this->users[$i]['level'] == 9 && $this->users[$i]['battle_exp'] >= 31000) { - $this->users[$i]['battle_exp'] = 31000; - }; - // if ($this->users[$i]['level']==10 ) {$this->users[$i]['battle_exp']=floor($this->users[$i]['battle_exp']/4);}; - if ($this->users[$i]['level'] == 10 && $this->users[$i]['battle_exp'] >= 52000) { - $this->users[$i]['battle_exp'] = 52000; - }; - // if ($this->users[$i]['level']==11 ) {$this->users[$i]['battle_exp']=floor($this->users[$i]['battle_exp']/4);}; - if ($this->users[$i]['level'] >= 11 && $this->users[$i]['battle_exp'] >= 75000) { - $this->users[$i]['battle_exp'] = 75000; - }; - //------------------------------------- - - if ($this->info['type'] != 33) { - $this->users[$i]['battle_text'] = ' . : ' . floor($this->users[$i]['battle_yron']) . ' HP. : ' . (0 + $this->users[$i]['battle_exp']) . '' . $prc . '.' . $sinf; //stats - } - - /* */ - if ($c['nolevel'] == true) { - $rex95 = substr($this->users[$i]['exp'], -1); - if ($this->users[$i]['money4'] < 1000 && $this->users[$i]['exp'] == 12499) { - $rex95 = 6; - $rex95 = 5; - } - } else { - $rex95 = 5; - } - - - //echo '['.$rex95.']'; - if ($c['zuby'] == true && $this->info['dungeon'] == 0 && ($this->info['clone'] == 0 || $this->users[$i]['level'] < 5) && $rex95 != 9 && $this->info['type'] != 564) { - if ($this->users[$i]['align'] != 2 && $this->users[$i]['level'] >= 0 && $this->users[$i]['level'] < 8 && $this->users[$i]['battle_exp'] > 0) { - $rzb = 0; - - if ($this->get_chanse(50) == true) { - $rzb += rand(1, 3); - } else { - if ($this->users[$i]['battle_exp'] > 15) { - $rzb += 1; - } - } - - $chzbs = 100; - - if ($this->stats[$i]['silver'] > 0) { - $chzbs = 150; - } - - if ($this->users[$i]['battle_exp'] > 9) { - if ($this->users[$i]['level'] > 1) { - // - if ($this->get_chanse(25 / 100 * $chzbs) == true) { - $rzb += 10; - } - } elseif ($this->users[$i]['level'] == 1) { - if ($this->get_chanse(30 / 100 * $chzbs) == true) { - $rzb += 10; - } - } - - if ($this->users[$i]['level'] > 3) { - if ($this->get_chanse(5 / 100 * $chzbs) == true) { - $rzb += 100; - } - } - } - - if ($this->users[$i]['team'] == $this->info['team_win']) { - // - if ($this->users[$i]['level'] < 8) { - $rzb += 1; - } - } elseif ($this->users[$i]['team'] == 0) { - // - if ($this->get_chanse(25 / 100 * $chzbs) == true && $this->users[$i]['battle_exp'] > 2) { - $rzb = rand(0, 1); - } else { - $rzb = 0; - } - } else { - // - if ($this->users[$i]['level'] >= 1) { - $rzb = 0; - } else { - if ($this->users[$i]['battle_exp'] < 3) { - $rzb = 0; - } elseif ($this->user[$i]['lose'] > $this->user[$i]['win']) { - if ($this->get_chanse(5 / 100 * $chzbs) == true) { - $rzb = rand(0, 1); - } else { - $rzb = 0; - } - } elseif ($this->get_chanse(10 / 100 * $chzbs) == true) { - $rzb = rand(0, 1); - } - } - $rzb = 0; - } - - if ($rex95 == 6 /*|| $this->users[$i]['exp'] == 12499 */) { - if ($this->users[$i]['battle_exp'] > 10) { - $rzb = rand(0, 1); - } else { - $rzb = 0; - } - } - - if ($rzb > 0 && rand(0, 1000) <= 500) { - $rzb = rand(1, 3); - } - if ($rzb > 0) { - if ($this->stats[$i]['silver'] >= 5) { - $rzb = $rzb * 2; - } - mysql_query('UPDATE `users` SET `money4` = `money4` + "' . $rzb . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - $this->users[$i]['battle_text'] .= ' ' . $u->zuby($rzb, - 1) . ' .'; - } - } - } - - if ($this->info['priz'] > 0) { - // - /* - [4754] - 2-3 = 1 - 4-5 = 1 - 6-7 = 2 - 8-9 = 3 - (3) - - */ - if ($this->info['type'] == 33)// - { - /* - $pld = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `inUser` = "'.$this->users[$i]['id'].'" LIMIT 1')); - if (isset($pld['id'])) - { - $u->addItem(4754,$pld['id'],''); - $u->addItem(4754,$pld['id'],''); - $u->addItem(4754,$pld['id'],''); - $u->addItem(4754,$pld['id'],''); - $u->addItem(4754,$pld['id'],''); - $this->users[$i]['battle_text'] .= ' (x5). '; - mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `id` = "'.$pld['id'].'" LIMIT 1'); - mysql_query('DELETE FROM `users` WHERE `id` = "'.$this->users[$i]['id'].'" LIMIT 1'); - mysql_query('DELETE FROM `stats` WHERE `id` = "'.$this->users[$i]['id'].'" LIMIT 1'); - mysql_query('DELETE FROM `items_users` WHERE `uid` = "'.$this->users[$i]['id'].'" LIMIT 100'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "'.$this->users[$i]['id'].'" LIMIT 100'); - } - - if($this->users[$i]['team']==$this->info['team_win'] && isset($pld['id'])) - { - if(rand(1,100)<=5) - { - $u->addItem(10020,$pld['id'],''); - $this->users[$i]['battle_text'] .= ' . '; - } - - } - */ - } else { - $tmon = [ - 2 => 1, - 3 => 1, - 4 => 1, - 5 => 1, - 6 => 1, - 7 => 2, - 8 => 3, - 9 => 3, - 10 => 5, - 11 => 5, - ]; - $tmon = $tmon[$this->users[$i]['level']]; - // - $tmonc = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `battle` WHERE `id` IN ( SELECT `battle_id` FROM `battle_last` WHERE `uid` = "' . $this->users[$i]['id'] . '" ) AND `priz` > 0 AND `time_start` > "' . strtotime(date('d.m.Y')) . '"')); - $tmonc = $tmonc[0]; - // - if ($this->users[$i]['team'] == $this->info['team_win']) { - // - if ($tmonc < 1) { - $tmonc = 1; - } elseif ($tmonc > 96) { - $tmonc = 96; - } - $tmon = ($tmon * $tmonc); - } - // - $tmoni = 1; - while ($tmoni <= floor($tmon / 2)) { - $u->addItem(4754, $this->users[$i]['id'], ''); // - $tmoni++; - } - // - $this->users[$i]['battle_text'] .= ' (x' . floor($tmon / 2) . '). ( , ! ' . ($tmonc) . '/96 )'; - // - unset($tmon, $tmoni); - } - } - // - if ($this->info['dungeon'] == 0 && $this->info['razdel'] == 5 && $this->users[$i]['team'] == $this->info['team_win']) { - //2 - $u->repexp_add($this->users[$i]['id'], 2); // +2 - $check = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `id_eff` = 478 AND `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = 0 ORDER BY `overType` DESC LIMIT 1;')); - if (isset($check['id'])) { - $urcheck = 10000; - if ($this->users[$i]['level'] == 8) { - $urcheck = 3000; - } elseif ($this->users[$i]['level'] == 9) { - $urcheck = 7000; - } elseif ($this->users[$i]['level'] == 10) { - $urcheck = 12000; - } elseif ($this->users[$i]['level'] >= 11) { - $urcheck = 18000; - } - - if ($this->users[$i]['battle_yron'] >= $urcheck) { - //UPDATE `eff_users` SET `timeUse` = '1555700000' WHERE `eff_users`.`id` = 31912807; - mysql_query('UPDATE `eff_users` SET `timeUse` = `timeUse` - 300 WHERE `id_eff`=478 AND `delete` = 0 AND `uid` =' . $this->users[$i]['id'] . ' LIMIT 1'); - $this->users[$i]['battle_text'] .= ' ' . $urcheck . ' -5 . !'; - } - } - mysql_query('UPDATE `users_achiv` SET `vx`= `vx`+1 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); // - - } - // - if ($this->info['dungeon'] == 0 && $this->info['type'] == 250 && $this->users[$i]['team'] == $this->info['team_win']) { - mysql_query('UPDATE `users_achiv` SET `kw`= `kw`+1 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - if (date('w') == 0 || date('w') == 6 || date('w') == 4) { - $u->repexp_add($this->users[$i]['id'], 25); // () 25 - } - } - // - if ($this->info['dungeon'] == 0 && $this->info['type'] == 99 && $this->users[$i]['team'] == $this->info['team_win']) { - if (date('w') == 0 || date('w') == 6 || date('w') == 5) { - $u->repexp_add($this->users[$i]['id'], 10); // () 10 - } - } - - // - if ($this->info['dungeon'] == 0 && $this->info['type'] == 500 && $this->users[$i]['team'] == $this->info['team_win'] && $this->users[$i]['no_ip'] != 'trupojor' && $this->users[$i]['bot'] == 0) { - if ($this->users[$i]['level'] > 9) { - $mid = 903093; - } else { - $mid = 89489; - } - $mon = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_monsters` WHERE `uid` = "' . $mid . '" LIMIT 1')); - - if ($this->users[$i]['battle_yron'] >= 2000) { - $ritem = rand(1, 100); - if ($ritem <= 20) { - $mon['win_itm'] = '4459@1'; - } elseif ($ritem <= 40) { - $mon['win_itm'] = '4460@1'; - } elseif ($ritem <= 60) { - $mon['win_itm'] = '4461@1'; - } elseif ($ritem <= 80) { - $mon['win_itm'] = '4462@1'; - } else { - $mon['win_itm'] = '4463@1'; - } - } elseif ($this->users[$i]['battle_yron'] >= 1500) { - $ritem = rand(1, 100); - if ($ritem <= 20) { - $mon['win_itm'] = '4459@1'; - } elseif ($ritem <= 40) { - $mon['win_itm'] = '4460@1'; - } elseif ($ritem <= 60) { - $mon['win_itm'] = '4461@1'; - } elseif ($ritem <= 80) { - $mon['win_itm'] = '4462@1'; - } else { - $mon['win_itm'] = '4463@1'; - } - } elseif ($this->users[$i]['battle_yron'] >= 1000) { - $ritem = rand(1, 100); - if ($ritem <= 25) { - $mon['win_itm'] = '4460@1'; - } elseif ($ritem <= 50) { - $mon['win_itm'] = '4461@1'; - } elseif ($ritem <= 75) { - $mon['win_itm'] = '4462@1'; - } else { - $mon['win_itm'] = '4463@1'; - } - } else { - $mon['win_itm'] = '4392@1'; - $timewait = 0; - } - if ($this->users[$i]['battle_yron'] > 0) { - mysql_query('INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","478","111","' . $this->users[$i]['id'] . '"," ","pravonapodvig=1","' . time() . '")'); - } - mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $this->users[$i]['id'] . '","' . (time() - $timewait) . '","capitalcity","' . $this->users[$i]['room'] . '","end_trup"," ","","")'); - mysql_query('INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","479","112","' . $u->info['id'] . '"," ","zashitatk=1","' . time() . '")'); - $ritem = rand(1, 1000); - if ($ritem == 555) { - $mon['win_itm'] = $mon['win_itm'] . ',5022@1'; - } - // - $this->addGlobalItems($mid, $this->users[$i]['id'], $mon['win_itm'], $mon['win_eff'], - $mon['win_ico'], 1, $mon['win_money1'], $mon['win_money2']); //$mon['win_exp'] - - } - - if ($this->info['dungeon'] == 0 && $this->info['razdel'] == 5 && $u->info['battle_yron'] >= 2000) //$u->info['battle_yron'] - { - // ang_g - if ($this->users[$i]['team'] == $this->info['team_win']) { - // - $tmoni = 2; - } else { - $tmoni = 1; - } - - // - $tmon = $tmoni; - $effblago = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = ' . $this->users[$i]['id'] . ' AND `delete` = 0 AND `id_eff`= 414 LIMIT 1')); - if (isset ($effblago['id'])) { - $limitg = 50; - } else { - $limitg = 25; - } - while ($tmoni >= 1) { - if ($u->info['ang_g'] < $limitg) { - $u->addItem(4754, $this->users[$i]['id'], ''); - mysql_query('UPDATE `users` SET `ang_g`=`ang_g`+1 WHERE `id` =' . $this->users[$i]['id'] . ''); - } else { - $tmon--; - } - $tmoni--; - } - - if ($this->info['type'] != 33) { - $this->users[$i]['battle_text'] .= ' (' . $tmon . '). [' . ($u->info['ang_g'] + $tmon) . '/' . $limitg . '] . '; - } - unset($tmon, $tmoni, $effblago, $limitg); - } - - - if ($this->info['razdel'] == 5 || $this->info['razdel'] == 4) { - if (date('d.m') == '31.10' || (date('m') == 11 && date('d') < 7)) { - // 4504 - $this->users[$i]['battle_text'] .= ' (x1).'; - $u->addItem(4504, $this->users[$i]['id'], '|sudba=1'); - } - } - - - // - if ($this->info['dungeon'] == 0 && $this->info['razdel'] == 5 && $this->users[$i]['exp'] >= 1500 /*($this->users[$i]['exp'] < 12499 || $this->users[$i]['exp'] > 12500)*/ - ) { - if ($this->users[$i]['battle_exp'] > 100 * $this->users[$i]['level']) { - $rzbvo = $this->users[$i]['battle_exp'] * 6 / 1000; - - if ($this->users[$i]['level'] == 8) { - if ($rzbvo >= 100) { - $rzbvo = 100; - } - } - if ($this->users[$i]['level'] == 9) { - if ($rzbvo >= 150) { - $rzbvo = 150; - } - } - if ($this->users[$i]['level'] == 10) { - if ($rzbvo >= 200) { - $rzbvo = 200; - } - } - if ($this->users[$i]['level'] == 11) { - if ($rzbvo >= 250) { - $rzbvo = 250; - } - } - if ($this->users[$i]['level'] == 12) { - if ($rzbvo >= 250) { - $rzbvo = 250; - } - } - - - /*if( $this->info['players_c'] > 4 ) { - $rzbvo = 2*$this->info['players_c']; - }*/ - if ($this->info['type'] != 33) { - $this->users[$i]['battle_text'] .= ' ' . $rzbvo . ' .'; - } - mysql_query('UPDATE `rep` SET `rep3` = `rep3` + "' . $rzbvo . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $this->users[$i]['id'] . '","' . time() . '","capitalcity","' . $this->users[$i]['room'] . '","end_xaot"," ","' . $zadID . '","")'); - } - } - - if ($this->stats[$i]['hpNow'] >= 1) { - $this->stats[$i]['test_heal'] = mysql_fetch_array(mysql_query('SELECT SUM(`yrn`) FROM `battle_stat` WHERE `uid2` = "' . $this->users[$i]['id'] . '" AND `battle` = "' . $this->info['id'] . '" LIMIT 1')); - $this->stats[$i]['test_heal'] = $this->stats[$i]['test_heal'][0]; - $this->stats[$i]['test_start'] = mysql_fetch_array(mysql_query('SELECT `hpStart` FROM `battle_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `battle` = "' . $this->info['id'] . '" LIMIT 1')); - $this->stats[$i]['test_start'] = $this->stats[$i]['test_start']['hpStart']; - // - $this->stats[$i]['hpNow'] = ($this->stats[$i]['test_start'] - $this->stats[$i]['test_heal']); - if ($this->stats[$i]['hpNow'] < 1) { - $this->stats[$i]['hpNow'] = 1; - } - } else { - $this->stats[$i]['hpNow'] = 0; - } - /* - $this->stats[$i]['test_heal'] = ($this->stats[$i]['hpNow']-$this->stats[$i]['hpAll']) + $this->stats[$i]['test_heal']; - if($this->users[$i]['team']==$this->info['team_win']){ - // - $this->stats[$i]['hpNow'] -= $this->stats[$i]['test_heal']; - $this->users[$i]['hpNow'] = $this->stats[$i]['hpNow']; - if(floor($this->stats[$i]['hpNow']) < 0) { - $this->stats[$i]['hpNow'] = 0; - } - }else{ - $this->stats[$i]['hpNow'] = 0; - } - */ - unset($this->stats[$i]['test_heal']); - - $this->users[$i]['last_b'] = $this->info['id']; //stats - $this->users[$i]['last_a'] = $act01; - $this->users[$i]['battle'] = -1; //users - $this->users[$i]['battle_yron'] = 0; //stats - - $this->users[$i]['exp'] += $this->users[$i]['battle_exp']; //users - - /*if($this->stats[$i]['speeden']>2) { // ( ) - $this->users[$i]['enNow']+= $this->stats[$i]['enNow']; //users - $upd2 = mysql_query('UPDATE `stats` SET `enNow` = "'.$this->users[$i]['enNow'].'" WHERE `id` = "'.$this->users[$i]['id'].'" LIMIT 1'); - }*/ - // ( ) - - if ($this->users[$i]['clan'] > 0) { - $cpr = 1; - if ($this->info['typeBattle'] == 9) { - $cpr = 25; - } elseif ($this->info['typeBattle'] == 50) { - $cpr = 65; - } - if ($this->stats[$i]['silver'] >= 5) { - $cpr = floor($cpr / 100 * 150); - } - mysql_query('UPDATE `clan` SET `exp` = `exp` + "' . round($this->users[$i]['battle_exp'] / 100 * $cpr) . '" WHERE `id` = "' . $this->users[$i]['clan'] . '" LIMIT 1'); - } - - $this->users[$i]['battle_exp'] = 0; //stats - - if ($this->users[$i]['team'] == $this->info['team_win']) { - mysql_query('UPDATE `rep` SET `n_capitalcity` = `n_capitalcity` + ' . $this->users[$i]['bn_capitalcity'] . ' ,`n_demonscity` = `n_demonscity` + ' . $this->users[$i]['bn_demonscity'] . ' ,`n_demonscity` = `n_demonscity` + ' . $this->users[$i]['bn_suncity'] . ' WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - } - - // - $this->users[$i]['bn_demonscity'] = 0; - $this->users[$i]['bn_capitalcity'] = 0; - $this->users[$i]['bn_suncity'] = 0; - // - $spe = mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `file_finish` != "" AND `v1` = "priem" LIMIT 30'); - while ($ple = mysql_fetch_array($spe)) { - if (file_exists('../../_incl_data/class/priems/' . $ple['file_finish'] . '.php')) { - require('../../_incl_data/class/priems/' . $ple['file_finish'] . '.php'); - } - } - // - mysql_query('DELETE FROM `eff_users` WHERE `v1` = "priem" AND `uid` = "' . $this->users[$i]['id'] . '" LIMIT 50'); - if ($dnr == 1) { - if ($this->users[$i]['room'] == 370) { - $dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `dn` = "' . $this->users[$i]['dnow'] . '" AND `vars` = "dielaba" LIMIT 1')); - $dies = $dies[0]; - mysql_query('INSERT INTO `dungeon_actions` (`dn`,`uid`,`x`,`y`,`time`,`vars`,`vals`) VALUES ( - "' . $this->users[$i]['dnow'] . '","' . $this->users[$i]['id'] . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '","' . time() . '","dielaba","" - )'); - } else { - $dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `dn` = "' . $this->users[$i]['dnow'] . '" AND `vars` = "die" LIMIT 1')); - $dies = $dies[0]; - mysql_query('INSERT INTO `dungeon_actions` (`dn`,`uid`,`x`,`y`,`time`,`vars`,`vals`) VALUES ( - "' . $this->users[$i]['dnow'] . '","' . $this->users[$i]['id'] . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '","' . time() . '","die","" - )'); - } - if ($dies < 2 || $this->info['dungeon'] == 15) { - // - $tshbn = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = 0 AND `item_id` = "4910" LIMIT 1')); - if (isset($tshbn['id'])) { - // - mysql_query('DELETE FROM `items_users` WHERE `id` = "' . $tshbn['id'] . '" LIMIT 1'); - // - mysql_query('INSERT INTO `dungeon_obj` ( - `name`,`dn`,`x`,`y`,`img`,`delete`,`action`,`for_dn`, - `type`,`w`,`h`,`s`,`s2`,`os1`,`os2`,`os3`,`os4`,`type2`,`top`,`left`,`date` - ) VALUES ( - "","' . $this->info['dn_id'] . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '","shaiba.png","0","fileact:15/shaiba","0", - "0","120","220","0","0","5","8","12","0","0","0","0","{use:\'takeit\',rt1:69,rl1:-47,rt2:74,rl2:126,rt3:76,rl3:140,rt4:80,rl4:150}" - )'); - // - } - // ( 00) - $this->users[$i]['x'] = $this->users[$i]['res_x']; - $this->users[$i]['y'] = $this->users[$i]['res_y']; - $this->users[$i]['s'] = $this->users[$i]['res_s']; - $r_n = mysql_fetch_array(mysql_query('SELECT `name` FROM `room` WHERE `id` = "' . (int)$this->users[$i]['room'] . '" LIMIT 1')); - if ($this->users[$i]['room'] == 370) { - if ($this->users[$i]['sex'] == 0) { - $rtxt = '' . $this->users[$i]['login'] . ' '; - } else { - $rtxt = '' . $this->users[$i]['login'] . ' '; - } - } else { - if ($this->users[$i]['sex'] == 0) { - $rtxt = '' . $this->users[$i]['login'] . ' "' . $r_n['name'] . '"'; - } else { - $rtxt = '' . $this->users[$i]['login'] . ' "' . $r_n['name'] . '"'; - } - } - } elseif ($this->info['dungeon'] == 102) { - $nld = ''; - $lab = mysql_fetch_array(mysql_query('SELECT `id`,`users` FROM `laba_now` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1')); - if ($lab['users'] < 2) { - // - mysql_query('DELETE FROM `laba_now` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `laba_map` WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `laba_obj` WHERE `lib` = "' . $lab['id'] . '"'); - mysql_query('DELETE FROM `laba_act` WHERE `lib` = "' . $lab['id'] . '"'); - mysql_query('DELETE FROM `laba_itm` WHERE `lib` = "' . $lab['id'] . '"'); - } else { - $lab['users']--; - mysql_query('UPDATE `laba_now` SET `users` = "' . $lab['users'] . '" WHERE `id` = "' . $lab['id'] . '" LIMIT 1'); - } - mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('UPDATE `users` SET `room` = "369" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - // - mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `delete` < 1234567890 AND `inShop` = "0" AND (`dn_delete` = "1" OR `data` LIKE "%fromlaba=1%")'); - if ($this->users[$i]['login'] != '') { - if ($this->users[$i]['sex'] == 0) { - $rtxt = '' . $this->users[$i]['login'] . ' ' . $nld; - } else { - $rtxt = '' . $this->users[$i]['login'] . ' ' . $nld; - } - } - } else { - $tinf = mysql_fetch_array(mysql_query('SELECT `uid` FROM `dungeon_now` WHERE `id` = "' . $this->info['dn_id'] . '" LIMIT 1')); - $nld = ''; - if ($tinf['uid'] == $this->users[$i]['id']) { - $tinf = mysql_fetch_array(mysql_query('SELECT `id` FROM `stats` WHERE `dnow` = "' . $this->info['dn_id'] . '" AND `hpNow` >= 1 LIMIT 1')); - if (isset($tinf['id'])) { - $tinf = mysql_fetch_array(mysql_query('SELECT `id`,`login` FROM `users` WHERE `id` = "' . $tinf['id'] . '" LIMIT 1')); - $nld .= ', "' . $tinf['login'] . '"'; - mysql_query('UPDATE `dungeon_now` SET `uid` = "' . $tinf['id'] . '" WHERE `id` = "' . $this->info['dn_id'] . '" LIMIT 1'); - } - } - $rooms = [ - 374 => 372, // ( ) - 189 => 188, // ( ) - 392 => 393, // ( ) - - 398 => 397, // ( ) - 243 => 395, // ( ) - 360 => 242, // ( ) - - 19 => 293 // - ]; - // $n_rm = $rooms[$this->users[$i]['room']]; - mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('UPDATE `users` SET `room` = "321" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - // - mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `dn_delete` = "1" LIMIT 1000'); - mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `item_id` = "1189" OR `item_id` = "4447" OR `item_id` = "1174") LIMIT 1000'); - if ($this->users[$i]['sex'] == 0) { - $rtxt = '' . $this->users[$i]['login'] . ' ' . $nld; - } else { - $rtxt = '' . $this->users[$i]['login'] . ' ' . $nld; - } - } - if ($rtxt != '') { - mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[$i]['city'] . "','" . $this->users[$i]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')"); - } - } - - mysql_query('UPDATE `users` SET `login2` = "" WHERE `battle` = "' . $this->info['id'] . '"'); - $upd = mysql_query('UPDATE `users` SET `login2` = "", `money` = "' . $this->users[$i]['money'] . '", `money2` = "' . $this->users[$i]['money2'] . '",`win` = "' . $this->users[$i]['win'] . '",`lose` = "' . $this->users[$i]['lose'] . '",`nich` = "' . $this->users[$i]['nich'] . '",`battle` = "-1" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - - if ($u->info['id'] == $this->users[$i]['id']) { - $u->info['battle_text'] = $this->users[$i]['battle_text']; - } - - $upd2 = mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->stats[$i]['hpNow'] . '",`mpNow` = "' . $this->stats[$i]['mpNow'] . '",`bn_capitalcity` = 0,`bn_demonscity` = 0,`smena` = 3,`tactic7` = "-100",`x`="' . $this->users[$i]['x'] . '",`y`="' . $this->users[$i]['y'] . '",`priems_z`="0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0",`last_pr`="0",`tactic1`="0",`tactic2`="0",`tactic3`="0",`tactic4`="0",`tactic5`="0",`tactic6`="0.00000000",`tactic7`="10",`exp` = "' . $this->users[$i]['exp'] . '",`battle_exp` = "' . $this->users[$i]['battle_exp'] . '",`battle_text` = "' . $this->users[$i]['battle_text'] . '",`battle_yron` = "0",`enemy` = "0",`last_b`="' . $this->info['id'] . '",`regHP` = "' . time() . '",`regMP` = "' . time() . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - if ($this->info['turnir'] == 0) { - // - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$i]['city'] . "','" . $this->users[$i]['room'] . "','','" . $this->users[$i]['login'] . "','" . $this->users[$i]['battle_text'] . "','-1','6','0')"); - } else { - mysql_query('UPDATE `turnirs` SET `winner` = "' . $this->info['team_win'] . '" WHERE `id` = "' . $this->info['turnir'] . '" LIMIT 1'); - } - // - $upd3 = mysql_query('UPDATE `battle` SET `time_over` = "' . time() . '",`team_win` = "' . $this->info['team_win'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - - // ( ) - /*$tinf = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_now` WHERE `id` = "'.$this->info['dn_id'].'" LIMIT 1')); - if(isset($tinf['id']) && $tinf['bsid']>0) - { - $bs = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `city` = "'.$u->info['city'].'" AND `id` = "'.$tinf['bsid'].'" AND `time_start` = "'.$tinf['time_start'].'" LIMIT 1')); - if(isset($bs['id'])) - { - $u->bsfinish($bs,$this->users,$this->info); - } - }*/ - // - if ($this->users[$i]['animal'] > 0) { - $a = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `id` = "' . $this->users[$i]['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1')); - if (isset($a['id'])) { - if ($a['eda'] < 1) { - $u->send('', $this->users[$i]['room'], $this->users[$i]['city'], '', - $this->users[$i]['login'], '' . $a['name'] . ' ...', - time(), 6, 0, 0, 0, 1); - } - } - } - mysql_query('UPDATE `stats` SET `battle_text` = "",`last_b`="0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - mysql_query('UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = "' . $this->users[$i]['id'] . '"'); - //mysql_query('DELETE FROM `battle_logs` WHERE `battle` = "'.$this->info['id'].'"'); - $this->saveLogs($this->info['id'], 'all'); - if ($u->info['battle'] != 0 && !isset($u->info['battle_lsto'])) { - echo ''; - } - } else { - //echo ' , 0- , !'; - } - } - //unlink($lock_file); - mysql_query('UPDATE `battle` SET `testfinish` = "0" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - } else { - sleep(2); - mysql_query('UPDATE `battle` SET `testfinish` = "0" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - } - mysql_query('UNLOCK TABLES'); - } - - // - //$this->addGlobalItems($this->user[$i]['id'],$this->user[$j]['id'],$mon['win_itm'],$mon['win_eff'],$mon['win_ico'],$mon['win_exp'],$mon['win_money'],$mon['win_money2']); - public $ainm = []; - - public function addGlobalItems($bid, $uid, $itm, $eff, $ico, $exp, $cr, $ecr) - { - global $u; - // - // - if ($bid == 1008) { - // - $jit = 0; - $iit = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `online` > ' . (time() - 120) . '')); - $iit = floor($iit[0] / 20); - $iit = rand(1, $iit); - while ($jit < $iit) { - if (rand(0, 100) < 50) { - $svtk = [ - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1461, - 1462, - 1463, - 4037, - 4038, - 4039, - 4040, - 911, - 1172, - 1173, - 2142, - 2141, - 2143, - 2870, - 2144, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - 1000, - ]; - $svtk = $svtk[rand(0, count($svtk) - 1)]; - if ($svtk == 1000) { - mysql_query('INSERT INTO `items_local` - ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES - ( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "' . $svtk . '", - "|nosale=1|srok=259200", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - ),( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "' . $svtk . '", - "|nosale=1|srok=259200", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - ),( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "' . $svtk . '", - "|nosale=1|srok=259200", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - ),( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "' . $svtk . '", - "|nosale=1|srok=259200", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - ),( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "' . $svtk . '", - "|nosale=1|srok=259200", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - ),( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "' . $svtk . '", - "|nosale=1|srok=259200", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - )'); - } - mysql_query('INSERT INTO `items_local` - ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES - ( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "' . $svtk . '", - "|nosale=1|srok=259200", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - )'); - } - $jit++; - } - unset($svtk); - } elseif ($bid == 1007) { - //, CAPITAL CITY - $jit = 0; - $iit = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `online` > ' . (time() - 120) . '')); - $iit = floor($iit[0] / 20); - $iit = rand(1, $iit); - while ($jit < $iit) { - if (rand(0, 100) < 50) { - mysql_query('INSERT INTO `items_local` - ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES - ( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "4504", - "", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - )'); - } - $jit++; - } - } elseif ($bid == 1006) { - // CAPITAL CITY - if (rand(0, 100) < 10) { - mysql_query('INSERT INTO `items_local` - ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES - ( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "4451", - "srok=86400", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - )'); - } - } elseif ($bid == 1000) { - // CAPITAL CITY - //if( rand(0,100) < 10 ) { - mysql_query('INSERT INTO `items_local` - ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES - ( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "4460", - "srok=2592000", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - )'); - //} - } elseif ($bid == 1001) { - // CAPITAL CITY - //if( rand(0,100) < 10 ) { - mysql_query('INSERT INTO `items_local` - ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES - ( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "4461", - "srok=2592000", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - )'); - //} - } elseif ($bid == 1002) { - // CAPITAL CITY - //if( rand(0,100) < 10 ) { - mysql_query('INSERT INTO `items_local` - ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES - ( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "4462", - "srok=2592000", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - )'); - //} - } elseif ($bid == 1003) { - // CAPITAL CITY - //if( rand(0,100) < 10 ) { - mysql_query('INSERT INTO `items_local` - ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES - ( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "4463", - "srok=2592000", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - )'); - //} - } elseif ($bid == 1004) { - // CAPITAL CITY - //if( rand(0,100) < 10 ) { - mysql_query('INSERT INTO `items_local` - ( `room` , `time`,`item_id`,`data`,`tr_login`,`colvo` ) VALUES - ( - "' . $this->users[$this->uids[$uid]]['room'] . '", - "' . time() . '", - "4459", - "srok=2592000", - "' . $this->users[$this->uids[$uid]]['login'] . '", - "1" - )'); - //} - } - // - if ($exp >= 0) { - $this->users[$this->uids[$uid]]['battle_exp'] += round($exp * $this->users[$this->uids[$uid]]['battle_yron'] / $this->stats[$this->uids[$bid]]['hpAll']); - mysql_query('UPDATE `stats` SET `battle_exp` = "' . mysql_real_escape_string($this->users[$this->uids[$uid]]['battle_exp']) . '" WHERE `id` = "' . mysql_real_escape_string($uid) . '" LIMIT 1'); - } - // - if ($cr != '' && $cr > 0) { - if ($this->stats[$this->uids[$uid]]['hpNow'] > 0) { - mysql_query('UPDATE `users` SET `money` = (`money` + ' . mysql_real_escape_string($cr) . ') WHERE `id` = "' . mysql_real_escape_string($uid) . '" LIMIT 1'); - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "',' : " . mysql_real_escape_string($cr) . " .','-1','6','0')"); - } - } - // - if ($ecr != '' && $ecr > 0) { - if ($this->stats[$this->uids[$uid]]['hpNow'] > 0) { - $this->users[$this->uids[$uid]]['money2'] += $ecr; - //$sleptime=rand(1,20); - //usleep($sleptime*100000); - $resulttp = mysql_query('UPDATE `users` SET `money2` = (`money2` + ' . mysql_real_escape_string($ecr) . ') WHERE `id` = "' . $this->users[$this->uids[$uid]]['id'] . '" LIMIT 1'); - if (!$resulttp) { - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "',' !!!','-1','6','0')"); - $u->addDelo(4, $this->users[$this->uids[$uid]]['id'], - '"System.battle": ( ), !!! ', time(), - $this->users[$this->uids[$uid]]['city'], 'System.battle', 0, 0); - } else { - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "',' -: " . mysql_real_escape_string($ecr) . " .','-1','6','0')"); - $u->addDelo(4, $this->users[$this->uids[$uid]]['id'], - '"System.battle": ' . $ecr . ' ( ), : ' . $this->users[$this->uids[$uid]]['money2'] . ' ', - time(), $this->users[$this->uids[$uid]]['city'], 'System.battle', 0, 0); - } - } - } - // - if ($ico != '') { - /* - 0(, 1 - , 2 - )@ - 1( )@ - 2( )@ - 3()@ - 4( 0 1, -1)@ - 5( % 0.001)@ - 6( : add_s1=5|add_hpAll=50)@ - 7( , )@ - 8( 0 1)@ - 9( 0 or 1) - */ - $i = 0; - $txt = ''; - $ico = explode('#', $ico); - while ($i < count($ico)) { - $ico_e = explode('@', $ico[$i]); - if (isset($ico_e[3])) { - // - $add = 1; - if ($ico_e[4] == 1 && floor($this->stats[$this->uids[$uid]]['hpNow']) < 1) { - $add = 0; - } - if ($add == 1) { - $ins = false; - if ($ico_e[8] == 0) { - $ins = true; - if ($ico_e[9] == 1) { - mysql_query('DELETE FROM `users_ico` WHERE `uid` = "' . mysql_real_escape_string($uid) . '" AND `img` = "' . mysql_real_escape_string($ico_e[2]) . '"'); - } - } else { - $old_ico = mysql_fetch_array(mysql_query('SELECT `id` FROM `users_ico` WHERE `uid` = "' . mysql_real_escape_string($uid) . '" AND (`endTime` > "' . time() . '" OR `endTime` = 0) AND `img` = "' . mysql_real_escape_string($ico_e[2]) . '" LIMIT 1')); - if (!isset($old_ico['id'])) { - $ins = true; - } else { - if ($old_ico['id'] > 0) { - $txt .= ', "' . $ico_e[3] . ' ()"'; - mysql_query('UPDATE `users_ico` SET `x` = `x` + 1,`endTime` = "' . mysql_real_escape_string(time() + $ico_e[1] * 60) . '" WHERE `id` = "' . $old_ico['id'] . '" LIMIT 1'); - } else { - $ins = true; - } - } - unset($old_ico); - } - if ($ins == true) { - if ($ico_e[9] == 1) { - mysql_query('DELETE FROM `users_ico` WHERE `uid` = "' . mysql_real_escape_string($uid) . '" AND `img` = "' . mysql_real_escape_string($ico_e[2]) . '"'); - } - mysql_query('INSERT INTO `users_ico` (`uid`,`time`,`text`,`img`,`endTime`,`type`,`bonus`) VALUES ( - "' . mysql_real_escape_string($uid) . '", - "' . time() . '", - "' . mysql_real_escape_string($ico_e[3]) . '", - "' . mysql_real_escape_string($ico_e[2]) . '", - "' . mysql_real_escape_string(time() + $ico_e[1] * 60) . '", - "' . mysql_real_escape_string($ico_e[0]) . '", - "' . mysql_real_escape_string($ico_e[6]) . '" - )'); - $txt .= ', "' . $ico_e[3] . '"'; - } - } - // - } - $i++; - } - if ($txt != '') { - $txt = ltrim($txt, ', '); - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "',' : " . mysql_real_escape_string($txt) . "','-1','6','0')"); - } - } - // - if ($itm != '') { - $i = 0; - $txt = ''; - $itm = explode(',', $itm); - while ($i < count($itm)) { - $itm_e = explode('@', $itm[$i]); - if ($itm_e[0] > 0) { - $j = 0; - while ($j < $itm_e[1]) { - $u->addItem($itm_e[0], $uid, '|' . $itm_e[2]); - $j++; - } - if (!isset($this->ainm[$itm_e[0]])) { - $this->ainm[$itm_e[0]] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "' . mysql_real_escape_string($itm_e[0]) . '" LIMIT 1')); - } - if (isset($this->ainm[$itm_e[0]]['id'])) { - // - $txt .= ', ' . $this->ainm[$itm_e[0]]['name'] . ''; - if ($itm_e[1] > 1) { - $txt .= ' (x' . $itm_e[1] . ')'; - } - } - } - $i++; - } - if ($txt != '') { - $txt = ltrim($txt, ', '); - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "',' : " . mysql_real_escape_string($txt) . "','-1','6','0')"); - } - } - // - } - - // - public function addNewAtack() - { - global $u; - if (!isset($this->ga[$u->info['id']][$u->info['enemy']])) { - if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] > 0) { - /*$us = $this->stats[$this->uids[$u->info['id']]]; - $i = 1; $no = 0; - if($us['weapon1']!=1 && $us['weapon2']==1) - { - $uz['zona'] += 1; - } - while($i<=$uz['zona']) - { - if($this->uAtc['a'][$i]==0) - { - $no = 1; - } - $i++; - }*/ - $us = $this->stats[$this->uids[$u->info['id']]]; - $i = 1; - $no = 0; - - while ($i <= $us['zona']) { - if ($this->uAtc['a'][$i] == 0) { - $no = 1; - } - $i++; - } - - - if ($this->uAtc['b'] == 0) { - $no = 1; - } - - - if ($no == 0) { - // - if ($u->info['enemy'] > 0) { - if (!isset($this->ga[$u->info['enemy']][$u->info['id']])) { - if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] >= 1 && $this->stats[$this->uids[$u->info['enemy']]]['hpNow'] >= 1) { - // - $a = $this->uAtc['a'][1] . '' . $this->uAtc['a'][2] . '' . $this->uAtc['a'][3] . '' . $this->uAtc['a'][4] . '' . $this->uAtc['a'][5]; - $b = $this->uAtc['b']; - mysql_query('DELETE FROM `battle_act` WHERE `battle` = "' . $this->info['id'] . '" AND ((`uid2` = "' . $u->info['id'] . '" AND `uid1` = "' . $u->info['enemy'] . '") OR (`uid1` = "' . $u->info['id'] . '" AND `uid2` = "' . $u->info['enemy'] . '")) LIMIT 2'); - $d = mysql_query('INSERT INTO `battle_act` (`battle`,`time`,`uid1`,`uid2`,`a1`,`b1`) VALUES ("' . $this->info['id'] . '","' . time() . '","' . $u->info['id'] . '","' . $u->info['enemy'] . '","' . $a . '","' . $b . '")'); - if (!$d) { - $this->e = ' ...'; - } else { - $this->ga[$u->info['id']][$u->info['enemy']] = mysql_insert_id(); - } - } - } else { - // - if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] >= 1 && $this->stats[$this->uids[$u->info['enemy']]]['hpNow'] >= 1) { - if (isset($this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['id'])) { - $this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['a2'] = $this->uAtc['a'][1] . '' . $this->uAtc['a'][2] . '' . $this->uAtc['a'][3] . '' . $this->uAtc['a'][4] . '' . $this->uAtc['a'][5]; - $this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['b2'] = $this->uAtc['b']; - $this->startAtack($this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['id']); - } - } - } - } else { - // ( ) - - } - } else { - $this->e = ' '; - } - } else { - $this->e = ' , ...'; - } - } else { - // , - - } - } - - // , - - public function magicItems($uid1, $uid2, $end) - { - global $u, $priem, $c, $code; - if (isset($this->stats[$this->uids[$uid1]])) { - $i = 0; - while ($i < count($this->stats[$this->uids[$uid1]]['items'])) { - $itm = $this->stats[$this->uids[$uid1]]['items'][$i]; - if (isset($itm['id'])) { - $e = $u->lookStats($itm['data']); - if (isset($e['bm_a1'])) { - if ($end > 0) { - if (file_exists('../../_incl_data/class/priems/' . $e['bm_a1'] . '.end.php')) { - require('../../_incl_data/class/priems/' . $e['bm_a1'] . '.end.php'); - } - } else { - if (file_exists('../../_incl_data/class/priems/' . $e['bm_a1'] . '.php')) { - require('../../_incl_data/class/priems/' . $e['bm_a1'] . '.php'); - } - } - } - } - $i++; - } - unset($itm); - } - } - - // - public function testPog($uid, $yr) - { - //$yr = round($yr*1.25); - $yr2 = $yr; - if ($yr > 0) { - $testmana = false; - global $u, $priem; - $i = 0; - $ypg22 = 0; - while ($i < count($this->stats[$this->uids[$uid]]['set_pog2'])) { - $j = $this->stats[$this->uids[$uid]]['set_pog2'][$i]; - $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] = str_replace('add_pog2=' . $j['y'], - 'add_pog2=$', $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); - $dt3 = $u->lookStats($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); - if (isset($dt3['add_pog2mp'])) { - $priem->minMana($uid, round(round($yr2 / 100 * (100 - $dt3['add_pog2p'])) * $dt3['add_pog2mp'])); - } - $j['y'] -= $yr2; // - if (isset($dt3['add_pog2p'])) { - $yr2 = round($yr2 / 100 * (100 - $dt3['add_pog2p'])); - //echo '[: '.($dt3['add_pog2p']).'% '.(round(round($yr2/100*(100-$dt3['add_pog2p']))*$dt3['add_pog2mp'])).'MP]'; - } - unset($dt3); - if ($j['y'] < 0 || ($this->stats[$this->uids[$uid]]['mpNow'] <= 0 && $dt3['add_pog2mp'] > 0)) { - $dt2 = $u->lookStats($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); - if (isset($dt2['endPog']) && $dt2['endPog'] == 1) { - // - $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['v2'] . '" LIMIT 1')); - $this->delPriem($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1], - $this->users[$this->uids[$uid]], 4, $uid); - $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1] = 'delete'; - } - unset($dt2); - $yr2 = -($j['y']); - $j['y'] = 0; - } - - $this->stats[$this->uids[$uid]]['set_pog'][$i]['y'] = $j['y']; - $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] = str_replace('add_pog2=$', - 'add_pog2=' . $j['y'], $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); - $upd = mysql_query('UPDATE `eff_users` SET `data` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] . '" WHERE `id` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['id'] . '" LIMIT 1'); - if ($upd) { - } - $i++; - } - } - return $yr2; - } - - public $rehodeff = []; - - // - public $poglast = []; - - public function testPogB($uid, $yr, $pliid, $test = 0) - { - //$yr = round($yr*1.25); - $yr2 = $yr; - $checktuman = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "' . $uid . '" - AND (`v2` = 273 OR `v2` = 286 OR `v2` = 287 OR `v2` = 288) - AND `delete` =0 LIMIT 1')); // - //if ( !isset($checktuman['id'])) - if ($yr > 0 && !isset($checktuman['id'])) { - $testmana = false; - global $u, $priem; - $i = 0; - $ypg22 = 0; - while ($i < count($this->stats[$this->uids[$uid]]['set_pog2'])) { - $j = $this->stats[$this->uids[$uid]]['set_pog2'][$i]; - if ($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['id'] == $pliid || $test == 1) { - $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] = str_replace('add_pog2=' . $j['y'], - 'add_pog2=$', $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); - $dt3 = $u->lookStats($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); - // - $dt30 = 0; - $dt30 = floor($j['y'] / $yr2 * 100); - // - //echo '['.$j['y'].'|'.$dt3['add_pog2'].'|'.$yr2.' -> '.$dt30.'/'.$dt3['add_pog2p'].'] '; - // - if ($dt30 < $dt3['add_pog2p']) { - $dt3['add_pog2p'] = $dt30; - } - // - unset($dt30); - // - if (isset($dt3['add_pog2mp'])) { - if ((round(round($yr2 / 100 * (100 - $dt3['add_pog2p'])) * $dt3['add_pog2mp'])) > $this->stats[$this->uids[$uid]]['mpNow']) { - // , % - $j['yhj'] = $this->stats[$this->uids[$uid]]['mpNow'] / (round(round($yr2 / 100 * (100 - $dt3['add_pog2p'])) * $dt3['add_pog2mp'])) * 100; - $j['yhj'] = floor($j['yhj']); // % - $dt3['add_pog2p'] = floor($dt3['add_pog2p'] / 100 * $j['yhj']); - //echo '[!]'; - } - if ($test == 1) { - $priem->minMana($uid, round(round($yr2 / 100 * $dt3['add_pog2p']) * $dt3['add_pog2mp'])); - } - } - if (!isset($this->poglast[$uid])) { - $this->poglast[$uid] = 0; - } - $this->poglast[$uid] += $yr2; - if ($test == 1) { - //$j['y'] -= $this->poglast[$uid]; // - $j['y'] -= round($this->poglast[$uid] / 100 * $dt3['add_pog2p']); - $priem->minMana($uid, - round(round($this->poglast[$uid] / 100 * $dt3['add_pog2p']) * $dt3['add_pog2mp'])); - } - if (isset($dt3['add_pog2p'])) { - $yr2 = round($yr2 / 100 * (100 - $dt3['add_pog2p'])); - //echo '[: '.($dt3['add_pog2p']).'% ( '.$yr2/100*$dt3['add_pog2p'].' '.$yr2.' . ) '.(round(round($yr2/100*(100-$dt3['add_pog2p']))*$dt3['add_pog2mp'])).'MP , : '.$this->stats[$this->uids[$uid]]['mpNow'].']'; - } - //unset($dt3); - if ($j['y'] < 0 || ($this->stats[$this->uids[$uid]]['mpNow'] <= 0 && $dt3['add_pog2mp'] > 0)) { - $dt2 = $u->lookStats($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); - if (isset($dt2['endPog']) && $dt2['endPog'] == 1) { - // - // - $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['v2'] . '" LIMIT 1')); - $this->delPriem($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1], - $this->users[$this->uids[$uid]], 4, $uid); - $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1] = 'delete'; - } - unset($dt2); - //$yr2 += -($j['y']); - $j['y'] = 0; - } - $this->stats[$this->uids[$uid]]['set_pog'][$i]['y'] = $j['y']; - if (isset($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'])) { - $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] = str_replace('add_pog2=$', - 'add_pog2=' . $j['y'], $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']); - //echo '['.$j['id'].'!'.$this->stats[$this->uids[$uid]]['effects'][$j['id']-1]['id'].']'; - $upd = mysql_query('UPDATE `eff_users` SET `data` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] . '" WHERE `id` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['id'] . '" LIMIT 1'); - } - if ($upd) { - //echo '['.$j['y'].'->'.$yr2.']'; - //echo $this->stats[$this->uids[$uid]]['effects'][$j['id']-1]['data']; - } - if ($j['y'] - $this->poglast[$uid] + $yr2 < 0) { - //echo '['.$yr.']'; - $yr -= $yr + ($j['y'] - $this->poglast[$uid] + $yr2); - //echo '['.$this->poglast[$uid].','.$yr2.','.$j['y'].']'; - $yr2 = $yr; - $i = count($this->stats[$this->uids[$uid]]['set_pog2']) + 1; - } - } - $i++; - } - } - unset($checktuman); - return $yr2; - } - - - // - public function testHowRazmen($id) - { - $r = [ - 1 => 0, - 2 => 0, - ]; - if (isset($this->atacks[$id])) { - if ($this->atacks[$id]['out1'] > 0 && $this->atacks[$id]['out2'] > 0) { - // 1 - if ($this->atacks[$id]['out1'] == 100) { - // - $r[1] = -2; - } else { - // - $r[1] = -1; - } - // 2 - if ($this->atacks[$id]['out2'] == 100) { - // - $r[2] = -2; - } else { - // - $r[2] = -1; - } - } elseif ($this->atacks[$id]['out1'] > 0) { - // 1 - if ($this->atacks[$id]['out1'] == 100) { - // - $r[1] = -2; - } else { - // - $r[1] = -1; - } - // 2 - $r[2] = 1; - } elseif ($this->atacks[$id]['out2'] > 0) { - // 2 - if ($this->atacks[$id]['out2'] == 100) { - // - $r[2] = -2; - } else { - // - $r[2] = -1; - } - // 1 - $r[1] = 1; - } else { - // 1 2 , 2 1 - $r[1] = 1; - $r[2] = 1; - } - } - return $r; - } - - // . - public function newRazmen($id, $at = null) - { - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - if ($this->atacks[$id]['out1'] == 0) { - $at[1] = $this->usersTestAtack($id, $uid1, $uid2); - } else { - //echo '['. $this->users[$this->uids[$uid1]]['login'] .' ]'; - $at[1] = [0]; - } - if ($this->atacks[$id]['out2'] == 0) { - $at[2] = $this->usersTestAtack($id, $uid2, $uid1); - } else { - //echo '['. $this->users[$this->uids[$uid2]]['login'] .' ]'; - $at[2] = [0]; - } - - return $at; - } - - //1 2 - public function usersTestAtack($id, $uid1, $uid2) - { - $r = []; - $block = [ - 0, - 0, - 0, - 0, - 0, - 0, - ]; - - // - $i = 1; - if ($uid1 == $this->atacks[$id]['uid1']) { - $a = 2; - $j = $this->atacks[$id]['b2']; - $atack = [ - 0, - $this->atacks[$id]['a1'][0], - $this->atacks[$id]['a1'][1], - $this->atacks[$id]['a1'][2], - $this->atacks[$id]['a1'][3], - $this->atacks[$id]['a1'][4], - ]; - } elseif ($uid2 == $this->atacks[$id]['uid1']) { - $a = 1; - $j = $this->atacks[$id]['b1']; - $atack = [ - 0, - $this->atacks[$id]['a2'][0], - $this->atacks[$id]['a2'][1], - $this->atacks[$id]['a2'][2], - $this->atacks[$id]['a2'][3], - $this->atacks[$id]['a2'][4], - ]; - } - if ($this->atacks[$id]['out' . $a] == 0) { - while ($i <= $this->stats[$this->uids[$uid2]]['zonb']) { - //echo '{'.$j.'}'; - $block[$j] = 1; - $j++; - if ($j > 5 || $j < 1) { - $j = 1; - } - $i++; - } - } - // - $i = 1; - while ($i <= $this->stats[$this->uids[$uid1]]['zona']) { - if (!isset($atack[$i]) || $atack[$i] == 0) { - $atack[$i] = rand(1, 5); - } - if ($atack[$i] > 0) { - if ($block[$atack[$i]] == 1) { - // - // , - $r['atack'][] = [$atack[$i], 3, 0]; - } else { - // - // , - $r['atack'][] = [$atack[$i], 1, 0]; - } - } - $i++; - } - return $r; - } - - // - public function testRazmenblock1($id, $uid1, $uid2, $atack) - { - $r = false; - // - $i = 1; - if ($uid1 == $this->atacks[$id]['uid1']) { - $j = $this->atacks[$id]['b2']; - } elseif ($uid2 == $this->atacks[$id]['uid1']) { - $j = $this->atacks[$id]['b1']; - } - if ($this->atacks[$id]['out2'] == 0) { - while ($i <= $this->stats[$this->uids[$uid2]]['zonb']) { - //echo '{'.$j.'}'; - $block[$j] = 1; - $j++; - if ($j > 5 || $j < 1) { - $j = 1; - } - $i++; - } - } - // - if ($atack > 0) { - if ($block[$atack] == 1) { - // - // , - $r = true; - } else { - // - // , - $r = false; - } - } - return $r; - } - - // . () - public function firstRazmen($id, $at) - { - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - // - - - $i++; - } - - return $at; - } - - // - public function yhod_user($uid1, $uid2, $type) - { - // 1 - . 2 - . - // - if ($this->import_user == 0) { - $r = $uid1; - $rand_user = false; - if ($type == 2) { - // ( ) - $i = 0; - while ($i < count($this->users)) { - if ($this->users[$i]['team'] == $this->users[$this->uids[$uid2]]['team']) { - $rand_user[] = $this->users[$i]['id']; - } - $i++; - } - } elseif ($type == 4) { - // , - $i = 0; - while ($i < count($this->users)) { - //if( $this->users[$i]['team'] == $this->users[$this->uids[$uid1]]['team'] ) { - $rand_user[] = $this->users[$i]['id']; - //} - $i++; - } - } elseif ($type == 5) { - // , ( ) - $i = 0; - while ($i < count($this->users)) { - if ($this->users[$i]['team'] == $this->users[$this->uids[$uid2]]['team'] && $uid2 != $this->users[$i]['id']) { - $rand_user[] = $this->users[$i]['id']; - } - $i++; - } - } elseif ($type == 6) { - // - $i = 0; - while ($i < count($this->users)) { - if ($this->users[$i]['team'] != $this->users[$this->uids[$uid2]]['team']) { - $rand_user[] = $this->users[$i]['id']; - } - $i++; - } - } elseif ($type > 100) { - // - if (!isset($this->users[$this->uids[$type]]) || $this->users[$this->uids[$type]]['id'] != $type) { - $r = $uid2; - } else { - $r = $type; - } - } - if ($rand_user != false && count($rand_user) > 0) { - $r = $rand_user[rand(0, (count($rand_user) - 1))]; - } - $this->import_user = $r; - } else { - $r = $this->import_user; - } - return $r; - } - - // - public function mf1Razmen($id, $at, $v, $pat = false, $rjd = 0) - { - global $u; - - if ($pat == true) { - $pat = $at; - $at = $pat['p']; - } else { - unset($pat); - } - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { - $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); - } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { - $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); - } - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - // (u2) (u1) - //print_r( $at[$i] ); - $j = 0; - $wp01 = 3; - $k01 = 0; - if ($rjd > 0) { - $j = $rjd - 1; - } - while ($j < count($at[$a]['atack']) && $j < 8) { - // , - if ($k01 == 0 && isset($this->stats[$this->uids[$u1]]['wp3id'])) { - // - $wp01 = 3; - $k01 = 1; - } else { - // - if (isset($this->stats[$this->uids[$u1]]['wp14id']) && $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp14id']]['type'] != 13) { - $wp01 = 14; - } else { - if (isset($this->stats[$this->uids[$u1]]['wp3id'])) { - $wp01 = 3; - } else { - // - - $wp01 = 3; - } - } - $k01 = 0; - } - $witm01 = 0; - $witm_type01 = 0; - if ($wp01 > 0) { - $witm01 = $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp' . $wp01 . 'id']]; - $witm_data01 = $u->lookStats($witm01['data']); - //$r['wt'] = $witm['type']; - } - // - if ($at[$a]['atack'][$j][2] == $v) { - //if( $wp01 > 0 && $witm01['type'] == 20 ) { - // $tyv = $this->mfs( 2 , array( 'mf' => $this->stats[$this->uids[$u2]]['m4']*1.25 , 'amf' => $this->stats[$this->uids[$u1]]['m5'] + $witm_data01['sv_m5'] ) ); - //}else{ - $tyv = $this->mfs(2, [ - 'u1' => $u1, - 'u2' => $u2, - 'mf' => $this->stats[$this->uids[$u2]]['m4'], - 'amf' => (int)$this->stats[$this->uids[$u2]]['m15'], - 'smf' => ($this->stats[$this->uids[$u1]]['m5'] + $witm_data01['sv_m5']), - 'asmf' => $this->stats[$this->uids[$u1]]['m21'], - ], $this->users[$this->uids[$u1]]['level'], $this->users[$this->uids[$u2]]['level']); - //} - if ($tyv == 1 && $this->atacks[$id]['out' . $b] == 0) { - //, :) - $this->stats[$this->uids[$u1]]['nopryh'] = floor(0 + (int)$this->stats[$this->uids[$u1]]['nopryh']); - if (!isset($this->stats[$this->uids[$u1]]['nopryh']) || $this->stats[$this->uids[$u1]]['nopryh'] <= 0) { - $at[$a]['atack'][$j][1] = 2; - } else { - $this->stats[$this->uids[$u1]]['nopryh']--; - $this->stats[$this->uids[$u1]]['nopryh_act']++; - } - } - } - $j++; - } - - $i++; - } - unset($witm01, $witm_type01, $wp01, $k01); - - if (isset($pat) && $pat != false) { - $pat['p'] = $at; - $at = $pat; - } - - return $at; - } - - // - public function mf2Razmen($id, $at, $v, $pat = false, $rjd = 0) - { - global $u; - - if ($pat == true) { - $pat = $at; - $at = $pat['p']; - } else { - unset($pat); - } - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { - $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); - } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { - $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); - } - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - // (u1) (u2) - //print_r( $at[$i] ); - $j = 0; - $wp01 = 0; - $k01 = 0; - if ($rjd > 0) { - $j = $rjd - 1; - } - while ($j < count($at[$a]['atack']) && $j <= 8) { - // , - if ($k01 == 0 && isset($this->stats[$this->uids[$u1]]['wp3id'])) { - // - $wp01 = 3; - $k01 = 1; - } else { - // - if (isset($this->stats[$this->uids[$u1]]['wp14id']) && $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp14id']]['type'] != 13) { - $wp01 = 14; - } else { - if (isset($this->stats[$this->uids[$u1]]['wp3id'])) { - $wp01 = 3; - } else { - // - $wp01 = 3; - } - } - $k01 = 0; - } - $witm01 = 0; - $witm_type01 = 0; - if ($wp01 > 0) { - $witm01 = $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp' . $wp01 . 'id']]; - $witm_data01 = $u->lookStats($witm01['data']); - //$r['wt'] = $witm['type']; - } - // - //if( $at[$a]['atack'][$j][2] == $v ) { - if ($this->mfs(1, [ - 'u1' => $u1, - 'u2' => $u2, - 'mf' => $this->stats[$this->uids[$u1]]['m1'] + $witm_data01['sv_m1'], - 'amf' => $this->stats[$this->uids[$u1]]['m14'], - 'smf' => $this->stats[$this->uids[$u2]]['m2'], - 'aamf1' => (int)$this->stats[$this->uids[$u2]]['enemy_am1'], - ], $this->users[$this->uids[$u1]]['level'], $this->users[$this->uids[$u2]]['level']) == 1) { - //, :) - if ($at[$a]['atack'][$j][1] == 3) { - // - $at[$a]['atack'][$j][1] = 4; // - } elseif ($at[$a]['atack'][$j][1] != 2 && $at[$a]['atack'][$j][1] != 6 && $at[$a]['atack'][$j][1] != 7 && $at[$a]['atack'][$j][1] != 8) { - // - $at[$a]['atack'][$j][1] = 5; - } else { - $at[$a]['atack'][$j][1] = 1; - } - } - //} - $j++; - } - - $i++; - } - unset($witm01, $witm_type01, $k01, $wp01); - - if (isset($pat) && $pat != false) { - $pat['p'] = $at; - $at = $pat; - } - - return $at; - } - - // - public function mf3Razmen($id, $at, $v, $pat = false, $rjd = 0) - { - if ($pat == true) { - $pat = $at; - $at = $pat['p']; - } else { - unset($pat); - } - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { - $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); - } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { - $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); - } - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - // (u2) (u1) - //print_r( $at[$i] ); - $j = 0; - if ($rjd > 0) { - $j = $rjd - 1; - } - while ($j < count($at[$a]['atack']) && $j < 8) { - // , - if ((!isset($this->stats[$this->uids[$u2]]['no_pr1']) || $this->stats[$this->uids[$u2]]['no_pr1'] == 0) && $at[$a]['atack'][$j][2] == $v) { - if ($this->mfs(3, [ - 'u1' => $u1, - 'u2' => $u2, - '1' => $this->stats[$this->uids[$u2]]['m7'], - '2' => $this->stats[$this->uids[$u1]]['m7'], - ], $this->users[$this->uids[$u1]]['level'], - $this->users[$this->uids[$u2]]['level']) == 1 && $this->atacks[$id]['out' . $b] == 0) { - //, :) - $this->stats[$this->uids[$u1]]['nopryh'] = floor(0 + (int)$this->stats[$this->uids[$u1]]['nopryh']); - if ((!isset($this->stats[$this->uids[$u1]]['nopryh']) || $this->stats[$this->uids[$u1]]['nopryh'] == 0) && $this->stats[$this->uids[$u1]]['nopryh_act'] < 1) { - $at[$a]['atack'][$j][1] = 6; - $this->stats[$this->uids[$u1]]['nopryh']--; - $this->stats[$this->uids[$u1]]['nopryh_act']++; - } - } - } - $j++; - } - - $i++; - } - - if (isset($pat) && $pat != false) { - $pat['p'] = $at; - $at = $pat; - } - - return $at; - } - - // - public function mf4Razmen($id, $at, $v, $pat = false, $rjd = 0) - { - if ($pat == true) { - $pat = $at; - $at = $pat['p']; - } else { - unset($pat); - } - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { - $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); - } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { - $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); - } - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if ($this->stats[$this->uids[$u2]]['sheld1'] > 0) { - // (u2) (u1) - //print_r( $at[$i] ); - $j = 0; - while ($j < count($at[$a]['atack']) && $j < 8) { - // , - if ($at[$a]['atack'][$j][2] == $v) { - if ($this->mfs(5, - ($this->stats[$this->uids[$u2]]['m8'] / 2 + $this->stats[$this->uids[$u2]]['m18']), - $this->users[$this->uids[$u1]]['level'], - $this->users[$this->uids[$u2]]['level']) == 1 && $this->atacks[$id]['out' . $b] == 0) { - // , :) - /*if( !isset($this->stats[$this->uids[$u1]]['nopryh']) || $this->stats[$this->uids[$u1]]['nopryh'] == 0 ) {*/ - $at[$a]['atack'][$j][1] = 7; - // $this->stats[$this->uids[$u1]]['nopryh']--; - // $this->stats[$this->uids[$u1]]['nopryh_act']++; - // } - } - } - $j++; - } - } - $i++; - } - - if (isset($pat) && $pat != false) { - $pat['p'] = $at; - $at = $pat; - } - - return $at; - } - - // - public function mf5Razmen($id, $at, $v, $rjd = 0) - { - global $u; - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { - $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); - } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { - $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); - } - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - // (u2) (u1) - //print_r( $at[$i] ); - $j = 0; - if ($rjd > 0) { - $j = $rjd - 1; - } - while ($j < count($at[$a]['atack']) && $j < 8) { - // , - if ($at[$a]['atack'][$j][2] == $v) { - if ($at[$a]['atack'][$j][1] == 2) { - if ($this->mfs(6, [ - 'u1' => $u1, - 'u2' => $u2, - 'a' => $this->stats[$this->uids[$u2]]['m6'], - 'b' => $this->stats[$this->uids[$u1]]['m6'], - ], $this->users[$this->uids[$u1]]['level'], $this->users[$this->uids[$u2]]['level']) == 1) { - //, :) - $at[$a]['atack'][$j][1] = 8; - $rnd_a = rand(1, 5); - $rjd = count($at[$b]['atack']); - if ($this->testRazmenblock1($id, $u2, $u1, $rnd_a) == false) { - $at[$b]['atack'][] = [$rnd_a, 1, 0, 1]; // 3 , 0 , 1 - //$at[$b]['atack'][] = $at[$b]['atack'][(count($at[$b]['atack'])-1)]; // 3 , 0 , 1 - } else { - $at[$b]['atack'][] = [$rnd_a, 3, 0, 1]; // 3 , 0 , 1 - //$at[$b]['atack'][] = $at[$b]['atack'][(count($at[$b]['atack'])-1)]; // 3 , 0 , 1 - } - $at = $this->contrRestart($id, $at, 1, $rjd); - } - } - } - $j++; - } - - $i++; - } - - return $at; - } - - // ( ) - public function seeRazmen($id, $at) - { - $r = ''; - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - if (!isset($at[$a]['atack'])) { - $r .= 'u1 '; - } else { - $j = 0; - while ($j < count($at[$a]['atack']) && $j < 8) { - if ($at[$a]['atack'][$j][1] == 1) { - //u1 u2 - $r .= 'u1 u2'; - } elseif ($at[$a]['atack'][$j][1] == 2) { - //u2 u1 - $r .= 'u2 u1'; - } elseif ($at[$a]['atack'][$j][1] == 3) { - //u2 u1 - $r .= 'u2 u1'; - } elseif ($at[$a]['atack'][$j][1] == 4) { - //u1 u2 - $r .= 'u1 u2 '; - } elseif ($at[$a]['atack'][$j][1] == 5) { - //u1 u2 - $r .= 'u1 u2'; - } elseif ($at[$a]['atack'][$j][1] == 6) { - //u2 u1 - $r .= 'u2 u1'; - } elseif ($at[$a]['atack'][$j][1] == 7) { - //u2 u1 - $r .= 'u2 u1'; - } elseif ($at[$a]['atack'][$j][1] == 8) { - //u2 u1 - $r .= 'u2 u1 '; - } - if ($at[$a]['atack'][$j][3] == 1) { - $r .= ' ()'; - } - if (isset($at[$a]['atack'][$j]['yron'])) { - $r .= ' ' . $at[$a]['atack'][$j]['yron']['r'] . ''; - if ($at[$a]['atack'][$j]['yron']['w'] == 3) { - $r .= ' ( )'; - } elseif ($at[$a]['atack'][$j]['yron']['w'] == 14) { - $r .= ' ( )'; - } - } - if (isset($at[$a]['atack'][$j]['yron']['hp'])) { - $r .= ' [' . floor($at[$a]['atack'][$j]['yron']['hp']) . '/' . floor($at[$a]['atack'][$j]['yron']['hpAll']) . ']'; - } - $r .= ',
'; - $j++; - } - } - - $r = str_replace('u1', '' . $this->users[$this->uids[$u1]]['login'] . '', $r); - $r = str_replace('u2', '' . $this->users[$this->uids[$u2]]['login'] . '', $r); - - $r .= '|
'; - $i++; - } - - return $r; - } - - // - public function addlt($a, $id, $s, $rnd = null) - { - global $log_text; - if ($rnd === null) { - $rnd = rand(0, (count($log_text[$s][$id]) - 1)); - } - return '{' . $a . 'x' . $id . 'x' . $rnd . '}'; - } - - // - public function addNewStat($stat) - { - if (isset($stat[1])) { - mysql_query('INSERT INTO `battle_stat` - ( `battle`,`uid1`,`uid2`,`time`,`type`,`a`,`b`,`ma`,`mb`,`type_a`,`type_b`,`yrn`,`yrn_krit`,`tm1`,`tm2` ) VALUES ( - "' . $this->info['id'] . '", - "' . $stat[1]['uid1'] . '", - "' . $stat[1]['uid2'] . '", - "' . $stat[1]['time'] . '", - "' . $stat[1]['type'] . '", - "' . $stat[1]['a'] . '", - "' . $stat[1]['b'] . '", - "' . $stat[1]['ma'] . '", - "' . $stat[1]['mb'] . '", - "' . $stat[1]['type_a'] . '", - "' . $stat[1]['type_b'] . '", - "' . $stat[1]['yrn'] . '", - "' . $stat[1]['yrn_krit'] . '", - "' . $stat[1]['tm1'] . '", - "' . $stat[1]['tm2'] . '" - )'); - } - if (isset($stat[2])) { - mysql_query('INSERT INTO `battle_stat` - ( `battle`,`uid1`,`uid2`,`time`,`type`,`a`,`b`,`ma`,`mb`,`type_a`,`type_b`,`yrn`,`yrn_krit`,`tm1`,`tm2` ) VALUES ( - "' . $this->info['id'] . '", - "' . $stat[2]['uid1'] . '", - "' . $stat[2]['uid2'] . '", - "' . $stat[2]['time'] . '", - "' . $stat[2]['type'] . '", - "' . $stat[2]['a'] . '", - "' . $stat[2]['b'] . '", - "' . $stat[1]['ma'] . '", - "' . $stat[2]['mb'] . '", - "' . $stat[2]['type_a'] . '", - "' . $stat[2]['type_b'] . '", - "' . $stat[2]['yrn'] . '", - "' . $stat[2]['yrn_krit'] . '", - "' . $stat[2]['tm1'] . '", - "' . $stat[2]['tm2'] . '" - )'); - } - } - - public $prlog = []; - - // - public function asr($u1, $u2, $type) - { - mysql_query('INSERT INTO `battle_static` ( - `uid1`,`uid2`,`hod`,`type`,`time`,`bid` - ) VALUES ( - "' . $u1 . '","' . $u2 . '","' . $this->hodID . '","' . $type . '","' . time() . '","' . $this->info['id'] . '" - )'); - } - - // - public function addlogRazmen($id, $at) - { - global $u; - - $r = ''; - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - $this->hodID++; - - $dies = [ - 1 => 0, - 2 => 0, - ]; - - // - $stat = [ - 1 => [ - 'uid1' => 0, - 'uid2' => 0, - 'time' => time(), - 'type' => 0, - 'a' => '00000', - 'b' => '0', - 'type_a' => '', - 'type_b' => '0', - 'yrn' => 0, - 'yrn_krit' => 0, - 'ma' => 0, - 'mb' => 0, - 'tm1' => 0, - 'tm2' => 0, - ], - 2 => [ - 'uid1' => 0, - 'uid2' => 0, - 'time' => time(), - 'type' => 0, - 'a' => '00000', - 'b' => '0', - 'type_a' => '', - 'type_b' => '0', - 'yrn' => 0, - 'yrn_krit' => 0, - 'ma' => 0, - 'mb' => 0, - 'tm1' => 0, - 'tm2' => 0, - ], - ]; - - //if( $u->info['admin'] > 0 ) { - //echo '[a: '.count($at[1]['atack']).'/'.count($at['p'][1]['atack']).', b: '.count($at[2]['atack']).'/'.count($at['p'][2]['atack']).']'; - //} - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - if ($this->stats[$this->uids[$u1]]['yhod'] > 0) { - //$u1 = $u2; - } elseif ($this->stats[$this->uids[$u2]]['yhod'] > 0) { - $u2 = $this->yhod_user($u1, $u2, $this->stats[$this->uids[$u2]]['yhod']); - } - - $s1 = $this->users[$this->uids[$u1]]['sex']; - $s2 = $this->users[$this->uids[$u2]]['sex']; - - $stat[$a]['uid1'] = $u1; - $stat[$a]['uid2'] = $u2; - $stat[$a]['ma'] = $this->stats[$this->uids[$u1]]['zona']; - $stat[$a]['mb'] = $this->stats[$this->uids[$u1]]['zonb']; - $stat[$a]['tm1'] = $this->users[$this->uids[$u1]]['team']; - $stat[$a]['tm2'] = $this->users[$this->uids[$u2]]['team']; - $stat[$a]['a'] = $this->atacks[$id]['a' . $a]; - $stat[$a]['b'] = $this->atacks[$id]['b' . $a]; - - $vLog = 'at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] . '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] . '||bl1=' . $this->atacks[$id]['b' . $a] . '||bl2=' . $this->atacks[$id]['b' . $b] . '||time1=' . $this->atacks[$id]['time'] . '||time2=' . $this->atacks[$id]['time2'] . '||s' . $a . '=' . $s1 . '||s' . $b . '=' . $s2 . '||t2=' . $this->users[$this->uids[$u2]]['team'] . '||t1=' . $this->users[$this->uids[$u1]]['team'] . '||login1=' . $this->users[$this->uids[$u1]]['login2'] . '||login2=' . $this->users[$this->uids[$u2]]['login2'] . ''; - - $mas = [ - 'text' => '', - 'time' => time(), - 'vars' => '', - 'battle' => $this->info['id'], - 'id_hod' => $this->hodID, - 'vars' => $vLog, - 'type' => 1, - ]; - - if (!isset($at[$a]['atack'])) { // - if ($this->atacks[$id]['tpo' . $a] == 2) { - $mas['text'] .= '{u1} .'; - } else { - // - if ($this->info['razdel'] == 0 && $this->info['dn_id'] == 0 && $this->info['izlom'] == 0) { - mysql_query('INSERT INTO `battle_out` (`battle`,`uid1`,`uid2`,`time`,`out`) VALUES ( - "' . $this->info['id'] . '","' . $u1 . '","' . $u2 . '","' . time() . '","1" - )'); - } - // - if (isset($u1)) { - $mas['text'] .= '{u1} .'; - // - mysql_query('UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u1 . '" AND `delete` = 0 AND `v1` = "priem" AND (`v2`=288 OR `v2`=287 OR `v2`=286 OR `v2`=273) LIMIT 1'); - } - } - $mas['text'] = '{tm1} ' . $mas['text']; - $this->add_log($mas); - } else { - $j = 0; - while ($j < count($at[$a]['atack']) && $j < 8) { - // - $mas['text'] = ''; - // - $wt = [ - 21 => 4, - 22 => 5, - 20 => 2, - 28 => 2, - 19 => 3, - 18 => 1, - 26 => 22, - ]; - $par = [ - 'zona' => '{zn2_' . $at[$a]['atack'][$j][0] . '} ', - 'kyda' => $this->lg_zon[$at[$a]['atack'][$j][0]][rand(0, - (count($this->lg_zon[$at[$a]['atack'][$j][0]]) - 1))], - 'chem' => $this->lg_itm[$wt[$at[$a]['atack'][$j]['wt']]][rand(0, - (count($this->lg_itm[$wt[$at[$a]['atack'][$j]['wt']]]) - 1))], - ]; - // - $this->atacks[$id]['uid_' . $u1 . '_t' . $at[$a]['atack'][$j][1]]++; - // - // - $this->asr($u1, $u2, $at[$a]['atack'][$j][1]); - // - if ($at[$a]['atack'][$j][1] == 1) { - //u1 u2 - $mas['text'] .= $par['zona'] . '{u2} ' . $this->addlt($b, 1, $s2, null) . '' . $this->addlt($b, - 2, $s2, null) . '' . $this->addlt($a, 3, $s1, null) . ' {u1} ' . $this->addlt($a, 4, - $s1, null) . '' . $this->addlt($a, 5, $s1, null) . '' . $this->addlt($a, 6, $s1, - null) . ' ' . $this->addlt(1, 7, $s1, - $at[$a]['atack'][$j]['yron']['t']) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; - } elseif ($at[$a]['atack'][$j][1] == 2) { - //u2 u1 - $mas['text'] .= $par['zona'] . '{u1} ' . $this->addlt($a, 8, $s1, null) . '' . $this->addlt($a, - 9, $s1, null) . ' {u2} ' . $this->addlt($b, 11, $s2, - null) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; - } elseif ($at[$a]['atack'][$j][1] == 3) { - //u2 u1 - $mas['text'] .= $par['zona'] . '{u1} ' . $this->addlt($a, 8, $s1, null) . '' . $this->addlt($a, - 9, $s1, null) . ' {u2} ' . $this->addlt($b, 10, $s2, - null) . ' ' . $this->addlt(1, 7, 0, $s1, - $at[$a]['atack'][$j]['yron']['t']) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; - } elseif ($at[$a]['atack'][$j][1] == 4) { - //u1 u2 - if (isset($at[$a]['atack'][$j]['yron']['t'])) { - $mas['text'] .= $par['zona'] . '{u2} ' . $this->addlt($b, 1, $s2, - null) . '' . $this->addlt($b, 2, $s2, null) . '' . $this->addlt($a, 3, $s1, - null) . ' {u1} ' . $this->addlt($a, 4, $s1, null) . '' . $this->addlt($a, 5, $s1, - null) . ', , ' . $this->addlt($a, 6, $s1, - null) . ' ' . $this->addlt(1, 7, $s1, - $at[$a]['atack'][$j]['yron']['t']) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; - } - } elseif ($at[$a]['atack'][$j][1] == 5) { - //u1 u2 - $mas['text'] .= $par['zona'] . '{u2} ' . $this->addlt($b, 1, $s2, null) . '' . $this->addlt($b, - 2, $s2, null) . '' . $this->addlt($a, 3, $s1, null) . ' {u1} ' . $this->addlt($a, 4, - $s1, null) . '' . $this->addlt($a, 5, $s1, null) . '' . $this->addlt($a, 6, $s1, - null) . ' ' . $this->addlt(1, 7, $s1, - $at[$a]['atack'][$j]['yron']['t']) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; - } elseif ($at[$a]['atack'][$j][1] == 6) { - //u2 u1 - $mas['text'] .= $par['zona'] . '{u1} ' . $this->addlt($a, 8, $s1, null) . '' . $this->addlt($a, - 9, $s1, - null) . ' {u2} ' . $this->addlt(1, - 7, 0, $s1, - $at[$a]['atack'][$j]['yron']['t']) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; - } elseif ($at[$a]['atack'][$j][1] == 7) { - //u2 u1 - $mas['text'] .= $par['zona'] . '{u1} ' . $this->addlt($a, 8, $s1, null) . '' . $this->addlt($a, - 9, $s1, - null) . ' {u2}, , ' . $this->addlt($b, - 10, $s2, null) . ' ' . $this->addlt(1, 7, 0, $s1, - $at[$a]['atack'][$j]['yron']['t']) . ' ' . $par['chem'] . ' ' . $par['kyda'] . '. '; - } elseif ($at[$a]['atack'][$j][1] == 8) { - //u2 u1 - $mas['text'] .= $par['zona'] . '{u1} ' . $this->addlt($a, 8, $s1, null) . '' . $this->addlt($a, - 9, $s1, null) . ' {u2} ' . $this->addlt($b, 11, $s2, - null) . ' ' . $par['chem'] . ' ' . $par['kyda'] . ' . '; - } - - $stat[$a]['type_a'] .= '' . $at[$a]['atack'][$j][1] . ''; - if ((!isset($this->stats[$this->uids[$u2]]['notravma']) || $this->stats[$this->uids[$u2]]['notravma'] == 0) && isset($at[$a]['atack'][$j]['yron']['travma']) && $at[$a]['atack'][$j]['yron']['travma'][0] > 0 && floor($at[$a]['atack'][$j]['yron']['hp']) <= 0) { - $tr_pl = mysql_fetch_array(mysql_query('SELECT `id`,`v1` FROM `eff_users` WHERE `id_eff` = 4 AND `uid` = "' . $u2 . '" AND `delete` = "0" ORDER BY `v1` DESC LIMIT 1')); - if (!isset($tr_pl['id']) || $tr_pl['v1'] < 3) { - //263 - if (isset($tr_pl['id'])) { - $at[$a]['atack'][$j]['yron']['travma'][0] = rand(($tr_pl['v1'] + 1), 3); - } - $tr_pl2 = mysql_fetch_array(mysql_query('SELECT `id` FROM `eff_users` WHERE `uid` = "' . $u2 . '" AND `delete` = "0" AND `name` LIKE "% %" LIMIT 1')); - if (!isset($tr_pl2['id']) && $at[$a]['atack'][$j]['yron']['travma'][0] <= 3) { - $mas['text'] = rtrim($mas['text'], '. '); - $mas['text'] .= ', '; - if ($at[$a]['atack'][$j]['yron']['travma'][0] == 1) { - $mas['text'] .= ''; - $this->addTravm($u2, 1, rand(3, 5)); - } elseif ($at[$a]['atack'][$j]['yron']['travma'][0] == 2) { - $mas['text'] .= ''; - $this->addTravm($u2, 2, rand(3, 5)); - } elseif ($at[$a]['atack'][$j]['yron']['travma'][0] == 3) { - $mas['text'] .= ''; - $this->addTravm($u2, 3, rand(3, 5)); - } - $mas['text'] .= ' . '; - } - } - unset($tr_pl); - } - if ($at[$a]['atack'][$j]['yron']['pb'] == 1 && isset($at[$a]['atack'][$j]['yron']['hp'])) { - $mas['text'] = rtrim($mas['text'], '. '); - $mas['text'] .= ' . '; - } - if ($at[$a]['atack'][$j][3] == 1) { - $mas['text'] .= '() '; - } - if (isset($at[$a]['atack'][$j]['yron'])) { - if ($at[$a]['atack'][$j]['yron']['w'] == 3) { - $mas['textWP'] = '( )'; - } elseif ($at[$a]['atack'][$j]['yron']['w'] == 14) { - $mas['textWP'] = '( )'; - } else { - $mas['textWP'] = '( )'; - } - if ($at[$a]['atack'][$j][1] == 4 || $at[$a]['atack'][$j][1] == 5 || $at[$a]['atack'][$j][1] == 1) { - if ($at[$a]['atack'][$j]['yron']['y'] < 1) { - $at[$a]['atack'][$j]['yron']['r'] = '--'; - } - } - if ($at[$a]['atack'][$j][1] == 4 || $at[$a]['atack'][$j][1] == 5) { - $stat[$a]['yrn_krit'] += -$at[$a]['atack'][$j]['yron']['r']; - //$stat[$a]['yrn_krit'] += $at[$a]['atack'][$j]['yron']['k']; - $mas['text'] .= ' ' . $at[$a]['atack'][$j]['yron']['r'] . ''; - } else { - $mas['text'] .= ' ' . $at[$a]['atack'][$j]['yron']['r'] . ''; - } - $stat[$a]['yrn'] += -$at[$a]['atack'][$j]['yron']['r']; - } - if (isset($at[$a]['atack'][$j]['yron']['hp'])) { - if ($this->users[$this->uids[$u2]]['align'] == 9) { - $at[$a]['atack'][$j]['yron']['hp'] = $at[$a]['atack'][$j]['yron']['hp'] / ($at[$a]['atack'][$j]['yron']['hpAll'] / 100); - $at[$a]['atack'][$j]['yron']['hpAll'] = '100%'; - } - $mas['text'] .= ' [' . floor($at[$a]['atack'][$j]['yron']['hp']) . '/' . floor($at[$a]['atack'][$j]['yron']['hpAll']) . ']'; - } - // - if ($mas['text'] != '') { - $mas['text'] = '{tm1} ' . $mas['text']; - } - /* - '.$mass['time'].'", - "'.$mass['battle'].'", - "'.$mass['id_hod'].'", - "'.$mass['text'].'", - "'.$mass['vars'].'", - "'.$mass['zona1'].'", - "'.$mass['zonb1'].'", - "'.$mass['zona2'].'", - "'.$mass['zonb2'].'", - "'.$mass['type'].' - */ - // - if (count($at[$a]['atack'][$j]['yron']['plog']) > 0) { - $il = 0; - while ($il <= count($at[$a]['atack'][$j]['yron']['plog'])) { - if (isset($at[$a]['atack'][$j]['yron']['plog'][$il])) { - eval($at[$a]['atack'][$j]['yron']['plog'][$il]); - } - $il++; - } - } - $this->add_log($mas); - $j++; - } - } - $i++; - } - - // + _ - $this->addNewStat($stat); - - // - if (floor($this->stats[$this->uids[$u1]]['hpNow']) < 1) { - $dies[1] = 1; - } - if (floor($this->stats[$this->uids[$u2]]['hpNow']) < 1) { - $dies[2] = 1; - } - if ($dies[1] > 0 || $dies[2] > 0) { - $s1 = $this->users[$this->uids[$u1]]['sex']; - $s2 = $this->users[$this->uids[$u2]]['sex']; - - $vLog = 'at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] . '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] . '||bl1=' . $this->atacks[$id]['b' . $a] . '||bl2=' . $this->atacks[$id]['b' . $b] . '||time1=' . $this->atacks[$id]['time'] . '||time2=' . $this->atacks[$id]['time2'] . '||s2=' . $this->users[$this->uids[$u2]]['sex'] . '||s1=' . $this->users[$this->uids[$u1]]['sex'] . '||t2=' . $this->users[$this->uids[$u2]]['team'] . '||t1=' . $this->users[$this->uids[$u1]]['team'] . '||login1=' . $this->users[$this->uids[$u1]]['login2'] . '||login2=' . $this->users[$this->uids[$u2]]['login2'] . ''; - - $mas = [ - 'text' => '', - 'time' => time(), - 'vars' => '', - 'battle' => $this->info['id'], - 'id_hod' => $this->hodID, - 'vars' => $vLog, - 'type' => 1, - ]; - - $rtngwin = [1, 2, 3, 5, 10, 20, 40, 80, 160]; - $rtnglos = [0, 0, 0, -1, -2, -5, -10, -20, -40]; - - if ($this->info['typeBattle'] == 99) { - if ($btlstatus[0] == 0) { - // - $rtngwin = [2, 4, 6, 10, 20, 40, 80, 160, 320]; - if ($this->info['razdel'] == 5) { - // - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } else { - // - $rtnglos = [0, 0, 0, 0, 0, 0, 0, 0, 0]; - } - } elseif ($btlstatus[0] == 25) { - // - $rtngwin = [3, 6, 9, 15, 30, 60, 120, 240, 480]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } elseif ($btlstatus[0] == 50) { - // - $rtngwin = [4, 8, 16, 32, 64, 128, 256, 512, 1024]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } elseif ($btlstatus[0] == 75) { - // - $rtngwin = [5, 10, 20, 40, 80, 160, 320, 640, 1280]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } elseif ($btlstatus[0] == 100) { - // - $rtngwin = [6, 12, 24, 48, 98, 196, 392, 784, 1568]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } elseif ($btlstatus[0] == 150) { - // - $rtngwin = [7, 14, 28, 56, 112, 224, 448, 896, 1792]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } - } else { - if ($btlstatus[0] == 0) { - // - $rtngwin = [1, 2, 3, 5, 10, 20, 40, 80, 160]; - if ($this->info['razdel'] == 5) { - // - $rtnglos = [0, 0, 0, -1, -2, -5, -10, -20, -40]; - } else { - // - $rtnglos = [0, 0, 0, 0, 0, 0, 0, 0, 0]; - } - } elseif ($btlstatus[0] == 25) { - // - $rtngwin = [2, 4, 6, 10, 20, 40, 80, 160, 320]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } elseif ($btlstatus[0] == 50) { - // - $rtngwin = [3, 6, 9, 15, 30, 60, 120, 240, 480]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } elseif ($btlstatus[0] == 75) { - // - $rtngwin = [4, 8, 16, 32, 64, 128, 256, 512, 1024]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } elseif ($btlstatus[0] == 100) { - // - $rtngwin = [5, 10, 20, 40, 80, 160, 320, 640, 1280]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } elseif ($btlstatus[0] == 150) { - // - $rtngwin = [7, 14, 28, 56, 112, 224, 448, 896, 1792]; - $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; - } - } - - if ($this->info['dn_id'] > 0 || $this->info['izlom'] != 0 || $this->info['turnir'] != 0) { - // , - $rtngwin = [0, 0, 0, 0, 0, 0, 0, 0, 0]; - $rtnglos = [0, 0, 0, 0, 0, 0, 0, 0, 0]; - } elseif ($this->info['clan1'] > 0 && $this->info['clan2'] > 0) { - // - $rtngwin = [3, 6, 9, 15, 30, 60, 120, 240, 480]; - $rtnglos = [-1, -2, -4, -8, -16, -32, -64, -128, -256]; - } - - /* - $btlstatus if( $x < 50000 ) { - // - }elseif( $x >= 50000 && $x < 100000 ) { - $r = array(25,50,' ',' '); - }elseif( $x < 150000 ) { - $r = array(50,75,' ',' '); - }elseif( $x < 200000 ) { - $r = array(75,100,' ',' '); - }elseif( $x < 250000 ) { - $r = array(100,125,' ',' '); - }elseif( $x >= 250000 ) { - $r = array(150,150,' ',' '); - } - */ - - if ($dies[1] == 1) { - if ($this->info['dn_id'] > 0) { - // - } else { - if ($this->users[$this->uids[$u1]]['level'] >= 4) { - $rtng1 += $rtnglos[$this->users[$this->uids[$u1]]['level'] - 4]; - $rtng2 += $rtngwin[$this->users[$this->uids[$u1]]['level'] - 4]; - } - } - // 1 2 - $this->spaCheck($this->users[$this->uids[$u1]]['id']); - } - if ($dies[2] == 1) { - if ($this->info['dn_id'] > 0) { - // - } else { - if ($this->users[$this->uids[$u1]]['level'] >= 4) { - $rtng1 += $rtnglos[$this->users[$this->uids[$u1]]['level'] - 4]; - $rtng2 += $rtngwin[$this->users[$this->uids[$u1]]['level'] - 4]; - } - } - // 2 1 - $this->spaCheck($this->stats[$this->uids[$u2]]['id']); - } - // - // - if ($this->info['type'] != 564 && $this->stats[$this->uids[$u1]]['inTurnir'] == 0 && $this->stats[$this->uids[$u2]]['inTurnir'] == 0 && $this->info['dn_id'] == 0 && $this->info['izlom'] == 0) { - // - if ($this->users[$this->uids[$u2]]['bot'] == 0) { - mysql_query('INSERT INTO `users_reting` (`uid`,`time`,`val`,`align`,`clan`) VALUES ( - "' . $u1 . '","' . time() . '","' . $rtng1 . '","' . $this->users[$this->uids[$u1]]['align'] . '","' . $this->users[$this->uids[$u1]]['clan'] . '")'); - } - unset($rtng); - if ($this->users[$this->uids[$u1]]['bot'] == 0) { - mysql_query('INSERT INTO `users_reting` (`uid`,`time`,`val`,`align`,`clan`) VALUES ( - "' . $u2 . '","' . time() . '","' . $rtng2 . '","' . $this->users[$this->uids[$u2]]['align'] . '","' . $this->users[$this->uids[$u2]]['clan'] . '")'); - } - } - unset($rtng1, $rtng2); - } - - return true; - } - - // - public function priemAddLog($id, $a, $b, $u1, $u2, $prm, $text, $hodID, $tm1 = 0, $tm2 = 0) - { - $time = time(); - if ($tm1 == 0) { - $tm1 = isset($this->atacks[$id]) ? $this->atacks[$id]['time'] : $time; - } - if ($tm2 == 0) { - $tm2 = isset($this->atacks[$id]) ? $this->atacks[$id]['time2'] : $time; - } - $prm = str_replace('=', '^^^^', $prm); - $vLog = - 'prm=' . $prm . - '||at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] . - '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] . - '||bl1=' . $this->atacks[$id]['b' . $a] . - '||bl2=' . $this->atacks[$id]['b' . $b] . - '||time1=' . $tm1 . - '||time2=' . $tm2 . - '||s' . $a . '=' . $this->users[$this->uids[$u1]]['sex'] . - '||s' . $b . '=' . $this->users[$this->uids[$u2]]['sex'] . - '||t2=' . $this->users[$this->uids[$u2]]['team'] . - '||t1=' . $this->users[$this->uids[$u1]]['team'] . - '||login1=' . $this->users[$this->uids[$u1]]['login2'] . - '||login2=' . $this->users[$this->uids[$u2]]['login2']; - - $mas = [ - 'text' => $text, - 'time' => $time, - 'battle' => $this->info['id'], - 'id_hod' => $hodID, - 'vars' => $vLog, - 'type' => 1, - ]; - $this->add_log($mas); - } - - // ( ) - public function priemAddLogFast($u1, $u2, $prm, $text, $hodID, $tm) - { - $vLog = 'prm=' . $prm . '||time1=' . $tm . '||time2=' . $tm . '||s1=' . $this->users[$this->uids[$u1]]['sex'] . '||s2=' . $this->users[$this->uids[$u2]]['sex'] . '||t2=' . $this->users[$this->uids[$u2]]['team'] . '||t1=' . $this->users[$this->uids[$u1]]['team'] . '||login1=' . $this->users[$this->uids[$u1]]['login2'] . '||login2=' . $this->users[$this->uids[$u2]]['login2'] . ''; - $mas = [ - 'text' => $text, - 'time' => time(), - 'vars' => '', - 'battle' => $this->info['id'], - 'id_hod' => ($this->hodID + $hodID), - 'vars' => $vLog, - 'type' => 1, - ]; - $this->add_log($mas); - } - - // - public function contrRestart($id, $at, $v, $rjd = 0) - { - // - /*$at['p'] = $at; - // - $at = $this->mf2Razmen($id,$at,$v,true); - // ( , ) - $at = $this->mf4Razmen($id,$at,$v,true); - // - $at = $this->mf1Razmen($id,$at,$v,true); - // - $at = $this->mf3Razmen($id,$at,$v,true); - // - //$at = $this->mf5Razmen($id,$at,$v); - // - $at = $this->yronRazmen($id,$at,true); - //$at = $this->yronRazmen($id,$at); - - $at = $at['p'];*/ - - - // - $at = $this->mf1Razmen($id, $at, $v, true, $rjd); - // - $at = $this->mf3Razmen($id, $at, $v, true, $rjd); - // - //$at = $this->mf5Razmen($id,$at,$v,true,$rjd); - // ( , ) - $at = $this->mf4Razmen($id, $at, $v, true, $rjd); - // - //$at = $this->yronRazmen($id,$at); - // - $at = $this->mf2Razmen($id, $at, $v, true, $rjd); - $at = $this->yronRazmen($id, $at, true, $rjd); - - - return $at; - } - - // - /* public function contrRestart($id,$at,$v) { - // - $at['p'] = $at; - // - //$at = $this->mf2Razmen($id,$at,$v,true); - // ( , ) - $at = $this->mf4Razmen($id,$at,$v,true); - // - $at = $this->mf1Razmen($id,$at,$v,true); - // - $at = $this->mf3Razmen($id,$at,$v,true); - // - //$at = $this->mf5Razmen($id,$at,$v); - // - //$at = $this->yronRazmen($id,$at,true); - $at = $this->yronRazmen($id,$at); - - $at = $at['p']; - - return $at; - } - */ - - // - public function yronGetrazmenStats($s, $z) - { - global $u; - /* - 1 - - 2 - - 3 - ( ) - 4 - - 5 - - 6 - - 7 - - 8 - - 9 - - 10-12 - - 13 - - 14 - / ( ) - 16 - - 17 - - */ - $zi = [ // - 1 => [1, 8, 9, 52], // - 2 => [4, 5, 6], // - 3 => [2, 4, 5, 6, 13], // - 4 => [7, 16, 10, 11, 12], // - 5 => [17] // - ]; - // - $zi = $zi[$z]; - $i = 0; - // - while ($i < count($zi)) { - // - $t = $u->items['add']; - $ii = 0; - // - while ($ii < count($s['items'])) { - if (isset($s['items'][$ii]) && $s['items'][$ii]['inOdet'] == $zi[$i]) { - $po = $u->lookStats($s['items'][$ii]['data']); - // - $x = 0; - while ($x < count($t)) { - $n = $t[$x]; - if (isset($po['sv_' . $n])) { - $s[$n] += $po['sv_' . $n]; - if ($n == 'za') { - $iii = 1; - while ($iii <= 4) { - $s['za' . $iii] += $po['sv_' . $n]; - $iii++; - } - } elseif ($n == 'zm') { - $iii = 1; - while ($iii <= 4) { - $s['zm' . $iii] += $po['sv_' . $n]; - $iii++; - } - } elseif ($n == 'zma') { - $iii = 1; - while ($iii <= 7) { - $s['zma' . $iii] += $po['sv_' . $n]; - $iii++; - } - } - } - $x++; - } - // - } - $ii++; - } - // - $i++; - } - // - return $s; - } - - // . - public function yronGetrazmen($uid1, $uid2, $wp, $zona) - { - global $u; - //$oldst1 = $this->stats[$this->uids[$uid1]]; - //$oldst2 = $this->stats[$this->uids[$uid2]]; - // 1 2 - //$this->stats[$this->uids[$uid1]] = $this->yronGetrazmenStats( $this->stats[$this->uids[$uid1]] , $zona ); - //$this->stats[$this->uids[$uid2]] = $this->yronGetrazmenStats( $this->stats[$this->uids[$uid2]] , $zona ); - //$this->a_save_stats($uid1); - //$this->a_save_stats($uid2); - // - //$this->a_testing_stats($uid1,$zona); - //$this->a_testing_stats($uid2,$zona); - // - $r = [ - 'y' => 0, - 'r' => '--', - ]; - // - /* - - - - - */ - $witm = 0; - $witm_type = 0; - - if ($wp > 0) { - $witm = $this->stats[$this->uids[$uid1]]['items'][$this->stats[$this->uids[$uid1]]['wp' . $wp . 'id']]; - $witm_data = $u->lookStats($witm['data']); - $witm_type = $this->weaponTx($witm); - //$r['wt'] = $witm['type']; - } - //$witm_type=1; - if ($witm_type == 0 || $witm_type == 12) { - $witm_type2 = ''; - } else { - $witm_type2 = $witm_type; - } - $r['t'] = $witm_type2; - // - /* - - - - - - */ - $bron = [ - 1 => [$this->stats[$this->uids[$uid2]]['mib1'], $this->stats[$this->uids[$uid2]]['mab1']], - 2 => [$this->stats[$this->uids[$uid2]]['mib2'], $this->stats[$this->uids[$uid2]]['mab2']], - 3 => [$this->stats[$this->uids[$uid2]]['mib2'], $this->stats[$this->uids[$uid2]]['mab2']], - 4 => [$this->stats[$this->uids[$uid2]]['mib3'], $this->stats[$this->uids[$uid2]]['mab3']], - 5 => [$this->stats[$this->uids[$uid2]]['mib4'], $this->stats[$this->uids[$uid2]]['mab4']], - ]; - // - // - //$witm_data - $iii = 1; - while ($iii <= 7) { - if (isset($witm_data['sv_a' . $iii]) && $witm_data['sv_a' . $iii] != 0) { - $this->stats[$this->uids[$uid1]]['a' . $iii] += $witm_data['sv_a' . $iii]; - } - if (isset($witm_data['sv_mg' . $iii]) && $witm_data['sv_mg' . $iii] != 0) { - $this->stats[$this->uids[$uid1]]['mg' . $iii] += $witm_data['sv_mg' . $iii]; - } - $iii++; - } - $iii = 1; - while ($iii <= 4) { - if (isset($witm_data['sv_aall']) && $witm_data['sv_aall'] != 0) { - $this->stats[$this->uids[$uid1]]['a' . $iii] += $witm_data['sv_aall']; - } - $iii++; - } - $iii = 1; - while ($iii <= 4) { - if (isset($witm_data['sv_mall']) && $witm_data['sv_mall'] != 0) { - $this->stats[$this->uids[$uid1]]['mg' . $iii] += $witm_data['sv_mall']; - } - $iii++; - } - $iii = 1; - while ($iii <= 7) { - if (isset($witm_data['sv_m2all']) && $witm_data['sv_m2all'] != 0) { - $this->stats[$this->uids[$uid1]]['mg' . $iii] += $witm_data['sv_m2all']; - } - $iii++; - } - - if (isset($witm_data['sv_m3']) && $witm_data['sv_m3'] != 0) { - $this->stats[$this->uids[$uid1]]['m3'] += $witm_data['sv_m3']; - } - - $iii = 1; - while ($iii <= 7) { - if (isset($witm_data['sv_pa' . $iii]) && $witm_data['sv_pa' . $iii] != 0) { - $this->stats[$this->uids[$uid1]]['pa' . $iii] += $witm_data['sv_pa' . $iii] + $witm_data['sv_m10']; - } - if (isset($witm_data['sv_pm' . $iii]) && $witm_data['sv_pm' . $iii] != 0) { - $this->stats[$this->uids[$uid1]]['pm' . $iii] += $witm_data['sv_pm' . $iii] + $witm_data['sv_m11a']; - if ($iii < 5) { - $this->stats[$this->uids[$uid1]]['pm' . $iii] += $witm_data['sv_m11']; - } - } - $iii++; - } - // - // + - $wAp = 0; - $w3p = 0; - $w14p = 0; - /* - , - if($witm_type==12) { - // - $wAp += $this->stats[$this->uids[$uid1]]['m10']; - if($this->users[$this->uids[$uid1]]['align']==7) { - $wAp += 15; - } - }elseif($witm_type < 5) { - $wAp += $this->stats[$this->uids[$uid1]]['pa'.$witm_type.''] + $this->stats[$this->uids[$uid1]]['m10'] + $witm_data['sv_pa'.$witm_type.'']; - $wAp -= $this->stats[$this->uids[$uid2]]['antpa'.$witm_type.'']; - }else{ - $wAp += $this->stats[$this->uids[$uid1]]['pm'.($witm_type-4).''] + $this->stats[$this->uids[$uid1]]['m11a'] + $witm_data['sv_pm'.($witm_type-4).'']; - $wAp -= $this->stats[$this->uids[$uid2]]['antpm'.($witm_type-4).'']; - } - */ - if ($witm_type == 12) { - // - $wAp += $this->stats[$this->uids[$uid1]]['m10']; - if ($this->users[$this->uids[$uid1]]['align'] == 7) { - $wAp += 15; - } - } elseif ($witm_type < 5) { - $wAp += $this->stats[$this->uids[$uid1]]['pa' . $witm_type . '']/* + $this->stats[$this->uids[$uid1]]['m10'] + $witm_data['sv_pa'.$witm_type.'']*/ - ; - $wAp -= $this->stats[$this->uids[$uid2]]['antpa' . $witm_type . '']; - } else { - $wAp += $this->stats[$this->uids[$uid1]]['m10'] + $this->stats[$this->uids[$uid1]]['pm' . ($witm_type - 4) . ''] + $this->stats[$this->uids[$uid1]]['m11a'] + $witm_data['sv_pm' . ($witm_type - 4) . '']; - $wAp -= $this->stats[$this->uids[$uid2]]['antpm' . ($witm_type - 4) . '']; - } - // - - // - // - $vladenie = 0; - - // - $proboi = 0; - $witm_data['m9'] = $this->stats[$this->uids[$uid1]]['m9']; - if (rand(1, 100) < floor($witm_data['m9'] / 2)) { - $proboi = floor($witm_data['m9'] / 2); - $r['pb'] = 1; - } - - - /*if( $this->mfs(4, $witm_data['m9'] , $this->users[$this->uids[$uid1]]['level'] , $this->users[$this->uids[$uid2]]['level']) == 1 ) { - $proboi = $witm_data['m9']; - $r['pb'] = 1; - } - if( $this->mfs(4, $witm_data['add_m9'] , $this->users[$this->uids[$uid1]]['level'] , $this->users[$this->uids[$uid2]]['level']) == 1 ) { - $proboi = $witm_data['add_m9']; - $r['pb'] = 1; - }*/ - - // % () - /*if( $witm_data['sv_m9'] > 0 ) { - $proboi = $witm_data['sv_m9']; - $r['pb'] = 1; - }*/ - // % () - - if ($witm['2h'] > 0) { - //$witm_data['sv_yron_min'] = $witm_data['sv_yron_min']*2; - //$witm_data['sv_yron_max'] = $witm_data['sv_yron_max']*2; - } - - $y = $this->yrn( - //$st1, $st2, $u1, $u2, $level, $level2, $type, $min_yron, $max_yron, $min_bron, $max_bron, - //$vladenie, $power_yron, $power_krit, $zashita, $ozashita, $proboi, $weapom_damage - $this->stats[$this->uids[$uid1]], - $this->stats[$this->uids[$uid2]], - $this->users[$this->uids[$uid1]], - $this->users[$this->uids[$uid2]], - $this->users[$this->uids[$uid1]]['level'], - $this->users[$this->uids[$uid2]]['level'], - // - $witm_type, - $this->stats[$this->uids[$uid1]]['minAtack'], //. () - $this->stats[$this->uids[$uid1]]['maxAtack'], //. - $bron[$zona][0], // . - $bron[$zona][1], // - // - $vladenie, // - (($wAp /*+ $w3p + $w14p*/)), // - (round($this->stats[$this->uids[$uid1]]['m3'])), // - (($this->stats[$this->uids[$uid2]]['za' . $witm_type2]) - $this->stats[$this->uids[$uid1]]['pza']), - // - $this->stats[$this->uids[$uid1]]['ozash'], // - $proboi, // - 0, // - ($witm_data['sv_yron_min'] + $this->stats[$this->uids[$uid1]]['yron_min']), - ($witm_data['sv_yron_max'] + $this->stats[$this->uids[$uid1]]['yron_max']), - $this->stats[$this->uids[$uid2]]['zaproc'], - $this->stats[$this->uids[$uid2]]['zmproc'], - (($this->stats[$this->uids[$uid2]]['zm' . ($witm_type2 - 4)]) - round($this->stats[$this->uids[$uid1]]['pzm'] * 0.8)), - // - $this->stats[$this->uids[$uid1]]['omzash'], // - $witm['type'], - $witm - ); - - $r['y'] = round(rand($y['min'] + $proboi, $y['max'] + round($proboi / 2))); - $r['k'] = round(rand($y['Kmin'] + round($proboi / 4), $y['Kmax'] + round($proboi / 8))); - - $r['m_y'] = $y['max']; - $r['m_k'] = $y['Kmax']; - - $r['bRND'] = $y['bRND']; - - $r['w_type'] = $witm_type; - - // - 50% - $wp1 = $this->stats[$this->uids[$uid1]]['items'][$this->stats[$this->uids[$uid1]]['wp3id']]; - $wp2 = $this->stats[$this->uids[$uid1]]['items'][$this->stats[$this->uids[$uid1]]['wp14id']]; - /*if( $wp == 14 ) { - if( $wp1['level'] >= $wp2['level'] ) { - $r['y'] = floor( $r['y'] * 0.5 ); - $r['k'] = floor( $r['k'] * 0.5 ); - } - }elseif( $wp == 3 ) { - if( $wp2['level'] > $wp1['level'] ) { - $r['y'] = floor( $r['y'] * 0.5 ); - $r['k'] = floor( $r['k'] * 0.5 ); - } - }*/ - - // - if ($witm['type'] == 18) { - $tp = 1; - } elseif ($witm['type'] == 19) { - $tp = 2; - } elseif ($witm['type'] == 20) { - $tp = 3; - } elseif ($witm['type'] == 21) { - $tp = 4; - } else { - //$tp = 0; - } - - if ($tp != $witm_type && $wp > 0) // - { - $r['y'] = round($r['y'] / 3); - $r['r'] = round($r['r'] / 3); - $r['k'] = round($r['k'] / 3); - $r['m_k'] = round($r['m_k'] / 3); - $r['m_y'] = round($r['m_y'] / 3); - } - - if (isset($this->stats[$this->uids[$uid2]]['zaproc'])) { - $r['y'] = round($r['y'] - $r['y'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); - $r['r'] = round($r['r'] - $r['r'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); - $r['k'] = round($r['k'] - $r['k'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); - $r['m_k'] = round($r['m_k'] - $r['m_k'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); - $r['m_y'] = round($r['m_y'] - $r['m_y'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); - if ($r['k'] < 1) { - $r['k'] = 2; - } - } - - if ($r['y'] < 1) { - $r['y'] = 1; - } - if ($r['r'] >= 0) { - $r['r'] = -1; - } - if ($r['k'] < 1) { - $r['k'] = 1; - } - if ($r['m_k'] < 1) { - $r['m_k'] = 1; - } - if ($r['m_y'] < 1) { - $r['m_y'] = 1; - } - //$this->a_restart_stats($uid1,1); - //$this->a_testing_stats($uid2,1); - return $r; - } - - // - public function yronRazmen($id, $at, $pat = false, $rjd = 0) - { - if ($pat == true) { - $pat = $at; - $at = $pat['p']; - } else { - unset($pat); - } - - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { - $yhod = [1 => 1, 2 => 0]; - //$uid1 = $this->yhod_user($this->atacks[$id]['uid2'],$this->atacks[$id]['uid1'],$this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); - } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { - $yhod = [1 => 0, 2 => 1]; - //$uid2 = $this->yhod_user($this->atacks[$id]['uid1'],$this->atacks[$id]['uid2'],$this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); - } - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - // - - - // (u2) (u1) - //print_r( $at[$i] ); - $j = 0; - $k = 0; - $wp = 3; - if ($rjd > 0) { - $j = $rjd - 1; - } - // - - //$checkhp1=$this->stats[$this->uids[$u2]]['hpNow']; - while ($j < count($at[$a]['atack']) && $j < 8) { - // , - if ($k == 0 && isset($this->stats[$this->uids[$u1]]['wp3id'])) { - // - $wp = 3; - $k = 1; - } else { - // - if (isset($this->stats[$this->uids[$u1]]['wp14id']) && $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp14id']]['type'] != 13) { - $wp = 14; - } else { - if (isset($this->stats[$this->uids[$u1]]['wp3id'])) { - $wp = 3; - } else { - // - $wp = 3; - } - } - $k = 0; - } - if ($wp > 0) { - $witm = $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp' . $wp . 'id']]; - $witm_type = $this->weaponTx($witm); - $at[$a]['atack'][$j]['wt'] = $witm['type']; - } - // - $at[$a]['atack'][$j]['yhod'] = $yhod[$a]; - // - /*if ($checkhp1>0) - {*/ - if (!isset($at[$a]['atack'][$j]['yron']) && ( - $at[$a]['atack'][$j][1] == 1 || - $at[$a]['atack'][$j][1] == 4 || - $at[$a]['atack'][$j][1] == 5) - ) { - // - //$at[$a]['atack'][$j]['yron'] = $this->yronGetrazmen($u1,$u2,$wp,$at[$a]['atack'][$j][0]); - $at[$a]['atack'][$j]['yron'] = $this->yronGetrazmen($u1, $u2, $wp, $at[$a]['atack'][$j][0], - $yhod[$b]); - /*if ($checkhp1 <1) - { - $at[$a]['atack'][$j]['yron']['y']=0; - $at[$a]['atack'][$j]['yron']['k']=0; - }*/ - - - if ($at[$a]['atack'][$j][1] == 4) { - $at[$a]['atack'][$j]['yron']['y_old'] = $at[$a]['atack'][$j]['yron']['y']; - $at[$a]['atack'][$j]['yron']['y'] = round($at[$a]['atack'][$j]['yron']['k'] / 2); - } elseif ($at[$a]['atack'][$j][1] == 5) { - $at[$a]['atack'][$j]['yron']['y_old'] = $at[$a]['atack'][$j]['yron']['y']; - $at[$a]['atack'][$j]['yron']['y'] = $at[$a]['atack'][$j]['yron']['k']; - } - $at[$a]['atack'][$j]['yron']['2h'] = $witm['2h']; - $at[$a]['atack'][$j]['yron']['w'] = $wp; - if ($at[$a]['atack'][$j]['yron']['y'] < 1) { - $at[$a]['atack'][$j]['yron']['r'] = '--'; - } else { - $at[$a]['atack'][$j]['yron']['r'] = '-' . $at[$a]['atack'][$j]['yron']['y']; - } - - /*if( ($at[$a]['atack'][$j][1] == 1 || - $at[$a]['atack'][$j][1] == 4 || - $at[$a]['atack'][$j][1] == 5)&& $at[$a]['atack'][$j][2] != 3) - { - $checkhp1=$checkhp1-$at[$a]['atack'][$j]['yron']['y']; - }*/ - // - } else { - // - //$at[$a]['atack'][$j]['block'] = $this->yronGetrazmen($u1,$u2,$wp,$at[$a]['atack'][$j][0]); - $at[$a]['atack'][$j]['block'] = $this->yronGetrazmen($u1, $u2, $wp, $at[$a]['atack'][$j][0], - $yhod[$b]); - /*if ($checkhp1 <1) - { - $at[$a]['atack'][$j]['block']['y']=0; - $at[$a]['atack'][$j]['block']['k']=0; - }*/ - if ($at[$a]['atack'][$j][1] == 4) { - $at[$a]['atack'][$j]['block']['y_old'] = $at[$a]['atack'][$j]['block']['y']; - $at[$a]['atack'][$j]['block']['y'] = round($at[$a]['atack'][$j]['block']['k'] / 2); - } elseif ($at[$a]['atack'][$j][1] == 5) { - $at[$a]['atack'][$j]['block']['y_old'] = $at[$a]['atack'][$j]['block']['y']; - $at[$a]['atack'][$j]['block']['y'] = $at[$a]['atack'][$j]['block']['k']; - } - $at[$a]['atack'][$j]['block']['2h'] = $witm['2h']; - $at[$a]['atack'][$j]['block']['w'] = $wp; - if ($at[$a]['atack'][$j]['block']['y'] < 1) { - $at[$a]['atack'][$j]['block']['r'] = '--'; - } else { - $at[$a]['atack'][$j]['block']['r'] = '-' . $at[$a]['atack'][$j]['block']['y']; - } - /* - if( ($at[$a]['atack'][$j][1] == 1 || - $at[$a]['atack'][$j][1] == 4 || - $at[$a]['atack'][$j][1] == 5)&& $at[$a]['atack'][$j][2] != 3) - { - $checkhp1=$checkhp1-$at[$a]['atack'][$j]['block']['y']; - }*/ - // - } - /*} - else - { - - if( $at[$a]['atack'][$j][1] == 1 || $at[$a]['atack'][$j][1] == 4 || $at[$a]['atack'][$j][1] == 5 ) - { - // - $at[$a]['atack'][$j]['yron'] = $this->yronGetrazmen($u1,$u2,$wp,$at[$a]['atack'][$j][0]); - $at[$a]['atack'][$j]['yron']['y']=0; - $at[$a]['atack'][$j]['yron']['k']=0; - if( $at[$a]['atack'][$j][1] == 4 ) { - $at[$a]['atack'][$j]['yron']['y_old'] = $at[$a]['atack'][$j]['yron']['y']; - $at[$a]['atack'][$j]['yron']['y'] = round($at[$a]['atack'][$j]['yron']['k']/2); - }elseif( $at[$a]['atack'][$j][1] == 5 ) { - $at[$a]['atack'][$j]['yron']['y_old'] = $at[$a]['atack'][$j]['yron']['y']; - $at[$a]['atack'][$j]['yron']['y'] = $at[$a]['atack'][$j]['yron']['k']; - } - $at[$a]['atack'][$j]['yron']['2h'] = $witm['2h']; - $at[$a]['atack'][$j]['yron']['w'] = $wp; - if( $at[$a]['atack'][$j]['yron']['y'] < 1 ) { - $at[$a]['atack'][$j]['yron']['r'] = '--'; - }else{ - $at[$a]['atack'][$j]['yron']['r'] = '-' . $at[$a]['atack'][$j]['yron']['y']; - } - // - }else{ - // - $at[$a]['atack'][$j]['block'] = $this->yronGetrazmen($u1,$u2,$wp,$at[$a]['atack'][$j][0]); - $at[$a]['atack'][$j]['block']['y']=0; - $at[$a]['atack'][$j]['block']['k']=0; - if( $at[$a]['atack'][$j][1] == 4 ) { - $at[$a]['atack'][$j]['block']['y_old'] = $at[$a]['atack'][$j]['block']['y']; - $at[$a]['atack'][$j]['block']['y'] = round($at[$a]['atack'][$j]['block']['k']/2); - }elseif( $at[$a]['atack'][$j][1] == 5 ) { - $at[$a]['atack'][$j]['block']['y_old'] = $at[$a]['atack'][$j]['block']['y']; - $at[$a]['atack'][$j]['block']['y'] = $at[$a]['atack'][$j]['block']['k']; - } - $at[$a]['atack'][$j]['block']['2h'] = $witm['2h']; - $at[$a]['atack'][$j]['block']['w'] = $wp; - if( $at[$a]['atack'][$j]['block']['y'] < 1 ) { - $at[$a]['atack'][$j]['block']['r'] = '--'; - }else{ - $at[$a]['atack'][$j]['block']['r'] = '-' . $at[$a]['atack'][$j]['block']['y']; - } - // - } - - - }*/ - $j++; - } - - $i++; - } - - if (isset($pat) && $pat != false) { - $pat['p'] = $at; - $at = $pat; - } - - return $at; - } - - // - public function updateHealth($id, $at) - { - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { - $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']); - } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { - $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']); - } - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - // - if ($this->atacks[$id]['out' . $b] > 0) { - // ${'u'.$a} , - if (rand(0, 100) < min(floor($this->stats[$this->uids[$u1]]['m6'] / 5), 20)) { - // - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u1]]['tactic3']++; - } - } - if (rand(0, 100) < min(floor($this->stats[$this->uids[$u1]]['m8'] / 4), 20)) { - // - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u1]]['tactic4']++; - } - } - } - - // (u2) (u1) - //print_r( $at[$i] ); - $j = 0; - $k = 0; - $wp = 3; - while ($j < count($at[$a]['atack']) && $j < 8) { - // - //$this->stats[$this->uids[$this->atacks[$id]['uid1']]]['tactic1'] - if ($at[$a]['atack'][$j][1] == 1) { - //u1 u2 - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u1]]['tactic1']++; - } - // - if ($at[$a]['atack'][$j]['yron']['2h'] == 1) { - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u1]]['tactic1'] += 2; - } - } - } elseif ($at[$a]['atack'][$j][1] == 2) { - //u2 u1 - } elseif ($at[$a]['atack'][$j][1] == 3) { - //u2 u1 - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u2]]['tactic4']++; - } - } elseif ($at[$a]['atack'][$j][1] == 4) { - //u1 u2 - if (!isset($at[$a]['atack'][$j]['notactic2'])) { - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u1]]['tactic2']++; - } - } - $this->users[$this->uids[$u2]]['tactic4']++; // - } elseif ($at[$a]['atack'][$j][1] == 5) { - //u1 u2 - if (!isset($at[$a]['atack'][$j]['notactic2'])) { - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u1]]['tactic2'] += 2; - } - // - if ($at[$a]['atack'][$j]['yron']['2h'] == 1) { - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u1]]['tactic2'] += 1; - } - } - } - } elseif ($at[$a]['atack'][$j][1] == 6) { - //u2 u1 - if (!isset($at[$a]['atack'][$j]['notactic5'])) { - if ($this->stats[$this->uids[$u1]]['this_animal'] == 0) { - $this->users[$this->uids[$u2]]['tactic5']++; - } - } - } elseif ($at[$a]['atack'][$j][1] == 7) { - //u2 u1 // - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u2]]['tactic4']++; - } - } elseif ($at[$a]['atack'][$j][1] == 8) { - //u2 u1 - if ($this->stats[$this->uids[$u1]]['this_animal'] == 0) { - $this->users[$this->uids[$u2]]['tactic3']++; - } - } - // , - if (isset($at[$a]['atack'][$j]['yron']) && ( - $at[$a]['atack'][$j][1] == 1 || - $at[$a]['atack'][$j][1] == 4 || - $at[$a]['atack'][$j][1] == 5)) { - // - - if ($this->stats[$this->uids[$u2]]['hpNow'] <= $at[$a]['atack'][$j]['yron']['y']) { - $at[$a]['atack'][$j]['yron']['y'] = $this->stats[$this->uids[$u2]]['hpNow']; - } - if ($this->stats[$this->uids[$u2]]['hpNow'] <= $at[$a]['atack'][$j]['yron']['k']) { - $at[$a]['atack'][$j]['yron']['k'] = $this->stats[$this->uids[$u2]]['hpNow']; - } - - if ($at[$a]['atack'][$j]['yron']['y'] < 0) { - $at[$a]['atack'][$j]['yron']['y'] = 1; - $at[$a]['atack'][$j]['yron']['r'] = -1; - $at[$a]['atack'][$j]['yron']['k'] = 1; - } - if ($this->stats[$this->uids[$u2]]['hpNow'] < 1) { - $at[$a]['atack'][$j]['yron']['y'] = 0; - $at[$a]['atack'][$j]['yron']['r'] = -1; - $at[$a]['atack'][$j]['yron']['k'] = 0; - } - - // - //$this->users[$this->uids[$u1]]['battle_yron'] += $at[$a]['atack'][$j]['yron']['y']; - $this->takeExp($u1, $at[$a]['atack'][$j]['yron']['y'], $u1, $u2); - // - $this->stats[$this->uids[$u2]]['hpNow'] -= $at[$a]['atack'][$j]['yron']['y']; - $this->users[$this->uids[$u2]]['last_hp'] = -$at[$a]['atack'][$j]['yron']['y']; - - //echo '['.$u1.' -> '.$u2.']'; - $at[$a]['atack'][$j]['yron']['hp'] = $this->stats[$this->uids[$u2]]['hpNow']; - if ($at[$a]['atack'][$j]['yron']['hp'] < 1) { - $at[$a]['atack'][$j]['yron']['hp'] = 0; - } - $at[$a]['atack'][$j]['yron']['hpAll'] = $this->stats[$this->uids[$u2]]['hpAll']; - if ($at[$a]['atack'][$j]['yron']['hp'] > $at[$a]['atack'][$j]['yron']['hpAll']) { - $at[$a]['atack'][$j]['yron']['hp'] = $at[$a]['atack'][$j]['yron']['hpAll']; - } - // - // - if (rand(0, 100) <= 50) { - if ($at[$a]['atack'][$j][1] == 4 || $at[$a]['atack'][$j][1] == 5) { - if (!isset($at[$a]['atack'][$j]['yron']['travma']) && rand(0, - 1000) < 500 && $this->users[$this->uids[$u2]]['level'] > 1 && $this->stats[$this->uids[$u1]] > 1) { - $trvm_chns = floor(rand(0, 200) / 10); - if ($trvm_chns > 3 || $trvm_chns < 1) { - $trvm_chns = 0; - } - $at[$a]['atack'][$j]['yron']['travma'] = [$trvm_chns, ' ']; - unset($trvm_chns); - } - } - } - } - $j++; - } - - $i++; - } - - return $at; - } - - // - public function addstatuser($id) - { - if ($id > 0) { - $uid = $id; - $id = $this->uids[$uid]; - mysql_query('INSERT INTO `battle_users` - ( `battle`,`uid`,`time_enter`,`login`,`level`,`align`,`clan`,`hpAll`,`hp`,`hpStart`,`team` ) - VALUES - ( - "' . $this->info['id'] . '", - "' . $uid . '", - "' . time() . '","' . $this->users[$id]['login'] . '", - "' . $this->users[$id]['level'] . '", - "' . $this->users[$id]['align'] . '", - "' . $this->users[$id]['clan'] . '", - "' . $this->stats[$id]['hpAll'] . '", - "' . $this->stats[$id]['hp'] . '", - "' . $this->stats[$id]['hpNow'] . '", - "' . $this->users[$id]['team'] . '" - )'); - } - } - - // - public function priemsRazmen($id, $at) - { - if ($at == 'fast') { - $uid1 = $id[0]; - $uid2 = $id[1]; - } else { - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - } - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - // - $eff = $this->stats[$this->uids[$u1]]['effects']; - $this->stats[$this->uids[$u1]]['u_priem'] = []; - $j = 0; - while ($j <= count($eff)) { - if (isset($eff[$j]) && $eff[$j]['id_eff'] == 22 && $eff[$j]['v1'] == 'priem' && $eff[$j]['v2'] > 0) { - $this->stats[$this->uids[$u1]]['u_priem'][] = [ - $j, - $eff[$j]['v2'], - $this->prm[$eff[$j]['v2']]['act'], - $eff[$j]['id'], - $this->prm[$eff[$j]['v2']]['type_of'], - $this->prm[$eff[$j]['v2']]['moment'], - $this->prm[$eff[$j]['v2']]['moment_end'], - $this->prm[$eff[$j]['v2']]['type_sec'], - ]; - } - $j++; - } - - $i++; - } - // - } - - // - public function priemsRazmenMoment($id, $at) - { - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if (!isset($at['p']['p_cast'])) { - $at['p'] = $at; - $at['p']['p_cast'] = true; - } - // - - // - if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) { - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 1) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - $this->stats[$this->uids[$u2]]['nopryh']--; - } - } - $j++; - } - } - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 2) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 3) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - if (isset($fx_priem)) { - $at = $fx_priem($id, $at, $u1, $j); - } - unset(${'fx_priem'}); - } - } - $j++; - } - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 4) { - if ($this->testPriemVarTrueZash($i, 1, $this->stats[$this->uids[$u1]]['u_priem'][$j][1], $a, $b, - $u1, $u2) == false) { - } elseif (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 5) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - // - $i++; - } - // - return $at; - } - - // ( ) - public function priemsRazmenMomentEnd($id, $at) - { - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - if (!isset($at['p']['p_cast'])) { - $at['p'] = $at; - $at['p']['p_cast'] = true; - } - // - - // - if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) { - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 1) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - $this->stats[$this->uids[$u2]]['nopryh']--; - } - } - $j++; - } - } - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 2) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 3) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - if (isset($fx_priem)) { - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - } - $j++; - } - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 4) { - if ($this->testPriemVarTrueZash($i, 2, $this->stats[$this->uids[$u1]]['u_priem'][$j][1], $a, $b, - $u1, $u2) == false) { - } elseif (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 5) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - $pr_moment = true; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - // - $i++; - } - // - return $at; - } - - - // - public function priemsTestRazmen($id, $at) - { - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - if (!isset($at['p']['p_cast'])) { - $at['p'] = $at; - $at['p']['p_cast'] = true; - } - - // - - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 220 || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 237 - || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 286 || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 287 || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 288 - || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 213) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - - // - if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) { - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 1) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - $this->stats[$this->uids[$u2]]['nopryh']--; - } - } - $j++; - } - } - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 2) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 3) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - if (isset($fx_priem)) { - $at = $fx_priem($id, $at, $u1, $j); - } - unset(${'fx_priem'}); - } - } - $j++; - } - - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 4) { - if ($this->testPriemVarTrueZash($i, 3, $this->stats[$this->uids[$u1]]['u_priem'][$j][1], $a, $b, - $u1, $u2) == false) { - } elseif (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - if (isset($fx_priem)) { - $at = $fx_priem($id, $at, $u1, $j); - } - unset(${'fx_priem'}); - } - } - $j++; - } - - /* - $j = 0; - while( $j <= count( $this->stats[$this->uids[$u2]]['u_priem'] ) ) { - if( $this->stats[$this->uids[$u2]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 4 ) { - if(file_exists('../../_incl_data/class/priem/'.$this->stats[$this->uids[$u2]]['u_priem'][$j][1].'.php')) { - $pr_used_this = $u2; - require('priem/'.$this->stats[$this->uids[$u2]]['u_priem'][$j][1].'.php'); - if( isset($fx_priem) ) { - $at = $fx_priem($id,$at,$u2,$j); - } - unset(${'fx_priem'}); - } - } - $j++; - } - */ - - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 5) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - if (isset($fx_priem)) { - $at = $fx_priem($id, $at, $u1, $j); - } - unset(${'fx_priem'}); - } - } - $j++; - } - // - /*$j = 0; - while( $j <= count( $this->stats[$this->uids[$u1]]['u_priem'] ) ) { - if( $this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 8 ) { - if(file_exists('../../_incl_data/class/priem/'.$this->stats[$this->uids[$u1]]['u_priem'][$j][1].'.php')) { - $pr_used_this = $u1; - require('priem/'.$this->stats[$this->uids[$u1]]['u_priem'][$j][1].'.php'); - $at = $fx_priem($id,$at,$u1,$j); - unset(${'fx_priem'}); - } - } - $j++; - }*/ - - $i++; - } - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - if (!isset($at['p']['p_cast'])) { - $at['p'] = $at; - $at['p']['p_cast'] = true; - } - - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 8) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 9) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_used_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - - $i++; - } - - return $at; - } - - // - public function priemsRestartRazmen($id, $at) - { - if (isset($at['p'])) { - // - // - $uid1 = $this->atacks[$id]['uid1']; - $uid2 = $this->atacks[$id]['uid2']; - - /* - , , : - 1. - 2 1. - : - 1. - 2 1. - 3. - 4 3. - .. - */ - - $i = 1; - while ($i <= 2) { - if ($i == 1) { - $a = 1; - $b = 2; - $u1 = ${'uid1'}; - $u2 = ${'uid2'}; - } else { - $a = 2; - $b = 1; - $u1 = ${'uid2'}; - $u2 = ${'uid1'}; - } - - if (!isset($at['p']['p_cast'])) { - $at['p'] = $at; - $at['p']['p_cast'] = true; - } - - // - if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) { - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 1) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_tested_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - $this->stats[$this->uids[$u2]]['nopryh']--; - } - } - $j++; - } - } - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 2) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_tested_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 4) { - if ($this->testPriemVarTrueZash($i, 4, $this->stats[$this->uids[$u1]]['u_priem'][$j][1], $a, $b, - $u1, $u2) == false) { - } elseif (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_tested_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 3) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_tested_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 5) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_tested_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u1, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 8) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { - $pr_tested_this = $u2; - require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u2, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 9) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { - $pr_tested_this = $u2; - require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); - $at = $fx_priem($id, $at, $u2, $j); - unset(${'fx_priem'}); - } - } - $j++; - } - - $i++; - } - // - $at = $at['p']; - unset($at['p']); - } - return $at; - } - - // - public function testPriemVarTrueZash($i, $id, $pid, $a, $b, $u1, $u2) - { - $r = true; - //echo '['.$pid.','.$i.','.$a.','.$b.']'; - $g = [ - 45 => ['221' => true], - ]; - if (isset($g[$pid])) { - //echo 1; - if ($g[$pid][$i . $a . $b] == true) { - $r = true; - } else { - // $r = false; - } - } - return $r; - } - - // - public $um_priem = []; - - /** - * . - - * . - * @param $uid1 - * @param $uid2 - * @param $priem - * @param $yron - * @param $profil - * @param $stabil - * @param $test - * @param $inlog - * @return float|int|mixed - */ - public function testYronPriem($uid1, $uid2, $priem, $yron, $profil, $stabil, $test = false, $inlog = 0) - { - /* - profil = { - -1 - - -2 - - 0 - - 1-4 - - 5-12 - - } - stabil - . - */ - // - $a = 1; - $b = 2; - $u1 = $uid1; - $u2 = $uid2; - - // $u1 $u2 - // - if (!isset($this->stats[$this->uids[$u2]]['u_priem'])) { - $eff = $this->stats[$this->uids[$u2]]['effects']; - $j = 0; - while ($j <= count($eff)) { - if (isset($eff[$j]) && $eff[$j]['id_eff'] == 22 && $eff[$j]['v1'] == 'priem' && $eff[$j]['v2'] > 0) { - $this->stats[$this->uids[$u2]]['u_priem'][] = [ - $j, - $eff[$j]['v2'], - $this->prm[$eff[$j]['v2']]['act'], - $eff[$j]['id'], - $this->prm[$eff[$j]['v2']]['type_of'], - $this->prm[$eff[$j]['v2']]['moment'], - ]; - } - $j++; - } - unset($eff); - } - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) { - if ($this->stats[$this->uids[$u2]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 4) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { - $pr_momental_this = $u2; - require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); - $yron = $fx_moment($u2, $u1, $j, $yron, $profil); - unset(${'fx_moment'}); - } - } - $j++; - } - - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 5) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_momental_this = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - if (isset($fx_moment)) { - $yron = $fx_moment($u1, $u2, $j, $yron, $profil, $inlog); - } - unset(${'fx_moment'}); - } - } - $j++; - } - - // ( ) - $j = 0; - while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) { - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][7] == 5) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) { - $pr_momental_this_seven = $u1; - require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php'); - if (isset($fx_moment_seven)) { - $yron = $fx_moment_seven($u1, $u2, $j, $yron, $profil, $inlog); - } - unset(${'fx_moment_seven'}); - } - } - if ($this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 180) { - // ( 10%). . - $x = mysql_fetch_row(mysql_query('select x from eff_users where v2 = 180 and uid = ' . $u1)); - $yron = 0.1 * $x[0]; - } - $j++; - } - - // - $j = 0; - while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) { - if ($this->stats[$this->uids[$u2]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 8) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { - $pr_momental_this = $u2; - require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); - if (isset($fx_moment)) { - $yron = $fx_moment($u2, $u1, $j, $yron, $profil, $inlog); - } - unset(${'fx_moment'}); - } - } - if ($this->stats[$this->uids[$u2]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 9) { - if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) { - $pr_momental_this = $u2; - require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php'); - if (isset($fx_moment)) { - $yron = $fx_moment($u2, $u1, $j, $yron, $profil, $inlog); - } - unset(${'fx_moment'}); - } - } - - $j++; - } - - if ($this->stats[$this->uids[$u2]]['zaproc'] > 0) { - $yron = round($yron - $yron * $this->stats[$this->uids[$uid2]]['zaproc'] / 100); - if ($yron < 1) { - $yron = 1; - } - } - //var_dump($this->stats[$this->uids[$u2]]['u_priem']); - return $yron; - } - - // + \ - public function priemYronSave($u1, $u2, $yron, $type) - { - //$type 0 - , 1 - - - $this->testUserInfoBattle($u1); - $this->testUserInfoBattle($u2); - - if (isset($this->uids[$u1])) { - if ($this->stats[$this->uids[$u2]]['hpAll'] <= 1000) { - $adt6 = round(0.1 * (floor($yron) / $this->stats[$this->uids[$u2]]['hpAll'] * 100), 10); - } else { - $adt6 = round(0.1 * (floor($yron) / 1000 * 100), 10); - } - - if ($yron > $this->stats[$this->uids[$u2]]['hpNow']) { - $yron = $this->stats[$this->uids[$u2]]['hpNow']; - } - - if ($yron > 0) { - $this->users[$this->uids[$u1]]['battle_yron'] += $yron; - $this->users[$this->uids[$u1]]['battle_exp'] += round(1 * $this->testExp($yron, - $this->stats[$this->uids[$u1]], $this->stats[$this->uids[$u2]], $u1, $u2)); - if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) { - $this->users[$this->uids[$u1]]['tactic6'] += $adt6; - $this->stats[$this->uids[$u1]]['tactic6'] += $adt6; - } else { - $this->users[$this->uids[$u1]]['tactic6'] += $adt6 / 3; - $this->stats[$this->uids[$u1]]['tactic6'] += $adt6 / 3; - } - } else { - $adt6 = 0; - } - // - $this->users[$this->uids[$u2]]['last_hp'] = -$yron; - // - mysql_query('UPDATE `stats` SET - `tactic6` = `tactic6` + "' . $adt6 . '", - `battle_yron` = `battle_yron` + "' . $yron . '", - `battle_exp` = `battle_exp` + "' . round($this->testExp($yron, $this->stats[$this->uids[$u1]], - $this->stats[$this->uids[$u2]], $u1, $u2)) . '" - WHERE `id` = "' . $u1 . '" LIMIT 1'); - // - mysql_query('UPDATE `stats` SET - `last_hp` = "' . $this->users[$this->uids[$u2]]['last_hp'] . '" - WHERE `id` = "' . $u2 . '" LIMIT 1'); - } - $this->addNewStat( - [ - 1 => [ - 'battle' => $this->info['id'], - 'uid1' => $this->users[$this->uids[$u1]]['id'], - 'uid2' => $this->users[$this->uids[$u2]]['id'], - 'time' => time(), - 'type' => 0, - 'a' => '10000', - 'b' => 0, - 'type_a' => 1, - 'type_b' => 0, - 'ma' => 1, - 'mb' => 1, - 'yrn' => $yron, - 'yrn_krit' => 0, - 'tm1' => $this->users[$this->uids[$u1]]['team'], - 'tm2' => $this->users[$this->uids[$u2]]['team'], - ], - ] - ); - } - - // - public $restart_stats_data = []; - - public function a_restart_stats($uid1, $glob) - { - if ($uid1 > 0 && isset($this->restart_stats_data[$uid1])) { - $this->stats[$this->uids[$uid1]] = $this->restart_stats_data[$uid1]; - if ($glob == 1) { - unset($this->restart_stats_data[$uid1]); - } - } - } - - public function a_save_stats($uid1) - { - if ($uid1 > 0) { - $this->restart_stats_data[$uid1] = $this->stats[$this->uids[$uid1]]; - } - } - - public function a_testing_stats($uid1, $zona) - { - //$this->stats[$this->uids[$uid1]] = $this->yronGetrazmenStats( $this->stats[$this->uids[$uid1]] , $zona ); - if ($uid1 > 0) { - $this->stats[$this->uids[$uid1]] = $this->yronGetrazmenStats($this->stats[$this->uids[$uid1]], $zona); - } - } - - public $import_atack = []; - public $contr = []; - public $import_user = 0; - - public function startAtack($id) - { - global $c, $u, $log_text, $priem; - // - $this->prlog = []; - // - $this->inport_user = 0; - // - $vrm = [ - 'uid1' => $this->atacks[$id]['uid1'], - 'uid2' => $this->atacks[$id]['uid2'], - ]; - // - /* - if( $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0 ) { - $this->atacks[$id]['uid1'] = $this->atacks[$id]['uid2']; - }elseif( $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0 ) { - $this->atacks[$id]['uid2'] = $this->atacks[$id]['uid1']; - } - */ - if (isset($this->atacks[$id]) && $this->atacks[$id]['lock'] == 0) { - // - $i = 1; - $j = 2; - $k = 0; - $unpr = ''; - while ($i <= 2) { - $untac = mysql_fetch_array(mysql_query('SELECT `id` FROM `eff_users` WHERE `v1` = "priem" AND `v2` = "217" AND `uid` = "' . $this->atacks[$id]['uid' . $i] . '" AND `delete` = 0 LIMIT 1')); - - $agrs = mysql_fetch_array(mysql_query('SELECT `id` FROM `eff_users` WHERE `v1` = "priem" AND `v2` = "211" AND `uid` = "' . $this->atacks[$id]['uid' . $j] . '" AND `delete` = 0 LIMIT 1')); - - if (isset($untac['id']) && !isset($agrs['id'])) { - // AND `a`.`v2` != 235 // AND `a`.`v2` != 273 AND `a`.`v2` != 286 AND `a`.`v2` != 287 AND `a`.`v2` != 288 - - $pvr['sp'] = mysql_query('SELECT `a`.* FROM `eff_users` AS `a` WHERE `a`.`uid` = "' . $this->atacks[$id]['uid' . $j] . '" AND `a`.`delete` = 0 AND `a`.`v1` = "priem" - - AND `a`.`v2` != 222 - - AND `a`.`v2` != 238 - - AND `a`.`v2` != 228 - AND `a`.`v2` != 229 - - AND `a`.`v2` != 139 - AND `a`.`v2` != 188 - AND `a`.`v2` != 226 - AND `a`.`v2` != 211 - AND `a`.`v2` != 49 - AND `a`.`v2` != 233 - AND `a`.`v2` != 227 - AND `a`.`v2` != 220 - AND `a`.`v2` != 191 - AND `a`.`v2` != 332 - AND `a`.`v2` != 333 - AND `a`.`v2` != 334 - AND `a`.`v2` != 335 - AND `a`.`v2` != 236 - - AND `a`.`v2` != 201 - - AND `a`.`v2` != 261 AND `a`.`v2` != 262 AND `a`.`v2` != 206 AND `a`.`v2` != 207 AND `a`.`v2` != 208 AND `a`.`v2` != 209 - AND `a`.`v2` != 210 AND `a`.`v2` != 284 - AND `a`.`v2` != 263 AND `a`.`v2` != 258 AND `a`.`v2` != 29 AND `a`.`v2` != 30 - AND `a`.`v2` != 31 AND `a`.`v2` != 32 AND `a`.`v2` != 256 AND `a`.`v2` != 249 - AND `a`.`v2` != 248 AND `a`.`v2` != 187 AND `a`.`v2` != 245 AND `a`.`v2` != 175 - AND `a`.`v2` != 176 AND `a`.`v2` != 177 AND `a`.`v2` != 178 AND `a`.`v2` != 179 - AND `a`.`v2` != 285 AND `a`.`v2` != 36 AND `a`.`v2` != 85 AND `a`.`v2` != 86 - AND `a`.`v2` != 87 AND `a`.`v2` != 88 AND `a`.`v2` != 89 AND `a`.`v2` != 90 - AND `a`.`v2` != 269 AND `a`.`v2` != 276 AND `a`.`v2` != 277 AND `a`.`v2` != 270 - AND `a`.`v2` != 174 - AND `a`.`v2` != 324 - - AND `a`.`v2` != 217 - - AND `name` NOT LIKE "%%" - - LIMIT 30'); - while ($pvr['pl'] = mysql_fetch_array($pvr['sp'])) { - $pvr['pl']['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $pvr['pl']['v2'] . '" LIMIT 1')); - if (isset($pvr['pl']['priem']['id']) && $pvr['pl']['priem']['neg'] == 0) { - $this->delPriem($pvr['pl'], $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 100); - } - } - // - $k++; - } - $j--; - $i++; - } - if ($u->info['admin'] > 0) { - //die('test'); - } - // - //UPDATE ... SET `lock` = 1 - // - //$this->a_save_stats($this->atacks[$id]['uid1']); - //$this->a_save_stats($this->atacks[$id]['uid2']); - // - - // 1% - if ($this->atacks[$id]['out1'] == 0) { - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s6'] / 4 < $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['level']) { - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['level'] + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hod_minmana']); - } else { - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s6'] / 4 + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hod_minmana']); - } - $this->users[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] = $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow']; - } - // - if ($this->atacks[$id]['out2'] == 0) { - if ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['s6'] / 4 < $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['level']) { - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['level'] + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hod_minmana']); - } else { - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['s6'] / 4 + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hod_minmana']); - } - $this->users[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] = $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow']; - } - // - //$this->users[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] = $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow']; - //$this->users[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] = $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow']; - // - - // - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['antm3'] != 0) { - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['m3'] -= round($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['antm3']); - } - if ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['antm3'] != 0) { - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['m3'] -= round($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['antm3']); - } - // - ,, - /*if( $this->users[$this->uids[$this->atacks[$id]['uid1']]]['level'] == 7 ) { - if( $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s2'] > 55 ) { - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['m5'] += ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s2']-5)*6; - } - } - - if( $this->users[$this->uids[$this->atacks[$id]['uid2']]]['level'] == 7 ) { - if( $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['s2'] > 55 ) { - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['m5'] += ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s2']-5)*6; - } - }*/ - - // - $last_yrn = [ - 1 => $this->users[$this->uids[$this->atacks[$id]['uid1']]]['battle_yron'], - 2 => $this->users[$this->uids[$this->atacks[$id]['uid2']]]['battle_yron'], - ]; - - // - $this->testZonb($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2']); - - // - $this->magicItems($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $id); - $this->magicItems($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $id); - - // - $this->priemsRazmen($id, $at); - $this->priemsRazmenMoment($id, $at); - $this->priemsRazmen($id, $at); - - // ( , , ) - if ($this->atacks[$id]['uid2'] == 1) { - // $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['zona'] += 1; - // $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['zona'] += 1; - } - $at = $this->newRazmen($id); - - // - // , , , , - // ( , ) - /* - $at = $this->mf4Razmen($id,$at,0); - // - $at = $this->mf2Razmen($id,$at,0); - // - $at = $this->mf1Razmen($id,$at,0); - // - $at = $this->mf3Razmen($id,$at,0); - // - $at = $this->mf5Razmen($id,$at,0); - // - $at = $this->yronRazmen($id,$at); - */ - $at = $this->mf2Razmen($id, $at, $v); // - $at = $this->mf3Razmen($id, $at, $v); // - $at = $this->mf4Razmen($id, $at, $v); // - - $at = $this->mf1Razmen($id, $at, $v); // - $at = $this->mf5Razmen($id, $at, $v); // - - $at = $this->yronRazmen($id, $at); // - - // - //['effects'][ - // - $at = $this->priemsTestRazmen($id, $at); - // ( .) - $at = $this->priemsRestartRazmen($id, $at); // ( ) - // - - // - if (count($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['set_pog']) > 0) { - $this->testPogB($this->atacks[$id]['uid1'], 1, $id, 1); - } - if (count($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['set_pog']) > 0) { - $this->testPogB($this->atacks[$id]['uid2'], 1, $id, 1); - } - - // - $at = $this->updateHealth($id, $at); - - // + - //mysql_query('LOCK TABLES battle_logs WRITE'); - $this->addlogRazmen($id, $at); - //mysql_query('UNLOCK TABLES'); - //echo $this->seeRazmen($id,$at); - // NEW BATTLE SYSTEM - - // - $this->magicItems($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $id); - $this->magicItems($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $id); - - /* - if( $this->stats[$this->uids[$vrm['uid1']]]['yhod'] > 0 ) { - $this->atacks[$id]['uid1'] = $vrm['uid1']; - }elseif( $this->stats[$this->uids[$vrm['uid2']]]['yhod'] > 0 ) { - $this->atacks[$id]['uid2'] = $vrm['uid2']; - } - */ - - // - // - $this->restZonb($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2']); - // - $zd1 = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems_z']); - $zd2 = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems_z']); - $zd1id = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems']); - $zd2id = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems']); - // - $prmos = []; - // - $i5 = 0; - - while ($i5 < 51) { - if (isset($zd1[$i5]) && $zd1[$i5] > 0) { - // - //$tstpm = mysql_fetch_array(mysql_query('SELECT `id` FROM `priems` WHERE `id` = "'.$zd1id[$i5].'" AND `activ` = 1 AND `img` NOT LIKE "wis_%" LIMIT 1')); - // - //if(isset($tstpm['id'])) { - // - $zd1[$i5] -= 1; - //}elseif( $this->users[$this->uids[$this->atacks[$id]['uid2']]]['id'] == $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] ) { - // - // $zd1[$i5] -= 1; - //}else{ - // ( ) - // if(!isset($prmos[$zd1id[$i5]])) { - // $prmos[$zd1id[$i5]] = mysql_fetch_array(mysql_query('SELECT `id`,`tr_hod` FROM `priems` WHERE `id` = "'.$zd1id[$i5].'" LIMIT 1')); - // } - // if( $prmos[$zd1id[$i5]]['tr_hod'] > 0 ) { - // $zd1[$i5] -= 1; - // } - //} - } else { - $zd1[$i5] = 0; - } - if (isset($zd2[$i5]) && $zd2[$i5] > 0) { - // - //$tstpm = mysql_fetch_array(mysql_query('SELECT `id` FROM `priems` WHERE `id` = "'.$zd2id[$i5].'" AND `activ` = 1 AND `img` NOT LIKE "wis_%" LIMIT 1')); - // - //if(isset($tstpm['id'])) { - // - $zd2[$i5] -= 1; - //}elseif( $this->users[$this->uids[$this->atacks[$id]['uid1']]]['id'] == $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] ) { - // - // $zd2[$i5] -= 1; - //}else{ - // ( ) - // if(!isset($prmos[$zd2id[$i5]])) { - // $prmos[$zd2id[$i5]] = mysql_fetch_array(mysql_query('SELECT `id`,`tr_hod` FROM `priems` WHERE `id` = "'.$zd2id[$i5].'" LIMIT 1')); - // } - // if( $prmos[$zd2id[$i5]]['tr_hod'] > 0 ) { - // $zd2[$i5] -= 1; - // } - //} - } else { - $zd2[$i5] = 0; - } - $i5++; - } - unset($prmos); - - if ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] == $this->users[$this->uids[$this->atacks[$id]['uid2']]]['id']) { - $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] = -$this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy']; - } - - if ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] == $this->users[$this->uids[$this->atacks[$id]['uid1']]]['id']) { - $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] = -$this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy']; - } - - $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems_z'] = implode('|', $zd1); - $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems_z'] = implode('|', $zd2); - if ($this->atacks[$id]['uid1'] == $u->info['id']) { - $u->info['priems_z'] = implode('|', $zd1); - } elseif ($this->atacks[$id]['uid2'] == $u->info['id']) { - $u->info['priems_z'] = implode('|', $zd2); - } - // - // - $i = 1; - while ($i <= 6) { - if ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] > 25) { - $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] = 25; - } elseif ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] <= 0) { - $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] = 0; - } - if ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] > 25) { - $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] = 25; - } elseif ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] <= 0) { - $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] = 0; - } - $i++; - } - // - // - mysql_query('UPDATE `items_users` SET `btl_zd` = `btl_zd` - 1 WHERE (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '") AND `btl_zd` > 0 AND `inOdet` > 0 LIMIT 100'); - - mysql_query('UPDATE `users` SET `notrhod` = "-1" WHERE `id` = "' . $this->atacks[$id]['uid1'] . '" OR `id` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 2'); - - // - mysql_query('UPDATE `pirogi` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")'); - mysql_query('UPDATE `tactic` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")'); - - // - mysql_query('DELETE FROM `pirogi` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); - mysql_query('DELETE FROM `tactic` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); - - // - mysql_query('UPDATE `spells` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")'); - mysql_query('DELETE FROM `spells` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); - - - // battle_users - mysql_query('UPDATE `battle_users` SET `hp` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hpNow'] . '" - WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1'); - mysql_query('UPDATE `battle_users` SET `hp` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hpNow'] . '" - WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1'); - // 25% - - $last_yrn = [ - 1 => $last_yrn[1], - 2 => $last_yrn[2], - 10 => $this->users[$this->uids[$this->atacks[$id]['uid1']]]['battle_yron'], - 20 => $this->users[$this->uids[$this->atacks[$id]['uid2']]]['battle_yron'], - ]; - - $last_yrn[100] = floor($last_yrn[10] - $last_yrn[1]); - $last_yrn[200] = floor($last_yrn[20] - $last_yrn[2]); - - if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) { - $this->save_stats($this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], - $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'])); - } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) { - $this->save_stats($this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], - $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'])); - } - mysql_query('UPDATE `stats` SET - - `hpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hpNow'] . '", - `mpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] . '", - `tactic1` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic1'] . '", - `tactic2` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic2'] . '", - `tactic3` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic3'] . '", - `tactic4` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic4'] . '", - `tactic5` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic5'] . '", - `tactic6` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic6'] . '", - `tactic7` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic7'] . '", - - `enemy` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] . '", - `battle_yron` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['battle_yron'] . '", - `last_hp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['last_hp'] . '", - `battle_exp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['battle_exp'] . '", - `priems_z` = "' . $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems_z'] . '" - - WHERE `id` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1'); - // - mysql_query('UPDATE `stats` SET - - `hpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hpNow'] . '", - `mpNow` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] . '", - `tactic1` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic1'] . '", - `tactic2` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic2'] . '", - `tactic3` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic3'] . '", - `tactic4` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic4'] . '", - `tactic5` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic5'] . '", - `tactic6` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic6'] . '", - `tactic7` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic7'] . '", - - `enemy` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] . '", - `battle_yron` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['battle_yron'] . '", - `last_hp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['last_hp'] . '", - `battle_exp` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['battle_exp'] . '", - `priems_z` = "' . $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems_z'] . '" - - WHERE `id` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1'); - // - $this->priemsRazmenMomentEnd($id, $at); - // - - // - // \ - $j = 1; - $jn = 1; - while ($j <= 2) { - $eff = $this->stats[$this->uids[$this->atacks[$id]['uid' . $j]]]['effects']; - $i = 0; - while ($i < count($eff)) { - if (isset($eff[$i])) { - if ($eff[$i]['timeUse'] == 77 && $eff[$i]['hod'] > -1) { - $eff[$i]['hod']--; - $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1')); - if (round($eff[$i]['priem']['minmana'] * $eff[$i]['x']) != 0) { - // - $priem->minMana($eff[$i]['user_use'], - round($eff[$i]['priem']['minmana'] * $eff[$i]['x'])); - if ($this->stats[$this->uids[$eff[$i]['user_use']]]['mpNow'] <= 0) { - $eff[$i]['hod'] = 0; - } - } - if (strripos($eff[$i]['data'], 'minprocmanahod')) { - $pvr = [ - 'x1' => 0, - 'x2' => 0, - 'd' => '', - 'i' => 0, - 'uid' => $eff[$i]['uid'], - 'color' => '', - 'color2' => '', - 'effx' => '', - 'x' => $eff[$i]['name'], - ]; - $pvr['d'] = explode('|', $eff[$i]['data']); - while ($pvr['i'] < count($pvr['d'])) { - if (isset($pvr['d'][$pvr['i']])) { - $pvr['d1'] = explode('=', $pvr['d'][$pvr['i']]); - if ($pvr['d1'][0] == 'minprocmanahod') { - $pvr['d1'] = explode('x', $pvr['d1'][1]); - $pvr['x1'] = $pvr['d1'][0]; - $pvr['x2'] = $pvr['d1'][1]; - } - } - $pvr['i']++; - } - - $pvr['mp'] = round($this->stats[$this->uids[$pvr['uid']]]['mpAll'] / 100 * rand($pvr['x1'], - $pvr['x2'])); - $pvr['mpSee'] = 0; - $pvr['mpNow'] = floor($this->stats[$this->uids[$pvr['uid']]]['mpNow']); - $pvr['mpAll'] = $this->stats[$this->uids[$pvr['uid']]]['mpAll']; - $pvr['mpTr'] = $pvr['mpAll'] - $pvr['mpNow']; - - //$pvr['mp'] = $btl->hphe( $u->info['id'] , $pvr['hp'] ); - - if ($pvr['mpTr'] > 0) { - // - if ($pvr['mpTr'] < $pvr['mp']) { - $pvr['mp'] = $pvr['mpTr']; - } - $pvr['mpSee'] = '+' . $pvr['mp']; - $pvr['mpNow'] += $pvr['mp']; - } - if ($pvr['mpNow'] > $pvr['mpAll']) { - $pvr['mpNow'] = $pvr['mpAll']; - } elseif ($pvr['mpNow'] < 0) { - $pvr['mpNow'] = 0; - } - if ($pvr['mpSee'] == 0) { - $pvr['mpSee'] = '--'; - } - - $btl->stats[$btl->uids[$pvr['uid']]]['mpNow'] = $pvr['mpNow']; - $btl->users[$btl->uids[$pvr['uid']]]['mpNow'] = $pvr['mpNow']; - mysql_query('UPDATE `stats` SET `mpNow` = "' . $btl->stats[$btl->uids[$pvr['uid']]]['mpNow'] . '" WHERE `id` = "' . $pvr['uid'] . '" LIMIT 1'); - - $pvr['text'] = $this->addlt(1, 21, $this->users[$this->uids[$pvr['uid']]]['sex'], null); - $pvr['text2'] = '{tm1} ' . $pvr['text'] . ' ' . $pvr['mpSee'] . ' [' . $pvr['mpNow'] . '/' . $pvr['mpAll'] . '] ()'; - $this->priemAddLog($id, 1, 2, $pvr['uid'], 0, - '' . $pvr['x'] . '', - $pvr['text2'], - ($this->hodID + 0) - ); - //echo '[ '.round(rand($pvr['x1'],$pvr['x2'])).'% .]'; - unset($pvr); - } - - if (isset($this->rehodeff[$eff[$i]['id']])) { - $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']]; - } - if ($eff[$i]['hod'] > 0) { - $this->stats[$this->uids[$this->atacks[$id]['uid' . $j]]]['effects']['hod'] = $eff[$i]['hod']; - mysql_query('UPDATE `eff_users` SET `hod` = "' . $eff[$i]['hod'] . '" WHERE `id` = "' . $eff[$i]['id'] . '" LIMIT 1'); - } else { - // - if ($eff[$i]['v2'] > 0) { - if ($j == 1) { - $jn = 2; - } else { - $jn = 1; - } - $this->delPriem($eff[$i], $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], - 3, $this->atacks[$id]['uid' . $jn]); - } - } - } elseif ($eff[$i]['timeUse'] == 77 && $eff[$i]['hod'] == -2) { - $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1')); - $priem->hodUsePriem($eff[$i], $eff[$i]['priem']); - } else { - $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1')); - if (isset($eff[$i]['priem']['minmana']) && round($eff[$i]['priem']['minmana'] * $eff[$i]['x']) != 0) { - // - $priem->minMana($eff[$i]['user_use'], - round($eff[$i]['priem']['minmana'] * $eff[$i]['x'])); - if ($this->stats[$this->uids[$eff[$i]['user_use']]]['mpNow'] <= 0) { - $eff[$i]['hod'] = 0; - if (isset($this->rehodeff[$eff[$i]['id']])) { - $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']]; - } - if ($eff[$i]['v2'] > 0) { - if ($j == 1) { - $jn = 2; - } else { - $jn = 1; - } - $this->delPriem($eff[$i], - $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 3, - $this->atacks[$id]['uid' . $jn]); - } - } - } elseif ($eff[$i]['timeUse'] > 100 && $eff[$i]['hod'] > -1 && $c['effz'] > 0) { - $eff[$i]['hod']--; - if (isset($this->rehodeff[$eff[$i]['id']])) { - $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']]; - } - if ($eff[$i]['hod'] > 0) { - $this->stats[$this->uids[$this->atacks[$id]['uid' . $j]]]['effects']['hod'] = $eff[$i]['hod']; - mysql_query('UPDATE `eff_users` SET `hod` = "' . $eff[$i]['hod'] . '" WHERE `id` = "' . $eff[$i]['id'] . '" LIMIT 1'); - } else { - // - if ($eff[$i]['v2'] > 0) { - if ($j == 1) { - $jn = 2; - } else { - $jn = 1; - } - $this->delPriem($eff[$i], - $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 3, - $this->atacks[$id]['uid' . $jn]); - } - } - } - // - } - } - $i++; - } - $j++; - } - // - // - // - if ($c['propsk_die'] > 0 && $this->info['razdel'] == 0 && $this->info['dn_id'] == 0 && $this->info['izlom'] == 0) { - $cn1 = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this->info['id'] . '" AND `uid1` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1')); - $cn2 = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this->info['id'] . '" AND `uid1` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1')); - if ($cn1[0] > 3) { - // - $pvr['text2'] = '{tm1} {u1} - .'; - $this->priemAddLog($id, 1, 2, $this->atacks[$id]['uid1'], 0, '', - $pvr['text2'], - ($this->hodID + 0) - ); - unset($pvr); - mysql_query('UPDATE `stats` SET `hpNow` = 0 WHERE `id` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1'); - } - if ($cn2[0] > $c['propsk_die']) { - $pvr['text2'] = '{tm1} {u1} - .'; - $this->priemAddLog($id, 1, 2, $this->atacks[$id]['uid2'], 0, '', - $pvr['text2'], - ($this->hodID + 0) - ); - unset($pvr); - mysql_query('UPDATE `stats` SET `hpNow` = 0 WHERE `id` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1'); - } - } - // - // - if ($u->info['id'] == $this->atacks[$id]['uid1']) { - $u->info['enemy'] = $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy']; - } - if ($u->info['id'] == $this->atacks[$id]['uid2']) { - $u->info['enemy'] = $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy']; - } - // // - mysql_query('DELETE FROM `battle_act` WHERE ( `uid1` = "' . $this->atacks[$id]['uid1'] . '" AND `uid2` = "' . $this->atacks[$id]['uid2'] . '" ) OR - ( `uid2` = "' . $this->atacks[$id]['uid1'] . '" AND `uid1` = "' . $this->atacks[$id]['uid2'] . '" )'); - - //$this->a_restart_stats($this->atacks[$id]['uid1'],1); - //$this->a_restart_stats($this->atacks[$id]['uid2'],1); - - unset($old_s1, $old_s2); - unset($this->ga[$this->atacks[$id]['uid1']][$this->atacks[$id]['uid2']], $this->ga[$this->atacks[$id]['uid2']][$this->atacks[$id]['uid1']]); - unset($this->ag[$this->atacks[$id]['uid1']][$this->atacks[$id]['uid2']], $this->ag[$this->atacks[$id]['uid2']][$this->atacks[$id]['uid1']]); - unset($this->atacks[$id]); - mysql_query('DELETE FROM `battle_act` WHERE `id` = "' . $id . '" LIMIT 1'); - // - // - /* - $this->stats[$this->uids[$this->atacks[$id]['uid1']]] = $old_s1; - $this->stats[$this->uids[$this->atacks[$id]['uid2']]] = $old_s2; - */ - unset($old_s1, $old_s2); - // - } - } - - // - public function save_stats($uid) - { - mysql_query('UPDATE `stats` SET - - `hpNow` = "' . $this->stats[$this->uids[$uid]]['hpNow'] . '", - `mpNow` = "' . $this->stats[$this->uids[$uid]]['mpNow'] . '", - `tactic1` = "' . $this->users[$this->uids[$uid]]['tactic1'] . '", - `tactic2` = "' . $this->users[$this->uids[$uid]]['tactic2'] . '", - `tactic3` = "' . $this->users[$this->uids[$uid]]['tactic3'] . '", - `tactic4` = "' . $this->users[$this->uids[$uid]]['tactic4'] . '", - `tactic5` = "' . $this->users[$this->uids[$uid]]['tactic5'] . '", - `tactic6` = "' . $this->users[$this->uids[$uid]]['tactic6'] . '", - `tactic7` = "' . $this->users[$this->uids[$uid]]['tactic7'] . '", - - `enemy` = "' . $this->users[$this->uids[$uid]]['enemy'] . '", - `battle_yron` = "' . $this->users[$this->uids[$uid]]['battle_yron'] . '", - `last_hp` = "' . $this->users[$this->uids[$uid]]['last_hp'] . '", - `battle_exp` = "' . $this->users[$this->uids[$uid]]['battle_exp'] . '", - `priems_z` = "' . $this->users[$this->uids[$uid]]['priems_z'] . '" - - WHERE `id` = "' . $uid . '" LIMIT 1'); - } - - // - public function hpSee($now, $all, $type = 1) - { - $r = '[' . $now . '/' . $all . ']'; - if ($all > 10000) { - $type = 2; - } - if ($type == 1) { - } elseif ($type == 2) { - $p1 = floor($now / $all * 100); - $r = '[' . $p1 . '/100%]'; - } - return $r; - } - - // - public function addFlog($t, $u1, $u2) - { - $vLog = ''; - if (isset($this->info[$this->uids[$u1]]['id'])) { - $vLog .= 'time1=' . time() . '||s1=' . $this->users[$this->uids[$u1]]['id']['sex'] . '||t1=' . $this->users[$this->uids[$u1]]['team'] . '||login1=' . $this->users[$this->uids[$u1]]['login'] . '||'; - } - if (isset($this->info[$this->uids[$u2]]['id'])) { - $vLog .= 'time2=' . time() . '||s2=' . $this->users[$this->uids[$u2]]['sex'] . '||t2=' . $this->users[$this->uids[$u2]]['team'] . '||login2=' . $this->users[$this->uids[$u2]]['login'] . ''; - } - $vLog = rtrim($vLog, '||'); - $mas1 = [ - 'time' => time(), - 'battle' => $this->info['id'], - 'id_hod' => $this->hodID, - 'text' => '', - 'vars' => $vLog, - 'zona1' => '', - 'zonb1' => '', - 'zona2' => '', - 'zonb2' => '', - 'type' => '1', - ]; - $mas1['text'] = $t; - $this->add_log($mas1); - } - - - // - /* public function logCache() - { - global $c,$u,$log_text; - sleep(2); - $thishodID = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_logs` WHERE `battle` = "'.$this->info['id'].'" ORDER BY `id` DESC LIMIT 1')); - if(isset($hodID['id'])) { - $hodID = $hodID['id']; - }else{ - $hodID = 0; - } - if( $hodID > $this->info['hod'] ) { - unlink("../../battle_logs/btl_".$this->info['id'].".js"); - $this->info['hod'] = $hodID; - mysql_query('UPDATE `battle` SET `hod` = "'.$hodID.'" WHERE `id` = "'.$this->info['id'].'" LIMIT 1'); - if( $u->info['design'] == 1 ) { - $js = ''; $pll = 0; - if($_POST['idlog']<1){ $_POST['idlog'] = 0; } - // - $sp = mysql_query('SELECT - `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` - FROM `battle_logs` WHERE `battle` = "'.$this->info['id'].'" AND `id` > '.mysql_real_escape_string($_POST['idlog']).' AND `id_hod` > '.($this->hodID-7).' LIMIT 100'); - $jin = 0; $forYou2 = 0; - while($pl = mysql_fetch_array($sp)) - { - $jin++; - $rt = $pl['text']; - $pl['vars'] = str_replace('^^^^','rvnO',$pl['vars']); - $rt = str_replace('{tm1}',''.date('H:i',$pl['time']).'',$rt); - $rt = str_replace('{tm2}',''.date('H:i',$pl['time']).'',$rt); - $rt = str_replace('{tm3}',''.date('d.m.Y H:i',$pl['time']).'',$rt); - $rt = str_replace('{tm4}',''.date('d.m.Y H:i',$pl['time']).'',$rt); - $pl['text'] = $rt; - unset($rt); - if($pll < $pl['id']) { - $pll = $pl['id']; - } - $js = 'add_log('.$pl['id'].','.$forYou2.',"'.$pl['text'].'",'.$pl['id_hod'].',0,0,"'.str_replace('"','"',$pl['vars']).'");'.$js; - } - $js .= 'id_log='.$pll.';'; - }else{ - $js = ''; $pll = 0; - if($_POST['idlog']<1){ $_POST['idlog'] = 0; } - // - $sp = mysql_query('SELECT - `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` - FROM `battle_logs` WHERE `battle` = "'.$this->info['id'].'" AND `id` > '.mysql_real_escape_string($_POST['idlog']).' AND `id_hod` > '.($this->hodID-7).' LIMIT 100'); - $jin = 0; $forYou2 = 0; - while($pl = mysql_fetch_array($sp)) - { - $jin++; - $rt = $pl['text']; - //$rt = str_replace('^^^^','=',$rt); - $pl['vars'] = str_replace('^^^^','rvnO',$pl['vars']); - $rt = str_replace('{tm1}',''.date('H:i',$pl['time']).'',$rt); - $rt = str_replace('{tm2}',''.date('H:i',$pl['time']).'',$rt); - $rt = str_replace('{tm3}',''.date('d.m.Y H:i',$pl['time']).'',$rt); - $rt = str_replace('{tm4}',''.date('d.m.Y H:i',$pl['time']).'',$rt); - $pl['text'] = $rt; - unset($rt); - if($pll < $pl['id']) { - $pll = $pl['id']; - } - $js = 'add_log('.$pl['id'].','.$forYou2.',"'.$pl['text'].'",'.$pl['id_hod'].',0,0,"'.str_replace('"','"',$pl['vars']).'");'.$js; - } - $js .= 'id_log='.$pll.';'; - } - // - $fp = fopen("battle_logs/btl_".$this->info['id'].".js", "w"); - fwrite($fp, 'var vlogid = '.$this->info['hod'].';var loadingLogNow = true;function logRefleshedCache(){ '.$js.' }'); - fclose($fp); - // - } - return true; - }*/ - - // - public function lookLog() - { - global $c, $u, $log_text; - $hodID = mysql_fetch_array(mysql_query('SELECT `id`,`id_hod` FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `time` ASC LIMIT 1')); - if ($hodID['id_hod'] <= 1) { - $u->info['alog'] = 0; - } - if (isset($hodID['id']) && $this->info['team_win'] != -1) { - $hodID = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_logs_save` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `time` ASC LIMIT 1')); - } - if (isset($hodID['id'])) { - $hodID = $hodID['id']; - } else { - $hodID = 0; - } - - $updt = 0; - if ($u->info['design'] == 1) { - $js = ''; - $pll = 0; - if ($_POST['idlog'] < 1) { - $_POST['idlog'] = 0; - } - $talog = mysql_fetch_array(mysql_query('SELECT `alog` FROM `stats` WHERE `id` = "' . $u->info['id'] . '" LIMIT 1')); - $sp = mysql_query('SELECT - `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` - FROM `battle_logs` - WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC'); - if (isset($sp) && $this->info['team_win'] != -1) { - $sp = mysql_query('SELECT - `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` - FROM `battle_logs_save` - WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC'); - } - $jin = 0; - $forYou2 = 0; - while ($pl = mysql_fetch_array($sp)) { - if ($jin == 0) { - $u->info['alog'] = $pl['id_hod']; - } - $jin++; - if ((true == false) && ($pl['type'] == 1 || $pl['type'] == 6)) { - } else { - $rt = $pl['text']; - //$rt = str_replace('^^^^','=',$rt); - $pl['vars'] = str_replace('^^^^', 'rvnO', $pl['vars']); - $rt = str_replace('{tm1}', '' . date('H:i', $pl['time']) . '', - $rt); - $rt = str_replace('{tm2}', '' . date('H:i', $pl['time']) . '', - $rt); - $rt = str_replace('{tm3}', - '' . date('d.m.Y H:i', $pl['time']) . '', $rt); - $rt = str_replace('{tm4}', - '' . date('d.m.Y H:i', $pl['time']) . '', $rt); - $pl['text'] = $rt; - } - unset($rt); - if ($pll < $pl['id']) { - $pll = $pl['id']; - } - $js = 'add_log(' . $pl['id'] . ',' . $forYou2 . ',"' . $pl['text'] . '",' . $pl['id_hod'] . ',0,0,"' . str_replace('"', - '"', $pl['vars']) . '");' . $js; - } - mysql_query('UPDATE `stats` SET `alog`="' . $u->info['alog'] . '" WHERE `id` ="' . $u->info['id'] . '" LIMIT 1'); - $js .= 'id_log=' . $pll . ';'; - } else { - $js = ''; - $pll = 0; - if ($_POST['idlog'] < 1) { - $_POST['idlog'] = 0; - } - $talog = mysql_fetch_array(mysql_query('SELECT `alog` FROM `stats` WHERE `id` = "' . $u->info['id'] . '" LIMIT 1')); - $sp = mysql_query('SELECT - `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` - FROM `battle_logs` - WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC'); - if (isset($sp) && $this->info['team_win'] != -1) { - $sp = mysql_query('SELECT - `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` - FROM `battle_logs_save` - WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC'); - } - $jin = 0; - $forYou2 = 0; - while ($pl = mysql_fetch_array($sp)) { - if ($jin == 0) { - $u->info['alog'] = $pl['id_hod']; - } - $jin++; - $rt = $pl['text']; - //$rt = str_replace('^^^^','=',$rt); - $pl['vars'] = str_replace('^^^^', 'rvnO', $pl['vars']); - $rt = str_replace('{tm1}', '' . date('H:i', $pl['time']) . '', $rt); - $rt = str_replace('{tm2}', '' . date('H:i', $pl['time']) . '', $rt); - $rt = str_replace('{tm3}', '' . date('d.m.Y H:i', $pl['time']) . '', - $rt); - $rt = str_replace('{tm4}', '' . date('d.m.Y H:i', $pl['time']) . '', - $rt); - $pl['text'] = $rt; - unset($rt); - if ($pll < $pl['id']) { - $pll = $pl['id']; - } - $js = 'add_log(' . $pl['id'] . ',' . $forYou2 . ',"' . $pl['text'] . '",' . $pl['id_hod'] . ',0,0,"' . str_replace('"', - '"', $pl['vars']) . '");' . $js; - } - mysql_query('UPDATE `stats` SET `alog`="' . $u->info['alog'] . '" WHERE `id` ="' . $u->info['id'] . '" LIMIT 1'); - $js .= 'id_log=' . $pll . ';'; - } - - - return $js; - } - -// - public function lookmLog() - { - global $c, $u, $log_text; - $js = ''; - $pll = 0; - - if ($this->info['type'] != 9) { - $hodID = mysql_fetch_array(mysql_query('SELECT `id`,`id_hod` FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `time` ASC LIMIT 1')); - if ($hodID['id_hod'] <= 1) { - $u->info['mlog'] = 0; - } - if (isset($hodID['id']) && $this->info['team_win'] != -1) { - $hodID = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_logs_save` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `time` ASC LIMIT 1')); - } - if (isset($hodID['id'])) { - $hodID = $hodID['id']; - } else { - $hodID = 0; - } - $tmlog = mysql_fetch_array(mysql_query('SELECT `mlog` FROM `stats` WHERE `id` = "' . $u->info['id'] . '" LIMIT 1')); - $spm = mysql_query('SELECT - `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` - FROM `battle_logs` - WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $tmlog['mlog'] . ' AND `vars` LIKE "%' . $u->info['login'] . '%" ORDER BY `id` DESC'); - - if (isset($spm) && $this->info['team_win'] != -1) { - $spm = mysql_query('SELECT - `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` - FROM `battle_logs_save` - WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $tmlog['mlog'] . ' AND `vars` LIKE "%' . $u->info['login'] . '%" ORDER BY `id` DESC'); - } - - $jin = 0; - $forYou2 = 0; - - while ($plm = mysql_fetch_array($spm)) { - if ($jin == 0) { - $u->info['mlog'] = $plm['id_hod']; - } - $jin++; - $rt = $plm['text']; - $plm['vars'] = str_replace('^^^^', 'rvnO', $plm['vars']); - $rt = str_replace('{tm1}', '' . date('H:i', $plm['time']) . '', $rt); - $rt = str_replace('{tm2}', '' . date('H:i', $plm['time']) . '', $rt); - $rt = str_replace('{tm3}', '' . date('d.m.Y H:i', $plm['time']) . '', - $rt); - $rt = str_replace('{tm4}', '' . date('d.m.Y H:i', $plm['time']) . '', - $rt); - $plm['text'] = $rt; - unset($rt); - if ($pll < $plm['id']) { - $pll = $plm['id']; - } - $js = 'add_mlog(' . $plm['id'] . ',' . $forYou2 . ',"' . $plm['text'] . '",' . $plm['id_hod'] . ',0,0,"' . str_replace('"', - '"', $plm['vars']) . '");' . $js; - } - $js .= 'id_mlog=' . $pll . ';'; - mysql_query('UPDATE `stats` SET `mlog`="' . $u->info['mlog'] . '" WHERE `id` ="' . $u->info['id'] . '" LIMIT 1'); - } - return $js; - } -//====================== - - // - public function add_log($mass) - { - if (empty($mass['text'])) { - return; - } - mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`type`) VALUES (unix_timestamp(), "' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $mass['text'] . '","' . $mass['vars'] . '","' . $mass['type'] . '")'); - if (rand(2, 10) == 10) { - $this->get_comment(); - } - } - - /// - public function get_comment() - { - $boycom = [ - ' .', - ' , ?', - ' ?', - ', -, ? ! !', - ' .', - ' . ', - ' ...', - ' ...', - ' ?', - ' , !?', - ' ?', - ' -, :', - ' - ?', - ' , ', - ' ?!', - ' . ?', - ' ...', - ' !', - ' !', - ' , !', - ' .', - ' 5 , , 20- ...', - '. .', - ' , - ?', - ' , ?', - ' ... : ...', - ' , ?', - ' , ', - ' . ... , , ', - ' !', - ' ? , .', - ' ! !', - ' !', - ', , ` ` ', - ' ?!', - ' ! .', - ' . ? .', - ' !', - ', ... !.. , .', - ' , !', - ' -, ...', - ' - , :)', - ' .', - ' - !!!', - '! ! ! !', - ' !', - ' ? . , .', - ' . .', - ' ...', - ' ...', - ' !!!', - '!? ?!', - ' ?', - ', ...', - ' .', - ' !', - ' , - .', - ', , , .', - ' !', - ', - ???', - ' , .', - ' ? !', - ', !', - ' , ...', - ' . !', - '! ! ... , .', - ', , ?', - ', !', - ' !', - ' , ... , ... ?!', - ' ?', - ' . .', - ', ..? . , .', - '... .', - '!!!.... ...', - '! .', - '! , !', - ' ???', - ' ... - .', - ', ...', - ' !', - '-, - .', - ' , .', - ' , ?', - ' - .', - ', .', - ' !', - ' , .', - ' ... , !', - ' ...', - ' !', - ' !', - ' ', - ' , .', - ' , .', - ' - .', - ' !', - ' ', - ' ...', - ' , !', - '!! , ...', - ' ! .', - ', !', - ', , ?', - ', , .', - ' !', - ' !', - '-!', - ' ?! !', - ' , ', - ' - ...', - ' , ! !', - ' , .', - ' ', - ' `` ?', - ' - ...', - ' , - .', - ' . :)', - ' , , , . ? - ?!', - ' , ...', - '( ) ... !', - '< > < > < > < >', - '< > ', - ]; - //$act_com = array(); - if (rand(1, 6) == rand(1, 6)) { - $txt = '{tm1} : ' . $boycom[rand(0, count($boycom) - 1)] . ''; - - $vLog = 'time1=' . time() . ''; - $mas1 = [ - 'time' => time(), - 'battle' => $this->info['id'], - 'id_hod' => $this->hodID, - 'text' => '', - 'vars' => $vLog, - 'zona1' => '', - 'zonb1' => '', - 'zona2' => '', - 'zonb2' => '', - 'type' => '1', - ]; - $mas1['text'] = $txt; - $this->add_log($mas1); - } else { - return false; - } - } - - // - public function weaponTx($item) - { - global $u; - $tp = 0; - if (!isset($item['id'])) { - $i = 1; - while ($i <= 4) { - $itm['tya' . $i] = 1; - $i++; - } - } - $itm = $u->lookStats($item['data']); - $t[0]['z'] = 0; - $t[0]['t'] = 0; - // - $t[1]['z'] = round(0 + $itm['tya1']); - $t[1]['t'] = 1; - // - $t[2]['z'] = round(0 + $itm['tya2']); - $t[2]['t'] = 2; - // - $t[3]['z'] = round(0 + $itm['tya3']); - $t[3]['t'] = 3; - // - $t[4]['z'] = round(0 + $itm['tya4']); - $t[4]['t'] = 4; - // - $t[5]['z'] = round(0 + $itm['tym1']); - $t[5]['t'] = 5; - // - $t[6]['z'] = round(0 + $itm['tym2']); - $t[6]['t'] = 6; - // - $t[7]['z'] = round(0 + $itm['tym3']); - $t[7]['t'] = 7; - // - $t[8]['z'] = round(0 + $itm['tym4']); - $t[8]['t'] = 8; - // - $t[9]['z'] = round(0 + $itm['tym5']); - $t[9]['t'] = 9; - // - $t[10]['z'] = round(0 + $itm['tym6']); - $t[10]['t'] = 10; - // - $t[11]['z'] = round(0 + $itm['tym7']); - $t[11]['t'] = 11; - - // - /* - $inr = array(); - $i = 1; - while( $i <= 11 ) { - if( $t[$i] > 0 ) { - $j = 0; - while( $j < $t[$i] ) { - //if(isset($itm['tya'.$i]) && $itm['tya'.$i] > 0 && $i < 5 && $itm['tya'.$i] > 0) { - //$inr[] = $i; - //}elseif(isset($itm['tym'.($i-4)]) && $itm['tym'.($i-4)] > 0 && $i > 4 && $itm['tym'.($i-4)] > 0) { - //$inr[] = $i; - //} - if( isset($itm['tya'.$i]) && $itm['tya'.$i] > 0 ) { - $inr[] = $i; - $rk .= '*'.$i.'='.$j.'%*|'; - }else{ - $rk .= ''.$i.'='.$j.'%|'; - } - $j++; - } - //if( $u->info['admin'] > 0 ) { - - //} - } - $i++; - } - //shuffle($inr); - $tp = $inr[rand(0,count($inr)-1)]; - if( !isset($itm['tya'.$tp]) || $itm['tya'.$tp] < 1 ) { - if(isset($item['id'])) { - $this->error($u->info['id'],'battle::weaponTx. : id : -'.$item['id'].'-b'.$this->info['id'].'.( : tya'.$tp.'['.$itm['tya'.$tp].']).( : '.$rk.').( : '.count($inr).')'); - } - } - - // - if( $item['type'] == 18 ) { - $tp = 1; - }elseif( $item['type'] == 19 ) { - $tp = 2; - }elseif( $item['type'] == 20 ) { - $tp = 3; - }elseif( $item['type'] == 21 ) { - $tp = 4; - }else{ - //$tp = 0; - }*/ - - $tpt = $t[0]['z']; - $tpmin = $t[0]; - $tpmax = $t[0]; - $i = 1; - - while ($i <= 11) { - if ($t[$i]['z'] > $tpt) { - $tpt = $t[$i]['z']; - $tpmax = $t[$i]; - $ii = $i; - } - $i++; - } - $t[$ii]['z'] = 0; - - $tpt = $t[0]['z']; - $i = 1; - while ($i <= 11) { - if ($t[$i]['z'] > $tpt) { - $tpt = $t[$i]['z']; - $tpmin = $t[$i]; - } - $i++; - } - - $setclass = rand(1, 100); - - if ($setclass > $tpmax['z']) { - $tp = $tpmin['t']; - } else { - $tp = $tpmax['t']; - } - - - return $tp; - } - - // - /*public function error($login,$t) { - mysql_query('INSERT INTO `chat_system` (`text`,`city`,`login`,`to`,`type`,`new`,`time`) VALUES ("'.mysql_real_escape_string($t).'","capitalcity","","'.$login.'","3","1","'.time().'")'); - }*/ - - - // - public function weaponAt($item, $st, $x) - { - $tp = 0; - $tp20 = 0; - if (isset($item['id'])) { - $itm = $this->lookStats($item['data']); - // - $min = $itm['sv_yron_min'] + $itm['yron_min'] + $st['minAtack']; - $max = $itm['sv_yron_max'] + $itm['yron_max'] + $st['maxAtack']; - if ($x != 0) { - /* - - 60% 40% . - - 70% 20% 20% . - - 100% . - - 60% 40% . - */ - // : 0 - , 1 - , 2 - , 3 - , 4 - , 5 - , 6 - , 7 - , 8 - , 9 - , 10 - , 11 - - if ($x == 1) { - // - $wst = $st['s2'] * 1; - $min += 5 + (ceil($wst * 1.4) / 1.25) + $st['minAtack']; - $max += 7 + (ceil(0.4 + $min / 0.9) / 1.25) + $st['maxAtack']; - $tp20 = 1; - } elseif ($x == 2) { - // - $wst = $st['s1'] * 0.75; - $min += 5 + (ceil($wst * 1.4) / 1) + $st['minAtack']; - $max += 7 + (ceil(0.4 + $min / 0.9) / 1.25) + $st['maxAtack']; - $tp20 = 2; - } elseif ($x == 3) { - // - $wst = $st['s4'] * 1.5; - $min += 5 + (ceil($wst * 1.4) / 1.25) + $st['minAtack']; - $max += 7 + (ceil(0.4 + $min / 0.9) / 1.25) + $st['maxAtack']; - $tp20 = 3; - } elseif ($x == 4) { - // - $wst = $st['s3'] * 1; - $min += 5 + (ceil($wst * 1.4) / 1.25) + $st['minAtack']; - $max += 7 + (ceil(0.4 + $min / 0.9) / 1.25) + $st['maxAtack']; - $tp20 = 4; - } elseif ($x >= 5 && $x <= 22) { - // - $wst = $st['s1'] * 0.01 + $st['s2'] * 0.01 + $st['s3'] * 0.01 + $st['s5'] * 0.06; - $min += 3 + (ceil($wst * 1.4) / 2.25) + $st['minAtack']; - $max += 5 + (ceil(0.4 + $min / 0.9) / 2.25) + $st['maxAtack']; - $tp20 = 5; - } else { - // - - } - - $wst = ($st['s1'] * 0.02 + $st['s2'] * 0.02 + $st['s3'] * 0.05); - $min1 = -2 + ceil($wst * 1.4) / 1.25; - $max1 = 4 + ceil(0.4 + $min1 / 0.9) / 1.25; - - $min = round(($min + $min1)); - //$max = round(($max+$max1)); - } - $tp = rand(($min + $max) / 3.5, (($min + $max) / 3.5 + (($min + $max) / 3.5) / 100 * 7)); - } - return $tp; - } - - // - public function weaponAt22($item, $st) - { - $tp = 0; - $tp20 = 0; - if (isset($item['id'])) { - $itm = $this->lookStats($item['data']); - // - $min = $itm['sv_yron_min'] + $itm['yron_min'] + $st['minAtack']; - $max = $itm['sv_yron_max'] + $itm['yron_max'] + $st['maxAtack']; - } - return [$min, $max]; - } - - public function domino($itm) - { - $r = 0; - //0 - inOdet , 1 - class , 2 - class-point , 3 - anti_class , 4 - antic_lass-point , 5 - level , 6 level_u - //15 - $clss = [ - 1 => 100, // - 2 => 80, // - 3 => 150, // - 14 => 100, // - 5 => 200, // - 7 => 50, // - 17 => 50, // - 10 => 80, // - 11 => 80, // - 12 => 80, // - 9 => 100, // - 8 => 100, // - 4 => 50, // - 16 => 80, // - 6 => 50 // - ]; - $r += $clss[$itm[0]]; - if ($itm[10] > 0) { - //. - if ($itm[10] < 500) { - // - $r += $clss[$itm[0]] * 4; - } else { - // - $r += $clss[$itm[0]] * 4; - } - } - return $r; - } - - public function adomino($itm) - { - $r = 0; - //0 - inOdet , 1 - class , 2 - class-point , 3 - anti_class , 4 - antic_lass-point , 5 - level , 6 level_u - //15 - $clss = [ - 1 => 80, // - 2 => 60, // - 3 => 130, // - 14 => 80, // - 5 => 180, // - 7 => 30, // - 17 => 30, // - 10 => 50, // - 11 => 50, // - 12 => 50, // - 9 => 80, // - 8 => 80, // - 4 => 30, // - 16 => 50, // - 6 => 30 // - ]; - $r += $clss[$itm[0]]; - return $r; - } - - public function domino_lvl($r, $lvl, $lvl_itm) - { - if ($lvl < $lvl_itm) { - $r = $r * ((50 - $lvl + $lvl_itm) / 100); - // , . \ , - $r = ceil($r); - } - return $r; - } - /* - public $bal = array( - // X - Y - // , , , , , - '' => array(0,50,90,00,90,50,50), // - '' => array(0,00,50,90,00,50,70), // - '' => array(0,90,00,50,90,30,50), // - '' => array(0,00,90,00,50,50,50), // - '' => array(0,50,30,90,00,50,70), // - '' => array(0,90,30,00,90,50,50) // - ); - */ - - /* - public function domino_all($v1,$v2,$d1,$d2) { - // 1 , 2 , 1 , 2 - // - $mx = 0; - $cs = array(NULL,'','','','','',''); - $r = array( - 0 => 0, - ''=>array(), - ''=>array(), - ''=>array(), - ''=>array(), - ''=>array(), - ''=>array() - ); - $i = 0; - while($i <= 7) { - if(isset($v1[$i]) || isset($v2[$i])) { - $r[$cs[$i]] = round(((1+($v1[$i]*1.3)-$v2[$i]+$d1[$i]+$d2[$i])/1300),2); - if($v1[$i] > $mx) { - $mx = $v1[$i]; - $r[0] = $cs[$i]; - $r[1] = $i; - } - } - $i++; - } - return $r; - }*/ - - public function yronLvl($lvl1, $lvl2) - { - $r = [ - 1 => [ - 0, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - ], - 2 => [ - 0, - 600, - 400, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - ], - 3 => [ - 0, - 1000, - 800, - 600, - 400, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - ], - 4 => [ - 0, - 1400, - 1200, - 1000, - 800, - 600, - 400, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - ], - 5 => [ - 0, - 1800, - 1600, - 1400, - 1200, - 1000, - 800, - 600, - 400, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - ], - 6 => [ - 0, - 2200, - 2000, - 1800, - 1600, - 1400, - 1200, - 1000, - 800, - 600, - 400, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - ], - 7 => [ - 0, - 2600, - 2400, - 2200, - 2000, - 1800, - 1600, - 1400, - 1200, - 1000, - 800, - 600, - 400, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - ], - 8 => [ - 0, - 3000, - 2800, - 2600, - 2400, - 2200, - 2000, - 1800, - 1600, - 1400, - 1200, - 1000, - 800, - 600, - 400, - 200, - 200, - 200, - 200, - 200, - 200, - 200, - ], - 9 => [ - 0, - 3400, - 3200, - 3000, - 2800, - 2600, - 2400, - 2200, - 2000, - 1800, - 1600, - 1400, - 1200, - 1000, - 800, - 600, - 400, - 200, - 200, - 200, - 200, - 200, - ], - 10 => [ - 0, - 3800, - 3600, - 3400, - 3200, - 3000, - 2800, - 2600, - 2400, - 2200, - 2000, - 1800, - 1600, - 1400, - 1200, - 1000, - 800, - 600, - 400, - 200, - 200, - 200, - ], - 11 => [ - 0, - 4200, - 4000, - 3800, - 3600, - 3400, - 3200, - 3000, - 2800, - 2600, - 2400, - 2200, - 2000, - 1800, - 1600, - 1400, - 1200, - 1000, - 800, - 600, - 400, - 200, - ], - 12 => [ - 0, - 4600, - 4400, - 4200, - 4000, - 3800, - 3600, - 3400, - 3200, - 3000, - 2800, - 2600, - 2400, - 2200, - 2000, - 1800, - 1600, - 1400, - 1200, - 1000, - 800, - 600, - ], - 13 => [ - 0, - 5000, - 4800, - 4600, - 4400, - 4200, - 4000, - 3800, - 3600, - 3400, - 3200, - 3000, - 2800, - 2600, - 2400, - 2200, - 2000, - 1800, - 1600, - 1400, - 1200, - 1000, - ], - 14 => [ - 0, - 5400, - 5200, - 5000, - 4800, - 4600, - 4400, - 4200, - 4000, - 3800, - 3600, - 3400, - 3200, - 3000, - 2800, - 2600, - 2400, - 2200, - 2000, - 1800, - 1600, - 1400, - ], - 15 => [ - 0, - 5800, - 5600, - 5400, - 5200, - 5000, - 4800, - 4600, - 4400, - 4200, - 4000, - 3800, - 3600, - 3400, - 3200, - 3000, - 2800, - 2600, - 2400, - 2200, - 2000, - 1800, - ], - 16 => [ - 0, - 6200, - 6000, - 5800, - 5600, - 5400, - 5200, - 5000, - 4800, - 4600, - 4400, - 4200, - 4000, - 3800, - 3600, - 3400, - 3200, - 3000, - 2800, - 2600, - 2400, - 2200, - ], - 17 => [ - 0, - 6600, - 6400, - 6200, - 6000, - 5800, - 5600, - 5400, - 5200, - 5000, - 4800, - 4600, - 4400, - 4200, - 4000, - 3800, - 3600, - 3400, - 3200, - 3000, - 2800, - 2600, - ], - 18 => [ - 0, - 7000, - 6800, - 6600, - 6400, - 6200, - 6000, - 5800, - 5600, - 5400, - 5200, - 5000, - 4800, - 4600, - 4400, - 4200, - 4000, - 3800, - 3600, - 3400, - 3200, - 3000, - ], - 19 => [ - 0, - 7400, - 7200, - 7000, - 6800, - 6600, - 6400, - 6200, - 6000, - 5800, - 5600, - 5400, - 5200, - 5000, - 4800, - 4600, - 4400, - 4200, - 4000, - 3800, - 3600, - 3400, - ], - 20 => [ - 0, - 7800, - 7600, - 7400, - 7200, - 7000, - 6800, - 6600, - 6400, - 6200, - 6000, - 5800, - 5600, - 5400, - 5200, - 5000, - 4800, - 4600, - 4400, - 4200, - 4000, - 3800, - ], - 21 => [ - 0, - 8200, - 8000, - 7800, - 7600, - 7400, - 7200, - 7000, - 6800, - 6600, - 6400, - 6200, - 6000, - 5800, - 5600, - 5400, - 5200, - 5000, - 4800, - 4600, - 4400, - 4200, - ], - ]; - $r = floor($r[$lvl1][$lvl2] / 100); - $r = 0; - return $r; - } - // - // - public function zago($v) - { - if ($v > 1700) { - $v = 1700; - } - $r = round((1 - (pow(0.5, ($v / 399.51)))) * 100, 2); - return $r; - } - - // () - public function zmgo($v) - { - //if($v > 1000) { - // $v = 1000; - //} - $r = (1 - (pow(0.5, ($v / 250)))) * 100; - return $r; - } - - - public function yrn( - $st1, - $st2, - $u1, - $u2, - $level, - $level2 = null, - $type, - $min_yron, - $max_yron, - $min_bron = null, - $max_bron = null, - $vladenie, - $power_yron, - $power_krit, - $zashita, - $ozashita = null, - $proboi, - $weapom_damage, - $weapom_min, - $weapom_max, - $za_proc = null, - $zm_proc = null, - $zashitam = null, // pzm ! - $ozashitam = null, - $wp_type, - $witm - ) { - global $u; - - // - if ($zashita < 1) { - $zashita = 1; - } - - if ($min_yron < 1) { - $min_yron = 1; - } - - if ($max_yron < 1) { - $max_yron = 1; - } - - if (!isset($type) || $type == '') { - $type = 12; - } - - // - $r = ['min' => 0, 'max' => 0, 'type' => $type]; - $p = [ - 'Y' => 0, - 'B' => [0 => 0, 1 => 0, 'rnd' => false], - 'L' => $level, - 'W' => [$weapom_min, $weapom_max, 'rnd' => false], // // - 'U' => $vladenie, // - 'M' => $power_yron, // - 'K' => $power_krit, // - 'S' => 0, // . - 'T' => 1, //. - 'iT' => 1, // . . - /* - (S) - - : S = * 0,3 + * 0,7 - : S = * 0,5 + * 0,25 + * 0,25 - : S = * 1 - : S = * 0,3 + * 0,7 - */ - ]; - - //$p['M'] = $p['M'] * 0.70; - //$p['K'] = $p['K'] * 0.70; // - - // 1.33 1.00 - //if ($weapom_damage == 0) { $p['T'] = 1; }elseif($weapom_damage == 1) { $p['T'] = 2.33;$p['iT'] = 2.33;} - - $witmdata = $this->lookStats($witm['data']); - - // - - if ($wp_type == 18) { - $r['type'] = 1; - } elseif ($wp_type == 19) { - $r['type'] = 2; - } elseif ($wp_type == 20) { - $r['type'] = 3; - } elseif ($wp_type == 21) { - $r['type'] = 4; - } else { - $r['type'] = 0; - } - // - // - if ($r['type'] == 1) { - $p['S'] = $st1['s1'] * 0.25 + $st1['s2'] * 0.75; - $p['U'] = $st1['a1'] * 1.00; // - // - } elseif ($r['type'] == 2) { - $p['S'] = $st1['s1'] * 1.20; - $p['U'] = $st1['a2'] * 1.00; // - // - } elseif ($r['type'] == 3) { - $p['S'] = $st1['s1'] * 0.5 + $st1['s4'] * 1.00; - $p['U'] = $st1['a3'] * 1.00; // - // - } elseif ($r['type'] == 4) { - $p['S'] = $st1['s3'] * 1.00; - $p['U'] = $st1['a4'] * 1.00; // - // - } elseif ($r['type'] >= 5 && $r['type'] < 12) { - $p['S'] = $st1['s1'] * 0.5 + $st1['s2'] * 0.5; - $p['U'] = $st1['mg' . ($r['type'] - 4)] * 1.00; // - $p['Mage'] = true; - } else { - $p['S'] = 0; - $p['U'] = 0; // ( - } - // - // - /*if($r['type'] == 1) { //s2 - if ($st1['s2']<100) - { - $p['S'] = $p['S']*0.15; - }elseif ($st1['s2']>=150 && $st1['s2']<250){ - $p['S'] = $p['S']*0.25; - }elseif ($st1['s2']>=250 && $st1['s2']<300){ - $p['S'] = $p['S']*0.50; - }elseif ($st1['s2']>=300){ - $p['S'] = $p['S']*0.65; - } - - // - }elseif($r['type'] == 2) { //s1 - if ($st1['s1']<100) - { - $p['S'] = $p['S']*0.25; - }elseif ($st1['s1']>=100 && $st1['s1']<200){ - $p['S'] = $p['S']*0.35; - }elseif ($st1['s1']>=200 && $st1['s1']<250){ - $p['S'] = $p['S']*0.45; - }elseif ($st1['s1']>=250){ - $p['S'] = $p['S']*0.50; - } - - // - }elseif($r['type'] == 3) { //s1 - if ($st1['s1']<100) - { - $p['S'] = $p['S']*0.50; - }elseif ($st1['s1']>=125 && $st1['s1']<150){ - $p['S'] = $p['S']*0.65; - }elseif ($st1['s1']>=150 && $st1['s1']<175){ - $p['S'] = $p['S']*0.75; - }elseif ($st1['s1']>=175){ - $p['S'] = $p['S']*0.85; - } - - // - }elseif($r['type'] == 4) { //s3 - if ($st1['s3']<100) - { - $p['S'] = $p['S']*0.10; - }elseif ($st1['s3']>=150 && $st1['s3']<200){ - $p['S'] = $p['S']*0.15; - }elseif ($st1['s3']>=200 && $st1['s3']<250){ - $p['S'] = $p['S']*0.20; - }elseif ($st1['s3']>=250){ - $p['S'] = $p['S']*0.25; - } - - }*/ - - $r['bron']['rnd'] = rand($r['bron'][0], $r['bron'][1]); - - // - /*$r['bron'] = array($min_bron, $max_bron); // - $r['bron']['rnd'] = rand($r['bron'][0],$r['bron'][1]); - //$r['bron']['rnd'] += $r['bron']['rnd']*0.01; // +1% - - $r['za'] = $zashita; // - $r['oza'] = $ozashita; // - - $r['zm'] = $zashitam; // - $r['ozm'] = $ozashitam; // */ - - - /* - // - r.B[0] = $('#v1').val() * 0.51; - r.B[1] = r.B[0] + 3.73; - r.B[0] = Math.ceil(r.B[0]); - r.B[1] = Math.floor(r.B[1]); - if( r.B[0] < 0 ) { r.B[0] = 0; } - if( r.B[1] < 0 ) { r.B[1] = 0; } - r.B[0] += 5; - r.B[1] += 6; - // - */ - - // () - //$p['B'][0] = $st1['s1']*0.51; - //$p['B'][1] = $p['B'][0] + 3.73; - $p['B'][0] = 2 + $level + $st1['s1'] - round($st1['s1'] / 5); - $p['B'][1] = $p['B'][0] + 3; - /*$p['B'][0] += 5; - $p['B'][1] += 6;*/ - - $p['B']['rnd'] = rand($p['B'][0], $p['B'][1]); - $p['W']['rnd'] = rand($p['W'][0], $p['W'][1]); - - // - //$p['Mstart'] = 0; // - if ($r['type'] == 12) { - $r['min'] = ($p['B'][0] + $weapom_min) * $p['T'] * (1 + $p['M'] / 100); - $r['max'] = ($p['B'][1] + $weapom_max) * $p['T'] * (1 + $p['M'] / 100); - } else { - $r['min'] = (($p['B'][0] + $p['S'] * 2 + $weapom_min * 2 + $p['U'] * 2) * $p['T']) * (1 + $p['M'] / 100); - $r['max'] = (($p['B'][1] + $p['S'] * 2 + $weapom_max * 2 + $p['U'] * 2) * $p['T']) * (1 + $p['M'] / 100); - //$r['min'] = (($p['B'][0]+$p['S']+$weapom_min)*$p['T']*(1+($u1['level']/200)*$p['U']))*(1+$p['M']/100); - //$r['max'] = (($p['B'][1]+$p['S']+$weapom_max)*$p['T']*(1+($u1['level']/200)*$p['U']))*(1+$p['M']/100); - if ($witmdata['tr_lvl'] < $level) { - /* - $minp = 3*($level-$witmdata['tr_lvl']); - $r['min'] -= ceil($r['min'] / 100 * $minp); - $r['max'] -= ceil($r['max'] / 100 * $minp); - */ - } - } - - //$r['minm'] = $r['min']*0.13; - //$r['maxm'] = $r['max']*0.13; - - /*if( $wp_type == 22 ) { - // - $r['min'] = $r['min']/2; - $r['max'] = $r['max']/2; - }*/ - - // - // - //$r['Kmin'] = $r['min']; - //$r['Kmax'] = $r['max']; - - /*$r['min'] += $weapom_min; - $r['max'] += $weapom_max; - $r['Kmin'] += $weapom_min*2; - $r['Kmax'] += $weapom_max*2;*/ - - // - //$r['min_'] = floor($r['min']*0.13); - //$r['max_'] = floor($r['max']*0.13); - //$r['Kmin_'] = floor($r['Kmin']*0.13); - //$r['Kmax_'] = floor($r['Kmax']*0.13); - - // - //$r['ozash_rnd'] = $r['oza'][$r['type']][1]; /*rand($r['oza'][$r['type']][0],$r['oza'][$r['type']][1]);*/ - - //if($r['ozash_rnd'] > 80) { $r['ozash_rnd'] = 80; } - //if($r['ozash_rnd'] < 0) { $r['ozash_rnd'] = 0; } - - - //$r['ozash_rnd'] = 100-$r['ozash_rnd']; - - //$p['iT'] - - /*$r['min'] = floor($r['min']*$p['iT'] + $weapom_min); - $r['max'] = floor($r['max']*$p['iT'] + $weapom_max); - $r['Kmin'] = floor($r['Kmin']*$p['iT'] + $weapom_min*2); - $r['Kmax'] = floor($r['Kmax']*$p['iT'] + $weapom_max*2); - $r['min_'] = floor($r['min_']*$p['iT'] + $weapom_min); - $r['max_'] = floor($r['max_']*$p['iT'] + $weapom_max); - $r['Kmin_'] = floor($r['Kmin_']*$p['iT'] + $weapom_min*2); - $r['Kmax_'] = floor($r['Kmax_']*$p['iT'] + $weapom_max*2); - */ - - //$r['min'] -= ($r['min']/(200+$r['ozash_rnd'])*$r['ozash_rnd']); - //$r['max'] -= ($r['max']/(200+$r['ozash_rnd'])*$r['ozash_rnd']); - - //$r['Kmin'] -= ($r['Kmin']/(200+$r['ozash_rnd'])*$r['ozash_rnd']); - //$r['Kmax'] -= ($r['Kmax']/(200+$r['ozash_rnd'])*$r['ozash_rnd']); - - $r['bRND'] = $p['B']['rnd']; - - //$r['min'] += $min_yron; - //$r['max'] += $max_yron; - - // - - /*if( $r['minm'] > $r['min'] ) { - $r['min'] = $r['minm']; - } - if( $r['maxm'] > $r['max'] ) { - $r['max'] = $r['maxm']; - }*/ - - $r['Kmin'] = ceil((2 + (0 + $p['K'] / 100)) * $r['min']); - $r['Kmax'] = ceil((2 + (0 + $p['K'] / 100)) * $r['max']); - - //$r['Kmin'] = ceil( ( 1 + ( 1 + $p['K']/100 ) ) * $r['min']); - //$r['Kmax'] = ceil( ( 1 + ( 1 + $p['K']/100 ) ) * $r['max']); - - //$r['Kmin'] = ceil( ( $r['min'] * 2 ) * ( 1 + $p['K']/100 )); - //$r['Kmax'] = ceil( ( $r['max'] * 2 ) * ( 1 + $p['K']/100 )); - - //$r['Kmin'] = ceil( ( $r['min'] ) * ( 2 + $p['K']/100 )); - //$r['Kmax'] = ceil( ( $r['max'] ) * ( 2 + $p['K']/100 )); - // - //$r['Kminm'] = $r['Kmin']*0.05; - //$r['Kmaxm'] = $r['Kmax']*0.05; - - // - // - if ($r['type'] < 5 || $r['type'] == 12) { - $r['min_abron'] = round($r['min'] * 0.05); - $r['max_abron'] = round($r['max'] * 0.05); - - /*if($proboi != 0) { - $r['bron']['rndold'] = $r['bron']['rnd']; - $r['yrnrz'] = $r['max']-$r['min']; - if( $r['yrnrz'] < 0 ) { - $r['yrnrz'] = -$r['yrnrz']; - } - }*/ - if ($proboi != 0) { - $r['bron']['rndold'] = $r['bron']['rnd']; - //$r['bron']['rnd'] = floor($r['bron']['rnd']/100*(100-$proboi)); - //if( $r['bron']['rnd'] < $r['bron'][0] ) { - $r['bron']['rnd'] = 0;//$r['bron'][0]; - //} - /*if( round($r['min']*0.45) < $r['bron']['rnd'] ) { - $r['bron']['rnd'] = round($r['min']*0.55); - } - // - $r['yrnrz'] = $r['max']-$r['min']; - if( $r['yrnrz'] < 0 ) { - $r['yrnrz'] = -$r['yrnrz']; - }*/ - } - - // - if ($r['bron']['rnd'] > $r['min']) { - // $r['bron']['rnd'] = $r['min']; - } - // - - $r['Kmin'] -= $r['bron']['rnd'] * 2; // 2 - $r['Kmax'] -= $r['bron']['rnd'] * 2; // 2 - - $r['min'] -= $r['bron']['rnd']; // . - $r['max'] -= $r['bron']['rnd']; // . - - if ($proboi != 0) { - // $r['yrnrz'] - // $r['bron']['rndold'] - } - } - - // ( 80%) - if ($r['type'] < 5) { - $r['min'] = round($r['min'] / 100 * (100 - $this->zago($st2['za']))); - $r['max'] = round($r['max'] / 100 * (100 - $this->zago($st2['za']))); - $r['Kmin'] = round($r['Kmin'] / 100 * (100 - $this->zago($st2['za']))); - $r['Kmax'] = round($r['Kmax'] / 100 * (100 - $this->zago($st2['za']))); - } elseif ($r['type'] == 12) { - $r['min'] = round($r['min'] / 100 * (100 - $this->zago($st2['za']))); - $r['max'] = round($r['max'] / 100 * (100 - $this->zago($st2['za']))); - $r['Kmin'] = round($r['Kmin'] / 100 * (100 - $this->zago($st2['za']))); - $r['Kmax'] = round($r['Kmax'] / 100 * (100 - $this->zago($st2['za']))); - } else { - $r['min'] = round($r['min'] / 100 * (100 - $this->zmgo($st2['zm']))); - $r['max'] = round($r['max'] / 100 * (100 - $this->zmgo($st2['zm']))); - $r['Kmin'] = round($r['Kmin'] / 100 * (100 - $this->zmgo($st2['zm']))); - $r['Kmax'] = round($r['Kmax'] / 100 * (100 - $this->zmgo($st2['zm']))); - } - - /*if( $r['Kminm'] > $r['Kmin'] ) { - $r['Kmin'] = $r['Kminm']; - } - if( $r['Kmaxm'] > $r['Kmax'] ) { - $r['Kmax'] = $r['Kmaxm']; - } - - if( $r['minm'] > $r['min'] ) { - $r['min'] = $r['minm']; - } - if( $r['maxm'] > $r['max'] ) { - $r['max'] = $r['maxm']; - }*/ - - $r['min'] = round($r['min']); - $r['max'] = round($r['max']); - $r['Kmin'] = round($r['Kmin']); - $r['Kmax'] = round($r['Kmax']); - - $min_yrn = 0; //% - - //if( $wp_type == 18 ) { - //$min_yrn = 17; - //} - - // - /*if($r['type'] == 1) { - $min_yrn += 50; - // - }elseif($r['type'] == 2) { - $min_yrn += 40; - // - }elseif($r['type'] == 3) { - $min_yrn += 35; - // - }elseif($r['type'] == 4) { - $min_yrn += 60; - // - }elseif($r['type'] >= 5){ - - }else { - - } - - // - if( $p['M'] > 0 ) { - //$min_yrn -= $p['M']/100*20; - } - // - if( $p['Mage'] == true && $r['type'] != 1 ) { - //$min_yrn += 30; - } - // - if( $r['type'] >= 5 ) { - $min_yrn += $zm_proc; - }else{ - $min_yrn += $za_proc; - } - if($r['type'] < 5){ - //$min_yrn += 50; - }*/ - - //$min_yrn = 33; - - if ($u1['clone'] > 0) { - $min_yrn = 75; - } - - $r['min'] -= floor($r['min'] / 100 * $min_yrn); - $r['max'] -= floor($r['max'] / 100 * $min_yrn); - $r['Kmin'] -= floor($r['Kmin'] / 100 * ($min_yrn)); - $r['Kmax'] -= floor($r['Kmax'] / 100 * ($min_yrn)); - $r['min_'] -= floor($r['min_'] / 100 * $min_yrn); - $r['max_'] -= floor($r['max_'] / 100 * $min_yrn); - $r['Kmin_'] -= floor($r['Kmin_'] / 100 * ($min_yrn)); - $r['Kmax_'] -= floor($r['Kmax_'] / 100 * ($min_yrn)); - - $defd = mysql_fetch_array(mysql_query('SELECT SUM(`vals`) FROM `battle_actions` WHERE `btl` = "' . $this->info['id'] . '" AND `vars` = "use_defteam' . $u2['team'] . '" LIMIT 1')); - if ($defd[0] > 100) { - $defd[0] = 100; - } - $defd = 0 + $defd[0]; - $powd = mysql_fetch_array(mysql_query('SELECT SUM(`vals`) FROM `battle_actions` WHERE `btl` = "' . $this->info['id'] . '" AND `vars` = "use_powteam' . $u1['team'] . '" LIMIT 1')); - if ($powd[0] > 100) { - $powd[0] = 100; - } - $powd = 0 + $powd[0]; - $defd = $defd - $powd; - - $r['min'] -= floor($defd); - $r['max'] -= floor($defd); - $r['Kmin'] -= floor($defd * 2); - $r['Kmax'] -= floor($defd * 2); - $r['min_'] -= floor($defd); - $r['max_'] -= floor($defd); - $r['Kmin_'] -= floor($defd * 2); - $r['Kmax_'] -= floor($defd * 2); - - /* - if($r['type'] == 4) { - $r['Kmin'] -= floor($r['Kmin']/100*10); - $r['Kmax'] -= floor($r['Kmax']/100*10); - $r['Kmin_'] -= floor($r['Kmin_']/100*10); - $r['Kmax_'] -= floor($r['Kmax_']/100*10); - } - */ - - $r['min'] += $st1['maxAtack']; - $r['max'] += $st1['maxAtack']; - $r['Kmin'] += $st1['maxAtack'] * 2; - $r['Kmin'] += $st1['maxAtack'] * 2; - - /*$r['min_'] += $st1['maxAtack']; - $r['max_'] += $st1['maxAtack']; - $r['Kmin_'] += $st1['maxAtack']*2; - $r['Kmin_'] += $st1['maxAtack']*2;*/ - - - /* - if($r['min'] < round($weapom_min/2)) { - $r['min'] = round($weapom_min/2); - } - if($r['max'] < round($weapom_max/2)) { - $r['max'] = round($weapom_max/2); - } - if($r['Kmin'] < round($weapom_min)) { - $r['Kmin'] = round($weapom_min); - } - if($r['Kmax'] < round($weapom_max)) { - $r['Kmax'] = round($weapom_max); - } - if($r['min_'] < round($weapom_min/2)) { - $r['min_'] = round($weapom_min/2); - } - if($r['max_'] < round($weapom_max/2)) { - $r['max_'] = round($weapom_max/2); - } - if($r['Kmin_'] < round($weapom_min)) { - $r['Kmin_'] = round($weapom_min); - } - if($r['Kmax_'] < round($weapom_max)) { - $r['Kmax_'] = round($weapom_max); - } - */ - if ($r['min'] < 1) { - $r['min'] = 1; - } - if ($r['max'] < 1) { - $r['max'] = 1; - } - if ($r['Kmin'] < 2) { - $r['Kmin'] = 2; - } - if ($r['Kmax'] < 2) { - $r['Kmax'] = 2; - } - if ($r['Kmin_'] < 2) { - $r['Kmin_'] = 2; - } - if ($r['Kmin_'] < 2) { - $r['Kmax_'] = 2; - } - - $r['m_k'] = $r['Kmax']; - - return $r; - } - - public $pr_not_use = [], $pr_reset = [], $pr_yrn = false, $prnt = []; - // - // pl - // u1 - // t1 - // 99 = - // u2 - //$this->delPriem($pd[$k2][1][$k],${'p'.$k2},1,${'p'.$k2jn}); - public $del_val = [], $re_pd = []; - - public function delPriem( - $pl, - $u1, - $t = 1, - $u2 = false, - $rznm = ' ', - $k2nm = null, - $yrn = null, - $yrnt = null - ) { - global $u, $priem; - if (isset($pl['priem']['id']) && !isset($this->del_val['eff'][$pl['priem']['id']])) { - if ($pl['x'] > 1) { - $pl['name'] = $pl['name'] . ' x' . $pl['x'] . ''; - } - if ($pl['timeUse'] == 77) { - // - mysql_query('DELETE FROM `eff_users` WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - } - $vLog = 'time1=' . time() . '||s1=' . $u1['sex'] . '||t1=' . $u1['team'] . '||login1=' . $u1['login'] . ''; - if (isset($u2['id'])) { - $vLog .= '||s2=' . $u2['sex'] . '||t2=' . $u2['team'] . '||login2=' . $u2['login'] . ''; - } - $mas1 = [ - 'time' => time(), - 'battle' => $this->info['id'], - 'id_hod' => $this->hodID, - 'text' => '', - 'vars' => $vLog, - 'zona1' => '', - 'zonb1' => '', - 'zona2' => '', - 'zonb2' => '', - 'type' => '1', - ]; - if ($t == 4) { - $mas1['id_hod']++; - $t = 2; - } - if ($t == 1) { - $mas1['id_hod']++; - if ($pl['priem']['file'] != '0') { - if (file_exists('../../_incl_data/class/priems/' . $pl['priem']['file'] . '.php')) { - require('priems/' . $pl['priem']['file'] . '.php'); - } - } elseif ($pl['priem']['file3'] != '0') { - if (file_exists('../../_incl_data/class/priems/' . $pl['priem']['file3'] . '.php')) { - require('priems/' . $pl['priem']['file3'] . '.php'); - } - } else { - $mas1['text'] = '{tm1} {u1} {1x16x0} "' . $pl['name'] . '".'; - $this->del_val['eff'][$pl['priem']['id']] = true; - } - } elseif ($t == 2) { - $mas1['text'] = '{tm1} {u1} "' . $pl['name'] . '".'; - } elseif ($t == 99) { - $mas1['text'] = '{u1} "' . $pl['name'] . '" ' . $rznm . ' .'; - } else { - if ($t == 100) { - $mas1['id_hod']++; - } - $mas1['text'] = '{tm1} "' . $pl['name'] . '" {u1}.'; - } - if ($pl['priem']['id'] != 24) { - $this->add_log($mas1); - } - $this->stats[$this->uids[$pl['uid']]] = $u->getStats($pl['uid'], 0, 0, false, false, true); - } else { - // - } - } - - public function hodUserPriem($pl, $u1, $t = 1, $u2 = false, $rznm = ' ', $k2nm, $yrn, $yrnt) - { - global $u, $priem; - if (isset($pl['priem']['id']) && !isset($this->del_val['eff'][$pl['priem']['id']])) { - if ($yrnt == 1) { - // - $yrn = round($yrn); - } elseif ($yrnt == 6) { - // - $yrn = 0; - } elseif ($yrnt == 9) { - // - $yrn = 0; - } elseif ($yrnt == 3) { - // - - $yrn = round($yrn * 1.95) + ceil($yrn / 125 * $this->stats[$this->uids[$u1['id']]]['m3']); - } elseif ($yrnt == 4) { - // - - $yrn = round($yrn * 0.45) + ceil($yrn / 125 * $this->stats[$this->uids[$u1['id']]]['m3']); - } else { - // - $yrn = 0; - } - - if ($pl['x'] > 1) { - $pl['name'] = $pl['name'] . ' x' . $pl['x'] . ''; - } - $vLog = 'time1=' . time() . '||s1=' . $u1['sex'] . '||t1=' . $u1['team'] . '||login1=' . $u1['login'] . ''; - if (isset($u2['id'])) { - $vLog .= '||s2=' . $u2['sex'] . '||t2=' . $u2['team'] . '||login2=' . $u2['login'] . ''; - } - $mas1 = [ - 'time' => time(), - 'battle' => $this->info['id'], - 'id_hod' => $this->hodID, - 'text' => '', - 'vars' => $vLog, - 'zona1' => '', - 'zonb1' => '', - 'zona2' => '', - 'zonb2' => '', - 'type' => '1', - ]; - if ($t == 4) { - $mas1['id_hod']++; - $t = 2; - } - if ($t == 1) { - $mas1['id_hod']++; - if ($pl['priem']['file'] != '0') { - if (file_exists('../../_incl_data/class/priems/' . $pl['priem']['file'] . '.php')) { - require('priems/' . $pl['priem']['file'] . '.php'); - } - } else { - $mas1['text'] = '{tm1} {u1} {1x16x0} "' . $pl['name'] . '".'; - $this->del_val['eff'][$pl['priem']['id']] = true; - } - } - $this->add_log($mas1); - $this->stats[$this->uids[$pl['uid']]] = $u->getStats($pl['uid'], 0, 0, false, false, true); - } else { - // - } - } - - // - public function aPower($za, $za1, $yrn) - { - $z = 0; - /*$z = ($za+$za1)*0.35; - $z = round($yrn/$z*100);*/ - - $z = (1 - (pow(0.5, (($za + $za1) / 250)))) * 100; - return $z; - } - - // - public function bronGo($min, $max) - { - $v = 0; - //$v = ceil(($min+$max)/2,$max); - $v = ceil($min, $max); - return $v; - } - - // (test) - public function bronGoTest($min, $max) - { - $v = 0; - //$v = ceil(($min+$max)/2,$max); - $v = ceil(round($min, $max)); - return $v; - } - - // - public function lookStats($m) - { - $ist = []; - $di = explode('|', $m); - $i = 0; - $de = false; - while ($i < count($di)) { - $de = explode('=', $di[$i]); - $ist[$de[0]] = $de[1]; - $i++; - } - return $ist; - } - - // - public function mfsgo1($a, $b) - { - $r = $this->form_mf($a, $b); - return $r; - } - - // - public function mfsgo2($a, $b) - { - $r = $this->form_mf($a, $b); - return $r; - } - - // . () - public function form_mf($u, $au) - { - $v = $u * 5.1 - $au * 5.1; - if ($v < 0) { - $v = 0; - } - $r = (1 - (pow(99 / 100, (($v) / 100)))) * 100; - $r = round($r); - return $r; - } - - // () 5 . - public function msf_st2($mf, $lvl1, $lvl2) - { - $r = 0; - - if ($lvl1 > $lvl2) { - $lvl = $lvl1; - } else { - $lvl = $lvl2; - } - - /* - 1-: 0 50 - 0 25% - 2-: 51 151 - 25% 50% - 3-: 151 400 - 50% 75% - 4-: 400 - 75% + 0,01 * ( - 1000) - - 350 50 300 85 - 350 100 250 - 350 150 200 85 - 350 175 175 - 350 200 150 - 350 225 125 - 350 250 100 65 - 50 35 - - - - */ - // - if ($mf < 0) { - $mf = 0; - } - if ($lvl <= 7) { - // 0-7 - if ($mf <= 100) { //0-35 - $prc = $mf; - $r = 35 / 50 * $prc; - } elseif ($mf <= 200) { //35-65 - $prc = $mf - 101; - $r = $prc / 99 * 30; - $r += 35; - } elseif ($mf <= 400) { //65-85 - $prc = $mf - 201; - $r = $prc / 199 * 20; - $r += 65; - } else { //> 75 - $r = 85 + 0.01 * abs(($mf - 1000)); - } - } else { - // - if ($mf <= 100) { //0-45 - $prc = $mf; - $r = 45 / 100 * $prc; - } elseif ($mf <= 300) { //45-65 - $prc = $mf - 101; - $r = $prc / 199 * 20; - $r += 45; - } elseif ($mf <= 450) { //65-75 - $prc = $mf - 301; - $r = $prc / 149 * 10; - $r += 65; - } else { //> 75 - $r = 85; - //$r = 75 + 0.01 * abs(($mf-1000)); - } - } - - if ($r < 0) { - $r = 0; - } - - return $r; - } - - // () - public function msf_st($mf, $lvl1, $lvl2) - { - $r = 0; - - if ($lvl1 > $lvl2) { - $lvl = $lvl1; - } else { - $lvl = $lvl2; - } - - /* - 1-: 0 100 - 0 25% - 2-: 101 400 - 35% 70% - 3-: 401 1000 - 70% 85% - 4-: 1000 - 85% + 0,01 * ( - 1000) - */ - /* . 150 , 350 . - - - 75 750 675 85 - 100 750 650 70 - 150 750 600 - 200 750 550 55 - - 300 750 450 50 - 350 750 400 50 - - 700 , 750 . . - */ - - if ($mf < 0) { - $mf = 0; - } - // - if ($lvl <= 7) { - // 0-7 - if ($mf <= 200) { //0-60 - $prc = $mf; - $r = 60 / 200 * $prc; - } elseif ($mf <= 550) { //60-70 - $prc = $mf - 201; - $r = $prc / 349 * 10; - $r += 60; - } elseif ($mf <= 675) { //70-75 - $prc = $mf - 551; - $r = $prc / 124 * 5; - $r += 70; - } else { //> 85 - $r = 76; - //$r = 85 + 0.01 * abs(($mf-1000)); - } - } else { - // - /* . 150 , 350 . - - - 50 950 1000 85 - 100 950 850 - 150 950 800 - 250 950 700 80 - - 300 950 650 75 - 400 950 550 70 - - - 100 - 50, . . - */ - if ($mf <= 250) { //0-35 - $prc = $mf; - $r = 35 / 250 * $prc; - } elseif ($mf <= 600) { //35-50 - $prc = $mf - 251; - $r = $prc / 349 * 15; - $r += 35; - } elseif ($mf <= 800) { //50-70 - $prc = $mf - 601; - $r = $prc / 199 * 20; - $r += 50; - } else { //> 85 - $r = 75; - //$r = 75 + 0.01 * abs(($mf-1000)); - } - } - - if ($r < 0) { - $r = 0; - } - - - return floor($r * 1.25); - } - - // - public function mfs($type, $mf, $lvl1, $lvl2) - { - $rval = 0; - switch ($type) { - case 1: - - // - - if ($mf['amf'] < 0) { - $mf['amf'] = 0; - } - if ($mf['mf'] < 0) { - $mf['mf'] = 0; - } - if ($mf['mf'] > $mf['smf']) { - $rval = 100 - floor(((($mf['smf']) / ($mf['mf'] + 1)) * 100)); - } else { - $rval = 0; - } - - if ($rval < 1) { - $rval = 0; - } - if ($rval > 75) { - $rval = 75; - } - if ($mf['amf'] >= 1) { - if ($mf['amf'] > 100) { - $mf['amf'] = 100; - } - if (($mf['amf'] * 100) >= mt_rand(1, 10000)) { - $rval = 100; - } - } - - - break; - case 2: - - if ($mf['mf'] < 0) { - $mf['mf'] = 0; - } - if ($mf['amf'] < 0) { - $mf['amf'] = 0; - } - if ($mf['smf'] < 0) { - $mf['smf'] = 0; - } - if ($mf['asmf'] < 0) { - $mf['asmf'] = 0; - } - - if ($mf['mf'] > $mf['smf']) { - $rval = 100 - floor(((($mf['smf']) / ($mf['mf'] + 1)) * 100)); //2.5 - } else { - $rval = 0; - } - if ($rval < 1) { - $rval = 0; - } - if ($rval > 75) { - $rval = 75; - } - if ($mf['asmf'] >= 0) // - { - if ($mf['asmf'] > 100) { - $mf['asmf'] = 100; - } - if ($mf['asmf'] >= rand(1, 100)) { - $rval = 0; - } - } - if ($mf['amf'] >= 0) { - if ($mf['amf'] > 100) { - $mf['amf'] = 100; - } - if ($mf['amf'] >= rand(1, 100)) { - $rval = 100; - } - } - - - break; - case 3: - //$mf[1] -= 4; - //$mf[2] -= 4; - if ($mf[1] < 1) { - $mf[1] = 1; - } - if ($mf[2] < 1) { - $mf[2] = 1; - } - - //$rval = $mf[1] - $mf[2]; // - $rval = $mf[1] - $mf[2] / 2; - if ($rval > 75) { - $rval = 75; - } - //$rval = round($rval/3); - if ($rval < 1) { - $rval = 1; - } - - //$rval = (1-( pow(0.75, ($rval/125) ) ))*100; - - //if( $rval > 60 ) { - // $rval = 60; - //} - - break; - case 4: - $mf = round($mf * 0.6); - if ($mf < 1) { - $mf = 0; - } - if ($mf > 100) { - $mf = 100; - } - //$mf = (1-( pow(0.5, ($mf/200) ) ))*100; - $rval = min($mf, 100); // - break; - case 5: - if ($mf < 1) { - $mf = 0; - } - $rval = min($mf, 85); // - break; - case 6: - // - //$mf['a'] - //$mf['b'] - if ($mf['a'] > 0) { - if ($mf['b'] > 0) { - $rval = round($mf['a'] - ($mf['b'] / 2)); - } else { - $rval = $mf['a']; - } - } else { - $rval = 0; - } - - - if ($rval < 1) { - $rval = 0; - } - if ($rval > 75) { - $rval = 75; - } - - - break; - } - if ($this->get_chanse($rval) == true) { - $rval = 1; - } else { - $rval = 0; - } - return $rval; - } - - public function dodge($a, $b) - { - $i = 0; - $arr = []; // - while ($i < ($b - $a)) { - while (in_array($rand, $arr)) { - $rand = mt_rand(1, 100); - } - $arr[] = $rand; - $i++; - } - - $n = mt_rand(1, 100); - return (!!array_search($n, $arr)); - } - - public function get_chanse($percent) - { - /*$a = 101+$percent; - $b = 100-$percent; - $i = 1; - if(($a-$b)>0){ - while($i<=$a-$b){ - $conp[] = rand(1,100); - //$conp[] = mt_rand(1,100); - if( $i > 100 ) { - $i = ($a-$b+1); - } - $i++; - } - } - $t = count($conp); - $prob = round($percent); - if(@array_search($prob,$conp)!=false){ - $critical = true; - }else{ - $critical = false; - }*/ - /*if( rand(0,100) <= $percent ) { - $critical = true; - }else{ - $critical = false; - }*/ - if ($percent >= 100) { - $percent = 100; - } elseif ($percent == 0) { - $percent = 0; - } - $critical = $this->dodge(1, $percent); - return $critical; - } - - // - public function get_chanse_new($persent) - { - $mm = 1; - if (mt_rand($mm, 100 * $mm) <= $persent * $mm) { - return true; - } else { - return false; - } - } - - // - public function smena($uid, $auto = false, $lastdie = false) - { - global $u; - if (($auto == false && $u->info['smena'] > 0) || $auto == true) { - if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] >= 1) { - if (isset($this->uids[$uid]) && $uid != $u->info['id'] && $this->users[$this->uids[$uid]]['team'] != $this->users[$this->uids[$u->info['id']]]['team']) { - if (!isset($this->ga[$u->info['id']][$uid]) || $lastdie == true) { - if (ceil($this->stats[$this->uids[$uid]]['hpNow']) >= 1) { - // - if ($auto == false) { - $u->info['smena']--; - } - $upd = mysql_query('UPDATE `stats` SET `enemy` = "' . $uid . '",`smena` = "' . $u->info['smena'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - $u->info['enemy'] = $uid; - $this->users[$this->uids[$uid]]['smena'] = $u->info['smena']; - $this->users[$this->uids[$u->info['id']]]['enemy'] = $uid; - return 1; - } else { - return ' , '; - } - } else { - return ' !'; - } - } else { - return ' []'; - } - } else { - return ' , ...'; - } - } else { - return ' '; - } - } - - //- // - public function autoSmena() - { - global $u; - $ms = []; - $ms_all = []; - $ms_ansf = []; - $i = 0; - $j = 0; - $z = 0; - while ($i < count($this->users)) { - if (isset($this->users[$i]) && $this->users[$i]['id'] != $u->info['id'] && $this->users[$i]['team'] != $u->info['team'] && $this->stats[$i]['hpNow'] > 0 && -($u->info['enemy']) != $this->users[$i]['id']) { - if (!isset($this->ga[$u->info['id']][$this->users[$i]['id']])) { - $ms[$j] = $this->users[$i]['id']; - $j++; - } - if (!isset($this->uids[(-($u->info['enemy']))])) { - $ms_all[] = $this->users[$i]['id']; - } - if (isset($this->ga[$this->users[$i]['id']][$u->info['id']])) { - $ms_ansf[$z] = $this->users[$i]['id']; - $z++; - } - } - $i++; - } - $msh = []; - if ($j == 0 && $z == 0) { - $enemydie = 0; - - if (isset($this->stats[$this->uids[$u->info['enemy']]])) { - $u->info['enemy'] = 0; - $enemydie = 1; - } - - if ((!isset($this->uids[(-($u->info['enemy']))]) || $this->stats[$this->uids[(-($u->info['enemy']))]]['hpNow'] < 1) && ($u->info['enemy'] < 0 || $enemydie == 1)) { - $i = 0; - $j = 0; - while ($i < count($this->users)) { - if (isset($this->users[$i]) && $this->users[$i]['id'] != $u->info['id'] && $this->users[$i]['team'] != $u->info['team'] && $this->stats[$i]['hpNow'] >= 1 && -($u->info['enemy']) != $this->users[$i]['id']) { - $ms[$j] = $this->users[$i]['id']; - $msh[$ms[$j]] = true; - $j++; - } - $i++; - } - } - } - - $ms = $ms[rand(0, $j - 1)]; - $ms_ansf = $ms_ansf[rand(0, $z - 1)]; - if ($z > 0) { - $this->smena($ms_ansf, true); - } elseif ($j > 0) { - if (isset($msh[$ms])) { - $this->smena($ms, true, true); - } else { - $this->smena($ms, true); - } - } else { - if ($u->info['enemy'] < 0) { - $smnr5 = $this->smena(-($u->info['enemy']), true); - /*if( $smnr5 != 1 ) { - if( !isset($this->uids[(-($u->info['enemy']))]) ) { - $u->info['enemy'] = $ms_all[rand(0,(count($ms_all)-1))]; - mysql_query('UPDATE `stats` SET `enemy` = "'.$u->info['enemy'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - }*/ - unset($smnr5); - } - } - } - - //- new - /*public function autoSmena() - { - global $u; - $ms = array(); - $ms_all = array(); - $i = 0; $j = 0; - while($iusers)) - { - if(isset($this->users[$i]) && $this->users[$i]['id']!=$u->info['id'] && $this->users[$i]['team']!=$u->info['team'] && $this->stats[$i]['hpNow']>=1 && -($u->info['enemy']) != $this->users[$i]['id']) - { - if(!isset($this->ga[$u->info['id']][$this->users[$i]['id']])) - { - $ms[$j] = $this->users[$i]['id']; - $j++; - } - if( !isset($this->uids[(-($u->info['enemy']))]) ) { - $ms_all[] = $this->users[$i]['id']; - } - } - $i++; - } - - $ms = $ms[rand(0,$j-1)]; - if($j>0) - { - $this->smena($ms,true); - }else{ - if( $u->info['enemy'] < 0 ) { - $smnr5 = $this->smena(-($u->info['enemy']),true); - if( $smnr5 != 1 ) { - //$u->info['enemy'] = -($u->info['enemy']); - //mysql_query('UPDATE `stats` SET `enemy` = "'.$u->info['enemy'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - if( !isset($this->uids[(-($u->info['enemy']))]) ) { - $u->info['enemy'] = $ms_all[rand(0,(count($ms_all)-1))]; - mysql_query('UPDATE `stats` SET `enemy` = "'.$u->info['enemy'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - //echo 'Fatal error: '.$smnr5.' #'.$j.''; - } - unset($smnr5); - //mysql_query('UPDATE `stats` SET `enemy` = "'.$u->info['enemy'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - } - } - }*/ - - // () - public function botAtack($uid, $pl, $tp) - { - /*if (isset($uid['id'])) {$uidt=$uid['id'];} else {$uidt=$uid;} - if (isset($pl['id'])) {$plt=$pl['id'];} else {$plt=$pl;} - $test_uid = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "'.$uidt.'" AND `hpNow` >= 1 LIMIT 1')); - $test_pl = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "'.$plt.'" AND `hpNow` >= 1 LIMIT 1')); - if (isset($test_uid['id']) && isset($test_pl['id']) && $test_uid['id']!=$test_pl['id']) - { - }*/ - $test_atack = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_act` WHERE `battle` = "' . $this->info['id'] . '" AND (( - `uid1` = "' . $pl . '" AND `uid2` = "' . $uid . '" - ) OR ( - `uid2` = "' . $pl . '" AND `uid1` = "' . $uid . '" - )) LIMIT 1')); - - if ($tp == 1 && !isset($test_atack['id'])) { - $test_uid = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $uid . '" AND `hpNow` >= 1 LIMIT 1')); - $test_pl = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $pl . '" AND `hpNow` >= 1 LIMIT 1')); - if (isset($test_uid['id']) && isset($test_pl['id']) && $test_uid['id'] != $test_pl['id']) { - $a = rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5); - $b = rand(1, 5); - $d = mysql_query('INSERT INTO `battle_act` (`battle`,`time`,`uid1`,`uid2`,`a1`,`b1`) VALUES ("' . $this->info['id'] . '","' . time() . '","' . $pl . '","' . $uid . '","' . $a . '","' . $b . '")'); - } - } elseif ($tp == 2) { - // - $test_uid = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $uid . '" AND `hpNow` >= 1 LIMIT 1')); - $test_pl = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $pl['uid2'] . '" AND `hpNow` >= 1 LIMIT 1')); - if (isset($test_uid['id']) && isset($test_pl['id']) && $test_uid['id'] != $test_pl['id']) { - $bot = $this->users[$this->uids[$pl['uid2']]]; - $na = ['id' => 0, 'a' => [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0], 'b' => 0]; - $a222 = rand(1, 5) . '_' . rand(1, 5) . '_' . rand(1, 5) . '_' . rand(1, 5) . '_' . rand(1, 5); - $a = explode('_', $a222); - $i = 1; - $na['id'] = time(); - while ($i <= 5) { - if (isset($a[$i - 1])) { - $a[$i - 1] = intval(round($a[$i - 1])); - if ($a[$i - 1] >= 1 && $a[$i - 1] <= 5) { - $na['a'][$i] = $a[$i - 1]; - } else { - $na['a'][$i] = 0; - } - } - $i++; - } - $na['b'] = rand(1, 5); - // - - $this->atacks[$pl['id']]['a2'] = $a222; - $this->atacks[$pl['id']]['b2'] = $na['b']; - $this->startAtack($pl['id']); - } - } - //unset($test_uid,$test_pl,$test_atack); - } - - // , , , - public function testActions() - { - // - $m = mysql_query('SELECT * FROM `battle_act` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `id` ASC'); - $i = 0; - $botA = []; - $botR = []; - while ($pl = mysql_fetch_array($m)) { - //mysql_query('DELETE FROM `battle_act` WHERE `battle` = "'.$this->info['id'].'" AND `uid1` = "'.$pl['uid2'].'" AND `uid2` = "'.$pl['uid1'].'"'); - $pluids = mysql_fetch_array(mysql_query('SELECT `hpNow` FROM `stats` WHERE (`id` = "' . $pl['uid1'] . '" AND `hpNow` <= 0) OR (`id` = "' . $pl['uid2'] . '" AND `hpNow` <= 0) LIMIT 1')); - - $pltest = mysql_fetch_array(mysql_query('SELECT * FROM `battle_act` WHERE `id` = "' . $pl['id'] . '" LIMIT 1')); - if (isset($pltest['id'])) { - if (isset($pluids['hpNow'])) { - mysql_query('DELETE FROM `battle_act` WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - } elseif ($pl['time'] + $this->info['timeout'] > time()) { - // , - $this->atacks[$pl['id']] = $pl; - $this->ga[$pl['uid1']][$pl['uid2']] = $pl['id']; - $this->ag[$pl['uid2']][$pl['uid1']] = $pl['id']; - if (isset($this->iBots[$pl['uid1']])) { - // - $botA[$pl['uid1']] = $pl['id']; - } elseif (isset($this->iBots[$pl['uid2']])) { - // - $botR[$pl['uid2']] = $pl['id']; - if ($this->users[$this->uids[$pl['uid2']]]['timeGo'] < time()) { - $this->botAtack($pl['uid1'], $pl, 2); - } - } - } else { - // - //mysql_query('UPDATE `battle_act` SET `time`="'.time().'" WHERE `id` = "'.$pl['id'].'" LIMIT 1'); - $pl['time'] = time(); - if ($pl['a1'] == 0 && $pl['a2'] == 0) { - // 1 - $pl['out1'] = time(); - $pl['tout1'] = 1; - // 2 - $pl['out2'] = time(); - $pl['tout2'] = 1; - } elseif ($pl['a1'] == 0) { - // 1 - $pl['out1'] = time(); - $pl['tout1'] = 1; - } elseif ($pl['a2'] == 0) { - // 2 - $pl['out2'] = time(); - $pl['tout2'] = 1; - } - // - if (!isset($pluids['hpNow'])) { - $this->atacks[$pl['id']] = $pl; - $this->startAtack($pl['id']); - mysql_query('DELETE FROM `battle_act` WHERE `id` = "' . $pl['id'] . '"'); - //mysql_query('DELETE FROM `battle_act` WHERE (`uid1` = "'.$pl['uid1'].'" AND `uid2` = "'.$pl['uid2'].'") OR (`uid1` = "'.$pl['uid2'].'" AND `uid2` = "'.$pl['uid1'].'")'); - } - } - } - } - // - if ($this->uAtc['id'] > 0) { - if ($this->na == 1) { - if ($pl['out1'] == 0 && $pl['out2'] == 0) { - // - if ($pl['uid1'] == $u->info['id'] || $pl['uid2'] == $u->info['id']) { - $this->addNewAtack(); - } - } else { - $this->addNewAtack(); - } - } - } - // - - // - - //, - $i = 0; - while ($i < count($this->bots)) { - $bot = $this->bots[$i]; - if (isset($bot) && $this->stats[$this->uids[$bot]]['hpNow'] >= 1 && $this->stats[$this->uids[$bot]]['pass'] != 'saintlucia') // saintlucia - { - //mysql_query('UPDATE `stats` SET `timeGo` = "'.$tnbot.'" WHERE `id` = "'.$this->users[$this->uids[$bot]]['id'].'" LIMIT 1'); - $j = 0; - while ($j < count($this->users)) { - if ($this->info['razdel'] == 0) { - $tnbot = time() + rand(1, 1); - } else { - $tnbot = time() + rand(1, 2); - } - if ($this->users[$j]['timeGo'] >= time() || $this->users[$this->uids[$bot]]['timeGo'] >= time()) { - } elseif ($this->users[$j]['hpNow'] >= 1 && $this->users[$this->uids[$bot]]['hpNow'] >= 1 && $this->users[$this->uids[$bot]]['team'] != $this->users[$j]['team']) { - if (isset($this->users[$j]) && $this->stats[$j]['hpNow'] >= 1 && $this->stats[$this->uids[$bot]]['hpNow'] >= 1 && !isset($this->ga[$bot][$this->users[$j]['id']]) && !isset($this->ag[$bot][$this->users[$j]['id']]) && $this->users[$j]['id'] != $bot && $this->users[$j]['team'] != $this->users[$this->uids[$bot]]['team']) { - if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time()) { - $this->botAtack($this->users[$j]['id'], $bot, 1); - mysql_query('UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this->users[$this->uids[$bot]]['id'] . '" LIMIT 1'); - } - } elseif (isset($this->users[$i]) && $this->users[$i]['bot'] > 0 && $this->stats[$i]['hpNow'] >= 1 && $this->stats[$this->uids[$bot]]['hpNow'] >= 1 && $this->users[$i]['id'] != $bot && $this->users[$i]['team'] != $this->users[$this->uids[$bot]]['team']) { - if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time()) { - if ($this->botAct($bot) == true) { - if (!isset($this->ga[$bot][$this->users[$i]['id']]) && $this->users[$this->uids[$bot]]['timeGo'] < time() && !isset($this->ag[$bot][$this->users[$i]['id']])) { - $this->botAtack($this->users[$i]['id'], $bot, 1); - mysql_query('UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this->users[$this->uids[$bot]]['id'] . '" LIMIT 1'); - } elseif (isset($this->ag[$bot][$this->users[$i]['id']])) { - } elseif (isset($this->ga[$bot][$this->users[$i]['id']]) && $this->users[$this->uids[$bot]]['timeGo'] < time()) { - $this->botAtack($bot, $this->users[$i]['id'], 1); - mysql_query('UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this->users[$this->uids[$bot]]['id'] . '" LIMIT 1'); - } - } - } - } else { - // - // - if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time() && $this->users[$j]['hpNow'] >= 1 && $this->users[$this->uids[$bot]]['hpNow'] >= 1) { - $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['a1'] = rand(1, 5) . '' . rand(1, - 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5); - $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['b1'] = rand(1, 5); - $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['a2'] = rand(1, 5) . '' . rand(1, - 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5); - $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['b2'] = rand(1, 5); - $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['a1'] = rand(1, 5) . '' . rand(1, - 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5); - $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['b1'] = rand(1, 5); - $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['a2'] = rand(1, 5) . '' . rand(1, - 5) . '' . rand(1, 5) . '' . rand(1, 5) . '' . rand(1, 5); - $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['b2'] = rand(1, 5); - if (isset($this->ga[$bot][$this->users[$j]['id']]) && $this->users[$j]['bot'] > 0) { - if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time()) { - $tnbot = time() + rand(3, 7); - if ($this->info['type'] == 329) { // - $tnbot = time() - 1; - } - $this->startAtack($this->ga[$bot][$this->users[$j]['id']]); - $this->users[$this->uids[$bot]]['timeGo'] = $tnbot; - mysql_query('UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this->users[$this->uids[$bot]]['id'] . '" LIMIT 1'); - } - } elseif (isset($this->ag[$bot][$this->users[$j]['id']]) && $this->users[$j]['bot'] > 0) { - if ($this->users[$this->uids[$bot]]['timeGo'] < time() && $this->users[$j]['timeGo'] < time()) { - $this->startAtack($this->ag[$bot][$this->users[$j]['id']]); - $tnbot = time() + rand(3, 7); - if ($this->info['type'] == 329) { // - $tnbot = time() - 1; - } - $this->users[$this->uids[$bot]]['timeGo'] = $tnbot; - mysql_query('UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this->users[$this->uids[$bot]]['id'] . '" LIMIT 1'); - } - } - } - // - } - } - $j++; - } - } - $i++; - } - } - - // - public function botAct($uid) - { - $r = false; - if ($this->users[$this->uids[$uid]]['bot'] > 0) { - if ($this->users[$this->uids[$uid]]['online'] < time() - 3) { - $r = true; - $this->users[$this->uids[$uid]]['online'] = time(); - mysql_query('UPDATE `users` SET `online` = "' . time() . '" WHERE `id` = "' . ((int)$uid) . '" LIMIT 1'); - } else { - if (rand(0, 2) == 1) { - $r = true; - } - } - } - return $r; - } - - // - public function battleInfo($id) - { - $b = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "' . mysql_real_escape_string($id) . '" LIMIT 1')); - if (isset($b['id'])) { - $this->hodID = mysql_fetch_array(mysql_query('SELECT `id_hod` FROM `battle_logs` WHERE `battle` = "' . $b['id'] . '" ORDER BY `id` DESC LIMIT 1')); - if (isset($this->hodID['id_hod'])) { - $this->hodID = $this->hodID['id_hod']; - } else { - $this->hodID = 0; - } - /*if( $this->hodID > $b['hod'] ) { - $b['hod'] = $this->hodID; - mysql_query('UPDATE `battle` SET `hod` = "'.$this->hodID.'" WHERE `id` = "'.$b['id'].'" LIMIT 1'); - }*/ - return $b; - } else { - return false; - } - } - - // - public function addAtack() - { - global $js; - if (isset($_POST['atack'], $_POST['block'])) { - $na = ['id' => 0, 'a' => [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0], 'b' => 0]; - $a = explode('_', $_POST['atack']); - $i = 1; - $na['id'] = time(); - while ($i <= 5) { - if (isset($a[$i - 1])) { - $a[$i - 1] = intval(round($a[$i - 1])); - if ($a[$i - 1] >= 1 && $a[$i - 1] <= 5) { - $na['a'][$i] = $a[$i - 1]; - } else { - $na['a'][$i] = 0; - } - } - $i++; - } - - $na['b'] = intval(round($_POST['block'])); - if ($na['b'] < 1 || $na['b'] > 5) { - $na['b'] = 0; - } - - $this->uAtc = $na; - $js .= 'testClearZone();'; - } else { - $this->e = ' '; - } - } - - // - public function teamsTake() - { - global $u; - $rs = ''; - $ts = []; - $tsi = 0; - if ($this->info['id'] > 0) { - // - $nxtlg = []; - $t = mysql_query('SELECT `u`.`room`,`u`.`no_ip`,`u`.`twink`,`u`.`stopexp`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`bot_id`,`u`.`money3`,`u`.`money2` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $this->info['id'] . '"'); - $i = 0; - $bi = 0; - $up = ''; - if ($this->info['start2'] == 0) { - $tststrt = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `start2` = "0" LIMIT 1')); - if (isset($tststrt['id'])) { - $upd = mysql_query('UPDATE `battle` SET `start2` = "' . time() . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - } else { - $this->info['start2'] = time(); - } - } - while ($pl = mysql_fetch_array($t)) { - // - if ($pl['login2'] == '') { - $pl['login2'] = $pl['login']; - } - $this->users[$i] = $pl; - $this->uids[$pl['id']] = $i; - - if ($this->info['start2'] == 0) { - mysql_query('UPDATE `users` SET `notrhod` = "-1" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - $this->users[$i]['notrhod'] = -1; - } - - if ($pl['bot'] > 0) { - $this->bots[$bi] = $pl['id']; - $this->iBots[$pl['id']] = $bi; - $bi++; - } - // - $this->stats[$i] = $u->getStats($pl, 0, 0, false, $this->cached, true); - // - if ($this->info['start2'] == 0) { - if (!isset($ts[$this->users[$i]['team']])) { - $tsi++; - $ts[$this->users[$i]['team']] = $tsi; - } - - if ($this->users[$i]['level'] <= 7) { - $this->users[$i]['tactic7'] = floor(10 / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); - } elseif ($this->users[$i]['level'] == 8) { - $this->users[$i]['tactic7'] = floor(20 / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); - } elseif ($this->users[$i]['level'] == 9) { - $this->users[$i]['tactic7'] = floor(30 / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); - } elseif ($this->users[$i]['level'] >= 10) { - $this->users[$i]['tactic7'] = floor((40 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); - } - - if ($this->stats[$i]['s7'] > 49) { - mysql_query('UPDATE `eff_users` SET `delete`="' . time() . '" WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `overType` = 101 AND `delete` = 0'); - mysql_query(" - INSERT INTO `eff_users` ( `id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES - ( 22, '" . $this->stats[$i]['id'] . "', '', 'add_spasenie=1', 101, 77, 0, '" . $this->stats[$i]['id'] . "', 0, 'priem', 324, 'preservation.gif', 1, -1, '', 0, 0, '', 0, 0, 0, 1, 0); - "); - } - - - # ) Ost. Costa - #$this->users[$i]['tactic7'] += $this->stats[$i]['s7']; - ##### - // animal_bonus - if ($this->users[$i]['animal'] > 0) { - $a = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `id` = "' . $this->users[$i]['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1')); - if (isset($a['id'])) { - if ($a['eda'] >= 1) { - $anl = mysql_fetch_array(mysql_query('SELECT `bonus` FROM `levels_animal` WHERE `type` = "' . $a['type'] . '" AND `level` = "' . $a['level'] . '" LIMIT 1')); - $anl = $anl['bonus']; - - $tpa = [ - 1 => 'cat', - 2 => 'owl', - 3 => 'wisp', - 4 => 'demon', - 5 => 'dog', - 6 => 'pig', - 7 => 'dragon', - ]; - $tpa2 = [ - 1 => '', - 2 => '', - 3 => '', - 4 => '', - 5 => '', - 6 => '', - 7 => '', - ]; - $tpa3 = [ - 1 => ' ', - 2 => ' ', - 3 => ' ', - 4 => ' ', - 5 => '', - 6 => ' ', - 7 => '', - ]; - - mysql_query('UPDATE `eff_users` SET `delete`="' . time() . '" WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `overType` = 100 AND `delete` = 0'); - - mysql_query('INSERT INTO `eff_users` (`hod`,`v2`,`img2`,`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`v1`,`user_use`) VALUES ("-1","201","summon_pet_' . $tpa[$a['type']] . '.gif",22,"' . $this->users[$i]['id'] . '","' . $tpa3[$a['type']] . ' [' . $a['level'] . ']","' . $anl . '","100","77","priem","' . $this->users[$i]['id'] . '")'); - - // - if ($a['type'] == 7) { - if ($a['level'] == 10) { - $this->users[$i]['tactic7'] = floor((50 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); - } elseif ($a['level'] == 11) { - $this->users[$i]['tactic7'] = floor((65 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); - } elseif ($a['level'] == 12) { - $this->users[$i]['tactic7'] = floor((90 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']); - } - } - // - $anl = $u->lookStats($anl); - - $vLog = 'time1=' . time() . '||s1=' . $this->users[$i]['sex'] . '||t1=' . $this->users[$i]['team'] . '||login1=' . $this->users[$i]['login'] . ''; - $vLog .= '||s2=1||t2=' . $this->users[$i]['team'] . '||login2=' . $a['name'] . ' ( ' . $this->users[$i]['login'] . ')'; - - $mas1 = [ - 'time' => time(), - 'battle' => $this->info['id'], - 'id_hod' => 1, - 'text' => '', - 'vars' => $vLog, - 'zona1' => '', - 'zonb1' => '', - 'zona2' => '', - 'zonb2' => '', - 'type' => '1', - ]; - - $ba = ''; - $i6 = 0; - while ($i6 < count($u->items['add'])) { - if (isset($anl['add_' . $u->items['add'][$i6]])) { - if ($anl['add_' . $u->items['add'][$i6]] > 0) { - if ($u->items['add'][$i6] == 'mib1') { - $ba .= ' : +' . $anl['add_' . $u->items['add'][$i6]] . ', '; - } elseif ($u->items['add'][$i6] == 'mib2') { - $ba .= ' : +' . $anl['add_' . $u->items['add'][$i6]] . ', '; - } elseif ($u->items['add'][$i6] == 'mib3') { - $ba .= ' : +' . $anl['add_' . $u->items['add'][$i6]] . ', '; - } elseif ($u->items['add'][$i6] == 'mib4') { - $ba .= ' : +' . $anl['add_' . $u->items['add'][$i6]] . ', '; - } elseif ($u->items['add'][$i6] == 'mab1' || $u->items['add'][$i6] == 'mab2' || $u->items['add'][$i6] == 'mab3' || $u->items['add'][$i6] == 'mab4') { - } else { - $ba .= $u->is[$u->items['add'][$i6]] . ': +' . $anl['add_' . $u->items['add'][$i6]] . ', '; - } - } - } - $i6++; - } - $ba = trim($ba, ', '); - if ($ba == '') { - $ba = ' '; - } - - $mas1['text'] = '{tm1} {u2} , "' . $tpa3[$a['type']] . ' [' . $a['level'] . ']" {u1}. (' . $ba . ')'; - $nxtlg[count($nxtlg)] = $mas1; - mysql_query('UPDATE `users_animal` SET `eda` = `eda` - 1 WHERE `id` = "' . $a['id'] . '" LIMIT 1'); - //$this->add_log($mas1); - $this->get_comment(); - } else { - //$u->send('',$this->users[$i]['room'],$this->users[$i]['city'],'',$this->users[$i]['login'],''.$a['name'].' ...',time(),6,0,0,0,1); - } - } - } - - mysql_query('UPDATE `stats` SET `last_hp` = "0",`tactic1`="0",`tactic2`="0",`tactic3`="0",`tactic4`="0",`tactic5`="0",`tactic6`="0",`tactic7` = "' . ($this->users[$i]['tactic7']) . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); - - $rs[$this->users[$i]['team']] .= $u->microLogin($this->users[$i], 2) . ', '; - } - $up .= '`uid` = "' . $pl['id'] . '" OR'; - //battle-user (, ) - $mybu = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . mysql_real_escape_string($pl['id']) . '" LIMIT 1')); - if (!isset($mybu['id'])) { - // - $this->addstatuser($pl['id']); - } - $i++; - } - - /* - if($i == 0) { - $t = mysql_query('SELECT `u`.*,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "'.$this->info['id'].'" AND `st`.`hpNow` > 0'); - $i = 0; $bi = 0; $up = ''; - while($pl = mysql_fetch_array($t)) - { - // - if($pl['login2']=='') - { - $pl['login2'] = $pl['login']; - } - $this->users[$i] = $pl; - $this->uids[$pl['id']] = $i; - if($pl['bot']>0) - { - $this->bots[$bi] = $pl['id']; - $this->iBots[$pl['id']] = $bi; - $bi++; - } - // - $this->stats[$i] = $u->getStats($pl,0); - // - if($this->info['start1']==0) - { - if(!isset($ts[$this->users[$i]['team']])) - { - $tsi++; - $ts[$this->users[$i]['team']] = $tsi; - } - - if($this->users[$i]['level']<=7) - { - $this->users[$i]['tactic7'] = floor(10/$this->stats[$i]['hpAll']*$this->stats[$i]['hpNow']); - }elseif($this->users[$i]['level']==8) - { - $this->users[$i]['tactic7'] = floor(20/$this->stats[$i]['hpAll']*$this->stats[$i]['hpNow']); - }elseif($this->users[$i]['level']==9) - { - $this->users[$i]['tactic7'] = floor(30/$this->stats[$i]['hpAll']*$this->stats[$i]['hpNow']); - }elseif($this->users[$i]['level']>=10) - { - $this->users[$i]['tactic7'] = floor(40/$this->stats[$i]['hpAll']*$this->stats[$i]['hpNow']); - } - - $this->users[$i]['tactic7'] += $this->stats[$i]['s7']; - - mysql_query('UPDATE `stats` SET `tactic1`="0",`tactic2`="0",`tactic3`="0",`tactic4`="0",`tactic5`="0",`tactic6`="0",`tactic7`="0",`tactic7` = "'.($this->users[$i]['tactic7']).'" WHERE `id` = "'.$this->users[$i]['id'].'" LIMIT 1'); - - $rs[$tsi] .= $u->microLogin($this->users[$i],2).', '; - } - $up .= '`uid` = "'.$pl['id'].'" OR'; - $i++; - } - } - */ - - $up = rtrim($up, ' OR'); - //mysql_query('UPDATE `eff_users` SET `timeAce` = "0" WHERE ('.$up.') AND `delete` = "0"'); - //echo '


'; - - // - - if ($this->info['start1'] == 0) { - $tststrt = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `start1` = "0" LIMIT 1')); - if (isset($tststrt['id'])) { - $upd = mysql_query('UPDATE `battle` SET `start1` = "' . time() . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1'); - if ($upd) { - $i = 0; - $r = ''; - while ($i <= $tsi) { - if (isset($rs[$i]) && $rs[$i] != '') { - $r .= rtrim($rs[$i], ', ') . ' '; - } - $i++; - } - $r = rtrim($r, ' '); - $r = str_replace('"', '\\\\\"', $r); - $this->hodID++; - $vLog = 'time1=' . time() . '||'; - $mass = [ - 'time' => time(), - 'battle' => $this->info['id'], - 'id_hod' => $this->hodID, - 'text' => 'test', - 'vars' => $vLog, - 'zona1' => '', - 'zonb1' => '', - 'zona2' => '', - 'zonb2' => '', - 'type' => '1', - ]; - $r = ' ' . date('d.m.Y H:i', - $this->info['time_start']) . ', ' . $r . ' .'; - $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $r . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")'); - if (!$ins) { - //echo $r; - } - $this->info['start1'] = time(); - } - } - - // - - if (count($nxtlg) > 0) { - $i = 0; - while ($i < count($nxtlg)) { - $this->add_log($nxtlg[$i]); - $i++; - } - } - // - } - } - } - - // - public function restZonb($uid1, $uid2) - { - if ($this->stnZbVs[$uid1] > 0) { - $this->stats[$this->uids[$uid1]]['zonb'] = $this->stnZbVs[$uid1]; - } - if ($this->stnZbVs[$uid2] > 0) { - $this->stats[$this->uids[$uid1]]['zonb'] = $this->stnZbVs[$uid2]; - } - } - - // () - public function testZonbVis() - { - global $u; - if ($this->stnZbVs == 0) { - $zb = $this->stats[$this->uids[$u->info['id']]]['zonb']; - $this->stnZbVs = $zb; - } else { - $zb = $this->stnZb; - } - $eu = $this->users[$this->uids[$u->info['id']]]['enemy']; - if ($zb > 3) { - $zb = 3; - } - if ($eu != '' && $eu != 0) { - if ($this->stats[$this->uids[$eu]]['weapon1'] == 1 || $this->stats[$this->uids[$eu]]['weapon2'] == 1) { - if ($this->stats[$this->uids[$u->info['id']]]['weapon1'] != 1 && $this->stats[$this->uids[$u->info['id']]]['weapon2'] != 1) { - $zb -= 1; - } - } - } - if ($zb < 1) { - $zb = 1; - } - return $zb; - } - - // - public function testZonb($uid, $uid2) - { - global $u; - $zba = [1 => 0, 2 => 0]; - - $zba[1] = $this->stats[$this->uids[$uid]]['zonb']; - $zba[2] = $this->stats[$this->uids[$uid2]]['zonb']; - - if ($this->stnZb[$uid] == 0) { - $zba[1] = $this->stats[$this->uids[$uid]]['zonb']; - $this->stnZb[$uid] = $zba[1]; - } else { - $zba[1] = $this->stnZb[$uid]; - } - - if ($this->stnZb[$uid2] == 0) { - $zba[2] = $this->stats[$this->uids[$uid2]]['zonb']; - $this->stnZb[$uid] = $zba[2]; - } else { - $zba[2] = $this->stnZb[$uid2]; - } - - if ($zba[1] > 3) { - $zba[1] = 3; - } - if ($zba[2] > 3) { - $zba[2] = 3; - } - - // 1 - if ($this->stats[$this->uids[$uid2]]['weapon1'] == 1 || $this->stats[$this->uids[$uid2]]['weapon2'] == 1) { - if ($this->stats[$this->uids[$uid]]['weapon1'] != 1 && $this->stats[$this->uids[$uid]]['weapon2'] != 1) { - $zba[1] -= 1; - } - } - - // 2 - if ($this->stats[$this->uids[$uid]]['weapon1'] == 1 || $this->stats[$this->uids[$uid]]['weapon2'] == 1) { - if ($this->stats[$this->uids[$uid2]]['weapon1'] != 1 && $this->stats[$this->uids[$uid2]]['weapon2'] != 1) { - $zba[2] -= 1; - } - } - - if ($zba[1] < 1) { - $zba[1] = 1; - } - if ($zba[2] < 1) { - $zba[2] = 1; - } - - $this->stats[$this->uids[$uid]]['zonb'] = $zba[1]; - $this->stats[$this->uids[$uid2]]['zonb'] = $zba[2]; - if ($this->stats[$this->uids[$uid]]['min_zonb'] > 0 && $this->stats[$this->uids[$uid]]['zonb'] < $this->stats[$this->uids[$uid]]['min_zonb']) { - $this->stats[$this->uids[$uid]]['zonb'] = $this->stats[$this->uids[$uid]]['min_zonb']; - } - if ($this->stats[$this->uids[$uid2]]['min_zonb'] > 0 && $this->stats[$this->uids[$uid2]]['zonb'] < $this->stats[$this->uids[$uid2]]['min_zonb']) { - $this->stats[$this->uids[$uid2]]['zonb'] = $this->stats[$this->uids[$uid2]]['min_zonb']; - } - } - - // - public function genTeams($you) - { - global $u; - $ret = ''; - $teams = []; - // - $i = 0; - $j = 1; - $tms = []; - //if( $this->users[$this->uids[$you]]['team'] > 0 && $this->stats[$this->uids[$you]]['hpNow'] > 0 ) { - $teams[$this->users[$this->uids[$you]]['team']] = ''; - $tms[0] = $this->users[$this->uids[$you]]['team']; - //} - while ($i < count($this->uids)) { - if ($this->stats[$i]['hpNow'] > 0) { - if (!isset($teams[$this->users[$i]['team']])) { - $tms[$j] = $this->users[$i]['team']; - $j++; - } - if ($this->stats[$i]['hpNow'] < 0) { - $this->stats[$i]['hpNow'] = 0; - } - if ($this->stats[$i]['hpAll'] < $this->stats[$i]['hpNow']) { - $this->stats[$i]['hpNow'] = $this->stats[$i]['hpAll']; - } - $a1ms = ''; - if (isset($this->ga[$this->users[$i]['id']][$you]) && $this->ga[$this->users[$i]['id']][$you] != false) { - $a1mc = ''; - $ac = mysql_fetch_array(mysql_query('SELECT * FROM `battle_act` WHERE `id` = "' . $this->ga[$this->users[$i]['id']][$you] . '" LIMIT 1')); - if (isset($ac) && $ac['time'] + $this->info['timeout'] - 15 < time()) { - $a1mc = 'color:red;'; - } - $a1ms = 'style=\"text-decoration: underline; ' . $a1mc . '\"'; - } elseif (isset($this->ag[$this->users[$i]['id']][$you]) && $this->ag[$this->users[$i]['id']][$you] != false) { - $a1mc = ''; - $ac = mysql_fetch_array(mysql_query('SELECT * FROM `battle_act` WHERE `id` = "' . $this->ag[$this->users[$i]['id']][$you] . '" LIMIT 1')); - if (isset($ac) && $ac['time'] + $this->info['timeout'] - 15 < time()) { - $a1mc = 'color:green;'; - } - $a1ms = 'style=\"text-decoration: overline; ' . $a1mc . '\"'; - } - if ($this->users[$i]['login2'] == '') { - $this->users[$i]['login2'] = $this->users[$i]['login']; - } - if ($this->users[$i]['align'] == 9) { - $this->stats[$i]['hpNow'] = $this->stats[$i]['hpNow'] / ($this->stats[$i]['hpAll'] / 100); - $this->stats[$i]['hpAll'] = '100%'; - } - $ldr = ''; - if ($this->users[$i]['lider'] == $this->info['id']) { - $ldr = 'users[$i]['team'] . '.gif \>'; - } - $teams[$this->users[$i]['team']] .= ', ' . $ldr . 'users[$i]['team'] . '\" onClick=\"top.chat.addto(\'' . $this->users[$i]['login2'] . '\',\'to\'); return false;\" oncontextmenu=\"top.infoMenu(\'' . $this->users[$i]['login2'] . '\',event,\'main\'); return false;\">' . $this->users[$i]['login2'] . ' [' . floor($this->stats[$i]['hpNow']) . '/' . $this->stats[$i]['hpAll'] . ']'; - } - $i++; - } - - // - $i = 0; - while ($i < count($tms)) { - $teams[$tms[$i]] = ltrim($teams[$tms[$i]], ', '); - if ($teams[$tms[$i]] != '') { - //if($u->info['team'] == $tms[$i]) { - // $teams[$tms[$i]] = ' '.$teams[$tms[$i]]; - //}else{ - $teams[$tms[$i]] = ' ' . $teams[$tms[$i]]; - //} - $ret .= $teams[$tms[$i]]; - if (count($tms) > $i + 1) { - $ret .= '     '; - } - } - $i++; - } - return 'genteam("' . $ret . '");'; - } - - - public function addTravm($uid, $type, $lvl) - { - global $u; - $t = $type; - if ($t == 1) { - $name = ' '; - $stat = rand(1, 3); // - $timeEnd = rand(1, 3);// 1.30 6 - $data = 'add_s' . $stat . '=-' . $lvl; - $img = 'eff_travma1.gif'; - $v1 = 1; - //echo ''.$name.''; - } elseif ($t == 2) { - $name = ' '; - $stat = rand(1, 3); // - $timeEnd = rand(3, 5);// 6 12 - $data = 'add_s' . $stat . '=-' . ($lvl * 2); - $v1 = 2; - $img = 'eff_travma2.gif'; - } elseif ($t == 3) { - $name = ' '; - $stat = rand(1, 3); // - $timeEnd = rand(5, 7);// 12 6 - $data = 'add_s' . $stat . '=-' . ($lvl * 3); - $v1 = 3; - $img = 'eff_travma3.gif'; - } elseif ($t == 4) { - $name = ' '; - $stat = rand(1, 3); // - $timeEnd = 24;// 24 - $data = 'add_s' . $stat . '=-' . ($lvl * 50); - $v1 = 4; - $img = 'eff_travma4.gif'; - } - $timeEnd = $timeEnd * 3600; - // - //$timeEnd = $timeEnd/3600; - // - $ins = mysql_query('INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ("0","' . time() . '","-1","' . $name . '","' . $data . '","' . $uid . '", "4", "' . $img . '","' . $timeEnd . '", "' . $v1 . '")'); - $ins = mysql_query('INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ("0","' . time() . '","-1",": ","add_notravma=1","' . $uid . '", "263", "cure1.gif","21600", "")'); - } - - public function testUserInfoBattle($uid) - { - global $u; - if (!isset($this->uids[$uid])) { - // ( ) - if (!isset($this->uids[$uid])) { - $this->uids[$uid] = count($this->users); - } - $this->users[$this->uids[$uid]] = mysql_fetch_array(mysql_query('SELECT - - `u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`, - `u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money2`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`, - `u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`, - `u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`activ`,`u`.`stopexp`,`u`.`real`, - - `st`.* - - FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = "' . $uid . '" LIMIT 1')); - $this->stats[$this->uids[$uid]] = $u->getStats($this->users[$this->uids[$uid]], 0, 0, false, false, true); - } - } - - ///---- - public function spaCheck($u1) - { - if ($this->stats[$this->uids[$u1]]['hpNow'] < 1) { - mysql_query('DELETE FROM `battle_act` WHERE `uid1` = "' . $u1 . '" OR `uid2` = "' . $u1 . '"'); - if ($this->stats[$this->uids[$u1]]['spasenie'] > 0 && $this->users[$this->uids[$u1]]['tactic7'] >= 25) // - { - // - // - if ($this->stats[$this->uids[$u1]]['s7'] > 49 && $this->stats[$this->uids[$u1]]['s7'] < 75) { - // - mysql_query("INSERT INTO `eff_users` - (`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES - (22, '" . $u1 . "', ' ', 'add_zmproc=75|add_zaproc=75', 0, 77, 0, '" . $u1 . "', 0, 'priem', 141, 'spirit_block25.gif', 1, 1, '0', 0, 0, '', 0, 0, 0, 0, 0);"); - $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll'] * 0.5); - $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll'] * 0.5); - } elseif ($this->stats[$this->uids[$u1]]['s7'] > 74 && $this->stats[$this->uids[$u1]]['s7'] < 100) { - // - mysql_query("INSERT INTO `eff_users` - (`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES - (22, '" . $u1 . "', ' ', 'add_zmproc=100|add_zaproc=100', 0, 77, 0, '" . $u1 . "', 0, 'priem', 358, 'block_absolute.gif', 1, 1, '0', 0, 0, '', 0, 0, 0, 0, 0);"); - $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll'] * 0.75); - $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll'] * 0.75); - } elseif ($this->stats[$this->uids[$u1]]['s7'] > 99) { - // x2 - mysql_query("INSERT INTO `eff_users` - (`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES - (22, '" . $u1 . "', ' ', 'add_zmproc=100|add_zaproc=100', 0, 77, 0, '" . $u1 . "', 0, 'priem', 358, 'wis_white_shield.gif', 1, 2, '0', 0, 0, '', 0, 0, 0, 0, 0);"); - $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll']); - $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll']); - } - - if ($this->stats[$this->uids[$u1]]['hpNow'] < 1) { - $this->stats[$this->uids[$u1]]['hpNow'] = 1; - } - if ($this->stats[$this->uids[$u1]]['mpNow'] < 1) { - $this->stats[$this->uids[$u1]]['mpNow'] = 1; - } - if ($this->stats[$this->uids[$u1]]['hpNow'] > $this->stats[$this->uids[$u1]]['hpAll']) { - $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll']); - } - if ($this->stats[$this->uids[$u1]]['mpNow'] > $this->stats[$this->uids[$u1]]['mpAll']) { - $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll']); - } - - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $u1 . '" AND `id_eff` = 22 AND `v1` = "priem" AND `v2` = 324'); - mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->stats[$this->uids[$u1]]['hpNow'] . '",`mpNow` = "' . $this->stats[$this->uids[$u1]]['mpNow'] . '", `tactic7` = `tactic7` - 25 WHERE `id` = "' . $u1 . '" LIMIT 1'); - $mas['text'] = '{tm1} ' . $this->stats[$this->uids[$u1]]['login'] . ' ...' . $this->stats[$this->uids[$u1]]['login'] . ' . '; - $this->priemAddLog($id, 1, 2, $u->info['id'], $u1, - ' ', - $mas['text'], - ($this->hodID + 0) - ); - // - - - } else { - if (isset($this->stats[$this->uids[$u1]]['login'])) { - mysql_query('UPDATE `stats` SET `hpNow` = "0",`mpNow` = "0" WHERE `id` = "' . $u1 . '" LIMIT 1'); - $this->stats[$this->uids[$u1]]['hpNow'] = 0; - $this->users[$this->uids[$u1]]['hpNow'] = 0; - $mas['text'] = '{tm1} ' . $this->stats[$this->uids[$u1]]['login'] . ' .'; - $this->priemAddLog($id, 1, 2, $u->info['id'], $u1, - ' ', - $mas['text'], - ($this->hodID + 1) - // // - ); - mysql_query('DELETE FROM `battle_act` WHERE `uid1` = "' . $this->stats[$this->uids[$u1]]['id'] . '" OR `uid2` = "' . $this->stats[$this->uids[$u1]]['id'] . '" OR `uid2` = "-' . $this->stats[$this->uids[$u1]]['id'] . '"'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->stats[$this->uids[$u1]]['id'] . '" AND `v1` = "priem" AND `delete` =0'); - // v1 priem - } - } - } - } - // - -} diff --git a/_incl_data/class/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 @@ +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 = '
' . $message . '
'; + $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/FightRequest.php b/_incl_data/class/FightRequest.php deleted file mode 100644 index 1f4a243b..00000000 --- a/_incl_data/class/FightRequest.php +++ /dev/null @@ -1,3203 +0,0 @@ - '', 5 => '']; - private $z2n = [4 => '', 5 => '']; - private $u; - private $zv_see; - public $test_s = ''; - public $error = ''; - - /** - * . - */ - public function __construct() - { - $this->u = User::start(); - unset($_POST['kingfight'], $_POST['nobot'], $_POST['mut_clever']); - - $this->u->info['no_zv_key'] = true; - if (!isset($_GET['del_z_time']) || $_GET['del_z_time'] == null) { - return; - } - $zay = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `id` = "' . $this->u->info['zv'] . '" AND `creator` = "' . $this->u->info['id'] . '" AND `start` = 0 AND `cancel` = 0 AND `btl_id` = 0 ORDER BY `id` DESC LIMIT 1')); - if (!isset($zay['id']) || $zay['priz'] != 0) { - return; - } - $colls = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $zay['id'] . '"')); - $cs = $colls[0]; - if ($this->u->info['zv'] != $zay['id'] || $zay['creator'] != $this->u->info['id']) { - $this->test_s = ' , .'; - } elseif ($cs != 1) { - $this->test_s = '- .'; - } else { - mysql_query('UPDATE `stats` SET `zv` = 0 WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `zayvki` WHERE `id` = "' . $zay['id'] . '" LIMIT 1'); - $this->test_s = ' ...'; - } - - $this->test(); // - } - - private 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; - } - - private function testTravm() - { - $tr_pl = mysql_fetch_array(mysql_query('SELECT `id`,`v1` FROM `eff_users` WHERE `id_eff` = 4 AND `uid` = "' . $this->u->info['id'] . '" AND `delete` = "0" ORDER BY `v1` DESC LIMIT 1')); - return isset($tr_pl['id']) ? $tr_pl['v1'] - 1 : 0; - } - - private function testTurnir() - { - // - $sp = mysql_query('SELECT * FROM `turnirs` WHERE `status` != "-1"'); - while ($pl = mysql_fetch_array($sp)) { - - // - 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 = ': 5 . '; - 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 = ': 10 . '; - 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 = ': 15 . '; - 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'] . '"'); - } - } - } - } - - private function testGroupAndChaotic() - { - // - $sp = mysql_query('SELECT * FROM `zayvki` AS `z` WHERE `z`.`btl_id` = "0" AND `z`.`cancel` = "0" AND `z`.`start` = "0" AND (`z`.`razdel` = 4 OR `z`.`razdel` = 5) ORDER BY `z`.`id` DESC LIMIT 22'); - while ($pl = mysql_fetch_array($sp)) { - $uz = mysql_query('SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $pl['id'] . '"'); - $tm1 = []; - $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 .= '' . $this->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); - } - } - } - } - } - - /** - * @return void - */ - private function test() - { - if ($this->u->info['zv'] > 0) { - $test_zv = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `id` = "' . $this->u->info['zv'] . '" LIMIT 1')); - if (!isset($test_zv['id'])) { - $this->u->info['zv'] = 0; - } else { - if ($test_zv['cancel'] > 0 || $test_zv['btl_id'] > 0) { - $this->u->info['zv'] = 0; - } - if ($test_zv['time'] < time() - 3600) { - $this->u->info['zv'] = 0; - } - } - if ($this->u->info['zv'] == 0) { - mysql_query('UPDATE `stats` SET `zv` = 0 WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); - } - } - - $this->testTurnir(); - $this->testGroupAndChaotic(); - - } - - private function testCronTurnir() - { - // - $sp = mysql_query('SELECT * FROM `turnirs` WHERE `status` != "-1"'); - while ($pl = mysql_fetch_array($sp)) { - // - if ($pl['status'] != 0 || $pl['time'] >= time()) { - continue; - } - if ($pl['users_in'] > 1) { - // - mysql_query('UPDATE `turnirs` SET `time` = "' . (time() + $pl['time3']) . '",`status` = "1" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - $usp = mysql_query('SELECT * FROM `users` WHERE `inTurnirnew` = "' . $pl['id'] . '" LIMIT ' . $pl['users_in']); - while ($ur = mysql_fetch_array($usp)) { - mysql_query('INSERT INTO `users` (`login`,`room`,`name`,`sex`,`level`,`inTurnirnew`,`bithday`,`activ`) VALUES ("' . $ur['login'] . '","318","' . $ur['name'] . '","' . $ur['sex'] . '","' . $t['level'] . '","' . $pl['id'] . '","01.01.2001","0")'); - $uri = mysql_insert_id(); - mysql_query('INSERT INTO `users_turnirs` (`uid`,`bot`,`turnir`) VALUES ("' . $ur['id'] . '","' . $uri . '","' . $pl['id'] . '")'); - $zid = 0; - $x1 = 0; - $y1 = 0; - mysql_query('INSERT INTO `stats` (`upLevel`,`dnow`,`id`,`stats`,`exp`,`ability`,`skills`,`x`,`y`) VALUES ("98","' . $zid . '","' . $uri . '","s1=3|s2=3|s3=3|s4=3|s5=0|s6=0|rinv=40|m9=5|m6=10","0","0","0",' . $x1 . ',' . $y1 . ')'); - mysql_query('UPDATE `users` SET `inUser` = "' . $uri . '" WHERE `id` = "' . $ur['id'] . '" LIMIT 1'); - // - } - } else { - // - mysql_query('UPDATE `turnirs` SET `time` = "' . (time() + $pl['time2']) . '",`users_in` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - mysql_query('UPDATE `users` SET `inTurnirnew` = "0" WHERE `inTurnirnew` = "' . $pl['id'] . '"'); - } - - } - } - - private function testCronGroupAndChaotic() - { - // - $sp = mysql_query('SELECT * FROM `zayvki` AS `z` WHERE `z`.`btl_id` = "0" AND `z`.`cancel` = "0" AND `z`.`start` = "0" AND (`z`.`razdel` = 4 OR `z`.`razdel` = 5) ORDER BY `z`.`id` DESC LIMIT 1000'); - while ($pl = mysql_fetch_array($sp)) { - $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'])) { - continue; - } - $toChat = rtrim($toChat, ','); - $toWhere = ltrim($toWhere, 'OR '); - if ($pl['razdel'] == 4) { - // - if (!isset($i[1]) || !isset($i[2])) { - // - $this->cancelGroup($pl, $toChat); - } else { - // - $this->startBattle($pl['id'], $toChat . '|-|' . $toWhere); - } - } elseif ($pl['razdel'] == 5) { - // - $i = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $pl['id'] . '" LIMIT 1')); - if ($i[0] < 4 && ($pl['fastfight'] == 0 || $i[0] < 2)) { - $rcf = mysql_fetch_array(mysql_query('SELECT `id`,`btl_cof` FROM `stats` WHERE `zv` = "' . $pl['id'] . '" ORDER BY `btl_cof` DESC LIMIT 1')); - $rcf = $rcf['btl_cof']; - // - // - $lvl_btl_exp = [ - 0 => 0, - 1 => 110, - 2 => 420, - 3 => 1300, - 4 => 2500, - 5 => 5000, - 6 => 12500, - 7 => 30000, - 8 => 300000, - 9 => 3000000, - 10 => 10000000, - 11 => 52000000, - 12 => 63000000, - 13 => 182000000, - 14 => 212000000, - 15 => 352000000, - 16 => 504000000, - 17 => 1187000000, - 18 => 2455000000, - 19 => 4387000000, - 20 => 6355000000, - 21 => 15500000000, - 22 => 755500000000 - ]; - $bot_users = []; - - if ($pl['min_lvl_1'] <= 8 && $pl['max_lvl_1'] <= 8 && $pl['nobot'] == 0) { - $bsp = mysql_query('SELECT - `u`.`id`, - `u`.`login`, - `u`.`level`, - `s`.`stats`, - `u`.`cityreg`, - `u`.`sex`, - `u`.`obraz`, - `s`.`upLevel`, - `s`.`priems`, - `s`.`btl_cof` - FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `s`.`exp` >= ' . $lvl_btl_exp[$pl['min_lvl_1']] . ' AND `s`.`exp` < ' . $lvl_btl_exp[$pl['max_lvl_1'] + 1] . ' AND `s`.`bot` = "0" ORDER BY `s`.`btl_cof` DESC LIMIT 50'); - while ($bpl = mysql_fetch_array($bsp)) { - $bot_users[] = $bpl; - } - } - - $mincs = 4; - if ($pl['fastfight'] > 0) { - $mincs = 2; - } - - if (empty($bot_users)) { - if ($pl['fastfight'] == 0 || $i[0] < 2) { - $text = ' : . (' . $pl['id'] . ': ' . count($bot_users) . ' ' . $lvl_btl_exp[$pl['min_lvl_1']] . '-' . $lvl_btl_exp[$pl['max_lvl_1'] + 1] . ')'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $zv['city'] . "','','','LEL','" . $text . "','" . time() . "','6','0')"); - $this->cancelGroup($pl, $toChat); - } - } else { - $j = 0; - $k = 0; - while ($j < $mincs - $i[0]) { - $botlg = $bot_users[rand(0, count($bot_users) - 1)]; - $j++; - $clone = [ - 'id' => $botlg['id'], - 'login' => ' ( ' . $j . ')', - 'level' => $botlg['level'], - 'city' => $pl['city'], - 'cityreg' => $pl['city'], - 'name' => '', - 'sex' => $botlg['sex'], - 'deviz' => '', - 'hobby' => '', - 'time_reg' => time(), - 'obraz' => $botlg['obraz'], - 'stats' => $botlg['stats'], - 'upLevel' => $botlg['upLevel'], - 'priems' => $botlg['priems'], - 'loclon' => true - ]; - $bot = $this->u->addNewbot(1, null, $clone, null, true); - if ($bot > 0) { - mysql_query('UPDATE `stats` SET `btl_cof` = "' . $botlg['btl_cof'] . '",`zv` = "' . $pl['id'] . '",`hpNow` = 100000,`mpNow` = 100000 WHERE `id` = ' . $bot . ' LIMIT 1'); - mysql_query('UPDATE `users` SET `room` = 303,`battle` = 0 WHERE `id` = ' . $bot . ' LIMIT 1'); - $k++; - } - } - unset($bot_users, $bpl, $bsp, $bot); - if ($k + $i[0] >= 4 || ($pl['fastfight'] == 0 || $k + $i[0] >= 2)) { - $back_test = true; - } - } - } else { - // - $this->startBattle($pl['id'], $toChat . '|-|' . $toWhere); - } - } - } - return isset($back_test)? $back_test : false; - } - public function testCronZv() - { - $this->testCronTurnir(); - $back_test = $this->testCronGroupAndChaotic(); - - if ($back_test) { - $this->testCronZv(); - } - - } - - public function userInfo() - { - $r = ''; - if ($this->u->stats['mpAll'] > 0) { - $pm = $this->u->stats['mpNow'] / $this->u->stats['mpAll'] * 100; - } - $ph = $this->u->stats['hpNow'] / $this->u->stats['hpAll'] * 100; - $dp = ''; - if ($this->u->stats['mpAll'] <= 0) { - $dp = 'margin-top:13px;'; - } - $r .= ' - -
  ' . $this->u->microLogin($this->u->info['id'], 1) . '   -
' . floor($this->u->stats['hpNow']) . '/' . $this->u->stats['hpAll'] . '
-
-
-
-'; - - if ($this->u->stats['mpAll'] > 0) { - $r .= '
' . floor($this->u->stats['mpNow']) . '/' . $this->u->stats['mpAll'] . '
-
-
-
'; - } - $r .= '
'; - unset($stt, $ph, $pm); - return $r; - } - - public function cancelGroup($zv, $uids) - { - 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) { - return; - } - $upd = mysql_query('UPDATE `zayvki` SET `cancel` = "' . time() . '" WHERE `id` = "' . $zv['id'] . '"'); - if (!$upd || $uids == '') { - return; - } - if ($zv['priz'] > 0) { - while ($pl = mysql_fetch_array($sp)) { - // 1 - if ($zv['type'] == 33) // - { - $pld = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `inUser` = "' . $pl['id'] . '"')); - if (isset($pld['id'])) { - mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `id` = "' . $pld['id'] . '" LIMIT 1'); - $this->u->addItem(4754, $pld['id'], ''); - $uids = $pld['id']; - mysql_query('DELETE FROM `users` WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `stats` WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $pl['id'] . '" LIMIT 100'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $pl['id'] . '" LIMIT 100'); - } - } else { - $this->u->addItem(4754, $pl['id'], ''); - } - } - $text = ' : . (1)'; - } else { - $text = ' : .'; - } - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $zv['city'] . "','','','" . $uids . "','" . $text . "','" . time() . "','6','0')"); - } - - public function add() - { - if (isset($_GET['r']) && $this->u->info['inTurnirnew'] == 0) { - $r = round(intval($_GET['r'])); - if (in_array($r, [1, 4, 5, 8, 10])) { - $az = 1; - if ($r == 1 && $this->u->info['level'] > 0) { - $az = 0; - $this->error = ' ;)'; - } - if (($r == 4 || $r == 5) && $this->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 ($this->u->info['hpNow'] < $this->u->stats['hpAll'] / 100 * 30 && ($r >= 1 || $r <= 3)) { - $this->error = ' '; - $az = 0; - } - if ($this->u->info['zv'] > 0) { - $az = 0; - $this->error = ' .'; - } - if ($az == 1) { - $nz = []; - $nz['city'] = $this->u->info['city']; - $nz['creator'] = $this->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 && $this->u->info['level'] > 1) { - // - if ($_POST['startime2']) { - $nz['time_start'] = (int)$_POST['startime2']; - $nz['comment'] = substr($_POST['cmt'], 0, 40); - $nz['comment'] = str_replace('"', '"', $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'] = $this->u->info['level']; - $nz['max_lvl_1'] = $this->u->info['level']; - $nz['min_lvl_2'] = $nz['min_lvl_1']; - $nz['max_lvl_2'] = $nz['min_lvl_2']; - } elseif ($lvl == 6) { - $nz['min_lvl_1'] = $this->u->info['level'] - 1; - $nz['max_lvl_2'] = $this->u->info['level'] + 1; - } else { - $nz['min_lvl_1'] = 2; - $nz['max_lvl_1'] = 2; - } - - 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'] = $this->u->stats['reting']; - - if (!$this->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 = '- ...
'; - } - } elseif ($r == 4 && $this->u->info['level'] > 1) { - // - // - if ($_POST['startime']) { - $nz['time_start'] = (int)$_POST['startime']; - $nz['comment'] = substr($_POST['cmt'], 0, 40); - $nz['comment'] = str_replace('"', '"', $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 .= ' -
'; - $gad = 0; - } - - $nz['tm2max'] = (int)$_POST['nlogin2']; - if ($nz['tm2max'] < 1 || $nz['tm2max'] > 99) { - $this->error .= ' -
'; - $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
'; - $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'] = $this->u->info['level']; - } elseif ($lvl == 2) { - $nz['min_lvl_1'] = 2; - $nz['max_lvl_1'] = $this->u->info['level'] - 1; - } elseif ($lvl == 3) { - $nz['min_lvl_1'] = $this->u->info['level']; - $nz['max_lvl_1'] = $this->u->info['level']; - } elseif ($lvl == 4) { - $nz['min_lvl_1'] = $this->u->info['level']; - $nz['max_lvl_1'] = $this->u->info['level'] + 1; - } elseif ($lvl == 5) { - $nz['min_lvl_1'] = $this->u->info['level'] - 1; - $nz['max_lvl_1'] = $this->u->info['level']; - } elseif ($lvl == 6) { - $nz['min_lvl_1'] = $this->u->info['level'] - 1; - $nz['max_lvl_1'] = $this->u->info['level'] + 1; - $nz['min_lvl_1'] = 99; - } else { - $this->error = '- ...
'; - $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'] = $this->u->info['level']; - } elseif ($lvl == 2) { - $nz['min_lvl_2'] = 2; - $nz['max_lvl_2'] = $this->u->info['level'] - 1; - } elseif ($lvl == 3) { - $nz['min_lvl_2'] = $this->u->info['level']; - $nz['max_lvl_2'] = $this->u->info['level']; - } elseif ($lvl == 4) { - $nz['min_lvl_2'] = $this->u->info['level']; - $nz['max_lvl_2'] = $this->u->info['level'] + 1; - } elseif ($lvl == 5) { - $nz['min_lvl_2'] = $this->u->info['level'] - 1; - $nz['max_lvl_2'] = $this->u->info['level']; - } elseif ($lvl == 6) { - $nz['min_lvl_2'] = $this->u->info['level'] - 1; - $nz['max_lvl_2'] = $this->u->info['level'] + 1; - $nz['min_lvl_2'] = 99; - } else { - $this->error = '- ...
'; - $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 = '- ...
'; - } - } - - $bt2 = (int)$_POST['bots2']; - if ($bt2 != 0 && $r == 4 && $this->u->info['level'] > 1) { - $bt2 = 1; - $nz['min_lvl_2'] = $this->u->info['level']; - $nz['max_lvl_2'] = $this->u->info['level']; - $nz['min_lvl_1'] = $this->u->info['level']; - $nz['max_lvl_1'] = $this->u->info['level']; - } else { - $bt2 = 0; - } - - 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($this->u->info['align']) == 3) { - $nz['align1'] = 3; - $nz['align2'] = 1; - $nz['align3'] = 7; - } elseif (floor($this->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`="' . $this->u->info['id'] . '" LIMIT 1'); - $this->u->info['zv'] = $zid; - $this->error = ' '; - } else { - $this->error = ' ...' . $ins; - } - } - } - } - } - } - - // - public function addBot() - { - global $c; - - if (($this->u->info['level'] <= $c['bot_level'] || $this->u->info['admin'] > 0) && $this->u->info['exp'] != 12499) { - $bot = $this->u->addNewbot($id['id'], null, $this->u->info['id'], null, true); - } else { - $bot = false; - } - if (!$bot) { - $this->error = ' , , 8 ...
, - ...
'; - } elseif ($this->u->info['hpNow'] < $this->u->stats['hpAll'] / 100 * 30 && ($r == 1)) { - $this->error = ' '; - $az = 0; - } elseif ($this->u->info['align'] == 2) { - $this->error = ' '; - $az = 0; - } elseif (!$bot) { - echo '
Cannot start battle (no prototype "ND0Clone")
'; - } 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", - "' . $this->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(); - // - $this->u->info['enNow'] -= $trEn; - $upd2 = mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $this->u->info['id'] . '" OR `id` = "' . $bot . '" LIMIT 2'); - mysql_query('UPDATE `stats` SET `team`="1",`enNow` = "' . $this->u->info['enNow'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->u->stats['hpAll'] . '",`team`="2" WHERE `id` = "' . $bot . '" LIMIT 1'); - // , - $this->u->info['battle'] = $btl_id; - // - mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $this->u->info['city'] . "','" . $this->u->info['room'] . "','" . $this->u->info['login'] . "','" . time() . "','11','0','117')"); - die(''); - } else { - $this->error = 'Cannot start battle (no prototype "ABD0Clone")'; - } - } - } - - // - public function addBotClone($uid) - { - if ($this->u->info['online'] > 0) { - $bot = $this->u->addNewbot($id['id'], null, $uid, null, false); - } else { - $bot = false; - } - if (!$bot) { - $this->error = ' '; - } elseif ($this->u->info['hpNow'] < $this->u->stats['hpAll'] / 100 * 30 && ($r >= 1 || $r <= 3)) { - $this->error = ' '; - $az = 0; - } elseif ($this->u->info['align'] == 2) { - $this->error = ' '; - $az = 0; - } elseif (!$bot) { - echo '
Cannot start battle (no prototype "ND0Clone")
'; - } 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", - "' . $this->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(); - // - $this->u->info['enNow'] -= $trEn; - $upd2 = mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $this->u->info['id'] . '" OR `id` = "' . $bot . '" LIMIT 2'); - mysql_query('UPDATE `stats` SET `team`="1",`enNow` = "' . $this->u->info['enNow'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot . '" LIMIT 1'); - // , - if ($btl['type'] == 1) { - mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $this->u->info['id'] . '" AND `inOdet`!=0'); - mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $bot . '" AND `inOdet`!=0'); - } - - // , - $this->u->info['battle'] = $btl_id; - // - mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $this->u->info['city'] . "','" . $this->u->info['room'] . "','" . $this->u->info['login'] . "','" . time() . "','11','0','117')"); - die(''); - } else { - $this->error = 'Cannot start battle (no prototype "ABD0Clone")'; - } - } - } - - // - public function startIzlom($id2, $lvl) - { - $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` <= "' . $this->u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); - $logins_bot = []; - $bot = $this->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'] . '", - "' . $this->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` = "' . $this->u->info['id'] . '" OR `id` = "' . $bot['id'] . '" LIMIT 2'); - mysql_query('UPDATE `stats` SET `team`="1" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - - // , - $this->u->info['battle'] = $btl_id; - - // 2 - $id2 = rand(0, (count($bots) - 1)); - $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $this->u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); - $bot = $this->u->addNewbot($id['id'], null, null, $logins_bot, null); - if (isset($id['id']) && $bot) { - $logins_bot = $bot['logins_bot']; - mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - } - $id2 = rand(0, (count($bots) - 1)); - $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $this->u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1')); - $bot = $this->u->addNewbot($id['id'], null, null, $logins_bot, null); - if (isset($id['id']) && $bot) { - $logins_bot = $bot['logins_bot']; - mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1'); - } - - // - mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $this->u->info['city'] . "','" . $this->u->info['room'] . "','" . $this->u->info['login'] . "','" . time() . "','11','0','117')"); - die(''); - } else { - $this->error = 'Cannot start battle (no prototype "ABD0' . $id['id'] . '")'; - } - } else { - echo '
Cannot start battle (no prototype "ND0IZ' . $lvl . '")
'; - } - } - - public function startBattle($id, $vars = null) - { - $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'); - $this->u->info['battle'] = $btl_id; - // - mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $this->u->info['city'] . "','-1','" . $vars[0] . "','" . time() . "','11','0','117')"); - - } - } elseif ($z['razdel'] >= 1 && $z['razdel'] <= 3) { - // PvP - if ($this->u->info['team'] == 1 && $this->u->info['zv'] == $z['id']) { - $zu = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `zv`="' . $z['id'] . '" AND `team` = "2" LIMIT 1')); - if (isset($zu['id'])) { - $uz = mysql_fetch_array(mysql_query('SELECT `login`,`money` FROM `users` WHERE `id`="' . $zu['id'] . '" LIMIT 1')); - if ($zu['clone'] > 0) { - // - $bot = $this->u->addNewbot(1, null, $zu['clone'], null, true); - if ($bot > 0) { - mysql_query('DELETE FROM `users` WHERE `id` = "' . $zu['id'] . '" LIMIT 1'); - mysql_query('DELETE FROM `stats` WHERE `id` = "' . $zu['id'] . '" LIMIT 1'); - 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'] || $this->u->info['money'] < $z['money']) { - $z['money'] = 0; - } - $btl = ['otmorozok' => $z['otmorozok'], 'players' => '', 'timeout' => $z['timeout'], 'type' => $z['type'], 'travmChance' => $z['travmChance'], 'invis' => 0, 'noinc' => 0, 'typeBattle' => 0, 'addExp' => 0, 'money' => round($z['money'], 2), 'money3' => 0]; - $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']) . '", - "' . $this->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` = "' . $this->u->info['id'] . '" OR `id` = "' . $zu['id'] . '" LIMIT 2'); - - // , - if ($z['type'] == 1) { - mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $this->u->info['id'] . '" AND `inOdet`!=0'); - mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $zu['id'] . '" AND `inOdet`!=0'); - } - - // , - $upd = mysql_query('UPDATE `zayvki` SET `start` = "' . time() . '",`btl_id` = "' . $btl_id . '" WHERE `id` = "' . $z['id'] . '" LIMIT 1'); - - $this->u->info['battle'] = $btl_id; - - // - mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $this->u->info['city'] . "','" . $this->u->info['room'] . "','" . $uz['login'] . "','" . time() . "','11','0','117')"); - die(''); - } else { - $this->error = ' .'; - } - } else { - $this->error = ' , .'; - } - } else { - $this->error = ' .'; - } - } - } - mysql_query('UNLOCK TABLES'); - mysql_query('COMMIT'); - } - - public function cancelzv() - { - global $zi; - if (isset($_GET['cancelzv'], $zi['id']) && $zi['razdel'] >= 1 && $zi['razdel'] <= 3) { - $enemy = mysql_fetch_array(mysql_query('SELECT `u`.*,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zi['id'] . '" AND `st`.`team` = "2" LIMIT 1')); - if (isset($enemy['id'])) { - if ($this->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 ($this->u->info['sex'] == 2) { - $sa = ''; - } - $text = ' [login:' . $this->u->info['login'] . '] ' . $sa . ' .'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $enemy['city'] . "','','','" . $enemy['login'] . "','" . $text . "','" . time() . "','6','0')"); - } - } elseif ($this->u->info['id'] == $enemy['id'] && $zi['start'] == 0) { - // + - $upd = mysql_query('UPDATE `stats` SET `zv` = "0",`team`="0" WHERE `id` = "' . $enemy['id'] . '" LIMIT 1'); - if ($upd) { - $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 ($this->u->info['sex'] == 2) { - $sa = ''; - } - $text = ' [login:' . $this->u->info['login'] . '] ' . $sa . ' .'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $uz['city'] . "','','','" . $uz['login'] . "','" . $text . "','" . time() . "','6','0')"); - } - $this->u->info['zv'] = 0; - $this->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 ($this->u->info['team'] == 1) { - // - $upd = mysql_query('UPDATE `zayvki` SET `cancel` = "' . time() . '" WHERE `id` = "' . $zi['id'] . '" LIMIT 1'); - if ($upd) { - mysql_query('UPDATE `stats` SET `zv` = "0" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); - $this->error = ' '; - $zi = false; - $this->u->info['zv'] = 0; - } - } - } - } - } - - public function see() - { - global $c, $code, $zi; - if (isset($_GET['r']) && ((!isset($_GET['new_group']) && !isset($_POST['groupClick'])) || isset($zi['id']))) { - $r = round(intval($_GET['r'])); - if (in_array($r, [1, 4, 5, 8, 10])) { - $this->zv_see = 1; - if ($this->u->room['FR'] == 0 && $this->u->room['zvsee'] == 0) { - echo '


'; - $this->zv_see = 0; - } elseif ($r == 1 && $this->u->info['level'] > 0) { - echo '


;)
'; - $this->zv_see = 0; - } elseif ($r > 1 && $r < 6 && $this->u->info['level'] < 1) { - echo '


;)
'; - $this->zv_see = 0; - } elseif ($r > 3 && $r < 6 && $this->u->info['level'] < 2) { - echo '


' . $this->z1n[$r] . ' .
'; - $this->zv_see = 0; - } elseif ($r == 1 && $this->u->info['level'] > 0) { - echo '


;)
'; - $this->zv_see = 0; - } elseif ($r == 8 && $this->u->info['level'] < 1) { - echo '


.
'; - $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($this->u->info['id']); - } - } - ## - # . - $db = new \Insallah\Db(); - $tournamentsList = $db::getRows('select * from tournaments'); - $tournaments = ''; - ?> -
- ! -
    -
  • , - !
  • - u->info['id'])): ?> -
  • , u->info['level']) ?> .
  • - - u->info['exp'] < \Insallah\Tournament::MIN_EXP): ?> -
  • .
  • - -
  • , .
  • -
  • 1, 2 3 25, 15, 5 , 12 , 6 3 !
  • -
-
- -
- .
- -
- - u->info['id']) || !\Insallah\TournamentModel::isStarted($this->u->info['level'])): ?> -
- - -
- - . - - -
- ! -
- u->info['zv'] > 0 && $this->u->info['battle'] == 0 && $r != 8) { - if ($zi['razdel'] == 1 || $zi['razdel'] == 2 || $zi['razdel'] == 3) { - echo ' - - -
'; - - if ($this->u->info['team'] == 1) { - $uz = mysql_fetch_array(mysql_query('SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zi['id'] . '" AND `st`.`team`="2" LIMIT 1')); - if (!isset($uz['id'])) { - // - echo '
'; - } else { - // - - $sa = ''; - if ($uz['sex'] == 2) { - $sa = ''; - } - echo ' ' . $sa . ' ' . $ca . ' ' . $this->u->microLogin($uz['id'], 1) . ' ? '; - } - } else { - $uz = mysql_fetch_array(mysql_query('SELECT `u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zi['id'] . '" AND `st`.`team`="1" LIMIT 1')); - if (isset($uz['id'])) { - echo ' ' . $this->u->microLogin($uz['id'], 1) . ' '; - } - } - echo '
'; - } else { - $tm_start = floor(($zi['time'] + $zi['time_start'] - time()) / 6) / 10; - $tm_start = $this->rzv($tm_start); - echo ' ' . $this->z2n[$zi['razdel']] . ' '; - echo '
' . $tm_start . ' .'; - } - } elseif ($r == 8) { - // - - $ttur = [ - 0 => ' !', - 1 => ' !', - 2 => ' !' - ]; - - if (isset($_POST['trn1']) && $this->u->room['zvsee'] == 0) { - if ($this->u->info['inTurnirnew'] == 0) { - $totr = mysql_fetch_array(mysql_query('SELECT * FROM `turnirs` WHERE `id` = "' . mysql_real_escape_string($_POST['trn1']) . '" AND `status` = "0" LIMIT 1')); - if (isset($totr['id'])) { - mysql_query('UPDATE `users` SET `inTurnirnew` = "' . $totr['id'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); - mysql_query('UPDATE `turnirs` SET `users_in` = `users_in` + 1 WHERE `id` = "' . $totr['id'] . '" LIMIT 1'); - $this->u->info['inTurnirnew'] = $totr['id']; - $this->error = ' .'; - } else { - $this->error = ' .'; - } - } else { - $this->error = ' .'; - } - } elseif (isset($_GET['cancel13']) && $this->u->room['zvsee'] == 0) { - if ($this->u->info['inTurnirnew'] > 0) { - $totr = mysql_fetch_array(mysql_query('SELECT * FROM `turnirs` WHERE `id` = "' . mysql_real_escape_string($this->u->info['inTurnirnew']) . '" AND `status` = "0" LIMIT 1')); - if (isset($totr['id'])) { - mysql_query('UPDATE `users` SET `inTurnirnew` = "0" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); - mysql_query('UPDATE `turnirs` SET `users_in` = `users_in` - 1 LIMIT 1'); - $this->u->info['inTurnirnew'] = 0; - $this->error = ' .'; - } else { - $this->error = ' .'; - } - } else { - $this->error = ' .'; - } - } - - $dv = ''; - $trse = ''; - - if ($this->u->info['inTurnirnew'] > 0) { - $pl = mysql_fetch_array(mysql_query('SELECT * FROM `turnirs` WHERE `id` = "' . $this->u->info['inTurnirnew'] . '" LIMIT 1')); - if (!isset($pl['id'])) { - mysql_query('UPDATE `users` SET `inTurnirnew` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - echo '- ... .'; - } else { - $dv = ' [' . $pl['users_in'] . ']:
'; - $spu = mysql_query('SELECT `u`.`id`,`u`.`align`,`u`.`login`,`u`.`clan`,`u`.`level`,`u`.`city`,`u`.`online`,`u`.`sex`,`u`.`cityreg`,`u`.`palpro`,`u`.`invis` FROM `users` AS `u` WHERE `u`.`inTurnirnew` = "' . $pl['id'] . '" LIMIT ' . $pl['users_in']); - $i = 1; - while ($plu = mysql_fetch_array($spu)) { - $dv .= '
' . $i . '. ' . $this->u->microLogin($plu, 2) . '
'; - $i++; - } - echo ' - -
- - - - - - -
- ' . $this->error . ' -
- ' . $this->u->timeOut($pl['time'] - time()) . ' -
-
- ' . $dv . ' -
-
 
-
'; - } - } else { - $tlvl = 4; - $i = 4; - $trnmz = [4 => '', 5 => '', 6 => '.\.']; - while ($i <= 6) { - if ($_GET['tlvl'] == $i) { - $trse .= ''; - $tlvl = $i; - } else { - $trse .= ''; - } - $i++; - } - $prb = ''; - echo ''; - $sp = mysql_query('SELECT * FROM `turnirs` WHERE `status` = "0" AND `level` = "' . $tlvl . '"'); - $j = 0; - while ($pl = mysql_fetch_array($sp)) { - $j++; - $dinf = ' ' . $this->u->timeOut($pl['time'] - time()) . ''; - $dv .= ''; - } - if ($dv == '') { - $dv = ' ...'; - } - echo ' - -
- - - - - - -
- ' . $this->error . ' -
- : - - ' . $prb . ' -
-
- ' . $dv . ' -
- ' . $prb . ' -
-
'; - } - } elseif ($r == 1) { - //, . . 29.05.22 - $zi = [ - 1 => ' , .', - ]; - $dv = ''; - if ($this->u->room['zvsee'] == 0) { - if ($this->u->info['level'] <= $c['bot_level'] || $this->u->info['admin'] > 0) { - $dv = ' ' . ($c['bot_level'] + 1) . '- . '; - } else { - if ($this->u->info['level'] < 9) { - $tstw = ' 8 '; - } else { - $tstw = ''; - } - $dv .= '
-
-
- ' . $tstw . ' - -
-
-
'; - } - if ($this->u->info['admin'] > 0) { - if (isset($_GET['adminbotatack'])) { - $bot_atack = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . mysql_real_escape_string($_GET['adminbotatack']) . '" LIMIT 1')); - if (isset($bot_atack['id'])) { - $logins_bot = []; - $k = $this->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", - "' . $this->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` = "' . $this->u->info['id'] . '" LIMIT 2'); - mysql_query('UPDATE `stats` SET `team` = "2" WHERE `id` = "' . $k['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); - die(''); - } - } - } - - $dv .= '
'; - - $dv .= '
:
'; - } - - echo ' -
- - - - - - -
- - - - -
- ' . $dv . ' -
-
'; - } - } elseif ($r == 4) { - if ($this->u->room['zvsee'] == 0) { // ?> - - - u->room['zvsee'] == 0) { - echo '
-
- - -
'; - } - } - } 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 .= $this->u->microLogin($tmu[$tms[$i]][$j], 1) . ', '; - } - $j++; - } - $tmsu = rtrim($tmsu, ', '); - $tm .= $tmsu; - if ($i + 1 != count($tms)) { - $tm .= ' '; - } - $i++; - } - if ($tm != '') { - $html .= ($p + $x) . '. ' . date('d.m.y H:i', $pl['time_start']) . ' ' . $tm . '
'; - } - $x++; - } - ?> - - - - - -

- ( )

- ...'; - } else { - echo '
' . $html . '
'; - } ?> - - - - - -
0 && $xx > 15) { ?> -   - 0) { ?> -   -
- 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 = ' - - - - -
 

' . date('d.m.Y', $dt) . '

 
-
- : -
-
'; - $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 .= ''; - } - $tm2 .= '' . $tms[$g][$h]['login'] . ' [' . $tms[$g][$h]['lvl'] . '], '; - } - $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 .= ' '; - } - $tm .= $tm2; - if ($k + 1 < count($ts) && $tm2 != '' && $ts[$k + 1] > 0) { - $tm .= ' '; - } - $k++; - } - } - if (!isset($btl_lst[$b['id']])) { - $btl_lst[$b['id']] = true; - if ($tm == '') { - $tm = ' '; - } - $jk++; - $btl .= $jk . '. ' . date('d.m.y H:i', $pl['time']) . ' ' . $tm . '
'; - } - $j++; - } - } - if ($btl == '') { - $see .= '


, , ...




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

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

'; - } - } - } - - public function rzv($v) - { - $v = explode('.', $v); - if (!isset($v[1])) { - $v = $v[0] . '.0'; - } else { - $v = $v[0] . '.' . $v[1]; - } - return $v; - } - - public function rzInfo($id) - { - $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` <= ' . $this->u->info['level'] . ' OR `min_lvl_2` <= ' . $this->u->info['level'] . ') AND (`max_lvl_1` >= ' . $this->u->info['level'] . ' OR `max_lvl_2` >= ' . $this->u->info['level'] . ')')); - if ($w > 0) { - $r = ' (' . $w . ')'; - } - return $r; - } - - public function testzvu($id, $tm, $bt = 0) - { - $query = "select id from stats where zv = $id and team = $tm"; - if ($bt) { - $query .= " and bot = 2"; - } - return mysql_num_rows(mysql_query($query)); - } - - public function seeZv() - { - global $c, $code, $zi; - if (isset($_GET['r']) && $this->zv_see == 1) { - $r = round(intval($_GET['r'])); - if ($r >= 1 && $r <= 5) { - // - $i = 0; - $cl = mysql_query('SELECT * FROM `zayvki` WHERE `razdel` = "' . mysql_real_escape_string($r) . '" AND `start` = "0" AND `cancel` = "0" AND `time` > "' . (time() - 60 * 60 * 2) . '" /*AND `city` = "' . $this->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 .= $this->u->microLogin($s['id'], 1) . ', '; - } - $rad = ''; - $tm = rtrim($tm, ', '); - if (!isset($zi['id']) && $this->u->room['zvsee'] == 0 && $this->u->info['inTurnirnew'] == 0) { - $rad = ' '; - } - $n1tv = ''; - $unvs = ''; - if ($pl['invise'] == 1) { - // - $tm = ''; - $unvs = 0; - - $usrszv = ''; - //if( $this->u->info['admin'] > 0 ) { - $spzm = mysql_query('SELECT `id`,`team` FROM `stats` WHERE `zv` = "' . $pl['id'] . '" AND `id` != "' . $pl['creator'] . '"'); - while ($plzm = mysql_fetch_array($spzm)) { - if ($this->u->info['admin'] > 0 || ($this->u->info['align'] > 1 && $this->u->info['align'] < 2) || ($this->u->info['align'] > 3 && $this->u->info['align'] < 4)) { - $usrszv .= ',' . $this->u->microLogin($plzm['id'], 1) . ''; - } - $unvs++; - } - //} - $tm = '' . $this->u->microLogin($pl['creator'], 1) . '' . $usrszv . ' - ' . $tm; - - $unvs = ' : ' . (1 + $unvs) . ' . '; - $n1tv = ' '; - } - if ($pl['kingfight'] == 1) { - $n1tv .= ' '; - } - if ($pl['travmaChance'] == 100) { - $n1tv .= ''; - } - if ($pl['noatack'] == 1) { - $n1tv .= ' '; - } - if ($pl['nobot'] == 1) { - $n1tv .= ' '; - } - if ($pl['fastfight'] == 1) { - $n1tv .= ' '; - } - if ($pl['noeff'] == 1) { - $n1tv .= ' '; - } - if ($pl['arand'] == 1) { - $n1tv .= ' '; - } - if ($pl['noart'] == 1) { - $n1tv .= ' '; - } - if ($pl['otmorozok'] == 1) { - $n1tv .= ' '; - } - if ($pl['comment'] != '') { - $dl = ''; - if (($moder['boi'] == 1 || $this->u->info['admin'] > 0) && $pl['dcom'] == 0) { - $dl .= ' ( )'; - if (isset($_GET['delcom']) && $_GET['delcom'] == $pl['id'] && $this->u->newAct($_GET['key']) == true) { - mysql_query('UPDATE `zayvki` SET `dcom` = "' . $this->u->info['id'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - $pl['dcom'] = $this->u->info['id']; - } - } - if ($pl['dcom'] > 0) { - $dl = ' '; - } - if ($pl['dcom'] > 0) { - if ($moder['boi'] == 1 || $this->u->info['admin'] > 0) { - $pl['comment'] = '[ : ' . $pl['comment'] . '] '; - } 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 = ' ( ' . $imn . ')'; - } - if ($r == 5 && ($pl['creator'] == $this->u->info['id']) && $cols < 2 && $pl['priz'] == 0) { - $del_q = '  '; - } 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 . '' . date('H:i', $pl['time']) . ' (' . $lvldt . ') : ' . $n1tv . ' ( ' . ($pl['timeout'] / 60) . ' .) ' . $zv_comm . ' (' . $unvs . ' ' . $tmStart . ' .) ' . $mon . ' : ' . $tm . ' ' . $del_q . '
'; - } 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 = $this->u->addNewbot(0, '', $plb['id']); - $logins_bot = $bt['logins_bot']; - if ($bt > 0) { - mysql_query('UPDATE `stats` SET `zv` = "' . $pl['id'] . '",`team` = "2" WHERE `id` = "' . $bt . '" LIMIT 1'); - $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']} .= $this->u->microLogin($s['id'], 1) . ', '; - $tmc[$s['team']]++; - } - - if ($tm1 == '') { - $tm2 = ' '; - } else { - $tm1 = rtrim($tm1, ', '); - } - - if ($tm2 == '') { - $tm2 = ' '; - } else { - $tm2 = rtrim($tm2, ', '); - } - // - if ($pl['teams'] == 3) { - if ($tm3 == '') { - $tm2 = ' '; - } 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 = ' ' . $ttl1 . ': ' . $tm1; - $tm2 = ' ' . $ttl2 . ': ' . $tm2; - $tm3 = ' ' . $ttl3 . ': ' . $tm3; - - } - // - $rad = ''; - if (!isset($zi['id']) && $this->u->room['zvsee'] == 0) { - $rad = ' '; - } - if ($pl['comment'] != '') { - $dl = ''; - if (($moder['boi'] == 1 || $this->u->info['admin'] > 0) && $pl['dcom'] == 0) { - $dl .= ' ( )'; - if (isset($_GET['delcom']) && $_GET['delcom'] == $pl['id'] && $this->u->newAct($_GET['key']) == true) { - mysql_query('UPDATE `zayvki` SET `dcom` = "' . $this->u->info['id'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - $pl['dcom'] = $this->u->info['id']; - } - } - if ($pl['dcom'] > 0) { - $dl = ' '; - } - if ($pl['dcom'] > 0) { - if ($moder['boi'] == 1 || $this->u->info['admin'] > 0) { - $pl['comment'] = '[ : ' . $pl['comment'] . '] '; - } else { - $pl['comment'] = ''; - } - } - $zv_comm = '' . $pl['comment'] . '' . $dl . ''; - } else { - $zv_comm = ''; - } - if ($pl['teams'] == 3) { - $zv_comm .= ' ( )'; - } - - $zvb .= $rad . '' . date('H:i', $pl['time']) . ' '; - $zvb .= '(' . (0 + $tmc[1]) . '/' . $pl['tm1max'] . ')'; - $zvb .= ' ' . $tm1; - $zvb .= ' ('; - 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 .= ' .)'; - $zvb .= ' '; - $zvb .= '(' . (0 + $tmc[2]) . '/' . $pl['tm2max'] . ')'; - $zvb .= ' ' . $tm2; - $zvb .= ' ('; - 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 .= ' .)'; - $zvb .= ' : (: ' . ($pl['timeout'] / 60) . ' .) '; - $zvb .= ' ' . $zv_comm . ' '; - $zvb .= ' ( ' . $tmStart . ') ' . $mon . '
'; - } 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'] == $this->u->info['id'] || $uze['id'] == $this->u->info['id'] || $this->u->info['level'] <= $c['bot_level']) { - $d1 = 'disabled="disabled"'; - } - if (!isset($uze['id']) || $this->u->info['zv'] == $pl['id']) { - $enm = ''; - if (isset($uze['id'])) { - $enm = ' ' . $this->u->microLogin($uze['id'], 1) . ''; - } - if ($uz['banned'] > 0) { - $pl['id'] = 0; - $d1 = 'disabled="disabled"'; - $zvb .= ''; - } - $dp1 = ''; - if ($pl['money'] > 0) { - $dp1 = ' , : ' . $this->u->round2($pl['money']) . ' .'; - } - if ($this->u->room['zvsee'] == 0) { - $zvb .= ''; - } - $mbcom = ''; - if ($pl['comment'] != '') { - $mbcom = ' ' . $pl['comment'] . ''; - } - $zvb .= '' . date('H:i', $pl['time']) . ' ' . $this->u->microLogin($uz['id'], 1) . ' ' . $enm . ' : ( ' . round($pl['timeout'] / 60) . ' .' . $dp1 . ' ' . $mon . ')' . $mbcom . '
'; - if ($uz['banned'] > 0) { - $zvb .= '
'; - } - } - } - } - $i++; - } - if ($i == 0) { - // - if ($this->u->room['zvsee'] > 0) { - echo '


'; - } - } else { - if (!isset($zi['id']) && $this->u->room['zvsee'] == 0) { - if ($_GET['r'] == 5) { - if (!$this->u->info['no_zv_key']) { - echo '

- : -
' . $zvb . ' : - -
'; - } else { - echo '

-
' . $zvb . ' -
'; - } - } else { - if ($zvb != '' && $this->u->info['level'] > $c['bot_level']) { - echo '


' . $zvb . '
'; - } else { - echo '
' . $zvb . '
'; - } - } - } else { - echo $zvb; - } - } - } - } - } - - public function go($id) - { - global $zi; - $filter = new Filter(); - if (isset($zi['id'])) { - $this->error = ' . .'; - } else { - if ($this->u->info['battle'] == 0 && $this->u->info['inTurnirnew'] == 0) { - $z = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `id`="' . mysql_real_escape_string(intval($id)) . '" /*AND `city` = "' . $this->u->info['city'] . '"*/ AND `start` = "0" AND `cancel` = "0" AND `time` > "' . (time() - 60 * 60 * 2) . '" LIMIT 1')); - if (isset($z['id'])) { - if ($z['razdel'] >= 1 && $z['razdel'] <= 3) { - //, , - $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 ($this->u->info['hpNow'] < $this->u->stats['hpAll'] / 100 * 30 && ($z['razdel'] >= 1 || $z['razdel'] <= 3)) { - $this->error = ' '; - $az = 0; - } elseif ($uz1['clan'] == $this->u->info['clan'] && $this->u->info['clan'] != 0 && $this->u->info['admin'] == 0 && true == false) { - $this->error = ' '; - } elseif ($z['withUser'] != '' && $filter->mystr($this->u->info['login']) != $filter->mystr($z['withUser']) && $z['razdel'] == 3) { - $this->error = ' '; - } elseif ($z['money'] > 0 && $z['money'] > $this->u->info['money']) { - $this->error = ' , '; - } elseif ($this->u->stats['hpNow'] < ceil($this->u->stats['hpMax'] / 100 * 30)) { - $this->error = ' , '; - } elseif (!isset($uz2['id'])) { - $upd = mysql_query('UPDATE `stats` SET `zv` = "' . $z['id'] . '",`team` = "2" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); - if ($upd) { - $ca = ''; - if ($uz1['clan'] != 0) { - $pc = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id`="' . $uz1['clan'] . '" LIMIT 1')); - if (isset($pc['id'])) { - $pc['img'] = $pc['name_mini'] . '.gif'; - $ca = ''; - } - } - if ($uz1['align'] != 0) { - $ca = '' . $ca; - } - $this->error = ' ' . $ca . ' ' . $uz1['login'] . ' [' . $uz1['level'] . ']'; - $sa = ''; - if ($this->u->info['sex'] == 2) { - $sa = ''; - } - $text = ' [login:' . $this->u->info['login'] . '] ' . $sa . ' .[reflesh_main_zv_priem:' . $this->u->info['id'] . ']'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $uz1['city'] . "','','','" . $uz1['login'] . "','" . $text . "','" . time() . "','6','0')"); - $zi = $z; - $this->u->info['zv'] = $z['id']; - $this->u->info['team'] = 2; - } else { - $this->error = ' .'; - } - } else { - $this->error = ' - .'; - } - } else { - $this->error = ' .'; - } - } elseif ($z['razdel'] == 4 && $this->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'] == $this->u->info['clan'] && $this->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'] > $this->u->info['money3']) { - $this->error = ' , '; - } elseif (($z['money'] > 0 || $z['money3'] > 0) && $this->u->info['level'] < 4) { - $this->error = ' 4- '; - } elseif ($z['tm' . $t1 . 'max'] > $tmmax) { - if ($z['min_lvl_' . $t1] > $this->u->info['level'] || $z['max_lvl_' . $t1] < $this->u->info['level']) { - $this->error = ' , ' . $z['min_lvl_' . $t1] . ' - ' . $z['max_lvl_' . $t1] . ' '; - } elseif ($this->u->stats['hpNow'] < ceil($this->u->stats['hpMax'] / 100 * 30)) { - $this->error = ' , '; - } else { - $upd = mysql_query('UPDATE `stats` SET `zv` = "' . $z['id'] . '",`team` = "' . mysql_real_escape_string((int)$t1) . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); - if (!$upd) { - $this->error = ' ...'; - } else { - $this->error = ' ...'; - $zi = $z; - $this->u->info['zv'] = $z['id']; - $this->u->info['team'] = mysql_real_escape_string((int)$t1); - } - } - } else { - $this->error = ' (' . ($z['tm' . $t1 . 'max'] - $tmmax) . ')'; - } - } - } elseif ($z['razdel'] == 5 && $this->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 (!$this->u->info['no_zv_key'] && (!isset($_SESSION['code2']) || $_SESSION['code2'] < 1 || ($_POST['code21'] != $_SESSION['code2'] && $_POST['code22'] != $_SESSION['code2']))) { - $this->error = ' '; - } elseif ($z['min_lvl_1'] > $this->u->info['level'] || $z['max_lvl_1'] < $this->u->info['level']) { - $this->error = ' , ' . $z['min_lvl_1'] . ' - ' . $z['max_lvl_1'] . ' '; - } elseif ($this->u->stats['hpNow'] < ceil($this->u->stats['hpMax'] / 100 * 30)) { - $this->error = ' , '; - } elseif ($z['money'] > 0 && $this->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 ( - "' . $this->u->info['name'] . '", - "' . $this->u->info['align'] . '", - "1", - "' . $this->u->info['login'] . '", - "0", - "' . $this->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", - "' . $this->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` = "' . $this->u->info['id'] . '" LIMIT 1'); - // - $sellclass = rand(1, 6); - if ($sellclass == 1) { - // 1 - $us = $this->add_effn($uidb, 8); // - $us = $this->add_effn($uidb, 20); // - - mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uidb . "','s1=21|s2=31|s3=16|s4=30|rinv=40|m9=5|m6=10|s7=0|a1=10|a2=0|a3=0|a4=0|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0',-75,-9,100000)"); - $re = $this->u->addItem(525, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "525" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(539, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "539" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(523, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "523" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(523, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 14 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "523" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(290, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "290" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(541, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "541" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(633, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "633" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(647, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "647" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(680, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "680" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(685, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "685" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $this->u->addItem(685, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "685" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $this->u->addItem(685, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "685" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(1151, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "1151" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(707, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "707" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(712, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "712" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - 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 = $this->add_effn($uidb, 7); // - $us = $this->add_effn($uidb, 20); // - - mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uidb . "','s1=24|s2=20|s3=24|s4=30|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=0|a4=9|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',-75,-9,100000)"); - $re = $this->u->addItem(527, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "527" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(537, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "537" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(567, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "567" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $this->u->addItem(723, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 14 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "723" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(291, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "291" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(544, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "544" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(626, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "626" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(651, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "651" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(683, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "683" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(686, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "686" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $this->u->addItem(686, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "686" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $this->u->addItem(686, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "686" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(706, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "706" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(708, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "708" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(717, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "717" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - 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 = $this->add_effn($uidb, 1); // - $us = $this->add_effn($uidb, 20); // - - mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uidb . "','s1=42|s2=3|s3=3|s4=50|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=9|a4=0|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',-75,-9,100000)"); - $re = $this->u->addItem(533, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "533" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(536, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "536" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(558, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "558" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $this->u->addItem(722, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 14 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "722" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(291, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "291" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(545, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "545" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(628, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "628" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(654, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "654" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(684, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "684" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(689, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "689" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $this->u->addItem(689, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "689" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $this->u->addItem(689, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "689" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(700, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "700" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(710, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "710" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(718, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "718" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - 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 = $this->add_effn($uidb, 1); // - $us = $this->add_effn($uidb, 20); // - - mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uidb . "','s1=43|s2=15|s3=15|s4=25|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=10|a3=0|a4=0|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0',-75,-9,100000)"); - $re = $this->u->addItem(528, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "528" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(538, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "538" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(552, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "552" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(552, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 14 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "552" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(291, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "291" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(543, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "543" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(627, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "627" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(653, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "653" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(681, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "681" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(687, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "687" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $this->u->addItem(687, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "687" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $this->u->addItem(687, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "687" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(320, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "320" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(709, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "709" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(716, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "716" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - 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 = $this->add_effn($uidb, 9); // - $us = $this->add_effn($uidb, 32); // - $us = $this->add_effn($uidb, 54); // - $us = $this->add_effn($uidb, 439); // - - mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uidb . "','s1=14|s2=3|s3=3|s4=25|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=0|a4=0|a5=3|mg1=0|mg2=0|mg3=0|mg4=6|mg5=0|mg6=0|mg7=0|s5=13|s6=40|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',-75,-9,100000)"); - $re = $this->u->addItem(531, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "531" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(534, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "534" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(1026, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "1026" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(291, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "291" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(548, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "548" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(629, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "629" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(699, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "699" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(711, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "711" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(714, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "714" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - ///------- - $re = $this->u->addItem(657, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "657" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(674, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "674" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(692, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "692" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $this->u->addItem(692, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "692" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $this->u->addItem(692, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "692" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - ///---- - 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 = $this->add_effn($uidb, 9); // - $us = $this->add_effn($uidb, 32); // - $us = $this->add_effn($uidb, 53); // - $us = $this->add_effn($uidb, 439); // - - - mysql_query("INSERT INTO `stats` (`id`,`stats`,`ability`,`skills`,exp) VALUES ('" . $uidb . "','s1=14|s2=3|s3=3|s4=25|rinv=40|m9=5|m6=10|s7=0|a1=0|a2=0|a3=0|a4=0|a5=3|mg1=0|mg2=6|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=13|s6=40|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0',-75,-9,100000)"); - $re = $this->u->addItem(531, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 1 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "531" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(534, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 2 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "534" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(1026, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 3 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "1026" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(291, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 4 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "291" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(548, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 5 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "548" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(629, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 7 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "629" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(699, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 13 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "699" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(711, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 16 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "711" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(714, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 17 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "714" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - ///------- - $re = $this->u->addItem(658, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 8 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "658" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(675, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 9 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "675" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - - $re = $this->u->addItem(693, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 10 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "693" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $this->u->addItem(693, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 11 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "693" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - $re = $this->u->addItem(693, $uidb); - mysql_query('UPDATE `items_users` SET `inodet` = 12 WHERE `id` = "' . $re . '" LIMIT 1'); - $price = mysql_fetch_array(mysql_query('SELECT `price_1` FROM `items_shop` WHERE `item_id` = "693" AND `sid`=1 LIMIT 1')); - mysql_query('UPDATE `items_users` SET `1price` = "' . $price['price_1'] . '" WHERE `id` = "' . $re . '" LIMIT 1'); - ///---- - 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 = $this->add_effn($uidb, 37);// - $us = $this->add_effn($uidb, 38);// - $us = $this->add_effn($uidb, 283);// - - - $us = $this->add_effn($uidb, 25);// - $us = $this->add_effn($uidb, 296);// +6 - - mysql_query('UPDATE `users` SET `money` = -3000 , `money2` = 0 WHERE `id` = "' . $uidb . '" LIMIT 1'); - // - $hpclon = mysql_fetch_array(mysql_query('SELECT `hpAll`,`mpAll` FROM `stats` WHERE `id` = "' . $uidb . '" LIMIT 1')); - mysql_query('UPDATE `stats` SET `hpNow` = "' . $hpclon['hpAll'] . '" `mpNow` = "' . $hpclon['mpAll'] . '" WHERE `id` = "' . $uidb . '" LIMIT 1'); - $this->u->info['id'] = $uidb; - //============================================================================================= - $this->error = ' 8 '; // - echo ''; - } - - if ($z['invise'] == 1) { - $nxtID = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $z['id'] . '"')); - $nxtID = $nxtID[0]; - } - $this->u->info['login2'] = ''; - - $blnc = $this->u->stats['reting']; - - $z['tm' . $t1] += $blnc; - - $upd = mysql_query('UPDATE `stats` SET `zv` = "' . $z['id'] . '",`team` = "' . $t1 . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); - if (!$upd) { - $this->error = ' ...'; - } else { - mysql_query('UPDATE `users` SET `login2` = "' . $this->u->info['login2'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); - mysql_query('UPDATE `zayvki` SET `tm1` = "' . $z['tm1'] . '", `tm2` = "' . $z['tm2'] . '" WHERE `id` = "' . $z['id'] . '" LIMIT 1'); - $this->error = ' ...'; - $zi = $z; - $this->u->info['zv'] = $z['id']; - $this->u->info['team'] = mysql_real_escape_string((int)$t1); - } - } - } - } else { - $this->error = ' .'; - } - } - } - } -} diff --git a/_incl_data/class/Filter.php b/_incl_data/class/Filter.php deleted file mode 100644 index 56a58846..00000000 --- a/_incl_data/class/Filter.php +++ /dev/null @@ -1,159 +0,0 @@ - $col) { - $str = substr($str, 0, $col); - } - return ($str); - } - // - // - private $sm = ["laugh" => 1, "fingal" => 1, "eek" => 1, "smoke" => 1, "hi" => 1, "bye" => 1, "king" => 1, "king2" => 1, "boks2" => 1, "boks" => 1, "gent" => 1, "lady" => 1, "tongue" => 1, "smil" => 1, "rotate" => 1, "ponder" => 1, "bow" => 1, "angel" => 1, "angel2" => 1, "hello" => 1, "dont" => 1, "idea" => 1, "mol" => 1, "super" => 1, "beer" => 1, "drink" => 1, "baby" => 1, "tongue2" => 1, "sword" => 1, "agree" => 1, "loveya" => 1, "kiss" => 1, "kiss2" => 1, "kiss3" => 1, "kiss4" => 1, "rose" => 1, "love" => 1, "love2" => 1, "confused" => 1, "yes" => 1, "no" => 1, "shuffle" => 1, "nono" => 1, "maniac" => 1, "privet" => 1, "ok" => 1, "ninja" => 1, "pif" => 1, "smash" => 1, "alien" => 1, "pirate" => 1, "gun" => 1, "trup" => 1, "mdr" => 1, "sneeze" => 1, "mad" => 1, "friday" => 1, "cry" => 1, "grust" => 1, "rupor" => 1, "fie" => 1, "nnn" => 1, "row" => 1, "red" => 1, "lick" => 1, "help" => 1, "wink" => 1, "jeer" => 1, "tease" => 1, "nunu" => 1, "inv" => 1, "duel" => 1, "susel" => 1, "nun" => 1, "kruger" => 1, "flowers" => 1, "horse" => 1, "hug" => 1, "str" => 1, "alch" => 1, "pal" => 1, "mag" => 1, "sniper" => 1, "vamp" => 1, "doc" => 1, "doc2" => 1, "sharp" => 1, "naem" => 1, "naem2" => 1, "naem3" => 1, "invis" => 1, "chtoza" => 1, "beggar" => 1, "sorry" => 1, "sorry2" => 1, "creator" => 1, "grace" => 1, "dustman" => 1, "carreat" => 1, "lordhaos" => 1, "ura" => 1, "elix" => 1, "dedmoroz" => 1, "snegur" => 1, "showng" => 1, "superng" => 1, "podz" => 1, "sten" => 1, "devil" => 1, "cat" => 1, "owl" => 1, "lightfly" => 1, "snowfight" => 1, "rocket" => 1, "ball" => 1, "smile" => 1, "fuck" => 1]; - - public function e($t) - { - mysql_query( - 'INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("#' . date('d.m.Y') . ' %' . date( - 'H:i:s' - ) . ': ' . mysql_real_escape_string($t) . '","capitalcity","","6","1","-1")' - ); - } - - public function setOnline($online, $uid) - { - $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('>', '', $txt); - $txt = str_replace('<', '', $txt); - $txt = str_replace('"', '', $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); - $testEN2 = $txt; - - $testEN2 = str_replace('"', '', $testEN2); - $testEN2 = str_replace(' ', '', $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); - $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); - } -} diff --git a/_incl_data/class/Insallah/Core/Db.php b/_incl_data/class/Insallah/Core/Db.php index f4b24e48..6a362d3a 100644 --- a/_incl_data/class/Insallah/Core/Db.php +++ b/_incl_data/class/Insallah/Core/Db.php @@ -2,6 +2,7 @@ namespace Insallah; +use Core\Database; use Exception; use http\Message; use PDO; @@ -50,8 +51,9 @@ class Db 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; 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/Magic.php b/_incl_data/class/Magic.php deleted file mode 100644 index 17a69186..00000000 --- a/_incl_data/class/Magic.php +++ /dev/null @@ -1,1992 +0,0 @@ -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, $btl; - - $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 && $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 = 'Вы слишком малы чтобы использовать данный предмет '; - return 'Вы слишком малы чтобы использовать данный предмет'; - } - - 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']) && (in_array($itm['item_id'], $this->e_magic) || in_array( - $itm['item_id'], $this->c_magic - ))) { - $itm['magic_chance'] += $bs_is['users']; - if ($itm['magic_chance'] >= 99) { - $itm['magic_chance'] = 99; - } - } - - if ($itm['iznosNOW'] >= $itm['iznosMAX']) { - $u->error = 'Не осталось зарядов...'; - } elseif ($st['useOnlyInBattle'] == 1 && $u->info['battle'] == 0) { - //Можно использовать только в поединке - $u->error = 'Можно использовать только в поединке'; - } elseif ($u->info['battle'] > 0 && $itm['btl_zd'] > 0) { - //Можно использовать только в поединке - $u->error = 'Задержка использования еще ' . $itm['btl_zd'] . ' ходов'; - } elseif ($st['useOnlyInBattle'] == 1 && $u->info['battle'] > 0 && $u->stats['hpNow'] < 1) { - //Можно использовать только в поединке - $u->error = 'Вы погибли, нельзя пользоваться свитками и магией'; - } elseif ($itm['magic_chance'] > 0 && rand(0, 100) > $itm['magic_chance']) { - - - $u->error = 'Каст "' . $itm['name'] . '" сгорел'; - $itm['iznosNOW']++; - if ($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = 0, `delete` = 0 WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); - } - mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'); - $u->addDelo(1, $u->info['id'], '"System.inventory":(КАСТ СГОРЕЛ) Персонаж использовал "' . $itm['name'] . '" (' . $us[1] . ') [itm:' . $itm['id'] . '].', time(), $u->info['city'], 'System.inventory', 0, 0); - - } elseif (isset($st['usefromfile'])) { - - //используем заклятие - $st = $u->lookStats($itm['data']); - if (isset($st['zazuby']) && $_GET['login'] != $u->info['login']) { - //unset($st['useOnLogin']); - $_GET['login'] = $u->info['login']; - } - $jl = $_GET['login']; - $_GET['login'] = urlencode($_GET['login']); - //используем на персонажа (все кроме себя) - $_GET['login'] = str_replace('%', ' ', $_GET['login']); - $_GET['login'] = str_replace('25', '', $_GET['login']); - $jl = str_replace('%', ' ', $jl); - $jl = str_replace('25', '', $jl); - - if (isset($st['useOnLogin']) && $st['useOnLogin'] == 1) { - if ($u->info['inTurnir'] == 0) { - if ($u->info['battle'] > 0) { - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`, `st`.`clone`, `u`.`bot_id`, `u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND `u`.`battle` = "' . $u->info['battle'] . '" AND (`u`.`login`="' . mysql_real_escape_string($_GET['login']) . '" OR `u`.`login`="' . mysql_real_escape_string($jl) . '") LIMIT 1')); - } else { - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`, `st`.`clone`, `u`.`bot_id`, `u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND (`u`.`login`="' . mysql_real_escape_string($_GET['login']) . '" OR `u`.`login`="' . mysql_real_escape_string($jl) . '") LIMIT 1')); - } - } else { - if ($u->info['battle'] > 0) { - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`,`st`.`clone`,`u`.`bot_id`,`u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND `u`.`battle` = "' . $u->info['battle'] . '" AND (`u`.`login`="' . mysql_real_escape_string($_GET['login']) . '" OR `u`.`login`="' . mysql_real_escape_string($jl) . '") AND `u`.`inTurnir` > 0 LIMIT 1')); - } else { - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`,`st`.`clone`,`u`.`bot_id`,`u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND (`u`.`login`="' . mysql_real_escape_string($_GET['login']) . '" OR `u`.`login`="' . mysql_real_escape_string($jl) . '") AND `u`.`inTurnir` > 0 LIMIT 1')); - } - } - } - - if ($st['usefromfile'] == 1) { - if ($u->info['battle'] > 0) { - if (file_exists('../../_incl_data/class/magic/' . $itm['magic_inci'] . '.php')) { - require('../../_incl_data/class/magic/' . $itm['magic_inci'] . '.php'); - } else { - $u->error = 'Не удалось использовать (' . $itm['magic_inci'] . '.b)'; - } - } else { - if (file_exists('_incl_data/class/magic/' . $itm['magic_inci'] . '.php')) { - require('_incl_data/class/magic/' . $itm['magic_inci'] . '.php'); - } else { - $u->error = 'Не удалось использовать (' . $itm['magic_inci'] . ')'; - } - } - } else { - if ($itm['useInBattle'] > 0) { - if (file_exists('../../_incl_data/class/priems/' . $st['usefromfile'] . '.php')) { - require('../../_incl_data/class/priems/' . $st['usefromfile'] . '.php'); - } else { - $u->error = 'Не удалось использовать (' . $st['usefromfile'] . '.)'; - } - } else { - $u->error = 'Не удалось использовать (' . $st['usefromfile'] . '!)'; - } - } - } elseif ($itm['type'] == 30) { - //Эликсиры - $goodUse = 0; - $use = []; - if (isset($st['moment'])) { - //Эликсир используется моментально (Восстановление НР или МР) - if (isset($st['moment_hp'])) { - //Восстанавливаем здоровье - if ($u->stats['hpNow'] < $u->stats['hpAll']) { - $goodUse = 1; - $use['moment_hp'] = $st['moment_hp']; - - if ($u->stats['hpNow'] + $use['moment_hp'] > $u->stats['hpAll']) { - $use['moment_hp'] = ceil($u->stats['hpAll'] - $u->stats['hpNow']); - } - - $u->error .= 'Вы восстановили ' . ($use['moment_hp']) . ' HP.
'; - } else { - $u->error = 'Ваше здоровье и так полностью восстановлено
'; - $goodUse = 0; - } - } - - if (isset($st['moment_mp'])) { - //Восстанавливаем здоровье - if ($u->stats['mpNow'] < $u->stats['mpAll']) { - $goodUse = 1; - $use['moment_mp'] = $st['moment_mp']; - if ($u->stats['mpNow'] + $use['moment_mp'] > $u->stats['mpAll']) { - $use['moment_mp'] = ceil($u->stats['mpAll'] - $u->stats['mpNow']); - } - $u->error .= 'Вы восстановили ' . ($use['moment_mp']) . ' MP.
'; - } else { - $u->error = 'Ваша манна и так полностью восстановлена'; - $goodUse = 0; - } - } - - if ($itm['iznosNOW'] >= $itm['iznosMAX']) { - $u->error = 'Эликсир был испорчен...'; - $goodUse = 0; - } - - if (($u->info['align'] == 2 || $u->info['haos'] > time()) && isset($st['nohaos'])) { - $goodUse = 0; - $u->error = 'Хаосники не могут использовать данный эликсир'; - } - - //Заносим данные в БД - if ($goodUse == 1) { - $itm['iznosNOW']++; - $upd = mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'); - if ($upd) { - $u->stats['hpNow'] += $use['moment_hp']; - $u->info['hpNow'] += $use['moment_hp']; - $u->stats['mpNow'] += $use['moment_mp']; - $u->info['mpNow'] += $use['moment_mp']; - if ($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); - } - mysql_query('UPDATE `stats` SET `hpNow` = "' . $u->info['hpNow'] . '", `mpNow` = "' . $u->info['mpNow'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - $u->addDelo(1, $u->info['id'], '"System.inventory": Персонаж использовал эликсир "' . $itm['name'] . '" (+' . $use['moment_hp'] . ' HP) [itm:' . $itm['id'] . '].', time(), $u->info['city'], 'System.inventory', 0, 0); - $this->youuse++; - $u->error = 'Вы успешно использовали эликсир "' . $itm['name'] . '"
' . $u->error . ''; - } else { - $u->error = 'Не удалось использовать эликсир...'; - } - } - } else { - //Эликсиры с продолжительным эффектом - $goodUse = 1; - if (($u->info['align'] == 2 || $u->info['haos'] > time()) && isset($st['nohaos'])) { - $goodUse = 0; - $u->error = 'Хаосники не могут использовать данный эликсир'; - } - if ($goodUse == 1) { - $upd1 = 1; - $upd2 = 1; - //добавляем эффект персонажу - if (isset($st['onlyOne'])) { - //убираем прошлые эффекты - $goodUse = 0; - $upd1 = mysql_query('UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `id_eff` = "' . $itm['magic_inc'] . '"'); - if ($upd1) { - $goodUse = 1; - } - } - if (isset($st['oneType'])) { - //убираем прошлые эффекты - $goodUse = 0; - $upd2 = mysql_query('UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `overType` = "' . $itm['overType'] . '"'); - if ($upd1) { - $goodUse = 1; - } - } - if ($goodUse == 1) { - $us = $this->add_eff($u->info['id'], $itm['magic_inc']); - if ($us[0] == 1) { - $itm['iznosNOW']++; - if ($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); - } - mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'); - $u->addDelo(1, $u->info['id'], '"System.inventory": Персонаж использовал эликсир "' . $itm['name'] . '" (' . $us[1] . ') [itm:' . $itm['id'] . '].', time(), $u->info['city'], 'System.inventory', 0, 0); - $this->youuse++; - $u->error = 'Вы успешно использовали эликсир "' . $itm['name'] . '"
' . $us[1] . ''; - } else { - $u->error = 'Не удалось использовать "' . $itm['name'] . '"'; - } - } else { - $u->error = 'Не удалось использовать "' . $itm['name'] . '"'; - } - } - } - //--------------- - } elseif ($itm['type'] == 29) { - //используем заклятие - $st = $u->lookStats($itm['data']); - if (isset($st['zazuby']) && $_GET['login'] != $u->info['login']) { - //unset($st['useOnLogin']); - $_GET['login'] = $u->info['login']; - } - $jl = $_GET['login']; - $_GET['login'] = urlencode($_GET['login']); - //используем на персонажа (все кроме себя) - $_GET['login'] = str_replace('%', ' ', $_GET['login']); - $_GET['login'] = str_replace('25', '', $_GET['login']); - $jl = str_replace('%', ' ', $jl); - $jl = str_replace('25', '', $jl); - if ($itm['magic_inci'] == 'nextuplvl') { - if ($itm['iznosNOW'] >= $itm['iznosMAX']) { - $u->error = 'Свиток был исполчен...'; - } elseif ($u->info['battle'] > 0) { - // - $u->error = 'Вы не можете использовать свиток в бою'; - } else { - if ($u->info['twink'] > 0) { - $u->error = 'Используйте свиток на основном персонаже'; - } else { - mysql_query('UPDATE `users` SET `stopexp` = 0 WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - mysql_query('UPDATE `users_twink` SET `stopexp` = 0 WHERE `uid` = "' . $u->info['id'] . '" LIMIT 1'); - $itm['iznosNOW']++; - if ($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); - } - mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'); - } - } - } elseif (isset($st['useOnLogin']) && $st['useOnLogin'] == 1) { - if ($u->info['inTurnir'] == 0) { - if ($u->info['battle'] > 0) { - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`, `st`.`clone`, `u`.`bot_id`, `u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND `u`.`battle` = "' . $u->info['battle'] . '" AND (`u`.`login`="' . mysql_real_escape_string($_GET['login']) . '" OR `u`.`login`="' . mysql_real_escape_string($jl) . '") LIMIT 1')); - } else { - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`, `st`.`clone`, `u`.`bot_id`, `u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND (`u`.`login`="' . mysql_real_escape_string($_GET['login']) . '" OR `u`.`login`="' . mysql_real_escape_string($jl) . '") LIMIT 1')); - } - } else { - if ($u->info['battle'] > 0) { - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`,`st`.`clone`,`u`.`bot_id`,`u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND `u`.`battle` = "' . $u->info['battle'] . '" AND (`u`.`login`="' . mysql_real_escape_string($_GET['login']) . '" OR `u`.`login`="' . mysql_real_escape_string($jl) . '") AND `u`.`inTurnir` > 0 LIMIT 1')); - } else { - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`,`st`.`clone`,`u`.`bot_id`,`u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND (`u`.`login`="' . mysql_real_escape_string($_GET['login']) . '" OR `u`.`login`="' . mysql_real_escape_string($jl) . '") AND `u`.`inTurnir` > 0 LIMIT 1')); - } - } - - - if (isset($usr['id'])) { - //заклятье нападения - if ($itm['iznosNOW'] >= $itm['iznosMAX']) { - $u->error = 'Свиток был исполчен...'; - } elseif ($itm['magic_inci'] == 'snowball') { - if ($u->info['battle'] == 0) { - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`clone`,`u`.`type_pers`,`u`.`bot_id`,`st`.`zv`,`u`.`inTurnir`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND (`u`.`battle` = 0 OR `u`.`battle` = "' . $u->info['battle'] . '") AND (`u`.`login`="' . mysql_real_escape_string($_GET['login']) . '" OR `u`.`login`="' . mysql_real_escape_string($jl) . '") LIMIT 1')); - } else { - $usr = mysql_fetch_array(mysql_query('SELECT `st`.`clone`,`u`.`type_pers`,`u`.`bot_id`,`st`.`zv`,`u`.`inTurnir`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "' . $u->info['city'] . '" AND (`u`.`battle` = 0 OR `u`.`battle` = "' . $u->info['battle'] . '") AND (`u`.`login`="' . mysql_real_escape_string($_GET['login']) . '" OR `u`.`login`="' . mysql_real_escape_string($jl) . '") AND `u`.`battle` = "' . $u->info['battle'] . '" LIMIT 1')); - } - if ($usr['battle'] > 0 && $u->info['battle'] != $usr['battle']) { - $u->error = 'Персонаж находится в бою'; - } elseif ($usr['battle'] > 0) { - //Кидаемся в поединке - if ($usr['team'] != $u->info['team'] && $usr['hpNow'] > 0) { - $txt = 1; - - //Отморозки - if ($usr['bot_id'] >= 439 && $usr['bot_id'] <= 460) { - $txt = 500; - } elseif ($usr['bot_id'] == 291) { - if ($usr['hpNow'] < 961) { - $txt = 1982; - } elseif ($usr['hpNow'] > 980 && $usr['hpNow'] < 1981) { - $txt = 1982; - } - } elseif ($usr['id'] == 1008) { - $txt = $u->info['level'] * 250; - } - - $usr['hpNow'] -= $txt; - if ($txt < 0) { - $txt = '+' . $txt; - } elseif ($txt == 0) { - $txt = '--'; - } else { - $txt = '-' . $txt; - } - if ($usr['hpNow'] < 0) { - $usr['hpNow'] = 0; - } - $btl->stats[$btl->uids[$usr['id']]]['hpNow'] = $usr['hpNow']; - $lastHOD = mysql_fetch_array(mysql_query('SELECT * FROM `battle_logs` WHERE `battle` = "' . $u->info['battle'] . '" ORDER BY `id_hod` DESC LIMIT 1')); - if (isset($lastHOD['id'])) { - $btl->stats[$btl->uids[$usr['id']]]['hpNow'] = floor($btl->stats[$btl->uids[$usr['id']]]['hpNow']); - if ($btl->stats[$btl->uids[$usr['id']]]['hpNow'] > $btl->stats[$btl->uids[$usr['id']]]['hpAll']) { - $btl->stats[$btl->uids[$usr['id']]]['hpNow'] = $btl->stats[$btl->uids[$usr['id']]]['hpAll']; - } - if ($btl->stats[$btl->uids[$usr['id']]]['hpNow'] < 1) { - $btl->stats[$btl->uids[$usr['id']]]['hpNow'] = 0; - } - $id_hod = $lastHOD['id_hod']; - if ($lastHOD['type'] != 6) { - $id_hod++; - } - mysql_query('UPDATE `stats` SET `hpNow` = "' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'); - $itm['iznosNOW']++; - if ($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); - } - mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'); - $txt = '' . $txt . ''; - if ($u->info['sex'] == 1) { - $txt = 'Хитрая {u1} бросила кусок снега в {u2}. ' . $txt . ' [' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['hpAll'] . ']'; - } else { - $txt = 'Хитрый {u1} бросил кусок снега в {u2}. ' . $txt . ' [' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['hpAll'] . ']'; - } - mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time() . '","' . $u->info['battle'] . '","' . ($id_hod) . '","{tm1} ' . $txt . '","login1=' . $u->info['login'] . '||t1=' . $u->info['team'] . '||login2=' . $usr['login'] . '||t2=' . $usr['team'] . '||time1=' . time() . '","","","","","6")'); - } - - unset($txt); - } else { - $u->error = 'Нельзя использовать на данного персонажа'; - } - } elseif ($u->info['dnow'] != $usr['dnow']) { - $u->error = 'Персонаж находится в другой комнате'; - } elseif ($usr['id'] == $u->info['id']) { - $u->error = 'Нельзя кидаться в самого себя'; - } elseif ($usr['online'] < 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 . ' "' . $u->info['login'] . '" бросил' . $sx2 . ' кусок снега в "' . $usr['login'] . '". -1000 [' . floor($urs_st['hpNow']) . '/' . $urs_st['hpAll'] . ']'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1')"); - unset($sx, $sx2); - } else { - $u->error = 'Не удалось кинуть снежок...'; - } - } - } elseif ($itm['magic_inci'] == 'atack') { //заклятье нападения - - $usta = $u->getStats($usr['id'], 0); // статы цели - $rgd = $u->regen($usr['id'], $usta, 1); - $usta['hpNow'] = $rgd['hpNow']; - $usta['mpNow'] = $rgd['mpNow']; - $minHp = floor($usta['hpAll'] / 100 * 33); // минимальный запас здоровья цели при котором можно напасть - $batlatest = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "' . $usr['battle'] . '" AND `team_win` = -1 LIMIT 1')); - $test = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_last` WHERE `uid` = "' . $u->info['id'] . '" AND `battle_id` = "' . $usr['battle'] . '" LIMIT 1')); - if (isset($test['id'])) { - echo 'Нельзя вмешаться, вы уже были в этом поединке.'; - } elseif (time() - $usr['timereg'] < 86400 * 10) { - $u->error = 'Нападать на новичков запрещается! Сейчас придет Мироздатель и превратит тебя в лягушку...'; - } elseif ($usr['atack'] == 1 || $usr['atack'] > time()) { - $u->error = 'На персонаже метка нападения, нападайте через неё...'; - } elseif ($u->info['dnow'] != $usr['dnow']) { - $u->error = 'Персонаж находится в другой комнате (пещере)'; - } elseif ($usr['inTurnirnew'] > 0) { - $u->error = 'Персонаж принимает участие в турнире'; - } elseif ($u->info['battle'] > 0) { - $u->error = 'Вы уже находитесь в бою'; - } elseif ($usr['id'] == $u->info['id']) { - $u->error = 'Нельзя нападать на самого себя'; - } elseif ($usr['bot'] == 2) { - $u->error = 'Не удалость напасть на бота ' . $usr['login'] . ''; - } elseif ($usr['online'] < 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]] "' . $u->info['login'] . '" использовал' . $sx . ' магию нападения на персонажа "' . $usr['login'] . '".'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES ('1','" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $rtxt . "','" . time() . "','11','0','1')"); - //напали, обновляем экран - - die(''); - } else { - if ($u->error == '') { - $u->error = 'Не удалось напасть на персонажа...'; - } - } - } - } elseif ($itm['magic_inci'] == 'cureHP') { - //Реген НР,MP - $po = $u->lookStats($itm['data']); - if ($u->info['battle'] > 0) { - //используем свиток в поединке - $bu = mysql_fetch_array(mysql_query('SELECT * FROM `spells` WHERE `btl` = "' . $u->info['battle'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1')); - if (isset($bu['id'])) { - $u->error = 'Нельзя использовать свиток каждый ход...'; - } elseif ($usr['battle'] != $u->info['battle']) { - $u->error = 'Неудалось использовать, персонаж в другом поединке...'; - } elseif ($usr['team'] != $u->info['team']) { - $u->error = 'Неудалось использовать на противника...'; - } elseif ($usr['hpNow'] < 1) { - $u->error = 'Неудалось использовать на мертвых...'; - } elseif ($u->info['hpNow'] < 1) { - $u->error = 'Неудалось использовать, вы погибли...'; - } elseif ($btl->info['noeff'] > 0) { - $u->error = 'Запрет на использования свитков восстановления'; - } elseif ($po['magic_hpNow'] < 1 && $po['magic_mpNow'] < 1) { - $u->error = 'Неудалось использовать, в магическом свитке нет магии...'; - } elseif (($usr['battle'] == $u->info['battle'] && ($u->info['team'] == $usr['team'] && ($po['magic_hpNow'] > 0 || $po['magic_mpNow'] > 0))) && $usr['hpNow'] >= 1 && $u->info['hpNow'] >= 1) { - //кастуем - if (isset($po['magic_hpNow'])) { - - mysql_query('INSERT INTO `spells` (`btl`,`uid`,`time`,`item_id`,`var`,`hod`) VALUES ( - "' . $u->info['battle'] . '","' . $u->info['id'] . '","' . time() . '","' . $itm['item_id'] . '","' . $itm['name'] . '","1" - )'); - - $txt = $po['magic_hpNow']; - - if ($btl->stats[$btl->uids[$usr['id']]]['hpAll'] - $btl->stats[$btl->uids[$usr['id']]]['hpNow'] < $txt) { - $txt = floor($btl->stats[$btl->uids[$usr['id']]]['hpAll'] - $btl->stats[$btl->uids[$usr['id']]]['hpNow']); - } - //653 - 400 - //253 - //453 1306 - $gdhh = round($txt / $btl->stats[$btl->uids[$usr['id']]]['hpAll'] * 5, 2); - $gdhd = round($gdhh / $btl->users[$btl->uids[$usr['id']]]['tactic7'] * 100); - if ($gdhd > 100) { - $txt = floor($txt / 100 * $gdhd); - } - - if ($btl->users[$btl->uids[$usr['id']]]['tactic7'] >= 1) { - if ($txt > 0) { - $btl->stats[$btl->uids[$usr['id']]]['hpNow'] += $txt; - $btl->users[$btl->uids[$usr['id']]]['tactic7'] -= $gdhh; - if ($btl->users[$btl->uids[$usr['id']]]['tactic7'] < 0) { - $btl->users[$btl->uids[$usr['id']]]['tactic7'] = 0; - } - } - mysql_query('UPDATE `stats` SET `last_hp` = "' . $txt . '", `hpNow` = `hpNow` + ' . $po['magic_hpNow'] . ', `tactic7` = "' . $btl->users[$btl->uids[$usr['id']]]['tactic7'] . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'); - if ($txt > 0) { - $txt = '+' . $txt; - } elseif ($txt == 0) { - $txt = '--'; - } - } else { - $txt = '--'; - } - $lastHOD = mysql_fetch_array(mysql_query('SELECT * FROM `battle_logs` WHERE `battle` = "' . $u->info['battle'] . '" ORDER BY `id_hod` DESC LIMIT 1')); - if (isset($lastHOD['id'])) { - $btl->stats[$btl->uids[$usr['id']]]['hpNow'] = floor($btl->stats[$btl->uids[$usr['id']]]['hpNow']); - if ($btl->stats[$btl->uids[$usr['id']]]['hpNow'] > $btl->stats[$btl->uids[$usr['id']]]['hpAll']) { - $btl->stats[$btl->uids[$usr['id']]]['hpNow'] = $btl->stats[$btl->uids[$usr['id']]]['hpAll']; - } - if ($btl->stats[$btl->uids[$usr['id']]]['hpNow'] < 1) { - $btl->stats[$btl->uids[$usr['id']]]['hpNow'] = 0; - } - $id_hod = $lastHOD['id_hod']; - if ($lastHOD['type'] != 6) { - $id_hod++; - } - $txt = '' . $txt . ''; - if ($u->info['id'] == $usr['id']) { - if ($u->info['sex'] == 1) { - $txt = '{u1} использовала "' . $itm['name'] . '" на себя. ' . $txt . ' [' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['hpAll'] . ']'; - } else { - $txt = '{u1} использовал "' . $itm['name'] . '" на себя. ' . $txt . ' [' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['hpAll'] . ']'; - } - } else { - if ($u->info['sex'] == 1) { - $txt = '{u1} использовала "' . $itm['name'] . '" на {u2}. ' . $txt . ' [' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['hpAll'] . ']'; - } else { - $txt = '{u1} использовал "' . $itm['name'] . '" на {u2}. ' . $txt . ' [' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['hpAll'] . ']'; - } - } - mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time() . '","' . $u->info['battle'] . '","' . ($id_hod) . '","{tm1} ' . $txt . '","login1=' . $u->info['login'] . '||t1=' . $u->info['team'] . '||login2=' . $usr['login'] . '||t2=' . $usr['team'] . '||time1=' . time() . '","","","","","6")'); - } - } - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'); - - // сообщение в лог боя - $sx = 'ый'; - $sx2 = ''; - if ($u->info['sex'] == 1) { - $sx = 'ая'; - $sx2 = 'а'; - } - $u->error = 'Свиток "' . $itm['name'] . '" был успешно использован.'; - } else { - $u->error = 'Нельзя использовать на данного персонажа'; - } - } elseif ($u->info['dnow'] != $usr['dnow']) { - $u->error = 'Персонаж находится в другой комнате [пещера]'; - } elseif ($usr['online'] < 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 = 'Свиток "' . $itm['name'] . '" был успешно использован.'; - $rtxt = '[img[items/' . $itm['img'] . ']] Персонаж "' . $u->info['login'] . '" использовал' . $sx2 . ' "' . $itm['name'] . '" на "' . $usr['login'] . '".'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1')"); - } - } elseif ($itm['magic_inci'] == 'cureMP') { - //Реген НР,MP - $po = $u->lookStats($itm['data']); - if ($u->info['battle'] > 0) { - //используем свиток в поединке - $bu = mysql_fetch_array(mysql_query('SELECT * FROM `spells` WHERE `btl` = "' . $u->info['battle'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1')); - if (isset($bu['id'])) { - $u->error = 'Нельзя использовать свиток каждый ход...'; - } elseif ($btl->info['noeff'] > 0) { - $u->error = 'Запрет на использования свитков восстановления'; - } elseif (($usr['battle'] == $u->info['battle'] && ($u->info['team'] == $usr['team'] && ($po['magic_hpNow'] > 0 || $po['magic_mpNow'] > 0))) && $usr['hpNow'] > 1 && $u->info['hpNow'] >= 1) { - //кастуем - if (isset($po['magic_mpNow'])) { - - mysql_query('INSERT INTO `spells` (`btl`,`uid`,`time`,`item_id`,`var`,`hod`) VALUES ( - "' . $u->info['battle'] . '","' . $u->info['id'] . '","' . time() . '","' . $itm['item_id'] . '","' . $itm['name'] . '","1" - )'); - - $txt = $po['magic_mpNow']; - - if ($btl->stats[$btl->uids[$usr['id']]]['mpAll'] - $btl->stats[$btl->uids[$usr['id']]]['mpNow'] < $txt) { - $txt = floor($btl->stats[$btl->uids[$usr['id']]]['mpAll'] - $btl->stats[$btl->uids[$usr['id']]]['mpNow']); - } - - $gdhh = round($txt / $btl->stats[$btl->uids[$usr['id']]]['mpAll'] * 5); - $gdhd = round($gdhh / $btl->users[$btl->uids[$usr['id']]]['tactic7'] * 100); - if ($gdhd > 100) { - $txt = floor($txt / 100 * $gdhd); - } - - if ($btl->users[$btl->uids[$usr['id']]]['tactic7'] >= 1) { // поставить >= 1 , если требует дух - if ($txt > 0) { - $btl->stats[$btl->uids[$usr['id']]]['mpNow'] += $txt; - $btl->users[$btl->uids[$usr['id']]]['tactic7'] -= $gdhh; - if ($btl->users[$btl->uids[$usr['id']]]['tactic7'] < 0) { - $btl->users[$btl->uids[$usr['id']]]['tactic7'] = 0; - } - } - mysql_query('UPDATE `stats` SET `mpNow` = `mpNow` + ' . $txt . ', `tactic7` = "' . $btl->users[$btl->uids[$usr['id']]]['tactic7'] . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'); - if ($txt > 0) { - $txt = '+' . $txt; - } elseif ($txt == 0) { - $txt = '--'; - } - } else { - $txt = '--'; - } - $lastHOD = mysql_fetch_array(mysql_query('SELECT * FROM `battle_logs` WHERE `battle` = "' . $u->info['battle'] . '" ORDER BY `id_hod` DESC LIMIT 1')); - if (isset($lastHOD['id'])) { - $btl->stats[$btl->uids[$usr['id']]]['mpNow'] = floor($btl->stats[$btl->uids[$usr['id']]]['mpNow']); - if ($btl->stats[$btl->uids[$usr['id']]]['mpNow'] > $btl->stats[$btl->uids[$usr['id']]]['mpAll']) { - $btl->stats[$btl->uids[$usr['id']]]['mpNow'] = $btl->stats[$btl->uids[$usr['id']]]['mpAll']; - } - if ($btl->stats[$btl->uids[$usr['id']]]['mpNow'] < 1) { - $btl->stats[$btl->uids[$usr['id']]]['mpNow'] = 0; - } - $id_hod = $lastHOD['id_hod']; - if ($lastHOD['type'] != 6) { - $id_hod++; - } - $txt = '' . $txt . ''; - if ($u->info['id'] == $usr['id']) { - if ($u->info['sex'] == 1) { - $txt = '{u1} использовала "' . $itm['name'] . '" на себя. ' . $txt . ' [' . $btl->stats[$btl->uids[$usr['id']]]['mpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['mpAll'] . '] (Мана)'; - } else { - $txt = '{u1} использовал "' . $itm['name'] . '" на себя. ' . $txt . ' [' . $btl->stats[$btl->uids[$usr['id']]]['mpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['mpAll'] . '] (Мана)'; - } - } else { - if ($u->info['sex'] == 1) { - $txt = '{u1} использовала "' . $itm['name'] . '" на {u2}. ' . $txt . ' [' . $btl->stats[$btl->uids[$usr['id']]]['mpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['mpAll'] . '] (Мана)'; - } else { - $txt = '{u1} использовал "' . $itm['name'] . '" на {u2}. ' . $txt . ' [' . $btl->stats[$btl->uids[$usr['id']]]['mpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['mpAll'] . '] (Мана)'; - } - } - mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time() . '","' . $u->info['battle'] . '","' . ($id_hod) . '","{tm1} ' . $txt . '","login1=' . $u->info['login'] . '||t1=' . $u->info['team'] . '||login2=' . $usr['login'] . '||t2=' . $usr['team'] . '||time1=' . time() . '","","","","","6")'); - } - } - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'); - - // сообщение в лог боя - $sx = 'ый'; - $sx2 = ''; - if ($u->info['sex'] == 1) { - $sx = 'ая'; - $sx2 = 'а'; - } - $u->error = 'Свиток "' . $itm['name'] . '" был успешно использован.'; - } else { - $u->error = 'Нельзя использовать на данного персонажа'; - } - } elseif ($u->info['dnow'] != $usr['dnow']) { - $u->error = 'Персонаж находится в другой комнате [пещера]'; - } elseif ($usr['online'] < 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 = 'Свиток "' . $itm['name'] . '" был успешно использован.'; - $rtxt = '[img[items/' . $itm['img'] . ']] Персонаж "' . $u->info['login'] . '" использовал' . $sx2 . ' "' . $itm['name'] . '" на "' . $usr['login'] . '".'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1')"); - } - } elseif ($itm['magic_inci'] == 'lech_1' or $itm['magic_inci'] == 'lech_2' or $itm['magic_inci'] == 'lech_3') { - - if ($u->info['battle'] > 0) { - //используем свиток в поединке - - } elseif ($u->info['dnow'] != $usr['dnow']) { - $u->error = 'Персонаж находится в другой комнате [пещера]'; - } elseif ($usr['online'] < 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 = '"Легкой травмы"'; - $text_msg2 = 'легких'; - } elseif ($itm['magic_inci'] == 'lech_2') { - $type_lechenie = 2; // тип травмы котору лечим - $text_msg = '"Средней травмы"'; - $text_msg2 = 'средних'; - } elseif ($itm['magic_inci'] == 'lech_3') { - $type_lechenie = 3; // тип травмы котору лечим - $text_msg = '"Тяжелой травмы"'; - $text_msg2 = 'тяжелых'; - } - if ($travm) { - $lech_aa = [0, 2, 3, 4]; - $travm_cep = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid`="' . $usr['id'] . '" and `id_eff`="335" and `delete`="0" and `v1`="' . $type_lechenie . '" LIMIT 1')); - if ($travm_cep['timeUse'] < time() - 360) { - unset($travm_cep); - } - - $cep_users = explode(',', $travm_cep['data']); - $it_i = 0; - $it_no = 0; - $it_users = ''; - while ($it_i < count($cep_users)) { - $it_u = $cep_users[$it_i]; - if ($it_u == $u->info['id']) { - $it_no = 1; - } - $it_u = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`level`,`align`,`clan`,`room` FROM `users` WHERE `id` = "' . $it_u . '" LIMIT 1')); - if (isset($it_u['id'])) { - $it_users .= ', ' . $it_u['login'] . ''; - } - $it_i++; - } - $it_u = ltrim($it_u, ', '); - - $lech_co = round($travm_cep['x'] + 1); - if ($it_no == 1) { - $u->error = 'Вы уже один из лекарей'; - } elseif ($lech_co >= $lech_aa[$type_lechenie]) { - mysql_query('UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $travm['id'] . '" LIMIT 1'); - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'); - if ($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); - } - - $rtxt = '[img[items/cure_g1.gif]] Лекарь "' . $u->info['login'] . '" кинул цепь исцеления на игрока "' . $usr['login'] . '".'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1')"); - - //mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$travm_cep['id'].'" LIMIT 1'); - mysql_query('UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $usr['id'] . '" AND `id_eff` = 4 AND `delete` = 0 LIMIT 1'); - - // сообщение в чат - $u->error = 'Персонаж излечен от ' . $text_msg . '.'; - $rtxt = '[img[items/cure' . $type_lechenie . '.gif]] Лекари "' . $u->info['login'] . $it_users . '" вылечили от ' . $text_msg . ' игрока "' . $usr['login'] . '".'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1')"); - } else { - if (isset($travm_cep['id'])) { - $travm_cep['x']++; - $u->error = 'Вы присоединились к цепи исцеления для "' . $text_msg . '" (исцеление ' . $text_msg2 . ' травм)'; - mysql_query('UPDATE `eff_users` SET `x` = "' . $travm_cep['x'] . '" - ,`data` = "' . $travm_cep['data'] . ',' . $u->info['id'] . '" - WHERE `id` = "' . $travm_cep['id'] . '" LIMIT 1'); - } else { - $u->error = 'Вы создали цепь исцеления для "' . $text_msg . '" (исцеление ' . $text_msg2 . ' травм), у остальных лекарей есть 5 минут, чтобы завершить заклинание'; - mysql_query('INSERT INTO `eff_users` - ( - `id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`user_use`,`v1`,`x` - ) VALUES ( - "335","' . $usr['id'] . '","Цепь исцеления","' . $u->info['id'] . '","28","' . time() . '","' . $u->info['id'] . '","' . $type_lechenie . '","1" - )'); - } - //mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$travm['id'].'" LIMIT 1'); - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'); - if ($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); - } - // сообщение в чат - $rtxt = '[img[items/cure_g1.gif]] Лекарь "' . $u->info['login'] . '" кинул цепь исцеления на игрока "' . $usr['login'] . '".'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1')"); - - } - } else { - $u->error = 'Персонаж не имеет данной травмы.'; - } - - } - - - } elseif ($itm['magic_inci'] == 'lech_free_1' or $itm['magic_inci'] == 'lech_free_2' or $itm['magic_inci'] == 'lech_free_3') { - - if ($u->info['battle'] > 0) { - //используем свиток в поединке - - } elseif ($u->info['dnow'] != $usr['dnow']) { - $u->error = 'Персонаж находится в другой комнате [пещера]'; - } elseif ($usr['online'] < 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 = '"Легкой травмы"'; - $text_msg2 = 'легких'; - } elseif ($itm['magic_inci'] == 'lech_free_2') { - $type_lechenie = 2; // тип травмы котору лечим - $text_msg = '"Средней травмы"'; - $text_msg2 = 'средних'; - } elseif ($itm['magic_inci'] == 'lech_free_3') { - $type_lechenie = 3; // тип травмы котору лечим - $text_msg = '"Тяжелой травмы"'; - $text_msg2 = 'тяжелых'; - } - if ($travm['v1'] != $type_lechenie) { - $u->error = 'Неподходящий свиток для данной травмы.'; - } elseif ($travm['id']) { - $lech_aa = [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]] Лекари "' . $u->info['login'] . $it_users . '" вылечили от ' . $text_msg . ' игрока "' . $usr['login'] . '".'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1')"); - } else { - if (isset($travm_cep['id'])) { - $travm_cep['x']++; - $u->error = 'Вы присоединились к цепи исцеления для "' . $text_msg . '" (исцеление ' . $text_msg2 . ' травм)'; - mysql_query('UPDATE `eff_users` SET `x` = "' . $travm_cep['x'] . '" - ,`data` = "' . $travm_cep['data'] . ',' . $u->info['id'] . '" - WHERE `id` = "' . $travm_cep['id'] . '" LIMIT 1'); - } else { - $u->error = 'Вы создали цепь исцеления для "' . $text_msg . '" (исцеление ' . $text_msg2 . ' травм), у остальных лекарей есть 5 минут, чтобы завершить заклинание'; - mysql_query('INSERT INTO `eff_users` - ( - `id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`user_use`,`v1`,`x` - ) VALUES ( - "335","' . $usr['id'] . '","Цепь исцеления","' . $u->info['id'] . '","28","' . time() . '","' . $u->info['id'] . '","' . $type_lechenie . '","1" - )'); - } - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'); - if ($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); - } - // сообщение в чат - $rtxt = '[img[items/cure_g1.gif]] Лекарь "' . $u->info['login'] . '" кинул цепь исцеления на игрока "' . $usr['login'] . '".'; - mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`) VALUES (1,'" . $u->info['city'] . "','" . $u->info['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1')"); - - } - } else { - $u->error = 'Персонаж не имеет данной травмы.'; - } - - } - - - } else { - if ($u->info['id'] != $usr['id']) { - $lsct = mysql_fetch_array(mysql_query('SELECT `id_eff` FROM `eff_users` WHERE `uid` = "' . $usr['id'] . '" AND `delete` = "0" AND (`overType` = "' . $itm['overType'] . '" OR (`id_eff` = "' . $itm['magic_inc'] . '" AND "' . (0 + $st['onlyOne']) . '" != "0")) LIMIT 1')); - $lsct['good'] = 1; - //Касты - if ($lsct['id_eff'] >= 291 && $lsct['id_eff'] <= 296 && $itm['magic_inc'] >= 291 && $itm['magic_inc'] <= 296) { - if ($lsct['id_eff'] > $itm['magic_inc']) { - $u->error = 'На персонаже есть каст лучше этого!'; - $lsct['good'] = 0; - } - } - } else { - $lsct['good'] = 1; - } - //просто используем на персонажа - if ($lsct['good'] == 0) { - - } elseif ($u->info['dnow'] != $usr['dnow']) { - $u->error = 'Персонаж находится в другой комнате [пещера]'; - } elseif ($usr['room'] == 217 || $usr['room'] == 218 || $usr['room'] == 219) { - $u->error = 'Персонаж ' . $u->microLogin($usr['id'], 1) . ' находится в Общежитии!'; - } elseif ($usr['inTurnir'] != 0 && ($u->info['inTurnir'] != $usr['inTurnir'])) { - $u->error = 'Участвует в турнире Башни смерти...'; - } elseif ($usr['id'] == $u->info['id'] && isset($st['useOnlyUser'])) { - $u->error = 'Нельзя использовать это заклятие на самого себя'; - } elseif ($usr['online'] < 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} переманил клона {u2} на свою сторону.'; - } else { - $txt_m = '{u1} переманила клона {u2} на свою сторону.'; - } - $this->inBattleLog($txt_m, $usr); - mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . ($itm['iznosNOW'] + 1) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); - mysql_query('UPDATE `items_users` SET `btl_zd` = "1" WHERE `item_id` = "' . $itm['item_id'] . '" AND `inOdet` > 0 AND `uid` = "' . $u->info['id'] . '" AND `delete` = "0" LIMIT 20'); - $u->error = 'Вы успешно использовали заклинание "' . $itm['name'] . '" на "' . $usr['login'] . '"'; - } else { - $u->error = 'Вы не можете переманивать данного персонажа...'; - } - } elseif ($goodUse == 1) { - $us = $this->add_eff($usr['id'], $itm['magic_inc']); - if ($us[0] == 1) { - $mmmid = mysql_insert_id(); - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'); - if ($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); - } - if ($u->info['id'] != $usr['id']) { - $u->addDelo(1, $u->info['id'], '"System.inventory": Персонаж использовал заклинание "' . $itm['name'] . '" (' . $us[1] . ') на персонажа "' . $usr['login'] . '" (id' . $usr['id'] . ') [itm:' . $itm['id'] . '].', time(), $u->info['city'], 'System.inventory', 0, 0); - $u->addDelo(1, $usr['id'], '"System.inventory": Персонаж "' . $u->info['login'] . '" (id' . $u->info['id'] . ') использовал заклинание "' . $itm['name'] . '" (' . $us[1] . ') на персонажа [itm:' . $itm['id'] . '].', time(), $usr['city'], 'System.inventory', 0, 0); - $u->error = 'Вы успешно использовали заклинание "' . $itm['name'] . '" на персонажа "' . $usr['login'] . '"
' . $us[1] . ''; - } else { - $u->addDelo(1, $u->info['id'], '"System.inventory": Персонаж использовал заклинание "' . $itm['name'] . '" (' . $us[1] . ') на персонажа самого себя [itm:' . $itm['id'] . '].', time(), $u->info['city'], 'System.inventory', 0, 0); - $u->error = 'Вы успешно использовали заклинание "' . $itm['name'] . '" на самого себя
' . $us[1] . ''; - - } - // - if ($usr['battle'] > 0) { - //Заносим в лог - $txt_m = ''; - if ($u->info['sex'] == 0) { - if ($u->info['id'] != $usr['id']) { - $txt_m .= '{u1} воспользовался магией "' . $itm['name'] . '" на {u2}.'; - } else { - $txt_m .= '{u1} воспользовался магией "' . $itm['name'] . '" на себя.'; - } - } else { - if ($u->info['id'] != $usr['id']) { - $txt_m .= '{u1} воспользовалась магией "' . $itm['name'] . '" на {u2}.'; - } else { - $txt_m .= '{u1} воспользовалась магией "' . $itm['name'] . '" на себя.'; - } - } - $this->inBattleLog($txt_m, $usr); - // - //По завершению боя эффект должен слетать - //306 - положительное , 307 - отрицательное - if ($tpsm == 1) { - //306 - mysql_query('UPDATE `eff_users` SET `v1` = "priem",`v2` = "306",`timeUse` = "77",`hod` = "-1",`img2` = "' . $itm['img'] . '" WHERE `id` = "' . $mmmid . '" LIMIT 1'); - } elseif ($tpsm == 2) { - //307 - mysql_query('UPDATE `eff_users` SET `v1` = "priem",`v2` = "307",`timeUse` = "77",`hod` = "-1",`img2` = "' . $itm['img'] . '" WHERE `id` = "' . $mmmid . '" LIMIT 1'); - } - // - } - // - $this->youuse++; - } else { - $u->error = 'Не удалось использовать "' . $itm['name'] . '" ... (' . $itm['magin_inc'] . ' and ' . $itm['magic_inci'] . ', Эффект не добавлен)'; - } - } else { - $u->error = 'Не удалось использовать "' . $itm['name'] . '"'; - } - } - } - } else { - $u->error = 'Персонаж "' . $jl . '" не найден в этом городе (' . $u->info['city'] . ')'; - } - } elseif (isset($st['useOnItem']) && $st['useOnItem'] == 1) { - //используем на предмет - - } else { - //на себя - $goodUse = 1; - if (($u->info['align'] == 2 || $u->info['haos'] > time()) && isset($st['nohaos'])) { - $goodUse = 0; - $u->error = 'Хаосники не могут использовать данное заклятие'; - } - - if ($itm['magic_inci'] == 'sanich2') { - if ($u->info['battle'] == 0) { - $sz = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `vars` = "sanich2" AND `time` > ' . (time() - 4 * 60 * 60) . ' LIMIT 1', 1); - if (!isset($sz['id'])) { - $slech = rand(0, 4); - $goodUse = 0; - if ($slech == 1) { - //3083 Настойка на жучьей требухе - //$this->add_eff($u->info['id'],3083); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = 290 AND `delete` =0'); - $this->add_eff($u->info['id'], 290); - $echotext = 'Настойка на жучьей требухе!'; - $u->error = 'Вы получили эфект от ' . $echotext . ''; - } elseif ($slech == 2) { - //5239 Амброзия подмастерья Владык - //$this->add_eff($u->info['id'],5239); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = 472 AND `delete` =0'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = 470 AND `delete` =0'); - $this->add_eff($u->info['id'], 472); - $echotext = 'Амброзия подмастерья Владык!'; - $u->error = 'Вы получили эфект от ' . $echotext . ''; - } elseif ($slech == 3) { - //5069 Амброзия Скучающих Владык - //$this->add_eff($u->info['id'],470); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = 472 AND `delete` =0'); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = 470 AND `delete` =0'); - $this->add_eff($u->info['id'], 470); - $echotext = 'Амброзия Скучающих Владык!'; - $u->error = 'Вы получили эфект от ' . $echotext . ''; - } elseif ($slech == 4) { - //1463 Звездное Сияние - //$this->add_eff($u->info['id'],1463); - mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $u->info['id'] . '" AND `id_eff` = 35 AND `delete` =0'); - $this->add_eff($u->info['id'], 35); - $echotext = 'Звездное Сияние!'; - $u->error = 'Вы получили эфект от ' . $echotext . ''; - } else { - $slech = 1; - - $echotext = 'Не удалось прочитать страницу!'; - $u->error = ' ' . $echotext . ' '; - } - - $itm['iznosNOW'] += $slech; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'); - $u->addAction(time(), 'sanich2', $slech); - - if ($u->info['sex'] == 1) { - $rtxt = '[img[items/' . $itm['img'] . ']] "' . $u->info['login'] . '" использовала "' . $itm['name'] . ' Саныча" и получила эффект ' . $echotext . ' травмы.'; - } else { - $rtxt = '[img[items/' . $itm['img'] . ']] "' . $u->info['login'] . '" использовал "' . $itm['name'] . ' Саныча" и получил эффект ' . $echotext . ' травмы.'; - } - - } else { - $u->error = 'Задержка использования ' . $u->timeOut(($sz['time'] + 4 * 60 * 60) - time()) . '.'; - } - } else { - $u->error = 'Невозможно использовать в бою'; - } - - } elseif ($itm['magic_inci'] == 'sanich1' && $u->info['battle'] > 0) { - - $sz = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `vars` = "sanich1" AND `time` > ' . (time() - 6 * 60) . ' LIMIT 1', 1); - if (!isset($sz['id'])) { - $goodUse = 0; - $u->error = 'Вы успешно использовали "' . $itm['name'] . '"'; - $z = 1; - while ($z <= 5) { - $u->info['tactic' . $z]++; - if ($u->info['tactic' . $z] > 25) { - $u->info['tactic' . $z] = 25; - } elseif ($u->info['tactic' . $z] < 0) { - $u->info['tactic' . $z] = 0; - } - $z++; - } - if ($u->info['sex'] == 1) { - $this->inBattleLog('{u1} использовала "' . $itm['name'] . ' Саныча".'); - } else { - $this->inBattleLog('{u1} использовал "' . $itm['name'] . ' Саныча".'); - } - mysql_query('UPDATE `stats` SET `tactic1` = "' . $u->info['tactic1'] . '",`tactic2` = "' . $u->info['tactic2'] . '",`tactic3` = "' . $u->info['tactic3'] . '",`tactic4` = "' . $u->info['tactic4'] . '",`tactic5` = "' . $u->info['tactic5'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'); - $u->addAction(time(), 'sanich1', $u->info['battle']); - } else { - $u->error = 'Задержка использования ' . $u->timeOut(($sz['time'] + 6 * 60) - time()) . '.'; - } - - } elseif ($itm['magic_inci'] == 'sanich3' && $u->info['battle'] > 0) { - - $sz = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `vars` = "sanich3" AND `time` > ' . (time() - 3 * 60 * 60) . ' LIMIT 1', 1); - if (!isset($sz['id'])) { - - $usr = mysql_fetch_array(mysql_query('SELECT `u`.`id`,`u`.`level`,`s`.`hpNow`,`s`.`team`,`u`.`login`,`u`.`sex` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `u`.`id` = "' . $u->info['enemy'] . '" AND `u`.`battle` = "' . $u->info['battle'] . '" LIMIT 1')); - if (isset($usr['id']) && $usr['hpNow'] >= 1) { - $iznslvl = $usr['level']; - - $goodUse = 0; - $u->error = 'Вы успешно использовали "' . $itm['name'] . '" на ' . $usr['login'] . ''; - - if ($u->info['sex'] == 1) { - $this->inBattleLog('{u1} использовала "' . $itm['name'] . ' Саныча" на {u2}.', $usr); - } else { - $this->inBattleLog('{u1} использовал "' . $itm['name'] . ' Саныча" на {u2}.', $usr); - } - - mysql_query('UPDATE `stats` SET `hpNow` = "' . $usr['hpNow'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - mysql_query('UPDATE `stats` SET `hpNow` = "' . $u->stats['hpNow'] . '" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'); - $itm['iznosNOW'] += $iznslvl; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'); - $u->addAction(time(), 'sanich3', $u->info['battle']); - } else { - $u->error = 'Нет подходящего противника'; - } - - } else { - $u->error = 'Задержка использования ' . $u->timeOut(($sz['time'] + 3 * 60 * 60) - time()) . '.'; - } - - } elseif ($itm['magic_inci'] == 'lech') { - $goodUse = 0; - if ($u->info['level'] >= 2 and $u->info['level'] <= 13) { - $travm = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid`="' . $u->info['id'] . '" and `id_eff`="4" and `delete`="0" LIMIT 1')); - if ($travm && $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} использовал "' . $itm['name'] . '" и породил клона.'; - } else { - $txt_m = '{u1} использовала "' . $itm['name'] . '" и породила клона.'; - } - $this->inBattleLog($txt_m, null); - if ($u->info['sex'] == 0) { - $txt_m = '' . $u->info['login'] . ' (клон ' . $bot_cou . ')[' . $u->info['level'] . '] вмешался в поединок!'; - } else { - $txt_m = '' . $u->info['login'] . ' (клон ' . $bot_cou . ')[' . $u->info['level'] . '] вмешалась в поединок!'; - } - $this->inBattleLog($txt_m, $usr_m); - mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . ($itm['iznosNOW'] + 1) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); - mysql_query('UPDATE `items_users` SET `btl_zd` = "1" WHERE `item_id` = "' . $itm['item_id'] . '" AND `inOdet` > 0 AND `uid` = "' . $u->info['id'] . '" AND `delete` = "0" LIMIT 20'); - $u->error = 'Заклятие "' . $itm['name'] . '" было успешно использовано'; - } else { - $u->error = 'Неудалось использовать заклятие...'; - } - unset($txt_m, $usr_m, $clone, $bot_cou, $bot); - } - - } elseif ($itm['magic_inci'] == 'scan') { - if ($u->info['inTurnir'] != 0) { - $sp = mysql_query('SELECT `st`.*, `u`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `inTurnir` = "' . $u->info['inTurnir'] . '"'); - while ($pl = mysql_fetch_array($sp)) { - $rrm = mysql_fetch_array(mysql_query('SELECT * FROM `bs_map` WHERE `x` = "' . $pl['x'] . '" AND `y` = "' . $pl['y'] . '"')); - $trnt .= $pl['login'] . ' Комната : ' . $rrm['name'] . ', '; - } - $trnt = rtrim($trnt, ', '); - $it_ = $u->addItem(2435, $u->info['id'], 'noodet=1|noremont=1|sudba=' . $u->info['login'] . ''); - mysql_query('UPDATE `items_users` SET `use_text` = 500 WHERE `id` = "' . $it_ . '" LIMIT 1'); - mysql_query('INSERT INTO `items_text` (`item_id`,`time`,`login`,`text`,`city`,`x`,`type`) VALUES ("' . $it_ . '","' . time() . '","","' . mysql_real_escape_string($trnt) . '","' . $u->info['city'] . '","1","1")'); - mysql_query('DELETE FROM `items_users` WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); - $u->error = 'Вы получили выписку...'; - - } else { - $u->error = 'Используется только в Башне смерти...'; - } - } elseif ($itm['magic_inci'] == 'tactic') { - //Выдаем тактику - if ($u->stats['hpNow'] >= 1) { - - $bu = mysql_fetch_array(mysql_query('SELECT * FROM `tactic` WHERE `btl` = "' . $u->info['battle'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1')); - if (isset($bu['id'])) { - $u->error = 'Нельзя использовать свиток каждый ход...'; - } else { - // - mysql_query('INSERT INTO `tactic` (`btl`,`uid`,`time`,`item_id`,`var`,`hod`) VALUES ("' . $u->info['battle'] . '","' . $u->info['id'] . '","' . time() . '","' . $itm['item_id'] . '","' . $itm['name'] . '","1")'); - // - mysql_query('INSERT INTO `battle_actions` (`uid`,`btl`,`time`,`vars`,`vals`) VALUES ( - "' . $u->info['id'] . '","' . $u->info['battle'] . '","' . time() . '","use_cast_tactic","" - )'); - $u->info['tactic' . $st['addtac']] += $st['addtacv']; - mysql_query('UPDATE `stats` SET `tactic' . $st['addtac'] . '` = "' . $u->info['tactic' . $st['addtac']] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - //Доабвляем лог - if ($u->info['sex'] == 0) { - $txt_m = '{u1} применил заклинание "' . $itm['name'] . '".'; - } else { - $txt_m = '{u1} применила заклинание "' . $itm['name'] . '".'; - } - $this->inBattleLog($txt_m, null); - mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . ($itm['iznosNOW'] + 1) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); - $u->error = 'Заклятие "' . $itm['name'] . '" было успешно использовано'; - } - } else { - $u->error = 'Вы погибли...'; - } - } elseif ($itm['magic_inci'] == 'add_animal') { - if ($u->info['animal'] > 0) { - $u->error = 'Не удалось использовать "' . $itm['name'] . '", у Вас уже есть зверь.'; - } else { - $anm = ['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'] . '" и помните - "Мы в ответе за тех, кого приручили".'; - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'); - if ($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); - } - $u->addDelo(1, $u->info['id'], '"System.inventory": Персонаж использовал заклинание "' . $itm['name'] . '" (' . $us[1] . ') [itm:' . $itm['id'] . '].', time(), $u->info['city'], 'System.inventory', 0, 0); - } else { - $u->error = 'Не удалось использовать "' . $itm['name'] . '", что-то здесь не так ...'; - } - } - } elseif ($goodUse == 1) { - if ($itm['magic_inc'] == '') { - $itm['magic_inc'] = $itm['magic_inci']; - } - $us = $this->add_eff($u->info['id'], $itm['magic_inc']); - if ($us[0] == 1) { - $itm['iznosNOW']++; - mysql_query('UPDATE `items_users` SET `iznosNOW` = "' . $itm['iznosNOW'] . '" WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'); - if ($itm['inGroup'] > 0 && $itm['delete'] == 0) { - mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'); - } - $u->addDelo(1, $u->info['id'], '"System.inventory": Персонаж использовал заклинание "' . $itm['name'] . '" (' . $us[1] . ') [itm:' . $itm['id'] . '].', time(), $u->info['city'], 'System.inventory', 0, 0); - $this->youuse++; - $u->error = 'Вы успешно использовали заклинание "' . $itm['name'] . '"
' . $us[1] . ''; - } else { - if ($u->error != '') { - $u->error = 'Не удалось использовать "' . $itm['name'] . '"...
' . $u->error; - } else { - $u->error = 'Не удалось использовать "' . $itm['name'] . '"...'; - } - } - } else { - if ($u->error != '') { - $u->error = 'Не удалось использовать "' . $itm['name'] . '"
' . $u->error; - } else { - $u->error = 'Не удалось использовать "' . $itm['name'] . '"'; - } - } - } - //------------------------------ - } - } - if ($goodUse == 1) { - mysql_query('UPDATE `items_users` SET `lastUPD` = ' . time() . ' WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'); - } - } else { - if ($id == 5555) { - mysql_query('UPDATE `stats` SET `seff` = 0 WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - $u->error = 'Эфекты развернуты'; - - } elseif ($id == 7777) { - mysql_query('UPDATE `stats` SET `seff` = 1 WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); - $u->error = 'Эфекты свернуты'; - } else { - $u->error = 'Предмет не найден в инвентаре'; - } - - } - } - - - public function add_eff($uid, $id, $is_no = null) - { - $g = [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 = ' {u1} напал на {u2} завязался бой »»'; - } else { - $text = ' {u1} напала на {u2} завязался бой »»'; - } - $usr_real = mysql_fetch_array(mysql_query('SELECT `id`, `login`, `align`, `clan`, `battle`, `level` FROM `users` WHERE (`inUser` = "' . $usr['id'] . '" OR `id` = "' . $usr['id'] . '") LIMIT 1')); - if (!isset($usr_real['id'])) { - $usr_real = $usr; - } - if (isset($usr_real['id'])) { - $usrreal = ''; - if ($usr_real['align'] > 0) { - $usrreal .= ''; - } - if ($usr_real['clan'] > 0) { - $usrreal .= ''; - } - $usrreal .= '' . $usr_real['login'] . '[' . $usr_real['level'] . ']'; - } else { - $usrreal = 'Невидимка[??]'; - } - $me_real = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `inUser` = "' . $u->info['id'] . '" AND `login` = "' . $u->info['login'] . '" LIMIT 1')); - if (isset($me_real['id'])) { - $mereal = ''; - if ($me_real['align'] > 0) { - $mereal .= ''; - } - if ($me_real['clan'] > 0) { - $mereal .= ''; - } - $mereal .= '' . $me_real['login'] . '[' . $me_real['level'] . ']'; - } else { - $mereal = 'Невидимка[??]'; - } - $text = str_replace('{u1}', $mereal, $text); - $text = str_replace('{u2}', $usrreal, $text); - mysql_query('INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( - "1", "' . mysql_real_escape_string($text) . '", "' . time() . '", "' . $bs['id'] . '", "' . $bs['count'] . '", "' . $bs['city'] . '", - "' . round($bs['money'] * 0.85, 2) . '","' . $i . '")'); - unset($text, $usrreal, $mereal, $usr_real, $me_real); - } - } - } - } elseif (isset($btl_test['id']) && $btl_test['type'] == 500 && $usr['team'] == 1) { - $u->error = 'Нельзя сражаться на стороне монстров!'; - } elseif (isset($btl_test['id']) && $btl_test['type'] == 250 && $u->info['clan'] != $btl_test['clan1'] && $u->info['clan'] != $btl_test['clan2']) { - $u->error = 'Нельзя попасть в клановые бои - если вы неявляетесь представителем данных кланов!!!'; - } elseif (isset($btl_test['id']) && $btl_test['invis'] > 0) { - $u->error = 'Нельзя вмешиваться в невидимый бой!'; - } elseif ($btl_test['noatack'] > 0) { - $u->error = 'В этот поединок нельзя вмешиваться!'; - } else { - - //вмешиваемся в бой - //effect ненападения - if ($usr['no_ip'] == 'trupojor') { - mysql_query('INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","479","112","' . $u->info['id'] . '","Защита от нападения","zashitatk=1","' . time() . '")'); - } - $upd = mysql_query('UPDATE `users` SET `battle`="' . $btl . '" WHERE `id` = "' . $uid1 . '" LIMIT 1'); - if ($upd) { - - if ($kulak > 0 || $btl_test['kulak'] > 0) { - mysql_query('UPDATE `items_users` SET `inOdet` = "0" WHERE `uid` = "' . $uid1 . '" AND `delete` = "0"'); - } - - $uid1st = $u->getStats($uid1); - $uid1u = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`level`,`clan`,`align`,`sex` FROM `users` WHERE `id` = "' . $uid1 . '" LIMIT 1')); - - if ($uid1u['level'] <= 7) { - $uid1st['tactic7'] = floor((10 + $uid1st['s7']) / $uid1st['hpAll'] * $uid1st['hpNow']); - } elseif ($uid1u['level'] == 8) { - $uid1st['tactic7'] = floor((20 + $uid1st['s7']) / $uid1st['hpAll'] * $uid1st['hpNow']); - } elseif ($uid1u['level'] == 9) { - $uid1st['tactic7'] = floor((30 + $uid1st['s7']) / $uid1st['hpAll'] * $uid1st['hpNow']); - } elseif ($uid1u['level'] >= 10) { - $uid1st['tactic7'] = floor((40 + $uid1st['s7']) / $uid1st['hpAll'] * $uid1st['hpNow']); - } else { - $uid1st['tactic7'] = floor((10 + $uid1st['s7']) / $uid1st['hpAll'] * $uid1st['hpNow']); - } - - //Духовность, спасение - if ($uid1st['s7'] > 49) { - mysql_query('UPDATE `eff_users` SET `delete`="' . time() . '" WHERE `uid` = "' . $uid1st['id'] . '" AND `overType` = 101 AND `delete` = 0'); - mysql_query(" - INSERT INTO `eff_users` ( `id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES - ( 22, '" . $uid1st['id'] . "', 'Спасение', 'add_spasenie=1', 101, 77, 0, '" . $uid1st['id'] . "', 0, 'priem', 324, 'preservation.gif', 1, -1, 'спасение', 0, 0, '', 0, 0, 0, 1, 0); - "); - } - - - $btxt = ''; - if ($uid1u['align'] > 0) { - $btxt = $btxt . ''; - } - if ($uid1u['align2'] > 0) { - $btxt = $btxt . ''; - } - if ($uid1u['clan'] > 0) { - $btxt = $btxt . ''; - } - $btxt = $btxt . '{u1}[' . $uid1u['level'] . ']'; - if ($uid1u['sex'] == 1) { - $btxt = $btxt . ' вмешалась в поединок.'; - } else { - $btxt = $btxt . ' вмешался в поединок.'; - } - - if ($kulak > 0) { - $btxt .= ' (Кулачное нападение)'; - } - - $lastHOD = mysql_fetch_array(mysql_query('SELECT * FROM `battle_logs` WHERE `battle` = "' . $btl . '" ORDER BY `id_hod` DESC LIMIT 1')); - if (isset($lastHOD['id'])) { - $id_hod = $lastHOD['id_hod']; - if ($lastHOD['type'] != 6) { - $id_hod++; - } - mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time() . '","' . $btl . '","' . ($id_hod) . '","{tm1} ' . $btxt . '","login1=' . $uid1st['login'] . '||t1=' . $uid1st['team'] . '||login2=' . $uid1st['login'] . '||t2=' . $uid1st['team'] . '||time1=' . time() . '","","","","","6")'); - } - - // Бафф Зверя animal_bonus --------------------------------- - if ($u->info['animal'] > 0) { - $a = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal` WHERE `uid` = "' . $u->info['id'] . '" AND `id` = "' . $u->info['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1')); - if (isset($a['id'])) { - if ($a['eda'] >= 1) { - $anl = mysql_fetch_array(mysql_query('SELECT `bonus` FROM `levels_animal` WHERE `type` = "' . $a['type'] . '" AND `level` = "' . $a['level'] . '" LIMIT 1')); - $anl = $anl['bonus']; - - $tpa = [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'], '' . $a['name'] . ' нуждается в еде...', 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 = ' {u1} вмешался в поединок против {u2} »»'; - } else { - $text = ' {u1} вмешалась в поединок против {u2} »»'; - } - $usr_real = mysql_fetch_array(mysql_query('SELECT `id`, `login`, `align`, `clan`, `battle`, `level` FROM `users` WHERE `inUser` = "' . $usr['id'] . '" LIMIT 1')); - if (!isset($usr_real['id'])) { - $usr_real = $usr; - } - if (isset($usr_real['id'])) { - $usrreal = ''; - if ($usr_real['align'] > 0) { - $usrreal .= ''; - } - if ($usr_real['clan'] > 0) { - $usrreal .= ''; - } - $usrreal .= '' . $usr_real['login'] . '[' . $usr_real['level'] . ']'; - } else { - $mereal = 'Невидимка[??]'; - } - $me_real = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `inUser` = "' . $u->info['id'] . '" AND `login` = "' . $u->info['login'] . '" LIMIT 1')); - if (isset($me_real['id'])) { - $mereal = ''; - if ($me_real['align'] > 0) { - $mereal .= ''; - } - if ($me_real['clan'] > 0) { - $mereal .= ''; - } - $mereal .= '' . $me_real['login'] . '[' . $me_real['level'] . ']'; - } else { - $mereal = 'Невидимка[??]'; - } - $text = str_replace('{u1}', $mereal, $text); - $text = str_replace('{u2}', $usrreal, $text); - mysql_query('INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( - "1", "' . mysql_real_escape_string($text) . '", "' . time() . '", "' . $bs['id'] . '", "' . $bs['count'] . '", "' . $bs['city'] . '", - "' . round($bs['money'] * 0.85, 2) . '","' . $i . '")'); - unset($text, $usrreal, $mereal, $usr_real, $me_real); - } - } - } - return $good; - } -} diff --git a/_incl_data/class/Priems.php b/_incl_data/class/Priems.php deleted file mode 100644 index e3a8abdc..00000000 --- a/_incl_data/class/Priems.php +++ /dev/null @@ -1,2848 +0,0 @@ -users[]['eff'] , 1 -*/ - -class Priems -{ - private $btl; - private $u; - const FIRE = 'fire'; - const WATER = 'water'; - const AIR = 'air'; - const EARTH = 'earth'; - private $mname = [ - '' => 1, - '' => 2, - '' => 3, - '' => 4, - '' => 5, - '' => 6, - '' => 7, - ]; - public $ue = []; - private $logColor = [ - 'crit' => '#f00', - 'miss' => '#888', - self::FIRE => '#a00', - self::WATER => '#00a', - self::EARTH => '#0a0', - self::AIR => '#0af', - ]; - - public function __construct() - { - global $btl; - $this->btl = $btl; - $this->u = User::start(); - } - - /**@deprecated try to use getDynamicInfo()*/ - private function getdr($s, $v, $d) - { - $i = 0; - while ($i < count($v)) { - if (isset($v[$i])) { - $s = str_replace('{' . $v[$i] . '}', $d[$i], $s); - } - $i++; - } - $s = eval("return (" . $s . ");"); - return floor($s); - } - - /** - * @param $match - * @return false|float - */ - private function getDynamicInfo($match) - { - $tmpl = [ - 'lvl1' => $this->u->info['level'], - 'ts5' => $this->u->stats['s5'], - 'mpAll' => $this->u->stats['mpAll'], - ]; - foreach ($tmpl as $k => $v) { - $match = str_ireplace('{' . $k . '}', $v, $match); - } - $p = $match[2]; - - if (preg_match('/(\d+)(?:\s*)([+\-*\/])(?:\s*)(\d+)/', $match[2], $matches) !== false) { - $operator = $matches[2]; - - switch ($operator) { - case '+': - $p = $matches[1] + $matches[3]; - break; - case '-': - $p = $matches[1] - $matches[3]; - break; - case '*': - $p = $matches[1] * $matches[3]; - break; - case '/': - $p = $matches[1] / $matches[3]; - break; - default: - } - } - return floor($p); - } - - - /** - * @param int $uid 0, id . - * @return void - */ - public function addAirStaticPoints($uid = 0) - { - if ($uid == 0) { - $uid = $this->ue['id']; - } - $x = Db::getValue( - 'select x from eff_users where uid = ? and `delete` = 0 and v2 = 260 and user_use = ? order by id desc limit 1', - [$uid, $this->u->info['id']] - ); - if (empty($x) || $x >= 5) { - return; - } - $x++; - $data['add_mg2static_points'] = $x; - $data = $this->impStats($data); - Db::sql( - 'update eff_users set x = ?, data = ? where uid = ? and `delete` = 0 and v2 = 260 and user_use = ?', - [$x, $data, $uid, $this->u->info['id']] - ); - } - - /** - * @param $uid - * @param $mp - * @param $tp [not used] - * @return bool - */ - public function minMana($uid, $mp, $tp = null) - { - global $btl; - /* , $mp > 0 */ - // ss - $mp -= round($mp / 100 * $btl->stats[$btl->uids[$uid]]['min_use_mp']); - $btl->stats[$btl->uids[$uid]]['mpNow'] -= $mp; - $mpNow = $this->zeromax($btl->stats[$btl->uids[$uid]]['mpNow'], $btl->stats[$btl->uids[$uid]]['mpAll']); - if ($mpNow > 0) { - Db::sql( - 'update stats set mpNow = ? where id = ?', - [$btl->stats[$btl->uids[$uid]]['mpNow'], $uid] - ); - } - return $mpNow > 0; - } - - /** - . - * @param $l2 - * @param $t - * @return int - */ - public function magKrit($l2, $t) - { - $r = $l2 * 2 - 7; - if ($r > $t) { - // ( , 2 ) 6% - //250 . 1% - //$r = -1; , -- - $r = 0; - } else { - // 3% - $r = ceil($t * 0.75); - if ($r > 30) { - $r = 30; - } - if (rand(0, 10000) < $r * 100) { - // - $r = 1; - } else { - $r = 0; - } - } - return $r; - } - - /** - * @param $eff - * @param $pr - * @return bool - */ - public function hodUsePriem($eff, $pr) - { - global $btl; - $return_main = true; - $ue = Db::getRow( - 'select * from users left join stats on (users.id = stats.id) where users.id = ? and battle = ? and hpNow > 0', - [$eff['uid'], $btl->info['id']] - ); - - if (!empty($pr['file'])) { - if (file_exists('../../_incl_data/class/priems/' . $pr['file'] . '.php')) { - $hod = $eff['hod']; - require_once 'priems/' . $pr['file'] . '.php'; - } - } elseif (!empty($pr['file3'])) { - if (file_exists('../../_incl_data/class/priems/' . $pr['file3'] . '.php')) { - $hod = $eff['hod']; - require_once 'priems/' . $pr['file3'] . '.php'; - } - } - return $return_main; - } - - /** data c add_m11=2*{lvl1} . - *
:
lvl1 = $uid[level]
ts5 = $uid[s5]
mpAll = $uid[mpAll] - * @param string $pl data - * @param int $uid , . - * @return string data . - */ - public function redate($pl, $uid) - { - global $btl; - $i = 0; - if ($pl != '') { - $e = explode('|', $pl); - while ($i < count($e)) { - $f = explode('=', $e[$i]); -// $f[1] = $this->getdr( -// $f[1], [0 => 'lvl1', 1 => 'ts5', 2 => 'mpAll'], [ -// 0 => $btl->users[$btl->uids[$uid]]['level'], -// 1 => $btl->stats[$btl->uids[$uid]]['s5'], -// 2 => $btl->stats[$btl->uids[$uid]]['mpAll'], -// ] -// ); - $f[1] = $this->getDynamicInfo($f[1]); - if ($f[0] != '' && $f[1] != '') { - $e[$i] = implode('=', $f); - } - $i++; - } - $pl = implode('|', $e); - } - return $pl; - } - - private function cancelEffects($effects_ids, $uid, Battle $btl) - { - $arr = explode(',', $effects_ids); - if (!is_array($arr) || empty($arr)) { - return; - } - foreach ($arr as $eid) { - if ($eid <= 0) { - continue; - } - $p = Db::getRow( - 'select * from eff_users where uid = ? and v1 = ? and v2 = ? and `delete` = 0', [$uid, 'priem', $eid] - ); - if (!$p['id']) { - continue; - } - $p['priem'] = Db::getRow('select * from priems where id = ?', [$eid]); - $btl->delPriem($p, $btl->users[$btl->uids[$uid]], 2); - } - } - - /* uid - - pr - id - data - , -1, 3 - d2 - 3 - tm - , 77 - - h - - "" - uu - id - tp - - */ - /** - * @param int $uid - * @param int $pr id - * @param int|string $data , -1, 3 - * @param int $d2 - * @param $tm - * @param int $h - * @param int $uu id - * @param $max - * @param $bj - * @param $tp - * @param $ch - * @param $rdt - * @param $tr_life_user - * @param $noupdatebtl - * @param $noplus - * @param $pname - * @return bool - */ - public function addPriem( - $uid, - $pr, - $data, - $d2, - $tm, - $h, - $uu, - $max, - $bj, - $tp = 0, - $ch = 0, - $rdt = 0, - $tr_life_user = 0, - $noupdatebtl = 0, - $noplus = 0, - $pname = null - ) { - global $btl; - //$pl = mysql_fetch_assoc(mysql_query('SELECT * FROM `priems` WHERE `id` = ' . (int)$pr)); - $pl = Db::getRow('select * from priems where id = ?', [$pr]); - - $r = false; - - if (!$pl['id']) { - return false; - } - - if ($data == -1) { - $data = $this->redate($pl['date3'], $this->u->info['id']); - } elseif ($d2 == 1) { - $data .= '|' . $this->redate($pl['date3'], $this->u->info['id']); - } - - $this->cancelEffects($pl['cancel_eff2'], $uid, $btl); - - if ($max <= 0) { - return false; - } - - if ($noplus == 0) { - if ($pl['zmu'] == 1) { - $num = Db::getRow( - 'select * from eff_users where bj = ? and user_use = ? and uid = ? and `delete` = 0', - [$bj, $this->u->info['id'], $uid] - ); - } else { - $num = Db::getRow( - 'select * from eff_users where bj = ? and uid = ? and `delete` = 0', - [$bj, $uid] - ); - } - } - - if (isset($num['id']) && ($num['user_use'] != $this->u->info['id'] && $pl['zmu'] != 2)) { - // - Db::sql( - 'update eff_users set `delete` = unix_timestamp() where id = ?', - [$num['id']] - ); - $i = 0; - while ($i < count($btl->stats[$btl->uids[$uid]]['effects'])) { - if ($btl->stats[$btl->uids[$uid]]['effects'][$i]['id'] == $num['id']) { - // - $btl->stats[$btl->uids[$uid]]['effects'][$i]['delete'] = time(); - } - $i++; - } - unset($num); - } - if (!isset($num['id'])) { - $q = 'insert into eff_users (tr_life_user, bj, user_use, hod, v2, img2, id_eff, uid, name, data, overType, timeUse, v1) values (?,?,?,?,?,?,?,?,?,?,?,?,?)'; - $image = !empty($pl['img']) ? $pl['img'] : $pl['id']; - $name = !empty($pname) ? $pname : $pl['name']; - $image .= '.gif'; - Db::sql( - $q, [floor($tr_life_user), $bj, $uu, $h, $pl['id'], $image, 22, $uid, $name, $data, 0, $tm, 'priem'] - ); - $lid = Db::lastInsertId(); - if ($lid) { - $r = true; - } - - /* $btl->eff */ - if ($noupdatebtl == 0) { - $btl->stats[$btl->uids[$uid]] = $this->u->getStats($uid, 0); - } - } elseif ($num['x'] < $max) { - // - $num['x']++; - $num['hod'] = $h; - if ($data != -1 && $data != '' && $d2 == 2) { - $num['data'] .= '|' . $data; - Db::sql( - 'update eff_users set x = x + 1, hod = ?, data = ? where id = ?', - [$h, $num['data'], $num['id']] - ); - } else { - Db::sql( - 'update eff_users set x = x + 1, hod = ? where id = ?', - [$h, $num['id']] - ); - } - $r = true; - } else { - // - $num['hod'] = $h; - if ($data != -1 && $data != '' && $d2 == 2) { - $num['data'] .= '|' . $data; - Db::sql("update eff_users set hod = ?, data = ? where id = ?", [$h, $num['data'], $num['id']]); - } else { - Db::sql( - 'update eff_users set hod = ? where id = ?', - [$h, $num['id']] - ); - } - $r = true; - } - - if (isset($num['id'])) { - foreach ($btl->stats[$btl->uids[$uid]]['effects'] as $effect) { - if ($effect['id'] != $num['id']) { - continue; - } - $effect['data'] = $num['data']; - $effect['hod'] = $num['hod']; - $effect['x'] = $num['x']; - } - } - - return $r; - } - - /** data ('a=1|b=2|c=3') [a=>1, b=>2, c=>3]. - * @param $m - * @return array - */ - public function lookStatsArray($m) - { - $arr = json_decode(str_replace(['=', '|'], ['":', ',"'], '{"' . $m . '}'), true); - return $arr ?: []; - } - - /** [a=>1, b=>2, c=>3] data ('a=1|b=2|c=3') . - * @param array $m - * @return string - */ - private function impStats(array $m) - { - $str = json_encode($m); - return $str ? str_replace(['":', ',"', '{"', '}'], ['=', '|'], $str) : ''; - } - - /** - * @param $data - * @param array $values - * @return string - */ - private function changeStatsData($data, array $values) - { - $arr = $this->lookStatsArray($data); - foreach ($values as $key => $value) { - $arr[$key] = $value; - } - return $this->impStats($arr); - } - - public function magicRegen($ue, $hpmin, $tmp, $pl, $eff, $rp = 0, $dp = 0, $krituet = true, $dopyrn = 0) - { - global $btl; - $rr = []; - $uen = $ue['id']; - $usu = $eff['user_use']; - if ($eff['user_use'] < 1) { - $usu = $this->u->info['id']; - } - $k = $this->magKrit($ue['level'], $btl->stats[$btl->uids[$usu]]['mg' . $tmp]); - - if (!$krituet) { - $k = 0; - } - - $hpmin = $this->testPower($btl->stats[$btl->uids[$usu]], $btl->stats[$btl->uids[$uen]], $hpmin, $tmp, 2); - $hpmin = round($hpmin); - - $dopyrn = $this->testPower($btl->stats[$btl->uids[$usu]], $btl->stats[$btl->uids[$uen]], $dopyrn, $tmp, 2); - $dopyrn = round($dopyrn); - - if ($btl->users[$btl->uids[$uen]]['tactic7'] <= 0 && $dp == 0) { - $hpmin = 0; - $k = -1; - $dopyrn = 0; - } - if ($k == 1 && $hpmin != 0 && $krituet) { - // - $hpmin = $hpmin * 2; - } elseif ($k == -1 && $hpmin != 0) { - // - $hpmin = $hpmin / 2; - $dopyrn = $dopyrn / 2; - } - if ($hpmin < 1) { - $hpmin = 0; - } else { - $hpmin = rand(($hpmin * 0.97), $hpmin); - } - - $hpmin += floor($dopyrn); - - if (isset($btl->stats[$btl->uids[$uen]]['min_heal_proc'])) { - if ($btl->stats[$btl->uids[$uen]]['min_heal_proc'] > 100) { - $btl->stats[$btl->uids[$uen]]['min_heal_proc'] = 100; - } - $hpmin = round($hpmin / 100 * (100 + $btl->stats[$btl->uids[$uen]]['min_heal_proc'])); - } - - if ($btl->users[$btl->uids[$uen]]['tactic7'] > 0 && $dp == 0) { - // , - $btl->users[$btl->uids[$uen]]['tactic7'] -= $hpmin / $btl->stats[$btl->uids[$uen]]['hpAll']; - $btl->users[$btl->uids[$uen]]['tactic7'] = round($btl->users[$btl->uids[$uen]]['tactic7'], 2); - $btl->stats[$btl->uids[$uen]]['tactic7'] = $btl->users[$btl->uids[$uen]]['tactic7']; - if ($uen == $this->u->info['id']) { - $this->u->info['tactic7'] = $btl->users[$btl->uids[$uen]]['tactic7']; - $this->u->stats['tactic7'] = $btl->users[$btl->uids[$uen]]['tactic7']; - } - if ($btl->users[$btl->uids[$uen]]['tactic7'] < 0) { - $btl->users[$btl->uids[$uen]]['tactic7'] = 0; - } - } - $hp2 = floor($btl->stats[$btl->uids[$uen]]['hpNow'] + $hpmin); - - if ($hp2 > $btl->stats[$btl->uids[$uen]]['hpAll']) { - $hpmin = floor($hp2 - $btl->stats[$btl->uids[$uen]]['hpAll']); - $hp2 = $btl->stats[$btl->uids[$uen]]['hpAll']; - } elseif ($hp2 < 0) { - $hp2 = 0; - } - $rr[0] = $hpmin; // - $rr[1] = $k; // - /* */ - // - $miny = 0; // ( ) - $minu = 0; - $sp1 = mysql_query( - 'SELECT `e`.* FROM `eff_users` AS `e` WHERE `e`.`uid` = "' . $uen . '" AND `e`.`id_eff` = "22" AND `e`.`delete` = "0" AND `e`.`v1` = "priem" LIMIT 25' - ); - while ($pl2 = mysql_fetch_assoc($sp1)) { - $pl2['priem'] = mysql_fetch_assoc( - mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $pl2['v2'] . '" LIMIT 1') - ); - if (isset($pl2['priem']['id'])) { - $dt1 = $this->lookStatsArray($pl2['priem']['date2']); - if (isset($dt1['yron_u2'])) { - - $minu = $this->getdr( - $dt1['yron_u2'], [0 => 'lvl1', 1 => 'yr1', 2 => 'ts5', 3 => 'ts6'], - [0 => $btl->users[$btl->uids[$level]], 1 => $hpmin, 2 => 0, 3 => 0] - ); - $miny -= $minu; - $hpmin += $minu; - $btl->delPriem($pl2, $btl->users[$btl->uids[$uen]]); - } - } - } - - /* */ - - // - $btl->users[$btl->uids[$uen]]['hpNow'] = $hp2; - $btl->stats[$btl->uids[$uen]]['hpNow'] = $hp2; - mysql_query( - 'UPDATE `stats` SET `hpNow` = ' . $hp2 . ',`tactic7` = ' . $btl->users[$btl->uids[$uen]]['tactic7'] . ' WHERE `id` = "' . $uen . '" LIMIT 1' - ); - - // - $vLog = - 'time1=' . time() . - '||s1=' . $this->u->info['sex'] . - '||t1=' . $this->u->info['team'] . - '||login1=' . $this->u->info['login'] . - '||s2=' . $btl->users[$btl->uids[$uen]]['sex'] . - '||t2=' . $btl->users[$btl->uids[$uen]]['team'] . - '||login2=' . $btl->users[$btl->uids[$uen]]['login']; - $mas1 = [ - 'time' => time(), - 'battle' => $btl->info['id'], - 'id_hod' => ($btl->hodID + 1), - 'text' => '', - 'vars' => $vLog, - 'zona1' => '', - 'zonb1' => '', - 'zona2' => '', - 'zonb2' => '', - 'type' => '1', - ]; - if ($rp == 1) { - $mas1['id_hod']--; - } - - $btl->takeExp($this->u->info['id'], ($hpmin * 0.33), $this->u->info['id'], $uen, true); - - if ($hpmin > 0) { - $hpmin = '+' . ceil($hpmin); - } else { - $hpmin = '--'; - } - $tco = [1 => '006699', 2 => '006699', 3 => '006699', 4 => '006699']; // - $tcl = [1 => 'A00000', 2 => '008080', 3 => '0000FF', 4 => 'A52A2A']; // - $tco = $tco[$tmp]; - $tcl = $tcl[$tmp]; - if ($k == 1) { - // - $tco = 'FF0000'; - $tcl = 'FF0000'; - } elseif ($k == -1) { - // - $tco = '979797'; - $tcl = '979797'; - } - $nmz = [ - 1 => [0 => '', 1 => ''], - 2 => [0 => '', 1 => ''], - 3 => [0 => '', 1 => ''], - 4 => [0 => '', 1 => ''], - ]; - $nmz = $nmz[$tmp]; - - if ($rp == 1) { - $sx = [0 => '', 1 => '']; - $mas1['text'] = '{tm1} "' . $pl['name'] . '" {u2}. ' . $hpmin . ' [' . ceil( - $hp2 - ) . '/' . $btl->stats[$btl->uids[$uen]]['hpAll'] . ']'; - } else { - $mas1['text'] = '{tm1} {u1} {1x16x0} "' . $pl['name'] . '" {u2} ' . $nmz[0] . '. ' . $hpmin . ' [' . ceil( - $hp2 - ) . '/' . $btl->stats[$btl->uids[$uen]]['hpAll'] . ']'; - } - $btl->add_log($mas1); - $pz[(int)$id] = 1; - return $rr; - } - - /** magicAttack - * @return array - */ - private function hasGhostDefence($uid) - { - $def = [ - 'all' => false, - self::FIRE => false, - self::AIR => false, - self::EARTH => false, - self::WATER => false, - ]; - $priems = Db::getRows('select v2 from eff_users where uid = ? and v2 in (141, 142, 144, 145, 146)', [$uid]); - foreach ($priems as $priem) { - if ($priem['v2'] == 141) { - $def['all'] = true; - } - if ($priem['v2'] == 142) { - $def[self::FIRE] = true; - } - if ($priem['v2'] == 144) { - $def[self::AIR] = true; - } - if ($priem['v2'] == 145) { - $def[self::WATER] = true; - } - if ($priem['v2'] == 146) { - $def[self::EARTH] = true; - } - } - return $def; - } - - /** - * . - * [priem]. - * @param int $attackerId - * @param int $defenderId - * @param float $damage - * @param string $damageType (?) , . - * @param bool $hasCritical , - * @return array [0|damage] int , [1|crit] bool , [2|miss] bool , [3|miss_type] int ( = 2). - * @author Insallah - */ - public function magicAttack(Battle $btl, $attackerId, $defenderId, $damage, $damageType, $hasCritical = false) - { - // , . - . - $dmgRuNames = [ - self::FIRE => '', - self::WATER => '', - self::AIR => '', - self::EARTH => '', - ]; - if (in_array($damageType, array_keys($dmgRuNames))) { - $damageType = $dmgRuNames[$damageType]; - } - - // . - // pm# = . - // m11 = . - // m11a = . - // [pm# = m11 + m11a] - ! - $power = $btl->stats[$btl->uids[$attackerId]]['pm' . $this->mname[$damageType]]; - - // . - $suppression = 0; - $suppression += $btl->stats[$btl->uids[$attackerId]]['pzm']; - // , 250. - $suppression += $btl->stats[$btl->uids[$attackerId]]['yzm']; - - // . - $skills = $btl->stats[$btl->uids[$attackerId]]['mg' . $this->mname[$damageType]]; - - // - // zm# = - // zm = - // zma = - // [zm# = zm + zma] - ! - $defence = $btl->stats[$btl->uids[$defenderId]]['zm' . $this->mname[$damageType]]; - - // 100% . - // 8 - 20, : 8 10 . - $requiredSkills = $btl->users[$btl->uids[$defenderId]]['level'] * 2; - - // ׸ " ". - $isGarantCrit = $btl->stats[$btl->uids[$attackerId]]['acestar'] > 0; - - // , . - $supressedDefence = Math::addPercent($defence, -min($suppression, 100)); - - // . - $damage *= $skills - $requiredSkills; - - // , > 0. - $poweredDamage = $damage > 0 ? $damage + $power : 0; - - // - $isCritical = $hasCritical && $skills >= mt_rand(0, 100); - - if ($isGarantCrit) { - $isCritical = true; - Db::sql( - 'delete from eff_users where uid = ? and `delete` = 0 and data like ?', - [$attackerId, '%add_acestar%'] - ); - unset($q); - } - - if ($skills >= $requiredSkills || $isCritical) { - $isHit = true; - } else { - $isCritical = false; - $missChance = 3 * ($requiredSkills - $skills); - $isHit = mt_rand(0, 100) > $missChance; - } - - // . , - . - $pType = 0; - if ($isHit) { - // = - , 0. . - //$finalDamage = max(round(Math::addPercent($poweredDamage, -$supressedDefence)), 0); - $finalDamage = $poweredDamage - $supressedDefence; - if ($isCritical) { - $finalDamage *= 2; - } - } else { - $finalDamage = 0; - // . , - . - $pType = 2; - } - - // , . - $ghostDefences = $this->hasGhostDefence($defenderId); - if ($ghostDefences['all']) { - $finalDamage /= 4; - } - - // . , . - if (in_array($damageType, $dmgRuNames)) { - $damageType = array_search($damageType, $dmgRuNames); - } - - if ($ghostDefences[$damageType]) { - $finalDamage /= 2; - } - - $finalDamage = max(round($finalDamage), 0); - - // . - if ($btl->users[$btl->uids[$attackerId]]['admin'] > 0) { - $s = " : $suppression%, : $power, : $skills, -
: damage x ($skills - $requiredSkills)
$damageType - : ($defence -$suppression%) = $supressedDefence | - : ($damage +$power) = $poweredDamage
- : ($poweredDamage -$supressedDefence) = $finalDamage"; - $s .= $isCritical ? ' ( *2)' : ''; - echo "
$s
"; - } - - - // !isHit . - // pType , = 0 = 2 . - . - // -damage - . - return [ - (int)$finalDamage, - $isCritical, - !$isHit, - $pType, // - 'damage' => (int)$finalDamage, - 'crit' => $isCritical, - 'miss' => !$isHit, - 'miss_type' => $pType, - ]; - } - - /** . . */ - public function magatack($u1, $u2, $yron, $type, $krit) - { - global $btl; - return $this->magicAttack($btl, $u1, $u2, $yron, $type, $krit); - } - - public function magatackfiz($u1, $u2, $yron, $type, $krit, $ymelki) - { - global $btl; - $cof_mag = [ - 0 => 250, - 1 => 250, - 2 => 250, - 3 => 250, - 4 => 250, - 5 => 250, - 6 => 250, - 7 => 250, - 8 => 250, - 9 => 300, - 10 => 360, - 11 => 475, - 12 => 520, - 13 => 625, - 14 => 750, - 15 => 895, - 16 => 1075, - 17 => 1290, - 18 => 1550, - 19 => 1860, - 20 => 2230, - 21 => 2675, - ]; - - $r = $yron; - // - if (!isset($ymelki) || $ymelki == '0') { - $ymelki = $type; - } - // - $prm = [ - 'ym' => $btl->stats[$btl->uids[$u1]]['mg' . $this->mname[$ymelki]], // ( ) - 'y' => $btl->stats[$btl->uids[$u1]]['a' . $this->mname[$ymelki]], // - 'yv' => 0, //, . - 'max_krit' => 0 // - ]; - // - // ( )*2 - 7 - , - /* - / : * 2 9 - 3%. 30% - */ - // - /* - b - - m - - z - [.] - p - [.] - k - ; k=250 8, k=300 9 .. +20% - */ - $prm['b'] = $r; // - $prm['m'] = $btl->stats[$btl->uids[$u1]]['pa' . $this->mname[$type]]; // - $prm['z'] = $btl->stats[$btl->uids[$u2]]['za' . $this->mname[$type]]; // (.) - $prm['p'] = $btl->stats[$btl->uids[$u1]]['pza' . $this->mname[$type]]; // (.) - $prm['k'] = $cof_mag[$btl->users[$btl->uids[$u1]]['level']]; // - // - if ($prm['p'] * 10 > $prm['k']) { - $prm['p'] = floor($prm['k'] / 10); - } - // - $r = $prm['b'] * (1 + $prm['m'] / 100) * pow(2, (($prm['p'] * 10 - $prm['z']) / $prm['k'])); - if ($r < floor($prm['b'] * 0.2)) { - $r = floor($prm['b'] * 0.2); - } elseif ($r > floor($prm['b'] * 10)) { - $r = floor($prm['b'] * 10); - } - // - //$prm['y'] -= 5; - if ($type < $this->mname[$type]) { - $prm['yv'] = ($btl->users[$btl->uids[$u2]]['level'] * 2 - 7); - } else { - $prm['yv'] = ($btl->users[$btl->uids[$u2]]['level'] * 2 - 9); - } - // - if ($prm['y'] >= $prm['yv'] || (isset($this->mname[$ymelki]) && $prm['ym'] >= $prm['yv'])) { - if ($krit == 1) { - if (isset($this->mname[$ymelki])) { - $prm['max_krit'] = 3 * ($prm['ym'] - $prm['yv']); - } else { - $prm['max_krit'] = 3 * ($prm['y'] - $prm['yv']); - } - //echo '[Magical crit: '.$prm['max_krit'].'%]'; - if ($prm['max_krit'] < 0) { - $prm['max_krit'] = 0; - } elseif ($prm['max_krit'] > 30) { - $prm['max_krit'] = 30; - } - //$prm['max_krit'] = round($prm['max_krit']/2); - // - if (rand(0, 100) <= $prm['max_krit']) { - $krit = true; - } else { - $krit = false; - } - } else { - $krit = false; - } - $promah = false; - } else { - $krit = false; - // - $prm['promah'] = 3 * ($prm['yv'] - $prm['ym']); - if ($prm['promah'] < 0) { - $prm['promah'] = 0; - } elseif ($prm['promah'] > 30) { - $prm['promah'] = 30; - } - if (rand(0, 100) <= $prm['promah']) { - $promah = true; - } else { - $promah = false; - } - } - // - if ($krit) { - $r = $r * 2; - $promah_type = 0; - } elseif ($promah) { - $r = rand(1, floor($r / 4)); - $promah_type = 1; - if (rand(0, 100) < 50) { - $r = 0; - $promah_type = 2; - } - } - // - unset($prm); - // - return [floor($r), $krit, $promah, $promah_type]; - } - - // priems - public function magicAtack( - $ue, - $hpmin, - $tmp, - $pl, - $eff, - $rp = 0, - $mxx = 0, - $fiz = 0, - $nomf = 0, - $krituet = true, - $heal = 0, - $namenew = null - ) { - $trawm_off = false; - global $btl; - if ($namenew != null) { - $pl['name'] = $namenew; - } - $rr = []; - $nhpmin = $hpmin; - $uen = $ue['id']; - $usu = $eff['user_use']; - if ($eff['user_use'] < 1) { - $usu = $this->u->info['id']; - } - if ($nomf == 0) { - $k = $this->magKrit($ue['level'], $btl->stats[$btl->uids[$usu]]['mg' . $tmp]); - if (!$krituet) { - $k = 0; - } - if ($fiz == 0) { - // - $hpmin = $this->testPower( - $btl->stats[$btl->uids[$usu]], $btl->stats[$btl->uids[$uen]], $hpmin, $tmp, - 2 - ); - } else { - // - $wAp = $btl->stats[$btl->uids[$usu]]['pa' . $tmp . '']; - $wAp += $btl->stats[$btl->uids[$usu]]['m10']; - $wAp -= $btl->stats[$btl->uids[$uen]]['antpa' . $tmp . ''] * 1.75; - $wAp -= $btl->stats[$btl->uids[$uen]]['antm10'] * 1.75; - $hpmin += ceil((0.01 + $hpmin / 100) * (0.01 + 0.98 * $wAp)) - 1; - - $hpmin -= round( - $hpmin / 100 * (35 * ($btl->stats[$btl->uids[$uen]]['za'] + $btl->stats[$btl->uids[$uen]]['za' . $tmp]) / 1200) - ); - $hpmin = round($hpmin); - - if (isset($btl->stats[$btl->uids[$uen]]['zaproc']) || isset($btl->stats[$btl->uids[$uen]]['za' . $fiz . 'proc'])) // () - { - $hpmin = floor( - $hpmin / 100 * (100 - $btl->stats[$btl->uids[$uen]]['zaproc'] - $btl->stats[$btl->uids[$uen]]['za' . $fiz . 'proc']) - ); - if ($hpmin < 0) { - $hpmin = 0; - } - } - } - } - $hpmin = round($hpmin); - if ($k == 1 and $krituet) { - // - $hpmin = $hpmin * 2; - } elseif ($k == -1) { - // - $hpmin = $hpmin / 2; - } - if ($hpmin < $nhpmin * 0.2) { - $hpmin = $nhpmin * 0.2; - } - if ($hpmin < 1) { - $hpmin = 0; - } else { - if ($nomf == 0) { - $hpmin = rand(($hpmin * 0.97), $hpmin); - } - } - if ($mxx > 0 && $hpmin > $mxx) { - if ($k == 0) { - $hpmin = $mxx; - } elseif ($k == 1 && $hpmin / 2 > $mxx) { - $hpmin = $mxx * 2; - } - } - $rr[0] = $hpmin; // - $rr[1] = $k; // - /* */ - // - $miny = 0; // ( ) - $sp1 = mysql_query( - 'SELECT `e`.* FROM `eff_users` AS `e` WHERE `e`.`uid` = "' . $uen . '" AND `e`.`id_eff` = "22" AND `e`.`delete` = "0" AND `e`.`v1` = "priem" LIMIT 25' - ); - while ($pl2 = mysql_fetch_assoc($sp1)) { - $pl2['priem'] = mysql_fetch_assoc( - mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $pl2['v2'] . '" LIMIT 1') - ); - if (isset($pl2['priem']['id'])) { - $dt1 = $this->lookStatsArray($pl2['priem']['date2']); - if (isset($dt1['yron_u2'])) { - $minu = $this->getdr( - $dt1['yron_u2'], [0 => 'lvl1', 1 => 'yr1', 2 => 'ts5', 3 => 'ts6'], - [0 => $btl->users[$btl->uids[$level]], 1 => $hpmin, 2 => 1, 3 => 0] - ); - $miny -= $minu; - $hpmin += $minu; - if (isset($dt1['rzEndMg']) && $dt1['rzEndMg'] == 1) { - $btl->delPriem($pl2, $btl->users[$btl->uids[$uen]]); - } - } elseif (isset($dt1['rzEndMg']) && $dt1['rzEndMg'] == 1) { - $btl->delPriem($pl2, $btl->users[$btl->uids[$uen]]); - } - } - } - - $hpmin = $btl->testPogB($uen, $hpmin); - - $hp2 = floor($btl->stats[$btl->uids[$uen]]['hpNow'] - $hpmin); - - if ($btl->stats[$btl->uids[$usu]]['yrnhealmpprocmg' . $tmp] > 0 && $fiz == 0) { - // - $btl->stats[$btl->uids[$usu]]['mpNow'] += round( - $hpmin / 100 * $btl->stats[$btl->uids[$usu]]['yrnhealmpprocmg' . $tmp] - ); - //if($btl->stats[$btl->uids[$usu]]['mpNow'] > $btl->stats[$btl->uids[$usu]]['mpAll']) { - //$btl->stats[$btl->uids[$usu]]['mpNow'] = $btl->stats[$btl->uids[$usu]]['mpAll']; - //} - $btl->users[$btl->uids[$usu]]['mpNow'] = $btl->stats[$btl->uids[$usu]]['mpNow']; - if ($usu == $this->u->info['id']) { - $this->u->info['mpNow'] = $btl->stats[$btl->uids[$usu]]['mpNow']; - $this->u->stats['mpNow'] = $btl->stats[$btl->uids[$usu]]['mpNow']; - } - } - - if ($hp2 < 0) { - $hp2 = 0; - } elseif ($hp2 > $btl->stats[$btl->uids[$uen]]['hpAll']) { - $hp2 = $btl->stats[$btl->uids[$uen]]['hpAll']; - } - - $btl->stats[$btl->uids[$uen]]['last_hp'] = -floor($hpmin); - - if ($heal != 0) { - if ($heal == -1) { - // - $btl->stats[$btl->uids[$eff['user_use']]]['hpNow'] += $hpmin; - if ($btl->stats[$btl->uids[$eff['user_use']]]['hpNow'] < 0) { - $btl->stats[$btl->uids[$eff['user_use']]]['hpNow'] = 0; - } elseif ($btl->stats[$btl->uids[$eff['user_use']]]['hpNow'] > $btl->stats[$btl->uids[$eff['user_use']]]['hpAll']) { - $btl->stats[$btl->uids[$eff['user_use']]]['hpNow'] = $btl->stats[$btl->uids[$eff['user_use']]]['hpAll']; - } - - if ($eff['user_use'] == $this->u->info['id']) { - $this->u->stats['hpNow'] = $btl->stats[$btl->uids[$eff['user_use']]]['hpNow']; - } - - $btl->users[$btl->uids[$eff['user_use']]]['hpNow'] = $btl->stats[$btl->uids[$eff['user_use']]]['hpNow']; - - mysql_query( - 'UPDATE `stats` SET `hpNow` = "' . $btl->stats[$btl->uids[$eff['user_use']]]['hpNow'] . '" WHERE `id` = "' . $eff['user_use'] . '" LIMIT 1' - ); - } else { - // - - } - } - - /* */ - - // - $btl->users[$btl->uids[$uen]]['hpNow'] = $hp2; - $btl->stats[$btl->uids[$uen]]['hpNow'] = $hp2; - - if ($uen == $this->u->info['id']) { - $this->u->stats['hpNow'] = $hp2; - } - - // - if ($btl->info['type'] == 99 and $hp2 == 0 and !$trawm_off) { - //$eff['user_use'] - //$sp1 = mysql_query('SELECT `e`.* FROM `eff_users` AS `e` WHERE `e`.`uid` = "'.$uen.'" AND `e`.`id_eff` = "22" AND `e`.`delete` = "0" AND `e`.`v1` = "priem" LIMIT 25'); - - $trawm_off = true; - //$at[2][$i]['ttravm']=' .'; - $btl->addTravm($btl->users[$btl->uids[$uen]]['id'], 3, $btl->users[$btl->uids[$eff['user_use']]]['level']); - } - $upd = mysql_query( - 'UPDATE `stats` SET `hpNow` = ' . $hp2 . ',`last_hp` = "' . $btl->stats[$btl->uids[$uen]]['last_hp'] . '" WHERE `id` = "' . $uen . '" LIMIT 1' - ); - - // - $vLog = 'time1=' . time( - ) . '||s1=' . $btl->users[$btl->uids[$usu]]['sex'] . '||t1=' . $btl->users[$btl->uids[$usu]]['team'] . '||login1=' . $btl->users[$btl->uids[$usu]]['login'] . '||s2=' . $btl->users[$btl->uids[$uen]]['sex'] . '||t2=' . $btl->users[$btl->uids[$uen]]['team'] . '||login2=' . $btl->users[$btl->uids[$uen]]['login'] . ''; - $mas1 = [ - 'time' => time(), - 'battle' => $btl->info['id'], - 'id_hod' => ($btl->hodID + 1), - 'text' => '', - 'vars' => $vLog, - 'zona1' => '', - 'zonb1' => '', - 'zona2' => '', - 'zonb2' => '', - 'type' => '1', - ]; - if ($rp > 0) { - $mas1['id_hod']--; - } - $hpminkrit = 0; - if ($k == 1) { - $hpminkrit = $hpmin; - } - $btl->addNewStat( - [ - 'battle' => $this->u->info['battle'], - 'uid1' => $this->u->info['id'], - 'uid2' => $uen, - 'time' => time(), - 'type' => 0, - 'a' => '10000', - 'b' => 0, - 'type_a' => 1, - 'type_b' => 0, - 'ma' => 1, - 'mb' => 1, - 'yrn' => $hpmin, - 'yrn_krit' => $hpminkrit, - 'tm1' => $this->u->info['team'], - 'tm2' => $btl->users[$btl->uid[$uen]]['team'], - ] - ); - - $btl->takeExp($this->u->info['id'], $hpmin, $usu, $uen); - - if ($hpmin > 0) { - $hpmin = '-' . ceil($hpmin); - } else { - $hpmin = '--'; - } - $tco = [ - 1 => '006699', - 2 => '006699', - 3 => '006699', - 4 => '006699', - 5 => '006699', - 6 => '006699', - 7 => '006699', - ]; // - $tcl = [ - 1 => 'A00000', - 2 => '008080', - 3 => '0000FF', - 4 => 'A52A2A', - 5 => '006699', - 6 => '006699', - 7 => '006699', - ]; // - $tco = $tco[$tmp]; - $tcl = $tcl[$tmp]; - if ($k == 1) { - // - $tco = 'FF0000'; - $tcl = 'FF0000'; - } elseif ($k == -1) { - // - $tco = 'CCCCCC'; - $tcl = 'CCCCCC'; - } - $nmz = [ - 1 => [0 => '', 1 => ''], - 2 => [0 => '', 1 => ''], - 3 => [0 => '', 1 => ''], - 4 => [0 => '', 1 => ''], - 5 => [0 => '', 1 => ''], - 6 => [0 => '', 1 => ''], - 7 => [0 => ' ', 1 => ' '], - ]; - $nmz = $nmz[$tmp]; - if ($fiz > 0) { - $nmz = [ - 1 => [0 => ', , ', 1 => ''], - 2 => [0 => ', , ', 1 => ''], - 3 => [0 => ', , ', 1 => ''], - 4 => [0 => ', , ', 1 => ''], - ]; - $nmz = $nmz[$fiz]; - } - - if ($rp == 1) { - if ($k == 0) { - $tcl = '000000'; - $tco = '008000'; - } - $sx = [0 => '', 1 => '']; - $mas1['text'] = '{tm1} {u2} ' . $sx[$btl->users[$btl->uids[$uen]]['sex']] . ' "' . $pl['name'] . '". ' . $hpmin . ' [' . ceil( - $hp2 - ) . '/' . $btl->stats[$btl->uids[$uen]]['hpAll'] . ']'; - } else { - if ($fiz == 1) { - $mas1['text'] = '{tm1} {u1} {1x16x0} "' . $pl['name'] . '" {u2}. ' . $hpmin . ' [' . ceil( - $hp2 - ) . '/' . $btl->stats[$btl->uids[$uen]]['hpAll'] . ']'; - } else { - $mas1['text'] = '{tm1} {u1} {1x16x0} "' . $pl['name'] . '" ' . $nmz[0] . ' {u2}. ' . $hpmin . ' [' . ceil( - $hp2 - ) . '/' . $btl->stats[$btl->uids[$uen]]['hpAll'] . ']'; - } - } - $btl->add_log($mas1); - $pz[(int)$id] = 1; - return $rr; - } - - private function testActiv($id) - { - $r = 0; - if ( - $this->u->info['admin'] > 0 || - $this->u->info['nadmin'] > 0 || - $this->u->info['id'] > 0) { - $r = 1; - } else { - $tst = $this->u->testAction( - '`uid` = "' . $this->u->info['id'] . '" AND `time` < ' . time( - ) . ' AND `vars` = "read" AND `vals` = "' . $id . '" LIMIT 1', - 1 - ); - if (isset($tst['id'])) { - $r = 1; - } - } - return $r; - } - - private function testRazmenOldUser($u2, $u1, $plid) - { - global $btl, $u; - $r = 0; - // -- -- - if ($btl->users[$btl->uids[$u2]]['id'] != $this->u->info['id']) { - if ($btl->users[$btl->uids[$u1]]['level'] < $btl->users[$btl->uids[$u2]]['level']) { - $r = 1; - echo '
'; - } elseif ($btl->users[$btl->uids[$u1]]['bot'] > 0 && $btl->users[$btl->uids[$u2]]['bot'] == 0) { - echo '
'; - $r = 1; - } elseif ( - $btl->users[$btl->uids[$u1]]['id'] != $btl->users[$btl->uids[$u2]]['id'] && - !in_array($plid, [35, 63, 64, 65, 66, 85, 86, 87, 88, 89, 90, 104, 105, 106, 107, 134, 135, 136, 137]) - ) // 90,89,88,87,86,85,35 - { - $this->addPriem( - $this->u->info['id'], '344', 'add_m11=-' . round($this->u->stats['m11'] * 75 / 100), 1, 77, 1, - $this->u->stats['id'], 3, '', 0, 0, 1 - ); // - } - } - return $r; - } - - public function testDie($u1) - { - global $btl; - // 1 2 - $btl->spaCheck($btl->stats[$btl->uids[$u1]]['id']); - } - - public function pruse($id) - { - global $u, $c, $code, $btl, $ue; - if ($id == 100500 && $this->u->info['animal'] > 0) { - $use_lst = $this->u->testAction( - '`uid` = "' . $this->u->info['id'] . '" AND `vars` = "animal_use' . $btl->info['id'] . '" LIMIT 1', - 1 - ); - if (!isset($use_lst['id'])) { - $a = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `users_animal` WHERE `uid` = "' . $this->u->info['id'] . '" AND `id` = "' . $this->u->info['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1' - ) - ); - if ($this->u->stats['hpNow'] < 1) { - echo ' , '; - } elseif (isset($a['id']) && $a['eda'] < 1) { - echo ' ...'; - } elseif (isset($a['id'])) { - // - $tp = [ - 1 => '', - 2 => '', - 3 => '', - 4 => '', - 5 => '', - 6 => '', - 7 => '', - ]; - $id = mysql_fetch_assoc( - mysql_query( - 'SELECT `id` FROM `test_bot` WHERE `login` = "' . $tp[$a['type']] . ' [' . $a['level'] . ']" LIMIT 1' - ) - ); - if (isset($id['id']) && $btl->info['type'] != 500) { - $b = $this->u->addNewbot($id['id'], null, null); - if ($b > 0 && $b != false) { - $a['eda'] -= 4; - if ($a['eda'] < 0) { - $a['eda'] = 0; - } - - $vLog = 'time1=' . time( - ) . '||s1=' . $this->u->info['sex'] . '||t1=' . $this->u->info['team'] . '||login1=' . $this->u->info['login'] . ''; - $mas1 = [ - 'time' => time(), - 'battle' => $btl->info['id'], - 'id_hod' => $btl->hodID, - 'vars' => $vLog, - 'zona1' => '', - 'zonb1' => '', - 'zona2' => '', - 'zonb2' => '', - 'type' => '1', - ]; - - $sex = $this->u->info['sex'] === 1 ? 'a' : ''; - $mas1['text'] = "{tm1} {u1} $sex "" . $a['name'] . '"'; - $btl->add_log($mas1); - - mysql_query( - 'UPDATE `users` SET `login` = "' . $a['name'] . ' ( ' . $this->u->info['login'] . ')",`obraz` = "' . $a['obraz'] . '.gif",`battle` = "' . $btl->info['id'] . '" WHERE `id` = "' . $b['id'] . '" LIMIT 1' - ); - mysql_query( - 'UPDATE `stats` SET `team` = "' . $this->u->info['team'] . '" WHERE `id` = "' . $b['id'] . '" LIMIT 1' - ); - mysql_query( - 'UPDATE `users_animal` SET `eda` = "' . $a['eda'] . '" WHERE `id` = "' . $a['id'] . '" LIMIT 1' - ); - $this->u->addAction(time(), 'animal_use' . $btl->info['id'], $a['level']); - } else { - echo ' ...'; - } - } else { - // - echo '
- ...'; - } - } else { - // - echo ' ...'; - } - } else { - // - echo ' ...'; - } - } else { - $p = explode('|', $this->u->info['priems']); - $pz = explode('|', $this->u->info['priems_z']); - if ($p[(int)$id] > 0 && $pz[(int)$id] <= 0 && $this->u->info['hpNow'] >= 1) { - $pl = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `priems` WHERE `level`<=' . $this->u->info['level'] . ' AND `id` = ' . $p[(int)$id] - ) - ); - if (isset($pl['id']) && $pl['activ'] != 1) { - if ($pl['activ'] == 0) { - unset($pl); - } elseif ($pl['activ'] > 1) { - // - if ($this->testActiv($pl['activ']) == 0) { - unset($pl); - } - } - } - if (isset($pl['id'])) { - $notr = 0; - $pl['useon_user'] = $this->u->info['enemy']; - if (isset($_POST['useon']) && $_POST['useon'] != '' && $_POST['useon'] != 'none') { - $_POST['useon'] = iconv('UTF-8', 'windows-1251', $_POST['useon']); - $this->ue = mysql_fetch_assoc( - mysql_query( - 'SELECT - - `u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`clan`, - `u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`, - `u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`, - `u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`activ`,`u`.`stopexp`,`u`.`real`, - - `st`.* - - FROM `users` AS `u` - LEFT JOIN `stats` AS `st` ON (`u`.`id`=`st`.`id`) - WHERE ( - `u`.`login`="' . mysql_real_escape_string($_POST['useon']) . '" OR - ( - `u`.`login2` = "' . mysql_real_escape_string($_POST['useon']) . '" AND - `u`.`login2` != "") - ) AND - ( - `u`.`inUser` > 0 OR - ( - `u`.`battle`="' . $btl->info['id'] . '" AND - `st`.`hpNow` > 0 - ) - ) ORDER BY `u`.`id` DESC LIMIT 1' - ) - ); - if (isset($this->ue['id']) && $this->ue['inUser'] > 0) { - $this->ue = mysql_fetch_assoc( - mysql_query( - 'SELECT - - `u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`clan`, - `u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`, - `u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`, - `u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`activ`,`u`.`stopexp`,`u`.`real`, - - `st`.* - - FROM `users` AS `u` - LEFT JOIN `stats` AS `st` ON (`u`.`id`=`st`.`id`) - WHERE - `u`.`battle`="' . $btl->info['id'] . '" AND - `st`.`hpNow` > 0) AND - `u`.`id` = "' . $this->ue['inUser'] . '" ORDER BY `u`.`id` ASC LIMIT 1' - ) - ); - } - if (!isset($this->ue['id']) && $pl['trUser'] > 0) { - $notr++; - } - if ($pl['team'] == 1) { - // - if ($this->u->info['team'] != $this->ue['team']) { - $notr++; - } - } elseif ($pl['team'] == 2) { - // - if ($this->u->info['team'] == $this->ue['team']) { - $notr++; - } - } elseif ($pl['team'] == 0) { - // - - } - } else { - $ga = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `battle_act` WHERE `battle` = "' . $btl->info['id'] . '" AND `uid1` = "' . $this->u->info['id'] . '" AND `uid2` = "' . $this->u->info['enemy'] . '" LIMIT 1' - ) - ); - if (($this->u->info['enemy'] == 0 || isset($ga['id'])) && ($pl['tr_hod'] > 0 || $pl['trUser'] > 0)) { - $notr++; - } - } - - $notr += $this->testpriem($pl, 1, $this->ue['id']); - - if ($this->ue['id'] > 0) { - $notr += $this->testRazmenOldUser($this->ue['id'], $this->u->info['enemy'], $pl['id']); - } - - if ($notr == 0) { - mysql_query( - 'UPDATE `stats` SET `last_pr` = "' . $pl['id'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1' - ); - - // - if ($this->ue['id'] > 0) { - $btl->priemsRazmen([$this->u->info['id'], $this->ue['id']], 'fast'); - mysql_query( - 'UPDATE `eff_users` SET `mark` = 1 WHERE `uid` = "' . $this->ue['id'] . '" AND `delete` = 0' - ); - } else { - $btl->priemsRazmen([$this->u->info['id'], $this->u->info['enemy']], 'fast'); - mysql_query( - 'UPDATE `eff_users` SET `mark` = 1 WHERE `uid` = "' . $this->u->info['enemy'] . '" AND `delete` = 0' - ); - } - mysql_query( - 'UPDATE `eff_users` SET `mark` = 1 WHERE `uid` = "' . $this->u->info['id'] . '" AND `delete` = 0' - ); - - if (file_exists('../../_incl_data/class/priem/' . $pl['id'] . '.php')) { - require('../../_incl_data/class/priem/' . $pl['id'] . '.php'); - $this->testDie($this->ue['id']); - } else { - echo 'useSkill' . $pl['id']; - } - - if (!isset($cup)) { - $this->uppz($pl, $id); - // - //$this->mintr($pl); - if ($pl['tr_hod'] > 0) { - $this->trhod($pl); - } - if ($pl['id'] != 258) { - if ($pl['cancel_eff'] == '') { - $pl['cancel_eff'] = '258'; - } else { - $pl['cancel_eff'] .= ',258'; - } - } - if ($pl['cancel_eff'] != '') { - $i = 0; - $e = explode(',', $pl['cancel_eff']); - while ($i < count($e)) { - if ($e[$i] > 0) { - if ($e[$i] == 258) { - $nem = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `eff_users` WHERE `uid` = "' . $this->u->info['id'] . '" AND `v1` = "priem" AND `v2` = "' . $e[$i] . '" AND `delete` = "0" AND `mark` = 1 LIMIT 1' - ) - ); - } else { - $nem = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `eff_users` WHERE `uid` = "' . $this->ue['id'] . '" AND `v1` = "priem" AND `v2` = "' . $e[$i] . '" AND `delete` = "0" AND `mark` = 1 LIMIT 1' - ) - ); - } - if (isset($nem['id'])) { - $nem['priem'] = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `priems` WHERE `id` = "' . $e[$i] . '" LIMIT 1' - ) - ); - if (isset($nem['id'])) { - $btl->delPriem($nem, $btl->users[$btl->uids[$this->ue['id']]], 500); - } - } - } - $i++; - } - } - } - } - } - } - } - } - - private function rezadEff($uid, $mg) - { - global $u, $btl, $c, $code; - //$this->rezadEff($this->u->info['id'],'wis_fire_'); - $md = ''; - $md2 = ''; - $ex = explode('|', $btl->users[$btl->uids[$uid]]['priems']); - $ex2 = explode('|', $btl->users[$btl->uids[$uid]]['priems_z']); - $i = 0; - $ty = []; - while ($i < count($ex)) { - if ($ex[$i] > 0) { - $md .= '`id` = "' . ((int)$ex[$i]) . '" OR '; - $ty[$ex[$i]] = $i; - } - $i++; - } - $md = rtrim($md, ' OR '); - if ($md != '') { - $md = '( ' . $md . ' ) AND '; - } - $sp = mysql_query('SELECT * FROM `priems` WHERE ' . $md . ' `img` LIKE "%' . $mg . '%"'); - while ($pl = mysql_fetch_assoc($sp)) { - $ex2[$ty[$pl['id']]] = 0; - } - $md2 = implode('|', $ex2); - $btl->users[$btl->uids[$uid]]['priems_z'] = $md2; - $this->u->info['priems_z'] = $md2; - $upd = mysql_query('UPDATE `stats` SET `priems_z` = "' . $md2 . '" WHERE `id` = "' . ((int)$uid) . '" LIMIT 1'); - unset($md, $md2, $ty); - return $upd; - } - - private function trhod($pl) - { - global $u, $btl; - if ($this->u->info['notrhod'] == -1) { - $this->u->info['notrhod'] = 0; - if ($this->u->stats['magic_cast'] > 0) { - $this->u->info['notrhod'] = $this->u->stats['magic_cast']; - } - mysql_query( - 'UPDATE `users` SET `notrhod` = "' . $this->u->info['notrhod'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1' - ); - } - if ($this->u->info['notrhod'] > 0) { - if ($pl['tr_hod'] > 0) { - $this->u->info['notrhod']--; - mysql_query( - 'UPDATE `users` SET `notrhod` = "' . $this->u->info['notrhod'] . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1' - ); - } - } else { - $a1 = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `battle_act` WHERE `battle` = "' . $btl->info['id'] . '" AND `uid2` = "' . $this->u->info['id'] . '" AND `uid1` = "' . $this->u->info['enemy'] . '" LIMIT 1' - ) - ); - if (isset($a1['id'])) { - // , 2 - mysql_query( - 'UPDATE `battle_act` SET `out2` = "1",`tpo2` = "2" WHERE `id` = "' . $a1['id'] . '" LIMIT 1' - ); - $a1['out2'] = 1; - $a1['tpo2'] = 2; - $btl->atacks[$a1['id']] = $a1; - $btl->users[$this->u->info['id']]['priems_z'] = $this->u->info['priems_z']; - $btl->startAtack($a1['id']); - } else { - // - mysql_query( - 'INSERT INTO `battle_act` (`battle`,`uid1`,`uid2`,`time`,`out1`,`type`,`tpo1`) VALUES ("' . $btl->info['id'] . '","' . $this->u->info['id'] . '","' . $this->u->info['enemy'] . '","' . time( - ) . '","1","1","2")' - ); - } - } - } - - public function plusData($d1, $d2) - { - global $u; - $j1 = $this->lookStatsArray($d1); - $j2 = $this->lookStatsArray($this->redate($d2, $this->u->info['id'])); - $v = $this->u->lookKeys($this->redate($d2, $this->u->info['id']), 0); // 2 - // - $i = 0; - $inf = ''; - while ($i < count($v)) { - $j1[$v[$i]] += $j2[$v[$i]]; - $vi = str_replace('add_', '', $v[$i]); - if ($this->u->is[$vi] != '') { - if ($j2[$v[$i]] > 0) { - $inf .= $this->u->is[$vi] . ': +' . ($j2[$v[$i]] * (1 + $mpr['x'])) . ', '; - } elseif ($j2[$v[$i]] < 0) { - $inf .= $this->u->is[$vi] . ': ' . ($j2[$v[$i]] * (1 + $mpr['x'])) . ', '; - } - } - $i++; - } - $inf = rtrim($inf, ', '); - $j1 = $this->u->impStats($j1); - return $j1; - } - - private function addEffPr($pl, $id) - { - global $u, $btl; - $rcu = false; - $j = $this->lookStatsArray($pl['date2']); - $mpr = false; - $addch = 0; - $uid = $this->u->info['id']; - if (isset($this->ue['id'])) { - $uid = $this->ue['id']; - } - if (isset($j['onlyOne'])) { - $mpr = Db::getRow( - 'select * from eff_users where v2 = ? and uid = ? and `delete` = 0 and mark = 1', - [$pl['id'], $uid] - ); - //$mpr = mysql_fetch_assoc(mysql_query('SELECT * FROM `eff_users` WHERE `v2` = "' . $pl['id'] . '" AND `uid` = "' . $uid . '" AND `delete` = "0" AND `mark` = 1 LIMIT 1')); - } - - // if ($pl['cancel_eff2'] != '') { - // $i = 0; - // $e = explode(',', $pl['cancel_eff2']); - // while ($i < count($e)) { - // if ($e[$i] > 0) { - // $nem = mysql_fetch_assoc(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "' . $uid . '" AND `v1` = "priem" AND `v2` = "' . $e[$i] . '" AND `delete` = "0" AND `mark` = 1 LIMIT 1')); - // if (isset($nem['id'])) { - // $nem['priem'] = mysql_fetch_assoc(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $e[$i] . '" LIMIT 1')); - // if (isset($nem['id'])) { - // $btl->delPriem($nem, $btl->users[$btl->uids[$uid]], 2); - // if ($nem['id'] == $mpr['id']) { - // unset($mpr); - // } - // } - // } - // } - // $i++; - // } - // } - - if (!empty($pl['cancel_eff2'])) { - $this->cancelEffects($pl['cancel_eff2'], $uid, $btl); - } - - $pld = [0 => '']; - $nc = 0; - if (isset($mpr['id']) && $j['onlyOne'] == 1) { - // - $addch = 1; - $this->mintr($pl); - $this->uppz($pl, $id); - // - if (isset($this->ue['id'])) { - $btl->stats[$btl->uids[$uid]] = $this->u->getStats($this->ue, 0); - } else { - $btl->stats[$btl->uids[$uid]] = $this->u->getStats($this->u->info, 0); - } - $nc = 1; - } elseif (!isset($mpr['id'])) { - $data = ''; - if (isset($j['date3Plus'])) { - $data = $this->redate($pl['date3'], $this->u->info['id']); - } - - $hd1 = -1; - if ($pl['limit'] > 0) { - $tm = 77; - $hd1 = $pl['limit']; - } else { - $tm = 77; - } - if ($pl['limit'] == -2) { - $hd1 = $pl['limit']; - } - if ($pl['id'] == 239) // - { - $btl->priemAddLogFast( - $uid, 0, $pl['name'], - '{tm' . $this->u->info['team'] . '} ' . $btl->addlt( - 1, 17, $btl->users[$btl->uids[$uid]]['sex'], - null - ) . '', - 1, time() - ); - } - - $uu = $pl['id'] === 260 ? '' : $this->u->info['id']; - Db::sql( - 'insert into eff_users (hod, v1, v2, img2, id_eff, uid, name, data, overType, timeUse, user_use) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', - [$hd1, 'priem', $pl['id'], $pl['img'] . '.gif', 22, $uid, $pl['name'], $data, 0, $tm, $uu] - ); - - unset($hd1, $uu); - // - $addch = 1; - $rcu = true; - $nc = 1; - $this->mintr($pl); - //$this->uppz($pl,$id); - // - if (isset($this->ue['id'])) { - $btl->stats[$btl->uids[$uid]] = $this->u->getStats($this->ue, 0); - } else { - $btl->stats[$btl->uids[$uid]] = $this->u->getStats($this->u->info, 0); - } - } elseif ($j['onlyOne'] > 1) { - if ($mpr['x'] < $j['onlyOne'] && isset($j['date3Plus'])) { - $j1 = $this->lookStatsArray($mpr['data']); - $j2 = $this->lookStatsArray($this->redate($pl['date3'], $this->u->info['id'])); - $v = $this->u->lookKeys($this->redate($pl['date3'], $this->u->info['id']), 0); // 2 - // - $i = 0; - $inf = ''; - while ($i < count($v)) { - $j1[$v[$i]] += $j2[$v[$i]]; - $vi = str_replace('add_', '', $v[$i]); - if ($this->u->is[$vi] != '') { - if ($j2[$v[$i]] > 0) { - $inf .= $this->u->is[$vi] . ': +' . ($j2[$v[$i]] * (1 + $mpr['x'])) . ', '; - } elseif ($j2[$v[$i]] < 0) { - $inf .= $this->u->is[$vi] . ': ' . ($j2[$v[$i]] * (1 + $mpr['x'])) . ', '; - } - } - $i++; - } - $inf = rtrim($inf, ', '); - $j1 = $this->u->impStats($j1); - $pld[0] = ' x' . ($mpr['x'] + 1); - if ($j['refHod'] == 1) { - $mpr['hod'] = $pl['limit']; - } - $upd = mysql_query( - 'UPDATE `eff_users` SET `hod` = "' . $mpr['hod'] . '",`data` = "' . $j1 . '",`x` = `x`+1 WHERE `id` = "' . $mpr['id'] . '" LIMIT 1' - ); - if ($upd) { - // - $this->mintr($pl); - $this->uppz($pl, $id); - // - if (isset($this->ue['id'])) { - $btl->stats[$btl->uids[$uid]] = $this->u->getStats($this->ue, 0); - } else { - $btl->stats[$btl->uids[$uid]] = $this->u->getStats($this->u->info, 0); - } - $addch = 1; - $rcu = true; - $nc = 1; - } - } - } - /* */ - if ($nc == 1 && $pl['tr_hod'] > 0) { - $this->trhod($pl); - } - //return $rcu; - } - - public function mintr($pl) - { - global $u, $btl; - $x = 1; - $rt = ''; - while ($x <= 7) { - if ($pl['ndt' . $x] == 0) { - $this->u->info['tactic' . $x] -= $pl['tt' . $x]; - $btl->users[$btl->uids[$this->u->info['id']]]['tactic' . $x] -= $pl['tt' . $x]; - } - if ($this->u->info['tactic' . $x] < 0) { - $this->u->info['tactic' . $x] = 0; - } - if ($btl->users[$btl->uids[$this->u->info['id']]]['tactic' . $x] < 0) { - $btl->users[$btl->uids[$this->u->info['id']]]['tactic' . $x] = 0; - } - //$rt .= ',`tactic'.$x.'`="'.$this->u->info['tactic'.$x].'"'; - $rt .= ',`tactic' . $x . '`="' . $btl->users[$btl->uids[$this->u->info['id']]]['tactic' . $x] . '"'; - $x++; - } - if ($pl['xuse'] > 0) { - $this->u->addAction(time(), 'use_priem_' . $btl->info['id'] . '_' . $this->u->info['id'], $pl['id']); - } - $rt = ltrim($rt, ','); - mysql_query('UPDATE `stats` SET ' . $rt . ' WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); - } - - public function maxtr($x, $val) - { - global $u, $btl; - $this->u->info['tactic' . $x] += $val; - $btl->users[$btl->uids[$this->u->info['id']]]['tactic' . $x] += $val; - if ($this->u->info['tactic' . $x] < 0) { - $this->u->info['tactic' . $x] = 0; - } - if ($btl->users[$btl->uids[$this->u->info['id']]]['tactic' . $x] < 0) { - $btl->users[$btl->uids[$this->u->info['id']]]['tactic' . $x] = 0; - } - $rt = '`tactic' . $x . '`="' . $this->u->info['tactic' . $x] . '"'; - mysql_query('UPDATE `stats` SET ' . $rt . ' WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); - } - - private function actpridMax($pl) - { - global $u, $btl; - if ($pl['actprid2'] > 0 || $pl['actprid3'] > 0) { - $i = 0; - $pe = explode('|', $this->u->info['priems']); - $piz = []; - while ($i < count($pe)) { - if ($pl['sbr'] == 0) { - // - $psp = mysql_fetch_assoc( - mysql_query('SELECT * FROM `priems` WHERE `id` = "' . ((int)$pe[$i]) . '" LIMIT 1') - ); - } else { - // - $imgnm = ''; - $nm = explode('_', $pl['img']); - if ($nm[0] == 'wis') { // - $imgnm = $nm[0] . '_' . $nm[1] . '%'; - } else { - $imgnm = $nm[0] . '%'; - } - // - $psp = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `priems` WHERE `id` = "' . ((int)$pe[$i]) . '" AND `img` LIKE "' . $imgnm . '" LIMIT 1' - ) - ); - } - if ($pl['noprid'] == 0 && isset($psp['id']) && $psp['tr_hod'] == 0 && $psp['type_pr'] == 1 && $psp['noprid'] == 0) { - if ($pl['actprid2'] > 0) { - $piz[$pe[$i]] = (int)$pl['actprid2']; - } elseif ($pl['actprid3'] > 0) { - $piz[$pe[$i]] = $psp['zad']; - } - } - $i++; - } - $pz = explode('|', $this->u->info['priems_z']); - $p = explode('|', $this->u->info['priems']); - $i = 0; - while ($i < count($p)) { - if ($p[$i] > 0 && isset($piz[$p[$i]]) && $pz[$i] == 0) { - $pz[$i] = $piz[$p[$i]]; - } - $i++; - } - $pz = implode('|', $pz); - $this->u->info['priems_z'] = $pz; - $btl->users[$btl->uids[$this->u->info['id']]]['priems_z'] = $pz; - $btl->stats[$btl->uids[$this->u->info['id']]]['priems_z'] = $pz; - } - } - - public function uppz($pl, $id) - { - global $u, $btl; - $this->actpridMax($pl); - $p = explode('|', $this->u->info['priems']); - $pz = explode('|', $this->u->info['priems_z']); - $pz[(int)$id] = $pl['zad']; - $i = 0; - $pe = explode(',', $pl['actprid']); - $piz = []; - while ($i < count($pe)) { - $piz[$pe[$i]] = 1; - $i++; - } - $i = 0; - $pe = explode(',', $pl['actprid_one']); - $piz2 = []; - while ($i < count($pe)) { - $piz2[$pe[$i]] = 1; - $i++; - } - $i = 0; - while ($i < count($p)) { - if ($p[$i] > 0) { - if (isset($piz[$p[$i]])) { - if ($pl['id'] == 281) { - // + 5 . - if ($p[$i] == 246 || $p[$i] == 186) { - $pz[$i] = 5; - } else { - $pz[$i] = $pl['zad']; - } - } else { - $pz[$i] = $pl['zad']; - } - } - if (isset($piz2[$p[$i]]) && $pz[$i] == 0) { - $pz[$i] = 1; - } - } - $i++; - } - $pz = implode('|', $pz); - $this->u->info['priems_z'] = $pz; - $btl->users[$btl->uids[$this->u->info['id']]]['priems_z'] = $pz; - $btl->stats[$btl->uids[$this->u->info['id']]]['priems_z'] = $pz; - $tr = $this->lookStatsArray($pl['tr']); - if (isset($tr['tr_mpNow'])) { - $tr['tr_mpNow'] = round($tr['tr_mpNow'] / 100 * (100 - $this->u->stats['min_use_mp'])); - $btl->users[$btl->uids[$this->u->info['id']]]['mpNow'] -= $tr['tr_mpNow']; - $btl->stats[$btl->uids[$this->u->info['id']]]['mpNow'] -= $tr['tr_mpNow']; - if ($btl->stats[$btl->uids[$this->u->info['id']]]['mpNow'] < $btl->users[$btl->uids[$this->u->info['id']]]['mpNow']) { - $btl->users[$btl->uids[$this->u->info['id']]]['mpNow'] = $btl->stats[$btl->uids[$this->u->info['id']]]['mpNow']; - } - } - $this->u->info['mpNow'] = $btl->users[$btl->uids[$this->u->info['id']]]['mpNow']; - mysql_query( - 'UPDATE `stats` SET `mpNow` = "' . $this->u->info['mpNow'] . '",`priems_z` = "' . $pz . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1' - ); - } - - public function reuns($id) - { - global $u, $c, $code; - $p = explode('|', $this->u->info['priems']); - if ($p[(int)$id] > 0) { - // - $p[(int)$id] = 0; - $p = implode('|', $p); - mysql_query( - 'UPDATE `stats` SET `priems` = "' . mysql_real_escape_string( - $p - ) . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1' - ); - $this->u->info['priems'] = $p; - } - } - - /** ? - * @param $id - * @return void - */ - public function uns($id) - { - global $u, $c, $code; - $pl = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `priems` WHERE `level`<="' . $this->u->info['level'] . '" AND `activ` > "0" AND `id` = "' . $id . '" LIMIT 1' - ) - ); - if (!isset($pl['id']) || $this->testpriem($pl, 1) != 0) { - return; - } - $yes = -1; - $non = -1; - $i = 0; - $p = explode('|', $this->u->info['priems']); - while ($i < $this->u->info['priemslot']) { - if ($non == -1 && $p[$i] == 0) { - $non = $i; - } - if ($p[$i] == $pl['id']) { - $yes = $i; - } - $i++; - } - - if ($yes != -1) { - // , - return; - } - if ($non != -1) { - // - $p[$non] = $pl['id']; - $p = implode('|', $p); - $upd = mysql_query( - 'UPDATE `stats` SET `priems` = "' . $p . '" WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1' - ); - if ($upd) { - $this->u->info['priems'] = $p; - } - } else { - // - echo ' ...'; - } - } - - // $id - 1 ( ), 2 - - public function seeMy($t) - { - global $u, $c, $code, $btl; - $i = 0; - $p = explode('|', $this->u->info['priems']); - $lvar = ''; - $pr = ''; - while ($i < $this->u->info['priemslot']) { - if ($p[$i] > 0) { - $pl = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `priems` WHERE `level`<="' . $this->u->info['level'] . '" AND `activ` > "0" AND `id` = "' . mysql_real_escape_string( - $p[$i] - ) . '" LIMIT 1' - ) - ); - $lvar = $this->priemInfo($pl, $t, $i); - $pz = $lvar[1]; - $lvar = $lvar[0]; - if ($t == 1) { - if (isset($_GET['inv'])) { - $cl = 'href="javascript:void(0)" onclick="location.href=\'main.php?all=' . ((int)$_GET['all']) . '&skills=1&rz=4&p_raz=all\'"'; - } else { - $cl = 'href="javascript:void(0)" onclick="location.href=\'main.php?all=' . ((int)$_GET['all']) . '&skills=1&unuse_priem=' . $i . '&rz=4&p_raz=\' + p_raz"'; - } - } else { - if ($pl['type'] == 1) { - // - if ($pl['onUser'] == 1) { - $oninuser = ''; - if ($pl['team'] == 1) { - if ($this->u->info['login2'] != '') { - $oninuser = $this->u->info['login2']; - } else { - $oninuser = $this->u->info['login']; - } - } else { - if ($btl->users[$btl->uids[$this->u->info['enemy']]]['login2'] != '') { - $oninuser = $btl->users[$btl->uids[$this->u->info['enemy']]]['login2']; - } else { - $oninuser = $btl->users[$btl->uids[$this->u->info['enemy']]]['login']; - } - } - $cl = 'href="javascript:void(0);" onClick="top.priemOnUser(' . $i . ',1,\'' . $pl['name'] . '\',\'' . $oninuser . '\',\'' . $pl['img'] . '\');"'; - unset($oninuser); - } else { - $cl = 'href="javascript:void(0);" onClick="usepriem(' . $i . ',1,\'' . $pl['img'] . '\');"'; - } - } elseif ($pl['type'] == 2) { - // - $cl = 'href="javascript:void(0);" onClick="usepriem(' . $i . ',1,\'' . $pl['img'] . '\');"'; - } elseif ($pl['type'] == 3) { - $cl = 'href="javascript:void(0);" onClick="alert(\' ?\');"'; - } - } - - - $notr = $this->testpriem($pl, $t); - - - $cl2 = ''; - $cli2 = ''; - if ((($pz[$i] > 0 || $notr > 0) && $t == 2) || (isset($this->u->stats['nopriems']) && $pl['nosh'] == 0) || $this->u->stats['notuse_last_pr'] == $pl['id']) { - $cli2 = ' class="nopriemuse" '; - } - - $pr .= ''; - } else { - - if (isset($_GET['inv'])) { - $pr .= ''; - } else { - $pr .= ''; - } - - } - $i++; - } - if ($this->u->info['animal'] > 0 && $t == 2) { - $use_lst = $this->u->testAction( - '`uid` = "' . $this->u->info['id'] . '" AND `vars` = "animal_use' . $btl->info['id'] . '" LIMIT 1', - 1 - ); - if (!isset($use_lst['id'])) { - $cl2 = ''; - $pr .= ''; - } else { - $cl2 = '" class="nopriemuse'; - $pr .= ''; - } - } - if ($t == 1) { - echo '
' . $pr . '
'; - } elseif ($t == 2) { - return str_replace('"', '\\"', $pr); - } - } - - public function testpriem($pl, $t = 1, $o = 0) - { - global $c, $u, $code, $btl; - $tr = $this->lookStatsArray($pl['tr']); - $d2 = $this->lookStatsArray($pl['date2']); - $x = 1; - $notr = 0; - - if ($t == 2 && $pl['id'] == 181) { - $imun = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `eff_users` WHERE `uid` = "' . $this->u->info['enemy'] . '" and `v2`="191" and `delete`="0" LIMIT 1' - ) - ); - if ($imun) { - $notr++; - } - } - - if (isset($btl->stats[$btl->uids[$this->u->info['id']]]['nousepriem']) && $btl->stats[$btl->uids[$this->u->info['id']]]['nousepriem'] > 0 && $pl['nosh'] == 0) { - if ($btl->stats[$btl->uids[$this->u->info['id']]]['noshock_voda'] > 0 && substr( - $pl['img'], 0, - 10 - ) == 'wis_water_') { - // - } else { - $notr++; - } - } - - if ($pl['id'] == $btl->stats[$btl->uids[$this->u->info['id']]]['notuse_last_pr']) { - $notr++; - } - - while ($x <= 7) { - if (isset($btl->uids[$this->u->info['id']], $btl->users[$btl->uids[$this->u->info['id']]])) { - if ($btl->users[$btl->uids[$this->u->info['id']]]['tactic' . $x] < $pl['tt' . $x] && $x != 7 && $pl['tt' . $x] > 0) { - $notr++; - } elseif ($x == 7) { - if ($pl['tt' . $x] > 0 && $btl->users[$btl->uids[$this->u->info['id']]]['tactic' . $x] <= 0) { - $notr++; - } - } - } - $x++; - } - - - if ($pl['xuse'] > 0) { - $xu = $this->u->testAction( - '`vars` = "use_priem_' . $btl->info['id'] . '_' . $this->u->info['id'] . '" AND `vals` = "' . $pl['id'] . '" LIMIT ' . $pl['xuse'] . '', - 2 - ); - if ($xu[0] >= $pl['xuse']) { - $notr++; - } - } - - $x = 0; - $t = $this->u->items['tr']; - while ($x < count($t)) { - $n = $t[$x]; - if (isset($tr['tr_' . $n])) { - if ($n == 'lvl') { - if ($tr['tr_' . $n] > $this->u->info['level']) { - $notr++; - } - } elseif ($tr['tr_' . $n] > $this->u->stats[$n]) { - $notr++; - } - } - $x++; - } - - - if ($pl['activ'] == 0 || ($this->testActiv($pl['activ']) == 0 && $pl['activ'] > 1)) { - $notr++; - } - - - //if($t==2) - //{ - if (isset($d2['onlyOne']) || isset($d2['onlyOneX1'])) { - if (isset($d2['onlyOneX1'])) { - if ($d2['onlyOneX1'] == 1) { - $pru = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `eff_users` WHERE `uid` = "' . $this->u->info['id'] . '" AND `v2` = "' . $pl['id'] . '" AND `delete` = "0" AND `x` >= 1 LIMIT 1' - ) - ); - if (isset($pru['id']) && $pru['x'] >= $d2['onlyOne']) { - $notr++; - } - } - } elseif (isset($d2['onlyOne'])) { - if ($d2['onlyOne'] > 1) { - $pru = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `eff_users` WHERE `uid` = "' . $this->u->info['id'] . '" AND `v2` = "' . $pl['id'] . '" AND `delete` = "0" AND `x` > 1 LIMIT 1' - ) - ); - if (isset($pru['id']) && $pru['x'] >= $d2['onlyOne']) { - $notr++; - } - } - } - } - - // - if (isset($tr['tr_nousepriem'])) { - $x = 0; - $nouse = explode(',', $tr['tr_nousepriem']); - while ($x < count($nouse)) { - $nousev = explode('.', $nouse[$x]); - if (isset($btl->stats[$btl->uids[$this->u->info['id']]]['prsu'][$nousev[0]]) && $btl->stats[$btl->uids[$this->u->info['id']]]['prsu'][$nousev[0]] >= 0) { - if ($nousev[2] > 1) { - if ($nousev[2] <= $btl->stats[$btl->uids[$this->u->info['id']]]['prsu'][$nousev[0]]) { - $notr++; - } - } else { - $notr++; - } - } - $x++; - } - unset($nouse, $nousev); - } - - if (isset($tr['tr_type_itm1'])) { - // - $itmt = mysql_fetch_assoc( - mysql_query( - 'SELECT `u`.`id` FROM `items_users` AS `u` LEFT JOIN `items_main` AS `m` ON `m`.`id` = `u`.`item_id` WHERE `m`.`type` = "' . $tr['tr_type_itm1'] . '" AND `u`.`inOdet` > 0 AND `u`.`uid` = "' . $this->u->info['id'] . '" AND `u`.`delete` = "0" LIMIT 1' - ) - ); - if (!isset($itmt['id'])) { - $notr++; - } - } - - if (isset($tr['tr_mpNow'])) { - if (isset($btl->stats[$btl->uids[$this->u->info['id']]])) { - if ($btl->stats[$btl->uids[$this->u->info['id']]]['mpNow'] < round( - $tr['tr_mpNow'] / 100 * (100 - $btl->stats[$btl->uids[$this->u->info['id']]]['min_use_mp']) - )) { - $notr++; - } - } elseif ($this->u->info['mpNow'] < $tr['tr_mpNow']) { - $notr++; - } - } - - if (isset($btl->uids[$this->u->info['id']], $btl->stats[$btl->uids[$this->u->info['id']]])) { - if ($pl['trUser'] == 1) { - // - ( ) - if (isset($btl->ga[$this->u->info['id']][$this->u->info['enemy']])) { - $notr++; - } - } elseif ($pl['trUser'] == 2 && $o > 0) { - // - ( , ) - $ga = mysql_fetch_assoc( - mysql_query( - 'SELECT * FROM `battle_act` WHERE `battle` = "' . $btl->info['id'] . '" AND `uid1` = "' . $this->u->info['id'] . '" AND `uid2` = "' . $btl->users[$btl->uids[$this->u->info['id']]]['enemy'] . '" LIMIT 1' - ) - ); - if (isset($ga['id'])) { - $notr++; - } - } - } - - return $notr; - } - - public function priemInfo($pl, $t, $id = false) - { - global $u, $c, $code, $btl; - $pz = explode('|', $this->u->info['priems_z']); - $tr = $this->lookStatsArray($pl['tr']); - $trs = ''; - $x = 0; - $notr = 0; - $t = $this->u->items['tr']; - while ($x < count($t)) { - $n = $t[$x]; - if (isset($tr['tr_' . $n])) { - if ($tr['tr_' . $n] > $this->u->stats[$n]) { - $trs .= ''; - $notr++; - } - $trs .= '
'; - $trs .= $this->u->is[$n] . ': ' . $tr['tr_' . $n]; - if ($tr['tr_' . $n] > $this->u->stats[$n]) { - $trs .= '
'; - } - } - $x++; - } - - $lvar = ''; - $j = 1; - $nm = [1 => 'hit', 2 => 'krit', 3 => 'counter', 4 => 'block', 5 => 'parry', 6 => 'hp', 7 => 'spirit']; - while ($j <= 6) { - if ($pl['tt' . $j] > 0) { - $lvar .= ' ' . round( - $pl['tt' . $j], - 2 - ) . '   '; - } - $j++; - } - if ($pl['tt7'] > 0) { - if ($lvar != '') { - $lvar .= '
'; - } - $lvar .= ' : ' . round($pl['tt' . $j], 2) . '
'; - } - $lvar .= '
'; - if ($pl['zad'] > 0) { - $lvar .= ': ' . $pl['zad']; - if ($pz[$id] > 0) { - $lvar .= ' ( ' . $pz[$id] . ')'; - } - $lvar .= '
'; - } - if (isset($tr['tr_mpNow']) && $tr['tr_mpNow'] > 0) { - $tr['tr_mpNow'] -= round($tr['tr_mpNow'] / 100 * $this->u->stats['min_use_mp']); - if ($this->u->info['mpNow'] < $tr['tr_mpNow'] || (isset($btl->stats[$btl->uids[$this->u->info['id']]]) && $btl->stats[$btl->uids[$this->u->info['id']]]['mpNow'] < $tr['tr_mpNow'])) { - $lvar .= ' : ' . $tr['tr_mpNow'] . '
'; - } else { - $lvar .= ' : ' . $tr['tr_mpNow'] . '
'; - } - } - if ($pl['tr_hod'] > 0) { - $lvar .= '
'; - } - if ($trs != '') { - $lvar .= ':' . $trs . '

'; - } else { - $lvar .= '
'; - } - - $pl['info'] = preg_replace_callback("!(#)(.*?)(#)!is", [$this, 'getDynamicInfo'], $pl['info']); - $lvar .= $pl['info']; - return [0 => $lvar, 1 => $pz]; - } - - // / / .. - public function testPower($s1, $s2, $y, $t, $t2) - { - global $u, $btl; - - $r = 0; - if ($t2 == 2) { - // - $pm = [0 => 0, 1 => 0, 2 => 0, 3 => 0]; - if ($t < 5) { - $pm[0] = $s1['m11']; - $pm[1] = $s2['zm']; - $pm[2] = $s2['antm11']; - } - - if (isset($btl->info['id'])) { - $pm[3] = $btl->zmgo($s2['zm' . $t]); - $pm[3] = round($pm[3]); - } - - // = b*(1+m/100)*2^((p*10-z)/k) - $fx_vl = [ - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 250, - 350, - 400, - 450, - 500, - 550, - 600, - 650, - 700, - 750, - 800, - 850, - 900, - 950, - ]; - - $fx = [ - 'b' => $y, // - 'm' => round($s1['pm' . $t] * 1 - $s2['antpm' . $t]), // - 'z' => round($s2['zm' . $t]), // . - 'p' => round(($s1['pzm'] + $s1['pzm' . $t])), // - 'k' => $fx_vl[(0 + $s1['lvl'])] // ; k=250 8, k=300 9 .. +20% - ]; - if (($fx['z'] + 250) - $fx['p'] * 10 < 0) { // , 250 . - $fx['p'] = ($fx['z'] + 250) / 10; - } - $fx['p'] = 0; - // - $p = $fx['b'] * (1 + $fx['m'] / 100) * pow(2, (($fx['z'] - $fx['p'] * 10) / $fx['k'])); - //$p += $p/100*10; - $p -= $p / 100 * $pm[3]; - //$p += floor($s1['s5']*0.25); - - if ($p < round($y * 0.1)) { - $p = round($y * 0.1); - } elseif ($p > round($y * 10)) { - $p = $y * 10; - } - - if (isset($s2['zm' . $t . 'proc'])) // () - { - $p = floor($p / 100 * (100 - $s2['zm' . $t . 'proc'])); - if ($p < 0) { - $p = 0; - } - } - if (isset($s2['zmproc'])) // () - { - if ($s2['zmproc'] >= 75) { - $p = floor($p / 100 * (100 - 75)); - } else { - $p = floor($p / 100 * (100 - $s2['zmproc'])); - if ($p < 0) { - $p = 0; - } - } - } - $r = $p; - } - - return round($r / 100 * 70); - } - - private function pyes($id) - { - global $u; - $p = explode('|', $this->u->info['priems']); - $r = false; - $i = 0; - while ($i < count($p)) { - if ($p[$i] == $id) { - $r = true; - } - $i++; - } - return $r; - } - - // - 1, - 2 - public function seePriems($mt) - { - global $u, $c, $code; - $t = $this->u->items['tr']; - $nm = [1 => 'hit', 2 => 'krit', 3 => 'counter', 4 => 'block', 5 => 'parry', 6 => 'hp', 7 => 'spirit']; - $lvlfe = $this->u->info['level']; - if (isset($_GET['all'])) { - $lvlfe = 21; - } - $sp = mysql_query( - 'SELECT * FROM `priems` WHERE `level`<="' . $lvlfe . '" AND `activ` > "0" ORDER BY `img`,`level` ASC' - ); - $this->u->info['lvl'] = $this->u->info['level']; - $lvar = ''; - while ($pl = mysql_fetch_assoc($sp)) { - $noaki = 0; - if ($pl['activ'] == 1 || $this->testActiv($pl['activ']) == 1) { - $lvar = $this->priemInfo($pl, 1); - $lvar = $lvar[0]; - $cl = ''; - $a1 = ''; - $a2 = ''; - - if ($this->pyes($pl['id']) || $this->testpriem($pl, 1) > 0) { - if ((isset($_GET['all']) && $_GET['all'] == 1) || $this->pyes($pl['id'])) { - $cl = 'filter: alpha(opacity=35); -moz-opacity: 0.35; -khtml-opacity: 0.35; opacity: 0.35;'; - $a1 = ''; - $a2 = ''; - } else { - $noaki = 1; - } - } - if ($noaki == 0) { - $mtnu = explode('_', $pl['img']); - if ($mtnu[0] != 'wis') { - $mtnu = $mtnu[0]; - } else { - $mtnu = 'wis_' . $mtnu[1]; - } - echo $a1 . '' . $a2; - } - } - } - } - - private function zeromax($num, $max) - { - if ($num <= 0) { - return 0; - } - if ($num > $max) { - $num = $max; - } - return $num; - } - - /** : . - * : 34, 67, 68, 69. - * @param $level - * @param Battle $btl - * @param $id - * pruse() . - * @return void - */ - private function fireFlash($level, Battle $btl, $id) - { - if (empty($this->ue) || $this->ue['hpNow'] <= 0 || $btl->users[$this->ue['id']]['team'] == $this->u->info['team']) { - return; - } - - $baseDamage = [8 => 40, 9 => 45, 10 => 50, 11 => 60]; - $pvr = []; - $magicTargetTier = Db::getValue( - 'select x from eff_users where uid = ? and v2 = 26 and `delete` = 0', - [$this->ue['id']] - ); - $leveledDamage = $baseDamage[$level] + 40 / 100 * (5 * $magicTargetTier); - - list($damage, $isCrit, $isMiss) = $this->magicAttack( - $btl, $this->u->info['id'], $this->ue['id'], $leveledDamage, self::FIRE, 1 - ); - // - $damage = $btl->testYronPriem( - $this->u->info['id'], $this->ue['id'], 21, $damage, 5, - true - ); - $btl->priemYronSave($this->u->info['id'], $this->ue['id'], $damage, 0); - - $this->ue['hpNow'] -= $damage; - $this->ue['hpNow'] = $this->zeromax($this->ue['hpNow'], $this->ue['hpAll']); - - $btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] = $this->ue['hpNow']; - - Db::sql('update stats set hpNow = ? where id = ?', [$this->ue['hpNow'], $this->ue['id']]); - - if ($isMiss) { - $color = $this->logColor['miss']; - } elseif ($isCrit) { - $color = $this->logColor['crit']; - } else { - $color = $this->logColor[self::FIRE]; - } - $btl->priemAddLog( - $id, - 1, - 2, - $this->u->info['id'], - $this->ue['id'], - " [$level]", - '{tm1}' . sprintf( - " %s %s [%d/%d]", - $btl->addlt(1, 19, $this->u->info['sex'], null), - $pvr['color'], - $isMiss ? '--' : -$damage, - (int)$this->ue['hpNow'], - (int)$this->ue['hpAll'] - ), - $btl->hodID + 1 - ); - } - - /** : {} - * : 25, 26, 27, 28. - * @param $element - * @param $pl - * @param $id - * @param Battle $btl - * @return bool (bool) . - */ - private function magicTarget($element, $pl, $id, Battle $btl) - { - $data = [ - self::WATER => [25, ''], - self::FIRE => [26, ''], - self::AIR => [27, ''], - self::EARTH => [28, ''], - ]; - if (!in_array($element, array_keys($data)) || empty($this->ue)) { - return false; - } - - $stacked = Db::getRow( - 'select id, x from eff_users where uid = ? and v2 = ? and `delete` = 0', - [$this->ue['id'], $data[$element][0]] - ); - $stackNumStr = $stacked['x'] > 0 ? $stacked['x'] + 1 : ''; - if ($stacked['x'] >= 5) { - echo " "; - return true; - } - - // . - $this->addEffPr($pl, $id); - - $dataStr = $stacked['x'] > 0 ? Db::getValue( - 'select data from eff_users where id = ?', - [$stacked['id']] - ) : $pl['date3']; - - // . , . - $effect = " {$data[$element][1]}: " . current($this->lookStatsArray($dataStr)); - $color = $this->logColor[$element]; - - $name = " {$data[$element][1]}"; - if ($stacked['x'] > 0) { - $name .= " x($stackNumStr)"; - } - - $btl->priemAddLog( - $id, - 1, - 2, - $this->u->info['id'], - $this->ue['id'], - "$name", - '{tm1}' . sprintf( - " %s. (%s)", - $btl->addlt(1, 19, $this->u->info['sex'], null), $effect - ), - $btl->hodID - ); - - return false; - } - - public function devouringFlame($id, $uid, $j_id, Battle $btl) - { - $a = 0; - $u1 = 0; - $u2 = 0; - // - $uid1 = $btl->atacks[$id]['uid1']; - $uid2 = $btl->atacks[$id]['uid2']; - if ($uid == $uid1) { - $a = 1; - $u1 = $uid1; - $u2 = $uid2; - } elseif ($uid == $uid2) { - $a = 2; - $u1 = $uid2; - $u2 = $uid1; - } - if ($a <= 0) { - return; - }// - $prv['j_priem'] = $btl->stats[$btl->uids[$u1]]['u_priem'][$j_id][0]; - - $pvr['data'] = $this->lookStatsArray($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['data']); - $pName = $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['name']; - - $pvr['hp'] = $pvr['data']['atgm']; - - $pvr['hpNow'] = floor($btl->stats[$btl->uids[$u1]]['hpNow']); - $pvr['hpAll'] = $btl->stats[$btl->uids[$u1]]['hpAll']; - - // - $pvr['hp'] = $btl->testYronPriem( - $btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['user_use'], $u1, 12, $pvr['hp'], 7, true, false, 1 - ); - - $pvr['hpNow'] -= $pvr['hp']; - $btl->priemYronSave($btl->stats[$btl->uids[$u1]]['effects'][$prv['j_priem']]['user_use'], $u1, $pvr['hp'], 0); - - $pvr['hpNow'] = $this->zeromax($pvr['hpNow'], $pvr['hpAll']); - - $btl->stats[$btl->uids[$u1]]['hpNow'] = $pvr['hpNow']; - - Db::sql('update stats set hpNow = ? where id = ?', [$btl->stats[$btl->uids[$u1]]['hpNow'], $u1]); - - $color = $this->logColor[self::FIRE]; - $prv['text'] = '{u2} "{pr}" '; - if ($pvr['promah_type'] == 2) { - $pvr['hp'] = '-'; - } - $prv['text'] .= sprintf( - "%s [%d/%d]", $color, -$pvr['hp'], $pvr['hpNow'], $pvr['hpAll'] - ); - - $btl->priemAddLog( - $id, 1, 2, $u2, $u1, "$pName", $prv['text'], ($btl->hodID) - ); - } - - /** . , . - * 5 . 5 . - * damage 5 (atgm=). - * : 33, 56, 57, 58, 59, 60. - * @param $id - * @param array $pl priems. - * @param Battle $btl - * @return void - */ - private function devouringFlameInit($id, array $pl, Battle $btl) - { - $baseDamage = [6 => 53, 7 => 63, 8 => 77, 9 => 91, 10 => 110, 11 => 133,]; - list($damage, , $isMiss) = $this->magicAttack( - $btl, $this->u->info['id'], $this->ue['id'], $baseDamage[$pl['level']], self::FIRE - ); - if ($isMiss || $damage <= 0) { - return; - } - - $color = $this->logColor[self::FIRE]; - $logText = '{tm1}' . $btl->addlt(1, 19, $btl->users[$btl->uids[$this->u->info['id']]]['sex'], null) . '.'; - $btl->priemAddLog( - $id, 1, 2, $this->u->info['id'], $this->ue['id'], "{$pl['name']}", - $logText, $btl->hodID + 1 - ); - - $data = $this->impStats(['atgm' => max(floor($damage / 5), 1)]); - - $this->addPriem( - $this->ue['id'], $pl['id'], $data, 0, 77, 5, $this->u->info['id'], 1, '', 0, 0, 1 - ); - } - - /** . ( ) 20 3 . - * . - * :267, 268. . - * @param $id - * @param array $pl - * @param Battle $btl - * @return void - */ - private function crystalize($id, array $pl, Battle $btl) - { - $q = 'select stats as data from stats where id = ? - union all select stats as data from test_bot where id = ? - union all select data from eff_users where `delete` = 0 and uid = ? - union all select data from items_users where inOdet > 0 and `delete` = 0 and uid = ?'; - $datas = Db::getColumn($q, array_fill(0, 3, $this->ue['id'])); - $stats = array_fill_keys(['s1', 's2', 's3', 's5', 's6'], 0); - foreach ($datas as $data) { - $data = $this->lookStatsArray($data); - print_r($data); - foreach (array_keys($stats) as $stat) { - if (isset($data[$stat])) { - $stats[$stat] += $data[$stat]; - } - if (isset($data['add_' . $stat])) { - $stats[$stat] += $data['add_' . $stat]; - } - } - } - $maxValue = max($stats); - $maxKeys = []; - - foreach ($stats as $k => $v) { - if ($maxValue == $v) { - $maxKeys[] = $k; - } - } - shuffle($maxKeys); - $datastr = "|add_{$maxKeys[0]}=-20"; - $debuffstr = " " . mb_strtolower($this->u->is[$maxKeys[0]]); - - $color = $this->logColor[self::WATER]; - $logText = '{tm1}' . $btl->addlt(1, 19, $btl->users[$btl->uids[$this->u->info['id']]]['sex'], null) . '.'; - $btl->priemAddLog( - $id, 1, 2, $this->u->info['id'], $this->ue['id'], - "{$pl['name']}: $debuffstr", $logText, $btl->hodID + 1 - ); - - $this->addPriem($this->ue['id'], 268, $datastr, 2, 77, 3, $this->u->info['id'], 3, 0, 0, 1); - } - -} diff --git a/_incl_data/class/Quests.php b/_incl_data/class/Quests.php deleted file mode 100644 index 1e192d46..00000000 --- a/_incl_data/class/Quests.php +++ /dev/null @@ -1,1010 +0,0 @@ -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 = ' "' . $pl['name'] . '"'; - } 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 = ' "' . $pl['name'] . '"'; - } 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 = ' "' . $pl['name'] . '"'; - } 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 = '
-
' . $xrz . '/' . $r . '
-
-
-
-

'; - } - 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 .= '"' . $qn['name'] . '", '; - } - } - $i++; - } - $t = trim($t, ', '); - $t .= '
'; - unset($qn); - } - // [ idbot-itm1=%,itm2=%| - if (isset($d['tr_botitm'])) { - $t .= ' :