';
- }
- $ixi++;
- $sma += $sm_pl['x'];
- }
- $smt .= '
';
- if ($pl['max_text'] - $pl['use_text'] > 0) {
- $is2 .= ' : ' . ($pl['max_text'] - $pl['use_text']) . '
';
- }
- if ($sma > 0) {
- $is2 .= '' . floor($sn['mpNow']) . '/' . (0 + $sn['mpAll']) . '
- ' . floor($sn['hpNow']) . '/' . (0 + $sn['hpAll']) . '
- ' . $hpmp . '
';
- } elseif ($type_info == 2) {
- $hptop = 0;
- $lh = [0 => 'hp_none', 1 => 1];
- $lh[1] = floor((0 + $sn['hpNow']) / (0 + $sn['hpAll']) * 200);
- if ($lh[1] > 0) {
- $lh[0] = 'hp_1';
- }
- if ($lh[1] > 32) {
- $lh[0] = 'hp_2';
- }
- if ($lh[1] > 65) {
- $lh[0] = 'hp_3';
- }
- if ($sn['mpAll'] > 0) {
-
- //
- $lm = [0 => 'hp_none', 1 => 1];
- $lm[1] = floor($sn['mpNow'] / $sn['mpAll'] * 200);
- if ($lm[1] > 0) {
- $lm[0] = 'hp_mp';
- }
- $hpmp .= ' ' . floor($sn['mpNow']) . '/' . (0 + $sn['mpAll']) . '
- ' . floor($sn['hpNow']) . '/' . (0 + $sn['hpAll']) . '
- ' . $hpmp . '
';
- }
-
- $lgn = '' . $witm[$j2] . '
';
- $j2++;
- }
-
- }
- //
- if ($type_info == 1) {
- if ($pb != '') {
- $pb = '
' . $pb . '
';
- }
- $rt[0] .= '
' . $lgn . '
' . $pb . '
-
-
-
-
-
-
- ' . $zag . '' . $witm[1] . ' |
-
-
- ' . $witm[2] . ' |
-
-
- ' . $witm[3] . ' |
-
-
- ' . $witm[4] . ' |
-
-
- ' . $witm[7] . ' |
-
-
- |
-
-
-
-
-
- ' . $hpmp . '
-
- |
-
-
- ';
- if ($zag == '') {
- if ($i1 == 0) {
- if (!isset($_GET['inv'])) {
- $invg = [0 => 'main.php?inv=1', 1 => ''];
- } else {
- $invg = [0 => 'main.php?skills=1', 1 => ''];
- }
- } else {
- $o = mysql_fetch_array(mysql_query('SELECT `id` FROM `obraz` WHERE `img` = "' . mysql_real_escape_string($this->info['obraz']) . '" AND `sex` = "' . $this->info['sex'] . '" LIMIT 1'));
- $invg = [0 => 'https://new-combats.com/shadow/' . $o['id'] . '" target="_blank', 1 => ' '];
- }
- $uobr = 'i/obraz/' . $u['sex'] . '/' . $u['obraz'] . '';
- if (isset($sn['items_img'][1])) {
- $uobr = 'rimg/r' . $sn['items_img'][1];
- }
- $rt[0] .= '
-
-
- ' . $eff . ' ' . $anml . '
- ';
- } else {
- if ($i1 == 0) {
- if (!isset($_GET['inv'])) {
- $invg = [0 => 'main.php?inv=1', 1 => ''];
- } else {
- $invg = [0 => 'main.php?skills=1', 1 => ''];
- }
- } else {
- $invg = [0 => 'https://lib.new-combats.com/obraz.php?namez=' . $u['zag'] . '" target="_blank', 1 => ' '];
- }
- $rt[0] .= '
-
-
- ' . $eff . ' ' . $anml . '
- ';
- }
-
- unset($invg);
-
- $rt[0] .= ' |
-
-
- ' . $msl . ' |
-
-
- |
-
-
-
- ' . $witm[8] . ' |
-
-
- ' . $witm[9] . ' |
-
-
-
-
- ' . $witm[10] . ' |
- ' . $witm[11] . ' |
- ' . $witm[12] . ' |
-
- |
-
-
- ' . $witm[13] . ' |
-
-
- ' . $witm[14] . ' |
-
-
- ' . $witm[16] . ' |
-
-
- ' . $witm[17] . ' |
-
-
- |
-
-
' . $witmg . '
';
- } elseif ($type_info == 2) {
- $rt[0] .= '
' . $lgn . '
-
-
' . $pb . '
-
-
- ' . $hpmp . '
-
-
-
-
-
-
-
- ' . $zag . '' . $witm[8] . ' |
-
-
- ' . $witm[9] . ' |
-
-
- ' . $witm[3] . ' |
-
-
- ' . $witm[4] . ' |
-
-
-
-
- ' . $witm[10] . ' |
- ' . $witm[11] . ' |
- ' . $witm[12] . ' |
-
- |
-
-
- |
-
-
-
- ';
- if ($zag == '') {
- if ($i1 == 0) {
- if (!isset($_GET['inv'])) {
- $invg = [0 => 'main.php?inv=1', 1 => ''];
- } else {
- $invg = [0 => 'main.php?skills=1', 1 => ''];
- }
- } else {
- $invg = [0 => 'https://lib.new-combats.com/obraz.php?name=' . $u['obraz'] . '" target="_blank', 1 => ' '];
- }
- $u['obraz'] = '0.gif';
- $uobr = 'i/obraz/' . $u['sex'] . '/old/' . $u['obraz'] . '';
- if (isset($sn['items_img'][1])) {
- $uobr = 'rimg/r' . $sn['items_img'][1];
- }
- $rt[0] .= '
-
-
- ' . $eff . ' ' . $anml . '
- ';
- }
-
- unset($invg);
-
- $rt[0] .= ' |
-
-
- |
-
-
-
- ' . $witm[1] . ' |
-
-
- ' . $witm[13] . ' |
-
-
- ' . $witm[14] . ' |
-
-
- ' . $witm[17] . ' |
-
-
- |
-
-
' . $witmg . '
';
- }
-
- if ($i1 == 0 && $u['battle'] == 0) {
- $rt[0] .= '';
- }
- if ($ivv == 0 && $i1 == 0) {
- $rt[0] .= $this->info_remont();
- }
- }
- return $rt;
- }
-
- public function endEffect($id, $u, $test = null)
- {
- if ($test == false) {
- $test = 0;
- }
-
- $e = mysql_fetch_array(mysql_query('SELECT
- `eu`.`id`,`eu`.`tr_life_user`,`eu`.`id_eff`,`eu`.`uid`,`eu`.`name`,`eu`.`data`,`eu`.`overType`,`eu`.`timeUse`,`eu`.`timeAce`,`eu`.`user_use`,`eu`.`delete`,`eu`.`v1`,`eu`.`v2`,`eu`.`img2`,`eu`.`x`,`eu`.`hod`,`eu`.`bj`,`eu`.`sleeptime`,`eu`.`no_Ace`,
- `em`.`id2`,`em`.`mname`,`em`.`type1`,`em`.`img`,`em`.`mdata`,`em`.`actionTime`,`em`.`type2`,`em`.`type3`,`em`.`onlyOne`,`em`.`oneType`,`em`.`noAce`,`em`.`see`,`em`.`info`,`em`.`overch`,`em`.`bp`,`em`.`noch`
- FROM `eff_users` AS `eu` LEFT JOIN `eff_main` AS `em` ON (`eu`.`id_eff` = `em`.`id2`) WHERE `eu`.`id`="' . mysql_real_escape_string($id) . '" AND `delete`="0" AND `deactiveTime` < "' . time() . '"'));
-
- if (isset($e['id'])) {
- $sleep = $this->testAction('`vars` = "sleep" AND `uid` = "' . $e['uid'] . '" LIMIT 1', 1);
- if ($e['id_eff'] == 2) {
- //
- $ev = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_main` WHERE `name` = "' . mysql_real_escape_string(str_replace(': ', '', $e['name'])) . '" LIMIT 1'));
- $et = mysql_fetch_array(mysql_query('SELECT `id` FROM `actions` WHERE `uid` = "' . $e['uid'] . '" AND `vars` LIKE "%read%" AND `vals` = "' . $ev['id'] . '" LIMIT 1'));
- if (isset($et['id'])) {
- if ($et['time'] < time()) {
- $et = false;
- } else {
- $et = true;
- }
- } else {
- $et = false;
- }
- } else {
- $et = false;
- }
- if ($et == false && $e['sleeptime'] == 0 && $sleep['vars'] != 'sleep') {
- $upd = mysql_query('UPDATE `eff_users` SET `delete`="' . time() . '" WHERE `id` = "' . $e['id'] . '" LIMIT 1');
- if ($upd) {
- $po = $this->lookStats($e['data']);
- if (isset($po['finish_file'])) {
- if (file_exists('_incl_data/class/magic/' . $po['finish_file'] . '.php')) {
- require('_incl_data/class/magic/' . $po['finish_file'] . '.php');
-
- } else {
- $this->error2 = '!File not exists "cgi-bin/magic.pl?use_' . $po['finish_file'] . '".';
- }
- }
- if (isset($u['id']) && ($e['type1'] < 11 || ($e['type1'] > 16 && $e['type1'] < 23)) && $e['noch'] == 0) {
- $text = ' "
' . $e['name'] . '"';
- mysql_query("INSERT INTO `chat` (`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`new`) VALUES ('" . $u['city'] . "','" . $u['room'] . "','','" . $u['login'] . "','" . $text . "','-1','6','0',1)");
- if ($u['battle'] > 0) {
- $lastHOD = mysql_fetch_array(mysql_query('SELECT `id`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type` FROM `battle_logs` WHERE `battle` = "' . $u['battle'] . '" ORDER BY `id_hod` DESC LIMIT 1'));
- if (isset($lastHOD['id'])) {
- $id_hod = $lastHOD['id_hod'];
- if ($lastHOD['type'] != 6) {
- $id_hod++;
- }
- mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time() . '","' . $u['battle'] . '","' . ($id_hod) . '","{tm1} ' . $text . ' {u1}.","login1=' . $u['login'] . '||t1=' . $u['team'] . '||time1=' . time() . '","","","","","6")');
- }
- }
- }
- return 1;
- } else {
- return 0;
- }
- } else {
- return 0;
- }
- } else {
- return 0;
- }
- }
-
- public function snatItem($id, $uid)
- {
- if ($uid != 0) {
- $au = 'AND `iu`.`uid`="' . mysql_real_escape_string($uid) . '"';
- } else {
- $au = '';
- }
- $itm = mysql_fetch_array($cl = mysql_query('SELECT
- `im`.`id`,`im`.`name`,`im`.`img`,`im`.`type`,`im`.`inslot`,`im`.`2h`,`im`.`2too`,`im`.`iznosMAXi`,`im`.`inRazdel`,`im`.`price1`,`im`.`price2`,`im`.`pricerep`,`im`.`magic_chance`,`im`.`info`,`im`.`massa`,`im`.`level`,`im`.`magic_inci`,`im`.`overTypei`,`im`.`group`,`im`.`group_max`,`im`.`geni`,`im`.`ts`,`im`.`srok`,`im`.`class`,`im`.`class_point`,`im`.`anti_class`,`im`.`anti_class_point`,`im`.`max_text`,`im`.`useInBattle`,`im`.`lbtl`,`im`.`lvl_itm`,`im`.`lvl_exp`,`im`.`lvl_aexp`,
- `iu`.`id`,`iu`.`item_id`,`iu`.`1price`,`iu`.`2price`,`iu`.`uid`,`iu`.`use_text`,`iu`.`data`,`iu`.`inOdet`,`iu`.`inShop`,`iu`.`delete`,`iu`.`iznosNOW`,`iu`.`iznosMAX`,`iu`.`gift`,`iu`.`gtxt1`,`iu`.`gtxt2`,`iu`.`kolvo`,`iu`.`geniration`,`iu`.`magic_inc`,`iu`.`maidin`,`iu`.`lastUPD`,`iu`.`timeOver`,`iu`.`overType`,`iu`.`secret_id`,`iu`.`time_create`,`iu`.`time_sleep`,`iu`.`inGroup`,`iu`.`dn_delete`,`iu`.`inTransfer`,`iu`.`post_delivery`,`iu`.`lbtl_`,`iu`.`bexp`,`iu`.`so`,`iu`.`blvl`
- FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id`="' . mysql_real_escape_string($id) . '" AND `iu`.`inOdet`!="0" ' . $au . ' AND `iu`.`delete`="0" LIMIT 1 FOR UPDATE'));
- if (isset($itm['id'])) {
-
- $upd = mysql_query('UPDATE `items_users` SET `lastUPD`="' . time() . '",`inOdet`="0" WHERE `id`="' . $itm['id'] . '" LIMIT 1');
- if ($upd) {
- if (isset($_GET['remitem']) || isset($_GET['sid'])) {
- $this->info['autospell'] = 1;
- mysql_query('UPDATE `users` SET `autospell` = "1" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
- }
- return 1;
- } else {
- return 0;
- }
- } else {
- return 0;
- }
- }
-
- public function snatItemAll($uid)
- {
- $upd = mysql_query('UPDATE `items_users` SET `lastUPD`="' . time() . '",`inOdet`="0" WHERE `uid`="' . $uid . '" AND `inOdet`!="0" AND `delete`="0" LIMIT 100');
- if ($upd) {
- return 1;
- } else {
- return 0;
- }
- }
-
- public function impStats($m)
- {
- $i = 0;
- if (array_keys($m)) {
- $k = array_keys($m);
- } else {
- $k = 0;
- }
- $d = '';
- while ($i <= count($k)) {
- if ($k[$i] != '') {
- $d .= $k[$i] . '=' . $m[$k[$i]] . '|';
- }
- $i++;
- }
- $d = rtrim($d, '|');
- return $d;
- }
-
- public function odetItem($id, $uid)
- {
- if ($uid != 0) {
- $au = 'AND `iu`.`uid` = "' . mysql_real_escape_string($uid) . '"';
- } else {
- $au = '';
- }
-
- $itm = mysql_fetch_array(mysql_query('SELECT
- `im`.`id`,`im`.`name`,`im`.`img`,`im`.`type`,`im`.`inslot`,`im`.`2h`,`im`.`2too`,`im`.`iznosMAXi`,`im`.`inRazdel`,`im`.`price1`,`im`.`price2`,`im`.`pricerep`,`im`.`magic_chance`,`im`.`info`,`im`.`massa`,`im`.`level`,`im`.`magic_inci`,`im`.`overTypei`,`im`.`group`,`im`.`group_max`,`im`.`geni`,`im`.`ts`,`im`.`srok`,`im`.`class`,`im`.`class_point`,`im`.`anti_class`,`im`.`anti_class_point`,`im`.`max_text`,`im`.`useInBattle`,`im`.`lbtl`,`im`.`lvl_itm`,`im`.`lvl_exp`,`im`.`lvl_aexp`,
- `iu`.`id`,`iu`.`item_id`,`iu`.`1price`,`iu`.`2price`,`iu`.`uid`,`iu`.`use_text`,`iu`.`data`,`iu`.`inOdet`,`iu`.`inShop`,`iu`.`delete`,`iu`.`iznosNOW`,`iu`.`iznosMAX`,`iu`.`gift`,`iu`.`gtxt1`,`iu`.`gtxt2`,`iu`.`kolvo`,`iu`.`geniration`,`iu`.`magic_inc`,`iu`.`maidin`,`iu`.`lastUPD`,`iu`.`timeOver`,`iu`.`overType`,`iu`.`secret_id`,`iu`.`time_create`,`iu`.`time_sleep`,`iu`.`inGroup`,`iu`.`dn_delete`,`iu`.`inTransfer`,`iu`.`post_delivery`,`iu`.`lbtl_`,`iu`.`bexp`,`iu`.`so`,`iu`.`blvl`
- FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id`="' . mysql_real_escape_string($id) . '" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ' . $au . ' AND `iu`.`delete`="0" LIMIT 1'));
- if (isset($itm['id'])) {
- if ($itm['group'] == 1) {
- if ($this->itemsX($itm['id']) > 1) {
- $this->unstack($itm['id'], 1);
- }
- }
-
-
- $tr = $this->lookStats($itm['data']);
- $notr = $this->trItem($tr);
- $msb = '';
- if (isset($tr['maks_itm_one']) && $tr['maks_itm_one'] > 0) {
- $test = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "' . $this->info['id'] . '" AND `inOdet` > 0 AND `delete` = 0 AND `data` LIKE "%maks_itm_one=' . $tr['maks_itm_one'] . '%" LIMIT 1'));
- if (isset($test['id'])) {
- $this->error = ' !';
- $notr++;
- }
- }
- if ($this->info['twink'] > 0) {
- // 100 .
- if ($itm['price2'] > 100 || $itm['2price'] > 100) {
- $notr++;
- }
- // +
- if (isset($tr['rune']) && $tr['rune'] > 0) {
- $notr++;
- }
- if (isset($tr['spell_id']) && $tr['spell_id'] > 0) {
- $notr++;
- }
- }
- if (isset($tr['vip_sale'])) {
- if ($this->stats['silver'] < 2) {
- $notr++;
- }
- }
- if (isset($tr['sudba'])) {
- if ($tr['sudba'] != '0' && $tr['sudba'] != $this->info['login']) {
- $notr++;
- } elseif ($tr['sudba'] == '0') {
- $tr['sudba'] = $this->info['login'];
- $itm['data'] = $this->impStats($tr);
- $msb = ',`data`="' . $itm['data'] . '"';
- }
- }
- if (isset($tr['tr_align_bs']) && $this->info['inTurnir'] > 0) {
- if ($tr['tr_align_bs'] == '1') {
- if ($this->info['align_real'] <= 1 || $this->info['align_real'] >= 2) {
- $notr++;
- } else {
- $notr = 0;
- }
- } else {
- if ($this->info['align_real'] <= 3 || $this->info['align_real'] >= 4) {
- $notr++;
- } else {
- $notr = 0;
- }
- }
- }
- if ($notr > 0) {
- //
- if (isset($tr['open']) && isset($_GET['open'])) {
- $this->error = ' ';
- } else {
- $this->error = ' ';
- }
- return 0;
- } elseif (isset($tr['open']) && isset($_GET['open']) && isset($tr['items_in_file'])) {
- $io = '';
- if ($itm['inGroup'] > 0) {
- mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '",`inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
- }
- if (file_exists('_incl_data/class/magic/' . $tr['items_in_file'] . '.php')) {
- require('_incl_data/class/magic/' . $tr['items_in_file'] . '.php');
- if (!isset($no_open_itm)) {
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->error = ' "' . $itm['name'] . '":
' . $io . '...';
- } else {
- unset($no_open_itm);
- }
- } else {
- $this->error = ' "' . $itm['name'] . '" ...';
- }
- } elseif (isset($tr['open']) && isset($_GET['open'])) {
- //
- $io = '';
- $i = 0;
- $itms = explode(',', $tr['items_in']);
-
-
- if ($itm['type'] == 37) {
- //
- $io = '';
- $itmin = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `id` = "' . $tr['item_inbox'] . '" LIMIT 1'));
- $itmmn = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "' . $itmin['item_id'] . '" LIMIT 1'));
- //
- if ($itm['gift'] == '' || $itm['gift'] == '0') {
- $this->error = ' , !';
- } elseif (!isset($itmin['id'])) {
- $this->error = ' , - ...';
- } else {
- $io .= $itmmn['name'];
- if ($itmin['item_id'] == 4867) {
- //
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- $this->error = ' . .';
- } elseif ($itmin['item_id'] == 4868) {
- //
- mysql_query('UPDATE `stats` SET `hpNow` = 1,`mpNow` = 1 WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- $this->error = ' HP...';
- } elseif ($itmin['item_id'] == 4870) {
- //
- if ($this->info['molch1'] > time()) {
- $this->info['molch1'] += 3600;
- } else {
- $this->info['molch1'] = time() + 3600;
- }
- mysql_query('UPDATE `users` SET `molch1` = "' . $this->info['molch1'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- $this->error = ' ...';
- } elseif ($itmin['item_id'] == 4873) {
- //
- $a = mysql_fetch_array(mysql_query('SELECT `id`,`type`,`name`,`uid`,`delete`,`inBattle`,`eda`,`exp`,`obraz`,`stats`,`level`,`sex`,`levelUp`,`pet_in_cage`,`max_exp`,`priems`,`bonus` FROM `users_animal` WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $this->info['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1'));
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- if (isset($a['id'])) {
- $this->error = ' "' . $a['name'] . '" ...';
- mysql_query('UPDATE `users_animal` SET `eda` = 0, `yad` = "' . (time() + 86400 * 7) . '" WHERE `id` = "' . $a['id'] . '" LIMIT 1');
- } else {
- $this->error = '- , :)';
- }
- } elseif ($itmin['item_id'] == 4869) {
- // ( 1 )
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- mysql_query('INSERT INTO `eff_users`
- (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
- "0","' . (time() + 3600) . '","-1",
- " ","add_s' . rand(1, 3) . '=-' . rand(5, 15) . '","' . $this->info['id'] . '",
- "4", "bad_present_travma1.gif","0", "1"
- )');
- $this->error = ' . ...';
- } elseif ($itmin['item_id'] == 4872) {
- // ( 1 )
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- mysql_query('INSERT INTO `eff_users`
- (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
- "0","' . (time() + 3600) . '","-1",
- " ","add_s' . rand(1, 3) . '=-' . rand(16, 25) . '","' . $this->info['id'] . '",
- "4", "bad_present_travma2.gif","0", "2"
- )');
- $this->error = ' . ...';
- } elseif ($itmin['item_id'] == 4876) {
- // ( 1 )
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- mysql_query('INSERT INTO `eff_users`
- (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
- "0","' . (time() + 3600) . '","-1",
- " ","add_s' . rand(1, 3) . '=-' . rand(26, 35) . '","' . $this->info['id'] . '",
- "4", "bad_present_travma3.gif","0", "3"
- )');
- $this->error = ' . ...';
- } elseif ($itmin['item_id'] == 4878) {
- // (add_puti=7200)
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- mysql_query('INSERT INTO `eff_users`
- (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
- "0","' . (time() + 7200) . '","-1",
- "","add_puti=1","' . $this->info['id'] . '",
- "4", "bad_present_chains.gif","0", "3"
- )');
- $this->error = ' ...';
- } elseif ($itmin['item_id'] == 4874) {
- //
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- mysql_query('INSERT INTO `eff_users`
- (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
- "0","' . (time() + 3600) . '","-1",
- " ","add_s5=-50","' . $this->info['id'] . '",
- "4", "bad_present_dmage.gif","0", "3"
- )');
- $this->error = ' ...';
- } elseif ($itmin['item_id'] == 4871) {
- //
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->deleteItem($itmin['id'], $this->info['id']);
- mysql_query('INSERT INTO `eff_users`
- (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (
- "0","' . (time() + 3600) . '","-1",
- " ","add_s1=-50","' . $this->info['id'] . '",
- "4", "bad_present_dfighter.gif","0", "3"
- )');
- $this->error = ' ...';
- } elseif (mysql_query('UPDATE `items_users` SET `uid` = "' . $this->info['id'] . '",`lastUPD` = "' . time() . '",`gift` = "' . $itm['gift'] . '",`gtxt1` = "' . $itm['gtxt1'] . '",`gtxt2` = " . : ' . date('d.m.Y H:i:s', $itmin['time_create']) . '" WHERE `id` = "' . $itmin['id'] . '" LIMIT 1')) {
- //
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->error = ' "' . $itm['name'] . '", :
' . $io . '...';
- } else {
- $this->error = ' , ?';
- }
- //
- }
- //
- } else {
-
- while ($i < count($itms)) {
- if (isset($itms[$i])) {
- $x = 0;
- $itms[$i] = explode('*', $itms[$i]);
- $x += (int)$itms[$i][1];
- $itms[$i] = $itms[$i][0];
- $s = mysql_fetch_array(mysql_query('SELECT `id`,`name`,`img`,`type`,`inslot`,`2h`,`2too`,`iznosMAXi`,`inRazdel`,`price1`,`price2`,`price3`,`magic_chance`,`info`,`massa`,`level`,`magic_inci`,`overTypei`,`group`,`group_max`,`geni`,`ts`,`srok`,`class`,`class_point`,`anti_class`,`anti_class_point`,`max_text`,`useInBattle`,`lbtl`,`lvl_itm`,`lvl_exp`,`lvl_aexp` FROM `items_main` WHERE `id`="' . ((int)$itms[$i]) . '" LIMIT 1'));
- if (isset($s['id'])) {
- $j = 1;
- while ($j <= $x) {
- $pid = $this->addItem($s['id'], $this->info['id']);
- if ($pid > 0) {
- mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '",`gift` = "' . $itm['gift'] . '" WHERE `id` = "' . $pid . '" AND `uid` = "' . $this->info['id'] . '" LIMIT 1');
- }
- $j++;
- }
- $io .= '' . $s['name'] . ' (x' . $x . '), ';
- }
- }
- $i++;
- }
- if ($itm['inGroup'] > 0) {
- mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '",`inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
- }
- $this->deleteItem($itm['id'], $this->info['id']);
- $this->error = ' "' . $itm['name'] . '", :
' . $io . '...';
- }
- } else {
- $inSlot = $itm['inslot'];
- $s = mysql_query('SELECT `iu`.`id`,`iu`.`inOdet` FROM `items_users` AS `iu` WHERE `iu`.`inOdet`!="0" AND `iu`.`uid`="' . $uid . '" AND `iu`.`delete`="0"');
- $d = [];
- while ($p = mysql_fetch_array($s)) {
- $d[$p['inOdet']] = $p['id'];
- }
-
- //
- if ($itm['2too'] == 1 && $inSlot == 3 && isset($d[3])) {
- $inSlot = 14;
- }
-
- if ($inSlot == 3 || $inSlot == 14) {
- // -
- if ($this->stats['items'][$this->stats['wp3id']]['2h'] == 1 || $this->stats['items'][$this->stats['wp14id']]['2h'] == 1 || $itm['2h'] == 1) {
- $this->snatItem($this->stats['items'][$this->stats['wp3id']]['id'], $uid);
- $this->snatItem($this->stats['items'][$this->stats['wp14id']]['id'], $uid);
- }
- }
-
- if (isset($d[$inSlot])) {
- if ($inSlot == 10) {
- if (!isset($d[12])) {
- $inSlot = 12;
- } elseif (!isset($d[11])) {
- $inSlot = 11;
- }
- } elseif ($inSlot == 40) {
- $i = 40;
- while ($i <= 51) {
- if (!isset($d[$i])) {
- $inSlot = $i;
- $i = 52;
- } elseif ($i == 50) {
- $inSlot = 50;
- }
- $i++;
- }
- } elseif ($inSlot == 53) {
- if (!isset($d[53])) {
- $inSlot = 53;
- } elseif (!isset($d[54])) {
- $inSlot = 54;
- }
- } elseif ($inSlot == 56) {
- if (!isset($d[56])) {
- $inSlot = 56;
- } elseif (!isset($d[57])) {
- $inSlot = 57;
- } elseif (!isset($d[58])) {
- $inSlot = 58;
- } else {
- $inSlot = 58;
- }
- } elseif ($inSlot == 59) {
- if (!isset($d[59])) {
- $inSlot = 59;
- } elseif (!isset($d[60])) {
- $inSlot = 60;
- } elseif (!isset($d[61])) {
- $inSlot = 61;
- } elseif (!isset($d[62])) {
- $inSlot = 62;
- }
- }
- }
- if (isset($d[$inSlot])) {
- $this->snatItem($d[$inSlot], $uid);
- }
-
-
- $upd = mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `inOdet` = "' . $inSlot . '"' . $msb . ' WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
- if ($itm['inGroup'] > 0) {
- mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `inGroup` = 0, `delete` = 0 WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
- }
- if ($upd) {
- //
- //if($itm[''])
- //{
- //
- //}
- $this->info['autospell'] = 1;
- mysql_query('UPDATE `users` SET `autospell` = "1" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
- return 1;
- } else {
- $this->error = '(!) ';
- return 0;
- }
- }
- } else {
- $this->error = ' ';
- return 0;
- }
- }
-
- public function deleteItem($id, $uid = 0, $coldel = 0)
- {
- if ($uid != 0) {
- $au = 'AND `iu`.`uid`="' . mysql_real_escape_string($uid) . '"';
- } else {
- $au = '';
- }
- $itm = mysql_fetch_array(mysql_query('SELECT `im`.*,`iu`.*
- FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id`="' . mysql_real_escape_string($id) . '" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ' . $au . ' AND (`iu`.`delete`="0" OR `iu`.`delete`="1000") LIMIT 1'));
- if (isset($itm['id'])) {
-
- if ($coldel == 0) {
- //
- $upd = mysql_query('UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1');
- $col = $this->itemsX($itm['id']);
- if ($col > 0) {
- mysql_query('UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" LIMIT ' . $col);
- }
- } else {
- // -
- $col = $this->itemsX($itm['id']);
- if ($col > 1) {
- if ($col <= $coldel) {
- $upd = mysql_query('UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1');
- }
- $upd = mysql_query('UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" AND `delete` = "1000" LIMIT ' . $coldel);
- } else {
- //
- $upd = mysql_query('UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `id`="' . $itm['id'] . '" LIMIT 1');
- $upd = mysql_query('UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '",`inGroup` = "0" WHERE `inGroup`="' . $itm['id'] . '" AND `delete` = "1000" LIMIT ' . $col);
- }
- }
- if ($upd) {
- if (isset($_GET['deleteall7'])) {
- $st = $this->lookStats($itm['data']);
- $whr = '';
- if (isset($st['frompisher'])) {
- $whr .= 'AND `data` LIKE "%frompisher=' . $st['frompisher'] . '%"';
- }
- $col = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `items_users` WHERE `item_id`="' . $itm['item_id'] . '" AND `inOdet` = 0 AND `delete` < 100000 AND `uid` = "' . $itm['uid'] . '" AND `data` NOT LIKE "%nodelete%"' . $whr));
- $col = $col[0];
- mysql_query('UPDATE `items_users` SET `lastUPD`="' . time() . '",`delete`="' . time() . '" WHERE `item_id`="' . $itm['item_id'] . '" AND `inOdet` = 0 AND `delete` < 100000 AND `uid` = "' . $itm['uid'] . '" AND `data` NOT LIKE "%nodelete%"' . $whr);
- $this->error = ' "' . $itm['name'] . ' (x' . ($col + 1) . ')" ';
- $this->addDelo(1, $uid, '"
System.inventory": "
' . $itm['name'] . ' (x' . $col . ')" [itm:' . $itm['id'] . '=' . time() . ']
.', time(), $this->info['city'], 'System.inventory', 0, 0);
- } else {
- $this->error = ' "' . $itm['name'] . '" ';
- $this->addDelo(1, $uid, '"
System.inventory": "
' . $itm['name'] . '" [itm:' . $itm['id'] . ']
.', time(), $this->info['city'], 'System.inventory', 0, 0);
- }
- return 1;
- } else {
- return 0;
- }
- } else {
- $this->error = ' ';
- }
- }
-
- public function return_btn()
- {
- return false;
- }
-
- public function get_battle_cache($uid, $battle)
- {
- $r = false;
- if ($uid > 0 && $battle > 0) {
- $r = mysql_fetch_array(mysql_query('SELECT * FROM `battle_cache` WHERE `battle` = "' . mysql_real_escape_string($battle) . '" AND `uid` = "' . mysql_real_escape_string($uid) . '" ORDER BY `id` DESC LIMIT 1'));
- if (!isset($r['id'])) {
- $r = false;
- } else {
- $r = json_decode($r['data'], true);
- }
- }
- return $r;
- }
-
- public function clear_battle_cache($uid)
- {
- mysql_query('DELETE FROM `battle_cache` WHERE `uid` = "' . mysql_real_escape_string($uid) . '"');
- }
-
- public function getStats($uid, $i1 = null, $res = 0, $reimg = false, $btl_cache = false, $minimal = false)
- {
- global $c;
- if (count($uid) > 1) {
- $u = $uid;
- } elseif ($uid != $this->info['id'] || $res == 1) {
- if ($minimal == true) {
- $u = mysql_fetch_array(mysql_query('SELECT `u`.`twink`,`u`.`swin`,`u`.`slose`,`u`.`stopexp`,`u`.`battle`,`u`.`id`,`u`.`no_ip`,`u`.`level`,`u`.`login`,`u`.`clan`,`u`.`vip`,
- `st`.`id`,`st`.`lider`,`st`.`btl_cof`,`st`.`last_hp`,`st`.`last_pr`,`st`.`smena`,`st`.`stats`,`st`.`hpAll`,`st`.`mpAll`,`st`.`hpNow`,`st`.`mpNow`,`st`.`enNow`,`st`.`transfers`,`st`.`regHP`,`st`.`regMP`,`st`.`showmenu`,`st`.`prmenu`,`st`.`ability`,`st`.`skills`,`st`.`sskills`,`st`.`nskills`,`st`.`exp`,`st`.`minHP`,`st`.`minMP`,`st`.`zv`,`st`.`dn`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`last_a`,`st`.`last_b`,`st`.`battle_text`,`st`.`upLevel`,`st`.`wipe`,`st`.`bagStats`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`nextAct`,`st`.`active`,`st`.`bot`,`st`.`lastAlign`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`s`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`ref_data`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`bn_capitalcity`,`st`.`bn_demonscity`
- FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id`="' . mysql_real_escape_string($uid) . '" OR `u`.`login`="' . mysql_real_escape_string($uid) . '" LIMIT 1'));
- } else {
- $u = mysql_fetch_array(mysql_query('SELECT `u`.`twink`,`u`.`swin`,`u`.`slose`,`u`.`stopexp`,`u`.`battle`,`u`.`id`,`u`.`no_ip`,`u`.`level`,`u`.`login`,`u`.`clan`,`u`.`vip`,
- `st`.`id`,`st`.`lider`,`st`.`btl_cof`,`st`.`last_hp`,`st`.`last_pr`,`st`.`smena`,`st`.`stats`,`st`.`hpAll`,`st`.`mpAll`,`st`.`hpNow`,`st`.`mpNow`,`st`.`enNow`,`st`.`transfers`,`st`.`regHP`,`st`.`regMP`,`st`.`showmenu`,`st`.`prmenu`,`st`.`ability`,`st`.`skills`,`st`.`sskills`,`st`.`nskills`,`st`.`exp`,`st`.`minHP`,`st`.`minMP`,`st`.`zv`,`st`.`dn`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`last_a`,`st`.`last_b`,`st`.`battle_text`,`st`.`upLevel`,`st`.`wipe`,`st`.`bagStats`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`nextAct`,`st`.`active`,`st`.`bot`,`st`.`lastAlign`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`s`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`ref_data`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`bn_capitalcity`,`st`.`bn_demonscity`
- FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id`="' . mysql_real_escape_string($uid) . '" OR `u`.`login`="' . mysql_real_escape_string($uid) . '" LIMIT 1'));
- }
- } else {
- $u = $this->info;
- }
-
- if (isset($u['id'], $u['stats']) && !isset($cache)) {
- $st = [];
- $s_vi = [];
- $s_v = [];
- $u['clanpos'] = 0;
- if ($u['clan'] > 0) {
- $r1 = mysql_fetch_array(mysql_query('SELECT `pos` FROM `aaa_clan_reting_list` WHERE `clan` = "' . $u['clan'] . '" AND `date` = "' . date('dmY') . '" LIMIT 1'));
- if (isset($r1['pos'])) {
- $st['clanpos'] = $r1['pos'];
- }
- unset($r1);
- }
-
- if (!isset($cache_items)) {
-
- $lvl = mysql_fetch_array(mysql_query('SELECT `bprice`,`upLevel`,`nextLevel`,`exp`,`money`,`money_bonus1`,`money_bonus2`,`ability`,`skills`,`nskills`,`sskills`,`expBtlMax`,`hpRegen`,`mpRegen`,`money2` FROM `levels` WHERE `upLevel` = "' . $u['upLevel'] . '" LIMIT 1'));
- if (isset($lvl['upLevel'])) {
- $st['levels'] = $lvl;
- } else {
- $st['levels'] = 'undefined';
- }
- $st2 = [];
- $st['id'] = $u['id'];
- $st['login'] = $u['login'];
- $st['lvl'] = $u['level'];
- $st['hpNow'] = $u['hpNow'];
- $st['hpAll'] = 0;
- $st['mpNow'] = $u['mpNow'];
- $st['mpAll'] = 0;
- $st['zona'] = 1;
- $st['zonb'] = 2;
- $st['items'] = [];
- $st['effects'] = [];
- $st['reting'] = 0;
- $st['irka'] = 0;
- $st['vip'] = $u['vip'];
- $sts = explode('|', $u['stats']);
- $i = 0;
- $ste = '';
- //
- while ($i < count($sts)) {
- $ste = explode('=', $sts[$i]);
- if (isset($ste[1])) {
- if (!isset($st[$ste[0]])) {
- $st[$ste[0]] = 0;
- }
- $st[$ste[0]] += intval($ste[1]);
-
- if (!isset($st2[$ste[0]])) {
- $st2[$ste[0]] = 0;
- }
- $st2[$ste[0]] += intval($ste[1]);
- }
- $i++;
- }
-
- if ($u['admin'] > 0) {
- mysql_query('UPDATE `stats` SET
- `tactic1` = 25,
- `tactic2` = 25,
- `tactic3` = 25,
- `tactic4` = 25,
- `tactic5` = 25,
- `tactic6` = 25,
- `tactic7` = 25,
- `priems_z` = "0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|"
- WHERE `id` = "' . $u['id'] . '" LIMIT 1
- ');
- }
-
- //
- if ($this->info['id'] == $u['id'] || $reimg != false) {
- $sp_img = mysql_query('SELECT * FROM `items_img` WHERE `uid` = "' . $u['id'] . '" AND `img_id` != "0" LIMIT 16');
- while ($pl_img = mysql_fetch_array($sp_img)) {
- $pl_img_r = mysql_fetch_array(mysql_query('SELECT * FROM `reimage` WHERE ((`uid` = "' . $u['id'] . '" AND `clan` = "0") OR (`clan` = "' . $u['clan'] . '" AND ' . $u['clan'] . ' > 0)) AND `good` > 0 AND `bad` = "0" AND `id` = "' . $pl_img['img_id'] . '" LIMIT 1'));
- if (isset($pl_img_r['id'])) {
- $st['items_img'][$pl_img['type']] = $pl_img_r['id'] . '.' . $pl_img_r['format'];
- } else {
- mysql_query('UPDATE `items_img` SET `img_id` = "0" WHERE `id` = "' . $pl_img['id'] . '" LIMIT 1');
- }
- }
- }
-
- // // tr_lvl
- $cl = mysql_query('SELECT
- `im`.`id`,`im`.`name`,`im`.`img`,`im`.`type`,`im`.`inslot`,`im`.`2h`,`im`.`2too`,`im`.`iznosMAXi`,`im`.`inRazdel`,`im`.`price1`,`im`.`price2`,`im`.`pricerep`,`im`.`magic_chance`,`im`.`info`,`im`.`massa`,`im`.`level`,`im`.`magic_inci`,`im`.`overTypei`,`im`.`group`,`im`.`group_max`,`im`.`geni`,`im`.`ts`,`im`.`srok`,`im`.`class`,`im`.`class_point`,`im`.`anti_class`,`im`.`anti_class_point`,`im`.`max_text`,`im`.`useInBattle`,`im`.`lbtl`,`im`.`lvl_itm`,`im`.`lvl_exp`,`im`.`lvl_aexp`,
- `iu`.`id`,`iu`.`item_id`,`iu`.`1price`,`iu`.`2price`,`iu`.`uid`,`iu`.`use_text`,`iu`.`data`,`iu`.`inOdet`,`iu`.`inShop`,`iu`.`delete`,`iu`.`iznosNOW`,`iu`.`iznosMAX`,`iu`.`gift`,`iu`.`gtxt1`,`iu`.`gtxt2`,`iu`.`kolvo`,`iu`.`geniration`,`iu`.`magic_inc`,`iu`.`maidin`,`iu`.`lastUPD`,`iu`.`timeOver`,`iu`.`overType`,`iu`.`secret_id`,`iu`.`time_create`,`iu`.`time_sleep`,`iu`.`inGroup`,`iu`.`dn_delete`,`iu`.`inTransfer`,`iu`.`post_delivery`,`iu`.`lbtl_`,`iu`.`bexp`,`iu`.`so`,`iu`.`blvl`
- FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`inOdet`!="0" AND `iu`.`uid`="' . $u['id'] . '" AND `iu`.`delete`="0" LIMIT 250');
- $ia = $this->items['add'];
- $h = 0;
- $hnd1 = 0;
- $hnd2 = 0;
- $sht1 = 0;
- $reitm = [];
- $coms = []; //
- $dom = [];
- $btl_cof = 0;
- $oza = [
- 1 => [0, 0],
- 2 => [0, 0],
- 3 => [0, 0],
- 4 => [0, 0]
- ]; //
- $ozm = [
- 1 => [0, 0],
- 2 => [0, 0],
- 3 => [0, 0],
- 4 => [0, 0]
- ]; //
-
- $itmslvl = 0;
- $itmsCfc = 0;
- $st['reting'] = 0;
- while ($pl = mysql_fetch_array($cl)) {
- if ($pl['inOdet'] <= 18 && $pl['inOdet'] > 0) {
- if ($pl['1price'] > 0) {
- $st['irka'] += $pl['1price'];
- } else {
- $st['irka'] += $pl['price1'];
- }
- }
-
-
- $st['wp' . $pl['inOdet'] . 'id'] = $h;
-
- $st['items'][$h] = $pl;
- $h++;
- if ($pl['inOdet'] == 3 && (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27 || $pl['type'] == 28)) {
- $hnd1 = 1;
- }
- if ($pl['inOdet'] == 14 && (($pl['type'] >= 18 && $pl['type'] <= 24) || $pl['type'] == 26 || $pl['type'] == 27 || $pl['type'] == 28)) {
- $hnd2 = 1;
- } elseif ($pl['inOdet'] == 14 && $pl['type'] == 13) {
- $sht1 = 1;
- }
- $sts = explode('|', $pl['data']);
- $i = 0;
- $ste = '';
- $sti = [];
- while ($i < count($sts)) {
- $ste = explode('=', $sts[$i]);
- if (isset($ste[1])) {
- if (!isset($sti[$ste[0]])) {
- $sti[$ste[0]] = 0;
- }
- $sti[$ste[0]] += intval($ste[1]);
- }
- $i++;
- }
-
- if (!isset($sti['zazuby']) && !isset($sti['frompisher'])) {
- if ($pl['inOdet'] < 18 && $pl['inOdet'] > 0) {
-
- if ($pl['2price'] == 0 && $pl['price2'] == 0) {
- if ($pl['1price'] > 0) {
- $st['prckr'] += $pl['1price'];
- } else {
- $st['prckr'] += $pl['price1'];
- }
- } else {
- if ($pl['2price'] > 0) {
- $st['prckr'] += $pl['2price'] * 200;
- $st['preckr'] += $pl['2price'];
- } else {
- $st['prckr'] += $pl['price2'] * 200;
- $st['preckr'] += $pl['price2'];
- }
- }
- }
- }
-
- if ($pl['inOdet'] <= 18 && $pl['inOdet'] > 0) {
-
- $st['reting'] += 1;
- }
-
- $ko = 1;
- while ($ko <= 4) {
- if (isset($sti['add_oza' . $ko])) {
- if (isset($sti['add_oza'])) {
- if ($sti['add_oza'] == 1) {
- //
- $oza[$ko][0] += 1;
- $oza[$ko][1] += 9;
- } elseif ($sti['add_oza'] == 2) {
- //
- $oza[$ko][0] += 20;
- $oza[$ko][1] += 39;
- } elseif ($sti['add_oza'] == 3) {
- //
- $oza[$ko][0] += 40;
- $oza[$ko][1] += 69;
- } elseif ($sti['add_oza'] == 4) {
- //
- $oza[$ko][0] += 10;
- $oza[$ko][1] += 19;
- } elseif ($sti['add_oza'] == 5) {
- //
- $oza[$ko][0] += 70;
- $oza[$ko][1] += 89;
- }
- }
- if (isset($sti['add_ozm'])) {
- if ($sti['add_ozm'] == 1) {
- //
- $ozm[$ko][0] += 1;
- $ozm[$ko][1] += 9;
- } elseif ($sti['add_ozm'] == 2) {
- //
- $ozm[$ko][0] += 20;
- $ozm[$ko][1] += 39;
- } elseif ($sti['add_ozm'] == 3) {
- //
- $ozm[$ko][0] += 40;
- $ozm[$ko][1] += 69;
- } elseif ($sti['add_ozm'] == 4) {
- //
- $ozm[$ko][0] += 10;
- $ozm[$ko][1] += 19;
- } elseif ($sti['add_ozm'] == 5) {
- //
- $ozm[$ko][0] += 70;
- $ozm[$ko][1] += 89;
- }
- } else {
- $ozm[$ko][0] += 1;
- $ozm[$ko][1] += 9;
- }
- if ($sti['add_oza' . $ko] == 1) {
- //
- $oza[$ko][0] += 1;
- $oza[$ko][1] += 9;
- } elseif ($sti['add_oza' . $ko] == 2) {
- //
- $oza[$ko][0] += 20;
- $oza[$ko][1] += 39;
- } elseif ($sti['add_oza' . $ko] == 3) {
- //
- $oza[$ko][0] += 40;
- $oza[$ko][1] += 69;
- } elseif ($sti['add_oza' . $ko] == 4) {
- //
- $oza[$ko][0] += 10;
- $oza[$ko][1] += 19;
- } elseif ($sti['add_oza' . $ko] == 5) {
- //
- $oza[$ko][0] += 70;
- $oza[$ko][1] += 89;
- }
- if (isset($sti['add_ozm' . $ko])) {
- if ($sti['add_ozm' . $ko] == 1) {
- //
- $ozm[$ko][0] += 1;
- $ozm[$ko][1] += 9;
- } elseif ($sti['add_ozm' . $ko] == 2) {
- //
- $ozm[$ko][0] += 20;
- $ozm[$ko][1] += 39;
- } elseif ($sti['add_ozm' . $ko] == 3) {
- //
- $ozm[$ko][0] += 40;
- $ozm[$ko][1] += 69;
- } elseif ($sti['add_ozm' . $ko] == 4) {
- //
- $ozm[$ko][0] += 10;
- $ozm[$ko][1] += 19;
- } elseif ($sti['add_ozm' . $ko] == 5) {
- //
- $ozm[$ko][0] += 70;
- $ozm[$ko][1] += 89;
- }
- } else {
- $ozm[$ko][0] += 1;
- $ozm[$ko][1] += 9;
- }
-
- }
- $ko++;
- }
-
- //if( $sti['tr_lvl'] == $u['level'] ) {
- if ($pl['inOdet'] <= 18) {
- $itmslvl++;
- }
- if ($pl['inOdet'] <= 14 && isset($pl['tr_lvl'])) {
- if ($pl['tr_lvl'] == $u['level']) {
- $itmsCfc += 1;
- } else {
- $itmsCfc += ($sti['tr_lvl'] / $u['level']) / 4;
- }
- }
- //}
-
- if (isset($sti['art'])) {
- if (!isset($st['art'])) {
- $st['art'] = 0;
- }
- $st['art'] += $sti['art'];
- }
- if (isset($sti['maks_itm'])) {
- if (!isset($st['maks_itm'])) {
- $st['maks_itm'] = 0;
- }
- $st['maks_itm'] += $sti['maks_itm'];
- }
- if (isset($sti['complect'])) {
- $coms[count($coms)]['id'] = $sti['complect'];
- if (!isset($coms['com'][$sti['complect']])) {
- $coms['com'][$sti['complect']] = 0;
- if (!isset($coms['new'])) {
- $coms['new'] = [];
- }
- $coms['new'][count($coms['new'])] = $sti['complect'];
- }
- $coms['com'][$sti['complect']]++;
- if ($pl['2h'] > 0) {
- $coms['com'][$sti['complect']]++;
- }
- }
- if (isset($sti['complect2'])) {
- $coms[count($coms)]['id'] = $sti['complect2'];
- if (!isset($coms['com'][$sti['complect2']])) {
- $coms['com'][$sti['complect2']] = 0;
- if (!isset($coms['new'])) {
- $coms['new'] = [];
- }
- $coms['new'][count($coms['new'])] = $sti['complect2'];
- }
- $coms['com'][$sti['complect2']]++;
- if ($pl['2h'] > 0) {
- $coms['com'][$sti['complect2']]++;
- }
- }
-
- if (isset($sti['zonb']) && $sti['zonb'] != 0) {
- if (!isset($st['zonb'])) {
- $st['zonb'] = 0;
- }
- $st['zonb'] += $sti['zonb'];
- }
-
- if (isset($sti['zona']) && $sti['zona'] != 0) {
- if (!isset($st['zona'])) {
- $st['zona'] = 0;
- }
- $st['zona'] += $sti['zona'];
- }
-
- //
- if (!isset($sti['restart_stats'])) {
- $i = 0;
- while ($i < count($ia)) {
- if (isset($ia[$i])) {
-
- // ( )
- if (isset($sti['add_' . $ia[$i]])) {
-
- if ($ia[$i] != 'zmproc' && $ia[$i] != 'zaproc') {
- if (!isset($st[$ia[$i]])) {
- $st[$ia[$i]] = 0;
- }
- $st[$ia[$i]] += intval($sti['add_' . $ia[$i]]);
- } else {
- if (!isset($st[$ia[$i]])) {
- $st[$ia[$i]] = 0;
- }
- $st[$ia[$i]] = 100 - $st[$ia[$i]];
- $st[$ia[$i]] = $st[$ia[$i]] - $st[$ia[$i]] / 100 * intval($sti['add_' . $ia[$i]]);
- $st[$ia[$i]] = 100 - $st[$ia[$i]];
- }
-
- }
- }
- $i++;
- }
- } else {
- $reitm[count($reitm)] = $sti;
- }
- $i = 0;
- while ($i < count($ia)) {
- if (isset($ia[$i])) {
- if (isset($sti['sv_' . $ia[$i]])) {
- if (!isset($s_v[$ia[$i]])) {
- $s_v[$ia[$i]] = 0;
- $s_v['z'][$pl['inOdet']][$ia[$i]] = 0;
- }
- $s_v[$ia[$i]] += intval($sti['sv_' . $ia[$i]]);
- $s_v['z'][$pl['inOdet']][$ia[$i]] += intval($sti['sv_' . $ia[$i]]);
- }
- }
- $i++;
- }
- }
-
- // -
- if (count($reitm) > 0) {
- $i39 = [0 => 0, 1 => 0, 2 => 0];
- $i = 0;
- while ($i < count($reitm)) {
- if (isset($reitm[$i]['sm_skill']) && $i39[0] == 0) {
- //
- $i9 = 1;
- $i39[0] = 1;
- while ($i9 <= 7) {
- $st['a' . $i9] = $st['a' . $i9] - $st2['a' . $i9] + $reitm[$i]['add_a' . $i9];
- $st['mg' . $i9] = $st['mg' . $i9] - $st2['mg' . $i9] + $reitm[$i]['add_mg' . $i9];
- $i9++;
- }
- } elseif (isset($reitm[$i]['sm_abil']) && $i39[1] == 0) {
- //
- $i9 = 1;
- $i39[1] = 1;
- while ($i9 <= 12) {
- $st['s' . $i9] = $st['s' . $i9] - $st2['s' . $i9] + $reitm[$i]['add_s' . $i9];
- $i9++;
- }
- } elseif (isset($reitm[$i]['sm_skill2']) && $i39[2] == 0) {
- //
-
- $i39[2] = 1;
- }
- $i++;
- }
- }
-
- //
- $efs = mysql_query('SELECT * FROM `users_ico` WHERE `uid`="' . mysql_real_escape_string($u['id']) . '" AND (`endTime` > "' . time() . '" OR `endTime` = 0)');
- while ($e = mysql_fetch_array($efs)) {
- $sts = $this->lookStats($e['bonus']);
- $i = 0;
- while ($i < count($ia)) {
- if (isset($ia[$i])) {
- if (!isset($sti[$ia[$i]])) {
- $sti[$ia[$i]] = 0;
- }
- if (!isset($sts['add_' . $ia[$i]])) {
- $sts['add_' . $ia[$i]] = 0;
- }
-
- $sti[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
-
- if (!isset($st[$ia[$i]])) {
- $st[$ia[$i]] = 0;
- }
- //
- $st[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
- }
- $i++;
- }
- }
- }
-
- //
- //if( $this->info['id'] != $u['id'] ) {
- if ($u['battle'] > 0) {
- $test_btl_info = mysql_fetch_array(mysql_query('SELECT `id`,`noeff` FROM `battle` WHERE `id` = "' . $u['battle'] . '" LIMIT 1'));
- $test_noef = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_actions` WHERE `uid` = "' . $u['id'] . '" AND `vars` = "noeffectbattle1" AND `btl` = "' . $u['battle'] . '" LIMIT 1'));
- }
- //}
- //
- $h = 0;
- $nbs = [];
- $prsu = [];
- if (!isset($test_noef['id'])) {
- $efs = mysql_query('SELECT
- `eu`.`id`,`eu`.`id_eff`,`eu`.`tr_life_user`,`eu`.`uid`,`eu`.`name`,`eu`.`data`,`eu`.`overType`,`eu`.`timeUse`,`eu`.`timeAce`,`eu`.`user_use`,`eu`.`delete`,`eu`.`v1`,`eu`.`v2`,`eu`.`img2`,`eu`.`x`,`eu`.`hod`,`eu`.`bj`,`eu`.`sleeptime`,`eu`.`no_Ace`,
- `em`.`id2`,`em`.`mname`,`em`.`type1`,`em`.`img`,`em`.`mdata`,`em`.`actionTime`,`em`.`type2`,`em`.`type3`,`em`.`onlyOne`,`em`.`oneType`,`em`.`noAce`,`em`.`see`,`em`.`info`,`em`.`overch`,`em`.`bp`,`em`.`noch` FROM `eff_users` AS `eu` LEFT JOIN `eff_main` AS `em` ON (`eu`.`id_eff` = `em`.`id2`) WHERE `eu`.`uid`="' . mysql_real_escape_string($u['id']) . '" AND `eu`.`delete`="0" AND `eu`.`deactiveTime` < "' . time() . '" AND `eu`.`v1`!="priem" ORDER BY `eu`.`id` DESC LIMIT 50');
- while ($e = mysql_fetch_array($efs)) {
- if ($u['dnow'] == 0) {
- if ($u['battle'] == 0) {
- mysql_query('DELETE FROM `eff_users` WHERE `id_eff` = "' . $e['id_eff'] . '" AND `uid` = "' . $u['id'] . '" AND `id` != "' . $e['id'] . '" ORDER BY `id` ASC');
- //
- if ($e['v1'] != 'priem') {
- if ($e['hod'] != -1) {
- mysql_query('UPDATE `eff_users` SET `hod` = "-1",`timeUse` = "' . (time() + ($e['hod'] * $c['effz']) - $e['actionTime']) . '" WHERE `id` = "' . $e['id'] . '" LIMIT 1');
- }
- }
- } else {
- if ($e['v1'] != 'priem' && $c['effz'] > 0) {
- if ($e['hod'] == -1) {
- $efzz = round(($e['timeUse'] + $e['actionTime'] + $e['timeAce']) - time());
- if ($efzz > 0) {
- mysql_query('UPDATE `eff_users` SET `hod` = "' . ($efzz / $c['effz']) . '" WHERE `id` = "' . $e['id'] . '" LIMIT 1');
- }
- }
- }
- }
- }
- if (($e['timeUse'] + $e['timeAce'] + $e['actionTime'] > time() || $e['timeUse'] == 77)) {
- if ($e['v1'] == 'priem') {
- $prsu[$e['v2']] = 0 + $prsu['x'];
- }
- $st['effects'][$h] = $e;
- $h++;
- $sts = $this->lookStats($e['data']);
- if (isset($sts['itempl']) && $sts['itempl'] > 0) {
- $nbs[$sts['itempl']] += 1;
- }
- if (isset($sts['puti'])) {
- $st['puti'] = $sts['puti'];
- }
- if (isset($sts['add_silver'])) {
- $st['slvtm'] = $e['timeUse'] + $e['actionTime'];
- }
- $i = 0;
- while ($i < count($ia)) {
- if (isset($ia[$i])) {
- if (isset($sts['add_' . $ia[$i]])) {
- if (!isset($sti[$ia[$i]])) {
- $sti[$ia[$i]] = 0;
- }
- $sti[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
- }
- if (isset($sts['add_' . $ia[$i]])) {
- if ($ia[$i] != 'zaproc' && $ia[$i] != 'zmproc') {
- if (!isset($st[$ia[$i]])) {
- $st[$ia[$i]] = 0;
- }
- $st[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
- } else {
- if (!isset($st[$ia[$i]])) {
- $st[$ia[$i]] = 0;
- }
- $st[$ia[$i]] = 100 - $st[$ia[$i]];
- $st[$ia[$i]] = $st[$ia[$i]] - $st[$ia[$i]] / 100 * intval($sts['add_' . $ia[$i]]);
- $st[$ia[$i]] = 100 - $st[$ia[$i]];
- }
- }
- }
- $i++;
- }
- $i = 0;
- while ($i < count($ia)) {
- if (isset($ia[$i])) {
- if (isset($sts['sv_' . $ia[$i]])) {
- if (!isset($s_vi[$ia[$i]])) {
- $s_vi[$ia[$i]] = 0;
- }
- $s_vi[$ia[$i]] += intval($sts['sv_' . $ia[$i]]);
- }
- if (isset($sts['sv_' . $ia[$i]])) {
- if (!isset($s_v[$ia[$i]])) {
- $s_v[$ia[$i]] = 0;
- }
- $s_v[$ia[$i]] += intval($sts['sv_' . $ia[$i]]);
- }
- }
- $i++;
- }
- } elseif ($e['timeUse'] != 77) {
- //
- if ($e['img2'] != 'tz.gif' || $u['id'] == $this->info['id']) {
- if ($e['sleeptime'] == 0) {
- $this->endEffect($e['id'], $u);
- }
- $st['act'] = 1;
- }
- }
- }
- } else {
- $st['noeffectbattle1'] = 1;
- }
-
- //
- //$st['items_img'][$pl_img['type']] = $pl_img_r['id'].'.'.$pl_img_r['format'];
- if ($nbs[4899] > 0) {
- //
- $st['items_img'][8] = 'robe_illusion4.gif';
- $st['items_img'][11] = 'leg_illusion4.gif';
- } elseif ($nbs[4900] > 0) {
- //
- $st['items_img'][8] = 'robe_illusion5.gif';
- $st['items_img'][11] = 'leg_illusion5.gif';
- } elseif ($nbs[4901] > 0) {
- //
- $st['items_img'][8] = 'robe_illusion3.gif';
- $st['items_img'][11] = 'leg_illusion3.gif';
- } elseif ($nbs[4902] > 0) {
- //
- $st['items_img'][8] = 'robe_illusion6.gif';
- $st['items_img'][11] = 'leg_illusion6.gif';
- } elseif ($nbs[4903] > 0) {
- //
- $st['items_img'][8] = 'robe_illusion8.gif';
- $st['items_img'][11] = 'leg_illusion8.gif';
- } elseif ($nbs[4904] > 0) {
- //
- $st['items_img'][8] = 'robe_illusion7.gif';
- $st['items_img'][11] = 'leg_illusion7.gif';
- } elseif ($nbs[4905] > 0) {
- //
- $st['items_img'][8] = 'robe_illusion9.gif';
- $st['items_img'][11] = 'leg_illusion9.gif';
- } elseif ($nbs[4908] > 0) {
- //
- $st['items_img'][8] = 'robe_illusion2.gif';
- $st['items_img'][11] = 'leg_illusion2.gif';
- $st['items_img'][10] = 'boots_illusion2.gif';
- $st['items_img'][9] = 'belt_illusion2.gif';
- $st['items_img'][5] = 'naruchi_illusion2.gif';
- $st['items_img'][4] = 'helmet_illusion2.gif';
- $st['items_img'][12] = 'perchi_illusion2.gif';
- } elseif ($nbs[4906] > 0) {
- //
- $st['items_img'][8] = 'robe_illusion1.gif';
- $st['items_img'][11] = 'leg_illusion1.gif';
- $st['items_img'][10] = 'boots_illusion1.gif';
- $st['items_img'][9] = 'belt_illusion1.gif';
- $st['items_img'][5] = 'naruchi_illusion1.gif';
- $st['items_img'][4] = 'helmet_illusion1.gif';
- $st['items_img'][12] = 'perchi_illusion1.gif';
- }
- if ($nbs[4909] > 0) {
- //
- $st['items_img'][13] = 'ring_illusion2.gif';
- $st['items_img'][17] = 'ring_illusion2.gif';
- $st['items_img'][18] = 'ring_illusion2.gif';
- $st['items_img'][14] = 'amulet_illusion2.gif';
- $st['items_img'][15] = 'earrings_illusion2.gif';
- } elseif ($nbs[4907] > 0) {
- //
- $st['items_img'][13] = 'ring_illusion1.gif';
- $st['items_img'][17] = 'ring_illusion1.gif';
- $st['items_img'][18] = 'ring_illusion1.gif';
- $st['items_img'][14] = 'amulet_illusion1.gif';
- $st['items_img'][15] = 'earrings_illusion1.gif';
- }
-
- if ($itmslvl < 5) {
- //
- $st['itmslvl'] = 0;
- } else {
- $st['itmslvl'] = 1;
- }
- //
- $st['itmsCfc'] = $itmsCfc;
-
- unset($test_btl_info);
-
- if ($u['battle'] > 0) {
- //
- $efs = mysql_query('SELECT `eu`.`id`,`eu`.`id_eff`,`eu`.`uid`,`eu`.`name`,`eu`.`data`,`eu`.`overType`,`eu`.`timeUse`,`eu`.`timeAce`,`eu`.`user_use`,`eu`.`tr_life_user`,`eu`.`delete`,`eu`.`v1`,`eu`.`v2`,`eu`.`img2`,`eu`.`x`,`eu`.`hod`,`eu`.`bj`,`eu`.`sleeptime`,`eu`.`no_Ace` FROM `eff_users` AS `eu` WHERE `eu`.`uid`="' . mysql_real_escape_string($u['id']) . '" AND `eu`.`delete`="0" AND `eu`.`deactiveTime` < "' . time() . '" AND `eu`.`v1` = "priem" ORDER BY `eu`.`id` ASC');
- $st['set_pog'] = [];
- $st['set_pog2'] = [];
- while ($e = mysql_fetch_array($efs)) {
- $e['type1'] = 14;
- $e['img'] = $e['img2'];
- if ($e['tr_life_user'] > 0) {
- $trlu = mysql_fetch_array(mysql_query('SELECT `hpNow` FROM `stats` WHERE `id` = "' . $e['tr_life_user'] . '" LIMIT 1'));
- if (floor($trlu['hpNow']) < 1) {
- $this->endEffect($e['id'], $u);
- $st['act'] = 1;
- }
- }
- if ($e['timeUse'] + $e['timeAce'] + $e['actionTime'] > time() || $e['timeUse'] == 77) {
- if ($e['v1'] == 'priem') {
- $prsu[$e['v2']] = 0 + $prsu['x'];
- }
- $st['effects'][$h] = $e;
- $h++;
- $sts = $this->lookStats($e['data']);
- if ($e['v2'] == 217) {
- $st['raztac'] = 1;
- }
- if (isset($sts['add_pog'])) {
- $ctt = count($st['set_pog']);
- $st['set_pog'][$ctt]['id'] = $h;
- $st['set_pog'][$ctt]['y'] = $sts['add_pog'];
- unset($ctt);
- }
- if (isset($sts['natoe'])) {
- $st['set_natoe']['id'] = $h;
- $st['set_natoe']['a'] = 0 + $sts['natoe_end'];
- $st['set_natoe']['b'] = 0 + $sts['natoe'];
- $st['set_natoe']['eff_id'] = $e['id'];
- $st['set_natoe']['t'] = 0 + $sts['natoe_type'];
- $st['set_natoe']['user_id'] = $e['tr_life_user'];
- }
- if (isset($sts['add_pog2'])) {
- $ctt = count($st['set_pog2']);
- $st['set_pog2'][$ctt]['id'] = $h;
- $st['set_pog2'][$ctt]['y'] = $sts['add_pog2'];
- $st['set_pog2'][$ctt]['p'] = $sts['add_pog2p'];
- $st['set_pog2'][$ctt]['m'] = $sts['add_pog2mp'];
- unset($ctt);
- }
- $i = 0;
- while ($i < count($ia)) {
- if (isset($ia[$i])) {
- if (isset($sts['add_' . $ia[$i]])) {
- if ($ia[$i] != 'zaproc' && $ia[$i] != 'zmproc') {
- if (!isset($sti[$ia[$i]])) {
- $sti[$ia[$i]] = 0;
- }
- $sti[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
- if (!isset($st[$ia[$i]])) {
- $st[$ia[$i]] = 0;
- }
- $st[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
- } else {
- $sti[$ia[$i]] = 100 - $sti[$ia[$i]];
- $sti[$ia[$i]] = $sti[$ia[$i]] - $sti[$ia[$i]] / 100 * intval($sts['add_' . $ia[$i]]);
- $sti[$ia[$i]] = 100 - $sti[$ia[$i]];
-
- $st[$ia[$i]] = 100 - $st[$ia[$i]];
- $st[$ia[$i]] = $st[$ia[$i]] - $st[$ia[$i]] / 100 * intval($sts['add_' . $ia[$i]]);
- $st[$ia[$i]] = 100 - $st[$ia[$i]];
- }
- }
- }
- $i++;
- }
- $i = 0;
- while ($i < count($ia)) {
- if (isset($ia[$i])) {
- if (isset($sts['add_' . $ia[$i]])) {
- if (!isset($s_vi[$ia[$i]])) {
- $s_vi[$ia[$i]] = 0;
- }
- $s_vi[$ia[$i]] += intval($sts['sv_' . $ia[$i]]);
- if (!isset($s_v[$ia[$i]])) {
- $s_v[$ia[$i]] = 0;
- }
- $s_v[$ia[$i]] += intval($sts['sv_' . $ia[$i]]);
- }
- }
- $i++;
- }
- } elseif ($e['timeUse'] != 77) {
- //
- $this->endEffect($e['id'], $u);
- $st['act'] = 1;
- }
- }
- }
-
- //
-
- if (!isset($st['hpAll'])) {
- $st['hpAll'] = 0;
- }
- $st['hpAll'] += $st['s4'] * 5;
-
- if (!isset($st['mpAll'])) {
- $st['mpAll'] = 0;
- }
- @$st['mpAll'] += @$st['s6'] * 10;
-
- //
- if (!isset($st['m1'])) {
- $st['m1'] = 0;
- }
- $st['m1'] += $st['s3'] * 5;
-
-
- // .- = 2.5
- if (!isset($st['m2'])) {
- $st['m2'] = 0;
- }
- $st['m2'] += $st['s3'] * 5;
-
- // . = 2.5
- if (!isset($st['m4'])) {
- $st['m4'] = 0;
- }
- $st['m4'] += $st['s2'] * 5;
-
- // .- = 2.5
- if (!isset($st['m5'])) {
- $st['m5'] = 0;
- }
- $st['m5'] += $st['s2'] * 5;
-
- if (!isset($st['za'])) {
- $st['za'] = 0;
- }
- $st['za'] += $st['s4'] * 1.0;
-
- if (!isset($st['zm'])) {
- $st['zm'] = 0;
- }
- $st['zm'] += $st['s4'] * 1.0;
-
- if (!isset($st['zaproc'])) { // 'zaproc'=>' (%)','zmproc'=>' (%)
- $st['zaproc'] = 0;
- }
- $st['zaproc'] += round($st['s5'] * 0);
-
- if (!isset($st['m19'])) {
- $st['m19'] = 0;
- }
- $st['m19'] += round($st['s3'] * 0.03);
-
- //
- // " . ".
- if (!isset($st['antm3'])) {
- $st['antm3'] = 0;
- }
- $st['antm3'] += $st['s2'] * 0.5;
-
-
- if (!isset($st['m10'])) {
- $st['m10'] = 0;
- }
- $st['m10'] += 0;
-
- if (!isset($st['m11'])) {
- $st['m11'] = 0;
- }
- $st['m11'] += 0;
-
- if (!isset($st['m11a'])) {
- $st['m11a'] = 0;
- }
- $st['m11a'] += 0;
-
-
- if (!isset($st['m8'])) {
- $st['m8'] = 0;
- }
- $st['m8'] += 0;
-
- //
- $i = 0;
- while ($i <= count(@$coms['new'])) {
- if (@isset($coms['new'][$i])) {
- //$coms[$i]['id'] - id , $j - -
- $j = @$coms['com'][$coms['new'][$i]];
- $com = mysql_fetch_array(mysql_query('SELECT `id`,`com`,`name`,`x`,`data` FROM `complects` WHERE `com` = "' . ((int)$coms['new'][$i]) . '" AND `x` <= ' . ((int)$j) . ' ORDER BY `x` DESC LIMIT 1'));
- if (isset($com['id'])) {
- //
- $ij = 0;
- $sti = $this->lookStats($com['data']);
- while ($ij < count($ia)) {
- if (isset($ia[$ij]) && isset($sti[$ia[$ij]])) {
- $st[$ia[$ij]] += $sti[$ia[$ij]];
- }
- $ij++;
- }
- }
- }
- $i++;
- }
-
- //
- //
- if ($u['autospell'] != '' && $u['autospell'] != 0 && $u['battle'] == 0) {
- //
- $splink = '';
- $spi = mysql_query('SELECT `id`,`item_id`,`inOdet` FROM `items_users` WHERE `inOdet` >= 40 AND `inOdet` <= 50 AND `uid` = "' . $u['id'] . '" AND `delete` = 0 ORDER BY `item_id` DESC LIMIT 20');
- while ($pli = mysql_fetch_array($spi)) {
- $splink .= $pli['item_id'] . '-' . $pli['inOdet'] . ',';
- }
- $splink = rtrim($splink, ',');
-
- //
- if ($u['autospell'] == 1) {
- $u['autospell'] = $splink;
- mysql_query('UPDATE `users` SET `autospell` = "' . $splink . '" WHERE `id` = "' . $u['id'] . '" LIMIT 1');
- }
-
- // ,
- if ($u['autospell'] != $splink) {
- $spe1 = explode(',', $splink);
- $spe2 = explode(',', $u['autospell']);
- $i = 0;
- while ($i <= 20) {
- //
- $spe1a = explode('-', $spe1[$i]);
- $spe2a = explode('-', $spe2[$i]);
- //
- if (isset($spe1a[0])) {
- $spe1g[$spe1a[1]] = $spe1a[0];
- }
- if (isset($spe2a[0])) {
- $spe2g[$spe2a[1]] = $spe2a[0];
- }
- //
- $i++;
- }
- $i = 40;
- while ($i <= 50) {
- if ($spe1g[$i] != $spe2g[$i] && $spe1g[$i] == 0) {
- //echo '['.$spe2g[$i].'->'.$i.']';
- $splu = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `item_id` = "' . $spe2g[$i] . '" AND `inOdet` = 0 AND `delete` = 0 AND `inTransfer` = 0 AND `inShop` = 0 AND `uid` = "' . $u['id'] . '" AND `inGroup` = 0 LIMIT 1'));
- if (isset($splu['id'])) {
- mysql_query('UPDATE `items_users` SET `inOdet` = "' . $i . '" WHERE `id` = "' . $splu['id'] . '" LIMIT 1');
- }
- }
- $i++;
- }
- }
- }
-
-
- //
- //
- //
-
- if ($st['s1'] > 24 && $st['s1'] < 50) {
- $st['m2'] += 15;
- }
- if ($st['s1'] > 49 && $st['s1'] < 75) {
- $st['pa2'] += 2;
- $st['m2'] += 35;
- }
- if ($st['s1'] > 74 && $st['s1'] < 100) {
- $st['pa2'] += 5;
- $st['m2'] += 50;
- }
- if ($st['s1'] > 99 && $st['s1'] < 125) {
- $st['pa2'] += 8;
- $st['m2'] += 80;
- }
- if ($st['s1'] > 124 && $st['s1'] < 150) {
- $st['pa2'] += 12;
- $st['m2'] += 105;
- }
- if ($st['s1'] > 149 && $st['s1'] < 175) {
- $st['pa2'] += 17;
- $st['m7'] += 2;
- }
- if ($st['s1'] > 174 && $st['s1'] < 200) {
- $st['pa2'] += 23;
- $st['m7'] += 5;
- }
- if ($st['s1'] > 199) {
- $st['pa2'] += 30;
- $st['m7'] += 7;
- }
-
- // $st[1]['pa1'] += 2; $st['m7'] += 35;
-
- if ($st['s2'] > 24 && $st['s2'] < 50) {
- $st['pa1'] += 2;
- $st['m4'] += 35;
- }
- if ($st['s2'] > 49 && $st['s2'] < 75) {
- $st['pa1'] += 5;
- $st['m2'] += 40;
- $st['m4'] += 75;
- }
- if ($st['s2'] > 74 && $st['s2'] < 100) {
- $st['pa1'] += 8;
- $st['m2'] += 65;
- $st['m4'] += 90;
- }
- if ($st['s2'] > 99 && $st['s2'] < 125) {
- $st['pa1'] += 12;
- $st['m2'] += 75;
- $st['m4'] += 105;
- }
- if ($st['s2'] > 124 && $st['s2'] < 150) {
- $st['pa1'] += 17;
- $st['m2'] += 85;
- $st['m4'] += 105;
- $st['m15'] += 1;
- }
- if ($st['s2'] > 149 && $st['s2'] < 175) {
- $st['pa1'] += 20;
- $st['m2'] += 110;
- $st['m4'] += 115;
- $st['m15'] += 2;
- }
- if ($st['s2'] > 174 && $st['s2'] < 200) {
- $st['pa1'] += 23;
- $st['m2'] += 145;
- $st['m4'] += 145;
- $st['m15'] += 3;
- }
- if ($st['s2'] > 199) {
- $st['pa1'] += 30;
- $st['m2'] += 165;
- $st['m4'] += 165;
- $st['m15'] += 5;
- }
-
- //
-
- if ($st['s3'] > 24 && $st['s3'] < 50) {
- $st['pa4'] += 2;
- $st['m3'] += 2;
- $st['m1'] += 25;
- }
- if ($st['s3'] > 49 && $st['s3'] < 75) {
- $st['pa4'] += 5;
- $st['m3'] += 5;
- $st['m1'] += 55;
- }
- if ($st['s3'] > 74 && $st['s3'] < 100) {
- $st['pa4'] += 8;
- $st['m3'] += 10;
- $st['m1'] += 75;
- $st['m5'] += 25;
- }
- if ($st['s3'] > 99 && $st['s3'] < 125) {
- $st['pa4'] += 12;
- $st['m3'] += 15;
- $st['m1'] += 105;
- $st['m5'] += 35;
- }
- if ($st['s3'] > 124 && $st['s3'] < 150) {
- $st['pa4'] += 17;
- $st['m3'] += 20;
- $st['m1'] += 125;
- $st['m5'] += 45;
- $st['m14'] += 1;
- }
- if ($st['s3'] > 149 && $st['s3'] < 175) {
- $st['pa4'] += 20;
- $st['m3'] += 30;
- $st['m1'] += 145;
- $st['m5'] += 50;
- $st['m14'] += 2;
- }
- if ($st['s3'] > 174 && $st['s3'] < 200) {
- $st['pa4'] += 23;
- $st['m3'] += 35;
- $st['m1'] += 165;
- $st['m5'] += 55;
- $st['m14'] += 3;
- }
- if ($st['s3'] > 199) {
- $st['pa4'] += 30;
- $st['m3'] += 40;
- $st['m1'] += 185;
- $st['m5'] += 65;
- $st['m14'] += 5;
- }
-
- //
-
- if ($st['s4'] > 0) {
- $st['hpAll'] += 30;
- }
- if ($st['s4'] > 24 && $st['s4'] < 50) {
- $st['hpAll'] += 50;
- }
- if ($st['s4'] > 49 && $st['s4'] < 75) {
- $st['hpAll'] += 100;
- }
- if ($st['s4'] > 74 && $st['s4'] < 100) {
- $st['hpAll'] += 175;
- $st['m19'] += 2;
- }
- if ($st['s4'] > 99 && $st['s4'] < 125) {
- $st['hpAll'] += 250;
- $st['m19'] += 4;
- }
- if ($st['s4'] > 124 && $st['s4'] < 150) {
- $st['hpAll'] += 400;
- $st['za'] += 25;
- $st['zm'] += 25;
- }
- if ($st['s4'] > 149 && $st['s4'] < 175) {
- $st['hpAll'] += 450;
- $st['za'] += 50;
- $st['zm'] += 50;
- }
- if ($st['s4'] > 174 && $st['s4'] < 200) {
- $st['hpAll'] += 600;
- $st['za'] += 100;
- $st['zm'] += 100;
- }
- if ($st['s4'] > 199) {
- $st['hpAll'] += 850;
- $st['za'] += 125;
- $st['zm'] += 125;
- }
- //
-
- if ($st['s5'] > 24 && $st['s5'] < 50) {
- $st['m11'] += 10;
- }
- if ($st['s5'] > 49 && $st['s5'] < 75) {
- $st['m11'] += 15;
- }
- if ($st['s5'] > 74 && $st['s5'] < 100) {
- $st['m11'] += 20;
- }
- if ($st['s5'] > 99 && $st['s5'] < 125) {
- $st['m11'] += 25;
- }
- if ($st['s5'] > 124 && $st['s5'] < 150) {
- $st['m11'] += 35;
- }
- if ($st['s5'] > 149 && $st['s5'] < 175) {
- $st['m11'] += 50;
- }
- if ($st['s5'] > 174) {
- $st['m11'] += 65;
- $st['pzm'] += 2;
- }
- if ($st['s5'] > 199) {
- $st['pzm'] += 5;
- }
- //
-
- if ($st['s6'] > 24 && $st['s6'] < 50) {
- $st['mpAll'] += 150;
- $st['speedmp'] += 100;
- }
- if ($st['s6'] > 49 && $st['s6'] < 75) {
- $st['mpAll'] += 200;
- $st['speedmp'] += 200;
- }
- if ($st['s6'] > 74 && $st['s6'] < 100) {
- $st['mpAll'] += 250;
- $st['speedmp'] += 350;
- }
- if ($st['s6'] > 99 && $st['s6'] < 125) {
- $st['mpAll'] += 350;
- $st['speedmp'] += 500;
- }
- if ($st['s6'] > 124 && $st['s6'] < 150) {
- $st['mpAll'] += 500;
- $st['speedmp'] += 500;
- $st['pzm'] += 2;
- }
- if ($st['s6'] > 149 && $st['s6'] < 175) {
- $st['mpAll'] += 700;
- $st['speedmp'] += 600;
- $st['pzm'] += 3;
- }
- if ($st['s6'] > 174 && $st['s6'] < 200) {
- $st['mpAll'] += 900;
- $st['speedmp'] += 700;
- $st['pzm'] += 5;
- }
- if ($st['s6'] > 199) {
- $st['mpAll'] += 900;
- $st['speedmp'] += 700;
- $st['pzm'] += 7;
- }
-
- //
- if ($hnd2 == 1 && $hnd1 == 1) {
- $st['zona']++;
- }
-
- if ($sht1 == 1) {
- $st['zonb']++;
- }
-
- /* */
- $i = 1;
- while ($i <= 7) {
- if (!isset($st['pm' . $i])) {
- $st['pm' . $i] = 0;
- }
- if (!isset($st['a' . $i])) {
- $st['a' . $i] = 0;
- }
- if (!isset($st['mg' . $i])) {
- $st['mg' . $i] = 0;
- }
- if (!isset($st['zm' . $i])) {
- $st['zm' . $i] = 0;
- }
- if (isset($st['s5'])) {
- $st['pm' . $i] += $st['s5'] * 0.5;
- }
- if (isset($st['m11a'])) {
- $st['pm' . $i] += $st['m11a'];
- }
- if (isset($st['aall'])) {
- $st['a' . $i] += $st['aall'];
- }
- if (isset($st['m2all'])) {
- $st['mg' . $i] += $st['m2all'];
- }
- if (isset($st['zm'])) {
- $st['zm' . $i] += $st['zm'];
- }
- if (isset($st['zma'])) {
- $st['zm' . $i] += $st['zma'];
- }
- if ($i <= 4) {
- if (!isset($st['mib' . $i])) {
- $st['mib' . $i] = 0;
- }
- if (!isset($st['mab' . $i])) {
- $st['mab' . $i] = 0;
- }
- if (!isset($st['mg' . $i])) {
- $st['mg' . $i] = 0;
- }
- if (!isset($st['pm' . $i])) {
- $st['pm' . $i] = 0;
- }
- if (!isset($st['pa' . $i])) {
- $st['pa' . $i] = 0;
- }
- if (!isset($st['za' . $i])) {
- $st['za' . $i] = 0;
- }
- $st['mib' . $i] += 0;
- $st['mab' . $i] += 0;
- if (isset($st['mall'])) {
- $st['mg' . $i] += $st['mall'];
- }
- if (isset($st['m11'])) {
- $st['pm' . $i] += $st['m11'];
- }
- if (isset($st['m10'])) {
- $st['pa' . $i] += $st['m10'];
- }
- if (isset($st['za'])) {
- $st['za' . $i] += $st['za'];
- }
- }
- $i++;
- }
-
- //
-
- $i = 1;
- while ($i <= 7) {
- @$st['yzm' . $i] += @$st['yzma'];
- if ($i <= 4) {
- @$st['yzm' . $i] += @$st['yzm'];//
- @$st['yza' . $i] += @$st['yza']; //
- }
- //
- if (isset($st['yza' . $i]) && $i <= 4) {
- $st['za' . $i] = ($st['za' . $i] / 100 * (100 + ($st['yza' . $i])));
- if ($st['za' . $i] < 0) {
- $st['za' . $i] = 0;
- }
- }
- //
- if (isset($st['yzm' . $i])) {
- $st['zm' . $i] = ($st['zm' . $i] / 100 * (100 + ($st['yzm' . $i])));
- if ($st['zm' . $i] < 0) {
- $st['zm' . $i] = 0;
- }
- }
- $i++;
- }
-
-
- if (isset($st['hpVinos']) && $st['hpVinos'] != 0) {
- $st['hpAll'] += round($st['hpVinos'] * $st['s4']);
- }
-
- if (isset($st['mpVinos']) && $st['mpVinos'] != 0) {
- $st['mpAll'] += round($st['mpVinos'] * $st['s6']);
- }
-
- if (isset($st['hpProc']) && $st['hpProc'] != 0) {
- $st['hpAll'] += round($st['hpAll'] / 100 * $st['hpProc']);
- }
-
- if (isset($st['mpProc']) && $st['mpProc'] != 0) {
- $st['mpAll'] += round($st['mpAll'] / 100 * $st['mpProc']);
- }
-
- //. - 250 .
-
-
- //
- if ($st['hpNow'] < 0) {
- $st['hpNow'] = 0;
- } elseif ($st['hpNow'] > $st['hpAll']) {
- $st['hpNow'] = $st['hpAll'];
- }
- if ($st['mpNow'] < 0) {
- $st['mpNow'] = 0;
- } elseif ($st['mpNow'] > $st['mpAll']) {
- $st['mpNow'] = $st['mpAll'];
- }
-
- //
- if ($st['zona'] < 1) {
- $st['zona'] = 1;
- }
- if ($st['zona'] > 5) {
- $st['zona'] = 5;
- }
- if ($st['zonb'] < 1) {
- $st['zonb'] = 1;
- }
- if ($st['zonb'] > 3) {
- $st['zonb'] = 3;
- }
-
- $st['ozash'] = $oza;
- $st['ozmsh'] = $ozm;
- $st['weapon1'] = $hnd1;
- $st['weapon2'] = $hnd2;
- $st['sheld1'] = $sht1;
- $st['sv_'] = $s_v;
- $st['sv_i'] = $s_vi;
- $st['dom'] = $dom;
- $st['prsu'] = $prsu;
-
- $st['x'] = $u['x'];
- $st['y'] = $u['y'];
- $st['s'] = $u['s'];
-
- $st['reting'] = 1 + ceil($st['reting']);
- $st['reting'] = 1 + $st['irka'];
-
- if ($st['vip'] > 0) { //$u
- $st['antm3'] += 20;
- $st['zaproc'] += 5;
- $st['zmproc'] += 5;
- $st['m10'] += 20;
- $st['pzm'] += 5;
- }
-
- //
- $rep1 = mysql_fetch_array(mysql_query('SELECT
- `add_slot`,`nu_sandcity`,`n_sandcity`,
- `dl1`,`id`,`rep1`,`rep2`,`repcapitalcity`,`repdemonscity`,`repangelscity`,`repabandonedplain`,
- `repdevilscity`,`repmooncity`,`repsuncity`,`repsandcity`,`repemeraldscity`,`repdreamscity`,`repizlom`,
- `n_capitalcity`,`n_demonscity`,`n_suncity`,`nu_demonscity`,`nu_angelscity`,`nu_abandonedplain`,`nu_emeraldscity`,
- `nu_capitalcity`,`nu_suncity`,`nu_devilscity`,`nu_dreamscity`,`add_stats`,`add_money`,`add_skills`,`add_skills2`,
- `rep3`,`rep3_buy`,`repdragonscity`,`n_dragonscity`,`nu_dragonscity`,
- (`repcapitalcity`+`repdemonscity`+`repangelscity`+`repsuncity`+`repdreamscity`+`repabandonedplain`+`repsandcity`+`repemeraldscity`+`repdevilscity`) as allrep,
- (`nu_capitalcity`+`nu_demonscity`+`nu_angelscity`+`nu_suncity`+`nu_dreamscity`+`nu_abandonedplain`+`nu_sandcity`+`nu_emeraldscity`+`nu_devilscity`) as allnurep FROM `rep` WHERE `id` = "' . $u['id'] . '" LIMIT 1'));
-
- if ($u['referals'] >= 3000) {
- $st['speedhp'] += 50;
- $st['speedmp'] += 50;
- $st['antm3'] += 25;
- $st['m10'] += 15;
- $st['m11'] += 15;
- $st['speed_dungeon'] += 25;
- $st['hpAll'] += 250;
- }
-
- //
- if ($rep1['repdreamscity'] >= 24999) {
- $st['m10'] += 10;
- $st['pzm'] += 1;
- }
- //
- if ($rep1['repizlom'] == 9999) {
- $st['m10'] += 10;
- $st['pzm'] += 1;
- }
- //
- if ($rep1['repangelscity'] == 25000) {
- $st['m10'] += 10;
- $st['pzm'] += 1;
- }
- //
- if ($rep1['repdemonscity'] == 25000) {
- $st['m10'] += 10;
- $st['pzm'] += 1;
- }
- //
- if ($rep1['repdemonscity'] == 25000) {
- $st['m10'] += 10;
- $st['pzm'] += 1;
- }
- //
- if ($rep1['repcapitalcity'] == 25000) {
- $st['m10'] += 10;
- $st['pzm'] += 1;
- }
- //
- if ($rep1['repsandcity'] == 25000) {
- $st['m10'] += 10;
- $st['pzm'] += 1;
- }
- //
- if ($rep1['repabandonedplain'] == 24999) {
- $st['m10'] += 10;
- $st['pzm'] += 1;
- }
-
-
- //
- $st['maxves'] += 500;
-
- if ($st['silver'] >= 5) {
- $st['speed_dungeon'] += 25;
- }
-
- if ($u['admin'] > 0) {
- $st['speed_dungeon'] += 1000;
- $st['speedhp'] += 1000000000000000;
- }
-
- if (date('H') >= 22 && date('H') <= 10) {
- $st['exp'] += 25;
- }
-
- //
- $st['reting'] = floor($st['reting']);
-
- if (@$st['btl_cof'] != @$st['prckr']) {
- $st['btl_cof'] = $st['prckr'];
- mysql_query('UPDATE `stats` SET `btl_cof` = "' . $st['prckr'] . '" WHERE `id` = "' . $st['id'] . '" LIMIT 1');
- }
-
- if ($st['hpAll'] < 1) {
- $st['hpAll'] = 1;
- }
-
- if ($st['mpAll'] < 0) {
- $st['mpAll'] = 0;
- }
-
- if ($u['room'] == 411) {
- //, -25%
- $shb = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "' . $u['id'] . '" AND `item_id` = 4910 AND `delete` = 0 LIMIT 1'));
- if (isset($shb['id'])) {
- $st['hpAll'] = round($st['hpAll'] / 100 * 75);
- }
- }
-
- if (stristr($u['login'], '( ') == true || (stristr($u['login'], ' ') && $u['ip'] == '0')) {
- $st['this_animal'] = 1;
- } else {
- $st['this_animal'] = 0;
- }
-
- $rt = [];
- if ($i1 == 1) {
- $rt[0] = $st;
- $rt[1] = $st2; //
- } else {
- $rt = $st;
- }
-
- if ($u['hpAll'] != $st['hpAll'] || $u['mpAll'] != $st['mpAll']) {
- mysql_query('UPDATE `stats` SET `hpAll` = "' . $st['hpAll'] . '",`mpAll` = "' . $st['mpAll'] . '" WHERE `id` = "' . $u['id'] . '" LIMIT 1');
- }
-
- if ($btl_cache == true && $cache == false) {
- $dataca = [
- 'st' => $st,
- 'st2' => $st2
- ];
- $dataca = json_encode($dataca);
- mysql_query('INSERT INTO `battle_cache` (`uid`,`battle`,`data`,`time`) VALUES ("' . $u['id'] . '","' . $u['battle'] . '","' . mysql_real_escape_string($dataca) . '","' . time() . '")');
- }
- }
-
- if (isset($cache)) {
- if ($i1 == 1) {
- $rt = [$cache['st'], $cache['st2']];
- } else {
- $rt = $cache['st'];
- }
- }
-
- return $rt;
- }
-
- public function send($color, $room, $city, $from, $to, $text, $time, $type, $toChat, $spam, $sound, $new = 1, $typeTime = 0, $global = 0)
- {
- mysql_query("INSERT INTO `chat` (`global`,`typeTime`,`new`,`sound`,`color`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`spam`) VALUES
- ('" . $global . "','" . $typeTime . "','" . $new . "','" . $sound . "','" . $color . "','" . $city . "','" . $room . "','" . $from . "','" . $to . "','" . $text . "','" . $time . "','" . $type . "','" . $toChat . "','" . $spam . "')");
- $msg_id = mysql_insert_id();
- return $msg_id;
- }
-
- //
- public function testLevel()
- {
- global $c;
- $rt = 0;
- if ($this->info['expstopu'] > 2 && $this->info['exp'] > $c['expstopu']) {
- $this->info['exp'] = $c['expstopu'];
- mysql_query('UPDATE `stats` SET `exp` = "' . $c['expstopu'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
- } elseif ($this->info['exp'] > $c['expstop'] && $this->info['expstopu'] < 3) {
- //upexpdate
- if ($this->info['upexpdate'] == 0) {
- $this->info['upexpdate'] = time();
- mysql_query('UPDATE `stats` SET `upexpdate` = "' . time() . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
- } elseif (time() >= ($this->info['upexpdate'] + 400 * 60 * 60 * 24)) //4*60*60*24
- {
- $this->info['upexpdate'] = time();
- $this->info['expstopu'] = $this->info['expstopu'] + 1;
- mysql_query('UPDATE `stats` SET `upexpdate` = "' . time() . '",`expstopu` = `expstopu`+1 WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
- }
- if ($this->info['expstopu'] < 3) {
- $this->info['exp'] = $c['expstop'];
- mysql_query('UPDATE `stats` SET `exp` = "' . $c['expstop'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
- }
- }
- if (isset($this->stats['levels']['upLevel'])) {
- $telvl = [];
- $sp = mysql_query('SELECT `upLevel`,`exp` FROM `levels`');
- while ($pl = mysql_fetch_array($sp)) {
- $telvl[$pl['upLevel']] = $pl['exp'];
- }
- if ($this->info['exp'] >= $telvl[$this->info['upLevel']]) {
- $lvl = mysql_fetch_array(mysql_query('SELECT `duh`,`vinos`,`bprice`,`upLevel`,`nextLevel`,`exp`,`money`,`money_bonus1`,`money_bonus2`,`ability`,`skills`,`nskills`,`sskills`,`expBtlMax`,`hpRegen`,`mpRegen`,`money2` FROM `levels` WHERE `upLevel`="' . $this->info['upLevel'] . '" LIMIT 1'));
- $lvln = mysql_fetch_array(mysql_query('SELECT `duh`,`vinos`,`bprice`,`upLevel`,`nextLevel`,`exp`,`money`,`money_bonus1`,`money_bonus2`,`ability`,`skills`,`nskills`,`sskills`,`expBtlMax`,`hpRegen`,`mpRegen`,`money2` FROM `levels` WHERE `upLevel`="' . ($lvl['upLevel'] + 1) . '" LIMIT 1'));
- //
- if ($this->info['exp'] > 12499 && $this->info['level'] <= 5 && $c['infinity5level'] == true) {
- $itm = mysql_fetch_array(mysql_query('SELECT `id`,`item_id`,`1price`,`2price`,`3price`,`uid`,`use_text`,`data`,`inOdet`,`inShop`,`delete`,`iznosNOW`,`iznosMAX`,`gift`,`gtxt1`,`gtxt2`,`kolvo`,`geniration`,`magic_inc`,`maidin`,`lastUPD`,`timeOver`,`overType`,`secret_id`,`time_create`,`inGroup`,`dn_delete`,`inTransfer`,`post_delivery`,`lbtl_`,`bexp`,`so`,`blvl` FROM `items_users` WHERE `item_id` = "1204" AND `delete` = "0" AND `uid` = "' . $this->info['id'] . '" AND `inShop` = "0" AND `inTransfer` = "0" LIMIT 1'));
- if (!isset($itm['id']) && $this->info['host_reg'] != 'noinfinity5' && $this->info['twink'] == 0) {
- $this->info['exp'] = 12499;
- mysql_query('UPDATE `stats` SET `exp` = "12499" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
- echo '';
- } else {
-
- mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
- $text = ' "
[6]" .';
- echo '';
- //mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1',".$this->info['city']."','".$this->info['room']."','','".$this->info['login']."','".$text."','".time()."','6','0')");
- }
-
- }
- //****************
- $i = 0;
- $ult = 0;
- //mysql_query('LOCK TABLES users,stats,mults,bank,referal_bous,levels,chat WRITE');
- while ($i != 1) {
- if ($c['nolevel'] == true && $this->info['exp'] >= $lvl['exp'] && isset($lvln['upLevel'])) {
- $tlus = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `real` = 1 AND `level` = "' . $this->info['level'] . '" LIMIT 1'));
- // , $lvln
- if ($tlus[0] < $this->info['level'] * 5) {
- // / 100
- $this->info['exp'] = $lvl['exp'] - 1;
- mysql_query('UPDATE `stats` SET `exp` = "' . $this->info['exp'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
- }
- }
- if ($this->info['exp'] >= $lvl['exp'] && isset($lvln['upLevel'])) {
- if ($lvl['nextLevel'] > $this->info['level']) {
-
- //
- $a4 = 1;
- if ($lvl['nextLevel'] == 9) {
- $a4 = 2;
- } elseif ($lvl['nextLevel'] == 10) {
- $a4 = 3;
- } elseif ($lvl['nextLevel'] == 11) {
- $a4 = 5;
- } elseif ($lvl['nextLevel'] == 12) {
- $a4 = 30;
- }
-
- $this->stats['s4'] += $a4;
- $sex1 = '';
- if ($this->info['sex'] == 1) {
- $sex1 = '';
- }
-
- $ult = 1;
-
- //
- if ($this->info['twink'] == 0 && (round($this->info['host_reg']) > 0 && ($this->info['dieline'] == 0 || $this->info['dieline'] < $lvl['exp']))) {
- $mtest = mysql_fetch_array(mysql_query('SELECT `id`,`uid`,`uid2`,`ip` FROM `mults` WHERE (`uid` = "' . $this->info['id'] . '" AND `uid2` = "' . ((int)$this->info['host_reg']) . '") OR (`uid2` = "' . $this->info['id'] . '" AND `uid` = "' . ((int)$this->info['host_reg']) . '") LIMIT 1'));
- $rlog = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`catch`,`host_reg` FROM `users` WHERE `id` = "' . ((int)$this->info['host_reg']) . '" LIMIT 1'));
- $rlogs = mysql_fetch_array(mysql_query('SELECT `id`,`ref_data` FROM `stats` WHERE `id` = "' . ((int)$this->info['host_reg']) . '" LIMIT 1'));
-
- if (!isset($mtest['id']) && isset($rlog['id'])) {
- $rtg = true;
- } else {
- $rtg = mysql_fetch_array(mysql_query('SELECT * FROM `ref_mult` WHERE `uid1` = "' . $rlog['id'] . '" LIMIT 1'));
- if (isset($rtg['id'])) {
- if ($this->info['id'] == $rtg['uid2']) {
- $rtg = true;
- } else {
- $rtg = false;
- }
- } else {
- mysql_query('INSERT INTO `ref_mult` (`uid1`,`uid2`,`time`) VALUES (
- "' . $rlog['id'] . '" , "' . $this->info['id'] . '","' . time() . '"
- )');
- $rtg = true;
- }
- }
-
- if (($rtg == true || !isset($mtest['id'])) && isset($rlog['id']) && $this->info['activ'] == 0) {
- $rfs['data'] = explode('|', $rlogs['ref_data']);
- $ekr = '0.00';
- $bn = mysql_fetch_array(mysql_query('SELECT `id`,`type`,`level`,`add_bank`,`add_money`,`finish_battle`,`online`,`onlyOne`,`add_crystals` FROM `referal_bous` WHERE `type` = 1 AND `level` = "' . $lvl['nextLevel'] . '" LIMIT 1'));
- if (isset($bn['id']) && ($bn['add_bank'] > 0 || $bn['add_money'] > 0)) {
- $ekr = $bn['add_bank'];
- $kr = $bn['add_money'];
- $up = mysql_query('UPDATE `users` SET `money` = `money` + ' . $kr . ',`money2` = `money2` + ' . $ekr . ' WHERE `id` = "' . mysql_real_escape_string($rlog['id']) . '" LIMIT 1');
- if ($up) {
-
- // 1-
- $krtxt = '';
- if ($kr > 0) {
- $krtxt .= '' . $kr . ' ';
- if ($ekr > 0) {
- $krtxt .= ', ';
- }
- }
- if ($ekr > 0) {
- $krtxt .= '' . $ekr . ' ';
- }
- $this->send('', $this->info['room'], $this->info['city'], '', $rlog['login'], '
' . $this->info['login'] . ' ' . $sex1 . ' ' . $lvl['nextLevel'] . '! ' . $krtxt, -1, 6, 0, 0, 0, 1);
- $rlog['catch'] += $bn['add_bank'];
- mysql_query('UPDATE `users` SET `catch` = "' . $rlog['catch'] . '" WHERE `id` = "' . $rlog['id'] . '" LIMIT 1');
- //
- if ((int)$rlog['host_reg'] > 0) {
- // 2-
- $llogin = $rlog['login'];
- $ekr = round($bn['add_bank'] * 0.4, 2);
- $kr = round($bn['add_money'] * 0.4, 2);
- $rlog = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`catch`,`host_reg` FROM `users` WHERE `id` = "' . ((int)$rlog['host_reg']) . '" LIMIT 1'));
- if (isset($rlog['id'])) {
- $krtxt = '';
- if ($kr > 0) {
- $krtxt .= '' . $kr . ' ';
- if ($ekr > 0) {
- $krtxt .= ', ';
- }
- }
- if ($ekr > 0) {
- $krtxt .= '' . $ekr . ' ';
- }
- $this->send('', $this->info['room'], $this->info['city'], '', $rlog['login'], '
' . $this->info['login'] . ' (2- "' . $llogin . '" ) ' . $sex1 . ' ' . $lvl['nextLevel'] . '! ' . $krtxt, -1, 6, 0, 0, 0, 1);
- $rlog['catch'] += $bn['add_bank'];
- mysql_query('UPDATE `users` SET `money` = `money` + ' . $kr . ',`money2` = `money2` + ' . $ekr . ' WHERE `id` = "' . $rlog['id'] . '" LIMIT 1');
- //
- if ((int)$rlog['host_reg'] > 0) {
- // 3-
- $llogin2 = $rlog['login'];
- $ekr = round($bn['add_bank'] * 0.2, 2);
- $kr = round($bn['add_money'] * 0.2, 2);
- $rlog = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`catch`,`host_reg` FROM `users` WHERE `id` = "' . ((int)$rlog['host_reg']) . '" LIMIT 1'));
- if (isset($rlog['id'])) {
- $krtxt = '';
- if ($kr > 0) {
- $krtxt .= '' . $kr . ' ';
- if ($ekr > 0) {
- $krtxt .= ', ';
- }
- }
- if ($ekr > 0) {
- $krtxt .= '' . $ekr . ' ';
- }
- $this->send('', $this->info['room'], $this->info['city'], '', $rlog['login'], '
' . $this->info['login'] . ' (3- "' . $llogin2 . '" ( ' . $llogin . ') ) ' . $sex1 . ' ' . $lvl['nextLevel'] . '! ' . $krtxt, -1, 6, 0, 0, 0, 1);
- $rlog['catch'] += $bn['add_bank'];
- mysql_query('UPDATE `users` SET `money` = `money` + ' . $kr . ',`money2` = `money2` + ' . $ekr . ' WHERE `id` = "' . $rlog['id'] . '" LIMIT 1');
- //
- }
- }
- //
- }
- }
-
- } else {
- $this->send('', $this->info['room'], $this->info['city'], '', $rlog['login'], '
' . $this->info['login'] . ' ' . $sex1 . ' ' . $lvl['nextLevel'] . '! ( , ) ' . $bnk . ' ' . $ekr . ' .', -1, 6, 0, 0, 0, 1);
- }
- }
- //
- mysql_query("UPDATE `users` SET `referals` = `referals` + 5 WHERE `id` = '" . mysql_real_escape_string($rlog['id']) . "' LIMIT 1");
- //
- } elseif (isset($rlog['id'])) {
- $this->send('', $this->info['room'], $this->info['city'], '', $rlog['login'], '
' . $this->info['login'] . ' ' . $sex1 . ' ' . $lvl['nextLevel'] . '!
( , IP! 1 !)', -1, 6, 0, 0, 0, 1);
- }
- }
- }
-
- $tst = $this->lookStats($this->info['stats']);
- $tst['s4'] += $lvl['vinos'];
- $tst['s7'] += $lvl['duh'];
- $this->info['stats'] = $this->impStats($tst);
-
- $this->info['level'] = $lvl['nextLevel'];
- $this->stats['levels'] = $lvln;
- $this->info['ability'] += $lvl['ability'];
- $this->info['skills'] += $lvl['skills'];
- $this->info['sskills'] += $lvl['sskills'];
- $this->info['nskills'] += $lvl['nskills'];
- if ($this->info['twink'] == 0) {
- $this->info['money'] = $lvl['money'] + $this->info['money'];
- $this->info['money2'] = $lvl['money2'] + $this->info['money2'];
- //}
- }
- $lvl = $lvln;
- $lvln = mysql_fetch_array(mysql_query('SELECT `bprice`,`upLevel`,`nextLevel`,`exp`,`money`,`money_bonus1`,`money_bonus2`,`ability`,`skills`,`nskills`,`sskills`,`expBtlMax`,`hpRegen`,`mpRegen`,`money2` FROM `levels` WHERE `upLevel`="' . ($lvl['upLevel'] + 1) . '" LIMIT 1'));
- $this->info['upLevel'] += 1;
- $rt++;
- } else {
- $i = 1;
- }
- }
- if ($ult == 1) {
- if ($this->info['level'] == 4 || $this->info['level'] == 8) {
- //
- mysql_query('DELETE FROM `actions` WHERE `uid` = "' . $this->info['id'] . '" AND `vars` LIKE "psh%"');
- $this->send('', $this->info['room'], $this->info['city'], '', $this->info['login'], ' !!!!!!!!!!!!!!!.', -1, 6, 0, 0, 0, 1);
- }
-
- //
- $this->send('', $this->info['room'], $this->info['city'], '', '', '
' . $this->info['login'] . ' ' . $sex1 . ' ' . $this->info['level'] . '!', time(), 6, 0, 0, 0, 1, 2); //
- //}
- }
- //mysql_query('UNLOCK TABLES');
- if ($rt > 0) {
- if ($this->info['level'] >= 11) {
- //$this->info['stopexp'] = 1; //
- $this->info['stopexp'] = 0;
- } else {
- $this->info['stopexp'] = 0;
- }
- $upd = mysql_query('UPDATE `users_twink` SET `stopexp` = "' . $this->info['stopexp'] . '" WHERE `uid` = "' . $this->info['id'] . '" LIMIT 1');
- if ($upd) {
- mysql_query('UPDATE `stats` SET `ability` = "' . $this->info['ability'] . '",`skills` = "' . $this->info['skills'] . '",`nskills` = "' . $this->info['nskills'] . '",`sskills` = "' . $this->info['sskills'] . '",`stats` = "' . $this->info['stats'] . '",`upLevel` = "' . $this->info['upLevel'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
- $this->info['money'] = $this->r2($this->info['money']);
- }
- return 1;
- }
- //****************
- }
- }
- /*------------*/
- if ($this->info['animal'] > 0) {
- //
- $a = mysql_fetch_array(mysql_query('SELECT `id`,`type`,`name`,`uid`,`delete`,`inBattle`,`eda`,`exp`,`obraz`,`stats`,`level`,`sex`,`levelUp`,`pet_in_cage`,`max_exp`,`priems`,`bonus` FROM `users_animal` WHERE `uid` = "' . $this->info['id'] . '" AND `id` = "' . $this->info['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1'));
- if (isset($a['id']) && $a['level'] < 12) {
- $ea = [
- 0 => 0,
- 1 => 110,
- 2 => 410,
- 3 => 1300,
- 4 => 2500,
- 5 => 5000,
- 6 => 12500,
- 7 => 30000,
- 8 => 100000,
- 9 => 3000000,
- 10 => 10000000,
- 11 => 50000000,
- 12 => 150000000
- ];
- $mx = [
- 0 => 140,
- 1 => 400,
- 2 => 500,
- 3 => 650,
- 4 => 700,
- 5 => 1400,
- 6 => 3000,
- 7 => 6000,
- 8 => 10000,
- 9 => 16000,
- 10 => 24000,
- 11 => 40000,
- 12 => 60000
- ];
- $iz = 0;
- while ($iz != -1) {
- if ($ea[$a['level'] + 1] <= $a['exp']) {
- //
- $a['level']++;
- $a['max_exp'] = $mx[$a['level']];
- } else {
- if ($iz > 0) {
- $a['stats'] = mysql_fetch_array(mysql_query('SELECT `id`,`type`,`exp`,`level`,`stats`,`bonus` FROM `levels_animal` WHERE `type` = "' . $a['type'] . '" AND `level` = "' . $a['level'] . '" LIMIT 1'));
- $a['stats'] = $a['stats']['stats'];
- $this->send('', $this->info['room'], $this->info['city'], '', $this->info['login'], '
' . $a['name'] . ' ' . $a['level'] . ' !', time(), 6, 0, 0, 0, 1);
- mysql_query('UPDATE `users_animal` SET `stats` = "' . $a['stats'] . '",`level`="' . $a['level'] . '",`max_exp`="' . $a['max_exp'] . '" WHERE `id` = "' . $a['id'] . '" LIMIT 1');
- }
- $iz = -2;
- }
- if ($iz > 1000) {
- $iz = -2;
- }
- $iz++;
- }
- }
- }
- /*------------*/
- }
-
- public function r2($v)
- {
- $v = number_format($v, 2, '.', ' ');
- return $v;
- }
-
- /**
- * ! hp mp 1000 ,
- * - . 12.07.2022 .
- * @param $uid
- * @param $st
- * @param $i1
- * @return array|int[]
- */
- public function regen($uid, $st, $i1)
- {
- if ($uid != $this->info['id']) {
- $where = is_numeric($uid)? "`u`.`id` = $uid" : "`u`.`login` = $uid";
- $u = mysql_fetch_array(mysql_query('SELECT `u`.`battle`, `st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE ' . $where));
- if (!isset($st['hpAll'])) {
- $st = $this->getStats($uid, $i1);
- }
- } else {
- $u = $this->info;
- $st = isset($this->stats['hpAll']) ? $this->stats : $this->getStats($uid, $i1);
- }
-
- if (!empty($u['battle'])) {
- return [0, 0];
- }
-
- $sth = $u['minHP']; // HP
- $stm = $u['minMP']; // MP
- $st['speedhp'] = $st['speedhp'] ?: 0;
- $st['speedmp'] = $st['speedmp'] ?: 0;
- #$sh = 0; // 1 .
- #$sm = 0; // M 1 .
-
- //
- //
- # , ?
- $st['speedhp'] += 150;
- $st['speedmp'] += 150;
-
- //hp
- $sh = ($st['hpAll'] / (60 * $sth));
- $sh += ($sh / 100) * (1 + $st['speedhp'] + $st['levels']['hpRegen']);
- $st['hpNow'] += $sh * (time() - $u['regHP']);
- $st['hpNow'] = $st['hpNow'] > 0 ? min($st['hpNow'], $st['hpAll']) : 0;
-
- // . ?
- //$sh = $st['hpAll'] * (101 + $st['speedhp'] + $st['levels']['hpRegen']) / (6000 * $u['minHP'])
-
- //mp
- $sm = ($st['mpAll'] / (60 * $stm));
- $sm += ($sm / 100) * (1 + $st['speedmp'] + $st['levels']['mpRegen']);
- $st['mpNow'] += $sm * (time() - $u['regMP']);
- $st['mpNow'] = $st['mpNow'] > 0 ? min($st['mpNow'], $st['mpAll']) : 0;
-
-
- //
-
- if ($u['hpNow'] < $st['hpAll'] || $u['mpNow'] < $st['mpAll']) {
- Db::sql('update stats set
- regHP = unix_timestamp(),
- regMP = unix_timestamp(),
- hpNow = ?,
- mpNow = ?
- where id = ?', [$st['hpNow'], $st['mpNow'], $u['id']]);
- }
-
- if ($this->info['id'] == $u['id']) {
- $this->stats['regHP'] = time();
- $this->stats['regMP'] = time();
- $this->stats['hpNow'] = $st['hpNow'];
- $this->stats['mpNow'] = $st['mpNow'];
- }
- return [$sh, $sm, 'hpNow' => $st['hpNow'], 'mpNow' => $st['mpNow']];
- }
-
- public function set_cl_item($id, $user, $cl)
- {
- $item_ = mysql_fetch_array(mysql_query('SELECT `iu`.*, `im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` = "' . $user['id'] . '" AND `iu`.`delete` = 0 AND `iu`.`inOdet` = 0 AND `iu`.`inShop` = 0 AND `im`.`inslot` > 0 AND `iu`.`gift` = "" AND `iu`.`data` NOT LIKE "%frompisher=%" AND `iu`.`id` = "' . $id . '" LIMIT 1'));
- $res = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $cl . '" LIMIT 1'));
- if (isset($item_['id'])) {
- $po = $this->lookStats($item_['data']);
- if (isset($po['toclan'])) {
- $po['toclan1'] = explode('#', $po['toclan']);
- $po['toclan1'] = $po['toclan1'][0];
- }
- if (isset($po['sudba']) && $po['sudba'] != '0') {
- $r = '
';
- } elseif (isset($po['toclan']) && $po['toclan1'] != $user['clan']) {
- $r = '
...';
- } elseif ($user['inTurnir'] > 0 || $user['inTurnirnew'] > 0) {
- $r = '
.';
- } else {
- if ((isset($po['sudba']) && $po['sudba'] != '0') || isset($po['icos']) || isset($po['frompisher']) || isset($po['fromlaba']) || ($item_['gift'] != '' && $item_['gift'] != 0)) {
- $r = ' ';
- } elseif (!isset($po['toclan'])) {
- $po['toclan'] = $user['clan'] . '#' . $user['id'];
- $item_['data'] = $this->impStats($po);
- if (mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "-21' . $user['clan'] . '", `data` = "' . $item_['data'] . '" WHERE `id` = "' . $id . '" LIMIT 1')) {
- $r = '
"' . $item_['name'] . '" ';
- $col = $this->itemsX(((int)$id));
- $this->addDelo(2, $user['id'], '"
System.transfer.MONEY": "' . $item_['name'] . '" (#id : "' . $id . '") (x' . $col . ') "' . $res['name'] . '" (' . $res['id'] . ').', time(), $user['city'], 'System.transfer.clan', 0, 0);
- mysql_query('INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "4", "' . $user['login'] . '", "' . $item_['name'] . ' (x' . $col . ') : [' . $id . ']", "' . $user['id'] . '")');
- } else {
- $r = '
...';
- }
- } else {
- if (mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "-21' . $user['clan'] . '" WHERE `id` = "' . $id . '" LIMIT 1')) {
- $col = $this->itemsX(((int)$id));
- mysql_query('INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "3", "' . $user['login'] . '", "' . $item_['name'] . '" (x' . $col . ') : [' . $id . '], "' . $user['id'] . '")');
- $r = '
"' . $item_['name'] . '" ';
- } else {
- $r = '
...';
- }
- }
- }
- } else {
- $r = '
.';
- }
- return $r;
- }
-
-
- public function ungive_itm_cl($id, $user, $cl)
- {
- $itm_ = mysql_fetch_array(mysql_query('SELECT `iu`.*, `im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` >= 0 AND `iu`.`delete` = 0 AND `iu`.`id` = "' . $id . '" LIMIT 1'));
- $res = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $cl . '" LIMIT 1'));
- $user_itm = mysql_fetch_array(mysql_query('SELECT `id`,`bot`,`clone` FROM `stats` WHERE `id` = "' . $itm_['uid'] . '" LIMIT 1'));
- if ($user_itm['bot'] > 0 || $user_itm['clone'] > 0 || !isset($user_itm['id'])) {
- $r = '
, ';
- } elseif (isset($itm_['id'])) {
- if ($user['inTurnir'] == 0 && $user['inTurnirnew'] == 0) {
- if ($itm_['inOdet'] != 0) {
- $o = ', `inOdet` = 0';
- } else {
- $o = '';
- }
- $r = '
"' . $itm_['name'] . '"';
- $col = $this->itemsX(((int)$id));
- mysql_query('INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "6", "' . $user['login'] . '", "' . $itm_['name'] . ' (x' . $col . ') : [' . $id . '] | : [' . $itm_['uid'] . ']", "' . $user['id'] . '")');
- mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "-21' . $res['id'] . '" ' . $o . ' WHERE `id` = "' . $id . '" LIMIT 1');
- } else {
- $r = '
.';
- }
- } else {
- $r = '
.';
- }
- return $r;
- }
-
- public function take_itm_cl($id, $user, $cl)
- {
- $itm_ = mysql_fetch_array(mysql_query('SELECT `iu`.*, `im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `iu`.`uid` = "-21' . $user['clan'] . '" AND `iu`.`delete` = 0 AND `iu`.`id` = "' . $id . '" LIMIT 1'));
- $res = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = "' . $cl . '" LIMIT 1'));
- if (isset($itm_['id'])) {
- $po = $this->lookStats($itm_['data']);
- if (isset($po['toclan'])) {
- $cls = explode('#', $po['toclan']);
- $cls = $cls[1];
- }
- if ($user['inTurnir'] == 0 && $user['inTurnirnew'] == 0) {
- $col = $this->itemsX(((int)$id));
- mysql_query('INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "5", "' . $user['login'] . '", "' . $itm_['name'] . ' (x' . $col . ') : [' . $id . '] : [' . $cls . ']", "' . $user['id'] . '")');
- mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "' . $user['id'] . '" WHERE `id` = "' . $id . '" LIMIT 1');
- $r = '
"' . $itm_['name'] . '" ';
- } else {
- $r = '
.';
- }
- } else {
- $r = '
.' . $id;
- }
- return $r;
- }
-
- public function rem_itm_cl($user, $cl, $type)
- {
- $itms = mysql_query('SELECT * FROM `items_users` WHERE (`uid` = "-21' . $user['clan'] . '" OR `data` LIKE "%toclan=' . $user['clan'] . '#%")');
- while ($pl = mysql_fetch_array($itms)) {
- $po = $this->lookStats($pl['data']);
- if (isset($po['toclan'])) {
- $cls = explode('#', $po['toclan']);
- $cls = $cls[1];
- }
- if ($cls == $user['id']) {
- if ($pl['uid'] != $user['id']) {
- if ($pl['inOdet'] != 0) {
- mysql_query('UPDATE `items_users` SET `inOdet` = 0 WHERE `id` = "' . $pl['id'] . '"');
- }
- }
- unset($po['toclan']);
- $pl['data'] = $this->impStats($po);
- $col = $this->itemsX(((int)$pl['id']));
- $it_n = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $pl['item_id'] . '"'));
- mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "' . $user['id'] . '", `data` = "' . $pl['data'] . '" WHERE `id` = "' . $pl['id'] . '"');
- mysql_query('INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "' . $type . '", "' . $user['login'] . '", "' . $it_n['name'] . ' (x' . $col . ') : [' . $pl['id'] . ']", "' . $user['id'] . '")');
- } elseif ($cls != $user['id'] && $pl['uid'] == $user['id']) {
- $col = $this->itemsX(((int)$pl['id']));
- $it_n = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $pl['item_id'] . '"'));
- mysql_query('UPDATE `items_users` SET `lastUPD` = "' . time() . '", `uid` = "-21' . $user['clan'] . '" WHERE `id` = "' . $pl['id'] . '"');
- mysql_query('INSERT INTO `clan_operations` (`clan`, `time`, `type`, `text`, `val`, `uid`) VALUES ("' . $res['id'] . '", "' . time() . '", "9", "' . $user['login'] . '", "' . $it_n['name'] . ' (x' . $col . ') : [' . $pl['id'] . ']", "' . $user['id'] . '")');
- }
- }
- }
-
- public function roomInfo($id, $short = false)
- {
- $select = $short ? ' `id`, `name`, `code`, `city`, `timeGO`, `level`,`roomGo` ' : ' * ';
- $roomInfo = mysql_fetch_array(mysql_query('SELECT ' . $select . ' FROM `room` WHERE `id` = "' . $id . '" LIMIT 1'));
- if ($roomInfo['roomGo']) $roomInfo['roomGo'] = explode(',', $roomInfo['roomGo']);
- if ($roomInfo['level']) $roomInfo['level'] = explode('-', $roomInfo['level']);
- return $roomInfo;
- }
-
- public function showAbils()
- {
- $r = '';
- $sp = mysql_fetch_array(mysql_query('SELECT * FROM `abils_user` WHERE `uid` = "' . $this->info['id'] . '" LIMIT 1'));
- if (isset($sp['id'])) {
- $r .= '';
- } else {
- mysql_query('INSERT INTO `abils_user` (`uid`) VALUES ("' . $this->info['id'] . '")');
- }
- return $r;
- }
-
-}
-
-$u = user::start();
diff --git a/_incl_data/class/__zv.php b/_incl_data/class/__zv.php
deleted file mode 100644
index ca34e581..00000000
--- a/_incl_data/class/__zv.php
+++ /dev/null
@@ -1,3274 +0,0 @@
-
-if (!defined('GAME')) {
- die();
-}
-
-class Balancer
-{
- public static function balance($items, $key)
- {
- $result = [];
-
- $maxWeight = floor(self::sum($items, $key) / 2);
-
- $numItems = count($items);
-
- $sack = self::buildSack($numItems, $maxWeight);
-
- for ($n = 1; $n <= $numItems; $n++) {
- // loop all items
- for ($weight = 1; $weight <= $maxWeight; $weight++) {
- $a = $sack[$n - 1][$weight]['value'];
- $b = null;
- $value = $items[$n - 1][$key];
- if ($value <= $weight) {
- $b = $value + $sack[$n - 1][$weight - $value]['value'];
- }
- $sack[$n][$weight]['value'] = ($b === null ? $a : max($a, $b));
- $sack[$n][$weight]['take'] = ($b !== null && $b > $a);
- }
- }
-
- $setA = [];
- $setB = [];
-
- for ($n = $numItems, $weight = $maxWeight; $n > 0; $n--) {
- $item = $items[$n - 1];
- $value = $item[$key];
- if ($sack[$n][$weight]['take']) {
- $setA[] = $item;
- } else {
- $setB[] = $item;
- }
- $weight = $weight - $value;
- }
-
- return [$setA, $setB];
- }
-
- protected static function sum($items, $key)
- {
- $sum = 0;
- foreach ($items as $item) {
- $sum += $item[$key];
- }
- return $sum;
- }
-
- protected static function buildSack($width, $height)
- {
- $sack = [];
- for ($x = 0; $x <= $width; $x++) {
- $sack[$x] = [];
- for ($y = 0; $y <= $height; $y++) {
- $sack[$x][$y] = [
- 'value' => 0,
- 'take' => false
- ];
- }
- }
- return $sack;
- }
-}
-
-unset($_POST['kingfight'], $_POST['nobot'], $_POST['mut_clever']);
-
-session_start();
-
-function add_effn($uid, $id)
-{
- $g = [0 => 0, 1 => ''];
- $eff = mysql_fetch_array(mysql_query('SELECT * FROM `eff_main` WHERE `id2` = "' . $id . '" LIMIT 1'));
- if (isset($eff['id2'])) {
- $n = $eff['mname'];
- $d = $eff['mdata'];
- $ins = mysql_query('INSERT INTO `eff_users` (`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`) VALUES ("' . $eff['oneType'] . '","' . $eff['id2'] . '","' . $uid . '","' . $n . '","' . time() . '","' . $d . '")');
- if ($ins) {
- $g[0] = 1;
- $g[1] = '...';
- }
- }
- return $g;
-}
-
-$u->info['no_zv_key'] = true;
-$moder = mysql_fetch_array(mysql_query('SELECT * FROM `moder` WHERE `align` = "' . $u->info['align'] . '" LIMIT 1'));
-
-if (isset($_GET['del_z_time']) && $_GET['del_z_time'] != null) {
- $zay = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `id` = "' . $u->info['zv'] . '" AND `creator` = "' . $u->info['id'] . '" AND `start` = 0 AND `cancel` = 0 AND `btl_id` = 0 ORDER BY `id` DESC LIMIT 1'));
- if (isset($zay['id']) && $zay['priz'] == 0) {
- $colls = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $zay['id'] . '"'));
- $cs = $colls[0];
- if ($u->info['zv'] == $zay['id'] && ($zay['creator'] == $u->info['id'])) {
- if ($cs == 1) {
- mysql_query('UPDATE `stats` SET `zv` = 0 WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
- mysql_query('DELETE FROM `zayvki` WHERE `id` = "' . $zay['id'] . '" LIMIT 1');
- $test_s = ' ...';
- } else {
- $test_s = '- .';
- }
- } else {
- $test_s = ' , .';
- }
- }
-}
-
-class zayvki
-{
- public $zv_see, $error, $z1n = [4 => '', 5 => ''], $z2n = [4 => '', 5 => ''];
-
- public function testTravm()
- {
- global $u;
- $r = 0;
- $tr_pl = mysql_fetch_array(mysql_query('SELECT `id`,`v1` FROM `eff_users` WHERE `id_eff` = 4 AND `uid` = "' . $u->info['id'] . '" AND `delete` = "0" ORDER BY `v1` DESC LIMIT 1'));
- if (isset($tr_pl['id'])) {
- //
- if ($tr_pl['v1'] == 1) {
- //
- } elseif ($tr_pl['v1'] == 2) {
- $r = 1;
- } elseif ($tr_pl['v1'] == 3) {
- $r = 2;
- }
- }
- return $r;
- }
-
- public function test()
- {
- global $code, $c, $u;
-
- if ($u->info['zv'] > 0) {
- $test_zv = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `id` = "' . $u->info['zv'] . '" LIMIT 1'));
- if (!isset($test_zv['id'])) {
- $u->info['zv'] = 0;
- } else {
- if ($test_zv['cancel'] > 0 || $test_zv['btl_id'] > 0) {
- $u->info['zv'] = 0;
- }
- if ($test_zv['time'] < time() - 3600) {
- $u->info['zv'] = 0;
- }
- }
- if ($u->info['zv'] == 0) {
- mysql_query('UPDATE `stats` SET `zv` = 0 WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
- }
- }
-
- //
- $sp = mysql_query('SELECT * FROM `turnirs` WHERE `status` != "-1"');
- while ($pl = mysql_fetch_array($sp)) {
-
- //
- if ($pl['status'] == 0 && $pl['time'] > time()) {
- if (floor(($pl['time'] - time()) / 60) <= 2 && $pl['chat'] > 0) {
- mysql_query('UPDATE `turnirs` SET `chat` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
- } elseif (floor(($pl['time'] - time()) / 60) <= 5 && $pl['chat'] > 1) {
- // 5 .
- $r = '
: 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'] . '"');
- }
- }
- }
-
- //
- $sp = mysql_query('SELECT * FROM `zayvki` AS `z` WHERE /*`z`.`city` = "' . $u->info['city'] . '" AND*/ `z`.`btl_id` = "0" AND `z`.`cancel` = "0" AND `z`.`start` = "0" AND (`z`.`razdel` = 4 OR `z`.`razdel` = 5) ORDER BY `z`.`id` DESC LIMIT 22');
- while ($pl = mysql_fetch_array($sp)) {
- $uz = mysql_query('SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $pl['id'] . '"');
- $tm1 = [];
- $tm2 = [];
- $i = [];
- $toChat = '';
- $toChat2 = '';
- $toWhere = '';
- while ($t = mysql_fetch_array($uz)) {
- if (!isset(${'tm' . $t['team']})) {
- ${'tm' . $t['team']} = [];
- }
- if (!isset($i[$t['team']])) {
- $i[$t['team']] = 0;
- }
- ${'tm' . $t['team']}[$i[$t['team']]] = $t;
- $toChat .= '' . $t['login'] . ',';
- $toWhere .= 'OR `id` = "' . $t['id'] . '" ';
- if ($pl['razdel'] == 5 && $pl['time_start'] - 180 < time() - $pl['time'] && $pl['send'] == 0) {
- $toChat2 .= '' . $u->microLogin2($t) . ', ';
- }
- $i[$t['team']]++;
- }
-
- if ($pl['razdel'] == 5) {
- $col_p = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $pl['id'] . '"'));
- $cols = $col_p[0];
- if ($cols >= $pl['maxplayers']) {
- $pl['time_start'] = time() - $pl['time'] - 1;
- }
- }
-
- if ($pl['time_start'] < time() - $pl['time'] || ($pl['razdel'] == 4 && $i[1] >= $pl['tm1max'] && $i[2] >= $pl['tm2max'])) {
- $toChat = rtrim($toChat, ',');
- $toWhere = ltrim($toWhere, 'OR ');
- if ($pl['razdel'] == 4) {
- //
- if (!isset($i[1]) || !isset($i[2]) || (!isset($i[3]) && $pl['teams'] == 3)) {
- //
- $this->cancelGroup($pl, $toChat);
- } else {
- //
- $this->startBattle($pl['id'], $toChat . '|-|' . $toWhere);
- }
- } elseif ($pl['razdel'] == 5) {
- //
- //
- $i = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $pl['id'] . '" LIMIT 1'));
- if ($i[0] < 4 && ($i[0] < 2 || $pl['fastfight'] == 0)) {
- //
- $this->cancelGroup($pl, $toChat);
- } else {
- //
- $this->startBattle($pl['id'], $toChat . '|-|' . $toWhere);
- }
- }
- }
- }
- }
-
- public function testCronZv()
- {
- global $code, $c, $u;
-
- $back_test = false;
-
- //
- $sp = mysql_query('SELECT * FROM `turnirs` WHERE `status` != "-1"');
- while ($pl = mysql_fetch_array($sp)) {
-
- //
- if ($pl['status'] == 0 && $pl['time'] < time()) {
- if ($pl['users_in'] > 1) {
- //
- mysql_query('UPDATE `turnirs` SET `time` = "' . (time() + $pl['time3']) . '",`status` = "1" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
-
- $usp = mysql_query('SELECT * FROM `users` WHERE `inTurnirnew` = "' . $pl['id'] . '" LIMIT ' . $pl['users_in']);
- while ($ur = mysql_fetch_array($usp)) {
- mysql_query('INSERT INTO `users` (`login`,`room`,`name`,`sex`,`level`,`inTurnirnew`,`bithday`,`activ`) VALUES ("' . $ur['login'] . '","318","' . $ur['name'] . '","' . $ur['sex'] . '","' . $t['level'] . '","' . $pl['id'] . '","01.01.2001","0")');
- $uri = mysql_insert_id();
- mysql_query('INSERT INTO `users_turnirs` (`uid`,`bot`,`turnir`) VALUES ("' . $ur['id'] . '","' . $uri . '","' . $pl['id'] . '")');
- $zid = 0;
- $x1 = 0;
- $y1 = 0;
- mysql_query('INSERT INTO `stats` (`upLevel`,`dnow`,`id`,`stats`,`exp`,`ability`,`skills`,`x`,`y`) VALUES ("98","' . $zid . '","' . $uri . '","s1=3|s2=3|s3=3|s4=3|s5=0|s6=0|rinv=40|m9=5|m6=10","0","0","0",' . $x1 . ',' . $y1 . ')');
- mysql_query('UPDATE `users` SET `inUser` = "' . $uri . '" WHERE `id` = "' . $ur['id'] . '" LIMIT 1');
- //
-
- }
-
- } else {
- //
- mysql_query('UPDATE `turnirs` SET `time` = "' . (time() + $pl['time2']) . '",`users_in` = "0" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
- mysql_query('UPDATE `users` SET `inTurnirnew` = "0" WHERE `inTurnirnew` = "' . $pl['id'] . '"');
- }
- }
-
- }
-
- //
- $sp = mysql_query('SELECT * FROM `zayvki` AS `z` WHERE `z`.`btl_id` = "0" AND `z`.`cancel` = "0" AND `z`.`start` = "0" AND (`z`.`razdel` = 4 OR `z`.`razdel` = 5) ORDER BY `z`.`id` DESC LIMIT 1000');
- while ($pl = mysql_fetch_array($sp)) {
- $uz = mysql_query('SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $pl['id'] . '"');
- $tm1 = [];
- $tm2 = [];
- $i = [];
- $toChat = '';
- $toWhere = '';
- while ($t = mysql_fetch_array($uz)) {
- if (!isset(${'tm' . $t['team']})) {
- ${'tm' . $t['team']} = [];
- }
- if (!isset($i[$t['team']])) {
- $i[$t['team']] = 0;
- }
- ${'tm' . $t['team']}[$i[$t['team']]] = $t;
- $toChat .= '' . $t['login'] . ',';
- $toWhere .= 'OR `id` = "' . $t['id'] . '" ';
- $i[$t['team']]++;
- }
- if ($pl['time_start'] <= time() - $pl['time'] || ($pl['razdel'] == 4 && $i[1] >= $pl['tm1max'] && $i[2] >= $pl['tm2max'])) {
- $toChat = rtrim($toChat, ',');
- $toWhere = ltrim($toWhere, 'OR ');
- if ($pl['razdel'] == 4) {
- //
- if (!isset($i[1]) || !isset($i[2])) {
- //
- $this->cancelGroup($pl, $toChat);
- } else {
- //
- $this->startBattle($pl['id'], $toChat . '|-|' . $toWhere);
- }
- } elseif ($pl['razdel'] == 5) {
- //
- $i = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `stats` WHERE `zv` = "' . $pl['id'] . '" LIMIT 1'));
- if ($i[0] < 4 && ($pl['fastfight'] == 0 || $i[0] < 2)) {
- $rcf = mysql_fetch_array(mysql_query('SELECT `id`,`btl_cof` FROM `stats` WHERE `zv` = "' . $pl['id'] . '" ORDER BY `btl_cof` DESC LIMIT 1'));
- $rcf = $rcf['btl_cof'];
- //
- //
- $lvl_btl_exp = [
- 0 => 0,
- 1 => 110,
- 2 => 420,
- 3 => 1300,
- 4 => 2500,
- 5 => 5000,
- 6 => 12500,
- 7 => 30000,
- 8 => 300000,
- 9 => 3000000,
- 10 => 10000000,
- 11 => 52000000,
- 12 => 63000000,
- 13 => 182000000,
- 14 => 212000000,
- 15 => 352000000,
- 16 => 504000000,
- 17 => 1187000000,
- 18 => 2455000000,
- 19 => 4387000000,
- 20 => 6355000000,
- 21 => 15500000000,
- 22 => 755500000000
- ];
- $bot_users = [];
-
- if ($pl['min_lvl_1'] <= 8 && $pl['max_lvl_1'] <= 8 && $pl['nobot'] == 0) {
- $bsp = mysql_query('SELECT
- `u`.`id`,
- `u`.`login`,
- `u`.`level`,
- `s`.`stats`,
- `u`.`cityreg`,
- `u`.`sex`,
- `u`.`obraz`,
- `s`.`upLevel`,
- `s`.`priems`,
- `s`.`btl_cof`
- FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `s`.`exp` >= ' . $lvl_btl_exp[$pl['min_lvl_1']] . ' AND `s`.`exp` < ' . $lvl_btl_exp[$pl['max_lvl_1'] + 1] . ' AND `s`.`bot` = "0" ORDER BY `s`.`btl_cof` DESC LIMIT 50');
- while ($bpl = mysql_fetch_array($bsp)) {
- $bot_users[] = $bpl;
- }
- }
-
- $mincs = 4;
- if ($pl['fastfight'] > 0) {
- $mincs = 2;
- }
-
- if (count($bot_users) == 0) {
- if ($i[0] < 4 && ($pl['fastfight'] == 0 || $i[0] < 2)) {
- $text = ' : . (' . $pl['id'] . ': ' . count($bot_users) . ' ' . $lvl_btl_exp[$pl['min_lvl_1']] . '-' . $lvl_btl_exp[$pl['max_lvl_1'] + 1] . ')';
- mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $zv['city'] . "','','','LEL','" . $text . "','" . time() . "','6','0')");
- $this->cancelGroup($pl, $toChat);
- }
- } else {
- $j = 0;
- $k = 0;
- $bot_users_new = [];
- while ($j < $mincs - $i[0]) {
- $botlg = $bot_users[rand(0, count($bot_users) - 1)];
- $j++;
- $clone = [
- 'id' => $botlg['id'],
- 'login' => ' ( ' . $j . ')',
- 'level' => $botlg['level'],
- 'city' => $pl['city'],
- 'cityreg' => $pl['city'],
- 'name' => '',
- 'sex' => $botlg['sex'],
- 'deviz' => '',
- 'hobby' => '',
- 'time_reg' => time(),
- 'obraz' => $botlg['obraz'],
- 'stats' => $botlg['stats'],
- 'upLevel' => $botlg['upLevel'],
- 'priems' => $botlg['priems'],
- 'loclon' => true
- ];
- $bot = $u->addNewbot(1, null, $clone, null, true);
- if ($bot > 0) {
- mysql_query('UPDATE `stats` SET `btl_cof` = "' . $botlg['btl_cof'] . '",`zv` = "' . $pl['id'] . '",`hpNow` = "100000",`mpNow` = "100000" WHERE `id` = "' . $bot . '" LIMIT 1');
- mysql_query('UPDATE `users` SET `room` = "303",`battle` = "0" WHERE `id` = "' . $bot . '" LIMIT 1');
- $k++;
- }
- }
- unset($bot_users, $bpl, $bsp, $bot);
- if ($k + $i[0] >= 4 || ($pl['fastfight'] == 0 || $k + $i[0] >= 2)) {
- $back_test = true;
- }
- }
- } else {
- //
- $this->startBattle($pl['id'], $toChat . '|-|' . $toWhere);
- }
- }
- }
- }
-
- if ($back_test) {
- $this->testCronZv();
- }
-
- }
-
- public function userInfo()
- {
- global $u, $c;
- $r = '';
- if ($u->stats['mpAll'] > 0) {
- $pm = $u->stats['mpNow'] / $u->stats['mpAll'] * 100;
- }
- $ph = $u->stats['hpNow'] / $u->stats['hpAll'] * 100;
- $dp = '';
- if ($u->stats['mpAll'] <= 0) {
- $dp = 'margin-top:13px;';
- }
- $r .= '
- ' . $u->microLogin($u->info['id'], 1) . ' |
-
- ' . floor($u->stats['hpNow']) . '/' . $u->stats['hpAll'] . '
-
-
-
-';
-
- if ($u->stats['mpAll'] > 0) {
- $r .= ' ' . floor($u->stats['mpNow']) . '/' . $u->stats['mpAll'] . '
-
-
- ';
- }
- $r .= ' |
';
- unset($stt, $ph, $pm);
- return $r;
- }
-
- public function cancelGroup($zv, $uids)
- {
- global $u;
-
- if ($zv['priz'] > 0) {
- $sp = mysql_query('SELECT `id` FROM `stats` WHERE `zv` = "' . $zv['id'] . '"');
- }
- $upd = mysql_query('UPDATE `stats` SET `zv` = "0" WHERE `zv` = "' . $zv['id'] . '"');
- if ($upd) {
- $upd = mysql_query('UPDATE `zayvki` SET `cancel` = "' . time() . '" WHERE `id` = "' . $zv['id'] . '"');
- if ($upd && $uids != '') {
- if ($zv['priz'] > 0) {
- while ($pl = mysql_fetch_array($sp)) {
- // 1
- if ($zv['type'] == 33) //
- {
- $pld = mysql_fetch_array(mysql_query('SELECT `id` FROM `users` WHERE `inUser` = "' . $pl['id'] . '"'));
- if (isset($pld['id'])) {
- mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `id` = "' . $pld['id'] . '" LIMIT 1');
- $u->addItem(4754, $pld['id'], '');
- $uids = $pld['id'];
- mysql_query('DELETE FROM `users` WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
- mysql_query('DELETE FROM `stats` WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
- mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $pl['id'] . '" LIMIT 100');
- mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $pl['id'] . '" LIMIT 100');
- }
- } else {
- $u->addItem(4754, $pl['id'], '');
- }
- }
- $text = ' : . (1)';
- } else {
- $text = ' : .';
- }
- mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $zv['city'] . "','','','" . $uids . "','" . $text . "','" . time() . "','6','0')");
- }
- }
- }
-
- public function add()
- {
- global $u, $c, $code;
- if (isset($_GET['r']) && $u->info['inTurnirnew'] == 0) {
- $r = round(intval($_GET['r']));
- if (in_array($r, [1, 4, 5, 8, 10])) {
- $az = 1;
- if ($r == 1 && $u->info['level'] > 0) {
- $az = 0;
- $this->error = ' ;)';
- }
- if (($r == 4 || $r == 5) && $u->info['level'] < 2) {
- $az = 0;
- $this->error = ' ' . $this->z1n[$r] . ' .';
- }
-
- if ($this->testTravm() == 1 && $_POST['k'] != 1) {
- $this->error = ' . .';
- $az = 0;
- } elseif ($this->testTravm() == 2) {
- $this->error = ' . .';
- $az = 0;
- } elseif ($u->info['hpNow'] < $u->stats['hpAll'] / 100 * 30 && ($r >= 1 || $r <= 3)) {
- $this->error = ' ';
- $az = 0;
- }
- if ($u->info['zv'] > 0) {
- $az = 0;
- $this->error = ' .';
- }
- if ($az == 1) {
- $nz = [];
- $nz['city'] = $u->info['city'];
- $nz['creator'] = $u->info['id'];
- $nz['type'] = 0;
- if ($_POST['k'] == 1) {
- $nz['type'] = 1;
- }
- if ($_POST['k'] == 2) {
- $nz['type'] = 6;
- $nz['travmaChance'] = 100;
- }
- $_POST['timeout'] = round(intval(mysql_real_escape_string($_POST['timeout'])));
- if ($_POST['timeout'] == 1 || $_POST['timeout'] == 2 || $_POST['timeout'] == 3 || $_POST['timeout'] == 4 || $_POST['timeout'] == 5) {
- $nz['timeout'] = $_POST['timeout'] * 60;
- } else {
- $nz['timeout'] = 3 * 60;
- }
-
- $nz['razdel'] = $r;
- $nz['time_start'] = 0;
- $nz['min_lvl_1'] = 0;
- $nz['min_lvl_2'] = 0;
- $nz['max_lvl_1'] = 21;
- $nz['max_lvl_2'] = 21;
- $nz['tm1max'] = 0;
- $nz['tm2max'] = 0;
- $nz['invise'] = 0;
- $nz['money'] = 0;
- $nz['comment'] = '';
- $nz['tm1'] = 0;
- $nz['tm2'] = 0;
- $nz['otmorozok'] = 0;
- $gad = 1;
-
- if ($r == 5 && $u->info['level'] > 1) {
- //
- if ($_POST['startime2']) {
- $nz['time_start'] = (int)$_POST['startime2'];
- $nz['comment'] = substr($_POST['cmt'], 0, 40);
- $nz['comment'] = str_replace('"', '"', $nz['comment']);
- $nz['comment'] = htmlspecialchars($nz['comment'], null, 'cp1251');
- if ($nz['time_start'] != 180 && $nz['time_start'] != 300 && $nz['time_start'] != 600 && $nz['time_start'] != 900 && $nz['time_start'] != 1200 && $nz['time_start'] != 1800) {
- $nz['time_start'] = 600;
- }
-
- if (isset($_POST['mut_hidden'])) {
- $nz['invise'] = 1;
- }
- if (isset($_POST['noinc'])) {
- $nz['noinc'] = 1;
- }
- if (isset($_POST['fastfight'])) {
- $nz['fastfight'] = 1;
- }
- if (isset($_POST['otmorozok'])) {
- $nz['otmorozok'] = 1;
- }
- if (isset($_POST['nobot'])) {
- $nz['nobot'] = 1;
- }
- if (isset($_POST['kingfight'])) {
- $nz['kingfight'] = 1;
- }
- if (isset($_POST['arand'])) {
- $nz['arand'] = 1;
- }
- if (isset($_POST['travma'])) {
- $nz['travmaChance'] = 100;
- }
- if (isset($_POST['noatack'])) {
- $nz['noatack'] = 1;
- }
- if (isset($_POST['noeff'])) {
- $nz['noeff'] = 1;
- }
- if (isset($_POST['smert'])) {
- $nz['smert'] = 1;
- }
- if (isset($_POST['noart'])) {
- $nz['noart'] = 1;
- }
- if ($nz['kingfight'] == 1 && $nz['fastfight'] == 1) {
- $nz['kingfight'] = 0;
- }
-
- $nz['timeout'] = (int)$_POST['timeout'];
- if ($nz['timeout'] != 1 && $nz['timeout'] != 2 && $nz['timeout'] != 3 && $nz['timeout'] != 4 && $nz['timeout'] != 5) {
- $nz['timeout'] = 3;
- }
-
- //
- $lvl = (int)$_POST['levellogin1'];
- if ($lvl == 0) {
- $nz['min_lvl_1'] = 2;
- $nz['max_lvl_1'] = 21;
- } elseif ($lvl == 3) {
- $nz['min_lvl_1'] = $u->info['level'];
- $nz['max_lvl_1'] = $u->info['level'];
- $nz['min_lvl_2'] = $nz['min_lvl_1'];
- $nz['max_lvl_2'] = $nz['min_lvl_2'];
- } elseif ($lvl == 6) {
- $nz['min_lvl_1'] = $u->info['level'] - 1;
- $nz['max_lvl_2'] = $u->info['level'] + 1;
- } else {
- $nz['min_lvl_1'] = 2;
- $nz['max_lvl_1'] = 2;
- }
-
- if ((int)$_POST['k'] == 1) {
- //
- $nz['type'] = 1;
- }
- if ((int)$_POST['k'] == 2) {
- //
- $nz['type'] = 6;
- $nz['travmaChance'] = 1;
- }
- $nz['timeout'] = $nz['timeout'] * 60;
- $nz['tm1'] = $u->stats['reting'];
-
- if (!$u->info['no_zv_key'] && ($_POST['code21'] == 0 || $_POST['code21'] != $_SESSION['code2'] || $_SESSION['code2'] == 0 || !isset($_SESSION['code2']))) {
- $this->error = ' ';
- $gad = 0;
- }
- } else {
- $gad = 0;
- $this->error = '- ...
';
- }
- } elseif ($r == 4 && $u->info['level'] > 1) {
- //
- //
- if ($_POST['startime']) {
- $nz['time_start'] = (int)$_POST['startime'];
- $nz['comment'] = substr($_POST['cmt'], 0, 40);
- $nz['comment'] = str_replace('"', '"', $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'] = $u->info['level'];
- } elseif ($lvl == 2) {
- $nz['min_lvl_1'] = 2;
- $nz['max_lvl_1'] = $u->info['level'] - 1;
- } elseif ($lvl == 3) {
- $nz['min_lvl_1'] = $u->info['level'];
- $nz['max_lvl_1'] = $u->info['level'];
- } elseif ($lvl == 4) {
- $nz['min_lvl_1'] = $u->info['level'];
- $nz['max_lvl_1'] = $u->info['level'] + 1;
- } elseif ($lvl == 5) {
- $nz['min_lvl_1'] = $u->info['level'] - 1;
- $nz['max_lvl_1'] = $u->info['level'];
- } elseif ($lvl == 6) {
- $nz['min_lvl_1'] = $u->info['level'] - 1;
- $nz['max_lvl_1'] = $u->info['level'] + 1;
- $nz['min_lvl_1'] = 99;
- } else {
- $this->error = '- ...
';
- $gad = 0;
- }
-
- //
- $lvl = (int)$_POST['levellogin2'];
- if ($lvl == 0) {
- $nz['min_lvl_2'] = 2;
- $nz['max_lvl_2'] = 21;
- } elseif ($lvl == 1) {
- $nz['min_lvl_2'] = 2;
- $nz['max_lvl_2'] = $u->info['level'];
- } elseif ($lvl == 2) {
- $nz['min_lvl_2'] = 2;
- $nz['max_lvl_2'] = $u->info['level'] - 1;
- } elseif ($lvl == 3) {
- $nz['min_lvl_2'] = $u->info['level'];
- $nz['max_lvl_2'] = $u->info['level'];
- } elseif ($lvl == 4) {
- $nz['min_lvl_2'] = $u->info['level'];
- $nz['max_lvl_2'] = $u->info['level'] + 1;
- } elseif ($lvl == 5) {
- $nz['min_lvl_2'] = $u->info['level'] - 1;
- $nz['max_lvl_2'] = $u->info['level'];
- } elseif ($lvl == 6) {
- $nz['min_lvl_2'] = $u->info['level'] - 1;
- $nz['max_lvl_2'] = $u->info['level'] + 1;
- $nz['min_lvl_2'] = 99;
- } else {
- $this->error = '- ...
';
- $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 && $u->info['level'] > 1) {
- $bt2 = 1;
- $nz['min_lvl_2'] = $u->info['level'];
- $nz['max_lvl_2'] = $u->info['level'];
- $nz['min_lvl_1'] = $u->info['level'];
- $nz['max_lvl_1'] = $u->info['level'];
- } else {
- $bt2 = 0;
- }
-
- if ($gad == 1) {
- if (!isset($nz['withUser'])) {
- $nz['withUser'] = '';
- }
- $nz['time_create_zv'] = time();
- if ($nz['razdel'] == 4 || $nz['razdel'] == 5) {
- //
- $nz['time_create_zv'] = strtotime(date('d.m.Y H:i', $nz['time_create_zv']) . ':00', $nz['time_create_zv']);
- } elseif ($nz['razdel'] == 3) {
- $nz['noinc'] = 1;
- }
- $nz['teams'] = 2;
- $nz['align1'] = 0;
- $nz['align2'] = 0;
- $nz['align3'] = 0;
- if (isset($_POST['3align'])) {
- $nz['teams'] = 3;
- $nz['min_lvl_1'] = 2;
- $nz['min_lvl_2'] = 2;
- $nz['max_lvl_1'] = 21;
- $nz['max_lvl_2'] = 21;
- //
- if (floor($u->info['align']) == 3) {
- $nz['align1'] = 3;
- $nz['align2'] = 1;
- $nz['align3'] = 7;
- } elseif (floor($u->info['align']) == 7) {
- $nz['align1'] = 7;
- $nz['align2'] = 1;
- $nz['align3'] = 3;
- } else {
- $nz['align1'] = 1;
- $nz['align2'] = 3;
- $nz['align3'] = 7;
- }
- //
- }
- //
- if ($nz['razdel'] == 2 && isset($_POST['commentfiz'])) {
- $nz['comment'] = htmlspecialchars($_POST['commentfiz'], null, 'cp1251');
- }
- //
- if ($nz['razdel'] == 5) {
- $nz['maxplayers'] = [
- 6 => 6,
- 8 => 8,
- 10 => 10,
- 12 => 12,
- 14 => 14,
- 16 => 16,
- 18 => 18,
- 20 => 20,
- 40 => 40
- ];
- if (isset($nz['players'][$_POST['players']])) {
- $nz['maxplayers'];
- } else {
- $nz['maxplayers'] = $nz['maxplayers'][$_POST['players']];
- }
- }
- //
- $ins = mysql_query('INSERT INTO `zayvki` (`maxplayers`,`otmorozok`,`align1`,`align2`,`align3`,`teams`,`smert`,`noart`,`noeff`,`noatack`,`arand`,`kingfight`,`nobot`,`fastfight`,`noinc`,`bot1`,`bot2`,`time`,`city`,`creator`,`type`,`time_start`,`timeout`,`min_lvl_1`,`min_lvl_2`,`max_lvl_1`,`max_lvl_2`,`tm1max`,`tm2max`,`travmaChance`,`invise`,`razdel`,`comment`,`money`,`withUser`,`tm1`,`tm2`) VALUES (
- "' . $nz['maxplayers'] . '",
- "' . $nz['otmorozok'] . '",
- "' . $nz['align1'] . '",
- "' . $nz['align2'] . '",
- "' . $nz['align3'] . '",
- "' . $nz['teams'] . '",
- "' . $nz['smert'] . '",
- "' . $nz['noart'] . '",
- "' . $nz['noeff'] . '",
- "' . $nz['noatack'] . '",
- "' . $nz['arand'] . '",
- "' . $nz['kingfight'] . '",
- "' . $nz['nobot'] . '",
- "' . $nz['fastfight'] . '",
- "' . $nz['noinc'] . '",
- "0",
- "' . ((int)$bt2) . '",
- "' . $nz['time_create_zv'] . '",
- "' . $nz['city'] . '",
- "' . $nz['creator'] . '",
- "' . $nz['type'] . '",
- "' . $nz['time_start'] . '",
- "' . mysql_real_escape_string($nz['timeout']) . '",
- "' . mysql_real_escape_string($nz['min_lvl_1']) . '",
- "' . mysql_real_escape_string($nz['min_lvl_2']) . '",
- "' . mysql_real_escape_string($nz['max_lvl_1']) . '",
- "' . mysql_real_escape_string($nz['max_lvl_2']) . '",
- "' . mysql_real_escape_string($nz['tm1max']) . '",
- "' . mysql_real_escape_string($nz['tm2max']) . '",
- "' . $nz['travmaChance'] . '",
- "' . $nz['invise'] . '",
- "' . $nz['razdel'] . '",
- "' . mysql_real_escape_string($nz['comment']) . '",
- "' . mysql_real_escape_string($nz['money']) . '",
- "' . $nz['withUser'] . '","' . $nz['tm1'] . '","' . $nz['tm2'] . '")');
- $zid = mysql_insert_id();
- if ($ins) {
- mysql_query('UPDATE `stats` SET `zv`="' . $zid . '",`team`="1" WHERE `id`="' . $u->info['id'] . '" LIMIT 1');
- $u->info['zv'] = $zid;
- $this->error = ' ';
- } else {
- $this->error = ' ...' . $ins;
- }
- }
- }
- }
- }
- }
-
- //
- public function addBot()
- {
- global $u, $c, $code;
-
- if (($u->info['level'] <= $c['bot_level'] || $u->info['admin'] > 0) && $u->info['exp'] != 12499) {
- $bot = $u->addNewbot($id['id'], null, $u->info['id'], null, true);
- } else {
- $bot = false;
- }
- if (!$bot) {
- $this->error = ' , , 8 ...
, - ...
';
- } elseif ($u->info['hpNow'] < $u->stats['hpAll'] / 100 * 30 && ($r == 1)) {
- $this->error = ' ';
- $az = 0;
- } elseif ($u->info['align'] == 2) {
- $this->error = ' ';
- $az = 0;
- } elseif (!$bot) {
- echo '
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",
- "' . $u->info['city'] . '",
- "' . time() . '",
- "' . $btl['players'] . '",
- "' . $btl['timeout'] . '",
- "' . $btl['type'] . '",
- "' . $btl['invis'] . '",
- "' . $btl['noinc'] . '",
- "' . $btl['travmChance'] . '",
- "' . $btl['typeBattle'] . '",
- "' . $btl['addExp'] . '",
- "' . $btl['money'] . '",
- "' . $btl['priz'] . '")');
- if ($ins) {
- $btl_id = mysql_insert_id();
- //
- $u->info['enNow'] -= $trEn;
- $upd2 = mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $u->info['id'] . '" OR `id` = "' . $bot . '" LIMIT 2');
- mysql_query('UPDATE `stats` SET `team`="1",`enNow` = "' . $u->info['enNow'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
- mysql_query('UPDATE `stats` SET `hpNow` = "' . $u->stats['hpAll'] . '",`team`="2" WHERE `id` = "' . $bot . '" LIMIT 1');
- // ,
- $u->info['battle'] = $btl_id;
- //
- mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $u->info['city'] . "','" . $u->info['room'] . "','" . $u->info['login'] . "','" . time() . "','11','0','117')");
- die('');
- } else {
- $this->error = 'Cannot start battle (no prototype "ABD0Clone")';
- }
- }
- }
-
- //
- public function addBotClone($uid)
- {
- global $u, $c, $code;
-
- if ($u->info['online'] > 0) {
- $bot = $u->addNewbot($id['id'], null, $uid, null, false);
- } else {
- $bot = false;
- }
- if (!$bot) {
- $this->error = ' ';
- } elseif ($u->info['hpNow'] < $u->stats['hpAll'] / 100 * 30 && ($r >= 1 || $r <= 3)) {
- $this->error = ' ';
- $az = 0;
- } elseif ($u->info['align'] == 2) {
- $this->error = ' ';
- $az = 0;
- } elseif (!$bot) {
- echo '
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",
- "' . $u->info['city'] . '",
- "' . time() . '",
- "' . $btl['players'] . '",
- "' . $btl['timeout'] . '",
- "564",
- "' . $btl['invis'] . '",
- "' . $btl['noinc'] . '",
- "' . $btl['travmChance'] . '",
- "' . $btl['typeBattle'] . '",
- "' . $btl['addExp'] . '",
- "' . $btl['money'] . '")');
- if ($ins) {
- $btl_id = mysql_insert_id();
- //
- $u->info['enNow'] -= $trEn;
- $upd2 = mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $u->info['id'] . '" OR `id` = "' . $bot . '" LIMIT 2');
- mysql_query('UPDATE `stats` SET `team`="1",`enNow` = "' . $u->info['enNow'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
- mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot . '" LIMIT 1');
- // ,
- if ($btl['type'] == 1) {
- mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $u->info['id'] . '" AND `inOdet`!=0');
- mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $bot . '" AND `inOdet`!=0');
- }
-
- // ,
- $u->info['battle'] = $btl_id;
- //
- mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $u->info['city'] . "','" . $u->info['room'] . "','" . $u->info['login'] . "','" . time() . "','11','0','117')");
- die('');
- } else {
- $this->error = 'Cannot start battle (no prototype "ABD0Clone")';
- }
- }
- }
-
- //
- public function startIzlom($id2, $lvl)
- {
- global $u, $c, $code;
- $lvl = (int)$lvl;
-
- if ($lvl == 8) {
- /*
-
-
-
-
- */
- $bots = ['', ' ', ' ', ' ', ' ', ' ', ' '];
- }
-
- $id2 = rand(0, (count($bots) - 1));
- $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1'));
- $logins_bot = [];
- $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null);
-
- if (isset($id['id']) && $bot) {
- $logins_bot = $bot['logins_bot'];
- //
- $expB = -$bot['expB'];
- $btl = ['priz' => '', 'players' => '', 'otmorozok' => 0, 'timeout' => 60, 'type' => 9, 'invis' => 0, 'noinc' => 0, 'travmChance' => 0, 'typeBattle' => 0, 'addExp' => $expB, 'money' => 0, 'izlom' => (int)$id2, 'izlomLvl' => (int)$lvl];
- $ins = mysql_query('INSERT INTO `battle` (`otmorozok`,`priz`,`smert`,`noart`,`noeff`,`noatack`,`arand`,`kingfight`,`nobot`,`fastfight`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`,`izlom`,`izlomLvl`) VALUES (
- "' . $btl['otmorozok'] . '",
- "' . $btl['priz'] . '",
- "' . $btl['smert'] . '",
- "' . $btl['noart'] . '",
- "' . $btl['noeff'] . '",
- "' . $btl['noatack'] . '",
- "' . $btl['arand'] . '",
- "' . $btl['kingfight'] . '",
- "' . $btl['nobot'] . '",
- "' . $btl['fastfight'] . '",
- "' . $u->info['city'] . '",
- "' . time() . '",
- "' . $btl['players'] . '",
- "' . $btl['timeout'] . '",
- "' . $btl['type'] . '",
- "' . $btl['invis'] . '",
- "' . $btl['noinc'] . '",
- "' . $btl['travmChance'] . '",
- "' . $btl['typeBattle'] . '",
- "' . $btl['addExp'] . '",
- "' . $btl['money'] . '","' . $btl['izlom'] . '","' . $btl['izlomLvl'] . '")');
- if ($ins) {
- $btl_id = mysql_insert_id();
- //
- $upd2 = mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $u->info['id'] . '" OR `id` = "' . $bot['id'] . '" LIMIT 2');
- mysql_query('UPDATE `stats` SET `team`="1" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
- mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
-
- // ,
- $u->info['battle'] = $btl_id;
-
- // 2
- $id2 = rand(0, (count($bots) - 1));
- $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1'));
- $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null);
- if (isset($id['id']) && $bot) {
- $logins_bot = $bot['logins_bot'];
- mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
- mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
- }
- $id2 = rand(0, (count($bots) - 1));
- $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1'));
- $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null);
- if (isset($id['id']) && $bot) {
- $logins_bot = $bot['logins_bot'];
- mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
- mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
- }
-
- //
- mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $u->info['city'] . "','" . $u->info['room'] . "','" . $u->info['login'] . "','" . time() . "','11','0','117')");
- die('');
- } 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)
- {
- global $c, $code, $u;
- $z = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `id`="' . $id . '" AND `start` = "0" AND `cancel` = "0" AND (`time` > "' . (time() - 60 * 60 * 2) . '" OR `razdel` > 3) LIMIT 1'));
- if ($z['type'] == 33) {
- sleep(5);
- }
- mysql_query('START TRANSACTION');
- mysql_query("LOCK TABLES
- `aaa_monsters` WRITE,
- `actions` WRITE,
- `bank` WRITE,
-
- `battle` WRITE,
- `battle_act` WRITE,
- `battle_actions` WRITE,
- `battle_cache` WRITE,
- `battle_end` WRITE,
- `battle_last` WRITE,
- `battle_logs` WRITE,
- `battle_logs_save` WRITE,
- `battle_stat` WRITE,
- `battle_users` WRITE,
-
- `bs_actions` WRITE,
- `bs_items` WRITE,
- `bs_items_use` WRITE,
- `bs_logs` WRITE,
- `bs_map` WRITE,
- `bs_statistic` WRITE,
- `bs_trap` WRITE,
- `bs_turnirs` WRITE,
- `bs_zv` WRITE,
-
- `clan` WRITE,
- `clan_wars` WRITE,
-
- `dungeon_actions` WRITE,
- `dungeon_bots` WRITE,
- `dungeon_items` WRITE,
- `dungeon_map` WRITE,
- `dungeon_now` WRITE,
- `dungeon_zv` WRITE,
-
- `eff_main` WRITE,
- `eff_users` WRITE,
-
- `items_img` WRITE,
- `items_local` WRITE,
- `items_main` WRITE,
- `items_main_data` WRITE,
- `items_users` WRITE,
-
- `izlom` WRITE,
- `izlom_rating` WRITE,
-
- `laba_act` WRITE,
- `laba_itm` WRITE,
- `laba_map` WRITE,
- `laba_now` WRITE,
- `laba_obj` WRITE,
-
- `levels` WRITE,
- `levels_animal` WRITE,
-
- `online` WRITE,
-
- `priems` WRITE,
-
- `quests` WRITE,
- `reimage` WRITE,
-
- `reg` WRITE,
-
- `stats` WRITE,
- `test_bot` WRITE,
- `turnirs` WRITE,
- `users` WRITE,
- `users_animal` WRITE,
- `user_ico` WRITE,
- `users_twink` WRITE,
- `zayvki` WRITE;");
- $z = mysql_fetch_array(mysql_query('SELECT * FROM `zayvki` WHERE `id`="' . $id . '" AND `start` = "0" AND `cancel` = "0" AND (`time` > "' . (time() - 60 * 60 * 2) . '" OR `razdel` > 3) LIMIT 1'));
- if (isset($z['id'])) {
- $vars = explode('|-|', $vars);
- if ($z['razdel'] >= 4 && $z['razdel'] <= 5) {
- //
- $btl_id = 0;
- //$txtz = '';
- if ($z['razdel'] == 5) {
- $sp = mysql_query('SELECT `s`.`id`,`s`.`team`,`s`.`upLevel`,`s`.`btl_cof`,`s`.`exp` FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `u`.`id` = `s`.`id` WHERE `s`.`zv` = "' . $z['id'] . '" ORDER BY `s`.`btl_cof` DESC LIMIT 200');
- $tsr = rand(0, 100);
- if ($tsr >= 70 && $z['type'] != 33) {
- $ii = -1;
- while ($pl = mysql_fetch_array($sp)) {
- $ii++;
- $pld[$ii] = $pl;
- }
- $yy = $ii;
- $jj = $ii;// c
- $ii = 0;
- $teamA = 0;
- $teamAbtlconf = 0;
- $teamB = 0;
- $teamBbtlconf = 0;
- while ($yy > -1) {
- if ($ii == 0 || $teamAbtlconf <= $teamBbtlconf) {
- if (isset ($pld[$ii])) {
- $teamnew = 1;
- $teamAbtlconf = $teamAbtlconf + $pld[$ii]['btl_cof'];
- $teamA++;
- $idi = $ii;
- mysql_query('UPDATE `stats` SET `team` = "' . $teamnew . '" WHERE `id` = "' . $pld[$idi]['id'] . '" LIMIT 1');
- }
- $ii++;
- } elseif (($teamB - $teamA) <= 0) {
- if (isset ($pld[$ii])) {
- $teamnew = 2;
- $teamBbtlconf = $teamBbtlconf + $pld[$ii]['btl_cof'];
- $teamB++;
- $idi = $ii;
- mysql_query('UPDATE `stats` SET `team` = "' . $teamnew . '" WHERE `id` = "' . $pld[$idi]['id'] . '" LIMIT 1');
- }
- $ii++;
- } else {
- if (isset ($pld[$ii])) {
- $teamnew = 1;
- $teamAbtlconf = $teamAbtlconf + $pld[$jj]['btl_cof'];
- $teamA++;
- $idi = $jj;
- mysql_query('UPDATE `stats` SET `team` = "' . $teamnew . '" WHERE `id` = "' . $pld[$idi]['id'] . '" LIMIT 1');
- }
- $jj--;
- }
- $yy--;
- }
- } else {
- $balansteamA = 0;
- $balansteamB = 0;
- while ($pl = mysql_fetch_array($sp)) {
- $teamnew = rand(1, 2);
- if ($balansteamA != $balansteamB) {
- if ($balansteamA > $balansteamB) {
- $teamnew = 2;
- } else {
- $teamnew = 1;
- }
- }
- mysql_query('UPDATE `stats` SET `team` = "' . $teamnew . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
- if ($teamnew == 1) {
- $balansteamA += 1;
- } else {
- $balansteamB += 1;
- }
- }
- }
- unset($sp, $pl);
- }
- $btl = [
- 'otmorozok' => $z['otmorozok'],
- 'priz' => $z['priz'], 'smert' => $z['smert'], 'noart' => $z['noart'], 'noeff' => $z['noeff'], 'noatack' => $z['noatack'], 'arand' => $z['arand'], 'kingfight' => $z['kingfight'],
- 'players' => '', 'timeout' => $z['timeout'], 'type' => $z['type'], 'travmChance' => $z['travmChance'], 'invis' => $z['invise'], 'noinc' => 0, 'typeBattle' => 0, 'addExp' => $z['exp'], 'money' => 0, 'money3' => 0];
- //
- $ins = mysql_query('INSERT INTO `battle` (`otmorozok`,`priz`,`smert`,`noart`,`noeff`,`noatack`,`arand`,`kingfight`,`nobot`,`fastfight`,`razdel`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES (
- "' . $z['otmorozok'] . '",
- "' . $z['priz'] . '",
- "' . $z['smert'] . '",
- "' . $z['noart'] . '",
- "' . $z['noeff'] . '",
- "' . $z['noatack'] . '",
- "' . $z['arand'] . '",
- "' . $z['kingfight'] . '",
- "' . $z['nobot'] . '",
- "' . $z['fastfight'] . '",
- "' . $z['razdel'] . '",
- "' . $z['city'] . '",
- "' . time() . '",
- "' . mysql_real_escape_string($btl['players']) . '",
- "' . mysql_real_escape_string($btl['timeout']) . '",
- "' . mysql_real_escape_string($btl['type']) . '",
- "' . mysql_real_escape_string($btl['invis']) . '",
- "' . mysql_real_escape_string($btl['noinc']) . '",
- "' . mysql_real_escape_string($z['travmChance']) . '",
- "' . mysql_real_escape_string($btl['typeBattle']) . '",
- "' . mysql_real_escape_string($btl['addExp']) . '",
- "' . mysql_real_escape_string($btl['money']) . '")');
- $btl_id = mysql_insert_id();
- if ($btl_id > 0) {
-
- // ,
- if ($z['type'] == 1) {
- $sp = mysql_query('SELECT `id` FROM `stats` WHERE `zv` = "' . $z['id'] . '"');
- while ($pl = mysql_fetch_array($sp)) {
- mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $pl['id'] . '" AND `inOdet`!=0');
- }
- } elseif ($z['type'] == 51) { //
- $sp = mysql_query('SELECT `id` FROM `stats` WHERE `zv` = "' . $z['id'] . '"');
- while ($pl = mysql_fetch_array($sp)) {
- mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $pl['id'] . '" AND `2price` > 0');
- }
- }
-
- //
- $upd1 = mysql_query('UPDATE `stats` SET `zv`="0" WHERE `zv` = "' . $z['id'] . '"');
- $upd2 = mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE ' . $vars[1] . '');
-
- // ,
- $upd = mysql_query('UPDATE `zayvki` SET `start` = "' . time() . '",`btl_id` = "' . $btl_id . '" WHERE `id` = "' . $z['id'] . '" LIMIT 1');
- $u->info['battle'] = $btl_id;
- //
- mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $u->info['city'] . "','-1','" . $vars[0] . "','" . time() . "','11','0','117')");
-
- }
- } elseif ($z['razdel'] >= 1 && $z['razdel'] <= 3) {
- // PvP
- if ($u->info['team'] == 1 && $u->info['zv'] == $z['id']) {
- $zu = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `zv`="' . $z['id'] . '" AND `team` = "2" LIMIT 1'));
- if (isset($zu['id'])) {
- $uz = mysql_fetch_array(mysql_query('SELECT `login`,`money` FROM `users` WHERE `id`="' . $zu['id'] . '" LIMIT 1'));
- if ($zu['clone'] > 0) {
- //
- $bot = $u->addNewbot(1, null, $zu['clone'], null, true);
- if ($bot > 0) {
- mysql_query('DELETE FROM `users` WHERE `id` = "' . $zu['id'] . '" LIMIT 1');
- mysql_query('DELETE FROM `stats` WHERE `id` = "' . $zu['id'] . '" LIMIT 1');
- mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $zu['id'] . '" LIMIT 100');
- mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $zu['id'] . '" LIMIT 100');
-
- mysql_query('UPDATE `stats` SET `zv` = "' . $z['id'] . '",`team` = 2 WHERE `id` = "' . $bot . '" LIMIT 1');
-
- $zu = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `zv`="' . $z['id'] . '" AND `team` = "2" LIMIT 1'));
- $uz = mysql_fetch_array(mysql_query('SELECT `login`,`money` FROM `users` WHERE `id`="' . $zu['id'] . '" LIMIT 1'));
- }
- }
-
- //
- $btl_id = 0;
- if ($uz['money'] < $z['money'] || $u->info['money'] < $z['money']) {
- $z['money'] = 0;
- }
- $btl = ['otmorozok' => $z['otmorozok'], 'players' => '', 'timeout' => $z['timeout'], 'type' => $z['type'], 'travmChance' => $z['travmChance'], 'invis' => 0, 'noinc' => 0, 'typeBattle' => 0, 'addExp' => 0, 'money' => round($z['money'], 2), 'money3' => 0];
- $ins = mysql_query('INSERT INTO `battle` (`otmorozok`,`smert`,`noart`,`noeff`,`noatack`,`arand`,`kingfight`,`nobot`,`fastfight`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES (
- "' . mysql_real_escape_string($btl['otmorozok']) . '",
- "' . mysql_real_escape_string($btl['smert']) . '",
- "' . mysql_real_escape_string($btl['noart']) . '",
- "' . mysql_real_escape_string($btl['noeff']) . '",
- "' . mysql_real_escape_string($btl['noatack']) . '",
- "' . mysql_real_escape_string($btl['arand']) . '",
- "' . mysql_real_escape_string($btl['kingfight']) . '",
- "' . mysql_real_escape_string($btl['nobot']) . '",
- "' . mysql_real_escape_string($btl['fastfight']) . '",
- "' . $u->info['city'] . '",
- "' . time() . '",
- "' . mysql_real_escape_string($btl['players']) . '",
- "' . mysql_real_escape_string($btl['timeout']) . '",
- "' . mysql_real_escape_string($btl['type']) . '",
- "' . mysql_real_escape_string($btl['invis']) . '",
- "' . mysql_real_escape_string($btl['noinc']) . '",
- "' . mysql_real_escape_string($btl['travmChance']) . '",
- "' . mysql_real_escape_string($btl['typeBattle']) . '",
- "' . mysql_real_escape_string($btl['addExp']) . '",
- "' . mysql_real_escape_string($btl['money']) . '")');
- $btl_id = mysql_insert_id();
- if ($ins) {
- //
- $upd1 = mysql_query('UPDATE `stats` SET `zv`="0" WHERE `zv` = "' . $z['id'] . '" LIMIT 2');
- $upd2 = mysql_query('UPDATE `users` SET `battle`="' . $btl_id . '" WHERE `id` = "' . $u->info['id'] . '" OR `id` = "' . $zu['id'] . '" LIMIT 2');
-
- // ,
- if ($z['type'] == 1) {
- mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $u->info['id'] . '" AND `inOdet`!=0');
- mysql_query('UPDATE `items_users` SET `inOdet`="0" WHERE `uid` = "' . $zu['id'] . '" AND `inOdet`!=0');
- }
-
- // ,
- $upd = mysql_query('UPDATE `zayvki` SET `start` = "' . time() . '",`btl_id` = "' . $btl_id . '" WHERE `id` = "' . $z['id'] . '" LIMIT 1');
-
- $u->info['battle'] = $btl_id;
-
- //
- mysql_query("INSERT INTO `chat` (`city`,`room`,`to`,`time`,`type`,`toChat`,`sound`) VALUES ('" . $u->info['city'] . "','" . $u->info['room'] . "','" . $uz['login'] . "','" . time() . "','11','0','117')");
- die('');
- } else {
- $this->error = ' .';
- }
- } else {
- $this->error = ' , .';
- }
- } else {
- $this->error = ' .';
- }
- }
- }
- mysql_query('UNLOCK TABLES');
- mysql_query('COMMIT');
- }
-
- public function cancelzv()
- {
- global $u, $c, $code, $zi;
- if (isset($_GET['cancelzv'], $zi['id']) && $zi['razdel'] >= 1 && $zi['razdel'] <= 3) {
- $enemy = mysql_fetch_array(mysql_query('SELECT `u`.*,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zi['id'] . '" AND `st`.`team` = "2" LIMIT 1'));
- if (isset($enemy['id'])) {
- if ($u->info['team'] == 1) {
- // +
- $upd = mysql_query('UPDATE `stats` SET `zv` = "0",`team`="0" WHERE `id` = "' . $enemy['id'] . '" LIMIT 1');
- if ($upd) {
- mysql_query('UPDATE `users` SET `otk` = (`otk` + 1) WHERE `id` = "' . $zi['id'] . '" LIMIT 1');
- $this->error = ' ' . $enemy['login'] . ' ';
- //
- $sa = '';
- if ($u->info['sex'] == 2) {
- $sa = '';
- }
- $text = ' [login:' . $u->info['login'] . '] ' . $sa . ' .';
- mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $enemy['city'] . "','','','" . $enemy['login'] . "','" . $text . "','" . time() . "','6','0')");
- }
- } elseif ($u->info['id'] == $enemy['id'] && $zi['start'] == 0) {
- // +
- $upd = mysql_query('UPDATE `stats` SET `zv` = "0",`team`="0" WHERE `id` = "' . $enemy['id'] . '" LIMIT 1');
- if ($upd) {
- $uz = mysql_fetch_array(mysql_query('SELECT `u`.`sex`,`u`.`login`,`u`.`city`,`u`.`room`,`u`.`id`,`st`.`zv`,`st`.`team` FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zi['id'] . '" AND `st`.`team` = "1" LIMIT 1'));
- if (isset($uz['id'])) {
- $this->error = ' .';
- //
- $sa = '';
- if ($u->info['sex'] == 2) {
- $sa = '';
- }
- $text = ' [login:' . $u->info['login'] . '] ' . $sa . ' .';
- mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $uz['city'] . "','','','" . $uz['login'] . "','" . $text . "','" . time() . "','6','0')");
- }
- $u->info['zv'] = 0;
- $u->info['team'] = 0;
- }
- }
- if ($enemy['bot'] == 1) {
- // ,
- mysql_query('DELETE FROM `users` WHERE `id` = "' . $enemy['id'] . '" LIMIT 1');
- mysql_query('DELETE FROM `stats` WHERE `id` = "' . $enemy['id'] . '" LIMIT 1');
- mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $enemy['id'] . '" LIMIT 100');
- mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $enemy['id'] . '" LIMIT 100');
- }
- } else {
- if ($u->info['team'] == 1) {
- //
- $upd = mysql_query('UPDATE `zayvki` SET `cancel` = "' . time() . '" WHERE `id` = "' . $zi['id'] . '" LIMIT 1');
- if ($upd) {
- mysql_query('UPDATE `stats` SET `zv` = "0" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
- $this->error = ' ';
- $zi = false;
- $u->info['zv'] = 0;
- }
- }
- }
- }
- }
-
- public function see()
- {
- global $u, $c, $code, $zi, $cron;
- if (isset($_GET['r']) && ((!isset($_GET['new_group']) && !isset($_POST['groupClick'])) || isset($zi['id']))) {
- $r = round(intval($_GET['r']));
- if (in_array($r, [1, 4, 5, 8, 10])) {
- $this->zv_see = 1;
- if ($u->room['FR'] == 0 && $u->room['zvsee'] == 0) {
- echo '
';
- $this->zv_see = 0;
- } elseif ($r == 1 && $u->info['level'] > 0) {
- echo '
;)';
- $this->zv_see = 0;
- } elseif ($r > 1 && $r < 6 && $u->info['level'] < 1) {
- echo '
;)';
- $this->zv_see = 0;
- } elseif ($r > 3 && $r < 6 && $u->info['level'] < 2) {
- echo '
' . $this->z1n[$r] . ' .';
- $this->zv_see = 0;
- } elseif ($r == 1 && $u->info['level'] > 0) {
- echo '
;)';
- $this->zv_see = 0;
- } elseif ($r == 8 && $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($u->info['id']);
- }
- }
- ##
- # .
- $db = new \Insallah\Db();
- $tournamentsList = $db::getRows('select * from tournaments');
- $tournaments = '
';
- foreach ($tournamentsList as $tournament) {
- $time = $tournament['start_time'] === -1 ? ' !' : date('G:i', $tournament['start_time']);
- $tournament_members_id = \Insallah\TournamentModel::getFreeFighters($tournament['tid']);
- $members = [];
- foreach ($tournament_members_id as $member) {
- $members[] = \Insallah\TournamentModel::uidToLogin($member);
- }
- $tournaments .= sprintf("- %d .
: %s
: %s ",
- $tournament['tid'], $time, implode(', ', $members));
- }
- $tournaments .= '
';
- ?>
-
-
!
-
- - , - !
- info['id'])): ?>
- - , = \Insallah\Tournament::ekrOverpriceFormula($u->info['level']) ?> .
-
- info['exp'] < \Insallah\Tournament::MIN_EXP): ?>
- - = \Insallah\Tournament::MIN_EXP ?> .
-
- - , = \Insallah\Tournament::START_TOURNAMENT ?> .
- - 1, 2 3 25, 15, 5 , 12 , 6 3 !
-
-
-
-
- .
- = $tournaments ?>
-
-
- info['id']) || !\Insallah\TournamentModel::isStarted($u->info['level'])): ?>
-
-
- .
-
-
-
- !
-
- info['zv'] > 0 && $u->info['battle'] == 0 && $r != 8) {
- if ($zi['razdel'] == 1 || $zi['razdel'] == 2 || $zi['razdel'] == 3) {
- echo '
-
-
- ';
-
- if ($u->info['team'] == 1) {
- $uz = mysql_fetch_array(mysql_query('SELECT `u`.`sex`,`u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zi['id'] . '" AND `st`.`team`="2" LIMIT 1'));
- if (!isset($uz['id'])) {
- //
- echo ' ';
- } else {
- // -
- $sa = '';
- if ($uz['sex'] == 2) {
- $sa = '';
- }
- echo ' ' . $sa . ' ' . $ca . ' ' . $u->microLogin($uz['id'], 1) . ' ? ';
- }
- } else {
- $uz = mysql_fetch_array(mysql_query('SELECT `u`.`id`,`u`.`login`,`u`.`align`,`u`.`clan`,`u`.`admin`,`u`.`city`,`u`.`room`,`u`.`online`,`u`.`level`,`u`.`battle`,`u`.`money`,`st`.* FROM `stats` AS `st` LEFT JOIN `users` AS `u` ON (`st`.`id` = `u`.`id`) WHERE `st`.`zv`="' . $zi['id'] . '" AND `st`.`team`="1" LIMIT 1'));
- if (isset($uz['id'])) {
- echo ' ' . $u->microLogin($uz['id'], 1) . ' ';
- }
- }
- echo ' | |
';
- } else {
- $tm_start = floor(($zi['time'] + $zi['time_start'] - time()) / 6) / 10;
- $tm_start = $this->rzv($tm_start);
- echo '' . $i . '. ' . $u->microLogin($plu, 2) . '
';
- $i++;
- }
- echo '
-
- ...
';
- } else {
- echo '' . $html . '
';
- } ?>
-