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] .= '';
}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] .= '';
}
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] .= '';}
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();
?>