- 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 = array(0=>'main.php?inv=1',1=>'');
- }else{
- $invg = array(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 = array(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 = array(0=>'main.php?inv=1',1=>'');
- }else{
- $invg = array(0=>'main.php?skills=1',1=>'');
- }
- }else{
- $invg = array(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 = array(0=>'main.php?inv=1',1=>'');
- }else{
- $invg = array(0=>'main.php?skills=1',1=>'');
- }
- }else{
- $invg = array(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)
- {
- 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;
- $k = array_keys($m);
- $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);
- /*$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`.`inOdet`="0" AND `iu`.`inShop`="0" '.$au.' AND `iu`.`delete`="1000" AND `iu`.`inGroup` = "'.$itm['id'].'" LIMIT 1'));
- if(!isset($itm['id'])) {
- $this->error = ' ...';
- $notr++;
- } else {
- $itm['delete'] = 0;
- }*/
- }
- }
-
-
- $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
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 = array();
- 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,$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,$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`,
- `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`,
- `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( $btl_cache == true ) {
- $cache = $this->get_battle_cache( $u['id'],$u['battle'] );
- if( $cache == false ) {
- unset($cache);
- }else{
- $cache['st'] = $u + $cache['st'];
- }
- }*/
-
- /*if( $u['battle'] > 0 ) {
- $cache_items = $this->get_battle_cache( $u['id'],$u['battle'] );
- if( $cache_items == false ) {
- unset($cache_items);
- }else{
- $cache_items['st']['hpNow'] = $u['hpNow'];
- $cache_items['st']['mpNow'] = $u['mpNow'];
- }
- }*/
-
- if(isset($u['id'],$u['stats']) && !isset($cache))
- {
- $st = array();
- $s_vi = array();
- $s_v = array();
- $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)) {
- //
- //$st = new SplFixedArray(1024000);
- //
- $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 = array();
- $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'] = array();
- $st['effects'] = array();
- $st['reting'] = 0;
- $st['irka'] = 0;
- $sts = explode('|',$u['stats']);
- $i = 0; $ste = '';
- //
- while($i 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');
- }
- }
- }
-
- //
- $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 = array();
- $coms = array(); //
- $dom = array();
- $btl_cof = 0;
- $oza = array(
- 1=>array(0,0),
- 2=>array(0,0),
- 3=>array(0,0),
- 4=>array(0,0)
- ); //
- $ozm = array(
- 1=>array(0,0),
- 2=>array(0,0),
- 3=>array(0,0),
- 4=>array(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'];
- }
- }
- /* */
- //$dom[count($dom)] = array($pl['inOdet'],$pl['class'],$pl['class_point'],$pl['anti_class'],$pl['anti_class_point'],$pl['level'],$u['level'],$pl['price2']);
-
-
- if($pl['inOdet'] <= 18 && $pl['inOdet'] > 0 ) {
- /*if( $pl['2price'] > 0 ) {
- $st['reting'] += $pl['2price']*12.5;
- }elseif( $pl['price2'] > 0 ) {
- $st['reting'] += $pl['price2']*12.5;
- }elseif( $pl['1price'] > 0 ) {
- $st['reting'] += $pl['1price'];
- }elseif( $pl['price1'] > 0 ) {
- $st['reting'] += $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 = array();
- while($i 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'];
- }
- }
- }
- }else{
- if( $pl['inOdet'] < 18 && $pl['inOdet'] > 0 ) {
- if( $pl['2price'] == 0 && $pl['price2'] == 0 ) {
- if( $pl['1price'] > 0 ) {
- //$st['prckr'] += round($pl['1price']/3);
- }else{
- //$st['prckr'] += round($pl['price1']/3);
- }
- }
- }
- }
-
- if($pl['inOdet'] <= 18 && $pl['inOdet'] > 0 ) {
-
- $st['reting'] += 1;
- }
-
- if(isset($sti['add_oza'])) {
-
- }
-
- $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;
- }
- }
- 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($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;
- }
- }
- $ko++;
- }
-
- //if( $sti['tr_lvl'] == $u['level'] ) {
- if( $pl['inOdet'] <= 18 ) {
- $itmslvl++;
- }
- if( $pl['inOdet'] <= 14 ) {
- 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'] = array();
- }
- $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'] = array();
- }
- $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($i0)
- {
- $i39 = array(0=>0,1=>0,2=>0);
- $i = 0;
- while($i "'.time().'" OR `endTime` = 0)');
- while($e = mysql_fetch_array($efs))
- {
- $sts = $this->lookStats($e['bonus']);
- $i = 0;
- while($i 0 ) {
- //
- $cache_items = array(
- 'st' => $st,
- 'sti' => $sti,
- 's_v' => $s_v,
- 's_vi' => $s_vi
- );
- $cache_items = json_encode($cache_items);
- mysql_query('INSERT INTO `battle_cache` (`uid`,`battle`,`data`,`time`) VALUES ("'.$u['id'].'","'.$u['battle'].'","'.mysql_real_escape_string($cache_items).'","'.time().'")');
- unset($cache_items);
- }*/
- }else{
- /*$st = $cache_items['st'];
- unset($cache_items['st']);
- $sti = $cache_items['sti'];
- unset($cache_items['sti']);
- $s_v = $cache_items['s_v'];
- unset($cache_items['s_v']);
- $s_vi = $cache_items['s_vi'];
- unset($cache_items);*/
- }
-
- //
- //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 = array();
- $prsu = array();
- 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');
- }
- }
- }
- }
- }
- //echo '['.date( 'd.m.Y H:i:s' , time() + round((($e['timeUse']+$e['timeAce']+$e['actionTime'])-time())/$c['effz'])*$c['effz']).']';
- if(true == false && $test_btl_info['noeff']==1 && isset($this->ekrcast[$e['id_eff']])) {
- //
- }elseif( $e['sleeptime'] != 0 && substr_count($e['v1'],'pgb') > 0 ) {
- //
- }elseif( ( $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($iinfo['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'] = array();
- $st['set_pog2'] = array();
- 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($iendEffect($e['id'],$u);
- $st['act'] = 1;
- }
- }
- }
-
- //
- /*$bl = mysql_fetch_array(mysql_query('SELECT `id`,`level` FROM `users_paybonus` WHERE `id` = "'.$u['id'].'" LIMIT 1'));
- $st['pbe'] = 0+$bl['level'];
- if( $st['pbe'] > 1000 ) {
- $st['pbe'] = 1000;
- }
- unset($bl);*/
-
- //
- if( $st['clanpos'] > 0 ) {
- if( $st['clanpos'] == 1 ) {
- $st['s1'] += 5;
- $st['s2'] += 5;
- $st['s3'] += 5;
- $st['s4'] += 5;
- $st['s5'] += 5;
- $st['s6'] += 5;
- $st['m10'] += 10;
- $st['m11'] += 10;
- }elseif( $st['clanpos'] == 2 ) {
- $st['s1'] += 3;
- $st['s2'] += 3;
- $st['s3'] += 3;
- $st['s4'] += 3;
- $st['s5'] += 3;
- $st['s6'] += 3;
- $st['m10'] += 5;
- $st['m11'] += 5;
- }elseif( $st['clanpos'] == 3 ) {
- $st['s1'] += 1;
- $st['s2'] += 1;
- $st['s3'] += 1;
- $st['s4'] += 1;
- $st['s5'] += 1;
- $st['s6'] += 1;
- $st['m10'] += 3;
- $st['m11'] += 3;
- }
- }
-
- //
-
- if(!isset($st['hpAll'])) {
- $st['hpAll'] = 0;
- }
- $st['hpAll'] += $st['s4']*6;
-
- //$st['enAll'] += 10;
- //$st['enAll'] += floor($st['s11']*10);
- //$st['enAll'] += round($st['s4']*0.09);
-
- 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.5;
-
- if(!isset($st['zm'])) {
- $st['zm'] = 0;
- }
- $st['zm'] += $st['s4']*1.5;
-
- //
- // " . ".
- if(!isset($st['antm3'])) {
- $st['antm3'] = 0;
- }
- //$st['antm3'] += $st['s4']*1.0;
-
-
-
- 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['m7'])) {
- $st['m7'] = 0;
- }
- $st['m7'] += 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= 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['m10'] += 5; }
- if($st['s1']>49 && $st['s1']<75){ $st['m10'] += 10; }
- if($st['s1']>74 && $st['s1']<100){ $st['m10'] += 17; }
- if($st['s1']>99 && $st['s1']<125){ $st['m10'] += 25; }
- if($st['s1']>124 && $st['s1']<150){ $st['m10'] += 25; $st['minAtack'] += 10; $st['maxAtack'] += 10; }
- if($st['s1']>149 && $st['s1']<175){ $st['m10'] += 30; $st['minAtack'] += 10; $st['maxAtack'] += 10; }
- if($st['s1']>174){ $st['m10'] += 30; $st['minAtack'] += 15; $st['maxAtack'] += 15; }*/
-
- if($st['s1']>24 && $st['s1']<50){ $st[1]['m2'] += 15; }
- if($st['s1']>49 && $st['s1']<75){ $st[1]['pa2'] += 2; $st[1]['m2'] += 35; }
- if($st['s1']>74 && $st['s1']<100){ $st[1]['pa2'] += 5; $st[1]['m2'] += 50; }
- if($st['s1']>99 && $st['s1']<125){ $st[1]['pa2'] += 8; $st[1]['m2'] += 80;}
- if($st['s1']>124 && $st['s1']<150){ $st[1]['pa2'] += 12; $st[1]['m2'] += 105; }
- if($st['s1']>149 && $st['s1']<175){ $st[1]['pa2'] += 17; $st[1]['m7'] += 2; }
- if($st['s1']>174){ $st[1]['pa2'] += 30; $st[1]['m7'] += 7; }
-
- //
- if($st['s2']>24 && $st['s2']<50){ $st['m7'] += 5; }
- if($st['s2']>49 && $st['s2']<75){ $st['m7'] += 5; $st['m4'] += 35; $st['m2'] += 15; }
- if($st['s2']>74 && $st['s2']<100){ $st['m7'] += 15; $st['m4'] += 35; $st['m2'] += 15; }
- if($st['s2']>99 && $st['s2']<125){ $st['m7'] += 15; $st['m4'] += 105; $st['m2'] += 40; }
- if($st['s2']>124 && $st['s2']<150) { $st['m7'] += 15; $st['m4'] += 105; $st['m2'] += 40; $st['m15'] += 5; }
- if($st['s2']>149 && $st['s2']<175){ $st['m7'] += 20; $st['m4'] += 115; $st['m2'] += 40; $st['m15'] += 5; }
- if($st['s2']>174){ $st['m7'] += 20; $st['m4'] += 120; $st['m2'] += 50; $st['m15'] += 7; }
- //
- if($st['s3']>24 && $st['s3']<50){ $st['m3'] += 10; }
- if($st['s3']>49 && $st['s3']<75){ $st['m3'] += 10; $st['m1'] += 35; $st['m5'] += 15; }
- if($st['s3']>74 && $st['s3']<100){ $st['m3'] += 25; $st['m1'] += 35; $st['m5'] += 15; }
- if($st['s3']>99 && $st['s3']<125){ $st['m3'] += 25; $st['m1'] += 105; $st['m5'] += 45; }
- if($st['s3']>124 && $st['s3']<150){ $st['m3'] += 25; $st['m1'] += 105; $st['m5'] += 45; $st['m14'] += 5; }
- if($st['s3']>149 && $st['s3']<175){ $st['m3'] += 30; $st['m1'] += 105; $st['m5'] += 45; $st['m14'] += 5; }
- if($st['s3']>174){ $st['m3'] += 30; $st['m1'] += 120; $st['m5'] += 45; $st['m14'] += 7; }
- //
- 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; }
- if($st['s4']>99 && $st['s4']<125){ $st['hpAll'] += 250; }
- if($st['s4']>124 && $st['s4']<150){ $st['hpAll'] += 250; $st['za'] += 25; }
- if($st['s4']>149 && $st['s4']<175){ $st['hpAll'] += 350; $st['za'] += 50; }
- if($st['s4']>174){ $st['hpAll'] += 400; $st['za'] += 100; }
- //
- if($st['s5']>24 && $st['s5']<50){ $st['m11'] += 5; }
- if($st['s5']>49 && $st['s5']<75){ $st['m11'] += 10; }
- if($st['s5']>74 && $st['s5']<100){ $st['m11'] += 17; }
- 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'] += 45; }
- if($st['s5']>174){ $st['m11'] += 60; }
- //
- if($st['s6']>24 && $st['s6']<50){ $st['mpAll'] += 50; $st['speedmp'] +=100; }
- if($st['s6']>49 && $st['s6']<75){ $st['mpAll'] += 100; $st['speedmp'] +=200; }
- if($st['s6']>74 && $st['s6']<100){ $st['mpAll'] += 175; $st['speedmp'] += 350; }
- if($st['s6']>99 && $st['s6']<125){ $st['mpAll'] += 250; $st['speedmp'] += 500; }
- if($st['s6']>124 && $st['s6']<150) { $st['mpAll'] += 250; $st['speedmp'] += 500; $st['pzm'] += 3; }
- if($st['s6']>149 && $st['s6']<175){ $st['mpAll'] += 300; $st['speedmp'] += 600; $st['pzm'] += 3; }
- if($st['s6']>174){ $st['mpAll'] += 450; $st['speedmp'] += 700; $st['pzm'] += 5; }
-
- //
- if($hnd2==1 && $hnd1==1)
- {
- $st['zona']++;
- }
-
- if($sht1==1)
- {
- $st['zonb']++;
- }
-
- //$st['speedhp'] += $st['pbe'];
- //$st['speedmp'] += $st['pbe'];
-
- /* */
- $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( $u['level'] > 7 ) {
- $st['speedhp'] -= 240;
- $st['speedmp'] -= 240;
- }*/
-
- //
- 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'] = 0;
- //
- $st['reting'] += $st['hpAll'];
- $st['reting'] += $st['mpAll'];
- //
- $st['reting'] += $st['m1'];
- $st['reting'] += $st['m2'];
- $st['reting'] += $st['m4'];
- $st['reting'] += $st['m5'];
- //
- $st['reting'] += $st['m6']*10;
- $st['reting'] += $st['m7']*10;
- $st['reting'] += $st['m8']*10;
- $st['reting'] += $st['m9']*10;
- //
- $st['reting'] += $st['a1']*7;
- $st['reting'] += $st['a2']*7;
- $st['reting'] += $st['a3']*7;
- $st['reting'] += $st['a4']*7;
- $st['reting'] += $st['a5']*7;
- $st['reting'] += $st['a6']*7;
- $st['reting'] += $st['a7']*7;
- //
- $st['reting'] += $st['mg1']*7;
- $st['reting'] += $st['mg2']*7;
- $st['reting'] += $st['mg3']*7;
- $st['reting'] += $st['mg4']*7;
- $st['reting'] += $st['mg5']*7;
- $st['reting'] += $st['mg6']*7;
- $st['reting'] += $st['mg7']*7;
- //
- $st['reting'] += $st['m3']*5;
- $i8 = 1;
- $st['reting'] += $st['za']*5;
- $st['reting'] += $st['zm']*5;
- //
- $st['reting'] += $st['s5']*5;
- $st['reting'] += $st['s6']*5;
- //
- while( $i8 < 8 ) {
- $st['reting'] += $st['pa'.$i]*5;
- $st['reting'] += $st['pm'.$i]*5;
- //
- $st['reting'] += $st['za'.$i]*10;
- $st['reting'] += $st['zm'.$i]*10;
- $i8++;
- }
- //
- $i8 = 1;
- while( $i8 < 5 ) {
- $st['reting'] += $st['mib'.$i];
- $st['reting'] += $st['mab'.$i];
- $i8++;
- }*/
-
- $st['reting'] = 1+ceil($st['reting']);
- $st['reting'] = 1+$st['irka'];
-
- if($u['vip'] > 0) {
- $st['exp'] += 25;
- $st['speedhp'] += 100;
- $st['speedmp'] += 100;
- $st['repair_discount'] +=1;
- $st['repair_r'] +=1;
- $st['repair_z'] +=1;
- }
-
- //
- $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_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`) as allrep,
- (`nu_capitalcity`+`nu_demonscity`+`nu_angelscity`+`nu_suncity`+`nu_dreamscity`+`nu_abandonedplain`+`nu_sandcity`) as allnurep FROM `rep` WHERE `id` = "'.$u['id'].'" LIMIT 1'));
- //
- if($rep1['repdreamscity'] > 999 && $rep1['repdreamscity'] < 5000 ) {
- $st['m1'] += 25;
- $st['m4'] += 25;
- }elseif($rep1['repdreamscity'] > 4999 && $rep1['repdreamscity'] < 10000) {
- $st['m1'] += 50;
- $st['m2'] += 25;
- $st['m4'] += 50;
- $st['m5'] += 25;
- }elseif($rep1['repdreamscity'] > 9999) {
- $st['m1'] += 75;
- $st['m2'] += 50;
- $st['m4'] += 75;
- $st['m5'] += 50;
- }
- //
- if($rep1['repizlom'] > 999 && $rep1['repizlom'] < 5000) {
- $st['speedhp'] += 50;
- $st['speedmp'] += 50;
- $st['speed_dungeon'] +=10;
- }elseif($rep1['repizlom'] > 4999 && $rep1['repizlom'] < 10000) {
- $st['speedhp'] += 75;
- $st['speedmp'] += 75;
- $st['speed_dungeon'] +=20;
- }elseif($rep1['repizlom'] > 9999) {
- $st['speedhp'] += 100;
- $st['speedmp'] += 100;
- $st['speed_dungeon'] += 30;
- }
- //
- if($rep1['repangelscity'] > 9999 && $rep1['repangelscity'] < 25000) {
- $st['exp'] += 5;
- /*$st['hpAll'] += 100;
- $st['mpAll'] += 100;*/
- }elseif($rep1['repangelscity'] > 24999) {
- $st['exp'] += 10;
- /*$st['hpAll'] += 200;
- $st['mpAll'] += 200;*/
- }
- //
- if($rep1['repdemonscity'] > 9999 && $rep1['repdemonscity'] < 25000) {
- $st['m10'] += 5;
- $st['zma'] += 50;
- }elseif($rep1['repdemonscity'] > 24999) {
- $st['m10'] += 10;
- $st['zma'] += 100;
- }
- //
- if($rep1['repsuncity'] > 9999 && $rep1['repsuncity'] < 25000) {
- $st['m11'] += 5;
- $st['za'] += 50;
- }elseif($rep1['repdemonscity'] > 24999) {
- $st['m11'] += 10;
- $st['za'] += 100;
- }
- //
- if($rep1['repcapitalcity'] > 9999 && $rep1['repcapitalcity'] < 25000) {
- $st['pza'] += 2;
- $st['pzm'] += 2;
- $st['mib1'] +=10;
- $st['mab1'] +=10;
- }elseif($rep1['repdemonscity'] > 24999) {
- $st['pza'] += 4;
- $st['pzm'] += 4;
- $st['mib1'] += 20;
- $st['mab1'] +=20;
- }
- //
- if($rep1['repabandonedplain'] > 9999 && $rep1['repabandonedplain'] < 25000) {
- $st['mib1'] += 5;
- $st['mab3'] += 5;
- $st['mab4'] +=5;
- }elseif($rep1['repdemonscity'] > 24999) {
- $st['mab1'] += 10;
- $st['mab3'] += 10;
- $st['mab4'] += 10;
- }
-
-
- //
- $st['maxves'] += 500;
-
- if( $st['silver'] >= 5 ) {
- $st['exp'] += 50;
- }
-
- if( $u['admin'] > 0 ) {
- $st['speed_dungeon'] += 1000;
- $st['speedhp'] += 1000000000000000;
- }
- /*if( date('H') >= 22 && date('H') <= 24 ) {
- if($u['room']==9 && $u['room']==323 && $u['room']==1) {
- $st['exp'] +=150;
- }
- }else*/if( date('H') >=22 && date('H') <= 10 ) {
- $st['exp'] +=25;
- }
-
- //
- $st['reting'] = floor($st['reting']);
- //if(@$st['btl_cof'] != @$st['reting']) {
- //$st['btl_cof'] = $st['reting'];
- //mysql_query('UPDATE `stats` SET `btl_cof` = "'.$st['reting'].'" WHERE `id` = "'.$st['id'].'" LIMIT 1');
- //}
- 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 = array();
- 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 = array(
- '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 = array( $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['exp'] > $c['expstop'] ) {
- $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 = array();
- $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'])
- {
- //
- /*
- if($lvl['nextLevel']==8){
- $text = ' 8 " --".';
- echo '';
- $this->addItem(1190,$this->info['id'],'|sudba='.$this->info['login']);
- }
- */
-
- //
- $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` + 10 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'] += $a4;
- $tst['s7'] += $lvl['duh'];
- $this->info['stats'] = $this->impStats($tst);
- */
- }
-
- /*if( $this->info['twink'] == 0 ) {
- if( $this->info['exp'] >= 300000 ) {
- $this->send('',$this->info['room'],$this->info['city'],'',$this->info['login'],' /, : '.$lvl['money'].' .',-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 ) {
- //if( $this->info['level'] < 8 ) {
- // 0-7
- //$this->info['money4'] = $lvl['money']+$this->info['money4'];
- //}else{
- $this->info['money'] = $lvl['money']+$this->info['money'];
- //}
- }
- $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);
- }
- /*if( $this->info['level'] > 0 && $this->info['level'] <= 5 ) {
- $this->info['money4'] += 100;
- mysql_query('UPDATE `users` SET `money4` = "'.$this->info['money4'].'" WHERE `id` = "'.$this->info['id'].'" LIMIT 1');
- $this->send('',$this->info['room'],$this->info['city'],'',$this->info['login'],' '.$this->zuby(100,1).'',-1,6,0,0,0,1);
- }*/
- //if( isset($itm['id']) || $lvl['nextLevel'] != 6 ) {
- //
- /*$txti = '';
- if( $this->info['sex'] == 1 ) {
- $txti .= '';
- }
- $txti .= ' '.$this->info['level'].' !
'.date('d.m.Y H:i').'';
- //
- mysql_query('INSERT INTO `users_ico` (
- `uid`,`time`,`text`,`img`,`type`,`x`,`see`
- ) VALUES (
- "'.$this->info['id'].'","'.time().'","'.$txti.'","pod_lvl'.$this->info['level'].'.gif","2","1","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'] >= 10 ) {
- //$this->info['stopexp'] = 1; //
- $this->info['stopexp'] = 0;
- }else{
- $this->info['stopexp'] = 0;
- }
- $upd = mysql_query('UPDATE `users` SET `stopexp` = "'.$this->info['stopexp'].'" , `level` = "'.$this->info['level'].'",`money` = "'.$this->info['money'].'",`money4` = "'.$this->info['money4'].'" WHERE `id` = "'.$this->info['id'].'" LIMIT 1');
- $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 = array(
- 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 = array(
- 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;
- }
-
- public function regen($uid,$st,$i1)
- {
- if($uid!=$this->info['id'])
- {
- $u = mysql_fetch_array(mysql_query('SELECT `u`.`align`,`u`.`align2`,`u`.`clan`,`u`.`battle`,`u`.`animal`,`u`.`id`,`u`.`level`,`u`.`login`,`u`.`sex`,`u`.`design`,`u`.`autospell`,`u`.`noplaw`,`u`.`obraz`,`st`.* FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id`="'.mysql_real_escape_string($uid).'" OR `u`.`login`="'.mysql_real_escape_string($uid).'" LIMIT 1'));
- if(!isset($st['hpAll']))
- {
- $st = $this->getStats($uid,$i1);
- }
- }else{
- $u = $this->info;
- if(isset($this->stats['hpAll']))
- {
- $st = $this->stats;
- }elseif($st!=0)
- {
-
- }else{
- $st = $this->getStats($uid,$i1);
- }
- }
- $btl = 0;
- if($u['battle']>0)
- {
- //$btl = mysql_fetch_array(mysql_query('SELECT `id`,`time_start` FROM `battle` WHERE `id` = "'.$u['battle'].'" AND `team_win` = "-1" LIMIT 1'));
- }
- if($u['battle']==0 || (isset($btl['id']) && $btl['time_start']>$this->info['timereg']))
- {
- $sth = $u['minHP']; // HP
- $stm = $u['minMP']; // MP
- $sh = 0; // 1 .
- $sm = 0; // M 1 .
- /*---()---*/
- if(@$st['os9']>0){
- if(@$st['os9']==5) {
- @$st['os9']=6;
- }
- $sth = floor($u['minHP']-($u['minHP']/100)*($st['os9']*5));
- }
- /*---()---*/
- /*---()---*/
- if(@$st['os10']>0){
- $stm = floor($u['minMP']-($u['minMP']/100)*($st['os10']*5));
- }
- /*---()---*/
- if($u['battle']>0)
- {
- $this->info['timereg'] = $btl['time_start'];
- }
-
- //
- //
- $st['speedhp'] += 150;
- $st['speedmp'] += 150;
-
- //hp
- $sh = ($st['hpAll']/(60*$sth));
- if(!isset($st['speedhp'])) { $st['speedhp'] = 0; }
- if( (0.0001+$st['speedhp']+$st['levels']['hpRegen']) < 0.00001 ) {
- $sh += ($sh/100)*0.00001;
- }else{
- $sh += ($sh/100)*(0.0001+$st['speedhp']+$st['levels']['hpRegen']);
- }
- $st['hpNow'] += $sh*(time()-$u['regHP']);
- if($st['hpNow']<0)
- {
- $st['hpNow'] = 0;
- }elseif($st['hpNow']>$st['hpAll'])
- {
- $st['hpNow'] = $st['hpAll'];
- }
- //mp
- $sm = ($st['mpAll']/(60*$stm));
- if(!isset($st['speedmp'])) { $st['speedmp'] = 0; }
- $sm += ($sm/100)*(1+$st['speedmp']+$st['levels']['mpRegen']);
- $st['mpNow'] += $sm*(time()-$u['regMP']);
- if($st['mpNow']<0)
- {
- $st['mpNow'] = 0;
- }elseif($st['mpNow']>$st['mpAll'])
- {
- $st['mpNow'] = $st['mpAll'];
- }
- //
- $upd = mysql_query('UPDATE `stats` SET `regHP`="'.time().'",`regMP`="'.time().'",`hpNow`="'.$st['hpNow'].'",`mpNow`="'.$st['mpNow'].'" WHERE `id` = "'.$u['id'].'" LIMIT 1');
- if(!$upd)
- {
- return array(0=>0,1=>0);
- }else{
- if($this->info['id']==$u['id'])
- {
- $this->stats['regHP'] = time();
- $this->stats['regMP'] = time();
- $this->stats['hpNow'] = $st['hpNow'];
- $this->stats['mpNow'] = $st['mpNow'];
- }
- return array(0=>$sh,1=>$sm,'hpNow'=>$st['hpNow'],'mpNow'=>$st['mpNow']);
- }
- }
- }
-
- public function send_mime_mail($name_from, //
- $email_from, // email
- $name_to, //
- $email_to, // email
- $data_charset, //
- $send_charset, //
- $subject, //
- $body //
- )
- {
- $to = $this->mime_header_encode($name_to, $data_charset, $send_charset)
- . ' <' . $email_to . '>';
- $subject = $this->mime_header_encode($subject, $data_charset, $send_charset);
- $from = $this->mime_header_encode($name_from, $data_charset, $send_charset)
- .' <' . $email_from . '>';
- if($data_charset != $send_charset) {
- $body = iconv($data_charset, $send_charset, $body);
- }
- $headers = "From: $from\r\n";
- $headers .= "Content-type: text/html; charset=$send_charset\r\n";
-
- return mail($to, $subject, $body, $headers);
- }
-
- public function mime_header_encode($str, $data_charset, $send_charset) {
- if($data_charset != $send_charset) {
- $str = iconv($data_charset, $send_charset, $str);
- }
- return '=?' . $send_charset . '?B?' . base64_encode($str) . '?=';
- }
-
-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 send_mail($to,$to_name,$from = 'support@new-combats.com',$name = ' 2',$title,$text) {
- $this->send_mime_mail($name,
- $from,
- $to_name,
- $to,
- 'CP1251', // ,
- 'KOI8-R', // ,
- $title,
- $text); // \r\n
- }
-
- public function roomInfo($id, $short=false) {
- if($short==true){
- $select = ' `id`, `name`, `code`, `city`, `timeGO`, `level`,`roomGo` ';
- } else {
- $select = ' * ';
- }
- $roomInfo = mysql_fetch_array(mysql_query('SELECT '.$select.' FROM `room` WHERE `id` = "'.$id.'" LIMIT 1'));
- if($roomInfo['roomGo']) $roomInfo['roomGo'] = explode(',', $roomInfo['roomGo']);
- if($roomInfo['level']) $roomInfo['level'] = explode('-', $roomInfo['level']);
- return $roomInfo;
- }
-
-public function showAbils() {
- $r = '';
- $sp = mysql_fetch_array(mysql_query('SELECT * FROM `abils_user` WHERE `uid` = "'.$this->info['id'].'" LIMIT 1'));
- if(isset($sp['id'])) {
- $r .= '';
- } else {
- mysql_query('INSERT INTO `abils_user` (`uid`) VALUES ("'.$this->info['id'].'")');
- }
- return $r;
-}
-
-}
-
-
-$u = user::start();
-?>
\ No newline at end of file
diff --git a/modules_data/titul.php b/modules_data/titul.php
index 0d418e82..7f1a28b1 100644
--- a/modules_data/titul.php
+++ b/modules_data/titul.php
@@ -1,8 +1,3 @@
-
-
[
- 'quest' => 'Выполнить задания бабки.',
- 'check' => ['Заданий', 5, 25, 50, 100, 250],
- 'prize' => ['Жетон
успеха
', 5, 20, 40, 60, 100],
- 'startlink' => 11
- ],
- 'vx' => [
- 'quest' => 'Победить в хаотических боях.',
- 'check' => ['Побед', 50, 300, 400, 500, 1000],
- 'prize' => ['екр.', 25, 50, 75, 100, 200],
- 'startlink' => 21
- ],
- 'snt' => [
- 'quest' => 'Открыть сундук трупожора.',
- 'check' => ['Открытий', 5, 25, 50, 100, 250],
- 'prize' => ['екр.', 10, 25, 50, 75, 200],
- 'startlink' => 31
- ],
- 'rp' => [
- 'quest' => 'Получить руну при плавке плохих заготовок. [S]',
- 'check' => ['Рун', 5, 10, 25, 50, 100],
- 'prize' => ['Плохие
заготовки
', 5, 7, 10, 12, 15],
- 'startlink' => 41
- ],
- 'rn' => [
- 'quest' => 'Получить руну при плавке нормальных заготовок. [M]',
- 'check' => ['Рун', 5, 10, 15, 25, 50],
- 'prize' => ['Нормальные
заготовки
', 5, 7, 9, 12, 15],
- 'startlink' => 51
- ],
- 'rb' => [
- 'quest' => 'Получить руну при плавке идеальных заготовок. [L]',
- 'check' => ['Рун', 2, 5, 8, 11, 15],
- 'prize' => ['Идеальные
заготовки
', 2, 4, 6, 10, 15],
- 'startlink' => 61
- ],
- 'pg' => [
- 'quest' => 'Поучаствовать в героическом сражении.',
- 'check' => ['Участий', 100, 200, 400, 600, 1000],
- 'prize' => ['Жетон
успеха
', 10, 20, 40, 60, 80],
- 'startlink' => 71
- ],
- 'bv' => [
- 'quest' => 'Продать бабушке найденные вещи в пещере.',
- 'check' => ['Продаж', 5, 25, 50, 100, 250],
- 'prize' => ['кр.', 500, 1000, 2000, 4000, 5000],
- 'startlink' => 81
- ],
- 'kw' => [
- 'quest' => 'Победить в клановой войне.',
- 'check' => ['Побед', 5, 10, 15, 20, 25],
- 'prize' => ['Свиток
кланового
опыта ', 1, 2, 5, 10, 15],
- 'startlink' => 91
- ],
- 'pa' => [ # not implemented!
- 'quest' => 'Получить покровительство Ангела.',
- 'check' => ['Получено', 5, 25, 50, 100, 250],
- 'prize' => null,
- 'startlink' => null
- ],
- 'bs' => [
- 'quest' => 'Победы в башне смерти.',
- 'check' => ['Побед', 1, 5, 10, 50, 500],
- 'prize' => ['екр.', 1, 5, 10, 50, 200],
- 'startlink' => 101
- ],
- 'trn' => [ # not implemented!
- 'quest' => 'Победы в турнирах.',
- 'check' => ['Побед', 25, 50, 100, 200, 500],
- 'prize' => ['екр.', 25, 25, 25, 25, 50],
- 'startlink' => 111
- ],
-];
-
-function table($rows, $class = '', $fill = false)
-{
- $c = '';
- $max_rows = sizeof(max($rows));
-
- foreach ($rows as $row) {
- if ($fill && sizeof($row) < $max_rows) {
- $row = array_merge($row, array_fill(0, $max_rows - sizeof($row), ''));
- }
-
- $c .= '' . implode(' | ', $row) . ' |
';
- }
-
- return (!empty($class) ? "" : '' . PHP_EOL;
+if (empty($u)) {
+ $u = user::start();
}
-$ai = $u->achivInf($u->info['id'], 1);
+$a = new Achievements($u);
+$ai = $a->getCheckedInfo();
+
if (isset($_GET['nagr'])) {
$nagrtxt = 'За выполненное достижение Вы получили ';
- if (
- in_array($_GET['nagr'], [14, 15, 24, 25, 34, 35, 44, 45, 54, 55, 64, 65, 74, 75, 84, 85, 94, 95, 104, 105]) &&
- $u->info['level'] < 9
- ) {
+
+ if ($a->hasNoTier4Access($_GET['nagr'])) {
$nagrtxt = 'Вы не можете получить эту награду на этом уровне!';
} elseif ( //бабка задание zb
in_array($_GET['nagr'], [11, 12, 13, 14, 15]) &&
@@ -119,179 +24,106 @@ if (isset($_GET['nagr'])) {
$ai['klaszb'] > $ai['zb_n']
) {
$ai['zb_n'] += 1;
- $u->rangup($u->info['id'], $ai['zb_n'], 'zb');
- $i = 0;
- while ($i < $achievement_data['zb']['prize'][$ai['zb_n']]) {
- $u->addItem(10020, $u->info['id'], '');
- $i++;
- }
- $nagrtxt .= 'Жетон успеха X' . $achievement_data['zb']['prize'][$ai['zb_n']];
+ $a->updateTier('zb_n');
+ $a->givePrizeItems(10020, 'zb');
+ $nagrtxt .= 'Жетон успеха X' . $a->getData()['zb']['prize'][$ai['zb_n']];
} elseif ( //Хаот задание vx
in_array($_GET['nagr'], [21, 22, 23, 24, 25]) &&
in_array($ai['vx_n'], [0, 1, 2, 3, 4]) &&
$ai['klasvx'] > $ai['vx_n']
) {
$ai['vx_n'] += 1;
- $u->rangup($u->info['id'], $ai['vx_n'], 'vx');
- Db::sql('update users set money2 = money2 + ? where id = ?',
- [$achievement_data['vx']['prize'][$ai['vx_n']], $u->info['id']]);
- $nagrtxt .= $achievement_data['vx']['prize'][$ai['vx_n']] . $achievement_data['vx']['prize'][0];
+ $a->updateTier('vx_n');
+ $u->addEkr($a->getData()['vx']['prize'][$ai['vx_n']]);
+ $nagrtxt .= $a->getData()['vx']['prize'][$ai['vx_n']] . $a->getData()['vx']['prize'][0];
} elseif ( //Сундуки трупожора snt
in_array($_GET['nagr'], [31, 32, 33, 34, 35]) &&
in_array($ai['snt_n'], [0, 1, 2, 3, 4]) &&
$ai['klassnt'] > $ai['snt_n']
) {
$ai['snt_n'] += 1;
- $u->rangup($u->info['id'], $ai['snt_n'], 'snt');
- Db::sql('update users set money2 = money2 + ? where id = ?',
- [$achievement_data['snt']['prize'][$ai['snt_n']], $u->info['id']]);
- $nagrtxt .= $achievement_data['snt']['prize'][$ai['snt_n']] . $achievement_data['snt']['prize'][0];
+ $a->updateTier('snt_n');
+ $u->addEkr($a->getData()['snt']['prize'][$ai['snt_n']]);
+ $nagrtxt .= $a->getData()['snt']['prize'][$ai['snt_n']] . $a->getData()['snt']['prize'][0];
} elseif ( //Руны 8 лвл. rp
in_array($_GET['nagr'], [41, 42, 43, 44, 45]) &&
in_array($ai['rp_n'], [0, 1, 2, 3, 4]) &&
$ai['klasrp'] > $ai['rp_n']
) {
$ai['rp_n'] += 1;
- $u->rangup($u->info['id'], $ai['rp_n'], 'rp');
- $i = 0;
- while ($i < $achievement_data['rp']['prize'][$ai['rp_n']]) {
- $u->addItem(10038, $u->info['id'], '');
- $i++;
- }
- $nagrtxt .= 'Плохие Заготовки X' . $achievement_data['rp']['prize'][$ai['rp_n']];
+ $a->updateTier('rp_n');
+ $a->givePrizeItems(10038, 'rp');
+ $nagrtxt .= 'Плохие Заготовки X' . $a->getData()['rp']['prize'][$ai['rp_n']];
} elseif ( //Руны 9 лвл. rn
in_array($_GET['nagr'], [51, 52, 53, 54, 55]) &&
in_array($ai['rn_n'], [0, 1, 2, 3, 4]) &&
$ai['klasrn'] > $ai['rn_n']
) {
$ai['rn_n'] += 1;
- $u->rangup($u->info['id'], $ai['rn_n'], 'rn');
- $i = 0;
- while ($i < $achievement_data['rn']['prize'][$ai['rn_n']]) {
- $u->addItem(10039, $u->info['id'], '');
- $i++;
- }
- $nagrtxt .= 'Нормальные Заготовки X' . $achievement_data['rn']['prize'][$ai['rn_n']];
+ $a->updateTier('rn_n');
+ $a->givePrizeItems(10039, 'rn');
+ $nagrtxt .= 'Нормальные Заготовки X' . $a->getData()['rn']['prize'][$ai['rn_n']];
} elseif ( //Руны 10 лвл. rb
in_array($_GET['nagr'], [61, 62, 63, 64, 65]) &&
in_array($ai['rb_n'], [0, 1, 2, 3, 4]) &&
$ai['klasrb'] > $ai['rb_n']
) {
$ai['rb_n'] += 1;
- $u->rangup($u->info['id'], $ai['rb_n'], 'rb');
- $i = 0;
- while ($i < $achievement_data['rb']['prize'][$ai['rb_n']]) {
- $u->addItem(10040, $u->info['id'], '');
- $i++;
- }
- $nagrtxt .= 'Идеальные Заготовки X' . $achievement_data['rb']['prize'][$ai['rb_n']];
+ $a->updateTier('rb_n');
+ $a->givePrizeItems(10040, 'rb');
+ $nagrtxt .= 'Идеальные Заготовки X' . $a->getData()['rb']['prize'][$ai['rb_n']];
} elseif ( //Героик pg
in_array($_GET['nagr'], [71, 72, 73, 74, 75]) &&
in_array($ai['pg_n'], [0, 1, 2, 3, 4]) &&
$ai['klaspg'] > $ai['pg_n']
) {
$ai['pg_n'] += 1;
- $u->rangup($u->info['id'], $ai['pg_n'], 'pg');
- $i = 0;
- while ($i < $achievement_data['pg']['prize'][$ai['pg_n']]) {
- $u->addItem(10020, $u->info['id'], '');
- $i++;
- }
- $nagrtxt .= 'Жетон Успеха X' . $achievement_data['pg']['prize'][$ai['pg_n']];
+ $a->updateTier('pg_n');
+ $a->givePrizeItems(10020, 'pg');
+ $nagrtxt .= 'Жетон Успеха X' . $a->getData()['pg']['prize'][$ai['pg_n']];
} elseif ( //Продать бабушке найденные вещи в пещере bv
in_array($_GET['nagr'], [81, 82, 83, 84, 85]) &&
in_array($ai['bv_n'], [0, 1, 2, 3, 4]) &&
$ai['klasbv'] > $ai['bv_n']
) {
$ai['bv_n'] += 1;
- $u->rangup($u->info['id'], $ai['bv_n'], 'bv');
- Db::sql('update users set money = money + ? where id = ?',
- [$achievement_data['bv']['prize'][$ai['bv_n']], $u->info['id']]);
- $nagrtxt .= $achievement_data['bv']['prize'][$ai['bv_n']] . $achievement_data['bv']['prize'][0];
+ $a->updateTier('bv_n');
+ $u->addKr($a->getData()['bv']['prize'][$ai['bv_n']]);
+ $nagrtxt .= $a->getData()['bv']['prize'][$ai['bv_n']] . $a->getData()['bv']['prize'][0];
} elseif ( //Клан вар kw
in_array($_GET['nagr'], [91, 92, 93, 94, 95]) &&
in_array($ai['kw_n'], [0, 1, 2, 3, 4]) &&
$ai['klaskw'] > $ai['kw_n']
) {
$ai['kw_n'] += 1;
- $u->rangup($u->info['id'], $ai['kw_n'], 'kw');
- $i = 0;
- while ($i < $achievement_data['kw']['prize'][$ai['kw_n']]) {
- $u->addItem(4917, $u->info['id'], '');
- $i++;
- }
- $nagrtxt .= 'Клановый опыт +50000 X' . $achievement_data['kw']['prize'][$ai['kw_n']];
+ $a->updateTier('kw_n');
+ $a->givePrizeItems(4917, 'kw');
+ $nagrtxt .= 'Клановый опыт +50000 X' . $a->getData()['kw']['prize'][$ai['kw_n']];
} elseif ( //Башня смерти задание bs
in_array($_GET['nagr'], [101, 102, 103, 104, 105]) &&
in_array($ai['bs_n'], [0, 1, 2, 3, 4]) &&
$ai['klasbs'] > $ai['bs_n']
) {
$ai['bs_n'] += 1;
- $u->rangup($u->info['id'], $ai['bs_n'], 'bs');
- Db::sql('update users set money2 = money2 + ? where id = ?',
- [$achievement_data['bs']['prize'][$ai['bs_n']], $u->info['id']]);
- $nagrtxt .= $achievement_data['bs']['prize'][$ai['bs_n']] . $achievement_data['bs']['prize'][0];
+ $a->updateTier('bs_n');
+ $u->addEkr($a->getData()['bs']['prize'][$ai['bs_n']]);
+ $nagrtxt .= $a->getData()['bs']['prize'][$ai['bs_n']] . $a->getData()['bs']['prize'][0];
} elseif ( //Турниры победы trn
in_array($_GET['nagr'], [111, 112, 113, 114, 115]) &&
in_array($ai['trn_n'], [0, 1, 2, 3, 4]) &&
$ai['klastrn'] > $ai['trn_n']
) {
$ai['trn_n'] += 1;
- $u->rangup($u->info['id'], $ai['trn_n'], 'trn');
- Db::sql('update users set money2 = money2 + ? where id = ?',
- [$achievement_data['trn']['prize'][$ai['trn_n']], $u->info['id']]);
- $nagrtxt .= $achievement_data['trn']['prize'][$ai['trn_n']] . $achievement_data['trn']['prize'][0];
+ $a->updateTier('trn_n');
+ $u->addEkr($a->getData()['trn']['prize'][$ai['trn_n']]);
+ $nagrtxt .= $a->getData()['trn']['prize'][$ai['trn_n']] . $a->getData()['trn']['prize'][0];
}
+ //Тоже бы вынести в класс чата.
+ Db::sql('insert into chat (new, city, room, `to`, `text`, `time`, type) values (?,?,?,?,?,?,?)',
+ [1, $u->info['city'], $u->info['room'], $u->info['login'], $nagrtxt, -1, 6]);
- Db::sql('insert into chat (new, city, room, login, `to`, `text`, `time`, type, toChat) values (?,?,?,?,?,?,?,?,?)',
- [1, $u->info['city'], $u->info['room'], $u->info['login'], $nagrtxt, -1, 6, 0]);
- //-------------
-}
-function drawSunduk($nagr, $whatInside, $tier)
-{
- return vsprintf('',
- [
- "location.href='\main.php?titul&nagr=$nagr'",
- "top.hi(this, 'Сундук $tier ранга
Содержит:
$whatInside', event, 2, 0, 1, 1, 'max-width:307px')",
- "top.hic();",
- "top.hic();",
- "https://img.new-combats.com/i/titul/nagr$tier.gif"
- ]);
}
-$data = null;
-foreach ($achievement_data as $key => $value) {
- $data .= '' . $ai['name' . $key] . '
';
- $data .= '' . $value[$key]['quest'] . '';
- $data .= 'Сейчас у Вас Ранг: ' . $ai['klas' . $key] . '';
- $data .= 'Количество выполнений: ' . $ai[$key] . ' =' . $ai['klasP' . $key] . '%';
- $data .= table([
- [TIERS, 1, 2, 3, 4, 5],
- $value[$key]['check'],
- array_merge([PRIZE], $value[$key]['prize'])
- ], 'prizelist', true);
- # If has new tier, AND only first 5 tiers AND prize is set.
- if (
- $ai['klas' . $key] > $ai[$key . '_n'] &&
- in_array($ai[$key . '_n'], [0, 1, 2, 3, 4]) &&
- !empty($value[$key]['prize']) &&
- !empty($value[$key]['startlink'])
- ) {
- $data .= '
' . PRIZE . ':
';
- if (in_array($value[$key]['prize'][0], ['екр.', 'кр.'])) {
- $sundukName = $value[$key]['prize'][$ai[$key . '_n'] + 1] . $value[$key]['prize'][0];
- } else {
- $sundukName = $value[$key]['prize'][0] . $value[$key]['prize'][$ai[$key . '_n'] + 1];
- }
-
- $data .= drawSunduk(
- $ai[$key . '_n'] + $value[$key]['startlink'],
- $sundukName,
- $ai[$key . '_n'] + $value[$key]['startlink']
- );
- }
- $data .= '
';
-}
?>