';
- }
- $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'] * 0.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['s5'] * 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;
- }
-
-}
diff --git a/_incl_data/class/UserStats.php b/_incl_data/class/UserStats.php
index 4b3a5588..55f85e31 100644
--- a/_incl_data/class/UserStats.php
+++ b/_incl_data/class/UserStats.php
@@ -7,7 +7,6 @@ class UserStats
/**
* .
* @param $userId
- * @param bool $showAll
* @return array
*/
public static function getAllBonuses($userId, $showAll = false)
@@ -18,7 +17,6 @@ class UserStats
union all select data from eff_users where uid = ? and `delete` = 0';
$iData = $db::getColumn($q, [$userId, $userId]);
$params = [];
- $params2 = json_decode(str_replace(['=', '|'], ['":', ',"'], '{"' . $iData . '}'), true);
foreach ($iData as $datum) {
foreach (explode('|', $datum) as $inner) {
list($a, $b) = explode('=', $inner);
diff --git a/_incl_data/class/__battle.php-cleared b/_incl_data/class/__battle.php-cleared
deleted file mode 100644
index 49474796..00000000
--- a/_incl_data/class/__battle.php-cleared
+++ /dev/null
@@ -1,8360 +0,0 @@
-db = $db;
- }
-
- /** Priems.
- * @param $u1
- * @param $u2
- * @param $type
- * @return string
- */
- public function maginfoattack($u1, $u2, $type)
- {
- /*
- 1 - ,
- 2 - ,
- 3 - ,
- 4 -
- */
- $v_l = str_replace(' ', ' ', $this->users[$this->uids[$u1]]['login']);
-
- //
- $v_z = 0 + $this->stats[$this->uids[$u2]]['zm' . $type];
- //
- $v_p = round(($this->stats[$this->uids[$u1]]['pzm' . $type] + $this->stats[$this->uids[$u1]]['pzm']) * 0.4);
- //
- $v_m = 0 + $this->stats[$this->uids[$u1]]['pm' . $type];
-
- return
- ' magelogin=' . $v_l .
- ' onMouseOver=top.hi(this,maginfo(' . $v_z . ',' . $v_p . ',' . $v_m . ',this),event,3,1,1,1,null); onMouseOut=top.hic(); onMouseDown=top.hic(); ';
- }
-
- /** $x
- * @param $x
- * @return array
- */
- private function typeBattle($x)
- {
- $r = [0, 0, ' ', ' '];
- if ($x >= 50000 && $x < 100000) {
- $r = [25, 50, ' ', ' '];
- } elseif ($x < 500000) {
- $r = [50, 75, ' ', ' '];
- } elseif ($x < 1000000) {
- $r = [75, 100, ' ', ' '];
- } elseif ($x < 2500000) {
- $r = [100, 125, ' ', ' '];
- } elseif ($x >= 5000000) {
- $r = [150, 150, ' ', ' '];
- }
- return $r;
- }
-
- ## - PRIEMS ()
- public $mncolor = [
- 1 => '006699',
- 2 => '006699',
- 3 => '006699',
- 4 => '006699',
- 5 => '006699',
- 6 => '006699',
- 7 => '006699',
- ]; //
- public $mcolor = [
- 1 => 'A00000',
- 2 => '008080',
- 3 => '0000FF',
- 4 => 'A52A2A',
- 5 => '006699',
- 6 => '006699',
- 7 => '006699',
- ]; //
- public $mname = [
- '' => 1,
- '' => 2,
- '' => 3,
- '' => 4,
- '' => 5,
- '' => 6,
- '' => 7,
- ];
-
- /** (?)
- *
act:
- *
1 -
- *
2 -
- *
type_of:
- *
1 -
- *
2 -
- *
3 -
- *
4 -
- *
5 -
- * @var array[]
- */
- private $prm = [
- 1 => ['name' => '', 'act' => 1, 'type_of' => 5],
- 2 => ['name' => '', 'act' => 2, 'type_of' => 3],
- 4 => ['name' => ' ', 'act' => 2, 'type_of' => 3],
- 7 => ['name' => ' ', 'act' => 1, 'type_of' => 4],
-
- 290 => ['name' => ' ', 'act' => 1, 'type_of' => 4],
-
- //
- //291 => array( 'name' => ' ', 'act' => 2, 'type_of' => 4 ),
-
- //
- 294 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 295 => ['name' => '', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 296 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 297 => ['name' => '', 'act' => 2, 'type_of' => 0, 'moment' => 3],
- 298 => ['name' => ' ', 'act' => 2, 'type_of' => 3],
-
- 141 => ['name' => ' ', 'act' => 2, 'type_of' => 4],
- 147 => ['name' => ' ', 'act' => 2, 'type_of' => 4],
- 148 => ['name' => ' ', 'act' => 2, 'type_of' => 4],
- 149 => ['name' => ' ', 'act' => 2, 'type_of' => 4],
- 150 => ['name' => ' ', 'act' => 2, 'type_of' => 4],
-
- 142 => ['name' => ' ', 'act' => 2, 'type_of' => 4],
- 144 => ['name' => ' ', 'act' => 2, 'type_of' => 4],
- 146 => ['name' => ' ', 'act' => 2, 'type_of' => 4],
- 145 => ['name' => ' ', 'act' => 2, 'type_of' => 4],
-
- 8 => ['name' => ' ', 'act' => 1, 'type_of' => 1],
- 9 => ['name' => ' ', 'act' => 2, 'type_of' => 3],
- 10 => ['name' => '', 'act' => 1, 'type_of' => 1],
- 11 => ['name' => ' ', 'act' => 2, 'type_of' => 3],
-
- 45 => ['name' => ' ', 'act' => 1, 'type_of' => 4],
-
- 47 => ['name' => ' ', 'act' => 2, 'type_of' => 2],
- 48 => ['name' => ' ', 'act' => 1, 'type_of' => 1],
- 49 => ['name' => ' ', 'act' => 1, 'type_of' => 1],
- 138 => ['name' => ' ', 'act' => 2, 'type_of' => 3],
- 140 => ['name' => ' ', 'act' => 1, 'type_of' => 4],
- 193 => ['name' => ' ', 'act' => 2, 'type_of' => 3],
- 204 => ['name' => '', 'act' => 2, 'type_of' => 0, 'moment' => 3],
- 211 => ['name' => ' ', 'act' => 1, 'type_of' => 4],
- 213 => ['name' => ' ', 'act' => 1, 'type_of' => 4],
- 215 => ['name' => ' ', 'act' => 1, 'type_of' => 1],
- 216 => ['name' => ' ', 'act' => 2, 'type_of' => 2],
- 217 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 3],
- 219 => ['name' => ' ', 'act' => 2, 'type_of' => 3],
- 220 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 3],
- 222 => ['name' => ' ', 'act' => 2, 'type_of' => 3],
- 225 => ['name' => ' ', 'act' => 1, 'type_of' => 4],
- 226 => ['name' => '', 'act' => 1, 'type_of' => 4],
- 231 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 3],
- 234 => ['name' => '', 'act' => 2, 'type_of' => 4],
- 235 => ['name' => ' ', 'act' => 2, 'type_of' => 3],
- 342 => ['name' => ' ', 'act' => 0, 'type_of' => 0],
- 343 => ['name' => '', 'act' => 0, 'type_of' => 0],
-
- 237 => ['name' => ' ', 'act' => 2, 'type_of' => 3 /*, 'moment' => 3*/],
-
- 239 => ['name' => ' ', 'act' => 2, 'type_of' => 3],
- 240 => ['name' => ' ', 'act' => 2, 'type_of' => 5],
-
- //
- 21 => ['name' => ' [4]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 73 => ['name' => ' [5]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 74 => ['name' => ' [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 75 => ['name' => ' [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 76 => ['name' => ' [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 77 => ['name' => ' [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 78 => ['name' => ' [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 79 => ['name' => ' [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
-
- //
- 22 => ['name' => ' [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 80 => ['name' => ' [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 81 => ['name' => ' [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 82 => ['name' => ' [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 83 => ['name' => ' [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 84 => ['name' => ' [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
-
- //
- 36 => ['name' => ' [5]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 85 => ['name' => ' [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 86 => ['name' => ' [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 87 => ['name' => ' [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 88 => ['name' => ' [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 89 => ['name' => ' [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 90 => ['name' => ' [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
-
- //
- 23 => ['name' => ' [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 70 => ['name' => ' [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 71 => ['name' => ' [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 72 => ['name' => ' [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
-
- //
- 269 => ['name' => ' [8]', 'act' => 2, 'type_of' => 9],
- 276 => ['name' => ' [9]', 'act' => 2, 'type_of' => 9],
- 277 => ['name' => ' [10]', 'act' => 2, 'type_of' => 9],
-
- 270 => ['name' => ' ', 'act' => 2, 'type_of' => 5, 'type_sec' => 5],
- 280 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 281 => ['name' => ' ', 'act' => 2, 'type_of' => 5],
- 282 => ['name' => ' ', 'act' => 2, 'type_of' => 5],
-
- //
- 24 => ['name' => '', 'act' => 2, 'type_of' => 0, 'moment' => 3],
-
- //
- 210 => ['name' => ' [4]', 'act' => 2, 'type_of' => 8],
- 209 => ['name' => ' [7]', 'act' => 2, 'type_of' => 8],
- 208 => ['name' => ' [8]', 'act' => 2, 'type_of' => 8],
- 207 => ['name' => ' [9]', 'act' => 2, 'type_of' => 8],
- 206 => ['name' => ' [10]', 'act' => 2, 'type_of' => 8],
- 284 => ['name' => ' [11]', 'act' => 2, 'type_of' => 8],
-
- //
- 175 => ['name' => ' [7]', 'act' => 2, 'type_of' => 8],
- 176 => ['name' => ' [8]', 'act' => 2, 'type_of' => 8],
- 177 => ['name' => ' [9]', 'act' => 2, 'type_of' => 8],
- 178 => ['name' => ' [10]', 'act' => 2, 'type_of' => 8],
- 179 => ['name' => ' [11]', 'act' => 2, 'type_of' => 8],
-
- //
- 42 => ['name' => ' [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 121 => ['name' => ' [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 122 => ['name' => ' [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 123 => ['name' => ' [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 124 => ['name' => ' [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 125 => ['name' => ' [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
-
- 249 => ['name' => ' ', 'act' => 2, 'type_of' => 4],
- 248 => ['name' => ' ', 'act' => 2, 'type_of' => 4],
- 251 => ['name' => ': ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 252 => ['name' => ': ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
-
- //
- 273 => ['name' => ' [10]', 'act' => 1, 'type_of' => 4],
- 286 => ['name' => ' [9]', 'act' => 1, 'type_of' => 4],
- 287 => ['name' => ' [8]', 'act' => 1, 'type_of' => 4],
- 288 => ['name' => ' [7]', 'act' => 1, 'type_of' => 4],
-
- 255 => ['name' => ' ', 'act' => 2, 'type_of' => 8],
-
- ////
- 337 => ['name' => ' ', 'act' => 2, 'type_of' => 5],
-
- //
- 33 => ['name' => ' [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 56 => ['name' => ' [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 57 => ['name' => ' [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 58 => ['name' => ' [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 59 => ['name' => ' [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 60 => ['name' => ' [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
-
- //
- 245 => ['name' => ' ', 'act' => 2, 'type_of' => 9],
-
- ////
- 327 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 3],
- 328 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 329 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 330 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 331 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 332 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 333 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 3],
- 334 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 335 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3,],
-
- //1 ,
- 299 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 300 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 301 => ['name' => ' ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 302 => ['name' => '', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 303 => ['name' => ' ', 'act' => 2, 'type_of' => 4],
- 304 => ['name' => ' !', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- 305 => ['name' => '', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3],
- ];
-
- /**
- * @return void
- */
- private function saveLogs()
- {
- mysql_query('INSERT INTO `battle_logs_save` SELECT `id`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type` FROM `battle_logs` WHERE `battle` = ' . $this->info['id'] . ' AND `id_hod` <= ' . $this->hodID);
- mysql_query('DELETE FROM `battle_logs` WHERE `battle` = ' . $this->info['id'] . 'all');
- mysql_query('DELETE FROM `battle_stat` WHERE `battle` < ' . ($this->info['id'] - 100));
- mysql_query('DELETE FROM `battle_actions` WHERE `btl` = ' . $this->info['id']);
- }
-
- /** Priems
- * @param $uid
- * @param $hp
- * @param $false_t7
- * @return false|float
- */
- public function hphe($uid, $hp, $false_t7 = false)
- {
- if (!isset($this->stats[$this->uids[$uid]])) {
- echo 'WARNING! ! !';
- } else {
- $hpnow = floor($this->stats[$this->uids[$uid]]['hpNow']);
- $hpall = $this->stats[$this->uids[$uid]]['hpAll'];
- if ($hp > 0) {
- //
- if ($hpnow + $hp > $hpall) {
- $hpli = $hpnow + $hp - $hpall;
- $hp -= $hpli;
- }
- if (isset($this->stats[$this->uids[$uid]]['min_heal_proc']) && $this->stats[$this->uids[$uid]]['min_heal_proc'] < -99) {
- $hp = 0;
- } else {
- $hp = $hp / 100 * (100 + $this->stats[$this->uids[$uid]]['min_heal_proc']);
- }
- //
- if (!$false_t7) {
- if ($this->users[$this->uids[$uid]]['tactic7'] <= 0) {
- $hp = 0;
- $this->users[$this->uids[$uid]]['tactic7'] = 0;
- $this->stats[$this->uids[$uid]]['tactic7'] = $this->users[$this->uids[$uid]]['tactic7'];
- } else {
- $gdhh = round($hp / $this->stats[$this->uids[$uid]]['hpAll'] * 10, 2);
- if ($gdhh == 0) {
- $gdhh = 0.01;
- }
-
- $gdhd = round($this->users[$this->uids[$uid]]['tactic7'] / $gdhh * 100);
-
- $this->users[$this->uids[$uid]]['tactic7'] = round(($this->users[$this->uids[$uid]]['tactic7'] - $gdhh),
- 2);
- if ($this->users[$this->uids[$uid]]['tactic7'] < 0) {
- $this->users[$this->uids[$uid]]['tactic7'] = 0;
- }
- $this->stats[$this->uids[$uid]]['tactic7'] = $this->users[$this->uids[$uid]]['tactic7'];
- if ($gdhd < 100) {
- $hp = floor($hp / 100 * $gdhd);
- }
- }
- }
- } elseif ($hp < 0) {
- //
- if ($hpnow + $hp < 0) {
- $hpli = $hpnow + $hp;
- $hp += -($hpli);
- }
- }
-
- if ($this->stats[$this->uids[$uid]]['hpNow'] < 1) {
- $hp = 0;
- }
-
- $this->stats[$this->uids[$uid]]['last_hp'] = -$hp;
- mysql_query('UPDATE `stats` SET
- `last_hp` = ' . $this->users[$this->uids[$uid]]['last_hp'] . ',
- `tactic7` = ' . $this->users[$this->uids[$uid]]['tactic7'] . '
- WHERE `id` = ' . $uid);
- }
-
- return floor($hp);
- }
-
- public function deleffm($pid, $uid, $id)
- {
- if ($id > 0) {
- if (!mysql_query('DELETE FROM `eff_users` WHERE `id` = ' . $id . ' AND `v1` = "priem" AND `v2` != 0')) {
- echo '[* [' . $id . ',' . $pid . ',' . $uid . ']]';
- }
- } else {
- mysql_query('DELETE FROM `eff_users` WHERE `uid` = ' . $uid . ' AND `v1` = "priem" AND `v2` = ' . $pid);
- }
- }
-
- /**
- * @var int
- */
- private $na = 1;
-
- /** %
- * @var int
- */
- private $expCoef = 0;
-
- /**
- * @var int
- */
- private $aBexp = 0;
-
- /** uid
- * $ga[ {id } ][ {id } ]
- * @var array
- */
- private $ag = [];
-
- /** ID
- * @var array
- */
- private $bots = [];
-
- /** i ???
- * @var array
- */
- private $iBots = [];
-
- private $stnZbVs = 0;
- private $stnZb = [];
-
- /** (?) [?]
- * @var array
- */
- private $uAtc = [
- 'id' => 0,
- 'a' => [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0],
- 'b' => 0,
- ];
-
- /**
- * @var string[][]
- */
- private $lg_itm = [
- 0 => ['', ' ', '', '', '', ' ', ' ', ''],
- 1 => ['', ' ', ' ', ' '],
- 2 => [' ', '', ' ', '', ' '],
- 3 => ['', '', ' ', '', ' ', ' '],
- 4 => ['', '', '', ' ', ' ', ' ', ' ', ' ',],
- 5 => [' ', '', ' ', ' ', ' '],
- 22 => [''],
- ];
-
- /**
- * @var string[][]
- */
- private $lg_zon = [
- 1 => [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',],
- 2 => [' ', ' ', ' ', ' ', ' '],
- 3 => [' ', ' ', ' ', ' '],
- 4 => [' < >', ' ', ' ', ' ', ' '],
- 5 => [' ', ' ', ' ', ' ', ' '],
- ];
-
- /** ()
- * @var
- */
- public $e;
-
- /**
- * @var bool
- */
- public $cached = false;
-
- /** :
- *
1 - ,
- *
2 - ,
- *
3 - .
- * @var int
- */
- public $mainStatus = 1;
-
- /**
- * @var array
- */
- public $info = [];
-
- /**
- * @var array
- */
- public $users = [];
-
- /**
- * @var array
- */
- public $stats = [];
-
- /** id stats users.
- *
id = 555 , $uids[555] users \ stats
- * @var array
- */
- public $uids = [];
-
- /** ()
- * @var array
- */
- public $atacks = [];
-
- /** uid
- *
$ga[ {id } ][ {id } ]
- * @var array
- */
- public $ga = [];
- public $hodID = 0;
-
- public $is = [];
- public $items = [];
-
- private $uclearc = [];
- private $ucleari = [];
- private $user = [];
- /**
- * @param $uid
- * @return void
- */
- private function clear_cache($uid)
- {
- if ($uid > 0 && !isset($this->uclearc[$uid])) {
- $this->uclearc[$uid] = true;
- $this->ucleari[] = $uid;
- }
- }
-
- /**
- * @return void
- */
- public function clear_cache_start()
- {
- $q = 'delete from battle_cache where uid in (' . implode(', ', $this->ucleari) . ')';
- mysql_query($q);
- }
-
- //
-
- /** . Priems.
- *
.
- * @param $pid
- * @param $u1
- * @param $u2
- * @param $hp
- * @return mixed
- */
- public function testYronPriemAttack($pid, $u1, $u2, $hp)
- {
- // 1 2 pid hp .
- /* */
- //
-
- foreach ($this->stats[$this->uids[$u2]]['effects'] as $effect) {
- if (
- isset($effect) &&
- $effect['id_eff'] == 22 &&
- $effect['v1'] == 'priem' &&
- in_array($effect['v2'], [45, 140, 211])
- ) {
- // = 1 , 0
- $hp['y'] = -1;
- $hp['r'] = 1;
- $hp['k'] = 2;
- $hp['m_y'] = 1;
- $hp['m_k'] = 2;
- }
- }
- return $hp;
- }
-
- /**
- * @param $y
- * @param $s1
- * @param $s2
- * @param $id1
- * @param $id2
- * @return float|int
- */
- private function testExp($y, $s1, $s2, $id1, $id2)
- {
- global $c;
- //
- $oplevel = [ // .
- 0 => 1,
- 1 => 1,
- 2 => 1,
- 3 => 1,
- 4 => 2,
- 5 => 2,
- 6 => 2,
- 7 => 2,
- 8 => 3,
- 9 => 4,
- 10 => 5,
- 11 => 6,
- 12 => 7,
- 13 => 50,
- 14 => 75,
- ];
-
- if ($y < 0) {
- $y = 0;
- }
- if ($s2['hpNow'] < 0) {
- $y = 0;
- }
- if ($s2['hpNow'] < $y) {
- $y = $s2['hpNow'];
- }
- if ($y < 0) {
- $y = 0;
- }
- $addExp = (int)($y * $oplevel[$this->users[$this->uids[$s2['id']]]['level']]);
- if ($s2['hpAll'] - $y <= 0) {
- $addExp = 100;
- }
-
- if ($addExp < 0) {
- $addExp = 0;
- }
- if ($s2['levels'] != 'undefined' && $this->users[$this->uids[$s2['id']]]['pass'] != 'saintlucia') {
- if ($this->info['razdel'] != 5 && $c['exp_limit_many']) {
- $texp = mysql_fetch_array(mysql_query('SELECT COUNT(`a`.`id`) FROM `battle_users` AS `a` WHERE `a`.`uid` = ' . $id1 . ' AND `a`.`battle` IN ( SELECT `b`.`battle` FROM `battle_users` AS `b` WHERE `b`.`uid` = ' . $id2 . ' AND `b`.`team` != `a`.`team` AND `b`.`time` > ' . (time() - 86400) . ' ) LIMIT 1'));
- $texp = $texp[0];
- //
- if ($texp > 5) {
- $addExp = $addExp * 0.00;
- } elseif ($texp > 4) {
- $addExp = $addExp * 0.50;
- } elseif ($texp > 3) {
- $addExp = $addExp * 0.75;
- } elseif ($texp > 2) {
- $addExp = $addExp * 1.00;
- } elseif ($texp > 1) {
- $addExp = $addExp * 1.00;
- } else {
- $addExp = $addExp * 1.00;
- }
- }
- } else {
- $addExp = 0;
- }
-
- return $addExp;
- }
-
- /** \
- * @param $id
- * @param $y
- * @param $id1
- * @param $id2
- * @param $mgregen
- * @return void
- */
- public function takeExp($id, $y, $id1, $id2, $mgregen = false)
- {
- global $u;
- if (isset($this->users[$this->uids[$id]])) {
- $s1 = $this->stats[$this->uids[$id1]];
- $s2 = $this->stats[$this->uids[$id2]];
- if ($id1 != $id2) {
- $e = $this->testExp($y, $s1, $s2, $id1, $id2);
- } else {
- $e = 0;
- }
-
- if (
- (int)$this->users[$this->uids[$id1]]['bot_id'] == 0 &&
- $this->users[$this->uids[$id1]]['dnow'] != 0 &&
- $this->info['dungeon'] != 1
- ) {
- $dun_limitForLevel = [ // .
- 4 => 750,
- 5 => 1500,
- 6 => 3500,
- 7 => 8000,
- 8 => 25000,
- 9 => 50000,
- 10 => 75000,
- 11 => 125000,
- 12 => 250000,
- 13 => 500000,
- 14 => 750000,
- ];
- $dun_expFactor = [ // .
- 4 => 5,
- 5 => 5,
- 6 => 5,
- 7 => 5,
- 8 => 5,
- 9 => 3,
- 10 => 1,
- 11 => 1,
- 12 => 1,
- 13 => 1,
- 14 => 1,
- ];
-
- if (isset($dun_expFactor[(int)$this->users[$this->uids[$id1]]['level']])) {
- $e = $e * $dun_expFactor[(int)$this->users[$this->uids[$id1]]['level']];
- }
- if ($this->info['dungeon'] > 1 && $this->users[$this->uids[$id1]]['battle'] > 0) { //
- $dun_exp = []; // .
- $rep = mysql_fetch_array(mysql_query('SELECT `dungeonexp`,`id` FROM `rep` WHERE `id` = ' . $this->users[$this->uids[$id1]]['id']));
- $rep = explode(',', $rep['dungeonexp']);
- foreach ($rep as $key => $val) {
- $val = explode('=', $val);
- if (isset($val[0]) && isset($val[1]) && $val[0] != '' && $val[1] != 0) {
- $dun_exp[(int)$val[0]] = (int)$val[1];
- } //
- }
- unset($rep);
-
- if (!isset($dun_exp[$this->info['dungeon']])) {
- $dun_exp[$this->info['dungeon']] = 0;
- }
- if (!isset($dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']])) { // , .
- $e = 0;
- } elseif (
- isset($dun_exp[$this->info['dungeon']]) &&
- $dun_exp[$this->info['dungeon']] >= $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']]
- ) { // , .
- $e = 0;
- } elseif (
- isset($dun_exp[$this->info['dungeon']]) &&
- $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] > $dun_exp[$this->info['dungeon']]
- ) { // .
- if (($dun_exp[$this->info['dungeon']] + $e) > $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']]) {
- // , .
- $e = abs($e - abs($dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] - ($e + $dun_exp[$this->info['dungeon']])));
- $dun_exp[$this->info['dungeon']] += $e;
- } elseif ($dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] > ($dun_exp[$this->info['dungeon']] + $e)) {
- // , .
- $dun_exp[$this->info['dungeon']] += $e;
- } else {
- $e = 0;
- }
- } else { // .
- $e = 0;
- }
- } else // .
- {
- if ($this->info['dungeon'] == 102) {
- $e = floor($e * 0.002);
- }
- }
- }
-
- $this->users[$this->uids[$id1]]['battle_exp'] += floor($e);
- //
- if (!$mgregen) {
- $this->users[$this->uids[$id1]]['battle_yron'] += floor($y);
- if ($this->stats[$this->uids[$id1]]['notactic'] != 1) {
- if ($s2['hpAll'] <= 1000) {
- if ($this->stats[$this->uids[$id2]]['this_animal'] == 0) {
- $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / $s2['hpAll'] * 100),
- 10);
- } else {
- $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / $s2['hpAll'] * 100),
- 10) / 3;
- }
- } else {
- if ($this->stats[$this->uids[$id2]]['this_animal'] == 0) {
- $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / 1000 * 100), 10);
- } else {
- $this->users[$this->uids[$id1]]['tactic6'] += round(0.1 * (floor($y) / 1000 * 100), 10) / 3;
- }
- }
- }
- }
-
- $upd = mysql_query('UPDATE `stats` SET `last_hp` = ' . $this->users[$this->uids[$id1]]['last_hp'] . ',`tactic6` = ' . $this->users[$this->uids[$id1]]['tactic6'] . ',`battle_yron` = ' . $this->users[$this->uids[$id1]]['battle_yron'] . ',`battle_exp` = ' . $this->users[$this->uids[$id1]]['battle_exp'] . ' WHERE `id` = ' . (int)$id1);
- if (!$upd) {
- echo '[ ]';
- } else {
- $this->stats[$this->uids[$id1]]['battle_exp'] = $this->users[$this->uids[$id1]]['battle_exp'];
- $this->clear_cache($id1);
- $this->stats[$this->uids[$id1]]['tactic6'] = $this->users[$this->uids[$id1]]['tactic6'];
- if ($id1 == $u->info['id']) {
- $u->info['tactic6'] = $this->users[$this->uids[$id1]]['tactic6'];
- $u->stats['tactic6'] = $this->users[$this->uids[$id1]]['tactic6'];
- $u->info['battle_exp'] = $this->users[$this->uids[$id1]]['battle_exp'];
- $u->info['battle_yron'] = $this->users[$this->uids[$id1]]['battle_yron'];
- $u->info['notactic'] = $this->users[$this->uids[$id1]]['notactic'];
- $u->stats['notactic'] = $this->users[$this->uids[$id1]]['notactic'];
- }
- }
- unset($s1, $s2);
- }
- }
-
- /** .
- * @param $uid
- * @param $y
- * @return void
- * @todo Priems.
- */
- public function takeYronNow($uid, $y)
- {
- global $u;
- $this->users[$this->uids[$uid]]['battle_yron'] += floor($y);
- $this->stats[$this->uids[$uid]]['battle_yron'] += floor($y);
- if ($uid == $u->info['id']) {
- $u->info['battle_yron'] += floor($y);
- $u->stats['battle_yron'] += floor($y);
- }
- mysql_query('UPDATE `stats` SET `battle_yron` = `battle_yron` + ' . mysql_real_escape_string(floor($y)) . ' WHERE `id` = ' . (int)$uid);
- }
-
- /** JS . , _battles..
- * @param $id
- * @param $t
- * @return false|string
- */
- public function myInfo($id, $t)
- {
- global $u;
- if (isset($this->users[$this->uids[$id]]) || $u->info['id'] == $id) {
- if ($u->info['id'] == $id || ($u->info['enemy'] == $id && $id > 0)) {
- //
- $this->users[$this->uids[$id]] = mysql_fetch_array(mysql_query('SELECT
-
- `u`.`zag`,`u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,
- `u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money2`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`,
- `u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`,
- `u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`activ`,`u`.`stopexp`,`u`.`real`,
-
- `st`.*
-
- FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = "' . $id . '" LIMIT 1'));
- $this->stats[$this->uids[$id]] = $u->getStats($this->users[$this->uids[$id]], 0, 0, false, false, true);
- }
-
- $ur = $this->users[$this->uids[$id]];
- $st = $this->stats[$this->uids[$id]];
- $itm = $this->stats[$this->uids[$id]]['items'];
- $eff = $this->stats[$this->uids[$id]]['effects'];
- $ef = '';
- $i = 0;
- if ($u->info['seff'] < 1) {
- $ef .= '
\',event,3,1,1,1,\'\');\" onmouseout=\"top.hic();\" onmousedown=\"top.hic();\">
';
-
- while ($i != -1) {
- $nseef = 0;
- if ($this->users[$this->uids[$ur['id']]]['id'] != $u->info['id'] && $ur['id'] != 0) {
- if ($this->stats[$this->uids[$ur['id']]]['seeAllEff'] != 1) {
- $nseef = 1;
- if ($eff[$i]['v1'] == 'priem') {
- $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1'));
- }
- if (isset($eff[$i]['priem']['id']) && $eff[$i]['priem']['neg'] == 1) {
- $nseef = 0;
- }
- }
- }
-
- if (isset($eff[$i]) && $eff[$i] != 'delete') {
- if ($nseef == 0) {
- $ei = '
' . $eff[$i]['name'] . ' ';
- if ($eff[$i]['x'] > 1) {
- $ei .= ' x' . $eff[$i]['x'] . ' ';
- }
- if ($eff[$i]['type1'] > 0 && $eff[$i]['type1'] < 7) {
- $ei .= ' ()';
- } elseif (($eff[$i]['type1'] > 6 && $eff[$i]['type1'] < 11) || $eff[$i]['type1'] == 16) {
- $ei .= ' ()';
- } elseif ($eff[$i]['type1'] == 14) {
- $ei .= ' ()';
- } elseif ($eff[$i]['type1'] == 15) {
- $ei .= ' ()';
- } elseif ($eff[$i]['type1'] == 17) {
- $ei .= ' ()';
- } elseif ($eff[$i]['type1'] == 18 || $eff[$i]['type1'] == 19) {
- $ei .= ' ()';
- } elseif ($eff[$i]['type1'] == 20) {
- $ei .= ' ()';
- } elseif ($eff[$i]['type1'] == 22) {
- $ei .= ' ()';
- } else {
- $ei .= ' ()';
- }
- $ei .= '
';
-
- $out = '';
- $time_still = ($eff[$i]['timeUse'] + ($eff[$i]['timeAce'] - $eff[$i]['timeUse']) + $eff[$i]['actionTime']);
- if ($eff[$i]['timeAce'] == 0) {
- $time_still += $eff[$i]['timeUse'];
- }
- $time_still -= time();
- if ($eff[$i]['bp'] == 0 && $eff[$i]['timeUse'] != 77) {
- if ($eff[$i]['type1'] != 13) {
- $ei .= ': ' . $u->timeOut($time_still);
- }
- } else {
- if ($eff[$i]['timeUse'] != 77 && $eff[$i]['hod'] < 1) {
- $ei .= ': ' . $u->timeOut($time_still);
- } elseif ($eff[$i]['hod'] >= 0) {
- $ei .= ': ' . $eff[$i]['hod'];
- }
- }
-
- if ($eff[$i]['user_use'] != '') {
- if ($this->users[$this->uids[$eff[$i]['user_use']]]['login2'] != '') {
- $ei .= '
:
' . $this->users[$this->uids[$eff[$i]['user_use']]]['login2'] . ' ';
- } elseif ($this->users[$this->uids[$eff[$i]['user_use']]]['login'] != '') {
- $ei .= '
:
' . $this->users[$this->uids[$eff[$i]['user_use']]]['login'] . ' ';
- }
- }
-
- //
- $tr = '';
- $ti = $u->items['add'];
- $x = 0;
- $ed = $this->lookStats($eff[$i]['data']);
- while ($x < count($ti)) {
- $n = $ti[$x];
- if (isset($ed['add_' . $n], $u->is[$n]) && $n != 'pog') {
- $z = '';
- if ($ed['add_' . $n] > 0) {
- $z = '+';
- }
- $tr .= '
' . $u->is[$n] . ': ' . $z . $ed['add_' . $n];
- }
- $x++;
- }
-
- if ($ed['add_mib1'] != 0) {
- if ($ed['add_mab1'] != 0) {
- $tr .= '
: ' . $ed['add_mib1'] . '-' . $ed['add_mab1'];
- } else {
- $m1l = $ed['add_mib1'];
- if ($m1l > 0) {
- $m1l = '+' . $m1l;
- }
- $tr .= '
: ' . $m1l;
- }
- }
- if ($ed['add_mib2'] != 0) {
- if ($ed['add_mab2'] != 0) {
- $tr .= '
: ' . $ed['add_mib2'] . '-' . $ed['add_mab2'];
- } else {
- $m1l = $ed['add_mib2'];
- if ($m1l > 0) {
- $m1l = '+' . $m1l;
- }
- $tr .= '
: ' . $m1l;
- }
- }
- if ($ed['add_mib3'] != 0) {
- if ($ed['add_mab3'] != 0) {
- $tr .= '
: ' . $ed['add_mib3'] . '-' . $ed['add_mab3'];
- } else {
- $m1l = $ed['add_mib3'];
- if ($m1l > 0) {
- $m1l = '+' . $m1l;
- }
- $tr .= '
: ' . $m1l;
- }
- }
- if ($ed['add_mib4'] != 0) {
- if ($ed['add_mab4'] != 0) {
- $tr .= '
: ' . $ed['add_mib4'] . '-' . $ed['add_mab4'];
- } else {
- $m1l = $ed['add_mib4'];
- if ($m1l > 0) {
- $m1l = '+' . $m1l;
- }
- $tr .= '
: ' . $m1l;
- }
- }
-
- $efix = 0;
- if (isset($ed['add_pog2']) && $ed['add_pog2'] > 0) {
- $efix = $ed['add_pog2'];
- }
- if (isset($ed['add_pog'])) {
- $tr .= '
' . $ed['add_pog'] . ' . ';
- }
- if (isset($ed['add_pog2'])) {
- $tr .= '
' . $ed['add_pog2'] . ' .
(' . $ed['add_pog2p'] . '%) ';
- }
-
- if ($tr != '') {
- $ei .= $tr;
- }
- if ($eff[$i]['info'] != '') {
- $ei .= '
: ' . $eff[$i]['info'];
- }
-
- $ef .= '
';
- unset($efix);
- }
- } elseif ($eff[$i] != 'delete') {
- $i = -2;
- }
- $i++;
- }
- } else {
- $ef .= '
\',event,3,1,1,1,\'\');\" onmouseout=\"top.hic();\" onmousedown=\"top.hic();\">
';
- }
-
- $ca = '';
- if ($ur['clan'] > 0) {
- $cl = mysql_fetch_array(mysql_query('SELECT * FROM `clan` WHERE `id` = ' . $ur['clan']));
- if (isset($cl['id'])) {
- $ca = '
';
- }
- }
- if ($ur['align'] > 0) {
- $ca = '
' . $ca;
- }
- if ($ur['login2'] == '') {
- $ur['login2'] = $ur['login'];
- }
- if (floor($st['hpNow']) > $st['hpAll']) {
- $st['hpNow'] = $st['hpAll'];
- }
- if (floor($st['mpNow']) > $st['mpAll']) {
- $st['mpNow'] = $st['mpAll'];
- }
- $stsua = '
' . $ur['login2'] . ' ';
- $stsua .= '
: ' . $st['s1'];
- $stsua .= '
: ' . $st['s2'];
- $stsua .= '
: ' . $st['s3'];
- $stsua .= '
: ' . $st['s4'];
- if ($st['s5'] != 0) {
- $stsua .= '
: ' . $st['s5'];
- }
- if ($st['s6'] != 0) {
- $stsua .= '
: ' . $st['s6'];
- }
- if ($st['s7'] != 0) {
- $stsua .= '
: ' . $st['s7'];
- }
- if ($u->info['admin'] > 0) {
- $align = $ur['align'];
- }
- $tp_img = [
- 1 => 4,
- 2 => 5,
- 14 => 6,
- 3 => 7,
- 5 => 8,
- 7 => 9,
- 17 => 10,
- 16 => 11,
- 13 => 12,
- 10 => 13,
- 9 => 14,
- 8 => 15,
- 11 => 17, // 2
- 12 => 18 // 3
- ];
- $info = 'info_reflesh(' . $t . ',' . $ur['id'] . ',"' . $ca . '
' . $ur['login2'] . ' [' . $ur['level'] . ']
","' . $ur['obraz'] . '",' . floor($st['hpNow']) . ',' . floor($st['hpAll']) . ',' . floor($st['mpNow']) . ',' . floor($st['mpAll']) . ',0,' . $ur['sex'] . ',"' . $ef . '","' . $stsua . '", "' . $align . '", "' . $ur['zag'] . '");shpb();';
- $i = 0;
- while ($i < count($itm)) {
- //
- if (isset($st['items_img'][$tp_img[$itm[$i]['inOdet']]])) {
- $itm[$i]['img'] = $st['items_img'][$tp_img[$itm[$i]['inOdet']]];
- }
- //
- $ttl = '
' . $itm[$i]['name'] . ' ';
- $td = $this->lookStats($itm[$i]['data']);
- $lvar = '';
- if ($td['add_hpAll'] > 0) {
- $td['add_hpAll'] = '+' . $td['add_hpAll'];
- $lvar .= '
: ' . $td['add_hpAll'];
- }
- if ($td['sv_yron_max'] > 0 || $td['sv_yron_min'] > 0) {
- $lvar .= '
: ' . (0 + $td['sv_yron_min']) . '-' . (0 + $td['sv_yron_max']);
- }
- if ($td['add_mab1'] > 0) {
- if ($td['add_mib1'] == $td['add_mab1'] && $pl['geniration'] == 1) {
- $m1l = '+';
- $lvar .= '
: ' . $m1l . (0 + $td['add_mab1']);
- } else {
- $lvar .= '
: ' . (0 + $td['add_mib1']) . '-' . (0 + $td['add_mab1']);
- }
- }
- if ($td['add_mab2'] > 0) {
- if ($td['add_mib2'] == $td['add_mab2'] && $pl['geniration'] == 1) {
- $m1l = '+';
- $lvar .= '
: ' . $m1l . (0 + $td['add_mab2']);
- } else {
- $lvar .= '
: ' . (0 + $td['add_mib2']) . '-' . (0 + $td['add_mab2']);
- }
- }
- if ($td['add_mab3'] > 0) {
- if ($td['add_mib3'] == $td['add_mab3'] && $pl['geniration'] == 1) {
- $m1l = '+';
- $lvar .= '
: ' . $m1l . (0 + $td['add_mab3']);
- } else {
- $lvar .= '
: ' . (0 + $td['add_mib3']) . '-' . (0 + $td['add_mab3']);
- }
- }
- if ($td['add_mab4'] > 0) {
- if ($td['add_mib4'] == $td['add_mab4'] && $pl['geniration'] == 1) {
- $m1l = '+';
- $lvar .= '
: ' . $m1l . (0 + $td['add_mab4']);
- } else {
- $lvar .= '
: ' . (0 + $td['add_mib4']) . '-' . (0 + $td['add_mab4']);
- }
- }
- if ($itm[$i]['iznosMAX'] > 0) {
- if ($itm[$i]['iznosMAXi'] == 999999999) {
- $lvar .= '
:
';
- } else {
- $lvar .= '
: ' . floor($itm[$i]['iznosNOW']) . '/' . floor($itm[$i]['iznosMAX']);
- }
- }
- $ttl .= $lvar;
- $ccv = '';
-
- if ($itm[$i]['magic_inci'] != '' || $itm[$i]['magic_inc'] != '') {
- if ($itm[$i]['magic_inc'] == '') {
- $itm[$i]['magic_inc'] = $itm[$i]['magic_inci'];
- }
- $temp01 = mysql_query('SELECT * FROM `eff_main` WHERE `id2` = ' . $itm[$i]['magic_inc'] . ' AND `type1` = 12345 LIMIT 1');
- if ($temp01) {
- $mgi = mysql_fetch_array($temp01);
- if (isset($mgi['id2'])) {
- $ccv .= 'top.useMagicBattle(\'' . $mgi['mname'] . '\',' . $itm[$i]['id'] . ',\'' . $mgi['img'] . '\',1,2);';
- }
- }
- }
-
- $info .= 'abitms(' . (0 + $t) . ',' . (0 + $itm[$i]['uid']) . ',' . (0 + $itm[$i]['id']) . ',' . (0 + $itm[$i]['inOdet']) . ',"' . $itm[$i]['name'] . '","' . $ttl . '","' . $itm[$i]['img'] . '","' . $ccv . '");';
- $i++;
- }
-
- return $info;
- } else {
- return false;
- }
- }
-
- //
- public function testUsersLive()
- {
- $tl = 0;
- for ($i = 0; $i < count($this->uids); $i++) {
- if ($this->stats[$i]['id'] <= 0) {
- continue;
- }
- if (isset($tml[$this->users[$i]['team']]) || floor($this->stats[$i]['hpNow']) < 1) {
- continue;
- }
- $tml[$this->users[$i]['team']] = 1;
- $tl++;
- if ($tl > 1) {
- break;
- }
- }
- return $tl > 1;
- }
-
- //
- private function miniLogAdd(array $user, $text)
- {
- $time = time();
- $vLog = 'at1=00000||at2=00000||zb1=0||zb2=0||bl1=0||bl2=0||time1=' . $time .
- '||time2=' . $time .
- '||s1=' . $user['sex'] .
- '||t1=' . $user['team'] .
- '||login1=' . $user['login'] .
- '||';
- $mas1 = [
- 'time' => $time,
- 'battle' => $this->info['id'],
- 'id_hod' => ($this->hodID + 1),
- 'text' => $text,
- 'vars' => $vLog,
- 'zona1' => '',
- 'zonb1' => '',
- 'zona2' => '',
- 'zonb2' => '',
- 'type' => '1',
- ];
-
- $this->add_log($mas1);
- }
-
- /** .
- *
[ ]: .
- * @return void
- */
- public function testFinish()
- {
- global $u;
- //
- mysql_query('START TRANSACTION;');
- //
- $test = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `team_win` = -1 LIMIT 1 FOR UPDATE'));
- //
- mysql_query('COMMIT;');
- //
- if ($this->info['team_win'] == -1 && isset($test['id'])) {
- $hp = [];
- $tml = [];
- $tmv = [];
- $tl = 0;
- $i = 0;
- $j = 0;
- while ($i < count($this->uids)) {
- if ($this->stats[$i]['id'] > 0) {
- if (floor($this->stats[$i]['hpNow']) < 1) {
- $this->stats[$i]['hpNow'] = 0;
- }
- $hp[$this->users[$i]['team']] += floor($this->stats[$i]['hpNow']);
- if (!isset($tml[$this->users[$i]['team']]) && floor($this->stats[$i]['hpNow']) >= 1) {
- $tml[$this->users[$i]['team']] = 1;
- $tmv[$j] = $this->users[$i]['team'];
- $tl++;
- }
- }
- $i++;
- }
-
- if ($tl <= 1) {
- //.
- $tmHpNow = [];
- $tmNow = [];
- $sp = mysql_query('SELECT `u`.`login`,`u`.`id`,`u`.`battle`,`s`.`team`,`s`.`hpNow` FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `u`.`battle` = "' . $this->info['id'] . '"');
- while ($pl = mysql_fetch_array($sp)) {
- if (!isset($tmHpNow[$pl['team']])) {
- $tmHpNow[$pl['team']] = 0;
- $tmNow[] = $pl['team'];
- }
- $hpTm = floor($pl['hpNow']);
- if ($hpTm < 0) {
- $hpTm = 0;
- }
- if ($hpTm > 0) {
- $tmHpNow[$pl['team']] += $pl['hpNow'];
- }
- }
- $gdj = 0;
- $i = 0;
- while ($i < count($tmNow)) {
- if (isset($tmNow[$i])) {
- $j = $tmNow[$i];
- if ($tmHpNow[$j] > 0) {
- $gdj++;
- }
- }
- $i++;
- }
- if ($gdj > 1) {
- $tl = $gdj;
- echo ' ... ( )';
- }
- }
-
- if ($tl <= 1) {
- // , - ,
-
- $i = 0;
- $tmwin = 0;
- while ($i < count($tmv)) {
- if ($tmv[$i] >= 1 && $tml[$tmv[$i]] > 0) {
- $tmwin = $tmv[$i];
- }
- $i++;
- }
-
- if ($this->info['izlom'] == 0) {
- $rs = '';
- $ts = [];
- $tsi = 0;
- if ($this->info['id'] > 0) {
- //
- unset($this->users, $this->stats, $this->uids, $this->bots, $this->iBots);
- $trl = mysql_query('SELECT `u`.`no_ip`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`money3`,`u`.`money2`,`u`.`bot_id` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $this->info['id'] . '" ORDER BY `st`.`bot` DESC');
- $ir = 0;
- $bi = 0;
- $this->users = null;
- $this->stats = null;
- $this->uids = null;
- $this->bots = null;
- $this->iBots = null;
- while ($pl = mysql_fetch_array($trl)) {
- //
- if ($pl['login2'] == '') {
- $pl['login2'] = $pl['login'];
- }
- $this->users[$ir] = $pl;
- $this->uids[$pl['id']] = $ir;
- if ($pl['bot'] > 0) {
- $this->bots[$bi] = $pl['id'];
- $this->iBots[$pl['id']] = $bi;
- $bi++;
- }
- //
- $this->stats[$ir] = $u->getStats($pl, 0, 0, false, false, true);
- $ir++;
- }
- }
- } elseif (!isset($this->uids[$u->info['id']])) {
- $rs = '';
- $ts = [];
- $tsi = 0;
- if ($this->info['id'] > 0) {
- //
- $trl = mysql_query('SELECT `u`.`no_ip`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`bot_id`,`u`.`money3`,`u`.`money2` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = "' . $this->info['id'] . '" LIMIT 1');
- $pl = mysql_fetch_array($trl);
- //
- if ($pl['login2'] == '') {
- $pl['login2'] = $pl['login'];
- }
- $this->users[] = $pl;
- $this->uids[$pl['id']] = $ir;
- if ($pl['bot'] > 0) {
- $this->bots[] = $pl['id'];
- $this->iBots[$pl['id']] = $bi;
- }
- //
- $this->stats[] = $u->getStats($pl, 0, 0, false, false, true);
- }
- }
-
-
- if ($this->info['izlom'] > 0 && $tmwin == 1) {
- //
- $i = 0;
- $dlt = '';
- $dlt2 = '';
- $sp = mysql_query('SELECT `users`.`id`,`stats`.`bot`,`stats`.`team` FROM `users`,`stats` WHERE `users`.`battle` = "' . $this->info['id'] . '" AND `stats`.`id` = `users`.`id` LIMIT 250');
- while ($pl = mysql_fetch_array($sp)) {
- if ($pl['bot'] == 1 && $pl['team'] != $u->info['team']) {
- $dlt .= ' `id`="' . $pl['id'] . '" OR';
- $dlt2 .= ' `uid`="' . $pl['id'] . '" OR';
- $i++;
- }
- }
-
- if ($i > 0) {
- $dlt = trim($dlt, 'OR');
- $dlt2 = trim($dlt2, 'OR');
- mysql_query('DELETE FROM `users` WHERE ' . $dlt . ' LIMIT ' . $i);
- mysql_query('DELETE FROM `stats` WHERE ' . $dlt . ' LIMIT ' . $i);
- mysql_query('DELETE FROM `items_users` WHERE ' . $dlt2 . ' LIMIT ' . ($i * 100));
- mysql_query('DELETE FROM `eff_users` WHERE ' . $dlt2 . ' LIMIT ' . ($i * 100));
- }
-
- unset($i, $dlt, $dlt2);
-
- $j = 0;
- $k = 0;
- $obr = 0;
-
- // ,
- if ($this->get_chanse(20)) {
- //
- if ($this->info['izlomLvl'] == 8) {
- $bots = [
- ' ',
- ' ',
- '',
- ' ',
- ' ',
- ];
- //$bots = array( ' ' );
- }
- $logins_bot = [];
- //
- echo '
...
';
- //
- $id2 = rand(0, (count($bots) - 1));
- $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1'));
- $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null,
- round($this->info['izlomRoundSee']));
- if (isset($id['id']) && $bot) {
- //
- $btxt = '';
- if ($id['align'] > 0) {
- $btxt = $btxt . '
';
- }
- if ($id['clan'] > 0) {
- $btxt = $btxt . '
';
- }
- $btxt = $btxt . '
{u1} [' . $id['level'] . ']
';
- if ($id['sex'] == 1) {
- $btxt = $btxt . ' .';
- } else {
- $btxt = $btxt . ' .';
- }
- $this->miniLogAdd([
- 'login' => $id['login'],
- 'sex' => $id['sex'],
- 'team' => 0,
- ], '{tm1} ' . $btxt);
- //
- $logins_bot = $bot['logins_bot'];
- mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
- mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
- $u->addAction(time(), 'win_bot_' . $id['id'], '', $this->users[$i]['id']);
- if (rand(0, 10000) < 1500) {
- $obr++;
- }
- $j++;
- }
- } else {
- //
- if ($this->info['izlomLvl'] == 8) {
- $bots = [
- '',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
- ];
- }
- $logins_bot = [];
- //
- $id2 = rand(0, (count($bots) - 1));
- $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1'));
- $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null,
- ($this->info['izlomRoundSee'] * 2));
- if (isset($id['id']) && $bot) {
- //
- $btxt = '';
- if ($id['align'] > 0) {
- $btxt = $btxt . '
';
- }
- if ($id['clan'] > 0) {
- $btxt = $btxt . '
';
- }
- $btxt = $btxt . '
{u1} [' . $id['level'] . ']
';
- if ($id['sex'] == 1) {
- $btxt = $btxt . ' .';
- } else {
- $btxt = $btxt . ' .';
- }
- $this->miniLogAdd([
- 'login' => $id['login'],
- 'sex' => $id['sex'],
- 'team' => 0,
- ], '{tm1} ' . $btxt);
- //
- $logins_bot = $bot['logins_bot'];
- mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
- mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
- if (rand(0, 10000) < 1500) {
- $obr++;
- }
- $j++;
- }
- //
- $id2 = rand(0, (count($bots) - 1));
- $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1'));
- $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null, $this->info['izlomRoundSee']);
- if (isset($id['id']) && $bot) {
- //
- $btxt = '';
- if ($id['align'] > 0) {
- $btxt = $btxt . '
';
- }
- if ($id['clan'] > 0) {
- $btxt = $btxt . '
';
- }
- $btxt = $btxt . '
{u1} [' . $id['level'] . ']
';
- if ($id['sex'] == 1) {
- $btxt = $btxt . ' .';
- } else {
- $btxt = $btxt . ' .';
- }
- $this->miniLogAdd([
- 'login' => $id['login'],
- 'sex' => $id['sex'],
- 'team' => 0,
- ], '{tm1} ' . $btxt);
- //
- $logins_bot = $bot['logins_bot'];
- mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
- mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
- if (rand(0, 10000) < 1500) {
- $obr++;
- }
- $j++;
- }
- //
- if (rand(0, 100) < 70) {
- $id2 = rand(0, (count($bots) - 1));
- $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1'));
- $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null,
- $this->info['izlomRoundSee']);
- if (isset($id['id']) && $bot) {
- //
- $btxt = '';
- if ($id['align'] > 0) {
- $btxt = $btxt . '
';
- }
- if ($id['clan'] > 0) {
- $btxt = $btxt . '
';
- }
- $btxt = $btxt . '
{u1} [' . $id['level'] . ']
';
- if ($id['sex'] == 1) {
- $btxt = $btxt . ' .';
- } else {
- $btxt = $btxt . ' .';
- }
- $this->miniLogAdd([
- 'login' => $id['login'],
- 'sex' => $id['sex'],
- 'team' => 0,
- ], '{tm1} ' . $btxt);
- //
- $logins_bot = $bot['logins_bot'];
- mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
- mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
- if (rand(0, 10000) < 1500) {
- $obr++;
- }
- $j++;
- }
- }
- // 10 = +1
- $irb = floor($this->info['izlomRoundSee'] / 10);
- while ($irb > 0) {
- //
- if (rand(0, 100) < 20) {
- $id2 = rand(0, (count($bots) - 1));
- $id = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "' . $bots[$id2] . '" AND `level` <= "' . $u->info['level'] . '" AND `pishera` != "" AND `active` = "1" ORDER BY `level` DESC LIMIT 1'));
- $bot = $u->addNewbot($id['id'], null, null, $logins_bot, null,
- $this->info['izlomRoundSee']);
- if (isset($id['id']) && $bot) {
- //
- $btxt = '';
- if ($id['align'] > 0) {
- $btxt = $btxt . '
';
- }
- if ($id['clan'] > 0) {
- $btxt = $btxt . '
';
- }
- $btxt = $btxt . '
{u1} [' . $id['level'] . ']
';
- if ($id['sex'] == 1) {
- $btxt = $btxt . ' .';
- } else {
- $btxt = $btxt . ' .';
- }
- $this->miniLogAdd([
- 'login' => $id['login'],
- 'sex' => $id['sex'],
- 'team' => 0,
- ], '{tm1} ' . $btxt);
- //
- $logins_bot = $bot['logins_bot'];
- mysql_query('UPDATE `users` SET `battle`="' . $this->info['id'] . '" WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
- mysql_query('UPDATE `stats` SET `team`="2" WHERE `id` = "' . $bot['id'] . '" LIMIT 1');
- if (rand(0, 10000) < 1500) {
- $obr++;
- }
- $j++;
- }
- }
- $irb--;
- }
- }
- //
- unset($logins_bot);
- if ($j == 0) {
- //
- $this->finishBattle($tml, $tmv, null, $tl);
- $fin1 = mysql_query('INSERT INTO `izlom_rating` (`uid`,`time`,`voln`,`level`,`bots`,`rep`,`obr`,`btl`) VALUES ("' . $u->info['id'] . '","' . time() . '","' . $this->info['izlomRoundSee'] . '","' . $this->info['izlomLvl'] . '","0","0","' . ($this->info['izlomObr'] - $this->info['izlomObrNow']) . '","' . $this->info['id'] . '")');
- } else {
- $this->info['izlomRound'] = $iz['round'];
- mysql_query('UPDATE `battle` SET `izlomObrNow` = ' . $obr . ',`izlomObr` = `izlomObr` + ' . $obr . ',`timeout` = (`timeout`+5),`izlomRound` = "' . ($this->info['izlomRound'] + 1) . '",`izlomRoundSee` = `izlomRoundSee`+1 WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
- $this->stats[$this->uids[$u->info['id']]]['hpNow'] += $this->stats[$this->uids[$u->info['id']]]['hpAll'] * 0.25;
- $this->stats[$this->uids[$u->info['id']]]['mpNow'] += $this->stats[$this->uids[$u->info['id']]]['mpAll'] * 0.25;
- $this->users[$this->uids[$u->info['id']]]['hpNow'] = $this->stats[$this->uids[$u->info['id']]]['hpAll'];
- $this->users[$this->uids[$u->info['id']]]['mpNow'] = $this->stats[$this->uids[$u->info['id']]]['mpAll'];
- $vLog = 'at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] . '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] . '||bl1=' . $this->atacks[$id]['b' . $a] . '||bl2=' . $this->atacks[$id]['b' . $b] . '||time1=' . $this->atacks[$id]['time'] . '||time2=' . $this->atacks[$id]['time2'] . '||s2=' . $this->users[$this->uids[$u2]]['sex'] . '||s1=' . $this->users[$this->uids[$u1]]['sex'] . '||t2=' . $this->users[$this->uids[$u2]]['team'] . '||t1=' . $this->users[$this->uids[$u1]]['team'] . '||login1=' . $this->users[$this->uids[$u1]]['login2'] . '||login2=' . $this->users[$this->uids[$u2]]['login2'] . '';
-
- $mas = [
- 'time' => time(),
- 'battle' => $this->info['id'],
- 'id_hod' => ($this->hodID + 1),
- 'vars' => $vLog,
- 'type' => 1,
- ];
- if ($u->info['sex'] == 1) {
- $mas['text'] = '
' . date('H:i') . ' ' . $u->info['login'] . ' "
".';
- } else {
- $mas['text'] = '
' . date('H:i') . ' ' . $u->info['login'] . ' "
".';
- }
- if ($u->stats['hpNow'] < $u->stats['hpAll']) {
- $hpSks = floor(($u->stats['hpAll'] * ((rand(15, 25)) / 100)));
- if ($hpSks > floor($u->stats['hpAll'] - $u->stats['hpNow'])) {
- $hpSks = floor($u->stats['hpAll'] - $u->stats['hpNow']);
- }
- $mas['text'] .= '
+' . $hpSks . ' ';
- } else {
- $hpSks = 0;
- $mas['text'] .= '
-- ';
- }
- $mas['text'] .= ' [' . floor($u->info['hpNow'] + $hpSks) . '/' . $u->stats['hpAll'] . ']';
- $this->add_log($mas);
-
- mysql_query('UPDATE `stats` SET `hpNow` = "' . ($u->info['hpNow'] + ($u->stats['hpAll'] * ((rand(15,
- 25)) / 100))) . '",`mpNow` = "' . ($u->info['mpNow'] + ($u->stats['mpAll'] * 0.25)) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
- }
- } else {
- //
- $this->finishBattle($tml, $tmv, null, $tl);
- if ($this->info['izlom'] > 0) {
- $fin1 = mysql_query('INSERT INTO `izlom_rating` (`uid`,`time`,`voln`,`level`,`bots`,`rep`,`obr`,`btl`) VALUES ("' . $u->info['id'] . '","' . time() . '","' . $this->info['izlomRoundSee'] . '","' . $this->info['izlomLvl'] . '","0","0","' . ($this->info['izlomObr'] - $this->info['izlomObrNow']) . '","' . $this->info['id'] . '")');
- }
- }
- if (isset($fin1)) {
- mysql_query('INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","31","23","' . $u->info['id'] . '"," ","nofastfinisheff=1","' . time() . '")');
- mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $u->info['city'] . "','" . $u->info['room'] . "','','" . $u->info['login'] . "',' ""x" . (($this->info['izlomObr'] - $this->info['izlomObrNow']) * 7) . "','" . time() . "','6','0')");
- $i01 = 1;
- while ($i01 <= (($this->info['izlomObr'] - $this->info['izlomObrNow'])) * 7) {
- $u->addItem(1226, $u->info['id'], '|sudba=' . $u->info['login']);
- $i01++;
- }
- mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $u->info['id'] . '","' . time() . '","capitalcity","' . $u->info['room'] . '","izlom"," ","","")');
- unset($fin1);
- }
- }
- } else {
- mysql_query('START TRANSACTION;');
- $test = mysql_fetch_array(mysql_query('SELECT `id`,`team_win`, `testfinish` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `team_win` != -1 LIMIT 1 FOR UPDATE'));
- mysql_query('COMMIT;');
- if (isset($test['id'])) {
- $this->finishBattle(null, null, 10, $tl);
- }
- }
- }
-
-
- /** .
- *
! Ѩ!
- *
.
- * @param $t ???
- * @param $v ???
- * @param $nl ???
- * @param $tl [unused] ???
- * @return void
- */
- private function finishBattle($t, $v, $nl, $tl)
- {
- global $u, $c;
- mysql_query('LOCK TABLES users,stats,battle,battle_last,battle_end,chat WRITE');
- $frtu = false;
- $test = mysql_fetch_array(mysql_query('SELECT `id`,`team_win`,`testfinish` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `team_win` != -1 LIMIT 1;'));
- if ($test['testfinish'] != -1) {
- $trtt = mysql_query('UPDATE `battle` SET `testfinish` = "-1" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
- $relbf = $this->info['team_win'];
- if ($nl != 10) {
- $i = 0;
- $dnr = 0;
- if ($this->info['team_win'] == -1) {
- $this->info['team_win'] = 0;
- while ($i < count($v)) {
- if ($v[$i] >= 1 && $t[$v[$i]] > 0) {
- $this->info['team_win'] = $v[$i];
- }
- $i++;
- }
- }
- }
-
-
- //
- $t = mysql_query('SELECT `u`.`stopexp`,`u`.`twink`,`u`.`city`,`u`.`room`,`u`.`no_ip`,`u`.`pass`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`bot_id`,`u`.`money3`,`u`.`money2` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $this->info['id'] . '"');
- $i = 0;
- $bi = 0;
- while ($pl = mysql_fetch_array($t)) {
- //
- if ($pl['login2'] == '') {
- $pl['login2'] = $pl['login'];
- }
- $this->users[$i] = $pl;
- $this->uids[$pl['id']] = $i;
- if ($pl['bot'] > 0) {
- $this->bots[$bi] = $pl['id'];
- $this->iBots[$pl['id']] = $bi;
- $bi++;
- }
- //
- $this->stats[$i] = $u->getStats($pl, 0, 0, false, false, true);
- $i++;
- }
- unset($pl, $t);
-
- if ($this->info['time_over'] == 0) {
- $tststrt = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `time_over` = "0" LIMIT 1'));
- if (isset($tststrt['id'])) {
- if ($this->info['inTurnir'] == 0 || $this->info['type'] == 500) {
- mysql_query('UPDATE `battle` SET `time_over` = "' . time() . '",`team_win` = "' . $this->info['team_win'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
- }
- mysql_query('UPDATE `battle_stat` SET `team_win` = "' . $this->info['team_win'] . '" WHERE `battle_id` = "' . $this->info['id'] . '"');
- //
- $i = 0;
- $vl = '';
- $vtvl = '';
- $relu = 0;
- while ($i < count($this->users)) {
- $vl .= '("' . $this->users[$i]['login'] . '","' . $this->users[$i]['city'] . '","' . $this->info['id'] . '","' . $this->users[$i]['id'] . '","' . time() . '","' . $this->users[$i]['team'] . '","' . $this->users[$i]['level'] . '","' . $this->users[$i]['align'] . '","' . $this->users[$i]['clan'] . '","' . $this->users[$i]['exp'] . '","' . $this->users[$i]['bot'] . '","' . $this->users[$i]['money'] . '","' . $this->users[$i]['money2'] . '","' . $this->users[$i]['money3'] . '"),';
- if ($this->users[$i]['team'] == $this->info['team_win'] && $this->info['team_win'] > 0) {
- $vtvl .= '
' . $this->users[$i]['login'] . ' , ';
- }
- $i++;
- }
-
- $this->info['players_c'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `users` WHERE `login` NOT LIKE "%(%" AND `battle` = "' . $this->info['id'] . '" LIMIT 1'));
- $this->info['players_c'] = $this->info['players_c'][0];
-
- mysql_query('UPDATE `battle` SET `players_c` = "' . $this->info['players_c'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-
- if ($vtvl != '') {
- $vtvl = rtrim($vtvl, ', ');
- $vtvl = str_replace('"', '\\\\\"', $vtvl);
- $this->hodID++;
- $vLog = 'time1=' . time();
- $mass = [
- 'time' => time(),
- 'battle' => $this->info['id'],
- 'id_hod' => $this->hodID,
- 'text' => 'test',
- 'vars' => $vLog,
- 'zona1' => '',
- 'zonb1' => '',
- 'zona2' => '',
- 'zonb2' => '',
- 'type' => '1',
- ];
- $vtvl = ' , ' . $vtvl . '.';
- } else {
- $this->info['players_cc'] = mysql_fetch_array(mysql_query('SELECT COUNT(`u`.`id`) FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `s`.`hpNow` > 0 AND `u`.`battle` = "' . $this->info['id'] . '" AND `s`.`team` != "' . $u->info['team'] . '" LIMIT 1'));
- $this->info['players_cc'] = $this->info['players_cc'][0];
- $this->info['players_cc2'] = mysql_fetch_array(mysql_query('SELECT COUNT(`u`.`id`) FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `s`.`hpNow` >= 1 AND `u`.`battle` = "' . $this->info['id'] . '" AND `s`.`team` != "' . $u->info['team'] . '" LIMIT 1'));
- $this->info['players_cc2'] = $this->info['players_cc2'][0];
- $inf_test = ', users: ' . $this->info['players_cc'] . ' and ' . $this->info['players_cc2'] . '';
- $this->hodID++;
- $vLog = 'time1=' . time();
- $mass = [
- 'time' => time(),
- 'battle' => $this->info['id'],
- 'id_hod' => $this->hodID,
- 'text' => 'test',
- 'vars' => $vLog,
- 'zona1' => '',
- 'zonb1' => '',
- 'zona2' => '',
- 'zonb2' => '',
- 'type' => '1',
- ];
- $vtvl = ' , .';
- }
- $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")');
-
- $this->saveLogs();
-
- if ($this->info['type'] == 99) {
- $vLog = 'time1=' . time();
- $mass = [
- 'time' => time(),
- 'battle' => $this->info['id'],
- 'id_hod' => $this->hodID,
- 'text' => 'test',
- 'vars' => $vLog,
- 'zona1' => '',
- 'zonb1' => '',
- 'zona2' => '',
- 'zonb2' => '',
- 'type' => '1',
- ];
- $vtvl = ' ...';
- $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")');
- $i = 0;
- $vtvl = '';
- $tr_nm = [
- 1 => '',
- 2 => '',
- 3 => '',
- 4 => '',
- ];
- while ($i < count($this->users)) {
- if ($this->users[$i]['team'] != $this->info['team_win']) {
- $tr_pl = mysql_fetch_array(mysql_query('SELECT `id`,`v1` FROM `eff_users` WHERE `id_eff` = 4 AND `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = "0" ORDER BY `v1` DESC LIMIT 1'));
- if (!isset($tr_pl['id']) || $tr_pl['v1'] < 3) {
- if ($this->info['smert'] == 1) {
- $tr_tp = 4;
- } else {
- $tr_tp = rand(1, 3);
- }
- if (isset($tr_pl['id'])) {
- $tr_tp = rand(($tr_pl['v1'] + 1), 3);
- }
- if ($this->users[$i]['sex'] == 1) {
- $vtvl = '
' . $this->users[$i]['login'] . ' :
' . $tr_nm[$tr_tp] . ' .
' . $vtvl;
- } else {
- $vtvl = '
' . $this->users[$i]['login'] . ' :
' . $tr_nm[$tr_tp] . ' .
' . $vtvl;
- }
- $this->addTravm($this->users[$i]['id'], $tr_tp, rand(3, 5));
- }
- }
- $i++;
- }
- $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")');
- }
-
- if ($vl != '') {
- $vl = rtrim($vl, ',');
- mysql_query('INSERT INTO `battle_last` (`login`,`city`,`battle_id`,`uid`,`time`,`team`,`lvl`,`align`,`clan`,`exp`,`bot`,`money`,`money2`,`money3`) VALUES ' . $vl . '');
- }
- mysql_query('INSERT INTO `battle_end` (`battle_id`,`city`,`time`,`team_win`) VALUES ("' . $this->info['id'] . '","' . $this->info['city'] . '","' . $this->info['time_start'] . '","' . $this->info['team_win'] . '")');
- }
-
-
- $vLog = 'time1=' . time();
- $mass = [
- 'time' => time(),
- 'battle' => $this->info['id'],
- 'id_hod' => $this->hodID,
- 'text' => 'test',
- 'vars' => $vLog,
- 'zona1' => '',
- 'zonb1' => '',
- 'zona2' => '',
- 'zonb2' => '',
- 'type' => '1',
- ];
- $i = 0;
- $vtvl = '';
- $tr_nm = [
- 1 => '',
- 2 => '',
- 3 => '',
- 4 => '',
- ];
- while ($i < count($this->users)) {
- if ($this->users[$i]['team'] != $this->info['team_win'] && $this->info['team_win'] > 0) {
- $tr_pl = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `v1` = "priem" AND `v2` = 292 AND `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = "0" LIMIT 1'));
-
- $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl2 . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")');
-
- if (isset($tr_pl['id'])) {
- if (rand(0, 100) < $tr_pl['data']) {
- $tr_tp = rand(($tr_pl['v1'] + 1), 3);
- if ($this->users[$i]['sex'] == 1) {
- $vtvl = '
' . $this->users[$i]['login'] . ' (, :
' . $this->users[$this->uids[$tr_pl['user_use']]]['login'] . ' ):
' . $tr_nm[$tr_tp] . ' .
' . $vtvl;
- } else {
- $vtvl = '
' . $this->users[$i]['login'] . ' (, :
' . $this->users[$this->uids[$tr_pl['user_use']]]['login'] . ' ):
' . $tr_nm[$tr_tp] . ' .
' . $vtvl;
- }
- $this->addTravm($this->users[$i]['id'], $tr_tp, rand(3, 5));
- }
- }
- }
- $i++;
- }
- if ($vtvl != '') {
- if ($this->info['type'] != 99) {
- $vtvl2 = ' ...';
- $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl2 . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")');
- }
- $ins = mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $vtvl . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")');
- }
-
- //
- if ($this->info['inTurnir'] > 0 && $this->info['dungeon'] != 15 && $u->info['room'] != 413) {
- $bs = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "' . $this->info['inTurnir'] . '" LIMIT 1'));
- $i = 0;
- $j = 0;
- while ($i < count($this->users)) {
- if ($this->stats[$i]['hpNow'] < 1 && $this->users[$i]['clone'] == 0 && $this->stats[$i]['clone'] == 0) {
- //
- if ($this->users[$i]['sex'] == 0) {
- $text .= '{u1} ';
- } else {
- $text .= '{u1} ';
- }
- //
- $spik = mysql_query('SELECT `id`,`item_id` FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `delete` ="0"');
- while ($plik = mysql_fetch_array($spik)) {
- /*
- -1
- */
- mysql_query('INSERT INTO `dungeon_items` (`dn`,`item_id`,`time`,`x`,`y`) VALUES (
- "' . $this->users[$i]['dnow'] . '","' . $plik['item_id'] . '","' . (time() - 600) . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '"
- )');
- }
- unset($spik, $plik);
- //
- $usrreal = '';
- $usr_real = mysql_fetch_array(mysql_query('SELECT `id`,`login`,`align`,`clan`,`battle`,`level` FROM `users` WHERE `login` = "' . $this->users[$i]['login'] . '" AND `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1'));
- if (!isset($usr_real['id'])) {
- $usr_real = $this->users[$i];
- }
- if (isset($usr_real['id'])) {
- if ($usr_real['align'] > 0) {
- $usrreal .= '
';
- }
- if ($usr_real['clan'] > 0) {
- $usrreal .= '
';
- }
- $usrreal .= '
' . $usr_real['login'] . ' [' . $usr_real['level'] . ']
';
- } else {
- $mereal = '
[??]';
- }
- $text = str_replace('{u1}', $usrreal, $text);
- mysql_query('INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES (
- "1", "' . mysql_real_escape_string($text) . '", "' . time() . '", "' . $bs['id'] . '", "' . $bs['count'] . '", "' . $bs['city'] . '",
- "' . round($bs['money'] * 0.85, 2) . '","' . $i . '"
- )');
- //
- //
- mysql_query('DELETE FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- mysql_query('DELETE FROM `stats` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- mysql_query('DELETE FROM `actions` WHERE `uid` = "' . $this->users[$i]['id'] . '"');
- mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '"');
- mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '"');
- mysql_query('DELETE FROM `users_delo` WHERE `uid` = "' . $this->users[$i]['id'] . '"');
- //
- mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `login` = "' . $this->users[$i]['login'] . '" OR `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- //
- mysql_query('UPDATE `bs_zv` SET `off` = "' . time() . '" WHERE `inBot` = "' . $this->users[$i]['id'] . '" AND `off` = "0" LIMIT 1');
- unset($text, $usrreal, $usr_real);
- if ($this->users[$i]['pass'] != 'bstowerbot') {
- $bs['users']--;
- $bs['users_finish']++;
- } else {
- $bs['arhiv']--;
- }
- $j++;
- }
- $i++;
- }
- if ($j > 0) {
- mysql_query('UPDATE `bs_turnirs` SET `arhiv` = "' . $bs['arhiv'] . '",`users` = "' . $bs['users'] . '",`users_finish` = "' . $bs['users_finish'] . '" WHERE `id` = "' . $bs['id'] . '" LIMIT 1');
- }
-
- unset($bs, $j);
- }
-
- //
- if ($this->info['type'] == 500 && isset($tststrt['id'])) {
- //
-
- $i = 0;
- while ($i < count($this->users)) {
- if ($this->users[$i]['no_ip'] == 'trupojor') {
- $mon = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_monsters` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 1'));
- if (isset($mon['id'])) {
- if ($this->info['team_win'] == 0) {
- //
- mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->stats[$i]['hpAll'] . '",`mpNow` = "' . $this->stats[$i]['mpAll'] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("
! ' . mysql_real_escape_string(str_replace('{b}',
- '
' . $this->users[$i]['login'] . ' [' . $this->users[$i]['level'] . ']
users[$i]['id'] . ' > ',
- $mon['nich_text'])) . ' ","' . $this->users[$i]['city'] . '","","6","1","' . time() . '")');
- } elseif ($this->info['team_win'] != $this->users[$i]['team']) {
- //
- $j = 0;
- $usrwin = '';
- while ($j < count($this->users)) {
- if ($this->users[$j]['no_ip'] != 'trupojor' && $this->users[$j]['bot'] == 0) {
- if ($this->stats[$j]['hpNow'] > 0) {
- $usrwin .= ', ';
- if ($this->users[$j]['align'] > 0) {
- $usrwin .= '
users[$j]['align'] . '.gif >';
- }
- if ($this->users[$j]['clan'] > 0) {
- $usrwin .= '
users[$j]['clan'] . '.gif >';
- }
- $usrwin .= '
' . $this->users[$j]['login'] . ' [' . $this->users[$j]['level'] . ']
users[$j]['id'] . ' > ';
- }
- }
- $j++;
- }
- if ($usrwin != '') {
- $usrwin = ltrim($usrwin, ', ');
- } else {
- $usrwin = '
';
- }
-
-
- mysql_query('UPDATE `users` SET `room` = "303" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
-
- $truptimelast = time() + rand(1800, 3600);
-
- mysql_query('UPDATE `stats` SET `res_x` = "' . $truptimelast . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("
! ' . mysql_real_escape_string(str_replace('{b}',
- '
' . $this->users[$i]['login'] . ' [' . $this->users[$i]['level'] . ']
users[$i]['id'] . ' > ',
- str_replace('{u}', $usrwin,
- $mon['win_text']))) . ' ","' . $this->users[$i]['city'] . '","","6","1","' . time() . '")');
- unset($usrwin);
- } else {
- //
- if ($mon['win_back'] == 1) {
- mysql_query('UPDATE `users` SET `room` = "303" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- }
- mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->stats[$i]['hpAll'] . '",`mpNow` = "' . $this->stats[$i]['mpAll'] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- mysql_query('INSERT INTO `chat` (`text`,`city`,`to`,`type`,`new`,`time`) VALUES ("
! ' . mysql_real_escape_string(str_replace('{b}',
- '
' . $this->users[$i]['login'] . ' [' . $this->users[$i]['level'] . ']
users[$i]['id'] . ' > ',
- $mon['lose_text'])) . ' ","' . $this->users[$i]['city'] . '","","6","1","' . time() . '")');
- }
- }
- }
- $i++;
- }
- }
- }
-
- //
- $i = 0;
- $botsi = 0;
- if (isset($tststrt['id'])) {
- while ($i < count($this->users)) {
- //
- if ($this->info['type'] == 33) {
- $plde = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'));
- if (isset($plde['mail']) && $plde['mail'] == "haot@new-combats.com") {
- $pld = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1'));
-
- if (isset($pld['id'])) {
- if ($this->users[$i]['battle_yron'] >= 500) {
- $u->addItem(4754, $pld['id'], '');
- $u->addItem(4754, $pld['id'], '');
- $u->addItem(4754, $pld['id'], '');
- $u->addItem(4754, $pld['id'], '');
- $u->addItem(4754, $pld['id'], '');
- $pld['battle_text'] .= '
(x5) . ';
- mysql_query('UPDATE `users_achiv` SET `pg`= `pg`+1 WHERE `id` = "' . $pld['id'] . '" LIMIT 1');
-
- if ($this->users[$i]['team'] == $this->info['team_win']) {
- if (rand(1, 100) <= 5) {
- $u->addItem(10020, $pld['id'], '');
- $pld['battle_text'] .= '
. ';
- }
- }
- } else {
- $pld['battle_text'] .= ' .
500 .';
- }
-
- mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $pld['city'] . "','" . $pld['room'] . "','','" . $pld['login'] . "','" . $pld['battle_text'] . "','-1','6','0')");
- mysql_query('DELETE FROM `stats` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100');
- mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100');
- mysql_query('UPDATE `users` SET `inUser` = "0" WHERE `inUser` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- mysql_query('DELETE FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- }
- }
-
- unset ($plde, $pld);
- }
-
- if ($this->users[$i]['bot'] == 1) {
- $botsi++;
- mysql_query('DELETE FROM `users` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- mysql_query('DELETE FROM `stats` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- mysql_query('DELETE FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100');
- mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100');
- } elseif ($this->users[$i]['bot'] == 2) {
- $this->users[$i]['battle'] = 0;
- mysql_query('UPDATE `users` SET `battle` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "0",`exp` = `exp` + `battle_exp`,`battle_exp` = "0",`battle_yron` = "0",`enemy` = "0", `timeGo` = "' . time() . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- //mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "0",`exp` = `exp` + `battle_exp`,`battle_exp` = "0",`timeGo` = "'.time().'" WHERE `id` = "'.$this->users[$i]['id'].'" LIMIT 1');
- mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100');
- } elseif ($this->users[$i]['bot'] > 0) {
- $this->users[$i]['battle'] = 0;
- mysql_query('UPDATE `users` SET `battle` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- mysql_query('UPDATE `stats` SET `zv` = "0",`team` = "0",`exp` = `exp` + `battle_exp`,`battle_exp` = "0",`battle_yron` = "0",`enemy` = "0", `timeGo` = "' . time() . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- mysql_query('DELETE FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" LIMIT 100');
- }
- if ($this->users[$i]['clone'] > 0 && $this->users[$i]['bot'] > 0 && isset($this->users[$this->uids[$this->users[$i]['clone']]]['id']) && $this->users[$this->uids[$this->users[$i]['clone']]]['team'] != $this->users[$i]['team']) {
- //
- if ($this->users[$this->uids[$this->users[$i]['clone']]]['team'] == $this->info['team_win']) {
- $u->addAction(time(), 'win_bot_clone', '', $this->users[$i]['clone']);
- } elseif ($this->info['team_win'] == 0) {
- $u->addAction(time(), 'nich_bot_clone', '', $this->users[$i]['clone']);
- } else {
- $u->addAction(time(), 'lose_bot_clone', '', $this->users[$i]['clone']);
- }
- } elseif ($this->users[$i]['bot'] > 0 && $this->users[$i]['bot_id'] > 0) {
- //
- $j = 0;
- while ($j < count($this->users)) {
- if ($this->users[$j]['bot'] == 0 && $this->users[$j]['team'] != $this->users[$i]['team']) {
- if ($this->users[$j]['team'] == $this->info['team_win']) {
- $u->addAction(time(), 'win_bot_' . $this->users[$i]['bot_id'], '',
- $this->users[$j]['id']);
- //
- mysql_query('UPDATE `dialog_act` SET `now` = `now` + 1 WHERE `uid` = "' . $this->users[$j]['id'] . '" AND
- ( `btl_bot` LIKE "' . $this->users[$i]['bot_id'] . '!%" OR `btl_bot` LIKE "%!' . $this->users[$i]['bot_id'] . '!%" )
- AND `val` != 1
- LIMIT 1');
- //
- } elseif ($this->info['team_win'] == 0) {
- $u->addAction(time(), 'nich_bot_' . $this->users[$i]['bot_id'], '',
- $this->users[$j]['id']);
- } else {
- $u->addAction(time(), 'lose_bot_' . $this->users[$i]['bot_id'], '',
- $this->users[$j]['id']);
- }
- }
- $j++;
- }
- }
- $i++;
- }
- }
-
- $botss = [];
-
- if ($nl != 10) {
- //
- if ($this->info['dungeon'] > 0) {
- if ($this->info['team_win'] == $u->info['team'] && $this->info['dungeon'] == 102) {
- $j1 = mysql_fetch_array(mysql_query('SELECT * FROM `laba_obj` WHERE `type` = 2 AND `lib` = "' . $this->info['dn_id'] . '" AND `x` = "' . $this->info['x'] . '" AND `y` = "' . $this->info['y'] . '" LIMIT 1'));
- if (isset($j1['id'])) {
- mysql_query('DELETE FROM `laba_obj` WHERE `id` = "' . $j1['id'] . '" LIMIT 1');
- //
- mysql_query('INSERT INTO `laba_obj` (`use`,`lib`,`time`,`type`,`x`,`y`,`vars`) VALUES (
- "0","' . $j1['lib'] . '","' . time() . '","6","' . $j1['x'] . '","' . $j1['y'] . '","' . (0 + $botsi) . '"
- )');
- }
- } elseif ($this->info['team_win'] == $u->info['team']) {
- // ,
- $j1 = mysql_query('SELECT * FROM `dungeon_bots` WHERE `dn` = "' . $this->info['dn_id'] . '" AND `for_dn` = "0" AND `x` = "' . $this->info['x'] . '" AND `delete` = "0" AND `y`= "' . $this->info['y'] . '" LIMIT 100');
- while ($tbot = mysql_fetch_array($j1)) {
- $j2 = 0;
- while ($j2 < $tbot['colvo']) {
- if (isset($tbot['id2'])) {
- $tbot2 = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "' . $tbot['id_bot'] . '" LIMIT 1'));
- $itms = explode('|', $tbot2['p_items']);
- $tii = 0;
- $testdrop = 0;
- while ($tii < count($itms) && $testdrop == 0) {
- $itmz = explode('=', $itms[$tii]);
- if ($itmz[0] > 0) {
- if (isset($itmz[2]) && $itmz[2] != '') {
- $questDrop = mysql_fetch_array(mysql_query('SELECT * FROM `actions` WHERE `vars` LIKE "%' . $itmz[2] . '%" AND `vals` = "go" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'));
- }
- if (isset($questDrop['id'])) { // ,
- } elseif (isset($itmz[2]) && $itmz[2] != '') {
- $itmz[1] = 0;
- } // , , 0
- unset($questDrop);
-
- //
- if ($itmz[1] * 100000 >= rand(1, 10000000)) {
- $tou = 0; //
- /* */
- $itmnm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itmz[0] . '" LIMIT 1'));
- $itmnm = $itmnm['name'];
-
- $rtxt = '
' . $tbot2['login'] . ' "' . $itmnm . '" ';
- mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[0]['city'] . "','" . $this->users[0]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')");
-
- $ins = mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES (
- "' . $this->info['dn_id'] . '",
- "' . $tou . '",
- "' . $itmz[0] . '",
- "' . time() . '",
- "' . $this->info['x'] . '",
- "' . $this->info['y'] . '")');
- if (!isset($questDrop['id'])) {
- $testdrop = 1; // drop-drop //quest
- }
- }
- }
- $tii++;
- }
- }
- $j2++;
- }
- //
- // 1-15 ,
- if (date('m') == 9 && date('d') < 15) {
- if ($this->get_chanse(99)) {
- //
- } elseif ($this->info['dungeon'] == 12 || $this->info['dungeon'] == 101) {
- $tou = 0; //
- /* */
- $itmz = [
- rand(4745, 4751),
- 100,
- ];
- //
- $itmnm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itmz[0] . '" LIMIT 1'));
- $itmnm = $itmnm['name'];
-
- $rtxt = '
' . $tbot2['login'] . ' "' . $itmnm . '" ';
- mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[0]['city'] . "','" . $this->users[0]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')");
-
- $ins = mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES (
- "' . $this->info['dn_id'] . '",
- "' . $tou . '",
- "' . $itmz[0] . '",
- "' . time() . '",
- "' . $this->info['x'] . '",
- "' . $this->info['y'] . '")');
- }
- }
- //
- // ,
-
- if (rand(1, 100) <= 99) {
- //
- } elseif ($this->info['dungeon'] == 12 || $this->info['dungeon'] == 3 ||
- $this->info['dungeon'] == 101 || $this->info['dungeon'] == 16 ||
- $this->info['dungeon'] == 9 || $this->info['dungeon'] == 10 ||
- $this->info['dungeon'] == 13 || $this->info['dungeon'] == 106) {
- $tou = 0; //
- //
- $itmz = rand(3143, 3192);
- //
- $itmnm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "' . $itmz . '" LIMIT 1'));
- $itmnm = $itmnm['name'];
-
- $rtxt = '
' . $tbot2['login'] . ' "' . $itmnm . '" ';
- mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[0]['city'] . "','" . $this->users[0]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')");
-
- $ins = mysql_query('INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES (
- "' . $this->info['dn_id'] . '",
- "' . $tou . '",
- "' . $itmz . '",
- "' . time() . '",
- "' . $this->info['x'] . '",
- "' . $this->info['y'] . '")');
- }
- }
- mysql_query('UPDATE `dungeon_bots` SET `delete` = "' . time() . '" AND `inBattle` = "' . $this->info['id'] . '" WHERE `dn` = "' . $this->info['dn_id'] . '" AND `for_dn` = "0" AND `delete` = "0" ');
- } else {
- // RESTART
- $dnr = 1;
- if ($this->info['dungeon'] != 102) {
- mysql_query('UPDATE `dungeon_bots` SET `inBattle` = "0" WHERE `dn` = "' . $this->info['dn_id'] . '" AND `for_dn` = "0" AND `x` = "' . $this->info['x'] . '" AND `y`= "' . $this->info['y'] . '"');
- }
- }
- }
- }
- $gm = [];
- $gms = [];
- $bm = [];
- $bms = [];
-
- //
- //
- //
- $i = $this->uids[$u->info['id']];
-
- if ($this->info['team_win'] >= 0) {
- if ($this->stats[$i]['pbe'] > 0) {
- //
- $this->expCoef += $this->stats[$i]['pbe'];
- }
-
- if (
- $this->info['razdel'] == 5 &&
- (($c['m'] >= 6 && $c['m'] <= 8) || ($c['w'] == 0 || $c['w'] == 6))
- ) {
- //
- $this->expCoef += 5;
- }
-
- $this->stats[$i]['exp'] += $this->expCoef;
-
- $this->stats[$i]['exp'] += $this->aBexp * $c['exp'];
-
- if ($this->stats[$i]['os4'] > 0) {
- $this->stats[$i]['exp'] += $this->stats[$i]['os4'];
- }
-
- $act01 = 0;
- $this->users[$i]['battle_exp'] = round($this->users[$i]['battle_exp'] + ($this->users[$i]['battle_exp'] / 100 * (1 + $this->info['addExp'] + $this->stats[$i]['exp'])));
-
- if ($this->info['type'] == 564) {
- //
- $this->users[$i]['battle_exp'] = 0;
- }
-
- if ($this->info['dungeon'] == 104) {
- $this->users[$i]['battle_exp'] = ($u->info['level'] * 2) * (count($this->uids) - 1);
- } elseif ($this->info['dungeon'] > 0 && $this->users[$i]['dnow'] != 0 && $this->info['dungeon'] != 1 && $this->users[$i]['team'] == $this->info['team_win']) {
- $dun_limitForLevel = [
- 4 => 750,
- 5 => 1500,
- 6 => 3500,
- 7 => 8000,
- 8 => 25000,
- 9 => 50000,
- 10 => 75000,
- 11 => 100000,
- 12 => 100000,
- 13 => 100000,
- 14 => 100000,
- ];
- // .
-
- if ($this->users[$i]['battle_exp'] > 0) {
- $dun_exp = []; // .
- $rep = mysql_fetch_array(mysql_query('SELECT `dungeonexp`,`id` FROM `rep` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'));
- $rep = explode(',', $rep['dungeonexp']);
- foreach ($rep as $key => $val) {
- $val = explode('=', $val); //
- if (isset($val[0]) && isset($val[1]) && $val[0] != '' && $val[1] != 0) {
- $dun_exp[(int)$val[0]] = (int)$val[1];
- }
- }
- unset($rep);
- }
-
- if (!isset($dun_exp[$this->info['dungeon']])) {
- $dun_exp[$this->info['dungeon']] = 0;
- }
-
- if (!isset($dun_limitForLevel[(int)$this->users[$i]['level']])) { // , .
- $this->users[$i]['battle_exp'] = 0;
- } elseif (
- isset($dun_exp[$this->info['dungeon']]) &&
- $dun_exp[$this->info['dungeon']] >= $dun_limitForLevel[(int)$this->users[$i]['level']]
- ) { // , .
- $this->users[$i]['battle_exp'] = 0;
- } elseif (
- isset($dun_exp[$this->info['dungeon']]) &&
- $dun_limitForLevel[(int)$this->users[$i]['level']] > $dun_exp[$this->info['dungeon']]
- ) { // .
- if (($dun_exp[$this->info['dungeon']] + $this->users[$i]['battle_exp']) > $dun_limitForLevel[(int)$this->users[$i]['level']]) {
- // , .
- $this->users[$i]['battle_exp'] = abs($this->users[$i]['battle_exp'] - abs($dun_limitForLevel[(int)$this->users[$i]['level']] - ($this->users[$i]['battle_exp'] + $dun_exp[$this->info['dungeon']])));
- $dun_exp[$this->info['dungeon']] += $this->users[$i]['battle_exp'];
- } elseif ($dun_limitForLevel[(int)$this->users[$i]['level']] > ($dun_exp[$this->info['dungeon']] + $this->users[$i]['battle_exp'])) {
- // , .
- $dun_exp[$this->info['dungeon']] += $this->users[$i]['battle_exp'];
- } else {
- $this->users[$i]['battle_exp'] = 0;
- }
- } else { // .
- $this->users[$i]['battle_exp'] = 0;
- }
-
-
- if ($this->users[$i]['battle_exp'] > 0 && isset($dun_exp[$this->info['dungeon']]) && $dun_exp[$this->info['dungeon']] > 0) {
- $dunexp = [];
- foreach ($dun_exp as $key => $val) {
- $dunexp[$key] = $key . '=' . $val; //
- }
- $dun_exp = implode(",", $dunexp);
- mysql_query('UPDATE `rep` SET `dungeonexp` = "' . $dun_exp . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- unset($dunexp, $dun_exp);
- }
- unset($dun_limitForLevel);
- }
-
- $sinf = '';
- if ($c['exp_mega']) {
- $this->users[$i]['battle_exp'] += floor($this->users[$i]['battle_exp'] / 100 * $c['exp_mega_val'][$this->users[$i]['level']]);
- }
-
- if ($this->info['team_win'] == 0 && $this->info['type'] != 564) {
- //
- if ($this->users[$i]['level'] <= 1) {
- $this->users[$i]['battle_exp'] = floor($this->users[$i]['battle_exp'] * 0.50);
- } else {
- $this->users[$i]['battle_exp'] = ceil($this->users[$i]['battle_exp'] * 0.10);
- }
- $this->users[$i]['nich'] += 1;
- //
- mysql_query('UPDATE `users` SET `swin` = 0, `slose` = 0 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- //
- } elseif ($this->users[$i]['team'] == $this->info['team_win'] && $this->info['type'] != 564) {
- //
- $gm[$i] = $this->info['money'];
-
- $gms[$i] = $this->info['money3'];
-
- $this->users[$i]['win'] += 1;
- $act01 = 1;
- //
- mysql_query('UPDATE `users` SET `swin` = `swin` + 1, `slose` = 0 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- //
- } elseif ($this->info['type'] != 564) {
- //
- if ($this->users[$i]['level'] <= 1) {
- $this->users[$i]['battle_exp'] = ceil($this->users[$i]['battle_exp'] * 0.33);
- } else {
- $this->users[$i]['battle_exp'] = ceil($this->users[$i]['battle_exp'] * 0.10);
- }
- $bm[$i] = $this->info['money'];
-
- $bms[$i] = $this->info['money3'];
-
- $this->users[$i]['lose'] += 1;
- mysql_query('UPDATE `users` SET `swin` = 0, `slose` = `slose` + 1 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- $act01 = 2;
- }
- // - ( .)
- if ($this->info['money3'] > 0 && isset($gms[$i]) && $this->info['type'] != 564) {
- $mn = [
- 'l' => 0, //
- 'w' => 0, //
- 'm' => 0 // ()
- ];
- if ($act01 == 1) {
- $mn['l'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" AND `team` != "' . $this->users[$i]['team'] . '" LIMIT 1'));
- $mn['l'] = $mn['l'][0];
- $mn['w'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" AND `team` = "' . $this->users[$i]['team'] . '" LIMIT 1'));
- $mn['w'] = $mn['w'][0];
- $mn['m'] = round(($mn['l'] * $this->info['money3']) / 100 * 87, 2);
- $gms[$i] = round(($mn['m'] / $mn['w']), 2);
- }
- }
- //
- //
- //
- if ($act01 == 1) {
- //
- if ($this->users[$i]['dnow'] == 0) {
- if ($this->users[$i]['hpNow'] < 1) {
- $lom = 0.05;
- }
- }
- } elseif ($act01 == 2) {
- //
- $lom = 0.55;
- } else {
- //
- $lom = 0.05;
- }
- //$lom = round($lom*2.75,2);
- $nlom = [0 => rand(0, 18), 1 => rand(0, 18), 2 => rand(0, 18), 3 => rand(0, 18)];
- if ($this->info['type'] == 564) {
- $lom = 0;
- }
- if ($this->stats[$i]['silver'] >= 4) {
- $lom = 0;
- }
- mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW`+' . $lom . ' WHERE `inOdet` < "18" AND `inOdet` > "0" AND `uid` = "' . $this->users[$i]['id'] . '" AND `inOdet`!="0" AND `inOdet`!=' . $nlom[0] . ' AND `inOdet`!=' . $nlom[1] . ' AND `inOdet`!=' . $nlom[2] . ' AND `inOdet`!=' . $nlom[3] . ' LIMIT 18');
-
- $prc = '';
- if ($this->users[$i]['align'] == 2) {
- $this->users[$i]['battle_exp'] = floor($this->users[$i]['battle_exp'] / 2);
- }
- if ($this->users[$i]['animal'] > 0) {
- $ulan = $u->testAction('`uid` = "' . $this->users[$i]['id'] . '" AND `vars` = "animal_use' . $this->info['id'] . '" LIMIT 1',
- 1);
- if (isset($ulan['id']) && $this->users[$i]['team'] == $this->info['team_win'] && $this->users[$i]['level'] > $ulan['vals']) {
- $a004 = mysql_fetch_array(mysql_query('SELECT `max_exp`,`name` FROM `users_animal` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `id` = "' . $this->users[$i]['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1'));
- //33% ,
- $aexp = (round($this->users[$i]['battle_exp'] / 100 * 33));
- if ($aexp > $a004['max_exp']) {
- $aexp = $a004['max_exp'];
- }
- unset($ulan);
- //
- mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`
- ) VALUES (
- '1','" . $this->users[$i]['city'] . "','" . $this->users[$i]['room'] . "','','" . $this->users[$i]['login'] . "'
- ,' "" . $a004['name'] . "" :
" . $aexp . " ','-1','6','0')");
- //
- $upd = mysql_query('UPDATE `users_animal` SET `exp` = `exp` + ' . $aexp . ' WHERE `id` = "' . $this->users[$i]['animal'] . '" AND `level` < ' . $this->users[$i]['level'] . ' LIMIT 1');
- if ($upd) {
- $this->users[$i]['battle_exp'] = round($this->users[$i]['battle_exp'] / 100 * 67);
- $this->info['addExp'] -= 33.333;
- }
- }
- }
-
- $prsusers = mysql_fetch_array(mysql_query('SELECT SUM(`price1`) FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" LIMIT 1'));
- unset($prsusers);
- $btlstatus = $this->typeBattle($prsusers[0]);
- if ($this->info['smert'] == 1) {
- $btlstatus = [150, 150, ' ', ' '];
- }
- //
- if ($this->stats[$i]['clanpos'] > 0) {
- if ($this->stats[$i]['clanpos'] == 1) {
- $this->info['addExp'] += 0;
- } elseif ($this->stats[$i]['clanpos'] == 2) {
- $this->info['addExp'] += 0;
- } elseif ($this->stats[$i]['clanpos'] == 3) {
- $this->info['addExp'] += 0;
- }
- }
-
- unset($r1);
- //
- if ($btlstatus[0] > 0) {
- if ($this->info['type'] == 99) {
- $this->info['addExp'] += $btlstatus[1];
- } else {
- $this->info['addExp'] += $btlstatus[0];
- }
- }
-
- if ($this->users[$i]['align'] == 2 || $this->users[$i]['haos'] > time()) {
- $this->stats[$i]['exp'] = -($this->info['addExp'] + 50);
- }
- if ($this->info['addExp'] + $this->stats[$i]['exp'] != 0) {
- $prc = ' (' . (100 + $this->info['addExp'] + $this->stats[$i]['exp']) . '%)';
- }
- if ($this->info['money'] > 0) {
- if (isset($gm[$i])) {
- $prc .= '
' . $gm[$i] . ' . .';
- $u->addDelo(4, $this->users[$i]['id'],
- '"
System.battle ":
' . $gm[$i] . ' . ( ' . $this->info['id'] . ').',
- time(), $this->info['city'], 'System.battle', 0, 0);
- $this->users[$i]['money'] += $gm[$i];
- } elseif (isset($bm[$i])) {
- $prc .= '
' . $bm[$i] . ' . .';
- $u->addDelo(4, $this->users[$i]['id'],
- '"
System.battle ":
' . $gm[$i] . ' . ( ' . $this->info['id'] . ').',
- time(), $this->info['city'], 'System.battle', 0, 0);
- $this->users[$i]['money'] -= $bm[$i];
- }
- }
- //
- if ($c['money_haot'] && $this->users[$i]['exp'] <= 200000000) {
- if ($act01 == 1 && $this->info['razdel'] == 5 && $this->users[$i]['level'] >= 8) {
- //
- $trexp = [
- 8 => 1200,
- 9 => 3000,
- 10 => 4500,
- 11 => 12000,
- 12 => 20000,
- 13 => 30000,
- 14 => 30000,
- 15 => 30000,
- 16 => 30000,
- 17 => 30000,
- 18 => 30000,
- 19 => 30000,
- 20 => 30000,
- 21 => 30000,
- ];
- $trexp = $trexp[$this->users[$i]['level']];
-
- //
- $trmn = [
- 8 => 1000,
- 9 => 3000,
- 10 => 2500,
- 11 => 3000,
- 12 => 3000,
- 13 => 3000,
- 14 => 3000,
- 15 => 3000,
- 16 => 3000,
- 17 => 3000,
- 18 => 3000,
- 19 => 3000,
- 20 => 3000,
- 21 => 3000,
- ];
- $trmn = $trmn[$this->users[$i]['level']];
-
- //
- $admn = [
- 8 => 0.05, //0.05
- 9 => 0.065, //0.065
- 10 => 0.075, //0.075
- 11 => 0.085, //0.085
- 12 => 0.1, //0.1
- 13 => 0.1,
- 14 => 0.1,
- 15 => 0.1,
- 16 => 0.1,
- 17 => 0.1,
- 18 => 0.1,
- 19 => 0.1,
- 20 => 0.1,
- 21 => 0.1,
- ];
- $admn = $admn[$this->users[$i]['level']];
-
- if ($c['m'] >= 6 && $c['m'] <= 8) {
- //
- if ($c['w'] == 0 || $c['w'] == 5 || $c['w'] == 6) {
- //
- $admn = $admn * 2;
- }
- } elseif ($c['w'] == 0 || $c['w'] == 5 || $c['w'] == 6) {
- //
- $admn = $admn * 2;
- }
- if ($this->users[$i]['battle_exp'] < $trexp) {
- //
- $prc .= ',
0 ( ).';
- //
- } elseif ($admn > 0) {
- if ($this->info['type'] != 33) {
- $prc .= ',
' . $admn . ' .';
- }
- $u->addDelo(4, $this->users[$i]['id'],
- '"
System.battle ":
' . $admn . ' ( ' . $this->info['id'] . ').',
- time(), $this->info['city'], 'System.battle', 0, 0);
- $this->users[$i]['money2'] += $admn;
- }
- }
- }
-
- if ($this->info['money3'] > 0) {
- if (isset($gms[$i])) {
- $prc .= '
' . $gms[$i] . ' $. .';
- $u->addDelo(4, $this->users[$i]['id'],
- '"
System.battle ":
' . $gms[$i] . ' $. ( ' . $this->info['id'] . ').',
- time(), $this->info['city'], 'System.battle', 0, 0);
- $this->users[$i]['money3'] += $gms[$i];
- mysql_query('UPDATE `users` SET `money3` = `money3` + "' . $gms[$i] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- } elseif (isset($bms[$i])) {
- $prc .= '
' . $bms[$i] . ' $. .';
- $u->addDelo(4, $this->users[$i]['id'],
- '"
System.battle ":
' . $gms[$i] . ' $. ( ' . $this->info['id'] . ').',
- time(), $this->info['city'], 'System.battle', 0, 0);
- $this->users[$i]['money3'] -= $bms[$i];
- mysql_query('UPDATE `users` SET `money3` = `money3` - "' . $bms[$i] . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- }
- }
-
- $lime = [
- 8 => 18000,
- 9 => 28000,
- 10 => 84000,
- 11 => 100,
- 12 => 100,
- 13 => 100,
- 14 => 100,
- 15 => 100,
- 16 => 100,
- 17 => 100,
- 18 => 100,
- 19 => 100,
- 20 => 100,
- 21 => 100,
- ];
-
- if ($this->users[$i]['level'] < 8) {
- $lime = 5400;
- } else {
- $lime = $lime[$this->users[$i]['level']];
- }
-
- if ($this->stats[$i]['silver'] >= 5) {
- $lime += round($lime);
- }
-
- if ($this->users[$i]['stopexp'] == 1) {
- $lime = 0;
- $this->users[$i]['battle_exp'] = 0;
- }
-
- if ($lime < $this->users[$i]['battle_exp'] && $c['limitedexp']) {
- $this->users[$i]['battle_exp'] = $lime;
- }
- unset($lime);
-
- if ($btlstatus[0] > 0) {
- if ($this->info['type'] == 99) {
- $prc .= ' (' . $btlstatus[3] . ')';
- } else {
- $prc .= ' (' . $btlstatus[2] . ')';
- }
- }
-
- if ($this->info['dungeon'] == 1 && $this->users[$i]['team'] == $this->info['team_win']) {
- //
- $rep = mysql_fetch_array(mysql_query('SELECT `dl1`,`id` FROM `rep` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'));
- if ($rep['dl' . $this->info['dungeon']] > 0) {
- $this->users[$i]['battle_exp'] += 3 * count($this->users);
- if ($rep['dl' . $this->info['dungeon']] > $this->users[$i]['battle_exp']) {
- $rep['dl' . $this->info['dungeon']] -= $this->users[$i]['battle_exp'];
- } else {
- $this->users[$i]['battle_exp'] = $rep['dl' . $this->info['dungeon']];
- $rep['dl' . $this->info['dungeon']] = 0;
- }
- mysql_query('UPDATE `rep` SET `dl' . $this->info['dungeon'] . '` = "' . $rep['dl' . $this->info['dungeon']] . '" WHERE `id` = "' . $rep['id'] . '" LIMIT 1');
- } else {
- $this->users[$i]['battle_exp'] = 0;
- }
- }
-
- if ($this->users[$i]['battle_exp'] < 1) {
- $this->users[$i]['battle_exp'] = 0;
- }
-
- if (
- $this->users[$i]['battle_exp'] < 1 &&
- $this->users[$i]['twink'] == 0 &&
- $this->info['money'] == 0 &&
- $this->info['money3'] == 0 &&
- $this->info['kingfight'] == 0 &&
- empty($admnb)
- ) {
- $prc = '';
- }
-
- if ($this->user[$i]['host_reg'] == 'real_bot_user') {
- $this->users[$i]['battle_exp'] = round($this->users[$i]['battle_exp'] / 3);
- }
-
- if ($sinf != '') {
- $sinf = ' ( ' . $sinf . ' )';
- }
-
- //-------------- 8-9--------------
-
- if ($this->users[$i]['level'] == 8 && $this->users[$i]['battle_exp'] >= 23000) {
- $this->users[$i]['battle_exp'] = 23000;
- }
- if ($this->users[$i]['level'] == 9 && $this->users[$i]['battle_exp'] >= 31000) {
- $this->users[$i]['battle_exp'] = 31000;
- }
- if ($this->users[$i]['level'] == 10 && $this->users[$i]['battle_exp'] >= 52000) {
- $this->users[$i]['battle_exp'] = 52000;
- }
- if ($this->users[$i]['level'] >= 11 && $this->users[$i]['battle_exp'] >= 75000) {
- $this->users[$i]['battle_exp'] = 75000;
- }
- //-------------------------------------
-
- if ($this->info['type'] != 33) {
- $this->users[$i]['battle_text'] = ' . :
' . floor($this->users[$i]['battle_yron']) . ' HP . :
' . (0 + $this->users[$i]['battle_exp']) . ' ' . $prc . '.' . $sinf; //stats
- }
-
- /* */
- if ($c['nolevel']) {
- $rex95 = substr($this->users[$i]['exp'], -1);
- if ($this->users[$i]['money4'] < 1000 && $this->users[$i]['exp'] == 12499) {
- $rex95 = 6;
- $rex95 = 5;
- }
- } else {
- $rex95 = 5;
- }
-
- if ($c['zuby'] && $this->info['dungeon'] == 0 && ($this->info['clone'] == 0 || $this->users[$i]['level'] < 5) && $rex95 != 9 && $this->info['type'] != 564) {
- if ($this->users[$i]['align'] != 2 && $this->users[$i]['level'] >= 0 && $this->users[$i]['level'] < 8 && $this->users[$i]['battle_exp'] > 0) {
- $rzb = 0;
-
- if ($this->get_chanse(50)) {
- $rzb += rand(1, 3);
- } elseif ($this->users[$i]['battle_exp'] > 15) {
- $rzb += 1;
- }
-
- $chzbs = 100;
-
- if ($this->stats[$i]['silver'] > 0) {
- $chzbs = 150;
- }
-
- if ($this->users[$i]['battle_exp'] > 9) {
- if ($this->users[$i]['level'] > 1) {
- //
- if ($this->get_chanse(25 / 100 * $chzbs)) {
- $rzb += 10;
- }
- } elseif ($this->users[$i]['level'] == 1 && $this->get_chanse(30 / 100 * $chzbs)) {
- $rzb += 10;
- }
-
- if ($this->users[$i]['level'] > 3 && $this->get_chanse(5 / 100 * $chzbs)) {
- $rzb += 100;
- }
- }
-
- if ($this->users[$i]['team'] == $this->info['team_win']) {
- //
- if ($this->users[$i]['level'] < 8) {
- $rzb += 1;
- }
- } elseif ($this->users[$i]['team'] == 0) {
- //
- if ($this->get_chanse(25 / 100 * $chzbs) && $this->users[$i]['battle_exp'] > 2) {
- $rzb = rand(0, 1);
- } else {
- $rzb = 0;
- }
- } else {
- //
- if ($this->users[$i]['level'] >= 1) {
- $rzb = 0;
- } else {
- if ($this->users[$i]['battle_exp'] < 3) {
- $rzb = 0;
- } elseif ($this->user[$i]['lose'] > $this->user[$i]['win']) {
- if ($this->get_chanse(5 / 100 * $chzbs)) {
- $rzb = rand(0, 1);
- } else {
- $rzb = 0;
- }
- } elseif ($this->get_chanse(10 / 100 * $chzbs)) {
- $rzb = rand(0, 1);
- }
- }
- $rzb = 0;
- }
-
- if ($rex95 == 6) {
- $rzb = $this->users[$i]['battle_exp'] > 10 ? rand(0, 1) : 0;
- }
-
- if ($rzb > 0 && rand(0, 1000) <= 500) {
- $rzb = rand(1, 3);
- }
- if ($rzb > 0) {
- if ($this->stats[$i]['silver'] >= 5) {
- $rzb = $rzb * 2;
- }
- mysql_query('UPDATE `users` SET `money4` = `money4` + "' . $rzb . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- $this->users[$i]['battle_text'] .= '
' . $u->zuby($rzb,
- 1) . ' .';
- }
- }
- }
-
- if ($this->info['priz'] > 0) {
- //
- /*
- [4754]
- 2-3 = 1
- 4-5 = 1
- 6-7 = 2
- 8-9 = 3
- (3)
-
- */
-
- $tmon = [
- 2 => 1,
- 3 => 1,
- 4 => 1,
- 5 => 1,
- 6 => 1,
- 7 => 2,
- 8 => 3,
- 9 => 3,
- 10 => 5,
- 11 => 5,
- ];
- $tmon = $tmon[$this->users[$i]['level']];
- //
- $tmonc = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `battle` WHERE `id` IN ( SELECT `battle_id` FROM `battle_last` WHERE `uid` = "' . $this->users[$i]['id'] . '" ) AND `priz` > 0 AND `time_start` > "' . strtotime(date('d.m.Y')) . '"'));
- $tmonc = $tmonc[0];
- //
- if ($this->users[$i]['team'] == $this->info['team_win']) {
- //
- if ($tmonc < 1) {
- $tmonc = 1;
- } elseif ($tmonc > 96) {
- $tmonc = 96;
- }
- $tmon = ($tmon * $tmonc);
- }
- //
- $tmoni = 1;
- while ($tmoni <= floor($tmon / 2)) {
- $u->addItem(4754, $this->users[$i]['id'], ''); //
- $tmoni++;
- }
- //
- $this->users[$i]['battle_text'] .= '
(x' . floor($tmon / 2) . ') . ( , ! ' . ($tmonc) . '/96 )';
- //
- unset($tmon, $tmoni);
- }
- //
- if ($this->info['dungeon'] == 0 && $this->info['razdel'] == 5 && $this->users[$i]['team'] == $this->info['team_win']) {
- //2
- $u->repexp_add($this->users[$i]['id'], 2); // +2
- $check = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `id_eff` = 478 AND `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = 0 ORDER BY `overType` DESC LIMIT 1;'));
- if (isset($check['id'])) {
- $urcheck = 10000;
- if ($this->users[$i]['level'] == 8) {
- $urcheck = 3000;
- } elseif ($this->users[$i]['level'] == 9) {
- $urcheck = 7000;
- } elseif ($this->users[$i]['level'] == 10) {
- $urcheck = 12000;
- } elseif ($this->users[$i]['level'] >= 11) {
- $urcheck = 18000;
- }
-
- if ($this->users[$i]['battle_yron'] >= $urcheck) {
- mysql_query('UPDATE `eff_users` SET `timeUse` = `timeUse` - 300 WHERE `id_eff`=478 AND `delete` = 0 AND `uid` =' . $this->users[$i]['id'] . ' LIMIT 1');
- $this->users[$i]['battle_text'] .= '
' . $urcheck . ' -5 . !';
- }
- }
- mysql_query('UPDATE `users_achiv` SET `vx`= `vx`+1 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'); //
-
- }
- //
- if ($this->info['dungeon'] == 0 && $this->info['type'] == 250 && $this->users[$i]['team'] == $this->info['team_win']) {
- mysql_query('UPDATE `users_achiv` SET `kw`= `kw`+1 WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- if (date('w') == 0 || date('w') == 6 || date('w') == 4) {
- $u->repexp_add($this->users[$i]['id'], 25); // () 25
- }
- }
- //
- if ($this->info['dungeon'] == 0 && $this->info['type'] == 99 && $this->users[$i]['team'] == $this->info['team_win']) {
- if (date('w') == 0 || date('w') == 6 || date('w') == 5) {
- $u->repexp_add($this->users[$i]['id'], 10); // () 10
- }
- }
-
- //
- if ($this->info['dungeon'] == 0 && $this->info['type'] == 500 && $this->users[$i]['team'] == $this->info['team_win'] && $this->users[$i]['no_ip'] != 'trupojor' && $this->users[$i]['bot'] == 0) {
- if ($this->users[$i]['level'] > 9) {
- $mid = 903093;
- } else {
- $mid = 89489;
- }
- $mon = mysql_fetch_array(mysql_query('SELECT * FROM `aaa_monsters` WHERE `uid` = "' . $mid . '" LIMIT 1'));
-
- if ($this->users[$i]['battle_yron'] >= 2000) {
- $ritem = rand(1, 100);
- if ($ritem <= 20) {
- $mon['win_itm'] = '4459@1';
- } elseif ($ritem <= 40) {
- $mon['win_itm'] = '4460@1';
- } elseif ($ritem <= 60) {
- $mon['win_itm'] = '4461@1';
- } elseif ($ritem <= 80) {
- $mon['win_itm'] = '4462@1';
- } else {
- $mon['win_itm'] = '4463@1';
- }
- } elseif ($this->users[$i]['battle_yron'] >= 1500) {
- $ritem = rand(1, 100);
- if ($ritem <= 20) {
- $mon['win_itm'] = '4459@1';
- } elseif ($ritem <= 40) {
- $mon['win_itm'] = '4460@1';
- } elseif ($ritem <= 60) {
- $mon['win_itm'] = '4461@1';
- } elseif ($ritem <= 80) {
- $mon['win_itm'] = '4462@1';
- } else {
- $mon['win_itm'] = '4463@1';
- }
- } elseif ($this->users[$i]['battle_yron'] >= 1000) {
- $ritem = rand(1, 100);
- if ($ritem <= 25) {
- $mon['win_itm'] = '4460@1';
- } elseif ($ritem <= 50) {
- $mon['win_itm'] = '4461@1';
- } elseif ($ritem <= 75) {
- $mon['win_itm'] = '4462@1';
- } else {
- $mon['win_itm'] = '4463@1';
- }
- } else {
- $mon['win_itm'] = '4392@1';
- $timewait = 0;
- }
- if ($this->users[$i]['battle_yron'] > 0) {
- mysql_query('INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","478","111","' . $this->users[$i]['id'] . '"," ","pravonapodvig=1","' . time() . '")');
- }
- mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $this->users[$i]['id'] . '","' . (time() - $timewait) . '","capitalcity","' . $this->users[$i]['room'] . '","end_trup"," ","","")');
- mysql_query('INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","479","112","' . $u->info['id'] . '"," ","zashitatk=1","' . time() . '")');
- $ritem = rand(1, 1000);
- if ($ritem == 555) {
- $mon['win_itm'] = $mon['win_itm'] . ',5022@1';
- }
-
- $this->addGlobalItems($mid, $this->users[$i]['id'], $mon['win_itm'], $mon['win_eff'],
- $mon['win_ico'], 1, $mon['win_money1'], $mon['win_money2']); //$mon['win_exp']
-
- }
-
- if ($this->info['dungeon'] == 0 && $this->info['razdel'] == 5 && $u->info['battle_yron'] >= 2000) {
- // ang_g
- if ($this->users[$i]['team'] == $this->info['team_win']) {
- //
- $tmoni = 2;
- } else {
- $tmoni = 1;
- }
-
- $tmon = $tmoni;
- $effblago = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = ' . $this->users[$i]['id'] . ' AND `delete` = 0 AND `id_eff`= 414 LIMIT 1'));
- if (isset ($effblago['id'])) {
- $limitg = 50;
- } else {
- $limitg = 25;
- }
- while ($tmoni >= 1) {
- if ($u->info['ang_g'] < $limitg) {
- $u->addItem(4754, $this->users[$i]['id'], '');
- mysql_query('UPDATE `users` SET `ang_g`=`ang_g`+1 WHERE `id` =' . $this->users[$i]['id']);
- } else {
- $tmon--;
- }
- $tmoni--;
- }
-
- if ($this->info['type'] != 33) {
- $this->users[$i]['battle_text'] .= '
(' . $tmon . ') . [' . ($u->info['ang_g'] + $tmon) . '/' . $limitg . '] . ';
- }
- unset($tmon, $tmoni, $effblago, $limitg);
- }
-
-
- if ($this->info['razdel'] == 5 || $this->info['razdel'] == 4) {
- if (date('d.m') == '31.10' || (date('m') == 11 && date('d') < 7)) {
- // 4504
- $this->users[$i]['battle_text'] .= '
(x1) .';
- $u->addItem(4504, $this->users[$i]['id'], '|sudba=1');
- }
- }
-
-
- //
- if ($this->info['dungeon'] == 0 && $this->info['razdel'] == 5 && $this->users[$i]['exp'] >= 1500
- ) {
- if ($this->users[$i]['battle_exp'] > 100 * $this->users[$i]['level']) {
- $rzbvo = $this->users[$i]['battle_exp'] * 6 / 1000;
-
- if ($this->users[$i]['level'] == 8) {
- if ($rzbvo >= 100) {
- $rzbvo = 100;
- }
- }
- if ($this->users[$i]['level'] == 9) {
- if ($rzbvo >= 150) {
- $rzbvo = 150;
- }
- }
- if ($this->users[$i]['level'] == 10) {
- if ($rzbvo >= 200) {
- $rzbvo = 200;
- }
- }
- if ($this->users[$i]['level'] == 11) {
- if ($rzbvo >= 250) {
- $rzbvo = 250;
- }
- }
- if ($this->users[$i]['level'] == 12) {
- if ($rzbvo >= 250) {
- $rzbvo = 250;
- }
- }
- if ($this->info['type'] != 33) {
- $this->users[$i]['battle_text'] .= ' ' . $rzbvo . ' .';
- }
- mysql_query('UPDATE `rep` SET `rep3` = `rep3` + ' . $rzbvo . ' WHERE `id` = ' . $this->users[$i]['id']);
- mysql_query('INSERT INTO `actions`(`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES ("' . $this->users[$i]['id'] . '","' . time() . '","capitalcity","' . $this->users[$i]['room'] . '","end_xaot"," ","' . $zadID . '","")');
- }
- }
-
- if ($this->stats[$i]['hpNow'] >= 1) {
- $this->stats[$i]['test_heal'] = mysql_fetch_array(mysql_query('SELECT SUM(`yrn`) FROM `battle_stat` WHERE `uid2` = "' . $this->users[$i]['id'] . '" AND `battle` = "' . $this->info['id'] . '" LIMIT 1'));
- $this->stats[$i]['test_heal'] = $this->stats[$i]['test_heal'][0];
- $this->stats[$i]['test_start'] = mysql_fetch_array(mysql_query('SELECT `hpStart` FROM `battle_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `battle` = "' . $this->info['id'] . '" LIMIT 1'));
- $this->stats[$i]['test_start'] = $this->stats[$i]['test_start']['hpStart'];
- //
- $this->stats[$i]['hpNow'] = ($this->stats[$i]['test_start'] - $this->stats[$i]['test_heal']);
- if ($this->stats[$i]['hpNow'] < 1) {
- $this->stats[$i]['hpNow'] = 1;
- }
- } else {
- $this->stats[$i]['hpNow'] = 0;
- }
-
- unset($this->stats[$i]['test_heal']);
-
- $this->users[$i]['last_b'] = $this->info['id']; //stats
- $this->users[$i]['last_a'] = $act01;
- $this->users[$i]['battle'] = -1; //users
- $this->users[$i]['battle_yron'] = 0; //stats
-
- $this->users[$i]['exp'] += $this->users[$i]['battle_exp']; //users
-
- // ( )
-
- if ($this->users[$i]['clan'] > 0) {
- $cpr = 1;
- if ($this->info['typeBattle'] == 9) {
- $cpr = 25;
- } elseif ($this->info['typeBattle'] == 50) {
- $cpr = 65;
- }
- if ($this->stats[$i]['silver'] >= 5) {
- $cpr = floor($cpr / 100 * 150);
- }
- mysql_query('UPDATE `clan` SET `exp` = `exp` + "' . round($this->users[$i]['battle_exp'] / 100 * $cpr) . '" WHERE `id` = "' . $this->users[$i]['clan'] . '" LIMIT 1');
- }
-
- $this->users[$i]['battle_exp'] = 0; //stats
-
- if ($this->users[$i]['team'] == $this->info['team_win']) {
- mysql_query('UPDATE `rep` SET `n_capitalcity` = `n_capitalcity` + ' . $this->users[$i]['bn_capitalcity'] . ' ,`n_demonscity` = `n_demonscity` + ' . $this->users[$i]['bn_demonscity'] . ' ,`n_demonscity` = `n_demonscity` + ' . $this->users[$i]['bn_suncity'] . ' WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- }
-
- //
- $this->users[$i]['bn_demonscity'] = 0;
- $this->users[$i]['bn_capitalcity'] = 0;
- $this->users[$i]['bn_suncity'] = 0;
- //
- $spe = mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `file_finish` != "" AND `v1` = "priem" LIMIT 30');
- while ($ple = mysql_fetch_array($spe)) {
- if (file_exists('../../_incl_data/class/priems/' . $ple['file_finish'] . '.php')) {
- require('../../_incl_data/class/priems/' . $ple['file_finish'] . '.php');
- }
- }
- //
- mysql_query('DELETE FROM `eff_users` WHERE `v1` = "priem" AND `uid` = "' . $this->users[$i]['id'] . '" LIMIT 50');
- if ($dnr == 1) {
- if ($this->users[$i]['room'] == 370) {
- $dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `dn` = "' . $this->users[$i]['dnow'] . '" AND `vars` = "dielaba" LIMIT 1'));
- $dies = $dies[0];
- mysql_query('INSERT INTO `dungeon_actions` (`dn`,`uid`,`x`,`y`,`time`,`vars`,`vals`) VALUES (
- "' . $this->users[$i]['dnow'] . '","' . $this->users[$i]['id'] . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '","' . time() . '","dielaba",""
- )');
- } else {
- $dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `dungeon_actions` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `dn` = "' . $this->users[$i]['dnow'] . '" AND `vars` = "die" LIMIT 1'));
- $dies = $dies[0];
- mysql_query('INSERT INTO `dungeon_actions` (`dn`,`uid`,`x`,`y`,`time`,`vars`,`vals`) VALUES (
- "' . $this->users[$i]['dnow'] . '","' . $this->users[$i]['id'] . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '","' . time() . '","die",""
- )');
- }
- if ($dies < 2 || $this->info['dungeon'] == 15) {
- //
- $tshbn = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `delete` = 0 AND `item_id` = "4910" LIMIT 1'));
- if (isset($tshbn['id'])) {
- //
- mysql_query('DELETE FROM `items_users` WHERE `id` = "' . $tshbn['id'] . '" LIMIT 1');
- //
- mysql_query('INSERT INTO `dungeon_obj` (
- `name`,`dn`,`x`,`y`,`img`,`delete`,`action`,`for_dn`,
- `type`,`w`,`h`,`s`,`s2`,`os1`,`os2`,`os3`,`os4`,`type2`,`top`,`left`,`date`
- ) VALUES (
- "","' . $this->info['dn_id'] . '","' . $this->users[$i]['x'] . '","' . $this->users[$i]['y'] . '","shaiba.png","0","fileact:15/shaiba","0",
- "0","120","220","0","0","5","8","12","0","0","0","0","{use:\'takeit\',rt1:69,rl1:-47,rt2:74,rl2:126,rt3:76,rl3:140,rt4:80,rl4:150}"
- )');
- //
- }
- // ( 00)
- $this->users[$i]['x'] = $this->users[$i]['res_x'];
- $this->users[$i]['y'] = $this->users[$i]['res_y'];
- $this->users[$i]['s'] = $this->users[$i]['res_s'];
- $r_n = mysql_fetch_array(mysql_query('SELECT `name` FROM `room` WHERE `id` = "' . (int)$this->users[$i]['room'] . '" LIMIT 1'));
- if ($this->users[$i]['room'] == 370) {
- if ($this->users[$i]['sex'] == 0) {
- $rtxt = '
' . $this->users[$i]['login'] . ' ';
- } else {
- $rtxt = '
' . $this->users[$i]['login'] . ' ';
- }
- } else {
- if ($this->users[$i]['sex'] == 0) {
- $rtxt = '
' . $this->users[$i]['login'] . ' "' . $r_n['name'] . '"';
- } else {
- $rtxt = '
' . $this->users[$i]['login'] . ' "' . $r_n['name'] . '"';
- }
- }
- } elseif ($this->info['dungeon'] == 102) {
- $nld = '';
- $lab = mysql_fetch_array(mysql_query('SELECT `id`,`users` FROM `laba_now` WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1'));
- if ($lab['users'] < 2) {
- //
- mysql_query('DELETE FROM `laba_now` WHERE `id` = "' . $lab['id'] . '" LIMIT 1');
- mysql_query('DELETE FROM `laba_map` WHERE `id` = "' . $lab['id'] . '" LIMIT 1');
- mysql_query('DELETE FROM `laba_obj` WHERE `lib` = "' . $lab['id'] . '"');
- mysql_query('DELETE FROM `laba_act` WHERE `lib` = "' . $lab['id'] . '"');
- mysql_query('DELETE FROM `laba_itm` WHERE `lib` = "' . $lab['id'] . '"');
- } else {
- $lab['users']--;
- mysql_query('UPDATE `laba_now` SET `users` = "' . $lab['users'] . '" WHERE `id` = "' . $lab['id'] . '" LIMIT 1');
- }
- mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- mysql_query('UPDATE `users` SET `room` = "369" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- //
- mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `delete` < 1234567890 AND `inShop` = "0" AND (`dn_delete` = "1" OR `data` LIKE "%fromlaba=1%")');
- if ($this->users[$i]['login'] != '') {
- if ($this->users[$i]['sex'] == 0) {
- $rtxt = '
' . $this->users[$i]['login'] . ' ' . $nld;
- } else {
- $rtxt = '
' . $this->users[$i]['login'] . ' ' . $nld;
- }
- }
- } else {
- $tinf = mysql_fetch_array(mysql_query('SELECT `uid` FROM `dungeon_now` WHERE `id` = "' . $this->info['dn_id'] . '" LIMIT 1'));
- $nld = '';
- if ($tinf['uid'] == $this->users[$i]['id']) {
- $tinf = mysql_fetch_array(mysql_query('SELECT `id` FROM `stats` WHERE `dnow` = "' . $this->info['dn_id'] . '" AND `hpNow` >= 1 LIMIT 1'));
- if (isset($tinf['id'])) {
- $tinf = mysql_fetch_array(mysql_query('SELECT `id`,`login` FROM `users` WHERE `id` = "' . $tinf['id'] . '" LIMIT 1'));
- $nld .= ', "' . $tinf['login'] . '"';
- mysql_query('UPDATE `dungeon_now` SET `uid` = "' . $tinf['id'] . '" WHERE `id` = "' . $this->info['dn_id'] . '" LIMIT 1');
- }
- }
- $rooms = [
- 374 => 372, // ( )
- 189 => 188, // ( )
- 392 => 393, // ( )
-
- 398 => 397, // ( )
- 243 => 395, // ( )
- 360 => 242, // ( )
-
- 19 => 293 //
- ];
- // $n_rm = $rooms[$this->users[$i]['room']];
- mysql_query('UPDATE `stats` SET `dnow` = "0" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- mysql_query('UPDATE `users` SET `room` = "321" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- //
- mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `dn_delete` = "1" LIMIT 1000');
- mysql_query('UPDATE `items_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `item_id` = "1189" OR `item_id` = "4447" OR `item_id` = "1174") LIMIT 1000');
- if ($this->users[$i]['sex'] == 0) {
- $rtxt = '
' . $this->users[$i]['login'] . ' ' . $nld;
- } else {
- $rtxt = '
' . $this->users[$i]['login'] . ' ' . $nld;
- }
- }
- if ($rtxt != '') {
- mysql_query("INSERT INTO `chat` (`dn`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`typeTime`,`new`) VALUES ('" . $this->info['dn_id'] . "','" . $this->users[$i]['city'] . "','" . $this->users[$i]['room'] . "','','','" . $rtxt . "','" . time() . "','6','0','1','1')");
- }
- }
-
- mysql_query('UPDATE `users` SET `login2` = "" WHERE `battle` = "' . $this->info['id'] . '"');
- mysql_query('UPDATE `users` SET `login2` = "", `money` = "' . $this->users[$i]['money'] . '", `money2` = "' . $this->users[$i]['money2'] . '",`win` = "' . $this->users[$i]['win'] . '",`lose` = "' . $this->users[$i]['lose'] . '",`nich` = "' . $this->users[$i]['nich'] . '",`battle` = "-1" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
-
- if ($u->info['id'] == $this->users[$i]['id']) {
- $u->info['battle_text'] = $this->users[$i]['battle_text'];
- }
-
- mysql_query('UPDATE `stats` SET `hpNow` = "' . $this->stats[$i]['hpNow'] . '",`mpNow` = "' . $this->stats[$i]['mpNow'] . '",`bn_capitalcity` = 0,`bn_demonscity` = 0,`smena` = 3,`tactic7` = "-100",`x`="' . $this->users[$i]['x'] . '",`y`="' . $this->users[$i]['y'] . '",`priems_z`="0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0",`last_pr`="0",`tactic1`="0",`tactic2`="0",`tactic3`="0",`tactic4`="0",`tactic5`="0",`tactic6`="0.00000000",`tactic7`="10",`exp` = "' . $this->users[$i]['exp'] . '",`battle_exp` = "' . $this->users[$i]['battle_exp'] . '",`battle_text` = "' . $this->users[$i]['battle_text'] . '",`battle_yron` = "0",`enemy` = "0",`last_b`="' . $this->info['id'] . '",`regHP` = "' . time() . '",`regMP` = "' . time() . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
- if ($this->info['turnir'] == 0) {
- //
- mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$i]['city'] . "','" . $this->users[$i]['room'] . "','','" . $this->users[$i]['login'] . "','" . $this->users[$i]['battle_text'] . "','-1','6','0')");
- } else {
- mysql_query('UPDATE `turnirs` SET `winner` = "' . $this->info['team_win'] . '" WHERE `id` = "' . $this->info['turnir'] . '" LIMIT 1');
- }
- //
- mysql_query('UPDATE `battle` SET `time_over` = "' . time() . '",`team_win` = "' . $this->info['team_win'] . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
-
- //
- if ($this->users[$i]['animal'] > 0) {
- $a = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal` WHERE `uid` = ' . $this->users[$i]['id'] . ' AND `id` = ' . $this->users[$i]['animal'] . ' AND `pet_in_cage` = 0 AND `delete` = 0 LIMIT 1'));
- if (isset($a['id'])) {
- if ($a['eda'] < 1) {
- $u->send('', $this->users[$i]['room'], $this->users[$i]['city'], '',
- $this->users[$i]['login'], '
' . $a['name'] . ' ...',
- time(), 6, 0, 0, 0, 1);
- }
- }
- }
- mysql_query("UPDATE `stats` SET `battle_text` = '',`last_b` = 0 WHERE `id` = " . $this->users[$i]['id']);
- mysql_query("UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = " . $this->users[$i]['id']);
- $this->saveLogs();
- if ($u->info['battle'] != 0 && !isset($u->info['battle_lsto'])) {
- echo '';
- }
- }
- } else {
- sleep(2);
- }
- mysql_query('UPDATE `battle` SET `testfinish` = 0 WHERE `id` = ' . $this->info['id']);
- mysql_query('UNLOCK TABLES');
- }
-
- //
- private $ainm = [];
-
- /**
- * @param $uid
- * @param int $itemId
- * @param string $data
- * @return void
- */
- private function addGlobalItem($uid, $itemId, $data)
- {
- $room = $this->users[$this->uids[$uid]]['room'];
- $login = $this->users[$this->uids[$uid]]['login'];
- $q = "insert into items_local (room, time, item_id, data, tr_login, colvo) values
- ($room, unix_timestamp(), $itemId, $data, $login, 1)";
- mysql_query($q);
- }
-
- private function addGlobalItems($bid, $uid, $itm, $eff, $ico, $exp, $cr, $ecr)
- {
- global $u;
- //
- //
- if ($bid == 1008) {
- //
- $jit = 0;
- $iit = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `online` > unix_timestamp() - 120'));
- $iit = floor($iit[0] / 20);
- $iit = rand(1, $iit);
- while ($jit < $iit) {
- if (rand(0, 100) < 50) {
- $svtk = array_fill(0, 71, 1000);
- array_push($svtk,
- 1461, 1462, 1463, 4037,
- 4038, 4039, 4040, 911,
- 1172, 1173, 2142, 2141,
- 2143, 2870, 2144);
-
- $svtk = $svtk[rand(0, count($svtk) - 1)];
- if ($svtk == 1000) {
- $this->addGlobalItem($uid, $svtk, '|nosale=1|srok=259200');
- $this->addGlobalItem($uid, $svtk, '|nosale=1|srok=259200');
- $this->addGlobalItem($uid, $svtk, '|nosale=1|srok=259200');
- $this->addGlobalItem($uid, $svtk, '|nosale=1|srok=259200');
- $this->addGlobalItem($uid, $svtk, '|nosale=1|srok=259200');
- $this->addGlobalItem($uid, $svtk, '|nosale=1|srok=259200');
- }
- $this->addGlobalItem($uid, $svtk, '|nosale=1|srok=259200');
- }
- $jit++;
- }
- unset($svtk);
- } elseif ($bid == 1007) {
- //, CAPITAL CITY
- $jit = 0;
- $iit = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users` WHERE `online` > unix_timestamp() - 120'));
- $iit = floor($iit[0] / 20);
- $iit = rand(1, $iit);
- while ($jit < $iit) {
- if (rand(0, 100) < 50) {
- $this->addGlobalItem($uid, 4504, '');
- }
- $jit++;
- }
- } elseif ($bid == 1006) {
- // CAPITAL CITY
- if (rand(0, 100) < 10) {
- $this->addGlobalItem($uid, 4451, 'srok=86400');
- }
- } elseif ($bid == 1000) {
- // CAPITAL CITY
- $this->addGlobalItem($uid, 4460, 'srok=2592000');
- } elseif ($bid == 1001) {
- // CAPITAL CITY
- $this->addGlobalItem($uid, 4461, 'srok=2592000');
- } elseif ($bid == 1002) {
- // CAPITAL CITY
- $this->addGlobalItem($uid, 4462, 'srok=2592000');
- } elseif ($bid == 1003) {
- // CAPITAL CITY
- $this->addGlobalItem($uid, 4463, 'srok=2592000');
- } elseif ($bid == 1004) {
- // CAPITAL CITY
- $this->addGlobalItem($uid, 4459, 'srok=2592000');
- }
-
- if ($exp >= 0) {
- $this->users[$this->uids[$uid]]['battle_exp'] += round($exp * $this->users[$this->uids[$uid]]['battle_yron'] / $this->stats[$this->uids[$bid]]['hpAll']);
- mysql_query('UPDATE `stats` SET `battle_exp` = "' . mysql_real_escape_string($this->users[$this->uids[$uid]]['battle_exp']) . '" WHERE `id` = "' . mysql_real_escape_string($uid) . '" LIMIT 1');
- }
-
- if ($cr != '' && $cr > 0) {
- if ($this->stats[$this->uids[$uid]]['hpNow'] > 0) {
- mysql_query('UPDATE `users` SET `money` = (`money` + ' . mysql_real_escape_string($cr) . ') WHERE `id` = "' . mysql_real_escape_string($uid) . '" LIMIT 1');
- mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','
: " . mysql_real_escape_string($cr) . " . ','-1','6','0')");
- }
- }
- //
- if ($ecr != '' && $ecr > 0) {
- if ($this->stats[$this->uids[$uid]]['hpNow'] > 0) {
- $this->users[$this->uids[$uid]]['money2'] += $ecr;
- $resulttp = mysql_query('UPDATE `users` SET `money2` = (`money2` + ' . mysql_real_escape_string($ecr) . ') WHERE `id` = "' . $this->users[$this->uids[$uid]]['id'] . '" LIMIT 1');
- if (!$resulttp) {
- mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','
!!! ','-1','6','0')");
- $u->addDelo(4, $this->users[$this->uids[$uid]]['id'],
- '"
System.battle >": ( ), !!! ',
- time(),
- $this->users[$this->uids[$uid]]['city'], 'System.battle', 0, 0);
- } else {
- mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','
-: " . mysql_real_escape_string($ecr) . " . ','-1','6','0')");
- $u->addDelo(4, $this->users[$this->uids[$uid]]['id'],
- '"
System.battle ":
' . $ecr . ' ( ), :
' . $this->users[$this->uids[$uid]]['money2'] . ' ',
- time(), $this->users[$this->uids[$uid]]['city'], 'System.battle', 0, 0);
- }
- }
- }
- //
- if ($ico != '') {
- /*
- 0(, 1 - , 2 - )@
- 1( )@
- 2( )@
- 3()@
- 4( 0 1, -1)@
- 5( % 0.001)@
- 6( : add_s1=5|add_hpAll=50)@
- 7( , )@
- 8( 0 1)@
- 9( 0 or 1)
- */
- $i = 0;
- $txt = '';
- $ico = explode('#', $ico);
- while ($i < count($ico)) {
- $ico_e = explode('@', $ico[$i]);
- if (isset($ico_e[3])) {
- //
- $add = 1;
- if ($ico_e[4] == 1 && floor($this->stats[$this->uids[$uid]]['hpNow']) < 1) {
- $add = 0;
- }
- if ($add == 1) {
- $ins = false;
- if ($ico_e[8] == 0) {
- $ins = true;
- if ($ico_e[9] == 1) {
- mysql_query('DELETE FROM `users_ico` WHERE `uid` = ' . (int)$uid . ' AND `img` = ' . mysql_real_escape_string($ico_e[2]));
- }
- } else {
- $old_ico = mysql_fetch_array(mysql_query('SELECT `id` FROM `users_ico` WHERE `uid` = ' . (int)$uid . ' AND (`endTime` > unix_timestamp() OR `endTime` = 0) AND `img` = ' . mysql_real_escape_string($ico_e[2]) . ' LIMIT 1'));
- if (!isset($old_ico['id'])) {
- $ins = true;
- } else {
- if ($old_ico['id'] > 0) {
- $txt .= ', "' . $ico_e[3] . ' (
)"';
- mysql_query('UPDATE `users_ico` SET `x` = `x` + 1,`endTime` = ' . (time() + $ico_e[1] * 60) . ' WHERE `id` = ' . $old_ico['id']);
- } else {
- $ins = true;
- }
- }
- unset($old_ico);
- }
-
- if ($ins) {
- if ($ico_e[9] == 1) {
- mysql_query('DELETE FROM `users_ico` WHERE `uid` = ' . mysql_real_escape_string($uid) . ' AND `img` = ' . mysql_real_escape_string($ico_e[2]));
- }
- mysql_query('INSERT INTO `users_ico` (`uid`,`time`,`text`,`img`,`endTime`,`type`,`bonus`) VALUES (
- ' . mysql_real_escape_string($uid) . ',
- unix_timestamp(),
- ' . mysql_real_escape_string($ico_e[3]) . ',
- ' . mysql_real_escape_string($ico_e[2]) . ',
- ' . mysql_real_escape_string(time() + $ico_e[1] * 60) . ',
- ' . mysql_real_escape_string($ico_e[0]) . ',
- ' . mysql_real_escape_string($ico_e[6]) . '
- )');
- $txt .= ', "' . $ico_e[3] . '"';
- }
- }
- }
- $i++;
- }
- if ($txt != '') {
- $txt = ltrim($txt, ', ');
- mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','
: " . mysql_real_escape_string($txt) . "','-1','6','0')");
- }
- }
- //
- if ($itm != '') {
- $i = 0;
- $txt = '';
- $itm = explode(',', $itm);
- while ($i < count($itm)) {
- $itm_e = explode('@', $itm[$i]);
- if ($itm_e[0] > 0) {
- $j = 0;
- while ($j < $itm_e[1]) {
- $u->addItem($itm_e[0], $uid, '|' . $itm_e[2]);
- $j++;
- }
- if (!isset($this->ainm[$itm_e[0]])) {
- $this->ainm[$itm_e[0]] = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = ' . mysql_real_escape_string($itm_e[0])));
- }
- if (isset($this->ainm[$itm_e[0]]['id'])) {
- //
- $txt .= ',
' . $this->ainm[$itm_e[0]]['name'] . ' ';
- if ($itm_e[1] > 1) {
- $txt .= '
(x' . $itm_e[1] . ') ';
- }
- }
- }
- $i++;
- }
- if ($txt != '') {
- $txt = ltrim($txt, ', ');
- mysql_query("INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $this->users[$this->uids[$uid]]['city'] . "','" . $this->users[$this->uids[$uid]]['room'] . "','','" . $this->users[$this->uids[$uid]]['login'] . "','
: " . mysql_real_escape_string($txt) . "','-1','6','0')");
- }
- }
- }
-
- /**
- * @return void
- */
- private function addNewAtack()
- {
- global $u;
- if (!isset($this->ga[$u->info['id']][$u->info['enemy']])) {
- if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] > 0) {
- $us = $this->stats[$this->uids[$u->info['id']]];
- $i = 1;
- $no = 0;
-
- while ($i <= $us['zona']) {
- if ($this->uAtc['a'][$i] == 0) {
- $no = 1;
- }
- $i++;
- }
-
- if ($this->uAtc['b'] == 0) {
- $no = 1;
- }
-
- if ($no == 0) {
- //
- if ($u->info['enemy'] > 0) {
- if (!isset($this->ga[$u->info['enemy']][$u->info['id']])) {
- if (
- $this->stats[$this->uids[$u->info['id']]]['hpNow'] >= 1 &&
- $this->stats[$this->uids[$u->info['enemy']]]['hpNow'] >= 1
- ) {
- //
- $a = $this->uAtc['a'][1] .
- $this->uAtc['a'][2] .
- $this->uAtc['a'][3] .
- $this->uAtc['a'][4] .
- $this->uAtc['a'][5];
- $b = $this->uAtc['b'];
- mysql_query('DELETE FROM `battle_act` WHERE `battle` = ' . $this->info['id'] . ' AND ((`uid2` = ' . $u->info['id'] . ' AND `uid1` = ' . $u->info['enemy'] . ') OR (`uid1` = ' . $u->info['id'] . ' AND `uid2` = ' . $u->info['enemy'] . ')) LIMIT 2');
- $d = mysql_query('INSERT INTO `battle_act` (`battle`,`time`,`uid1`,`uid2`,`a1`,`b1`) VALUES (' . $this->info['id'] . ',' . time() . ',' . $u->info['id'] . ',' . $u->info['enemy'] . ',' . $a . ',' . $b . ')');
- if (!$d) {
- $this->e = ' ...';
- } else {
- $this->ga[$u->info['id']][$u->info['enemy']] = mysql_insert_id();
- }
- }
- } else {
- //
- if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] >= 1 && $this->stats[$this->uids[$u->info['enemy']]]['hpNow'] >= 1) {
- if (isset($this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['id'])) {
- $this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['a2'] = $this->uAtc['a'][1] . $this->uAtc['a'][2] . $this->uAtc['a'][3] . $this->uAtc['a'][4] . $this->uAtc['a'][5];
- $this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['b2'] = $this->uAtc['b'];
- $this->startAtack($this->atacks[$this->ga[$u->info['enemy']][$u->info['id']]]['id']);
- }
- }
- }
- }
- } else {
- $this->e = ' ';
- }
- } else {
- $this->e = ' , ...';
- }
- }
- }
-
-
- /** , - .
- * . .
- *
: /class/priems/*
- * @param int $uid1
- * @param int $uid2
- * @param int $end > 0, *.end.php, *.php
- * @return void
- */
- private function magicItems($uid1, $uid2, $end)
- {
- if (!isset($this->stats[$this->uids[$uid1]])) {
- return;
- }
- foreach ($this->stats[$this->uids[$uid1]]['items'] as $item) {
- if (!$item['id'] || !$this->lookStats($item['data'])['bm_a1']) {
- continue;
- }
- $file = $this->lookStats($item['data'])['bm_a1'] . $end > 0 ? '.end.php' : '.php';
- if (file_exists('../../_incl_data/class/priems/' . $file)) {
- require_once '../../_incl_data/class/priems/' . $file;
- }
- }
- }
-
- private $rehodeff = [];
-
- //
- private $poglast = [];
-
- public function testPogB($uid, $yr, $pliid, $test = 0)
- {
- $yr2 = $yr;
-
- $checktuman = mysql_fetch_array(mysql_query('SELECT id FROM `eff_users` WHERE `uid` = ' . $uid . '
- AND v2 in (273, 286, 287, 288)
- AND `delete` =0 LIMIT 1')); //
- //if ( !isset($checktuman['id']))
- if ($yr > 0 && !isset($checktuman['id'])) {
- global $priem;
- $i = 0;
- while ($i < count($this->stats[$this->uids[$uid]]['set_pog2'])) {
- $j = $this->stats[$this->uids[$uid]]['set_pog2'][$i];
- if ($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['id'] == $pliid || $test == 1) {
- $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] = str_replace('add_pog2=' . $j['y'],
- 'add_pog2=$', $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']);
- $dt3 = $this->lookStats($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']);
-
- $dt3['add_pog2p'] = min(floor($j['y'] / $yr2 * 100), $dt3['add_pog2p']);
-
- if (isset($dt3['add_pog2mp'])) {
- if ((round(round($yr2 / 100 * (100 - $dt3['add_pog2p'])) * $dt3['add_pog2mp'])) > $this->stats[$this->uids[$uid]]['mpNow']) {
- // , %
- $j['yhj'] = $this->stats[$this->uids[$uid]]['mpNow'] / (round(round($yr2 / 100 * (100 - $dt3['add_pog2p'])) * $dt3['add_pog2mp'])) * 100;
- $j['yhj'] = floor($j['yhj']); // %
- $dt3['add_pog2p'] = floor($dt3['add_pog2p'] / 100 * $j['yhj']);
- }
- if ($test == 1) {
- $priem->minMana($uid, round(round($yr2 / 100 * $dt3['add_pog2p']) * $dt3['add_pog2mp']));
- }
- }
- if (!isset($this->poglast[$uid])) {
- $this->poglast[$uid] = 0;
- }
- $this->poglast[$uid] += $yr2;
- if ($test == 1) {
- $j['y'] -= round($this->poglast[$uid] / 100 * $dt3['add_pog2p']);
- $priem->minMana($uid,
- round(round($this->poglast[$uid] / 100 * $dt3['add_pog2p']) * $dt3['add_pog2mp']));
- }
- if (isset($dt3['add_pog2p'])) {
- $yr2 = round($yr2 / 100 * (100 - $dt3['add_pog2p']));
- }
- if ($j['y'] < 0 || ($this->stats[$this->uids[$uid]]['mpNow'] <= 0 && $dt3['add_pog2mp'] > 0)) {
- $dt2 = $this->lookStats($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']);
- if (isset($dt2['endPog']) && $dt2['endPog'] == 1) {
- //
- //
- $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['v2'] . '" LIMIT 1'));
- $this->delPriem($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1],
- $this->users[$this->uids[$uid]], 4, $uid);
- $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1] = 'delete';
- }
- unset($dt2);
- $j['y'] = 0;
- }
- $this->stats[$this->uids[$uid]]['set_pog'][$i]['y'] = $j['y'];
- if (isset($this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'])) {
- $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] = str_replace('add_pog2=$',
- 'add_pog2=' . $j['y'], $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data']);
- mysql_query('UPDATE `eff_users` SET `data` = ' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['data'] . ' WHERE `id` = ' . $this->stats[$this->uids[$uid]]['effects'][$j['id'] - 1]['id']);
- }
-
- if ($j['y'] - $this->poglast[$uid] + $yr2 < 0) {
- $yr -= $yr + ($j['y'] - $this->poglast[$uid] + $yr2);
- $yr2 = $yr;
- $i = count($this->stats[$this->uids[$uid]]['set_pog2']) + 1;
- }
- }
- $i++;
- }
- }
- return $yr2;
- }
-
- /** . */
- private function newRazmen($id)
- {
- $at = [1 => [0], 2 => [0]];
- $uid1 = $this->atacks[$id]['uid1'];
- $uid2 = $this->atacks[$id]['uid2'];
-
- if ($this->atacks[$id]['out1'] == 0) {
- $at[1] = $this->usersTestAtack($id, $uid1, $uid2);
- }
- if ($this->atacks[$id]['out2'] == 0) {
- $at[2] = $this->usersTestAtack($id, $uid2, $uid1);
- }
-
- return $at;
- }
-
- /** 1 2 (?) */
- private function usersTestAtack($id, $uid1, $uid2)
- {
- $r = [];
- $block = [0, 0, 0, 0, 0, 0,];
-
- //
- $i = 1;
- if ($uid1 == $this->atacks[$id]['uid1']) {
- $a = 2;
- $j = $this->atacks[$id]['b2'];
- $atack = [
- 0,
- $this->atacks[$id]['a1'][0],
- $this->atacks[$id]['a1'][1],
- $this->atacks[$id]['a1'][2],
- $this->atacks[$id]['a1'][3],
- $this->atacks[$id]['a1'][4],
- ];
- } elseif ($uid2 == $this->atacks[$id]['uid1']) {
- $a = 1;
- $j = $this->atacks[$id]['b1'];
- $atack = [
- 0,
- $this->atacks[$id]['a2'][0],
- $this->atacks[$id]['a2'][1],
- $this->atacks[$id]['a2'][2],
- $this->atacks[$id]['a2'][3],
- $this->atacks[$id]['a2'][4],
- ];
- }
- if ($this->atacks[$id]['out' . $a] == 0) {
- while ($i <= $this->stats[$this->uids[$uid2]]['zonb']) {
- //echo '{'.$j.'}';
- $block[$j] = 1;
- $j++;
- if ($j > 5 || $j < 1) {
- $j = 1;
- }
- $i++;
- }
- }
- //
- $i = 1;
- while ($i <= $this->stats[$this->uids[$uid1]]['zona']) {
- if (!isset($atack[$i]) || $atack[$i] == 0) {
- $atack[$i] = rand(1, 5);
- }
- if ($atack[$i] > 0) {
- if ($block[$atack[$i]] == 1) {
- //
- // ,
- $r['atack'][] = [$atack[$i], 3, 0];
- } else {
- //
- // ,
- $r['atack'][] = [$atack[$i], 1, 0];
- }
- }
- $i++;
- }
- return $r;
- }
-
- //
-
- /**
- * @param $id
- * @param $uid1
- * @param $uid2
- * @param $atack
- * @return bool (bool)
- */
- public function testRazmenblock1($id, $uid1, $uid2, $atack)
- {
- $block = [];
- //
- $i = 1;
- $j = 0;
- if ($uid1 == $this->atacks[$id]['uid1']) {
- $j = $this->atacks[$id]['b2'];
- } elseif ($uid2 == $this->atacks[$id]['uid1']) {
- $j = $this->atacks[$id]['b1'];
- }
- if ($this->atacks[$id]['out2'] == 0) {
- while ($i <= $this->stats[$this->uids[$uid2]]['zonb']) {
- //echo '{'.$j.'}';
- $block[$j] = 1;
- $j++;
- if ($j > 5 || $j < 1) {
- $j = 1;
- }
- $i++;
- }
- }
- //
- return $atack > 0 && $block[$atack] == 1;
- }
-
- // . ()
- /**
- * private function firstRazmen($id, $at)
- * {
- * $uid1 = $this->atacks[$id]['uid1'];
- * $uid2 = $this->atacks[$id]['uid2'];
- *
- * $i = 1;
- * while ($i <= 2) {
- * if ($i == 1) {
- * $u1 = $uid1;
- * $u2 = $uid2;
- * } else {
- * $u1 = $uid2;
- * $u2 = $uid1;
- * }
- *
- * //
- * $i++;
- * }
- * return $at;
- * }
- */
-
- /** yhod_user.
- * @var int
- */
- private $import_user = 0;
-
- /** */
- private function yhod_user($uid1, $uid2, $type)
- {
- // 1 - . 2 - .
- //
- if ($this->import_user == 0) {
- $r = $uid1;
- $rand_user = false;
- if ($type == 2) {
- // ( )
- $i = 0;
- while ($i < count($this->users)) {
- if ($this->users[$i]['team'] == $this->users[$this->uids[$uid2]]['team']) {
- $rand_user[] = $this->users[$i]['id'];
- }
- $i++;
- }
- } elseif ($type == 4) {
- // ,
- $i = 0;
- while ($i < count($this->users)) {
- //if( $this->users[$i]['team'] == $this->users[$this->uids[$uid1]]['team'] ) {
- $rand_user[] = $this->users[$i]['id'];
- //}
- $i++;
- }
- } elseif ($type == 5) {
- // , ( )
- $i = 0;
- while ($i < count($this->users)) {
- if ($this->users[$i]['team'] == $this->users[$this->uids[$uid2]]['team'] && $uid2 != $this->users[$i]['id']) {
- $rand_user[] = $this->users[$i]['id'];
- }
- $i++;
- }
- } elseif ($type == 6) {
- //
- $i = 0;
- while ($i < count($this->users)) {
- if ($this->users[$i]['team'] != $this->users[$this->uids[$uid2]]['team']) {
- $rand_user[] = $this->users[$i]['id'];
- }
- $i++;
- }
- } elseif ($type > 100) {
- //
- if (!isset($this->users[$this->uids[$type]]) || $this->users[$this->uids[$type]]['id'] != $type) {
- $r = $uid2;
- } else {
- $r = $type;
- }
- }
- if (!empty($rand_user)) {
- $r = $rand_user[rand(0, (count($rand_user) - 1))];
- }
- $this->import_user = $r;
- } else {
- $r = $this->import_user;
- }
- return $r;
- }
-
- /** */
- private function mf1Razmen($id, $at, $v, $pat = false, $rjd = 0)
- {
- if ($pat) {
- $pat = $at;
- $at = $pat['p'];
- } else {
- $pat = false;
- }
-
- $uid1 = $this->atacks[$id]['uid1'];
- $uid2 = $this->atacks[$id]['uid2'];
-
- if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) {
- $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'],
- $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']);
- } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) {
- $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'],
- $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']);
- }
-
- $i = 1;
- while ($i <= 2) {
- if ($i == 1) {
- $a = 1;
- $b = 2;
- $u1 = $uid1;
- $u2 = $uid2;
- } else {
- $a = 2;
- $b = 1;
- $u1 = $uid2;
- $u2 = $uid1;
- }
-
- // (u2) (u1)
- $j = 0;
- $wp01 = 3;
- $k01 = 0;
- if ($rjd > 0) {
- $j = $rjd - 1;
- }
- while ($j < count($at[$a]['atack']) && $j < 8) {
- // ,
- if ($k01 == 0 && isset($this->stats[$this->uids[$u1]]['wp3id'])) {
- //
- $wp01 = 3;
- $k01 = 1;
- } else {
- //
- if (
- isset($this->stats[$this->uids[$u1]]['wp14id']) &&
- $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp14id']]['type'] != 13
- ) {
- $wp01 = 14;
- } else {
- $wp01 = 3;
- }
- $k01 = 0;
- }
- $witm_type01 = 0;
- $witm01 = $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp' . $wp01 . 'id']];
- $witm_data01 = $this->lookStats($witm01['data']);
- if ($at[$a]['atack'][$j][2] == $v) {
- $tyv = $this->mfs(2, [
- 'u1' => $u1,
- 'u2' => $u2,
- 'mf' => $this->stats[$this->uids[$u2]]['m4'],
- 'amf' => (int)$this->stats[$this->uids[$u2]]['m15'],
- 'smf' => ($this->stats[$this->uids[$u1]]['m5'] + $witm_data01['sv_m5']),
- 'asmf' => $this->stats[$this->uids[$u1]]['m21'],
- ], $this->users[$this->uids[$u1]]['level'], $this->users[$this->uids[$u2]]['level']);
- if ($tyv == 1 && $this->atacks[$id]['out' . $b] == 0) {
- //, :)
- $this->stats[$this->uids[$u1]]['nopryh'] = floor(0 + (int)$this->stats[$this->uids[$u1]]['nopryh']);
- if (!isset($this->stats[$this->uids[$u1]]['nopryh']) || $this->stats[$this->uids[$u1]]['nopryh'] <= 0) {
- $at[$a]['atack'][$j][1] = 2;
- } else {
- $this->stats[$this->uids[$u1]]['nopryh']--;
- $this->stats[$this->uids[$u1]]['nopryh_act']++;
- }
- }
- }
- $j++;
- }
- $i++;
- }
- unset($witm01, $witm_type01, $wp01, $k01);
-
- if ($pat) {
- $pat['p'] = $at;
- $at = $pat;
- }
-
- return $at;
- }
-
- /** */
- private function mf2Razmen($id, $at, $v, $pat = false, $rjd = 0)
- {
- global $u;
-
- if ($pat) {
- $pat = $at;
- $at = $pat['p'];
- } else {
- $pat = false;
- }
-
- $uid1 = $this->atacks[$id]['uid1'];
- $uid2 = $this->atacks[$id]['uid2'];
-
- if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) {
- $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'],
- $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']);
- } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) {
- $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'],
- $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']);
- }
-
- $i = 1;
- while ($i <= 2) {
- if ($i == 1) {
- $a = 1;
- $u1 = $uid1;
- $u2 = $uid2;
- } else {
- $a = 2;
- $u1 = $uid2;
- $u2 = $uid1;
- }
-
- // (u1) (u2)
- $j = 0;
- $wp01 = 0;
- $k01 = 0;
- if ($rjd > 0) {
- $j = $rjd - 1;
- }
- while ($j < count($at[$a]['atack']) && $j <= 8) {
- // ,
- if ($k01 == 0 && isset($this->stats[$this->uids[$u1]]['wp3id'])) {
- //
- $wp01 = 3;
- $k01 = 1;
- } else {
- //
- if (
- isset($this->stats[$this->uids[$u1]]['wp14id']) &&
- $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp14id']]['type'] != 13
- ) {
- $wp01 = 14;
- } else {
- $wp01 = 3;
- }
- $k01 = 0;
- }
- $witm_type01 = 0;
- $witm01 = $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp' . $wp01 . 'id']];
- $witm_data01 = $this->lookStats($witm01['data']);
- if ($this->mfs(1, [
- 'u1' => $u1,
- 'u2' => $u2,
- 'mf' => $this->stats[$this->uids[$u1]]['m1'] + $witm_data01['sv_m1'],
- 'amf' => $this->stats[$this->uids[$u1]]['m14'],
- 'smf' => $this->stats[$this->uids[$u2]]['m2'],
- 'aamf1' => (int)$this->stats[$this->uids[$u2]]['enemy_am1'],
- ], $this->users[$this->uids[$u1]]['level'], $this->users[$this->uids[$u2]]['level']) == 1) {
- //, :)
- if ($at[$a]['atack'][$j][1] == 3) {
- //
- $at[$a]['atack'][$j][1] = 4; //
- } elseif ($at[$a]['atack'][$j][1] != 2 && $at[$a]['atack'][$j][1] != 6 && $at[$a]['atack'][$j][1] != 7 && $at[$a]['atack'][$j][1] != 8) {
- //
- $at[$a]['atack'][$j][1] = 5;
- } else {
- $at[$a]['atack'][$j][1] = 1;
- }
- }
- $j++;
- }
- $i++;
- }
- unset($witm01, $witm_type01, $k01, $wp01);
-
- if ($pat) {
- $pat['p'] = $at;
- $at = $pat;
- }
-
- return $at;
- }
-
- /** */
- private function mf3Razmen($id, $at, $v, $pat = false, $rjd = 0)
- {
- if ($pat) {
- $pat = $at;
- $at = $pat['p'];
- } else {
- $pat = false;
- }
-
- $uid1 = $this->atacks[$id]['uid1'];
- $uid2 = $this->atacks[$id]['uid2'];
-
- if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) {
- $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'],
- $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']);
- } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) {
- $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'],
- $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']);
- }
-
- $i = 1;
- while ($i <= 2) {
- if ($i == 1) {
- $a = 1;
- $b = 2;
- $u1 = $uid1;
- $u2 = $uid2;
- } else {
- $a = 2;
- $b = 1;
- $u1 = $uid2;
- $u2 = $uid1;
- }
-
- // (u2) (u1)
- //print_r( $at[$i] );
- $j = 0;
- if ($rjd > 0) {
- $j = $rjd - 1;
- }
- while ($j < count($at[$a]['atack']) && $j < 8) {
- // ,
- if ((!isset($this->stats[$this->uids[$u2]]['no_pr1']) || $this->stats[$this->uids[$u2]]['no_pr1'] == 0) && $at[$a]['atack'][$j][2] == $v) {
- if ($this->mfs(3, [
- 'u1' => $u1,
- 'u2' => $u2,
- '1' => $this->stats[$this->uids[$u2]]['m7'],
- '2' => $this->stats[$this->uids[$u1]]['m7'],
- ], $this->users[$this->uids[$u1]]['level'],
- $this->users[$this->uids[$u2]]['level']) == 1 && $this->atacks[$id]['out' . $b] == 0) {
- //, :)
- $this->stats[$this->uids[$u1]]['nopryh'] = floor(0 + (int)$this->stats[$this->uids[$u1]]['nopryh']);
- if ((!isset($this->stats[$this->uids[$u1]]['nopryh']) || $this->stats[$this->uids[$u1]]['nopryh'] == 0) && $this->stats[$this->uids[$u1]]['nopryh_act'] < 1) {
- $at[$a]['atack'][$j][1] = 6;
- $this->stats[$this->uids[$u1]]['nopryh']--;
- $this->stats[$this->uids[$u1]]['nopryh_act']++;
- }
- }
- }
- $j++;
- }
- $i++;
- }
-
- if ($pat) {
- $pat['p'] = $at;
- $at = $pat;
- }
-
- return $at;
- }
-
- /** ( ) */
- private function mf4Razmen($id, $at, $v, $pat = false, $rjd = 0)
- {
- if ($pat) {
- $pat = $at;
- $at = $pat['p'];
- } else {
- $pat = false;
- }
-
- $uid1 = $this->atacks[$id]['uid1'];
- $uid2 = $this->atacks[$id]['uid2'];
-
- if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) {
- $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'],
- $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']);
- } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) {
- $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'],
- $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']);
- }
-
- $i = 1;
- while ($i <= 2) {
- if ($i == 1) {
- $a = 1;
- $b = 2;
- $u1 = $uid1;
- $u2 = $uid2;
- } else {
- $a = 2;
- $b = 1;
- $u1 = $uid2;
- $u2 = $uid1;
- }
- if ($this->stats[$this->uids[$u2]]['sheld1'] > 0) {
- // (u2) (u1)
- //print_r( $at[$i] );
- $j = 0;
- while ($j < count($at[$a]['atack']) && $j < 8) {
- // ,
- if ($at[$a]['atack'][$j][2] == $v && $this->mfs(5,
- ($this->stats[$this->uids[$u2]]['m8'] / 2 + $this->stats[$this->uids[$u2]]['m18']),
- $this->users[$this->uids[$u1]]['level'],
- $this->users[$this->uids[$u2]]['level']) == 1 && $this->atacks[$id]['out' . $b] == 0) {
- // , :)
- $at[$a]['atack'][$j][1] = 7;
- }
- $j++;
- }
- }
- $i++;
- }
-
- if ($pat) {
- $pat['p'] = $at;
- $at = $pat;
- }
-
- return $at;
- }
-
- /** */
- private function mf5Razmen($id, $at, $v, $rjd = 0)
- {
- $uid1 = $this->atacks[$id]['uid1'];
- $uid2 = $this->atacks[$id]['uid2'];
-
- if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) {
- $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'],
- $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']);
- } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) {
- $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'],
- $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']);
- }
-
- $i = 1;
- while ($i <= 2) {
- if ($i == 1) {
- $a = 1;
- $b = 2;
- $u1 = $uid1;
- $u2 = $uid2;
- } else {
- $a = 2;
- $b = 1;
- $u1 = $uid2;
- $u2 = $uid1;
- }
-
- // (u2) (u1)
- $j = 0;
- if ($rjd > 0) {
- $j = $rjd - 1;
- }
- while ($j < count($at[$a]['atack']) && $j < 8) {
- // ,
- if ($at[$a]['atack'][$j][2] == $v && $at[$a]['atack'][$j][1] == 2 && $this->mfs(6, [
- 'u1' => $u1,
- 'u2' => $u2,
- 'a' => $this->stats[$this->uids[$u2]]['m6'],
- 'b' => $this->stats[$this->uids[$u1]]['m6'],
- ], $this->users[$this->uids[$u1]]['level'], $this->users[$this->uids[$u2]]['level']) == 1) {
- //, :)
- $at[$a]['atack'][$j][1] = 8;
- $rnd_a = rand(1, 5);
- $rjd = count($at[$b]['atack']);
- if (!$this->testRazmenblock1($id, $u2, $u1, $rnd_a)) {
- $at[$b]['atack'][] = [$rnd_a, 1, 0, 1]; // 3 , 0 , 1
- } else {
- $at[$b]['atack'][] = [$rnd_a, 3, 0, 1]; // 3 , 0 , 1
- }
- $at = $this->contrRestart($id, $at, 1, $rjd);
- }
- $j++;
- }
- $i++;
- }
- return $at;
- }
-
- //
- public function addlt($a, $id, $s, $rnd = null)
- {
- global $log_text;
- if (is_null($rnd)) {
- $rnd = rand(0, (count($log_text[$s][$id]) - 1));
- }
- return '{' . $a . 'x' . $id . 'x' . $rnd . '}';
- }
-
- private function addNewStatDb($id)
- {
- mysql_query('INSERT INTO `battle_stat`
- ( `battle`,`uid1`,`uid2`,`time`,`type`,`a`,`b`,`ma`,`mb`,`type_a`,`type_b`,`yrn`,`yrn_krit`,`tm1`,`tm2` ) VALUES (
- ' . $this->info['id'] . ',
- ' . $id['uid1'] . ',
- ' . $id['uid2'] . ',
- ' . $id['time'] . ',
- ' . $id['type'] . ',
- ' . $id['a'] . ',
- ' . $id['b'] . ',
- ' . $id['ma'] . ',
- ' . $id['mb'] . ',
- ' . $id['type_a'] . ',
- ' . $id['type_b'] . ',
- ' . $id['yrn'] . ',
- ' . $id['yrn_krit'] . ',
- ' . $id['tm1'] . ',
- ' . $id['tm2'] . '
- )');
- }
-
- //
- public function addNewStat($stat)
- {
- if (isset($stat[1])) {
- $this->addNewStatDb($stat[1]);
- }
- if (isset($stat[2])) {
- $this->addNewStatDb($stat[2]);
- }
- }
-
- //
- private function addlogRazmen($id, $at)
- {
- $this->hodID++;
-
- $uid1 = $this->atacks[$id]['uid1'];
- $uid2 = $this->atacks[$id]['uid2'];
-
- $dies = [
- 1 => 0,
- 2 => 0,
- ];
-
- //
- $stat = [
- 1 => [
- 'uid1' => 0,
- 'uid2' => 0,
- 'time' => time(),
- 'type' => 0,
- 'a' => '00000',
- 'b' => '0',
- 'type_a' => '',
- 'type_b' => '0',
- 'yrn' => 0,
- 'yrn_krit' => 0,
- 'ma' => 0,
- 'mb' => 0,
- 'tm1' => 0,
- 'tm2' => 0,
- ],
- 2 => [
- 'uid1' => 0,
- 'uid2' => 0,
- 'time' => time(),
- 'type' => 0,
- 'a' => '00000',
- 'b' => '0',
- 'type_a' => '',
- 'type_b' => '0',
- 'yrn' => 0,
- 'yrn_krit' => 0,
- 'ma' => 0,
- 'mb' => 0,
- 'tm1' => 0,
- 'tm2' => 0,
- ],
- ];
-
- $i = 1;
- while ($i <= 2) {
- if ($i == 1) {
- $a = 1;
- $b = 2;
- $u1 = $uid1;
- $u2 = $uid2;
- } else {
- $a = 2;
- $b = 1;
- $u1 = $uid2;
- $u2 = $uid1;
- }
-
- if ($this->stats[$this->uids[$u2]]['yhod'] > 0) {
- $u2 = $this->yhod_user($u1, $u2, $this->stats[$this->uids[$u2]]['yhod']);
- }
-
- $s1 = $this->users[$this->uids[$u1]]['sex'];
- $s2 = $this->users[$this->uids[$u2]]['sex'];
-
- $stat[$a]['uid1'] = $u1;
- $stat[$a]['uid2'] = $u2;
- $stat[$a]['ma'] = $this->stats[$this->uids[$u1]]['zona'];
- $stat[$a]['mb'] = $this->stats[$this->uids[$u1]]['zonb'];
- $stat[$a]['tm1'] = $this->users[$this->uids[$u1]]['team'];
- $stat[$a]['tm2'] = $this->users[$this->uids[$u2]]['team'];
- $stat[$a]['a'] = $this->atacks[$id]['a' . $a];
- $stat[$a]['b'] = $this->atacks[$id]['b' . $a];
-
- $vLog =
- 'at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] .
- '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] .
- '||bl1=' . $this->atacks[$id]['b' . $a] .
- '||bl2=' . $this->atacks[$id]['b' . $b] .
- '||time1=' . $this->atacks[$id]['time'] .
- '||time2=' . $this->atacks[$id]['time2'] .
- '||s' . $a . '=' . $s1 .
- '||s' . $b . '=' . $s2 .
- '||t2=' . $this->users[$this->uids[$u2]]['team'] .
- '||t1=' . $this->users[$this->uids[$u1]]['team'] .
- '||login1=' . $this->users[$this->uids[$u1]]['login2'] .
- '||login2=' . $this->users[$this->uids[$u2]]['login2'];
-
- $mas = [
- 'text' => '',
- 'time' => time(),
- 'battle' => $this->info['id'],
- 'id_hod' => $this->hodID,
- 'vars' => $vLog,
- 'type' => 1,
- ];
-
- if (!isset($at[$a]['atack'])) { //
- if ($this->atacks[$id]['tpo' . $a] == 2) {
- $mas['text'] .= '{u1} .';
- } else {
- //
- if ($this->info['razdel'] == 0 && $this->info['dn_id'] == 0 && $this->info['izlom'] == 0) {
- mysql_query('INSERT INTO `battle_out` (`battle`,`uid1`,`uid2`,`time`,`out`) VALUES (
- ' . $this->info['id'] . ',' . $u1 . ',' . $u2 . ', unix_timestamp(), 1)');
- }
- //
- if (isset($u1)) {
- $mas['text'] .= '{u1} .';
- //
- mysql_query('update eff_users set `delete` = unix_timestamp() where `uid` = ' . $u1 . ' AND `delete` = 0 AND `v1` = "priem" AND v2 in (288, 287, 286, 273) LIMIT 1');
- }
- }
- $mas['text'] = '{tm1} ' . $mas['text'];
- $this->add_log($mas);
- } else {
- $j = 0;
- while ($j < count($at[$a]['atack']) && $j < 8) {
- //
- $mas['text'] = '';
- //
- $wt = [
- 21 => 4,
- 22 => 5,
- 20 => 2,
- 28 => 2,
- 19 => 3,
- 18 => 1,
- 26 => 22,
- ];
- $par = [
- 'zona' => '{zn2_' . $at[$a]['atack'][$j][0] . '} ',
- 'kyda' => $this->lg_zon[$at[$a]['atack'][$j][0]][rand(0,
- (count($this->lg_zon[$at[$a]['atack'][$j][0]]) - 1))],
- 'chem' => $this->lg_itm[$wt[$at[$a]['atack'][$j]['wt']]][rand(0,
- (count($this->lg_itm[$wt[$at[$a]['atack'][$j]['wt']]]) - 1))],
- ];
- //
- $this->atacks[$id]['uid_' . $u1 . '_t' . $at[$a]['atack'][$j][1]]++;
-
- //
- if ($at[$a]['atack'][$j][1] == 1 || $at[$a]['atack'][$j][1] == 5) {
- //u1 u2
- //u1 u2
- $mas['text'] .=
- $par['zona'] . '{u2} ' .
- $this->addlt($b, 1, $s2) .
- $this->addlt($b, 2, $s2) .
- $this->addlt($a, 3, $s1) . ' {u1} ' .
- $this->addlt($a, 4, $s1) .
- $this->addlt($a, 5, $s1) .
- $this->addlt($a, 6, $s1) . ' ' .
- $this->addlt(1, 7, $s1, $at[$a]['atack'][$j]['yron']['t']) . ' ' .
- $par['chem'] . ' ' . $par['kyda'] . '. ';
- } elseif ($at[$a]['atack'][$j][1] == 2) {
- //u2 u1
- $mas['text'] .=
- $par['zona'] . '{u1} ' .
- $this->addlt($a, 8, $s1) .
- $this->addlt($a, 9, $s1) . ' {u2}
' .
- $this->addlt($b, 11, $s2) . ' ' .
- $par['chem'] . ' ' . $par['kyda'] . '. ';
- } elseif ($at[$a]['atack'][$j][1] == 3) {
- //u2 u1
- $mas['text'] .= $par['zona'] . '{u1} ' .
- $this->addlt($a, 8, $s1) .
- $this->addlt($a, 9, $s1) . ' {u2}
' .
- $this->addlt($b, 10, $s2) . ' ' .
- $this->addlt(1, 7, $s1, $at[$a]['atack'][$j]['yron']['t']) . ' ' .
- $par['chem'] . ' ' . $par['kyda'] . '. ';
- } elseif ($at[$a]['atack'][$j][1] == 4) {
- //u1 u2
- if (isset($at[$a]['atack'][$j]['yron']['t'])) {
- $mas['text'] .=
- $par['zona'] . '{u2} ' .
- $this->addlt($b, 1, $s2) .
- $this->addlt($b, 2, $s2) .
- $this->addlt($a, 3, $s1) . ' {u1} ' .
- $this->addlt($a, 4, $s1) .
- $this->addlt($a, 5, $s1) . ',
, ' .
- $this->addlt($a, 6, $s1) . ' ' .
- $this->addlt(1, 7, $s1, $at[$a]['atack'][$j]['yron']['t']) . ' ' .
- $par['chem'] . ' ' . $par['kyda'] . '. ';
- }
- } elseif ($at[$a]['atack'][$j][1] == 6) {
- //u2 u1
- $mas['text'] .=
- $par['zona'] . '{u1} ' .
- $this->addlt($a, 8, $s1) .
- $this->addlt($a, 9, $s1) . ' {u2}
' .
- $this->addlt(1, 7, $s1, $at[$a]['atack'][$j]['yron']['t']) . ' ' .
- $par['chem'] . ' ' . $par['kyda'] . '. ';
- } elseif ($at[$a]['atack'][$j][1] == 7) {
- //u2 u1
- $mas['text'] .=
- $par['zona'] . '{u1} ' .
- $this->addlt($a, 8, $s1) .
- $this->addlt($a, 9, $s1) . ' {u2},
, ' .
- $this->addlt($b, 10, $s2) . ' ' .
- $this->addlt(1, 7, $s1, $at[$a]['atack'][$j]['yron']['t']) . ' ' .
- $par['chem'] . ' ' . $par['kyda'] . '. ';
- } elseif ($at[$a]['atack'][$j][1] == 8) {
- //u2 u1
- $mas['text'] .=
- $par['zona'] . '{u1} ' .
- $this->addlt($a, 8, $s1) .
- $this->addlt($a, 9, $s1) . ' {u2}
' .
- $this->addlt($b, 11, $s2) . ' ' .
- $par['chem'] . ' ' . $par['kyda'] . ' . ';
- }
-
- $stat[$a]['type_a'] .= '' . $at[$a]['atack'][$j][1];
- if (
- (!isset($this->stats[$this->uids[$u2]]['notravma']) || $this->stats[$this->uids[$u2]]['notravma'] == 0) &&
- isset($at[$a]['atack'][$j]['yron']['travma']) &&
- $at[$a]['atack'][$j]['yron']['travma'][0] > 0 &&
- floor($at[$a]['atack'][$j]['yron']['hp']) <= 0
- ) {
- $tr_pl = mysql_fetch_array(mysql_query('SELECT `id`,`v1` FROM `eff_users` WHERE `id_eff` = 4 AND `uid` = ' . $u2 . ' AND `delete` = 0 ORDER BY `v1` DESC LIMIT 1'));
- if (!isset($tr_pl['id']) || $tr_pl['v1'] < 3) {
- //263
- if (isset($tr_pl['id'])) {
- $at[$a]['atack'][$j]['yron']['travma'][0] = rand(($tr_pl['v1'] + 1), 3);
- }
- $tr_pl2 = mysql_fetch_array(mysql_query('SELECT `id` FROM `eff_users` WHERE `uid` = ' . $u2 . ' AND `delete` = 0 AND `name` LIKE "% %" limit 1'));
- if (!isset($tr_pl2['id']) && $at[$a]['atack'][$j]['yron']['travma'][0] <= 3) {
- $mas['text'] = rtrim($mas['text'], '. ');
- $mas['text'] .= ',
';
- if ($at[$a]['atack'][$j]['yron']['travma'][0] == 1) {
- $mas['text'] .= '';
- $this->addTravm($u2, 1, rand(3, 5));
- } elseif ($at[$a]['atack'][$j]['yron']['travma'][0] == 2) {
- $mas['text'] .= '';
- $this->addTravm($u2, 2, rand(3, 5));
- } elseif ($at[$a]['atack'][$j]['yron']['travma'][0] == 3) {
- $mas['text'] .= '';
- $this->addTravm($u2, 3, rand(3, 5));
- }
- $mas['text'] .= ' . ';
- }
- }
- unset($tr_pl);
- }
- if ($at[$a]['atack'][$j]['yron']['pb'] == 1 && isset($at[$a]['atack'][$j]['yron']['hp'])) {
- $mas['text'] = rtrim($mas['text'], '. ');
- $mas['text'] .= '
. ';
- }
- if ($at[$a]['atack'][$j][3] == 1) {
- $mas['text'] .= '() ';
- }
- if (isset($at[$a]['atack'][$j]['yron'])) {
- if ($at[$a]['atack'][$j]['yron']['w'] == 3) {
- $mas['textWP'] = '( )';
- } elseif ($at[$a]['atack'][$j]['yron']['w'] == 14) {
- $mas['textWP'] = '( )';
- } else {
- $mas['textWP'] = '( )';
- }
- if (
- ($at[$a]['atack'][$j][1] == 4 || $at[$a]['atack'][$j][1] == 5 || $at[$a]['atack'][$j][1] == 1) &&
- $at[$a]['atack'][$j]['yron']['y'] < 1
- ) {
- $at[$a]['atack'][$j]['yron']['r'] = '--';
- }
- if ($at[$a]['atack'][$j][1] == 4 || $at[$a]['atack'][$j][1] == 5) {
- $stat[$a]['yrn_krit'] += -$at[$a]['atack'][$j]['yron']['r'];
- $mas['text'] .= '
' . $at[$a]['atack'][$j]['yron']['r'] . ' ';
- } else {
- $mas['text'] .= '
' . $at[$a]['atack'][$j]['yron']['r'] . ' ';
- }
- $stat[$a]['yrn'] += -$at[$a]['atack'][$j]['yron']['r'];
- }
- if (isset($at[$a]['atack'][$j]['yron']['hp'])) {
- if ($this->users[$this->uids[$u2]]['align'] == 9) {
- $at[$a]['atack'][$j]['yron']['hp'] = $at[$a]['atack'][$j]['yron']['hp'] / ($at[$a]['atack'][$j]['yron']['hpAll'] / 100);
- $at[$a]['atack'][$j]['yron']['hpAll'] = '100%';
- }
- $mas['text'] .= ' [' . floor($at[$a]['atack'][$j]['yron']['hp']) . '/' . floor($at[$a]['atack'][$j]['yron']['hpAll']) . ']';
- }
- //
- if ($mas['text'] != '') {
- $mas['text'] = '{tm1} ' . $mas['text'];
- }
-
- if (count($at[$a]['atack'][$j]['yron']['plog']) > 0) {
- $il = 0;
- while ($il <= count($at[$a]['atack'][$j]['yron']['plog'])) {
- if (isset($at[$a]['atack'][$j]['yron']['plog'][$il])) {
- eval($at[$a]['atack'][$j]['yron']['plog'][$il]);
- }
- $il++;
- }
- }
- $this->add_log($mas);
- $j++;
- }
- }
- $i++;
- }
-
- // + _
- $this->addNewStat($stat);
-
- //
- if (floor($this->stats[$this->uids[$u1]]['hpNow']) < 1) {
- $dies[1] = 1;
- }
- if (floor($this->stats[$this->uids[$u2]]['hpNow']) < 1) {
- $dies[2] = 1;
- }
- if ($dies[1] > 0 || $dies[2] > 0) {
- $rtngwin = [1, 2, 3, 5, 10, 20, 40, 80, 160];
- $rtnglos = [0, 0, 0, -1, -2, -5, -10, -20, -40];
-
- if ($this->info['typeBattle'] == 99) {
- if ($btlstatus[0] == 0) {
- //
- $rtngwin = [2, 4, 6, 10, 20, 40, 80, 160, 320];
- if ($this->info['razdel'] == 5) {
- //
- $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80];
- } else {
- //
- $rtnglos = [0, 0, 0, 0, 0, 0, 0, 0, 0];
- }
- } elseif ($btlstatus[0] == 25) {
- //
- $rtngwin = [3, 6, 9, 15, 30, 60, 120, 240, 480];
- $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80];
- } elseif ($btlstatus[0] == 50) {
- //
- $rtngwin = [4, 8, 16, 32, 64, 128, 256, 512, 1024];
- $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80];
- } elseif ($btlstatus[0] == 75) {
- //
- $rtngwin = [5, 10, 20, 40, 80, 160, 320, 640, 1280];
- $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80];
- } elseif ($btlstatus[0] == 100) {
- //
- $rtngwin = [6, 12, 24, 48, 98, 196, 392, 784, 1568];
- $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80];
- } elseif ($btlstatus[0] == 150) {
- //
- $rtngwin = [7, 14, 28, 56, 112, 224, 448, 896, 1792];
- $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80];
- }
- } else {
- if ($btlstatus[0] == 0) {
- //
- if ($this->info['razdel'] != 5) {
- //
- $rtnglos = [0, 0, 0, 0, 0, 0, 0, 0, 0];
- }
- } elseif ($btlstatus[0] == 25) {
- //
- $rtngwin = [2, 4, 6, 10, 20, 40, 80, 160, 320];
- $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80];
- } elseif ($btlstatus[0] == 50) {
- //
- $rtngwin = [3, 6, 9, 15, 30, 60, 120, 240, 480];
- $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80];
- } elseif ($btlstatus[0] == 75) {
- //
- $rtngwin = [4, 8, 16, 32, 64, 128, 256, 512, 1024];
- $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80];
- } elseif ($btlstatus[0] == 100) {
- //
- $rtngwin = [5, 10, 20, 40, 80, 160, 320, 640, 1280];
- $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80];
- } elseif ($btlstatus[0] == 150) {
- //
- $rtngwin = [7, 14, 28, 56, 112, 224, 448, 896, 1792];
- $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80];
- }
- }
-
- if ($this->info['dn_id'] > 0 || $this->info['izlom'] != 0 || $this->info['turnir'] != 0) {
- // ,
- $rtngwin = [0, 0, 0, 0, 0, 0, 0, 0, 0];
- $rtnglos = [0, 0, 0, 0, 0, 0, 0, 0, 0];
- } elseif ($this->info['clan1'] > 0 && $this->info['clan2'] > 0) {
- //
- $rtngwin = [3, 6, 9, 15, 30, 60, 120, 240, 480];
- $rtnglos = [-1, -2, -4, -8, -16, -32, -64, -128, -256];
- }
-
- if ($dies[1] == 1) {
- if ($this->info['dn_id'] > 0) {
- //
- } else {
- if ($this->users[$this->uids[$u1]]['level'] >= 4) {
- $rtng1 += $rtnglos[$this->users[$this->uids[$u1]]['level'] - 4];
- $rtng2 += $rtngwin[$this->users[$this->uids[$u1]]['level'] - 4];
- }
- }
- // 1 2
- $this->spaCheck($this->users[$this->uids[$u1]]['id']);
- }
- if ($dies[2] == 1) {
- if ($this->info['dn_id'] > 0) {
- //
- } else {
- if ($this->users[$this->uids[$u1]]['level'] >= 4) {
- $rtng1 += $rtnglos[$this->users[$this->uids[$u1]]['level'] - 4];
- $rtng2 += $rtngwin[$this->users[$this->uids[$u1]]['level'] - 4];
- }
- }
- // 2 1
- $this->spaCheck($this->stats[$this->uids[$u2]]['id']);
- }
- //
- //
- if (
- $this->info['type'] != 564 &&
- $this->stats[$this->uids[$u1]]['inTurnir'] == 0 &&
- $this->stats[$this->uids[$u2]]['inTurnir'] == 0 &&
- $this->info['dn_id'] == 0 &&
- $this->info['izlom'] == 0
- ) {
- //
- if ($this->users[$this->uids[$u2]]['bot'] == 0) {
- mysql_query('INSERT INTO `users_reting` (`uid`,`time`,`val`,`align`,`clan`) VALUES (
- ' . $u1 . ',
- unix_timestamp(),
- ' . $rtng1 . ',
- ' . $this->users[$this->uids[$u1]]['align'] . ',
- ' . $this->users[$this->uids[$u1]]['clan'] . ')
- ');
- }
- unset($rtng);
- if ($this->users[$this->uids[$u1]]['bot'] == 0) {
- mysql_query('INSERT INTO `users_reting` (`uid`,`time`,`val`,`align`,`clan`) VALUES (
- ' . $u2 . ',
- unix_timestamp(),
- ' . $rtng2 . ',
- ' . $this->users[$this->uids[$u2]]['align'] . ',
- ' . $this->users[$this->uids[$u2]]['clan'] . ')
- ');
- }
- }
- unset($rtng1, $rtng2);
- }
- }
-
- //
- public function priemAddLog($id, $a, $b, $u1, $u2, $prm, $text, $hodID, $tm1 = 0, $tm2 = 0)
- {
- if ($tm1 === 0) {
- if (isset($this->atacks[$id])) {
- $tm1 = $this->atacks[$id]['time'];
- } else {
- $tm1 = time();
- }
- }
- if ($tm2 === 0) {
- if (isset($this->atacks[$id])) {
- $tm2 = $this->atacks[$id]['time2'];
- } else {
- $tm2 = time();
- }
- }
- $vLog =
- 'prm=' . $prm .
- '||at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] .
- '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] .
- '||bl1=' . $this->atacks[$id]['b' . $a] .
- '||bl2=' . $this->atacks[$id]['b' . $b] .
- '||time1=' . $tm1 .
- '||time2=' . $tm2 .
- '||s' . $a . '=' . $this->users[$this->uids[$u1]]['sex'] .
- '||s' . $b . '=' . $this->users[$this->uids[$u2]]['sex'] .
- '||t2=' . $this->users[$this->uids[$u2]]['team'] .
- '||t1=' . $this->users[$this->uids[$u1]]['team'] .
- '||login1=' . $this->users[$this->uids[$u1]]['login2'] .
- '||login2=' . $this->users[$this->uids[$u2]]['login2'];
- $mas = [
- 'text' => $text,
- 'time' => time(),
- 'battle' => $this->info['id'],
- 'id_hod' => $hodID,
- 'vars' => $vLog,
- 'type' => 1,
- ];
- $this->add_log($mas);
- }
-
- // ( )
- public function priemAddLogFast($u1, $u2, $prm, $text, $hodID, $tm)
- {
- $vLog =
- 'prm=' . $prm .
- '||time1=' . $tm .
- '||time2=' . $tm .
- '||s1=' . $this->users[$this->uids[$u1]]['sex'] .
- '||s2=' . $this->users[$this->uids[$u2]]['sex'] .
- '||t2=' . $this->users[$this->uids[$u2]]['team'] .
- '||t1=' . $this->users[$this->uids[$u1]]['team'] .
- '||login1=' . $this->users[$this->uids[$u1]]['login2'] .
- '||login2=' . $this->users[$this->uids[$u2]]['login2'];
- $mas = [
- 'text' => $text,
- 'time' => time(),
- 'battle' => $this->info['id'],
- 'id_hod' => ($this->hodID + $hodID),
- 'vars' => $vLog,
- 'type' => 1,
- ];
- $this->add_log($mas);
- }
-
- //
- private function contrRestart($id, $at, $v, $rjd = 0)
- {
- //
- $at = $this->mf1Razmen($id, $at, $v, true, $rjd);
- //
- $at = $this->mf3Razmen($id, $at, $v, true, $rjd);
- //
- //$at = $this->mf5Razmen($id,$at,$v,true,$rjd);
- // ( , )
- $at = $this->mf4Razmen($id, $at, $v, true, $rjd);
- //
- //$at = $this->yronRazmen($id,$at);
- //
- $at = $this->mf2Razmen($id, $at, $v, true, $rjd);
-
- return $this->yronRazmen($id, $at, true, $rjd);
- }
-
- // .
- public function yronGetrazmen($uid1, $uid2, $wp, $zona)
- {
- global $u;
- $r = ['r' => '--',];
- //
- /*
-
-
-
-
- */
- $witm = 0;
- $witm_type = 0;
-
- if ($wp > 0) {
- $witm = $this->stats[$this->uids[$uid1]]['items'][$this->stats[$this->uids[$uid1]]['wp' . $wp . 'id']];
- $witm_data = $this->lookStats($witm['data']);
- $witm_type = $this->weaponTx($witm);
- }
-
- if ($witm_type == 0 || $witm_type == 12) {
- $witm_type2 = '';
- } else {
- $witm_type2 = $witm_type;
- }
- $r['t'] = $witm_type2;
- //
- /*
-
-
-
-
-
- */
- $bron = [
- 1 => [$this->stats[$this->uids[$uid2]]['mib1'], $this->stats[$this->uids[$uid2]]['mab1']],
- 2 => [$this->stats[$this->uids[$uid2]]['mib2'], $this->stats[$this->uids[$uid2]]['mab2']],
- 3 => [$this->stats[$this->uids[$uid2]]['mib2'], $this->stats[$this->uids[$uid2]]['mab2']],
- 4 => [$this->stats[$this->uids[$uid2]]['mib3'], $this->stats[$this->uids[$uid2]]['mab3']],
- 5 => [$this->stats[$this->uids[$uid2]]['mib4'], $this->stats[$this->uids[$uid2]]['mab4']],
- ];
- //
- //
- //$witm_data
- $iii = 1;
- while ($iii <= 7) {
- if (isset($witm_data['sv_a' . $iii]) && $witm_data['sv_a' . $iii] != 0) {
- $this->stats[$this->uids[$uid1]]['a' . $iii] += $witm_data['sv_a' . $iii];
- }
- if (isset($witm_data['sv_mg' . $iii]) && $witm_data['sv_mg' . $iii] != 0) {
- $this->stats[$this->uids[$uid1]]['mg' . $iii] += $witm_data['sv_mg' . $iii];
- }
- $iii++;
- }
- $iii = 1;
- while ($iii <= 4) {
- if (isset($witm_data['sv_aall']) && $witm_data['sv_aall'] != 0) {
- $this->stats[$this->uids[$uid1]]['a' . $iii] += $witm_data['sv_aall'];
- }
- $iii++;
- }
- $iii = 1;
- while ($iii <= 4) {
- if (isset($witm_data['sv_mall']) && $witm_data['sv_mall'] != 0) {
- $this->stats[$this->uids[$uid1]]['mg' . $iii] += $witm_data['sv_mall'];
- }
- $iii++;
- }
- $iii = 1;
- while ($iii <= 7) {
- if (isset($witm_data['sv_m2all']) && $witm_data['sv_m2all'] != 0) {
- $this->stats[$this->uids[$uid1]]['mg' . $iii] += $witm_data['sv_m2all'];
- }
- $iii++;
- }
-
- if (isset($witm_data['sv_m3']) && $witm_data['sv_m3'] != 0) {
- $this->stats[$this->uids[$uid1]]['m3'] += $witm_data['sv_m3'];
- }
-
- $iii = 1;
- while ($iii <= 7) {
- if (isset($witm_data['sv_pa' . $iii]) && $witm_data['sv_pa' . $iii] != 0) {
- $this->stats[$this->uids[$uid1]]['pa' . $iii] += $witm_data['sv_pa' . $iii] + $witm_data['sv_m10'];
- }
- if (isset($witm_data['sv_pm' . $iii]) && $witm_data['sv_pm' . $iii] != 0) {
- $this->stats[$this->uids[$uid1]]['pm' . $iii] += $witm_data['sv_pm' . $iii] + $witm_data['sv_m11a'];
- if ($iii < 5) {
- $this->stats[$this->uids[$uid1]]['pm' . $iii] += $witm_data['sv_m11'];
- }
- }
- $iii++;
- }
- // +
- $wAp = 0;
-
- if ($witm_type == 12) {
- //
- $wAp += $this->stats[$this->uids[$uid1]]['m10'];
- if ($this->users[$this->uids[$uid1]]['align'] == 7) {
- $wAp += 15;
- }
- } elseif ($witm_type < 5) {
- $wAp += $this->stats[$this->uids[$uid1]]['pa' . $witm_type];
- $wAp -= $this->stats[$this->uids[$uid2]]['antpa' . $witm_type];
- } else {
- $wAp += $this->stats[$this->uids[$uid1]]['m10'] + $this->stats[$this->uids[$uid1]]['pm' . ($witm_type - 4)] + $this->stats[$this->uids[$uid1]]['m11a'] + $witm_data['sv_pm' . ($witm_type - 4)];
- $wAp -= $this->stats[$this->uids[$uid2]]['antpm' . ($witm_type - 4)];
- }
-
- //
- $vladenie = 0;
-
- //
- $proboi = 0;
- $witm_data['m9'] = $this->stats[$this->uids[$uid1]]['m9'];
- if (rand(1, 100) < floor($witm_data['m9'] / 2)) {
- $proboi = floor($witm_data['m9'] / 2);
- $r['pb'] = 1;
- }
-
- $y = $this->yrn(
- $this->stats[$this->uids[$uid1]],
- $this->stats[$this->uids[$uid2]],
- $this->users[$this->uids[$uid1]],
- $this->users[$this->uids[$uid2]],
- $this->users[$this->uids[$uid1]]['level'],
- $this->users[$this->uids[$uid2]]['level'],
- //
- $witm_type,
- $this->stats[$this->uids[$uid1]]['minAtack'], //. ()
- $this->stats[$this->uids[$uid1]]['maxAtack'], //.
- $bron[$zona][0], // .
- $bron[$zona][1], //
- //
- $vladenie, //
- $wAp, //
- (round($this->stats[$this->uids[$uid1]]['m3'])), //
- (($this->stats[$this->uids[$uid2]]['za' . $witm_type2]) - $this->stats[$this->uids[$uid1]]['pza']),
- //
- $this->stats[$this->uids[$uid1]]['ozash'], //
- $proboi, //
- 0, //
- ($witm_data['sv_yron_min'] + $this->stats[$this->uids[$uid1]]['yron_min']),
- ($witm_data['sv_yron_max'] + $this->stats[$this->uids[$uid1]]['yron_max']),
- $this->stats[$this->uids[$uid2]]['zaproc'],
- $this->stats[$this->uids[$uid2]]['zmproc'],
- (($this->stats[$this->uids[$uid2]]['zm' . ($witm_type2 - 4)]) - round($this->stats[$this->uids[$uid1]]['pzm'] * 0.8)),
- //
- $this->stats[$this->uids[$uid1]]['omzash'], //
- $witm['type'],
- $witm
- );
-
- $r['y'] = round(rand($y['min'] + $proboi, $y['max'] + round($proboi / 2)));
- $r['k'] = round(rand($y['Kmin'] + round($proboi / 4), $y['Kmax'] + round($proboi / 8)));
- $r['m_y'] = $y['max'];
- $r['m_k'] = $y['Kmax'];
- $r['bRND'] = $y['bRND'];
- $r['w_type'] = $witm_type;
-
-
- //
- if ($witm['type'] == 18) {
- $tp = 1;
- } elseif ($witm['type'] == 19) {
- $tp = 2;
- } elseif ($witm['type'] == 20) {
- $tp = 3;
- } elseif ($witm['type'] == 21) {
- $tp = 4;
- }
-
- if ($tp != $witm_type && $wp > 0) //
- {
- $r['y'] = round($r['y'] / 3);
- $r['r'] = round($r['r'] / 3);
- $r['k'] = round($r['k'] / 3);
- $r['m_k'] = round($r['m_k'] / 3);
- $r['m_y'] = round($r['m_y'] / 3);
- }
-
- if (isset($this->stats[$this->uids[$uid2]]['zaproc'])) {
- $r['y'] = round($r['y'] - $r['y'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100);
- $r['r'] = round($r['r'] - $r['r'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100);
- $r['k'] = round($r['k'] - $r['k'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100);
- $r['m_k'] = round($r['m_k'] - $r['m_k'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100);
- $r['m_y'] = round($r['m_y'] - $r['m_y'] * $this->stats[$this->uids[$uid2]]['zaproc'] / 100);
- if ($r['k'] < 1) {
- $r['k'] = 2;
- }
- }
-
- if ($r['y'] < 1) {
- $r['y'] = 1;
- }
- if ($r['r'] >= 0) {
- $r['r'] = -1;
- }
- if ($r['k'] < 1) {
- $r['k'] = 1;
- }
- if ($r['m_k'] < 1) {
- $r['m_k'] = 1;
- }
- if ($r['m_y'] < 1) {
- $r['m_y'] = 1;
- }
- return $r;
- }
-
- //
- private function yronRazmen($id, $at, $pat = false, $rjd = 0)
- {
- if ($pat) {
- $pat = $at;
- $at = $pat['p'];
- } else {
- unset($pat);
- }
-
- $uid1 = $this->atacks[$id]['uid1'];
- $uid2 = $this->atacks[$id]['uid2'];
-
- if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) {
- $yhod = [1 => 1, 2 => 0];
- } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) {
- $yhod = [1 => 0, 2 => 1];
- }
-
- $i = 1;
- while ($i <= 2) {
- if ($i == 1) {
- $a = 1;
- $u1 = $uid1;
- $u2 = $uid2;
- } else {
- $a = 2;
- $u1 = $uid2;
- $u2 = $uid1;
- }
-
- //
-
-
- // (u2) (u1)
- $j = 0;
- $k = 0;
- if ($rjd > 0) {
- $j = $rjd - 1;
- }
- //
-
- while ($j < count($at[$a]['atack']) && $j < 8) {
- // ,
- if ($k == 0 && isset($this->stats[$this->uids[$u1]]['wp3id'])) {
- //
- $wp = 3;
- $k = 1;
- } else {
- //
- if (
- isset($this->stats[$this->uids[$u1]]['wp14id']) &&
- $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp14id']]['type'] != 13
- ) {
- $wp = 14;
- } else {
- $wp = 3;
- }
- $k = 0;
- }
- $witm = $this->stats[$this->uids[$u1]]['items'][$this->stats[$this->uids[$u1]]['wp' . $wp . 'id']];
- $witm_type = $this->weaponTx($witm);
- $at[$a]['atack'][$j]['wt'] = $witm['type'];
- //
- $at[$a]['atack'][$j]['yhod'] = $yhod[$a];
-
- if (!isset($at[$a]['atack'][$j]['yron']) && (
- $at[$a]['atack'][$j][1] == 1 ||
- $at[$a]['atack'][$j][1] == 4 ||
- $at[$a]['atack'][$j][1] == 5)
- ) {
- $at[$a]['atack'][$j]['yron'] = $this->yronGetrazmen($u1, $u2, $wp, $at[$a]['atack'][$j][0]);
-
- if ($at[$a]['atack'][$j][1] == 4) {
- $at[$a]['atack'][$j]['yron']['y_old'] = $at[$a]['atack'][$j]['yron']['y'];
- $at[$a]['atack'][$j]['yron']['y'] = round($at[$a]['atack'][$j]['yron']['k'] / 2);
- } elseif ($at[$a]['atack'][$j][1] == 5) {
- $at[$a]['atack'][$j]['yron']['y_old'] = $at[$a]['atack'][$j]['yron']['y'];
- $at[$a]['atack'][$j]['yron']['y'] = $at[$a]['atack'][$j]['yron']['k'];
- }
- $at[$a]['atack'][$j]['yron']['2h'] = $witm['2h'];
- $at[$a]['atack'][$j]['yron']['w'] = $wp;
- if ($at[$a]['atack'][$j]['yron']['y'] < 1) {
- $at[$a]['atack'][$j]['yron']['r'] = '--';
- } else {
- $at[$a]['atack'][$j]['yron']['r'] = '-' . $at[$a]['atack'][$j]['yron']['y'];
- }
- } else {
- $at[$a]['atack'][$j]['block'] = $this->yronGetrazmen($u1, $u2, $wp, $at[$a]['atack'][$j][0]);
-
- if ($at[$a]['atack'][$j][1] == 4) {
- $at[$a]['atack'][$j]['block']['y_old'] = $at[$a]['atack'][$j]['block']['y'];
- $at[$a]['atack'][$j]['block']['y'] = round($at[$a]['atack'][$j]['block']['k'] / 2);
- } elseif ($at[$a]['atack'][$j][1] == 5) {
- $at[$a]['atack'][$j]['block']['y_old'] = $at[$a]['atack'][$j]['block']['y'];
- $at[$a]['atack'][$j]['block']['y'] = $at[$a]['atack'][$j]['block']['k'];
- }
- $at[$a]['atack'][$j]['block']['2h'] = $witm['2h'];
- $at[$a]['atack'][$j]['block']['w'] = $wp;
- if ($at[$a]['atack'][$j]['block']['y'] < 1) {
- $at[$a]['atack'][$j]['block']['r'] = '--';
- } else {
- $at[$a]['atack'][$j]['block']['r'] = '-' . $at[$a]['atack'][$j]['block']['y'];
- }
- }
- $j++;
- }
- $i++;
- }
-
- if ($pat) {
- $pat['p'] = $at;
- $at = $pat;
- }
- return $at;
- }
-
- //
- private function updateHealth($id, $at)
- {
- $uid1 = $this->atacks[$id]['uid1'];
- $uid2 = $this->atacks[$id]['uid2'];
-
- if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) {
- $uid1 = $this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'],
- $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']);
- } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) {
- $uid2 = $this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'],
- $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']);
- }
-
- $i = 1;
- while ($i <= 2) {
- if ($i == 1) {
- $a = 1;
- $b = 2;
- $u1 = $uid1;
- $u2 = $uid2;
- } else {
- $a = 2;
- $b = 1;
- $u1 = $uid2;
- $u2 = $uid1;
- }
-
- //
- if ($this->atacks[$id]['out' . $b] > 0) {
- // ${'u'.$a} ,
- //
- if (rand(0, 100) < min(floor($this->stats[$this->uids[$u1]]['m6'] / 5), 20) &&
- $this->stats[$this->uids[$u2]]['this_animal'] == 0) {
- $this->users[$this->uids[$u1]]['tactic3']++;
- }
- //
- if (rand(0, 100) < min(floor($this->stats[$this->uids[$u1]]['m8'] / 4), 20) &&
- $this->stats[$this->uids[$u2]]['this_animal'] == 0) {
- $this->users[$this->uids[$u1]]['tactic4']++;
- }
- }
-
- // (u2) (u1)
- $j = 0;
- while ($j < count($at[$a]['atack']) && $j < 8) {
- //
- if ($at[$a]['atack'][$j][1] == 1) {
- //u1 u2
- if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) {
- $this->users[$this->uids[$u1]]['tactic1']++;
- }
- //
- if (
- $at[$a]['atack'][$j]['yron']['2h'] == 1 &&
- $this->stats[$this->uids[$u2]]['this_animal'] == 0
- ) {
- $this->users[$this->uids[$u1]]['tactic1'] += 2;
- }
- } elseif ($at[$a]['atack'][$j][1] == 2) {
- //u2 u1
- } elseif ($at[$a]['atack'][$j][1] == 3) {
- //u2 u1
- if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) {
- $this->users[$this->uids[$u2]]['tactic4']++;
- }
- } elseif ($at[$a]['atack'][$j][1] == 4) {
- //u1 u2
- if (
- !isset($at[$a]['atack'][$j]['notactic2']) &&
- $this->stats[$this->uids[$u2]]['this_animal'] == 0
- ) {
- $this->users[$this->uids[$u1]]['tactic2']++;
- }
- $this->users[$this->uids[$u2]]['tactic4']++; //
- } elseif ($at[$a]['atack'][$j][1] == 5) {
- //u1 u2
- if (!isset($at[$a]['atack'][$j]['notactic2'])) {
- if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) {
- $this->users[$this->uids[$u1]]['tactic2'] += 2;
- }
- //
- if (
- $at[$a]['atack'][$j]['yron']['2h'] == 1 &&
- $this->stats[$this->uids[$u2]]['this_animal'] == 0
- ) {
- $this->users[$this->uids[$u1]]['tactic2'] += 1;
- }
- }
- } elseif ($at[$a]['atack'][$j][1] == 6) {
- //u2 u1
- if (
- !isset($at[$a]['atack'][$j]['notactic5']) &&
- $this->stats[$this->uids[$u1]]['this_animal'] == 0
- ) {
- $this->users[$this->uids[$u2]]['tactic5']++;
- }
- } elseif ($at[$a]['atack'][$j][1] == 7) {
- //u2 u1 //
- if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) {
- $this->users[$this->uids[$u2]]['tactic4']++;
- }
- } elseif ($at[$a]['atack'][$j][1] == 8) {
- //u2 u1
- if ($this->stats[$this->uids[$u1]]['this_animal'] == 0) {
- $this->users[$this->uids[$u2]]['tactic3']++;
- }
- }
- // ,
- if (isset($at[$a]['atack'][$j]['yron']) && (
- $at[$a]['atack'][$j][1] == 1 ||
- $at[$a]['atack'][$j][1] == 4 ||
- $at[$a]['atack'][$j][1] == 5)) {
- if ($this->stats[$this->uids[$u2]]['hpNow'] <= $at[$a]['atack'][$j]['yron']['y']) {
- $at[$a]['atack'][$j]['yron']['y'] = $this->stats[$this->uids[$u2]]['hpNow'];
- }
- if ($this->stats[$this->uids[$u2]]['hpNow'] <= $at[$a]['atack'][$j]['yron']['k']) {
- $at[$a]['atack'][$j]['yron']['k'] = $this->stats[$this->uids[$u2]]['hpNow'];
- }
-
- if ($at[$a]['atack'][$j]['yron']['y'] < 0) {
- $at[$a]['atack'][$j]['yron']['y'] = 1;
- $at[$a]['atack'][$j]['yron']['r'] = -1;
- $at[$a]['atack'][$j]['yron']['k'] = 1;
- }
- if ($this->stats[$this->uids[$u2]]['hpNow'] < 1) {
- $at[$a]['atack'][$j]['yron']['y'] = 0;
- $at[$a]['atack'][$j]['yron']['r'] = -1;
- $at[$a]['atack'][$j]['yron']['k'] = 0;
- }
-
- //
- $this->takeExp($u1, $at[$a]['atack'][$j]['yron']['y'], $u1, $u2);
- //
- $this->stats[$this->uids[$u2]]['hpNow'] -= $at[$a]['atack'][$j]['yron']['y'];
- $this->users[$this->uids[$u2]]['last_hp'] = -$at[$a]['atack'][$j]['yron']['y'];
-
- $at[$a]['atack'][$j]['yron']['hp'] = $this->stats[$this->uids[$u2]]['hpNow'];
- if ($at[$a]['atack'][$j]['yron']['hp'] < 1) {
- $at[$a]['atack'][$j]['yron']['hp'] = 0;
- }
- $at[$a]['atack'][$j]['yron']['hpAll'] = $this->stats[$this->uids[$u2]]['hpAll'];
- if ($at[$a]['atack'][$j]['yron']['hp'] > $at[$a]['atack'][$j]['yron']['hpAll']) {
- $at[$a]['atack'][$j]['yron']['hp'] = $at[$a]['atack'][$j]['yron']['hpAll'];
- }
- //
- //
- if (
- rand(0, 100) <= 50 &&
- ($at[$a]['atack'][$j][1] == 4 || $at[$a]['atack'][$j][1] == 5) &&
- !isset($at[$a]['atack'][$j]['yron']['travma']) &&
- rand(0, 1000) < 500 &&
- $this->users[$this->uids[$u2]]['level'] > 1 &&
- $this->stats[$this->uids[$u1]] > 1
- ) {
- $trvm_chns = floor(rand(0, 200) / 10);
- if ($trvm_chns > 3 || $trvm_chns < 1) {
- $trvm_chns = 0;
- }
- $at[$a]['atack'][$j]['yron']['travma'] = [$trvm_chns, ' '];
- unset($trvm_chns);
- }
- }
- $j++;
- }
- $i++;
- }
- return $at;
- }
-
- //
- private function addstatuser($id)
- {
- if (!$id && !is_numeric($id)) {
- return;
- }
-
- mysql_query('INSERT INTO `battle_users`
- ( `battle`,`uid`,`time_enter`,`login`,`level`,`align`,`clan`,`hpAll`,`hp`,`hpStart`,`team` )
- VALUES
- (
- ' . $this->info['id'] . ',
- ' . $id . ',
- unix_timestamp(),
- ' . $this->users[$this->uids[$id]]['login'] . ',
- ' . $this->users[$this->uids[$id]]['level'] . ',
- ' . $this->users[$this->uids[$id]]['align'] . ',
- ' . $this->users[$this->uids[$id]]['clan'] . ',
- ' . $this->stats[$this->uids[$id]]['hpAll'] . ',
- ' . $this->stats[$this->uids[$id]]['hp'] . ',
- ' . $this->stats[$this->uids[$id]]['hpNow'] . ',
- ' . $this->users[$this->uids[$id]]['team'] . '
- )');
- }
-
- //
- public function priemsRazmen($id, $at)
- {
- if ($at == 'fast') {
- $uid1 = $id[0];
- $uid2 = $id[1];
- } else {
- $uid1 = $this->atacks[$id]['uid1'];
- $uid2 = $this->atacks[$id]['uid2'];
- }
- $i = 1;
- while ($i <= 2) {
- if ($i == 1) {
- $u1 = $uid1;
- } else {
- $u1 = $uid2;
- }
-
- //
- $eff = $this->stats[$this->uids[$u1]]['effects'];
- $this->stats[$this->uids[$u1]]['u_priem'] = [];
- $j = 0;
- while ($j <= count($eff)) {
- if (isset($eff[$j]) && $eff[$j]['id_eff'] == 22 && $eff[$j]['v1'] == 'priem' && $eff[$j]['v2'] > 0) {
- $this->stats[$this->uids[$u1]]['u_priem'][] = [
- $j,
- $eff[$j]['v2'],
- $this->prm[$eff[$j]['v2']]['act'],
- $eff[$j]['id'],
- $this->prm[$eff[$j]['v2']]['type_of'],
- $this->prm[$eff[$j]['v2']]['moment'],
- $this->prm[$eff[$j]['v2']]['moment_end'],
- $this->prm[$eff[$j]['v2']]['type_sec'],
- ];
- }
- $j++;
- }
- $i++;
- }
- }
-
- //
- private function priemsRazmenMoment($id, $at)
- {
- $uid1 = $this->atacks[$id]['uid1'];
- $uid2 = $this->atacks[$id]['uid2'];
-
- $i = 1;
- while ($i <= 2) {
- if ($i == 1) {
- $u1 = $uid1;
- $u2 = $uid2;
- } else {
- $u1 = $uid2;
- $u2 = $uid1;
- }
- if (!isset($at['p']['p_cast'])) {
- $at['p'] = $at;
- $at['p']['p_cast'] = true;
- }
- //
-
- //
- if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) {
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 1) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_used_this = $u1;
- $pr_moment = true;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u1, $j);
- unset(${'fx_priem'});
- $this->stats[$this->uids[$u2]]['nopryh']--;
- }
- }
- $j++;
- }
- }
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 2) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_used_this = $u1;
- $pr_moment = true;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u1, $j);
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 3) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_used_this = $u1;
- $pr_moment = true;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- if (isset($fx_priem)) {
- $at = $fx_priem($id, $at, $u1, $j);
- }
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 4) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_used_this = $u1;
- $pr_moment = true;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u1, $j);
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][5] == 5) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_used_this = $u1;
- $pr_moment = true;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u1, $j);
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
- $i++;
- }
- //return $at;
- }
-
- // ( )
- private function priemsRazmenMomentEnd($id, $at)
- {
- $uid1 = $this->atacks[$id]['uid1'];
- $uid2 = $this->atacks[$id]['uid2'];
-
- $i = 1;
- while ($i <= 2) {
- if ($i == 1) {
- $u1 = $uid1;
- $u2 = $uid2;
- } else {
- $u1 = $uid2;
- $u2 = $uid1;
- }
- if (!isset($at['p']['p_cast'])) {
- $at['p'] = $at;
- $at['p']['p_cast'] = true;
- }
- //
-
- //
- if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) {
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 1) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_used_this = $u1;
- $pr_moment = true;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u1, $j);
- unset(${'fx_priem'});
- $this->stats[$this->uids[$u2]]['nopryh']--;
- }
- }
- $j++;
- }
- }
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 2) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_used_this = $u1;
- $pr_moment = true;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u1, $j);
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 3) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_used_this = $u1;
- $pr_moment = true;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- if (isset($fx_priem)) {
- $at = $fx_priem($id, $at, $u1, $j);
- unset(${'fx_priem'});
- }
- }
- }
- $j++;
- }
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 4) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_used_this = $u1;
- $pr_moment = true;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u1, $j);
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][6] == 5) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_used_this = $u1;
- $pr_moment = true;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u1, $j);
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
- $i++;
- }
- //return $at;
- }
-
-
- //
- private function priemsTestRazmen($id, $at)
- {
- $uid1 = $this->atacks[$id]['uid1'];
- $uid2 = $this->atacks[$id]['uid2'];
-
- $i = 1;
- while ($i <= 2) {
- if ($i == 1) {
- $u1 = $uid1;
- $u2 = $uid2;
- } else {
- $u1 = $uid2;
- $u2 = $uid1;
- }
-
- if (!isset($at['p']['p_cast'])) {
- $at['p'] = $at;
- $at['p']['p_cast'] = true;
- }
-
- //
-
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 220 || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 237
- || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 286 || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 287 || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 288
- || $this->stats[$this->uids[$u1]]['u_priem'][$j][1] == 213) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_used_this = $u1;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u1, $j);
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
-
- //
- if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) {
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 1) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_used_this = $u1;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u1, $j);
- unset(${'fx_priem'});
- $this->stats[$this->uids[$u2]]['nopryh']--;
- }
- }
- $j++;
- }
- }
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 2) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_used_this = $u1;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u1, $j);
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
-
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 3) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_used_this = $u1;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- if (isset($fx_priem)) {
- $at = $fx_priem($id, $at, $u1, $j);
- }
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
-
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 4) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_used_this = $u1;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- if (isset($fx_priem)) {
- $at = $fx_priem($id, $at, $u1, $j);
- }
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
-
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 5) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_used_this = $u1;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- if (isset($fx_priem)) {
- $at = $fx_priem($id, $at, $u1, $j);
- }
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
- $i++;
- }
-
- $i = 1;
- while ($i <= 2) {
- $u1 = $i == 1 ? $uid1 : $uid2;
-
- if (!isset($at['p']['p_cast'])) {
- $at['p'] = $at;
- $at['p']['p_cast'] = true;
- }
-
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 8) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_used_this = $u1;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u1, $j);
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
-
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 9) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_used_this = $u1;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u1, $j);
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
- $i++;
- }
-
- return $at;
- }
-
- //
- private function priemsRestartRazmen($id, $at)
- {
- if (isset($at['p'])) {
- //
- //
- $uid1 = $this->atacks[$id]['uid1'];
- $uid2 = $this->atacks[$id]['uid2'];
-
- /*
- , , :
- 1.
- 2 1.
- :
- 1.
- 2 1.
- 3.
- 4 3.
- ..
- */
- $i = 1;
- while ($i <= 2) {
- if ($i == 1) {
- $u1 = $uid1;
- $u2 = $uid2;
- } else {
- $u1 = $uid2;
- $u2 = $uid1;
- }
-
- if (!isset($at['p']['p_cast'])) {
- $at['p'] = $at;
- $at['p']['p_cast'] = true;
- }
-
- //
- if (!isset($this->stats[$this->uids[$u2]]['nopryh']) || $this->stats[$this->uids[$u2]]['nopryh'] == 0) {
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 1) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_tested_this = $u1;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u1, $j);
- unset(${'fx_priem'});
- $this->stats[$this->uids[$u2]]['nopryh']--;
- }
- }
- $j++;
- }
- }
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 2) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_tested_this = $u1;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u1, $j);
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 4) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_tested_this = $u1;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u1, $j);
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 3) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_tested_this = $u1;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u1, $j);
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 5) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_tested_this = $u1;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u1, $j);
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 8) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) {
- $pr_tested_this = $u2;
- require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u2, $j);
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 9) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) {
- $pr_tested_this = $u2;
- require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php');
- $at = $fx_priem($id, $at, $u2, $j);
- unset(${'fx_priem'});
- }
- }
- $j++;
- }
-
- $i++;
- }
- }
- return $at['p'];
- }
-
- //
- public $um_priem = [];
-
- /**
- * . -
- * .
- * @param $uid1
- * @param $uid2
- * @param $priem
- * @param $yron
- * @param $profil
- * @param $stabil [deprecated]
- * @param $test [deprecated]
- * @param $inlog
- * @return float|int|mixed
- */
- public function testYronPriem($uid1, $uid2, $priem, $yron, $profil, $stabil, $test = false, $inlog = 0)
- {
- /*
- profil = {
- -1 -
- -2 -
- 0 -
- 1-4 -
- 5-12 -
- }
- stabil - .
- */
- //
- $u1 = $uid1;
- $u2 = $uid2;
-
- // $u1 $u2
- //
- if (!isset($this->stats[$this->uids[$u2]]['u_priem'])) {
- $eff = $this->stats[$this->uids[$u2]]['effects'];
- $j = 0;
- while ($j <= count($eff)) {
- if (isset($eff[$j]) && $eff[$j]['id_eff'] == 22 && $eff[$j]['v1'] == 'priem' && $eff[$j]['v2'] > 0) {
- $this->stats[$this->uids[$u2]]['u_priem'][] = [
- $j,
- $eff[$j]['v2'],
- $this->prm[$eff[$j]['v2']]['act'],
- $eff[$j]['id'],
- $this->prm[$eff[$j]['v2']]['type_of'],
- $this->prm[$eff[$j]['v2']]['moment'],
- ];
- }
- $j++;
- }
- unset($eff);
- }
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) {
- if ($this->stats[$this->uids[$u2]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 4) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) {
- $pr_momental_this = $u2;
- require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php');
- $yron = $fx_moment($u2, $u1, $j, $yron, $profil);
- unset(${'fx_moment'});
- }
- }
- $j++;
- }
-
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][4] == 5) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_momental_this = $u1;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- if (isset($fx_moment)) {
- $yron = $fx_moment($u1, $u2, $j, $yron, $profil, $inlog);
- }
- unset(${'fx_moment'});
- }
- }
- $j++;
- }
-
- // ( )
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u1]]['u_priem'])) {
- if ($this->stats[$this->uids[$u1]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u1]]['u_priem'][$j][7] == 5) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php')) {
- $pr_momental_this_seven = $u1;
- require('priem/' . $this->stats[$this->uids[$u1]]['u_priem'][$j][1] . '.php');
- if (isset($fx_moment_seven)) {
- $yron = $fx_moment_seven($u1, $u2, $j, $yron, $profil, $inlog);
- }
- unset(${'fx_moment_seven'});
- }
- }
- $j++;
- }
-
- //
- $j = 0;
- while ($j <= count($this->stats[$this->uids[$u2]]['u_priem'])) {
- if ($this->stats[$this->uids[$u2]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 8) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) {
- $pr_momental_this = $u2;
- require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php');
- if (isset($fx_moment)) {
- $yron = $fx_moment($u2, $u1, $j, $yron, $profil, $inlog);
- }
- unset(${'fx_moment'});
- }
- }
- if ($this->stats[$this->uids[$u2]]['u_priem'][$j][2] > 0 && $this->stats[$this->uids[$u2]]['u_priem'][$j][4] == 9) {
- if (file_exists('../../_incl_data/class/priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php')) {
- $pr_momental_this = $u2;
- require('priem/' . $this->stats[$this->uids[$u2]]['u_priem'][$j][1] . '.php');
- if (isset($fx_moment)) {
- $yron = $fx_moment($u2, $u1, $j, $yron, $profil, $inlog);
- }
- unset(${'fx_moment'});
- }
- }
- $j++;
- }
-
- if ($this->stats[$this->uids[$u2]]['zaproc'] > 0) {
- $yron = round($yron - $yron * $this->stats[$this->uids[$uid2]]['zaproc'] / 100);
- if ($yron < 1) {
- $yron = 1;
- }
- }
-
- return $yron;
- }
-
- // + \
-
- /**
- * @param $u1
- * @param $u2
- * @param $yron
- * @param $type [deprecated]
- * @return void
- */
- public function priemYronSave($u1, $u2, $yron, $type = 0)
- {
- //$type 0 - , 1 -
-
- $this->testUserInfoBattle($u1);
- $this->testUserInfoBattle($u2);
-
- if (isset($this->uids[$u1])) {
- if ($this->stats[$this->uids[$u2]]['hpAll'] <= 1000) {
- $adt6 = round(0.1 * (floor($yron) / $this->stats[$this->uids[$u2]]['hpAll'] * 100), 10);
- } else {
- $adt6 = round(0.1 * (floor($yron) / 1000 * 100), 10);
- }
-
- if ($yron > $this->stats[$this->uids[$u2]]['hpNow']) {
- $yron = $this->stats[$this->uids[$u2]]['hpNow'];
- }
-
- if ($yron > 0) {
- $this->users[$this->uids[$u1]]['battle_yron'] += $yron;
- $this->users[$this->uids[$u1]]['battle_exp'] += round($this->testExp($yron,
- $this->stats[$this->uids[$u1]], $this->stats[$this->uids[$u2]], $u1, $u2));
- if ($this->stats[$this->uids[$u2]]['this_animal'] == 0) {
- $this->users[$this->uids[$u1]]['tactic6'] += $adt6;
- $this->stats[$this->uids[$u1]]['tactic6'] += $adt6;
- } else {
- $this->users[$this->uids[$u1]]['tactic6'] += $adt6 / 3;
- $this->stats[$this->uids[$u1]]['tactic6'] += $adt6 / 3;
- }
- } else {
- $adt6 = 0;
- }
- //
- $this->users[$this->uids[$u2]]['last_hp'] = -$yron;
- //
- mysql_query('UPDATE `stats` SET
- `tactic6` = `tactic6` + ' . $adt6 . ',
- `battle_yron` = `battle_yron` + ' . $yron . ',
- `battle_exp` = `battle_exp` + ' . round($this->testExp($yron, $this->stats[$this->uids[$u1]],
- $this->stats[$this->uids[$u2]], $u1, $u2)) . '
- WHERE `id` = ' . $u1);
- //
- mysql_query('UPDATE `stats` SET
- `last_hp` = ' . $this->users[$this->uids[$u2]]['last_hp'] . '
- WHERE `id` = ' . $u2);
- }
-
- $this->addNewStat([
- 1 => [
- 'battle' => $this->info['id'],
- 'uid1' => $this->users[$this->uids[$u1]]['id'],
- 'uid2' => $this->users[$this->uids[$u2]]['id'],
- 'time' => time(),
- 'type' => 0,
- 'a' => '10000',
- 'b' => 0,
- 'type_a' => 1,
- 'type_b' => 0,
- 'ma' => 1,
- 'mb' => 1,
- 'yrn' => $yron,
- 'yrn_krit' => 0,
- 'tm1' => $this->users[$this->uids[$u1]]['team'],
- 'tm2' => $this->users[$this->uids[$u2]]['team'],
- ],
- ]);
- }
-
- //
-
- public function startAtack($id)
- {
- global $c, $u, $priem;
-
- if (!isset($this->atacks[$id]) || $this->atacks[$id]['lock'] != 0) {
- return;
- }//
- $i = 1;
- $j = 2;
- $k = 0;
-
- while ($i <= 2) {
- $untac = mysql_fetch_array(mysql_query('SELECT `id` FROM `eff_users` WHERE `v1` = "priem" AND `v2` = 217 AND `uid` = ' . $this->atacks[$id]['uid' . $i] . ' AND `delete` = 0'));
-
- $agrs = mysql_fetch_array(mysql_query('SELECT `id` FROM `eff_users` WHERE `v1` = "priem" AND `v2` = 211 AND `uid` = ' . $this->atacks[$id]['uid' . $j] . ' AND `delete` = 0'));
-
- if (isset($untac['id']) && !isset($agrs['id'])) {
- // AND `a`.`v2` != 235 // AND `a`.`v2` != 273 AND `a`.`v2` != 286 AND `a`.`v2` != 287 AND `a`.`v2` != 288
-
- $pvr['sp'] = mysql_query('SELECT * FROM `eff_users` WHERE
- `uid` = ' . $this->atacks[$id]['uid' . $j] . '
- AND `delete` = 0
- AND `v1` = "priem"
- and `v2` not in (222, 238, 228, 229, 139, 188, 226, 211, 49, 233, 227, 220, 191, 332, 333,
- 334, 335, 236, 201, 261, 262, 206, 207, 208, 209, 210, 284, 263, 258, 29, 30, 31, 32, 526, 249,
- 248, 187, 245, 175, 176, 177, 178, 179, 285, 36, 85, 86, 87, 88, 89, 90, 269, 276, 277, 270,
- 174, 324, 217)
- AND `name` NOT LIKE "%%"
- LIMIT 30');
- while ($pvr['pl'] = mysql_fetch_array($pvr['sp'])) {
- $pvr['pl']['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $pvr['pl']['v2'] . '" LIMIT 1'));
- if (isset($pvr['pl']['priem']['id']) && $pvr['pl']['priem']['neg'] == 0) {
- $this->delPriem($pvr['pl'], $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 100);
- }
- }
- //
- $k++;
- }
- $j--;
- $i++;
- }
-
- // 1%
- if ($this->atacks[$id]['out1'] == 0) {
- if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s6'] / 4 < $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['level']) {
- $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['level'] + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hod_minmana']);
- } else {
- $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['s6'] / 4 + $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hod_minmana']);
- }
- $this->users[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'] = $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['mpNow'];
- }
- //
- if ($this->atacks[$id]['out2'] == 0) {
- if ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['s6'] / 4 < $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['level']) {
- $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['level'] + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hod_minmana']);
- } else {
- $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] += floor($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['s6'] / 4 + $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hod_minmana']);
- }
- $this->users[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'] = $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['mpNow'];
- }
-
- //
- if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['antm3'] != 0) {
- $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['m3'] -= round($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['antm3']);
- }
- if ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['antm3'] != 0) {
- $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['m3'] -= round($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['antm3']);
- }
-
- //
- $this->testZonb($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2']);
-
- //
- $this->magicItems($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $id);
- $this->magicItems($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $id);
-
- //
- $this->priemsRazmen($id, $at);
- $this->priemsRazmenMoment($id, $at);
- $this->priemsRazmen($id, $at);
-
- $at = $this->newRazmen($id);
-
- //
- // , , , ,
- // ( , )
- $at = $this->mf2Razmen($id, $at, $v); //
- $at = $this->mf3Razmen($id, $at, $v); //
- $at = $this->mf4Razmen($id, $at, $v); //
-
- $at = $this->mf1Razmen($id, $at, $v); //
- $at = $this->mf5Razmen($id, $at, $v); //
-
- $at = $this->yronRazmen($id, $at); //
-
- //
- //
- $at = $this->priemsTestRazmen($id, $at);
- // ( .)
- $at = $this->priemsRestartRazmen($id, $at); // ( )
- //
-
- //
- if (count($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['set_pog']) > 0) {
- $this->testPogB($this->atacks[$id]['uid1'], 1, $id, 1);
- }
- if (count($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['set_pog']) > 0) {
- $this->testPogB($this->atacks[$id]['uid2'], 1, $id, 1);
- }
-
- //
- $at = $this->updateHealth($id, $at);
-
- // +
- $this->addlogRazmen($id, $at);
- // NEW BATTLE SYSTEM
-
- //
- $this->magicItems($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'], $id);
- $this->magicItems($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'], $id);
-
- //
- //
- $this->restZonb($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2']);
- //
- $zd1 = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems_z']);
- $zd2 = explode('|', $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems_z']);
- //
- $prmos = [];
- //
- $i5 = 0;
-
- while ($i5 < 51) {
- if (isset($zd1[$i5]) && $zd1[$i5] > 0) {
- //
- $zd1[$i5] -= 1;
- } else {
- $zd1[$i5] = 0;
- }
- if (isset($zd2[$i5]) && $zd2[$i5] > 0) {
- //
- $zd2[$i5] -= 1;
- } else {
- $zd2[$i5] = 0;
- }
- $i5++;
- }
- unset($prmos);
-
- if ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] == $this->users[$this->uids[$this->atacks[$id]['uid2']]]['id']) {
- $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'] = -$this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'];
- }
-
- if ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] == $this->users[$this->uids[$this->atacks[$id]['uid1']]]['id']) {
- $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'] = -$this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'];
- }
-
- $this->users[$this->uids[$this->atacks[$id]['uid1']]]['priems_z'] = implode('|', $zd1);
- $this->users[$this->uids[$this->atacks[$id]['uid2']]]['priems_z'] = implode('|', $zd2);
- if ($this->atacks[$id]['uid1'] == $u->info['id']) {
- $u->info['priems_z'] = implode('|', $zd1);
- } elseif ($this->atacks[$id]['uid2'] == $u->info['id']) {
- $u->info['priems_z'] = implode('|', $zd2);
- }
- //
- //
- $i = 1;
- while ($i <= 6) {
- if ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] > 25) {
- $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] = 25;
- } elseif ($this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] <= 0) {
- $this->users[$this->uids[$this->atacks[$id]['uid1']]]['tactic' . $i] = 0;
- }
- if ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] > 25) {
- $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] = 25;
- } elseif ($this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] <= 0) {
- $this->users[$this->uids[$this->atacks[$id]['uid2']]]['tactic' . $i] = 0;
- }
- $i++;
- }
- //
- //
- mysql_query('UPDATE `items_users` SET `btl_zd` = `btl_zd` - 1 WHERE (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '") AND `btl_zd` > 0 AND `inOdet` > 0 LIMIT 100');
-
- mysql_query('UPDATE `users` SET `notrhod` = "-1" WHERE `id` = "' . $this->atacks[$id]['uid1'] . '" OR `id` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 2');
-
- //
- mysql_query('UPDATE `pirogi` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")');
- mysql_query('UPDATE `tactic` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")');
-
- //
- mysql_query('DELETE FROM `pirogi` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1');
- mysql_query('DELETE FROM `tactic` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1');
-
- //
- mysql_query('UPDATE `spells` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")');
- mysql_query('DELETE FROM `spells` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1');
-
-
- // battle_users
- mysql_query('UPDATE `battle_users` SET `hp` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hpNow'] . '"
- WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1');
- mysql_query('UPDATE `battle_users` SET `hp` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hpNow'] . '"
- WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1');
- // 25%
-
-
- if ($this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod'] > 0) {
- $this->save_stats($this->yhod_user($this->atacks[$id]['uid2'], $this->atacks[$id]['uid1'],
- $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['yhod']));
- } elseif ($this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod'] > 0) {
- $this->save_stats($this->yhod_user($this->atacks[$id]['uid1'], $this->atacks[$id]['uid2'],
- $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['yhod']));
- }
- //
- $this->save_stats($this->atacks[$id]['uid1']);
- $this->save_stats($this->atacks[$id]['uid2']);
-
- $this->priemsRazmenMomentEnd($id, $at);
-
- // \
- $j = 1;
- while ($j <= 2) {
- $eff = $this->stats[$this->uids[$this->atacks[$id]['uid' . $j]]]['effects'];
- $i = 0;
- while ($i < count($eff)) {
- if (isset($eff[$i])) {
- if ($eff[$i]['timeUse'] == 77 && $eff[$i]['hod'] > -1) {
- $eff[$i]['hod']--;
- $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = ' . $eff[$i]['v2']));
- if (round($eff[$i]['priem']['minmana'] * $eff[$i]['x']) != 0) {
- //
- $priem->minMana($eff[$i]['user_use'],
- round($eff[$i]['priem']['minmana'] * $eff[$i]['x']));
- if ($this->stats[$this->uids[$eff[$i]['user_use']]]['mpNow'] <= 0) {
- $eff[$i]['hod'] = 0;
- }
- }
- if (strripos($eff[$i]['data'], 'minprocmanahod')) {
- $pvr = [
- 'x1' => 0,
- 'x2' => 0,
- 'd' => explode('|', $eff[$i]['data']),
- 'i' => 0,
- 'uid' => $eff[$i]['uid'],
- 'color' => '',
- 'color2' => '',
- 'effx' => '',
- 'x' => $eff[$i]['name'],
- ];
-
- while ($pvr['i'] < count($pvr['d'])) {
- if (isset($pvr['d'][$pvr['i']])) {
- $pvr['d1'] = explode('=', $pvr['d'][$pvr['i']]);
- if ($pvr['d1'][0] == 'minprocmanahod') {
- $pvr['d1'] = explode('x', $pvr['d1'][1]);
- $pvr['x1'] = $pvr['d1'][0];
- $pvr['x2'] = $pvr['d1'][1];
- }
- }
- $pvr['i']++;
- }
-
- $pvr['mp'] = round($this->stats[$this->uids[$pvr['uid']]]['mpAll'] / 100 * rand($pvr['x1'],
- $pvr['x2']));
- $pvr['mpSee'] = 0;
- $pvr['mpNow'] = floor($this->stats[$this->uids[$pvr['uid']]]['mpNow']);
- $pvr['mpAll'] = $this->stats[$this->uids[$pvr['uid']]]['mpAll'];
- $pvr['mpTr'] = $pvr['mpAll'] - $pvr['mpNow'];
-
- if ($pvr['mpTr'] > 0) {
- //
- if ($pvr['mpTr'] < $pvr['mp']) {
- $pvr['mp'] = $pvr['mpTr'];
- }
- $pvr['mpSee'] = '+' . $pvr['mp'];
- $pvr['mpNow'] += $pvr['mp'];
- }
- if ($pvr['mpNow'] > $pvr['mpAll']) {
- $pvr['mpNow'] = $pvr['mpAll'];
- } elseif ($pvr['mpNow'] < 0) {
- $pvr['mpNow'] = 0;
- }
- if ($pvr['mpSee'] == 0) {
- $pvr['mpSee'] = '--';
- }
-
-
- $this->stats[$this->uids[$pvr['uid']]]['mpNow'] = $pvr['mpNow'];
- $this->users[$this->uids[$pvr['uid']]]['mpNow'] = $pvr['mpNow'];
- mysql_query('UPDATE `stats` SET `mpNow` = ' . $this->stats[$this->uids[$pvr['uid']]]['mpNow'] . ' WHERE `id` = ' . $pvr['uid']);
-
- $pvr['text'] = $this->addlt(1, 21, $this->users[$this->uids[$pvr['uid']]]['sex']);
- $pvr['text2'] = '{tm1} ' . $pvr['text'] . '
' . $pvr['mpSee'] . ' [' . $pvr['mpNow'] . '/' . $pvr['mpAll'] . '] ()';
- $this->priemAddLog($id, 1, 2, $pvr['uid'], 0,
- '
' . $pvr['x'] . ' ',
- $pvr['text2'],
- ($this->hodID)
- );
-
- unset($pvr);
- }
-
- if (isset($this->rehodeff[$eff[$i]['id']])) {
- $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']];
- }
- if ($eff[$i]['hod'] > 0) {
- $this->stats[$this->uids[$this->atacks[$id]['uid' . $j]]]['effects']['hod'] = $eff[$i]['hod'];
- mysql_query('UPDATE `eff_users` SET `hod` = "' . $eff[$i]['hod'] . '" WHERE `id` = "' . $eff[$i]['id'] . '" LIMIT 1');
- } else {
- //
- if ($eff[$i]['v2'] > 0) {
- if ($j == 1) {
- $jn = 2;
- } else {
- $jn = 1;
- }
- $this->delPriem($eff[$i], $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]],
- 3, $this->atacks[$id]['uid' . $jn]);
- }
- }
- } elseif ($eff[$i]['timeUse'] == 77 && $eff[$i]['hod'] == -2) {
- $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1'));
- $priem->hodUsePriem($eff[$i], $eff[$i]['priem']);
- } else {
- $eff[$i]['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $eff[$i]['v2'] . '" LIMIT 1'));
- if (isset($eff[$i]['priem']['minmana']) && round($eff[$i]['priem']['minmana'] * $eff[$i]['x']) != 0) {
- //
- $priem->minMana($eff[$i]['user_use'],
- round($eff[$i]['priem']['minmana'] * $eff[$i]['x']));
- if ($this->stats[$this->uids[$eff[$i]['user_use']]]['mpNow'] <= 0) {
- $eff[$i]['hod'] = 0;
- if (isset($this->rehodeff[$eff[$i]['id']])) {
- $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']];
- }
- if ($eff[$i]['v2'] > 0) {
- if ($j == 1) {
- $jn = 2;
- } else {
- $jn = 1;
- }
- $this->delPriem($eff[$i],
- $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 3,
- $this->atacks[$id]['uid' . $jn]);
- }
- }
- } elseif ($eff[$i]['timeUse'] > 100 && $eff[$i]['hod'] > -1 && $c['effz'] > 0) {
- $eff[$i]['hod']--;
- if (isset($this->rehodeff[$eff[$i]['id']])) {
- $eff[$i]['hod'] = $this->rehodeff[$eff[$i]['id']];
- }
- if ($eff[$i]['hod'] > 0) {
- $this->stats[$this->uids[$this->atacks[$id]['uid' . $j]]]['effects']['hod'] = $eff[$i]['hod'];
- mysql_query('UPDATE `eff_users` SET `hod` = "' . $eff[$i]['hod'] . '" WHERE `id` = "' . $eff[$i]['id'] . '" LIMIT 1');
- } else {
- //
- if ($eff[$i]['v2'] > 0) {
- if ($j == 1) {
- $jn = 2;
- } else {
- $jn = 1;
- }
- $this->delPriem($eff[$i],
- $this->users[$this->uids[$this->atacks[$id]['uid' . $j]]], 3,
- $this->atacks[$id]['uid' . $jn]);
- }
- }
- }
- }
- }
- $i++;
- }
- $j++;
- }
- //
- //
- //
- if ($c['propsk_die'] > 0 && $this->info['razdel'] == 0 && $this->info['dn_id'] == 0 && $this->info['izlom'] == 0) {
- $cn1 = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this->info['id'] . '" AND `uid1` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1'));
- $cn2 = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this->info['id'] . '" AND `uid1` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1'));
- if ($cn1[0] > 3) {
- //
- $pvr['text2'] = '{tm1} {u1} - .';
- $this->priemAddLog($id, 1, 2, $this->atacks[$id]['uid1'], 0, '',
- $pvr['text2'],
- ($this->hodID)
- );
- unset($pvr);
- mysql_query('UPDATE `stats` SET `hpNow` = 0 WHERE `id` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1');
- }
- if ($cn2[0] > $c['propsk_die']) {
- $pvr['text2'] = '{tm1} {u1} - .';
- $this->priemAddLog($id, 1, 2, $this->atacks[$id]['uid2'], 0, '',
- $pvr['text2'],
- ($this->hodID)
- );
- unset($pvr);
- mysql_query('UPDATE `stats` SET `hpNow` = 0 WHERE `id` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1');
- }
- }
- //
- //
- if ($u->info['id'] == $this->atacks[$id]['uid1']) {
- $u->info['enemy'] = $this->users[$this->uids[$this->atacks[$id]['uid1']]]['enemy'];
- }
- if ($u->info['id'] == $this->atacks[$id]['uid2']) {
- $u->info['enemy'] = $this->users[$this->uids[$this->atacks[$id]['uid2']]]['enemy'];
- }
- // //
- mysql_query('DELETE FROM `battle_act` WHERE ( `uid1` = "' . $this->atacks[$id]['uid1'] . '" AND `uid2` = "' . $this->atacks[$id]['uid2'] . '" ) OR
- ( `uid2` = "' . $this->atacks[$id]['uid1'] . '" AND `uid1` = "' . $this->atacks[$id]['uid2'] . '" )');
-
- unset($old_s1, $old_s2);
- unset($this->ga[$this->atacks[$id]['uid1']][$this->atacks[$id]['uid2']], $this->ga[$this->atacks[$id]['uid2']][$this->atacks[$id]['uid1']]);
- unset($this->ag[$this->atacks[$id]['uid1']][$this->atacks[$id]['uid2']], $this->ag[$this->atacks[$id]['uid2']][$this->atacks[$id]['uid1']]);
- unset($this->atacks[$id]);
- mysql_query('DELETE FROM `battle_act` WHERE `id` = ' . $id);
- //
-
- unset($old_s1, $old_s2);
- //
- }
-
- //
- private function save_stats($uid)
- {
- mysql_query('UPDATE `stats` SET
- `hpNow` = ' . $this->stats[$this->uids[$uid]]['hpNow'] . ',
- `mpNow` = ' . $this->stats[$this->uids[$uid]]['mpNow'] . ',
- `tactic1` = ' . $this->users[$this->uids[$uid]]['tactic1'] . ',
- `tactic2` = ' . $this->users[$this->uids[$uid]]['tactic2'] . ',
- `tactic3` = ' . $this->users[$this->uids[$uid]]['tactic3'] . ',
- `tactic4` = ' . $this->users[$this->uids[$uid]]['tactic4'] . ',
- `tactic5` = ' . $this->users[$this->uids[$uid]]['tactic5'] . ',
- `tactic6` = ' . $this->users[$this->uids[$uid]]['tactic6'] . ',
- `tactic7` = ' . $this->users[$this->uids[$uid]]['tactic7'] . ',
- `enemy` = ' . $this->users[$this->uids[$uid]]['enemy'] . ',
- `battle_yron` = ' . $this->users[$this->uids[$uid]]['battle_yron'] . ',
- `last_hp` = ' . $this->users[$this->uids[$uid]]['last_hp'] . ',
- `battle_exp` = ' . $this->users[$this->uids[$uid]]['battle_exp'] . ',
- `priems_z` = ' . $this->users[$this->uids[$uid]]['priems_z'] . '
- WHERE `id` = ' . $uid);
- }
-
- //
- public function lookLog()
- {
- global $u;
- $hodID = mysql_fetch_array(mysql_query('SELECT `id_hod` FROM `battle_logs` WHERE `battle` = ' . $this->info['id'] . ' ORDER BY `time`'));
- if ($hodID['id_hod'] <= 1) {
- $u->info['alog'] = 0;
- }
-
- if ($_POST['idlog'] < 1) {
- $_POST['idlog'] = 0;
- }
- $talog = mysql_fetch_array(mysql_query('SELECT `alog` FROM `stats` WHERE `id` = ' . $u->info['id']));
- $sp = mysql_query('SELECT
- `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2`
- FROM `battle_logs`
- WHERE `battle` = ' . $this->info['id'] . ' AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC');
- if (isset($sp) && $this->info['team_win'] != -1) {
- $sp = mysql_query('SELECT
- `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2`
- FROM `battle_logs_save`
- WHERE `battle` = ' . $this->info['id'] . ' AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC');
- }
- $jin = 0;
- $forYou2 = 0;
- $js = '';
- $pll = 0;
- if ($_POST['idlog'] < 1) {
- $_POST['idlog'] = 0;
- }
- $talog = mysql_fetch_array(mysql_query('SELECT `alog` FROM `stats` WHERE `id` = ' . $u->info['id']));
- $sp = mysql_query('SELECT
- `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2`
- FROM `battle_logs`
- WHERE `battle` = ' . $this->info['id'] . ' AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC');
- if (isset($sp) && $this->info['team_win'] != -1) {
- $sp = mysql_query('SELECT
- `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2`
- FROM `battle_logs_save`
- WHERE `battle` = ' . $this->info['id'] . ' AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC');
- }
- $jin = 0;
- $forYou2 = 0;
- while ($pl = mysql_fetch_array($sp)) {
- if ($jin == 0) {
- $u->info['alog'] = $pl['id_hod'];
- }
- $jin++;
-
- $rt = $pl['text'];
- $pl['vars'] = str_replace('^^^^', 'rvnO', $pl['vars']);
- $rt = str_replace('{tm1}', '
' . date('H:i', $pl['time']) . ' ', $rt);
- $rt = str_replace('{tm2}', '
' . date('H:i', $pl['time']) . ' ', $rt);
- $rt = str_replace('{tm3}',
- '
' . date('d.m.Y H:i', $pl['time']) . ' ', $rt);
- $rt = str_replace('{tm4}',
- '
' . date('d.m.Y H:i', $pl['time']) . ' ', $rt);
- $pl['text'] = $rt;
-
- unset($rt);
- if ($pll < $pl['id']) {
- $pll = $pl['id'];
- }
- $js = 'add_log(' . $pl['id'] . ',' . $forYou2 . ',"' . $pl['text'] . '",' . $pl['id_hod'] . ',0,0,"' . str_replace('"',
- '"', $pl['vars']) . '");' . $js;
- }
- mysql_query('UPDATE `stats` SET `alog`=' . $u->info['alog'] . ' WHERE `id` =' . $u->info['id']);
- $js .= 'id_log=' . $pll . ';';
-
- return $js;
- }
-
-//
- public function lookmLog()
- {
- $u = user::start();
- $js = '';
- $pll = 0;
-
- if ($this->info['type'] != 9) {
- $hodID = mysql_fetch_array(mysql_query('SELECT `id`,`id_hod` FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `time` LIMIT 1'));
- if ($hodID['id_hod'] <= 1) {
- $u->info['mlog'] = 0;
- }
- if (isset($hodID['id']) && $this->info['team_win'] != -1) {
- $hodID = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_logs_save` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `time` LIMIT 1'));
- }
- if (isset($hodID['id'])) {
- $hodID = $hodID['id'];
- } else {
- $hodID = 0;
- }
- $tmlog = mysql_fetch_array(mysql_query('SELECT `mlog` FROM `stats` WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'));
- $spm = mysql_query('SELECT
- `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2`
- FROM `battle_logs`
- WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $tmlog['mlog'] . ' AND `vars` LIKE "%' . $u->info['login'] . '%" ORDER BY `id` DESC');
-
- if (isset($spm) && $this->info['team_win'] != -1) {
- $spm = mysql_query('SELECT
- `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2`
- FROM `battle_logs_save`
- WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $tmlog['mlog'] . ' AND `vars` LIKE "%' . $u->info['login'] . '%" ORDER BY `id` DESC');
- }
-
- $jin = 0;
- $forYou2 = 0;
-
- while ($plm = mysql_fetch_array($spm)) {
- if ($jin == 0) {
- $u->info['mlog'] = $plm['id_hod'];
- }
- $jin++;
- $rt = $plm['text'];
- $plm['vars'] = str_replace('^^^^', 'rvnO', $plm['vars']);
- $rt = str_replace('{tm1}', '
' . date('H:i', $plm['time']) . ' ', $rt);
- $rt = str_replace('{tm2}', '
' . date('H:i', $plm['time']) . ' ', $rt);
- $rt = str_replace('{tm3}', '
' . date('d.m.Y H:i', $plm['time']) . ' ',
- $rt);
- $rt = str_replace('{tm4}', '
' . date('d.m.Y H:i', $plm['time']) . ' ',
- $rt);
- $plm['text'] = $rt;
- unset($rt);
- if ($pll < $plm['id']) {
- $pll = $plm['id'];
- }
- $js = 'add_mlog(' . $plm['id'] . ',' . $forYou2 . ',"' . $plm['text'] . '",' . $plm['id_hod'] . ',0,0,"' . str_replace('"',
- '"', $plm['vars']) . '");' . $js;
- }
- $js .= 'id_mlog=' . $pll . ';';
- mysql_query('UPDATE `stats` SET `mlog`=' . $u->info['mlog'] . ' WHERE `id` =' . $u->info['id']);
- }
- return $js;
- }
-//======================
-
- //
- public function add_log($mass)
- {
- if ($mass['time'] != '' && $mass['text'] != '') {
- mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`type`) VALUES (' . $mass['time'] . ',' . $mass['battle'] . ',' . $mass['id_hod'] . ',' . $mass['text'] . ',' . $mass['vars'] . ',' . $mass['type'] . ')');
- if (rand(2, 10) == 10) {
- $this->get_comment();
- }
- }
- }
-
- ///
- private function get_comment()
- {
- $boycom = [
- ' .',
- ' , ?',
- ' ?',
- ', -, ? ! !',
- ' .',
- ' . ',
- ' ...',
- ' ...',
- ' ?',
- ' , !?',
- ' ?',
- ' -, :',
- ' - ?',
- ' , ',
- ' ?!',
- ' . ?',
- ' ...',
- ' !',
- ' !',
- ' , !',
- ' .',
- ' 5 , , 20- ...',
- '. .',
- ' , - ?',
- ' , ?',
- ' ... : ...',
- ' , ?',
- ' , ',
- ' . ... , , ',
- ' !',
- ' ? , .',
- ' ! !',
- ' !',
- ', , ` ` ',
- ' ?!',
- ' ! .',
- ' . ? .',
- ' !',
- ', ... !.. , .',
- ' , !',
- ' -, ...',
- ' - , :)',
- ' .',
- ' - !!!',
- '! ! ! !',
- ' !',
- ' ? . , .',
- ' . .',
- ' ...',
- ' ...',
- ' !!!',
- '!? ?!',
- ' ?',
- ', ...',
- ' .',
- ' !',
- ' , - .',
- ', , , .',
- ' !',
- ', - ???',
- ' , .',
- ' ? !',
- ', !',
- ' , ...',
- ' . !',
- '! ! ... , .',
- ', , ?',
- ', !',
- ' !',
- ' , ... , ... ?!',
- ' ?',
- ' . .',
- ', ..? . , .',
- '... .',
- '!!!.... ...',
- '! .',
- '! , !',
- ' ???',
- ' ... - .',
- ', ...',
- ' !',
- '-, - .',
- ' , .',
- ' , ?',
- ' - .',
- ', .',
- ' !',
- ' , .',
- ' ... , !',
- ' ...',
- ' !',
- ' !',
- ' ',
- ' , .',
- ' , .',
- ' - .',
- ' !',
- ' ',
- ' ...',
- ' , !',
- '!! , ...',
- ' ! .',
- ', !',
- ', , ?',
- ', , .',
- ' !',
- ' !',
- '-!',
- ' ?! !',
- ' , ',
- ' - ...',
- ' , ! !',
- ' , .',
- ' ',
- ' `` ?',
- ' - ...',
- ' , - .',
- ' . :)',
- ' , , , . ? - ?!',
- ' , ...',
- '( ) ... !',
- '< > < > < > < >',
- '< > ',
- ];
- if (rand(1, 12) !== 12) {
- return;
- }
- shuffle($boycom);
- $this->add_log([
- 'time' => time(),
- 'battle' => $this->info['id'],
- 'id_hod' => $this->hodID,
- 'text' => '{tm1}
: ' . current($boycom) . ' ',
- 'vars' => 'time1=' . time(),
- 'zona1' => '',
- 'zonb1' => '',
- 'zona2' => '',
- 'zonb2' => '',
- 'type' => '1',
- ]);
- }
-
- //
- public function weaponTx($item)
- {
- if (!isset($item['id'])) {
- $i = 1;
- while ($i <= 4) {
- $itm['tya' . $i] = 1;
- $i++;
- }
- }
- $itm = $this->lookStats($item['data']);
- $t[0]['z'] = 0;
- $t[0]['t'] = 0;
- //
- $t[1]['z'] = round(0 + $itm['tya1']);
- $t[1]['t'] = 1;
- //
- $t[2]['z'] = round(0 + $itm['tya2']);
- $t[2]['t'] = 2;
- //
- $t[3]['z'] = round(0 + $itm['tya3']);
- $t[3]['t'] = 3;
- //
- $t[4]['z'] = round(0 + $itm['tya4']);
- $t[4]['t'] = 4;
- //
- $t[5]['z'] = round(0 + $itm['tym1']);
- $t[5]['t'] = 5;
- //
- $t[6]['z'] = round(0 + $itm['tym2']);
- $t[6]['t'] = 6;
- //
- $t[7]['z'] = round(0 + $itm['tym3']);
- $t[7]['t'] = 7;
- //
- $t[8]['z'] = round(0 + $itm['tym4']);
- $t[8]['t'] = 8;
- //
- $t[9]['z'] = round(0 + $itm['tym5']);
- $t[9]['t'] = 9;
- //
- $t[10]['z'] = round(0 + $itm['tym6']);
- $t[10]['t'] = 10;
- //
- $t[11]['z'] = round(0 + $itm['tym7']);
- $t[11]['t'] = 11;
-
-
- $tpt = $t[0]['z'];
- $tpmin = $t[0];
- $tpmax = $t[0];
- $i = 1;
-
- while ($i <= 11) {
- if ($t[$i]['z'] > $tpt) {
- $tpt = $t[$i]['z'];
- $tpmax = $t[$i];
- $ii = $i;
- }
- $i++;
- }
- $t[$ii]['z'] = 0;
-
- $tpt = $t[0]['z'];
- $i = 1;
- while ($i <= 11) {
- if ($t[$i]['z'] > $tpt) {
- $tpt = $t[$i]['z'];
- $tpmin = $t[$i];
- }
- $i++;
- }
-
- $setclass = rand(1, 100);
-
- if ($setclass > $tpmax['z']) {
- $tp = $tpmin['t'];
- } else {
- $tp = $tpmax['t'];
- }
-
- return $tp;
- }
-
- //
- public function weaponAt22($item, $st = 0)
- {
- if (empty($item['data'])) {
- return [];
- }
- $itm = $this->lookStats($item['data']);
- //
- $min = $itm['sv_yron_min'] + $itm['yron_min'] + $st['minAtack'];
- $max = $itm['sv_yron_max'] + $itm['yron_max'] + $st['maxAtack'];
-
- return [$min, $max];
- }
-
- //
- //
- private function zago($v)
- {
- return round((1 - (pow(0.5, (max($v, 1700) / 399.51)))) * 100, 2);
- }
-
- // ()
- public function zmgo($v)
- {
- return (1 - (pow(0.5, ($v / 250)))) * 100;
- }
-
-
- /**
- * @param $st1
- * @param $st2
- * @param $u1
- * @param $u2
- * @param $level
- * @param $level2 [not used?]
- * @param $type
- * @param $min_yron
- * @param $max_yron
- * @param $min_bron [not used?]
- * @param $max_bron [not used?]
- * @param $vladenie
- * @param $power_yron
- * @param $power_krit
- * @param $zashita
- * @param $ozashita [not used?]
- * @param $proboi
- * @param $weapom_damage [not used?]
- * @param $weapom_min
- * @param $weapom_max
- * @param $za_proc [not used?]
- * @param $zm_proc [not used?]
- * @param $zashitam [not used?]
- * @param $ozashitam [not used?]
- * @param $wp_type
- * @param $witm
- * @return array
- */
- public function yrn(
- $st1,
- $st2,
- $u1,
- $u2,
- $level,
- $level2 = null,
- $type,
- $min_yron,
- $max_yron,
- $min_bron = null,
- $max_bron = null,
- $vladenie,
- $power_yron,
- $power_krit,
- $zashita,
- $ozashita = null,
- $proboi,
- $weapom_damage = null,
- $weapom_min,
- $weapom_max,
- $za_proc = null,
- $zm_proc = null,
- $zashitam = null, // pzm !
- $ozashitam = null,
- $wp_type,
- $witm
- ) {
- global $u;
-
- //
- if ($zashita < 1) {
- $zashita = 1;
- }
-
- if ($min_yron < 1) {
- $min_yron = 1;
- }
-
- if ($max_yron < 1) {
- $max_yron = 1;
- }
-
- if (!isset($type) || $type == '') {
- $type = 12;
- }
-
- //
- $p = [
- 'Y' => 0,
- 'B' => [0 => 0, 1 => 0, 'rnd' => false],
- 'L' => $level,
- 'W' => [$weapom_min, $weapom_max, 'rnd' => false], // //
- 'U' => $vladenie, //
- 'M' => $power_yron, //
- 'K' => $power_krit, //
- 'S' => 0, // .
- 'T' => 1, //.
- 'iT' => 1, // . .
- /*
- (S) -
- : S = * 0,3 + * 0,7
- : S = * 0,5 + * 0,25 + * 0,25
- : S = * 1
- : S = * 0,3 + * 0,7
- */
- ];
-
- // 1.33 1.00
-
- $witmdata = $this->lookStats($witm['data']);
-
- //
-
- if ($wp_type == 18) {
- $r['type'] = 1;
- } elseif ($wp_type == 19) {
- $r['type'] = 2;
- } elseif ($wp_type == 20) {
- $r['type'] = 3;
- } elseif ($wp_type == 21) {
- $r['type'] = 4;
- } else {
- $r['type'] = 0;
- }
- //
- //
- if ($r['type'] == 1) {
- $p['S'] = $st1['s1'] * 0.25 + $st1['s2'] * 0.75;
- $p['U'] = $st1['a1'] * 1.00; //
- //
- } elseif ($r['type'] == 2) {
- $p['S'] = $st1['s1'] * 1.20;
- $p['U'] = $st1['a2'] * 1.00; //
- //
- } elseif ($r['type'] == 3) {
- $p['S'] = $st1['s1'] * 0.5 + $st1['s4'] * 1.00;
- $p['U'] = $st1['a3'] * 1.00; //
- //
- } elseif ($r['type'] == 4) {
- $p['S'] = $st1['s3'] * 1.00;
- $p['U'] = $st1['a4'] * 1.00; //
- //
- } elseif ($r['type'] >= 5 && $r['type'] < 12) {
- $p['S'] = $st1['s1'] * 0.5 + $st1['s2'] * 0.5;
- $p['U'] = $st1['mg' . ($r['type'] - 4)] * 1.00; //
- $p['Mage'] = true;
- } else {
- $p['S'] = 0;
- $p['U'] = 0; // (
- }
-
- $r['bron']['rnd'] = rand($r['bron'][0], $r['bron'][1]);
-
- // ()
- $p['B'][0] = 2 + $level + $st1['s1'] - round($st1['s1'] / 5);
- $p['B'][1] = $p['B'][0] + 3;
-
- $p['B']['rnd'] = rand($p['B'][0], $p['B'][1]);
- $p['W']['rnd'] = rand($p['W'][0], $p['W'][1]);
-
- //
- if ($r['type'] == 12) {
- $r['min'] = ($p['B'][0] + $weapom_min) * $p['T'] * (1 + $p['M'] / 100);
- $r['max'] = ($p['B'][1] + $weapom_max) * $p['T'] * (1 + $p['M'] / 100);
- } else {
- $r['min'] = (($p['B'][0] + $p['S'] * 2 + $weapom_min * 2 + $p['U'] * 2) * $p['T']) * (1 + $p['M'] / 100);
- $r['max'] = (($p['B'][1] + $p['S'] * 2 + $weapom_max * 2 + $p['U'] * 2) * $p['T']) * (1 + $p['M'] / 100);
- }
-
- $r['bRND'] = $p['B']['rnd'];
-
- $r['Kmin'] = ceil((2 + ($p['K'] / 100)) * $r['min']);
- $r['Kmax'] = ceil((2 + ($p['K'] / 100)) * $r['max']);
-
- //
- //
- if ($r['type'] < 5 || $r['type'] == 12) {
- $r['min_abron'] = round($r['min'] * 0.05);
- $r['max_abron'] = round($r['max'] * 0.05);
-
- if ($proboi != 0) {
- $r['bron']['rndold'] = $r['bron']['rnd'];
- }
-
- //
- $r['Kmin'] -= $r['bron']['rnd'] * 2; // 2
- $r['Kmax'] -= $r['bron']['rnd'] * 2; // 2
-
- $r['min'] -= $r['bron']['rnd']; // .
- $r['max'] -= $r['bron']['rnd']; // .
-
- }
-
- // ( 80%)
- if ($r['type'] < 5 || $r['type'] == 12) {
- $r['min'] = round($r['min'] / 100 * (100 - $this->zago($st2['za'])));
- $r['max'] = round($r['max'] / 100 * (100 - $this->zago($st2['za'])));
- $r['Kmin'] = round($r['Kmin'] / 100 * (100 - $this->zago($st2['za'])));
- $r['Kmax'] = round($r['Kmax'] / 100 * (100 - $this->zago($st2['za'])));
- } else {
- $r['min'] = round($r['min'] / 100 * (100 - $this->zmgo($st2['zm'])));
- $r['max'] = round($r['max'] / 100 * (100 - $this->zmgo($st2['zm'])));
- $r['Kmin'] = round($r['Kmin'] / 100 * (100 - $this->zmgo($st2['zm'])));
- $r['Kmax'] = round($r['Kmax'] / 100 * (100 - $this->zmgo($st2['zm'])));
- }
-
- $r['min'] = round($r['min']);
- $r['max'] = round($r['max']);
- $r['Kmin'] = round($r['Kmin']);
- $r['Kmax'] = round($r['Kmax']);
-
- $min_yrn = 0; //%
-
- if ($u1['clone'] > 0) {
- $min_yrn = 75;
- }
-
- $r['min'] -= floor($r['min'] / 100 * $min_yrn);
- $r['max'] -= floor($r['max'] / 100 * $min_yrn);
- $r['Kmin'] -= floor($r['Kmin'] / 100 * ($min_yrn));
- $r['Kmax'] -= floor($r['Kmax'] / 100 * ($min_yrn));
- $r['min_'] -= floor($r['min_'] / 100 * $min_yrn);
- $r['max_'] -= floor($r['max_'] / 100 * $min_yrn);
- $r['Kmin_'] -= floor($r['Kmin_'] / 100 * ($min_yrn));
- $r['Kmax_'] -= floor($r['Kmax_'] / 100 * ($min_yrn));
-
- $defd = mysql_fetch_array(mysql_query('SELECT SUM(`vals`) FROM `battle_actions` WHERE `btl` = ' . $this->info['id'] . ' AND `vars` = "use_defteam' . $u2['team'] . '" LIMIT 1'));
- if ($defd[0] > 100) {
- $defd[0] = 100;
- }
- $defd = 0 + $defd[0];
- $powd = mysql_fetch_array(mysql_query('SELECT SUM(`vals`) FROM `battle_actions` WHERE `btl` = ' . $this->info['id'] . ' AND `vars` = "use_powteam' . $u1['team'] . '" LIMIT 1'));
- if ($powd[0] > 100) {
- $powd[0] = 100;
- }
- $powd = 0 + $powd[0];
- $defd = $defd - $powd;
-
- $r['min'] -= floor($defd);
- $r['max'] -= floor($defd);
- $r['Kmin'] -= floor($defd * 2);
- $r['Kmax'] -= floor($defd * 2);
- $r['min_'] -= floor($defd);
- $r['max_'] -= floor($defd);
- $r['Kmin_'] -= floor($defd * 2);
- $r['Kmax_'] -= floor($defd * 2);
-
- $r['min'] += $st1['maxAtack'];
- $r['max'] += $st1['maxAtack'];
- $r['Kmin'] += $st1['maxAtack'] * 2;
- $r['Kmin'] += $st1['maxAtack'] * 2;
-
- if ($r['min'] < 1) {
- $r['min'] = 1;
- }
- if ($r['max'] < 1) {
- $r['max'] = 1;
- }
- if ($r['Kmin'] < 2) {
- $r['Kmin'] = 2;
- }
- if ($r['Kmax'] < 2) {
- $r['Kmax'] = 2;
- }
- if ($r['Kmin_'] < 2) {
- $r['Kmin_'] = 2;
- }
- if ($r['Kmin_'] < 2) {
- $r['Kmax_'] = 2;
- }
-
- $r['m_k'] = $r['Kmax'];
-
- return $r;
- }
-
- //
- // pl
- // u1
- // t1
- // 99 =
- // u2
- //$this->delPriem($pd[$k2][1][$k],${'p'.$k2},1,${'p'.$k2jn});
- public $del_val = [];
-
- public function delPriem(
- $pl,
- $u1,
- $t = 1,
- $u2 = false,
- $rznm = ' '
- ) {
- global $u;
- if (isset($pl['priem']['id']) && !isset($this->del_val['eff'][$pl['priem']['id']])) {
- if ($pl['x'] > 1) {
- $pl['name'] = $pl['name'] . ' x' . $pl['x'];
- }
- if ($pl['timeUse'] == 77) {
- //
- mysql_query('DELETE FROM `eff_users` WHERE `id` = ' . $pl['id']);
- }
- $vLog = 'time1=' . time() . '||s1=' . $u1['sex'] . '||t1=' . $u1['team'] . '||login1=' . $u1['login'];
- if (isset($u2['id'])) {
- $vLog .= '||s2=' . $u2['sex'] . '||t2=' . $u2['team'] . '||login2=' . $u2['login'];
- }
- $mas1 = [
- 'time' => time(),
- 'battle' => $this->info['id'],
- 'id_hod' => $this->hodID,
- 'text' => '',
- 'vars' => $vLog,
- 'zona1' => '',
- 'zonb1' => '',
- 'zona2' => '',
- 'zonb2' => '',
- 'type' => '1',
- ];
- if ($t == 4) {
- $mas1['id_hod']++;
- $t = 2;
- }
- if ($t == 1) {
- $mas1['id_hod']++;
- if ($pl['priem']['file'] != '0') {
- if (file_exists('../../_incl_data/class/priems/' . $pl['priem']['file'] . '.php')) {
- require('priems/' . $pl['priem']['file'] . '.php');
- }
- } elseif ($pl['priem']['file3'] != '0') {
- if (file_exists('../../_incl_data/class/priems/' . $pl['priem']['file3'] . '.php')) {
- require('priems/' . $pl['priem']['file3'] . '.php');
- }
- } else {
- $mas1['text'] = '{tm1} {u1} {1x16x0} "
' . $pl['name'] . ' ".';
- $this->del_val['eff'][$pl['priem']['id']] = true;
- }
- } elseif ($t == 2) {
- $mas1['text'] = '{tm1} {u1} "
' . $pl['name'] . ' ".';
- } elseif ($t == 99) {
- $mas1['text'] = '{u1} "
' . $pl['name'] . ' "
' . $rznm . ' .';
- } else {
- if ($t == 100) {
- $mas1['id_hod']++;
- }
- $mas1['text'] = '{tm1} "
' . $pl['name'] . ' " {u1}.';
- }
- if ($pl['priem']['id'] != 24) {
- $this->add_log($mas1);
- }
- $this->stats[$this->uids[$pl['uid']]] = $u->getStats($pl['uid'], 0, 0, false, false, true);
- }
- }
-
- //
- public function lookStats($m)
- {
- return json_decode(str_replace(['=', '|'], ['":', ',"'], '{"' . $m . '}'), true);
- }
-
- //
-
- /**
- * @param $type
- * @param $mf
- * @param $lvl1 [not used?]
- * @param $lvl2 [not used?]
- * @return int
- */
- private function mfs($type, $mf, $lvl1 = null, $lvl2 = null)
- {
- $rval = 0;
- switch ($type) {
- case 1:
-
- //
-
- if ($mf['amf'] < 0) {
- $mf['amf'] = 0;
- }
- if ($mf['mf'] < 0) {
- $mf['mf'] = 0;
- }
- if ($mf['mf'] > $mf['smf']) {
- $rval = 100 - floor(((($mf['smf']) / ($mf['mf'] + 1)) * 100));
- }
-
- if ($rval < 1) {
- $rval = 0;
- }
- if ($rval > 75) {
- $rval = 75;
- }
- if ($mf['amf'] >= 1) {
- if ($mf['amf'] > 100) {
- $mf['amf'] = 100;
- }
- if (($mf['amf'] * 100) >= mt_rand(1, 10000)) {
- $rval = 100;
- }
- }
-
- break;
- case 2:
-
- if ($mf['mf'] < 0) {
- $mf['mf'] = 0;
- }
- if ($mf['amf'] < 0) {
- $mf['amf'] = 0;
- }
- if ($mf['smf'] < 0) {
- $mf['smf'] = 0;
- }
- if ($mf['asmf'] < 0) {
- $mf['asmf'] = 0;
- }
-
- if ($mf['mf'] > $mf['smf']) {
- $rval = 100 - floor(((($mf['smf']) / ($mf['mf'] + 1)) * 100)); //2.5
- }
- if ($rval < 1) {
- $rval = 0;
- }
- if ($rval > 75) {
- $rval = 75;
- }
- if ($mf['asmf'] >= 0) //
- {
- if ($mf['asmf'] > 100) {
- $mf['asmf'] = 100;
- }
- if ($mf['asmf'] >= rand(1, 100)) {
- $rval = 0;
- }
- }
- if ($mf['amf'] >= 0) {
- if ($mf['amf'] > 100) {
- $mf['amf'] = 100;
- }
- if ($mf['amf'] >= rand(1, 100)) {
- $rval = 100;
- }
- }
- break;
- case 3:
- if ($mf[1] < 1) {
- $mf[1] = 1;
- }
- if ($mf[2] < 1) {
- $mf[2] = 1;
- }
-
- //
- $rval = $mf[1] - $mf[2] / 2;
- if ($rval > 75) {
- $rval = 75;
- }
- if ($rval < 1) {
- $rval = 1;
- }
-
- break;
- case 4:
- $mf = round($mf * 0.6);
- if ($mf < 1) {
- $mf = 0;
- }
- if ($mf > 100) {
- $mf = 100;
- }
- $rval = min($mf, 100); //
- break;
- case 5:
- if ($mf < 1) {
- $mf = 0;
- }
- $rval = min($mf, 85); //
- break;
- case 6:
- //
- //$mf['a']
- //$mf['b']
- if ($mf['a'] > 0) {
- if ($mf['b'] > 0) {
- $rval = round($mf['a'] - ($mf['b'] / 2));
- } else {
- $rval = $mf['a'];
- }
- }
-
- if ($rval < 1) {
- $rval = 0;
- }
- if ($rval > 75) {
- $rval = 75;
- }
-
- break;
- }
-
- return $this->get_chanse($rval) ? 1 : 0;
- }
-
- public function get_chanse($percent)
- {
- if ($percent <= 0) {
- return false;
- }
- return mt_rand(1, 100) <= max($percent, 100);
- }
-
- //
- public function smena($uid, $auto = false, $lastdie = false)
- {
- global $u;
- if (($auto || $u->info['smena'] <= 0) && !$auto) {
- return ' ';
- }
- if ($this->stats[$this->uids[$u->info['id']]]['hpNow'] < 1) {
- return ' , ...';
- }
- if (
- !isset($this->uids[$uid]) ||
- $uid == $u->info['id'] ||
- $this->users[$this->uids[$uid]]['team'] == $this->users[$this->uids[$u->info['id']]]['team']
- ) {
- return ' []';
- }
- if (isset($this->ga[$u->info['id']][$uid]) && !$lastdie) {
- return ' !';
- }
- if (ceil($this->stats[$this->uids[$uid]]['hpNow']) < 1) {
- return ' , ';
- }//
- if (!$auto) {
- $u->info['smena']--;
- }
- mysql_query('UPDATE `stats` SET `enemy` = ' . $uid . ',`smena` = ' . $u->info['smena'] . ' WHERE `id` = ' . $u->info['id']);
- $u->info['enemy'] = $uid;
- $this->users[$this->uids[$uid]]['smena'] = $u->info['smena'];
- $this->users[$this->uids[$u->info['id']]]['enemy'] = $uid;
- return 1;
- }
-
- //- //
- public function autoSmena()
- {
- global $u;
- $ms = [];
- $ms_all = [];
- $ms_ansf = [];
- $i = 0;
- $j = 0;
- $z = 0;
- while ($i < count($this->users)) {
- if (isset($this->users[$i]) && $this->users[$i]['id'] != $u->info['id'] && $this->users[$i]['team'] != $u->info['team'] && $this->stats[$i]['hpNow'] > 0 && -($u->info['enemy']) != $this->users[$i]['id']) {
- if (!isset($this->ga[$u->info['id']][$this->users[$i]['id']])) {
- $ms[$j] = $this->users[$i]['id'];
- $j++;
- }
- if (!isset($this->uids[(-($u->info['enemy']))])) {
- $ms_all[] = $this->users[$i]['id'];
- }
- if (isset($this->ga[$this->users[$i]['id']][$u->info['id']])) {
- $ms_ansf[$z] = $this->users[$i]['id'];
- $z++;
- }
- }
- $i++;
- }
- $msh = [];
- if ($j == 0 && $z == 0) {
- $enemydie = 0;
-
- if (isset($this->stats[$this->uids[$u->info['enemy']]])) {
- $u->info['enemy'] = 0;
- $enemydie = 1;
- }
-
- if ((!isset($this->uids[(-($u->info['enemy']))]) || $this->stats[$this->uids[(-($u->info['enemy']))]]['hpNow'] < 1) && ($u->info['enemy'] < 0 || $enemydie == 1)) {
- $i = 0;
- $j = 0;
- while ($i < count($this->users)) {
- if (isset($this->users[$i]) && $this->users[$i]['id'] != $u->info['id'] && $this->users[$i]['team'] != $u->info['team'] && $this->stats[$i]['hpNow'] >= 1 && -($u->info['enemy']) != $this->users[$i]['id']) {
- $ms[$j] = $this->users[$i]['id'];
- $msh[$ms[$j]] = true;
- $j++;
- }
- $i++;
- }
- }
- }
-
- $ms = $ms[rand(0, $j - 1)];
- $ms_ansf = $ms_ansf[rand(0, $z - 1)];
- if ($z > 0) {
- $this->smena($ms_ansf, true);
- } elseif ($j > 0) {
- if (isset($msh[$ms])) {
- $this->smena($ms, true, true);
- } else {
- $this->smena($ms, true);
- }
- } else {
- if ($u->info['enemy'] < 0) {
- $smnr5 = $this->smena(-($u->info['enemy']), true);
- unset($smnr5);
- }
- }
- }
-
- // ()
- private function botAtack($uid, $pl, $tp)
- {
- $test_atack = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_act` WHERE `battle` = "' . $this->info['id'] . '" AND ((
- `uid1` = "' . $pl . '" AND `uid2` = "' . $uid . '"
- ) OR (
- `uid2` = "' . $pl . '" AND `uid1` = "' . $uid . '"
- )) LIMIT 1'));
-
- if ($tp == 1 && !isset($test_atack['id'])) {
- $test_uid = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $uid . '" AND `hpNow` >= 1 LIMIT 1'));
- $test_pl = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $pl . '" AND `hpNow` >= 1 LIMIT 1'));
- if (isset($test_uid['id']) && isset($test_pl['id']) && $test_uid['id'] != $test_pl['id']) {
- $a = rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5);
- $b = rand(1, 5);
- mysql_query('INSERT INTO `battle_act` (`battle`,`time`,`uid1`,`uid2`,`a1`,`b1`) VALUES ("' . $this->info['id'] . '","' . time() . '","' . $pl . '","' . $uid . '","' . $a . '","' . $b . '")');
- }
- } elseif ($tp == 2) {
- //
- $test_uid = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $uid . '" AND `hpNow` >= 1 LIMIT 1'));
- $test_pl = mysql_fetch_array(mysql_query('SELECT * FROM `stats` WHERE `id` = "' . $pl['uid2'] . '" AND `hpNow` >= 1 LIMIT 1'));
- if (isset($test_uid['id']) && isset($test_pl['id']) && $test_uid['id'] != $test_pl['id']) {
- $bot = $this->users[$this->uids[$pl['uid2']]];
- $na = ['id' => 0, 'a' => [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0], 'b' => 0];
- $a222 = rand(1, 5) . '_' . rand(1, 5) . '_' . rand(1, 5) . '_' . rand(1, 5) . '_' . rand(1, 5);
- $a = explode('_', $a222);
- $i = 1;
- $na['id'] = time();
- while ($i <= 5) {
- if (isset($a[$i - 1])) {
- $a[$i - 1] = intval(round($a[$i - 1]));
- if ($a[$i - 1] >= 1 && $a[$i - 1] <= 5) {
- $na['a'][$i] = $a[$i - 1];
- } else {
- $na['a'][$i] = 0;
- }
- }
- $i++;
- }
- $na['b'] = rand(1, 5);
- //
-
- $this->atacks[$pl['id']]['a2'] = $a222;
- $this->atacks[$pl['id']]['b2'] = $na['b'];
- $this->startAtack($pl['id']);
- }
- }
- //unset($test_uid,$test_pl,$test_atack);
- }
-
- // , , ,
- public function testActions()
- {
- //
- $m = mysql_query('SELECT * FROM `battle_act` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `id`');
- $i = 0;
- $botA = [];
- $botR = [];
- while ($pl = mysql_fetch_array($m)) {
- //mysql_query('DELETE FROM `battle_act` WHERE `battle` = "'.$this->info['id'].'" AND `uid1` = "'.$pl['uid2'].'" AND `uid2` = "'.$pl['uid1'].'"');
- $pluids = mysql_fetch_array(mysql_query('SELECT `hpNow` FROM `stats` WHERE (`id` = "' . $pl['uid1'] . '" AND `hpNow` <= 0) OR (`id` = "' . $pl['uid2'] . '" AND `hpNow` <= 0) LIMIT 1'));
-
- $pltest = mysql_fetch_array(mysql_query('SELECT * FROM `battle_act` WHERE `id` = "' . $pl['id'] . '" LIMIT 1'));
- if (isset($pltest['id'])) {
- if (isset($pluids['hpNow'])) {
- mysql_query('DELETE FROM `battle_act` WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
- } elseif ($pl['time'] + $this->info['timeout'] > time()) {
- // ,
- $this->atacks[$pl['id']] = $pl;
- $this->ga[$pl['uid1']][$pl['uid2']] = $pl['id'];
- $this->ag[$pl['uid2']][$pl['uid1']] = $pl['id'];
- if (isset($this->iBots[$pl['uid1']])) {
- //
- $botA[$pl['uid1']] = $pl['id'];
- } elseif (isset($this->iBots[$pl['uid2']])) {
- //
- $botR[$pl['uid2']] = $pl['id'];
- if ($this->users[$this->uids[$pl['uid2']]]['timeGo'] < time()) {
- $this->botAtack($pl['uid1'], $pl, 2);
- }
- }
- } else {
- //
- $pl['time'] = time();
- if ($pl['a1'] == 0 && $pl['a2'] == 0) {
- // 1
- $pl['out1'] = time();
- $pl['tout1'] = 1;
- // 2
- $pl['out2'] = time();
- $pl['tout2'] = 1;
- } elseif ($pl['a1'] == 0) {
- // 1
- $pl['out1'] = time();
- $pl['tout1'] = 1;
- } elseif ($pl['a2'] == 0) {
- // 2
- $pl['out2'] = time();
- $pl['tout2'] = 1;
- }
- //
- $this->atacks[$pl['id']] = $pl;
- $this->startAtack($pl['id']);
- mysql_query('DELETE FROM `battle_act` WHERE `id` = ' . $pl['id']);
- }
- }
- }
- //
- if ($this->uAtc['id'] > 0 && $this->na == 1) {
- if ($pl['out1'] == 0 && $pl['out2'] == 0) {
- //
- if ($pl['uid1'] == $u->info['id'] || $pl['uid2'] == $u->info['id']) {
- $this->addNewAtack();
- }
- } else {
- $this->addNewAtack();
- }
- }
- //
-
- //
-
- //,
- while ($i < count($this->bots)) {
- $bot = $this->bots[$i];
- if (isset($bot) && $this->stats[$this->uids[$bot]]['hpNow'] >= 1 && $this->stats[$this->uids[$bot]]['pass'] != 'saintlucia') // saintlucia
- {
- $j = 0;
- while ($j < count($this->users)) {
- if ($this->info['razdel'] == 0) {
- $tnbot = time() + rand(1, 1);
- } else {
- $tnbot = time() + rand(1, 2);
- }
- if ($this->users[$j]['hpNow'] >= 1 && $this->users[$this->uids[$bot]]['hpNow'] >= 1 && $this->users[$this->uids[$bot]]['team'] != $this->users[$j]['team']) {
- if (isset($this->users[$j]) && $this->stats[$j]['hpNow'] >= 1 && $this->stats[$this->uids[$bot]]['hpNow'] >= 1 && !isset($this->ga[$bot][$this->users[$j]['id']]) && !isset($this->ag[$bot][$this->users[$j]['id']]) && $this->users[$j]['id'] != $bot && $this->users[$j]['team'] != $this->users[$this->uids[$bot]]['team']) {
- if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time()) {
- $this->botAtack($this->users[$j]['id'], $bot, 1);
- mysql_query('UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this->users[$this->uids[$bot]]['id'] . '" LIMIT 1');
- }
- } elseif (isset($this->users[$i]) && $this->users[$i]['bot'] > 0 && $this->stats[$i]['hpNow'] >= 1 && $this->stats[$this->uids[$bot]]['hpNow'] >= 1 && $this->users[$i]['id'] != $bot && $this->users[$i]['team'] != $this->users[$this->uids[$bot]]['team']) {
- if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time() && $this->botAct($bot)) {
- if (!isset($this->ga[$bot][$this->users[$i]['id']]) && $this->users[$this->uids[$bot]]['timeGo'] < time() && !isset($this->ag[$bot][$this->users[$i]['id']])) {
- $this->botAtack($this->users[$i]['id'], $bot, 1);
- mysql_query('UPDATE `stats` SET `timeGo` = ' . $tnbot . ' WHERE `id` = ' . $this->users[$this->uids[$bot]]['id']);
- } elseif (isset($this->ga[$bot][$this->users[$i]['id']]) && $this->users[$this->uids[$bot]]['timeGo'] < time()) {
- $this->botAtack($bot, $this->users[$i]['id'], 1);
- mysql_query('UPDATE `stats` SET `timeGo` = ' . $tnbot . ' WHERE `id` = ' . $this->users[$this->uids[$bot]]['id']);
- }
- }
- } else {
- //
- //
- if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time() && $this->users[$j]['hpNow'] >= 1 && $this->users[$this->uids[$bot]]['hpNow'] >= 1) {
- $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['a1'] =
- rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5);
- $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['b1'] = rand(1, 5);
- $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['a2'] =
- rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5);
- $this->atacks[$this->ga[$bot][$this->users[$j]['id']]]['b2'] = rand(1, 5);
- $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['a1'] =
- rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5);
- $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['b1'] = rand(1, 5);
- $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['a2'] =
- rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5) . rand(1, 5);
- $this->atacks[$this->ag[$bot][$this->users[$j]['id']]]['b2'] = rand(1, 5);
- if (isset($this->ga[$bot][$this->users[$j]['id']]) && $this->users[$j]['bot'] > 0) {
- if ($this->users[$j]['timeGo'] < time() && $this->users[$this->uids[$bot]]['timeGo'] < time()) {
- $tnbot = time() + rand(3, 7);
- if ($this->info['type'] == 329) { //
- $tnbot = time() - 1;
- }
- $this->startAtack($this->ga[$bot][$this->users[$j]['id']]);
- $this->users[$this->uids[$bot]]['timeGo'] = $tnbot;
- mysql_query('UPDATE `stats` SET `timeGo` = ' . $tnbot . ' WHERE `id` = ' . $this->users[$this->uids[$bot]]['id']);
- }
- } elseif (isset($this->ag[$bot][$this->users[$j]['id']]) && $this->users[$j]['bot'] > 0) {
- if ($this->users[$this->uids[$bot]]['timeGo'] < time() && $this->users[$j]['timeGo'] < time()) {
- $this->startAtack($this->ag[$bot][$this->users[$j]['id']]);
- $tnbot = time() + rand(3, 7);
- if ($this->info['type'] == 329) { //
- $tnbot = time() - 1;
- }
- $this->users[$this->uids[$bot]]['timeGo'] = $tnbot;
- mysql_query('UPDATE `stats` SET `timeGo` = ' . $tnbot . ' WHERE `id` = ' . $this->users[$this->uids[$bot]]['id']);
- }
- }
- }
- }
- }
- $j++;
- }
- }
- $i++;
- }
- }
-
- //
- private function botAct($uid)
- {
- if ($this->users[$this->uids[$uid]]['bot'] > 0) {
- if ($this->users[$this->uids[$uid]]['online'] < time() - 3) {
- $this->users[$this->uids[$uid]]['online'] = time();
- mysql_query('UPDATE `users` SET `online` = unix_timestamp() WHERE `id` = ' . (int)$uid);
- return true;
- } elseif (rand(0, 2) == 1) {
- return true;
- }
- }
- return false;
- }
-
- //
- public function battleInfo($id)
- {
- $b = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = ' . (int)$id));
- if (isset($b['id'])) {
- $this->hodID = mysql_fetch_array(mysql_query('SELECT `id_hod` FROM `battle_logs` WHERE `battle` = ' . $b['id'] . ' ORDER BY `id` DESC LIMIT 1'));
- if (isset($this->hodID['id_hod'])) {
- $this->hodID = $this->hodID['id_hod'];
- } else {
- $this->hodID = 0;
- }
- return $b;
- } else {
- return false;
- }
- }
-
- //
- public function addAtack()
- {
- global $js;
- if (isset($_POST['atack'], $_POST['block'])) {
- $na = [
- 'id' => time(),
- 'a' => [1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0],
- 'b' => intval(round($_POST['block'])),
- ];
-
- $a = explode('_', $_POST['atack']);
- $i = 1;
-
- while ($i <= 5) {
- if (isset($a[$i - 1])) {
- $a[$i - 1] = intval(round($a[$i - 1]));
- if ($a[$i - 1] >= 1 && $a[$i - 1] <= 5) {
- $na['a'][$i] = $a[$i - 1];
- } else {
- $na['a'][$i] = 0;
- }
- }
- $i++;
- }
-
- if ($na['b'] < 1 || $na['b'] > 5) {
- $na['b'] = 0;
- }
-
- $this->uAtc = $na;
- $js .= 'testClearZone();';
- } else {
- $this->e = ' ';
- }
- }
-
- //
- public function teamsTake()
- {
- global $u;
- $rs = '';
- $ts = [];
- $tsi = 0;
- if ($this->info['id'] > 0) {
- //
- $nxtlg = [];
- $t = mysql_query('SELECT `u`.`room`,`u`.`no_ip`,`u`.`twink`,`u`.`stopexp`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`bot_id`,`u`.`money3`,`u`.`money2` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $this->info['id'] . '"');
- $i = 0;
- $bi = 0;
- $up = '';
- if ($this->info['start2'] == 0) {
- $tststrt = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = ' . $this->info['id'] . ' AND `start2` = 0 LIMIT 1'));
- if (isset($tststrt['id'])) {
- mysql_query('UPDATE `battle` SET `start2` = unix_timestamp() WHERE `id` = ' . $this->info['id'] . ' LIMIT 1');
- } else {
- $this->info['start2'] = time();
- }
- }
- while ($pl = mysql_fetch_array($t)) {
- //
- if ($pl['login2'] == '') {
- $pl['login2'] = $pl['login'];
- }
- $this->users[$i] = $pl;
- $this->uids[$pl['id']] = $i;
-
- if ($this->info['start2'] == 0) {
- mysql_query('UPDATE `users` SET `notrhod` = -1 WHERE `id` = ' . $this->users[$i]['id'] . ' LIMIT 1');
- $this->users[$i]['notrhod'] = -1;
- }
-
- if ($pl['bot'] > 0) {
- $this->bots[$bi] = $pl['id'];
- $this->iBots[$pl['id']] = $bi;
- $bi++;
- }
- //
- $this->stats[$i] = $u->getStats($pl, 0, 0, false, $this->cached, true);
- //
- if ($this->info['start2'] == 0) {
- if (!isset($ts[$this->users[$i]['team']])) {
- $tsi++;
- $ts[$this->users[$i]['team']] = $tsi;
- }
-
- if ($this->users[$i]['level'] <= 7) {
- $this->users[$i]['tactic7'] = floor(10 / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']);
- } elseif ($this->users[$i]['level'] == 8) {
- $this->users[$i]['tactic7'] = floor(20 / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']);
- } elseif ($this->users[$i]['level'] == 9) {
- $this->users[$i]['tactic7'] = floor(30 / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']);
- } elseif ($this->users[$i]['level'] >= 10) {
- $this->users[$i]['tactic7'] = floor((40 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']);
- }
-
- if ($this->stats[$i]['s7'] > 49) {
- mysql_query('UPDATE `eff_users` SET `delete`= unix_timestamp() WHERE `uid` = ' . $this->users[$i]['id'] . ' AND `overType` = 101 AND `delete` = 0');
- mysql_query("
- INSERT INTO `eff_users` ( `id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES
- ( 22, '" . $this->stats[$i]['id'] . "', '', 'add_spasenie=1', 101, 77, 0, '" . $this->stats[$i]['id'] . "', 0, 'priem', 324, 'preservation.gif', 1, -1, '', 0, 0, '', 0, 0, 0, 1, 0);
- ");
- }
-
-
- #####
- // animal_bonus
- if ($this->users[$i]['animal'] > 0) {
- $a = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal` WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `id` = "' . $this->users[$i]['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1'));
- if (isset($a['id']) && $a['eda'] >= 1) {
- $anl = mysql_fetch_array(mysql_query('SELECT `bonus` FROM `levels_animal` WHERE `type` = "' . $a['type'] . '" AND `level` = "' . $a['level'] . '" LIMIT 1'));
- $anl = $anl['bonus'];
-
- $tpa = [
- 1 => 'cat',
- 2 => 'owl',
- 3 => 'wisp',
- 4 => 'demon',
- 5 => 'dog',
- 6 => 'pig',
- 7 => 'dragon',
- ];
- $tpa2 = [
- 1 => '',
- 2 => '',
- 3 => '',
- 4 => '',
- 5 => '',
- 6 => '',
- 7 => '',
- ];
- $tpa3 = [
- 1 => ' ',
- 2 => ' ',
- 3 => ' ',
- 4 => ' ',
- 5 => '',
- 6 => ' ',
- 7 => '',
- ];
-
- mysql_query('UPDATE `eff_users` SET `delete`="' . time() . '" WHERE `uid` = "' . $this->users[$i]['id'] . '" AND `overType` = 100 AND `delete` = 0');
-
- mysql_query('INSERT INTO `eff_users` (`hod`,`v2`,`img2`,`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`v1`,`user_use`) VALUES ("-1","201","summon_pet_' . $tpa[$a['type']] . '.gif",22,"' . $this->users[$i]['id'] . '","' . $tpa3[$a['type']] . ' [' . $a['level'] . ']","' . $anl . '","100","77","priem","' . $this->users[$i]['id'] . '")');
-
- //
- if ($a['type'] == 7) {
- if ($a['level'] == 10) {
- $this->users[$i]['tactic7'] = floor((50 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']);
- } elseif ($a['level'] == 11) {
- $this->users[$i]['tactic7'] = floor((65 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']);
- } elseif ($a['level'] == 12) {
- $this->users[$i]['tactic7'] = floor((90 + $this->stats[$i]['s7']) / $this->stats[$i]['hpAll'] * $this->stats[$i]['hpNow']);
- }
- }
- //
- $anl = $this->lookStats($anl);
-
- $vLog =
- 'time1=' . time() .
- '||s1=' . $this->users[$i]['sex'] .
- '||t1=' . $this->users[$i]['team'] .
- '||login1=' . $this->users[$i]['login'];
- $vLog .=
- '||s2=1||t2=' . $this->users[$i]['team'] .
- '||login2=' . $a['name'] . ' ( ' . $this->users[$i]['login'] . ')';
-
- $mas1 = [
- 'time' => time(),
- 'battle' => $this->info['id'],
- 'id_hod' => 1,
- 'vars' => $vLog,
- 'zona1' => '',
- 'zonb1' => '',
- 'zona2' => '',
- 'zonb2' => '',
- 'type' => '1',
- ];
-
- $ba = '';
- $i6 = 0;
- while ($i6 < count($u->items['add'])) {
- if (isset($anl['add_' . $u->items['add'][$i6]]) && $anl['add_' . $u->items['add'][$i6]] > 0) {
- if ($u->items['add'][$i6] == 'mib1') {
- $ba .= ' : +' . $anl['add_' . $u->items['add'][$i6]] . ', ';
- } elseif ($u->items['add'][$i6] == 'mib2') {
- $ba .= ' : +' . $anl['add_' . $u->items['add'][$i6]] . ', ';
- } elseif ($u->items['add'][$i6] == 'mib3') {
- $ba .= ' : +' . $anl['add_' . $u->items['add'][$i6]] . ', ';
- } elseif ($u->items['add'][$i6] == 'mib4') {
- $ba .= ' : +' . $anl['add_' . $u->items['add'][$i6]] . ', ';
- } elseif (
- $u->items['add'][$i6] != 'mab1' &&
- $u->items['add'][$i6] != 'mab2' &&
- $u->items['add'][$i6] != 'mab3' &&
- $u->items['add'][$i6] != 'mab4'
- ) {
- $ba .= $u->is[$u->items['add'][$i6]] . ': +' . $anl['add_' . $u->items['add'][$i6]] . ', ';
- }
- }
- $i6++;
- }
- $ba = trim($ba, ', ');
- if ($ba == '') {
- $ba = ' ';
- }
-
- $mas1['text'] = '{tm1} {u2} , "
' . $tpa3[$a['type']] . ' [' . $a['level'] . '] " {u1}. (' . $ba . ')';
- $nxtlg[] = $mas1;
- mysql_query('UPDATE `users_animal` SET `eda` = `eda` - 1 WHERE `id` = "' . $a['id'] . '" LIMIT 1');
- $this->get_comment();
- }
- }
-
- mysql_query('UPDATE `stats` SET `last_hp` = "0",`tactic1`="0",`tactic2`="0",`tactic3`="0",`tactic4`="0",`tactic5`="0",`tactic6`="0",`tactic7` = "' . ($this->users[$i]['tactic7']) . '" WHERE `id` = "' . $this->users[$i]['id'] . '" LIMIT 1');
-
- $rs[$this->users[$i]['team']] .= $u->microLogin($this->users[$i], 2) . ', ';
- }
- $up .= '`uid` = "' . $pl['id'] . '" OR';
- //battle-user (, )
- $mybu = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_users` WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . mysql_real_escape_string($pl['id']) . '" LIMIT 1'));
- if (!isset($mybu['id'])) {
- //
- $this->addstatuser($pl['id']);
- }
- $i++;
- }
-
- $up = rtrim($up, ' OR');
-
- //
-
- if ($this->info['start1'] == 0) {
- $tststrt = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "' . $this->info['id'] . '" AND `start1` = "0" LIMIT 1'));
- if (isset($tststrt['id'])) {
- $upd = mysql_query('UPDATE `battle` SET `start1` = "' . time() . '" WHERE `id` = "' . $this->info['id'] . '" LIMIT 1');
- if ($upd) {
- $i = 0;
- $r = '';
- while ($i <= $tsi) {
- if (isset($rs[$i]) && $rs[$i] != '') {
- $r .= rtrim($rs[$i], ', ') . ' ';
- }
- $i++;
- }
- $r = rtrim($r, ' ');
- $r = str_replace('"', '\\\\\"', $r);
- $this->hodID++;
- $time = time();
- $mass = [
- 'time' => $time,
- 'battle' => $this->info['id'],
- 'id_hod' => $this->hodID,
- 'vars' => "time1=$time||",
- 'zona1' => '',
- 'zonb1' => '',
- 'zona2' => '',
- 'zonb2' => '',
- 'type' => '1',
- ];
- $r = '
' . date('d.m.Y H:i',
- $this->info['time_start']) . ' , ' . $r . ' .';
- mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . $mass['time'] . '","' . $mass['battle'] . '","' . $mass['id_hod'] . '","' . $r . '","' . $mass['vars'] . '","' . $mass['zona1'] . '","' . $mass['zonb1'] . '","' . $mass['zona2'] . '","' . $mass['zonb2'] . '","' . $mass['type'] . '")');
-
- $this->info['start1'] = time();
- }
- }
-
- if (!empty($nxtlg)) {
- foreach ($nxtlg as $item) {
- $this->add_log($item);
- }
- }
- }
- }
- }
-
- //
- private function restZonb($uid1, $uid2)
- {
- if ($this->stnZbVs[$uid1] > 0) {
- $this->stats[$this->uids[$uid1]]['zonb'] = $this->stnZbVs[$uid1];
- }
- if ($this->stnZbVs[$uid2] > 0) {
- $this->stats[$this->uids[$uid1]]['zonb'] = $this->stnZbVs[$uid2];
- }
- }
-
- // ()
- public function testZonbVis()
- {
- global $u;
- if ($this->stnZbVs == 0) {
- $zb = $this->stats[$this->uids[$u->info['id']]]['zonb'];
- $this->stnZbVs = $zb;
- } else {
- $zb = $this->stnZb;
- }
- $eu = $this->users[$this->uids[$u->info['id']]]['enemy'];
- if ($zb > 3) {
- $zb = 3;
- }
- if (
- !empty($eu) &&
- ($this->stats[$this->uids[$eu]]['weapon1'] == 1 || $this->stats[$this->uids[$eu]]['weapon2'] == 1) &&
- $this->stats[$this->uids[$u->info['id']]]['weapon1'] != 1 && $this->stats[$this->uids[$u->info['id']]]['weapon2'] != 1
- ) {
- $zb -= 1;
- }
- if ($zb < 1) {
- $zb = 1;
- }
- return $zb;
- }
-
- //
- private function testZonb($uid, $uid2)
- {
- $zba = [];
-
- if ($this->stnZb[$uid] == 0) {
- $zba[1] = $this->stats[$this->uids[$uid]]['zonb'];
- $this->stnZb[$uid] = $zba[1];
- } else {
- $zba[1] = $this->stnZb[$uid];
- }
-
- if ($this->stnZb[$uid2] == 0) {
- $zba[2] = $this->stats[$this->uids[$uid2]]['zonb'];
- $this->stnZb[$uid] = $zba[2];
- } else {
- $zba[2] = $this->stnZb[$uid2];
- }
-
- if ($zba[1] > 3) {
- $zba[1] = 3;
- }
- if ($zba[2] > 3) {
- $zba[2] = 3;
- }
-
- // 1
- if (
- ($this->stats[$this->uids[$uid2]]['weapon1'] == 1 || $this->stats[$this->uids[$uid2]]['weapon2'] == 1) &&
- $this->stats[$this->uids[$uid]]['weapon1'] != 1 && $this->stats[$this->uids[$uid]]['weapon2'] != 1
- ) {
- $zba[1] -= 1;
- }
-
- // 2
- if (
- ($this->stats[$this->uids[$uid]]['weapon1'] == 1 || $this->stats[$this->uids[$uid]]['weapon2'] == 1) &&
- $this->stats[$this->uids[$uid2]]['weapon1'] != 1 && $this->stats[$this->uids[$uid2]]['weapon2'] != 1
- ) {
- $zba[2] -= 1;
- }
-
- if ($zba[1] < 1) {
- $zba[1] = 1;
- }
- if ($zba[2] < 1) {
- $zba[2] = 1;
- }
-
- $this->stats[$this->uids[$uid]]['zonb'] = $zba[1];
- $this->stats[$this->uids[$uid2]]['zonb'] = $zba[2];
- if (
- $this->stats[$this->uids[$uid]]['min_zonb'] > 0 &&
- $this->stats[$this->uids[$uid]]['zonb'] < $this->stats[$this->uids[$uid]]['min_zonb']
- ) {
- $this->stats[$this->uids[$uid]]['zonb'] = $this->stats[$this->uids[$uid]]['min_zonb'];
- }
- if (
- $this->stats[$this->uids[$uid2]]['min_zonb'] > 0 &&
- $this->stats[$this->uids[$uid2]]['zonb'] < $this->stats[$this->uids[$uid2]]['min_zonb']
- ) {
- $this->stats[$this->uids[$uid2]]['zonb'] = $this->stats[$this->uids[$uid2]]['min_zonb'];
- }
- }
-
- //
- public function genTeams($you)
- {
- $ret = '';
- $teams = [];
- //
- $i = 0;
- $j = 1;
- $tms = [];
-
- $teams[$this->users[$this->uids[$you]]['team']] = '';
- $tms[0] = $this->users[$this->uids[$you]]['team'];
-
- while ($i < count($this->uids)) {
- if ($this->stats[$i]['hpNow'] > 0) {
- if (!isset($teams[$this->users[$i]['team']])) {
- $tms[$j] = $this->users[$i]['team'];
- $j++;
- }
- if ($this->stats[$i]['hpNow'] < 0) {
- $this->stats[$i]['hpNow'] = 0;
- }
- if ($this->stats[$i]['hpAll'] < $this->stats[$i]['hpNow']) {
- $this->stats[$i]['hpNow'] = $this->stats[$i]['hpAll'];
- }
- $a1ms = '';
- if ($this->ga[$this->users[$i]['id']][$you]) {
- $a1mc = '';
- $ac = mysql_fetch_array(mysql_query('SELECT * FROM `battle_act` WHERE `id` = "' . $this->ga[$this->users[$i]['id']][$you] . '" LIMIT 1'));
- if (isset($ac) && $ac['time'] + $this->info['timeout'] - 15 < time()) {
- $a1mc = 'color:red;';
- }
- $a1ms = 'style=\"text-decoration: underline; ' . $a1mc . '\"';
- } elseif ($this->ag[$this->users[$i]['id']][$you]) {
- $a1mc = '';
- $ac = mysql_fetch_array(mysql_query('SELECT * FROM `battle_act` WHERE `id` = "' . $this->ag[$this->users[$i]['id']][$you] . '" LIMIT 1'));
- if (isset($ac) && $ac['time'] + $this->info['timeout'] - 15 < time()) {
- $a1mc = 'color:green;';
- }
- $a1ms = 'style=\"text-decoration: overline; ' . $a1mc . '\"';
- }
- if ($this->users[$i]['login2'] == '') {
- $this->users[$i]['login2'] = $this->users[$i]['login'];
- }
- if ($this->users[$i]['align'] == 9) {
- $this->stats[$i]['hpNow'] = $this->stats[$i]['hpNow'] / ($this->stats[$i]['hpAll'] / 100);
- $this->stats[$i]['hpAll'] = '100%';
- }
- $ldr = '';
- if ($this->users[$i]['lider'] == $this->info['id']) {
- $ldr = '
users[$i]['team'] . '.gif \>';
- }
- $teams[$this->users[$i]['team']] .= ', ' . $ldr . '
users[$i]['team'] . '\" onClick=\"top.chat.addto(\'' . $this->users[$i]['login2'] . '\',\'to\'); return false;\" oncontextmenu=\"top.infoMenu(\'' . $this->users[$i]['login2'] . '\',event,\'main\'); return false;\">' . $this->users[$i]['login2'] . ' [' . floor($this->stats[$i]['hpNow']) . '/' . $this->stats[$i]['hpAll'] . '] ';
- }
- $i++;
- }
-
- //
- $i = 0;
- while ($i < count($tms)) {
- $teams[$tms[$i]] = ltrim($teams[$tms[$i]], ', ');
- if ($teams[$tms[$i]] != '') {
- $teams[$tms[$i]] = '
' . $teams[$tms[$i]];
- $ret .= $teams[$tms[$i]];
- if (count($tms) > $i + 1) {
- $ret .= '
';
- }
- }
- $i++;
- }
- return "genteam($ret);";
- }
-
- public function addTravm($uid, $type, $lvl)
- {
- $timeEnd = 0;
- if ($type == 1) {
- $name = ' ';
- $stat = rand(1, 3); //
- $timeEnd = rand(1, 3);// 1.30 6
- $data = 'add_s' . $stat . '=-' . $lvl;
- $img = 'eff_travma1.gif';
- $v1 = 1;
- } elseif ($type == 2) {
- $name = ' ';
- $stat = rand(1, 3); //
- $timeEnd = rand(3, 5);// 6 12
- $data = 'add_s' . $stat . '=-' . ($lvl * 2);
- $v1 = 2;
- $img = 'eff_travma2.gif';
- } elseif ($type == 3) {
- $name = ' ';
- $stat = rand(1, 3); //
- $timeEnd = rand(5, 7);// 12 6
- $data = 'add_s' . $stat . '=-' . ($lvl * 3);
- $v1 = 3;
- $img = 'eff_travma3.gif';
- } elseif ($type == 4) {
- $name = ' ';
- $stat = rand(1, 3); //
- $timeEnd = 24;// 24
- $data = 'add_s' . $stat . '=-' . ($lvl * 50);
- $v1 = 4;
- $img = 'eff_travma4.gif';
- }
- $timeEnd *= 3600;
-
- mysql_query('INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (0,unix_timestamp(), -1, ' . $name . ',' . $data . ',' . $uid . ', 4, ' . $img . ',' . $timeEnd . ', ' . $v1 . ')');
- mysql_query('INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES (0,unix_timestamp(), -1, ": ","add_notravma=1",' . $uid . ', 263, "cure1.gif",21600, "")');
- }
-
- public function testUserInfoBattle($uid)
- {
- global $u;
- if (!isset($this->uids[$uid])) {
- // ( )
- if (!isset($this->uids[$uid])) {
- $this->uids[$uid] = count($this->users);
- }
- $this->users[$this->uids[$uid]] = mysql_fetch_array(mysql_query('SELECT
-
- `u`.`id`,`u`.`login`,`u`.`login2`,`u`.`online`,`u`.`admin`,`u`.`city`,`u`.`cityreg`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,
- `u`.`level`,`u`.`money`,`u`.`money3`,`u`.`money2`,`u`.`money4`,`u`.`battle`,`u`.`sex`,`u`.`obraz`,`u`.`win`,`u`.`win_t`,
- `u`.`lose`,`u`.`lose_t`,`u`.`nich`,`u`.`timeMain`,`u`.`invis`,`u`.`bot_id`,`u`.`animal`,`u`.`type_pers`,
- `u`.`notrhod`,`u`.`bot_room`,`u`.`inUser`,`u`.`inTurnir`,`u`.`inTurnirnew`,`u`.`activ`,`u`.`stopexp`,`u`.`real`,
-
- `st`.*
-
- FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = "' . $uid . '" LIMIT 1'));
- $this->stats[$this->uids[$uid]] = $u->getStats($this->users[$this->uids[$uid]], 0, 0, false, false, true);
- }
- }
-
- ///----
- public function spaCheck($u1)
- {
- if ($this->stats[$this->uids[$u1]]['hpNow'] < 1) {
- mysql_query('DELETE FROM `battle_act` WHERE `uid1` = "' . $u1 . '" OR `uid2` = "' . $u1 . '"');
- if ($this->stats[$this->uids[$u1]]['spasenie'] > 0 && $this->users[$this->uids[$u1]]['tactic7'] >= 25) //
- {
- //
- //
- if ($this->stats[$this->uids[$u1]]['s7'] > 49 && $this->stats[$this->uids[$u1]]['s7'] < 75) {
- //
- mysql_query("INSERT INTO `eff_users`
- (`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES
- (22, '" . $u1 . "', ' ', 'add_zmproc=75|add_zaproc=75', 0, 77, 0, '" . $u1 . "', 0, 'priem', 141, 'spirit_block25.gif', 1, 1, '0', 0, 0, '', 0, 0, 0, 0, 0);");
- $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll'] * 0.5);
- $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll'] * 0.5);
- } elseif ($this->stats[$this->uids[$u1]]['s7'] > 74 && $this->stats[$this->uids[$u1]]['s7'] < 100) {
- //
- mysql_query("INSERT INTO `eff_users`
- (`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES
- (22, '" . $u1 . "', ' ', 'add_zmproc=100|add_zaproc=100', 0, 77, 0, '" . $u1 . "', 0, 'priem', 358, 'block_absolute.gif', 1, 1, '0', 0, 0, '', 0, 0, 0, 0, 0);");
- $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll'] * 0.75);
- $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll'] * 0.75);
- } elseif ($this->stats[$this->uids[$u1]]['s7'] > 99) {
- // x2
- mysql_query("INSERT INTO `eff_users`
- (`id_eff`, `uid`, `name`, `data`, `overType`, `timeUse`, `timeAce`, `user_use`, `delete`, `v1`, `v2`, `img2`, `x`, `hod`, `bj`, `sleeptime`, `no_Ace`, `file_finish`, `tr_life_user`, `deactiveTime`, `deactiveLast`, `mark`, `bs`) VALUES
- (22, '" . $u1 . "', ' ', 'add_zmproc=100|add_zaproc=100', 0, 77, 0, '" . $u1 . "', 0, 'priem', 358, 'wis_white_shield.gif', 1, 2, '0', 0, 0, '', 0, 0, 0, 0, 0);");
- $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll']);
- $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll']);
- }
-
- if ($this->stats[$this->uids[$u1]]['hpNow'] < 1) {
- $this->stats[$this->uids[$u1]]['hpNow'] = 1;
- }
- if ($this->stats[$this->uids[$u1]]['mpNow'] < 1) {
- $this->stats[$this->uids[$u1]]['mpNow'] = 1;
- }
- if ($this->stats[$this->uids[$u1]]['hpNow'] > $this->stats[$this->uids[$u1]]['hpAll']) {
- $this->stats[$this->uids[$u1]]['hpNow'] = floor($this->stats[$this->uids[$u1]]['hpAll']);
- }
- if ($this->stats[$this->uids[$u1]]['mpNow'] > $this->stats[$this->uids[$u1]]['mpAll']) {
- $this->stats[$this->uids[$u1]]['mpNow'] = floor($this->stats[$this->uids[$u1]]['mpAll']);
- }
-
- mysql_query('DELETE FROM `eff_users` WHERE `uid` = ' . $u1 . ' AND `id_eff` = 22 AND `v1` = "priem" AND `v2` = 324');
- mysql_query('UPDATE `stats` SET `hpNow` = ' . $this->stats[$this->uids[$u1]]['hpNow'] . ',`mpNow` = ' . $this->stats[$this->uids[$u1]]['mpNow'] . ', `tactic7` = `tactic7` - 25 WHERE `id` = ' . $u1 . ' LIMIT 1');
- $mas['text'] = '{tm1}
' . $this->stats[$this->uids[$u1]]['login'] . ' ...
' . $this->stats[$this->uids[$u1]]['login'] . ' . ';
- $this->priemAddLog($id, 1, 2, $u->info['id'], $u1,
- ' ',
- $mas['text'],
- ($this->hodID + 0)
- );
-
-
- } else {
- if (isset($this->stats[$this->uids[$u1]]['login'])) {
- mysql_query('UPDATE `stats` SET `hpNow` = 0,`mpNow` = 0 WHERE `id` = ' . $u1 . ' LIMIT 1');
- $this->stats[$this->uids[$u1]]['hpNow'] = 0;
- $this->users[$this->uids[$u1]]['hpNow'] = 0;
- $mas['text'] = '{tm1}
' . $this->stats[$this->uids[$u1]]['login'] . ' .';
- $this->priemAddLog($id, 1, 2, $u->info['id'], $u1,
- ' ',
- $mas['text'],
- ($this->hodID + 1)
- // //
- );
- mysql_query('DELETE FROM `battle_act` WHERE `uid1` = ' . $this->stats[$this->uids[$u1]]['id'] . ' OR `uid2` = ' . $this->stats[$this->uids[$u1]]['id'] . ' OR `uid2` = -' . $this->stats[$this->uids[$u1]]['id']);
- mysql_query('DELETE FROM `eff_users` WHERE `uid` = ' . $this->stats[$this->uids[$u1]]['id'] . ' AND `v1` = "priem" AND `delete` = 0');
- // v1 priem
- }
- }
- }
- }
- //
-
-
-}
-
-if (!defined('GAME')) {
- die();
-}
-ignore_user_abort(true);
-ini_set('memory_limit', '512M');
-
-$btl = new battleClass(new Db());
diff --git a/_incl_data/class/__db_connect.php b/_incl_data/class/__db_connect.php
index d2eb0076..fc8860b8 100644
--- a/_incl_data/class/__db_connect.php
+++ b/_incl_data/class/__db_connect.php
@@ -11,28 +11,10 @@ $db = [
];
$dsn = 'mysql:host=' . $db['s'] . ';dbname=' . $db['d'];
-if (function_exists('date_default_timezone_set')) {
- date_default_timezone_set('Europe/Moscow');
-}
+include './_incl_data/mysql_override.php';
-$dbgo = mysql_pconnect($db['s'], $db['u'], $db['p']);
+$dbgo = mysql_connect($db['s'], $db['u'], $db['p']);
mysql_select_db($db['d'], $dbgo);
mysql_query('SET NAMES cp1251');
-if (!function_exists('GetRealIp')) {
- function GetRealIpTest()
- {
- if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
- return $_SERVER['HTTP_CLIENT_IP'];
- } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
- return $_SERVER['HTTP_X_FORWARDED_FOR'];
- }
- return $_SERVER['REMOTE_ADDR'];
- }
-
- $ipban = GetRealIpTest();
-} else {
- $ipban = GetRealIp();
-}
-
-$pdo = new PDO($dsn, $db['u'], $db['p'], [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES cp1251"]);
\ No newline at end of file
+$pdo = new PDO($dsn, $db['u'], $db['p'], [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES cp1251"]);
diff --git a/_incl_data/class/dnaction/_dungeon_replace.php.bac b/_incl_data/class/dnaction/_dungeon_replace.php.bac
deleted file mode 100644
index d9453e6a..00000000
--- a/_incl_data/class/dnaction/_dungeon_replace.php.bac
+++ /dev/null
@@ -1,504 +0,0 @@
-info['battle'] != 0) { header('location: main.php'); die(); }
-
-if(isset($_POST['clip76_'])) {
- $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4677" LIMIT 1'));
- if($u->count_items(877, $u->info['id'], 1) > 0) {
- if($u->count_items(882, $u->info['id'], 1) > 0) {
- if($u->count_items(902, $u->info['id'], 1) > 0) {
- if($u->count_items(903, $u->info['id'], 1) > 0) {
- if($u->count_items(881, $u->info['id'], 1) > 0) {
- if($u->count_items(878, $u->info['id'], 1) > 0) {
- $data = '|frompisher=12';
- $u->addItem(4677, $u->info['id'], $data, $obj);
- $u->deleteItemID(877, $u->info['id'], 1);
- $u->deleteItemID(882, $u->info['id'], 1);
- $u->deleteItemID(902, $u->info['id'], 1);
- $u->deleteItemID(903, $u->info['id'], 1);
- $u->deleteItemID(881, $u->info['id'], 1);
- $u->deleteItemID(878, $u->info['id'], 1);
- $err = ' ';
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " """;
- }
-} elseif(isset($_POST['clip80_'])) {
- $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4758" LIMIT 1'));
- if($u->count_items(950, $u->info['id'], 1) > 0) {
- if($u->count_items(907, $u->info['id'], 1) > 0) {
- if($u->count_items(902, $u->info['id'], 1) > 0) {
- if($u->count_items(878, $u->info['id'], 1) > 0) {
- if($u->count_items(905, $u->info['id'], 1) > 0) {
- if($u->count_items(903, $u->info['id'], 1) > 0) {
- $data = '|frompisher=12';
- $u->addItem(4758, $u->info['id'], $data, $obj);
- $u->deleteItemID(950, $u->info['id'], 1);
- $u->deleteItemID(907, $u->info['id'], 1);
- $u->deleteItemID(902, $u->info['id'], 1);
- $u->deleteItemID(878, $u->info['id'], 1);
- $u->deleteItemID(905, $u->info['id'], 1);
- $u->deleteItemID(903, $u->info['id'], 1);
- $u->deleteItemID(905, $u->info['id'], 1);
- $err = ' ';
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
-} elseif(isset($_POST['clip81_'])) {
- $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4679" LIMIT 1'));
- if($u->count_items(906, $u->info['id'], 1) > 0) {
- if($u->count_items(907, $u->info['id'], 1) > 0) {
- $data = '|frompisher=12';
- $u->addItem(4679, $u->info['id'], $data, $obj);
- $u->deleteItemID(906, $u->info['id'], 1);
- $u->deleteItemID(907, $u->info['id'], 1);
- $err = ' ';
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
-} elseif(isset($_POST['clip82_'])) {
- $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4680" LIMIT 1'));
- if($u->count_items(877, $u->info['id'], 1) > 0) {
- if($u->count_items(890, $u->info['id'], 1) > 0) {
- if($u->count_items(902, $u->info['id'], 1) > 0) {
- if($u->count_items(903, $u->info['id'], 1) > 0) {
- if($u->count_items(888, $u->info['id'], 1) > 0) {
- $data = '|frompisher=12';
- $u->addItem(4680, $u->info['id'], $data, $obj);
- $u->deleteItemID(877, $u->info['id'], 1);
- $u->deleteItemID(890, $u->info['id'], 1);
- $u->deleteItemID(902, $u->info['id'], 1);
- $u->deleteItemID(903, $u->info['id'], 1);
- $u->deleteItemID(888, $u->info['id'], 1);
- $err = ' ';
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " """;
- }
-} elseif(isset($_POST['clip89_'])) {
- $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4681" LIMIT 1'));
- if($u->count_items(900, $u->info['id'], 1) > 0) {
- if($u->count_items(882, $u->info['id'], 1) > 0) {
- if($u->count_items(903, $u->info['id'], 1) > 0) {
- if($u->count_items(904, $u->info['id'], 1) > 0) {
- if($u->count_items(908, $u->info['id'], 1) > 0) {
- $data = '|frompisher=12';
- $u->addItem(4681, $u->info['id'], $data, $obj);
- $u->deleteItemID(900, $u->info['id'], 1);
- $u->deleteItemID(882, $u->info['id'], 1);
- $u->deleteItemID(903, $u->info['id'], 1);
- $u->deleteItemID(904, $u->info['id'], 1);
- $u->deleteItemID(908, $u->info['id'], 1);
- $err = ' ';
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
-} elseif(isset($_POST['clip90_'])) {
- $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4682" LIMIT 1'));
- if($u->count_items(950, $u->info['id'], 1) > 0) {
- if($u->count_items(889, $u->info['id'], 1) > 0) {
- if($u->count_items(902, $u->info['id'], 1) > 0) {
- if($u->count_items(903, $u->info['id'], 1) > 0) {
- if($u->count_items(878, $u->info['id'], 1) > 0) {
- $data = '|frompisher=12';
- $u->addItem(4682, $u->info['id'], $data, $obj);
- $u->deleteItemID(950, $u->info['id'], 1);
- $u->deleteItemID(889, $u->info['id'], 1);
- $u->deleteItemID(902, $u->info['id'], 1);
- $u->deleteItemID(906, $u->info['id'], 1);
- $u->deleteItemID(878, $u->info['id'], 1);
- $err = ' ';
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
-} elseif(isset($_POST['clip91_'])) {
- $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4683" LIMIT 1'));
- if($u->count_items(907, $u->info['id'], 1) > 0) {
- if($u->count_items(881, $u->info['id'], 1) > 0) {
- if($u->count_items(905, $u->info['id'], 1) > 0) {
- $data = '|frompisher=12';
- $u->addItem(4683, $u->info['id'], $data, $obj);
- $u->deleteItemID(907, $u->info['id'], 1);
- $u->deleteItemID(881, $u->info['id'], 1);
- $u->deleteItemID(905, $u->info['id'], 1);
- $err = ' ';
- } else {
- $err = " """;
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
-} elseif(isset($_POST['clip92_'])) {
- $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4684" LIMIT 1'));
- if($u->count_items(907, $u->info['id'], 1) > 0) {
- if($u->count_items(881, $u->info['id'], 1) > 0) {
- if($u->count_items(905, $u->info['id'], 1) > 0) {
- $data = '|frompisher=12';
- $u->addItem(4684, $u->info['id'], $data, $obj);
- $u->deleteItemID(907, $u->info['id'], 1);
- $u->deleteItemID(881, $u->info['id'], 1);
- $u->deleteItemID(905, $u->info['id'], 1);
- $err = ' ';
- } else {
- $err = " """;
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
-} elseif(isset($_POST['clip93_'])) {
- $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4685" LIMIT 1'));
- if($u->count_items(901, $u->info['id'], 1) > 0) {
- if($u->count_items(889, $u->info['id'], 1) > 0) {
- if($u->count_items(890, $u->info['id'], 1) > 0) {
- $data = '|frompisher=12';
- $u->addItem(4685, $u->info['id'], $data, $obj);
- $u->deleteItemID(901, $u->info['id'], 1);
- $u->deleteItemID(889, $u->info['id'], 1);
- $u->deleteItemID(890, $u->info['id'], 1);
- $err = ' : [1]';
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
-} elseif(isset($_POST['clip94_'])) {
- $obj = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "4686" LIMIT 1'));
- if($u->count_items(4685, $u->info['id'], 1) > 0) {
- if($u->count_items(4688, $u->info['id'], 1) > 0) {
- if($u->count_items(4689, $u->info['id'], 1) > 0) {
- if($u->count_items(4690, $u->info['id'], 1) > 0) {
- $data = '|frompisher=12';
- $u->addItem(4686, $u->info['id'], $data, $obj);
- $u->deleteItemID(4685, $u->info['id'], 1);
- $u->deleteItemID(4688, $u->info['id'], 1);
- $u->deleteItemID(4689, $u->info['id'], 1);
- $u->deleteItemID(4690, $u->info['id'], 1);
- $err = ' : [2]';
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " "";
- }
- } else {
- $err = " " : [1]"";
- }
-}
-
-
-function getColor($id, $num) {
- global $u;
- $color = 'green';
- $ch = mysql_query("SELECT `id` FROM `items_users` WHERE `uid` = ".$u->info['id']." AND `delete` = 0 AND `item_id` = ".(int)$id." AND inShop = 0 AND inOdet = 0");
- if(mysql_num_rows($ch) < $num) { $color = 'red'; }
- return $color;
-}
-
-function getImg($id, $num) {
- global $u;
- $img = 'good.png';
- $ch = mysql_query("SELECT `id` FROM `items_users` WHERE `uid` = ".$u->info['id']." AND `delete` = 0 AND `item_id` = ".(int)$id." AND inShop = 0 AND inOdet = 0");
- if(mysql_num_rows($ch) < $num) { $img = 'i/clear.gif'; }
- return $img;
-}
-
-?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if($err != '') { echo "
".$err." "; } ?>
-
-
- $st = array(); $st2 = array(); $st = $u->getStats($u->info['id'],1); $st2 = $st[1]; $st = $st[0]; $rgd = $u->regen($u->info['id'],$st,1); $us = $u->getInfoPers($u->info['id'],1,$st); if($us!=false){ echo $us[0]; }else{ echo 'information is lost.'; } ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
: [1]
-
-
-
-
: [2]
-
-
-
. ()
-
-
-
-
-
-
-
-
-
-
-