Файл: b_rt.php
Строк: 779
<?
define('PROTECTOR', 1);
$textl='Битва';
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
$lv=time();
$last=date('d.m.Y - H:i:s');
mysql_query("UPDATE `users` SET
`lv`='".$lv."',
`last`='".$last."',
`mesto`='".$textl."'
WHERE `id`='".$udata['id']."'");
$mobs=mysql_query("SELECT * FROM `craft` WHERE `usr`='".$udata['id']."'");
$rows=mysql_num_rows($mobs);
if($rows!=0)
{
header('location: work.php');exit;
}
$mobs1=mysql_query("SELECT * FROM `arena_usr` WHERE `usr`='".$udata['id']."'");
$rows1=mysql_num_rows($mobs1);
if($rows1!=0)
{
header('location: arena.php');exit;
}
$mobs3=mysql_query("SELECT * FROM `battle` WHERE `usr`='".$udata['id']."'");
$rows3=mysql_num_rows($mobs3);
if($rows3!=0)
{
header('location: battle.php');exit;
}
$mobs6=mysql_query("SELECT * FROM `str_usr` WHERE `usr`='".$udata['id']."'");
$rows6=mysql_num_rows($mobs6);
if($rows6!=0)
{
header('location: b_str.php');exit;
}
$mobs7=mysql_query("SELECT * FROM `terr_usr` WHERE `usr`='".$udata['id']."'");
$rows7=mysql_num_rows($mobs7);
if($rows7!=0)
{
header('location: terr_b.php');exit;
}
$bat=mysql_query("SELECT * FROM `rt_usr` WHERE `usr`='".$udata['id']."' and `tip`='usr'");
$num=mysql_num_rows($bat);
if($num==0)
{
header('location: game.php');exit;
}
else
{
$bt=mysql_fetch_array($bat);
$lvl=$udata['lvl']+1;
$exzn=mysql_num_rows(mysql_query("SELECT * FROM `lvl` WHERE `lvl`='".$lvl."'"));
if($exzn!=0)
{
$ex=mysql_fetch_array(mysql_query("SELECT * FROM `lvl` WHERE `lvl`='".$lvl."'"));
if($udata['exp']>=$ex['exp'])
{
$kl=$udata['lvl']+1;
if($udata['klass']==1)
{
$hp=$udata['hp1']+2;
$sila=$udata['sila1']+3;
$arm=$udata['arm1']+1;
}
if($udata['klass']==2)
{
$hp=$udata['hp1']+3;
$sila=$udata['sila1']+1;
$arm=$udata['arm1']+2;
}
if($udata['klass']==3)
{
$hp=$udata['hp1']+1;
$sila=$udata['sila1']+2;
$arm=$udata['arm1']+3;
}
mysql_query("UPDATE `users` SET `lvl`='".$kl."', `hp1`='".$hp."', `sila1`='".$sila."', `arm1`='".$arm."' WHERE `id`='".$udata['id']."'");
if($udata['ref']!=0)
{
$refer=mysql_query("SELECT * FROM `users` WHERE `id`='".$udata['ref']."'");
$ref=mysql_fetch_array($refer);
if($kl==30)
{
$ref_m=$ref['money']+100;
mysql_query("UPDATE `users` SET `money`='".$ref_m."' WHERE `id`='".$ref['id']."'");
$rows211=mysql_num_rows(mysql_query("SELECT * FROM `msg_kont` WHERE `usr1`='".$ref['id']."' and `usr2`='0'"));
if($rows211==0)
{
mysql_query("INSERT INTO `msg_kont` SET
`id`='',
`usr1`='".$ref['id']."',
`usr2`='0',
`read`='1',
`time`='".time()."'
");
}else
{
$rows21=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$ref['id']."'"));
mysql_query("UPDATE `msg_kont` SET `read`='1', `time`='".time()."' WHERE `usr2`='0' and `usr1`='".$ref['id']."'");
}
$rows21=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$ref['id']."'"));
$text='<font color=#cccccc>Ваш реферал '.$udata['usr'].' прокачался до 30 уровня. За это вы получаете <img src=img/main/p5.png>100.</font>
';
mysql_query("INSERT INTO `msg_dialog` SET
`id`='',
`dialog`='".$rows21['id']."',
`vhod`='1',
`time`='".time()."',
`text`='".$text."',
`usr`='".$ref['id']."'
");
}
if($kl==40)
{
$ref_m=$ref['jem']+5;
mysql_query("UPDATE `users` SET `jem`='".$ref_m."' WHERE `id`='".$ref['id']."'");
$rows211=mysql_num_rows(mysql_query("SELECT * FROM `msg_kont` WHERE `usr1`='".$ref['id']."' and `usr2`='0'"));
if($rows211==0)
{
mysql_query("INSERT INTO `msg_kont` SET
`id`='',
`usr1`='".$ref['id']."',
`usr2`='0',
`read`='1',
`time`='".time()."'
");
}else
{
$rows21=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$ref['id']."'"));
mysql_query("UPDATE `msg_kont` SET `read`='1', `time`='".time()."' WHERE `usr2`='0' and `usr1`='".$ref['id']."'");
}
$rows21=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$ref['id']."'"));
$text='<font color=#cccccc>Ваш реферал '.$udata['usr'].' прокачался до 40 уровня. За это вы получаете <img src=img/main/p13.png>5.</font>
';
mysql_query("INSERT INTO `msg_dialog` SET
`id`='',
`dialog`='".$rows21['id']."',
`vhod`='1',
`time`='".time()."',
`text`='".$text."',
`usr`='".$ref['id']."'
");
}
if($kl==45)
{
$ref_m=$ref['jem']+15;
mysql_query("UPDATE `users` SET `jem`='".$ref_m."' WHERE `id`='".$ref['id']."'");
$rows211=mysql_num_rows(mysql_query("SELECT * FROM `msg_kont` WHERE `usr1`='".$ref['id']."' and `usr2`='0'"));
if($rows211==0)
{
mysql_query("INSERT INTO `msg_kont` SET
`id`='',
`usr1`='".$ref['id']."',
`usr2`='0',
`read`='1',
`time`='".time()."'
");
}else
{
$rows21=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$ref['id']."'"));
mysql_query("UPDATE `msg_kont` SET `read`='1', `time`='".time()."' WHERE `usr2`='0' and `usr1`='".$ref['id']."'");
}
$rows21=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$ref['id']."'"));
$text='<font color=#cccccc>Ваш реферал '.$udata['usr'].' прокачался до 45 уровня. За это вы получаете <img src=img/main/p13.png>15.</font>
';
mysql_query("INSERT INTO `msg_dialog` SET
`id`='',
`dialog`='".$rows21['id']."',
`vhod`='1',
`time`='".time()."',
`text`='".$text."',
`usr`='".$ref['id']."'
");
}
if($kl==50)
{
$ref_m=$ref['jem']+30;
mysql_query("UPDATE `users` SET `jem`='".$ref_m."' WHERE `id`='".$ref['id']."'");
$rows211=mysql_num_rows(mysql_query("SELECT * FROM `msg_kont` WHERE `usr1`='".$ref['id']."' and `usr2`='0'"));
if($rows211==0)
{
mysql_query("INSERT INTO `msg_kont` SET
`id`='',
`usr1`='".$ref['id']."',
`usr2`='0',
`read`='1',
`time`='".time()."'
");
}else
{
$rows21=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$ref['id']."'"));
mysql_query("UPDATE `msg_kont` SET `read`='1', `time`='".time()."' WHERE `usr2`='0' and `usr1`='".$ref['id']."'");
}
$rows21=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$ref['id']."'"));
$text='<font color=#cccccc>Ваш реферал '.$udata['usr'].' прокачался до 50 уровня. За это вы получаете <img src=img/main/p13.png>30.</font>
';
mysql_query("INSERT INTO `msg_dialog` SET
`id`='',
`dialog`='".$rows21['id']."',
`vhod`='1',
`time`='".time()."',
`text`='".$text."',
`usr`='".$ref['id']."'
");
}
}
mysql_query("UPDATE `okrest` SET `hp`='".$udata['hp']."', `arm`='".$udata['arm']."', `sila`='".$udata['sila']."' WHERE `id`='".$bt['id']."'");
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='Ваш уровень повысился до ".$lvl."!'
");
header('location: ?');exit;
}
}
$bts_mob=mysql_query("SELECT * FROM `rt_mob` WHERE `usr`='".$udata['id']."'");
$bts_num=mysql_num_rows($bts_mob);
if($bts_num==0)
{
if($bt['status']==0)
{
$tr=time()-$bt['time_start'];
mysql_query("UPDATE `rt_usr` SET `status`='1', `trt`='".$tr."' WHERE `id`='".$bt['id']."'");
header('location: ?');exit;
}
}
else
{
$bts=mysql_fetch_array(mysql_query("SELECT * FROM `rt_mob` WHERE `usr`='".$udata['id']."' and `id`='".$bt['enemy']."'"));
}
$bts_mobz=mysql_query("SELECT * FROM `rt_mob` WHERE `usr`='".$udata['id']."' and `id`='".$bt['enemy']."'");
$bts_numz=mysql_num_rows($bts_mobz);
if($bt['status']==0 and $bts_num!=0 and $bts_numz==0)
{
$enemy=mysql_fetch_array(mysql_query("SELECT * FROM `rt_mob` WHERE `usr`='".$udata['id']."'"));
mysql_query("UPDATE `rt_usr` SET `enemy`='".$enemy['id']."' WHERE `id`='".$bt['id']."'");
header('location: ?');exit;
}
if(isset($_GET['kick']))
{
if($bt['status']==0)
{
$max_sila=$udata['sila'];
$min_sila=round($max_sila/100*10);if($min_sila<1){$min_sila=1;}
$blok=0;
$krit=$udata['krit'];
$arm=$bts['arm'];
if($bt['sfer_3_time']>=time())
{$baf_3=$bt['sfer_3_ef'];}else{$baf_3=0;}//усиление
if($bts['sfer_4_time']>=time())
{$baf_4=$bts['sfer_4_ef'];}else{$baf_4=0;}//пробивание
if($bt['sfer_5_time']>=time())
{$baf_5=$bt['sfer_5_time']-time();}else{$baf_5=0;}//стан
$time=$bt['time_us'];
if($time>time())
{
$sek=$time-time();
if($sek>=5){$prom=1;}
elseif($sek==4){$prom=0;$max_sila=round($max_sila-$max_sila/100*rand(70,80));$min_sila=round($min_sila/4);}
elseif($sek==3){$prom=0;$max_sila=round($max_sila-$max_sila/100*rand(50,70));$min_sila=round($min_sila/3);}
elseif($sek==2 or $sek==1){$prom=0;$max_sila=round($max_sila-$max_sila/100*rand(20,50));$min_sila=round($min_sila/2);}
}
if($baf_5!=0)
{
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b1.png><font color=#999999>Вы оглушены еще ".$baf_5."сек.</font>'
");
}
else
{
if($prom==1)
{
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b1.png><font color=#999999>Промах!</font>'
");
}
else
{
$sila=$max_sila;
$sila=round($sila+$sila/100*$baf_3);
$arm=round($arm-$arm/100*$baf_4);
$sila=$sila-$arm;
if($sila<$min_sila){$sila=round($min_sila-$min_sila/100*0);}
if($sila<1){$sila=1;}
$kr=rand(1,100);if($kr<=$krit){$sila=$sila*2;$k_sila=1;}else{$k_sila=0;}
$bl=rand(1,100);if($bl<=$blok){$blok_us=1;}else{$blok_us=0;}
if($blok_us==1)
{
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b23.png>".$bts['name']."<font color=#990000> заблокировал вашу атаку</font>'
");
$att=0;
$att2=0;
}
else
{
if($k_sila==1)
{
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b8.png><font color=#ff0000>Вы наносите критический удар ".$bts['name']." <b>-".$sila."</b></font>'
");
}
else
{
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b8.png><font color=#00ff99>Вы наносите удар ".$k." ".$bts['name']." -".$sila."</font>'
");
}
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$bts['name']."</font>'
");
$nai=$udata['reit_oh']+1;
$ds=$udata['dost2a']+1;
mysql_query("UPDATE `users` SET `reit_oh`='".$nai."', `dost2a`='".$ds."' WHERE `id`='".$udata['id']."'");
mysql_query("DELETE FROM `rt_mob` WHERE `id`='".$bts['id']."'");
}
else
{
$exp=$sila;
mysql_query("UPDATE `rt_mob` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
if($udata['lvl']<16)
{$vrs=5;}
if($udata['lvl']>15 and $udata['lvl']<31)
{$vrs=4;}
if($udata['lvl']>30 and $udata['lvl']<39)
{$vrs=2;}
if($udata['lvl']>38)
{$vrs=1;}
$exp=$exp*$vrs;
$vipss=mysql_query("SELECT * FROM `vip` WHERE `usr`='".$udata['id']."'");
$nvips=mysql_num_rows($vipss);
if($nvips!=0)
{
$exp=round($exp+$exp/100*30);
}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
$t=time()+7;
mysql_query("UPDATE `rt_usr` SET `time_us`='".$t."', `att`='".$att."' WHERE `id`='".$bt['id']."'");
}
}
header('location: ?');exit;
}
if(isset($_GET['mag']))
{
$m=mysql_real_escape_string($_GET['mag']);
$tn=time();
$mobs=mysql_query("SELECT * FROM `mag` WHERE `usr`='".$udata['id']."' and `mag`='".$m."' and `time`<='".$tn."' and `status`='on'");
$rows=mysql_num_rows($mobs);
if($rows!=0)
{
$skill=mysql_fetch_array($mobs);
if($m==3)
{
$sila=3*$skill['lvl'];
$tm=time()+90;
$ts=time()+60;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='3' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `rt_usr` SET `sfer_3_time`='".$ts."', `sfer_3_ef`='".$sila."' WHERE `id`='".$bt['id']."'");
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание усиления</font>, физические атаки +".$sila."% урона.</font>'
");
}
if($m==4)
{
if($bt['status']==0)
{
if($skill['lvl']==1)
{$sila=10;}
if($skill['lvl']==2)
{$sila=15;}
if($skill['lvl']==3)
{$sila=20;}
if($skill['lvl']==4)
{$sila=25;}
if($skill['lvl']==5)
{$sila=30;}
if($skill['lvl']==6)
{$sila=35;}
if($skill['lvl']==7)
{$sila=45;}
if($skill['lvl']==8)
{$sila=55;}
if($skill['lvl']==9)
{$sila=65;}
if($skill['lvl']==10)
{$sila=75;}
$tm=time()+60;
$ts=time()+40;
mysql_query("UPDATE `mag` SET`time`='".$tm."' WHERE `mag`='4' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `rt_mob` SET `sfer_4_time`='".$ts."', `sfer_4_ef`='".$sila."' WHERE `id`='".$bts['id']."'");
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание пробивания</font>, ".$bts['name']." -".$sila."% брони.</font>'
");
}
}
if($m==6)
{
if($skill['lvl']==1)
{$sila=10;}
if($skill['lvl']==2)
{$sila=15;}
if($skill['lvl']==3)
{$sila=20;}
if($skill['lvl']==4)
{$sila=25;}
if($skill['lvl']==5)
{$sila=30;}
if($skill['lvl']==6)
{$sila=35;}
if($skill['lvl']==7)
{$sila=45;}
if($skill['lvl']==8)
{$sila=55;}
if($skill['lvl']==9)
{$sila=65;}
if($skill['lvl']==10)
{$sila=75;}
$tm=time()+90;
$ts=time()+30;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='6' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `rt_usr` SET `sfer_6_time`='".$ts."', `sfer_6_ef`='".$sila."' WHERE `id`='".$bt['id']."'");
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание обороны</font>, +".$sila."% защиты от физических атак.</font>'
");
}
if($m==10)
{
$sila=5*$skill['lvl'];
$tm=time()+60;
$ts=time()+30;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='10' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `rt_usr` SET `sfer_10_time`='".$ts."', `sfer_10_ef`='".$sila."' WHERE `id`='".$bt['id']."'");
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание возврата</font>, ".$sila."% урона возвращается противнику.</font>'
");
}
if($m==11)
{
if($bt['status']==0)
{
$sila=5*$skill['lvl'];
$tm=time()+30;
$ts=time()+20;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='11' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `rt_mob` SET `sfer_11_time`='".$ts."', `sfer_11_ef`='".$sila."' WHERE `id`='".$bts['id']."'");
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание ослабления</font>, ".$bts['name']." -".$sila."% урона.</font>'
");
}
}
if($m==12)
{
if($skill['lvl']==1)
{$sila=7;}
if($skill['lvl']==2)
{$sila=15;}
if($skill['lvl']==3)
{$sila=22;}
if($skill['lvl']==4)
{$sila=30;}
if($skill['lvl']==5)
{$sila=37;}
if($skill['lvl']==6)
{$sila=45;}
if($skill['lvl']==7)
{$sila=52;}
if($skill['lvl']==8)
{$sila=60;}
if($skill['lvl']==9)
{$sila=67;}
if($skill['lvl']==10)
{$sila=75;}
$tm=time()+60;
$ts=time()+20;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='12' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `rt_usr` SET `sfer_12_time`='".$ts."', `sfer_12_ef`='".$sila."' WHERE `id`='".$bt['id']."'");
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание барьера</font>, +".$sila."% защиты от заклинаний.</font>'
");
}
if($m==1)
{
if($bt['status']==0)
{
$sila=5*$skill['lvl']+5;
$tm=time()+5;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='1' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание атаки</font>, ".$bts['name']." -".$sila."хп.</font>'
");
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$bts['name']."</font>'
");
$nai=$udata['reit_oh']+1;
$ds=$udata['dost2a']+1;
mysql_query("UPDATE `users` SET `reit_oh`='".$nai."', `dost2a`='".$ds."' WHERE `id`='".$udata['id']."'");
mysql_query("DELETE FROM `rt_mob` WHERE `id`='".$bts['id']."'");
}
else
{
$exp=$sila;
mysql_query("UPDATE `rt_mob` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `rt_usr` SET `att`='".$att."' WHERE `id`='".$bt['id']."'");
if($udata['lvl']<16)
{$vrs=5;}
if($udata['lvl']>15 and $udata['lvl']<31)
{$vrs=4;}
if($udata['lvl']>30 and $udata['lvl']<39)
{$vrs=2;}
if($udata['lvl']>38)
{$vrs=1;}
$exp=$exp*$vrs;
$vipss=mysql_query("SELECT * FROM `vip` WHERE `usr`='".$udata['id']."'");
$nvips=mysql_num_rows($vipss);
if($nvips!=0)
{
$exp=round($exp+$exp/100*30);
}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
if($m==2)
{
if($bt['status']==0)
{
if($skill['lvl']==1)
{$sila=rand(10,100);}
if($skill['lvl']==2)
{$sila=rand(30,200);}
if($skill['lvl']==3)
{$sila=rand(50,300);}
if($skill['lvl']==4)
{$sila=rand(70,400);}
if($skill['lvl']==5)
{$sila=rand(90,500);}
if($skill['lvl']==6)
{$sila=rand(110,600);}
if($skill['lvl']==7)
{$sila=rand(130,700);}
if($skill['lvl']==8)
{$sila=rand(150,800);}
if($skill['lvl']==9)
{$sila=rand(170,900);}
if($skill['lvl']==10)
{$sila=rand(190,1000);}
$tm=time()+50;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='2' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание случайности</font>, ".$bts['name']." -".$sila."хп.</font>'
");
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$bts['name']."</font>'
");
$nai=$udata['reit_oh']+1;
$ds=$udata['dost2a']+1;
mysql_query("UPDATE `users` SET `reit_oh`='".$nai."', `dost2a`='".$ds."' WHERE `id`='".$udata['id']."'");
mysql_query("DELETE FROM `rt_mob` WHERE `id`='".$bts['id']."'");
}
else
{
$exp=$sila;
mysql_query("UPDATE `rt_mob` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `rt_usr` SET `att`='".$att."' WHERE `id`='".$bt['id']."'");
if($udata['lvl']<16)
{$vrs=5;}
if($udata['lvl']>15 and $udata['lvl']<31)
{$vrs=4;}
if($udata['lvl']>30 and $udata['lvl']<39)
{$vrs=2;}
if($udata['lvl']>38)
{$vrs=1;}
$exp=$exp*$vrs;
$vipss=mysql_query("SELECT * FROM `vip` WHERE `usr`='".$udata['id']."'");
$nvips=mysql_num_rows($vipss);
if($nvips!=0)
{
$exp=round($exp+$exp/100*30);
}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
if($m==13)
{
if($bt['status']==0)
{
$sila=3*$skill['lvl'];
$sila=round($bts['hp']/100*$sila);
$tm=time()+60;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='13' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание сингулярности</font>, ".$bts['name']." -".$sila."хп.</font>'
");
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$bts['name']."</font>'
");
$nai=$udata['reit_oh']+1;
$ds=$udata['dost2a']+1;
mysql_query("UPDATE `users` SET `reit_oh`='".$nai."', `dost2a`='".$ds."' WHERE `id`='".$udata['id']."'");
mysql_query("DELETE FROM `rt_mob` WHERE `id`='".$bts['id']."'");
}
else
{
$exp=$sila;
mysql_query("UPDATE `rt_mob` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `rt_usr` SET `att`='".$att."' WHERE `id`='".$bt['id']."'");
if($udata['lvl']<16)
{$vrs=5;}
if($udata['lvl']>15 and $udata['lvl']<31)
{$vrs=4;}
if($udata['lvl']>30 and $udata['lvl']<39)
{$vrs=2;}
if($udata['lvl']>38)
{$vrs=1;}
$exp=$exp*$vrs;
$vipss=mysql_query("SELECT * FROM `vip` WHERE `usr`='".$udata['id']."'");
$nvips=mysql_num_rows($vipss);
if($nvips!=0)
{
$exp=round($exp+$exp/100*30);
}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
if($m==14)
{
if($bt['status']==0)
{
$sila=50*$skill['lvl'];
$tm=time()+40;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='14' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание хаоса</font>, ".$bts['name']." -".$sila."хп.</font>'
");
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$bts['name']."</font>'
");
$nai=$udata['reit_oh']+1;
$ds=$udata['dost2a']+1;
mysql_query("UPDATE `users` SET `reit_oh`='".$nai."', `dost2a`='".$ds."' WHERE `id`='".$udata['id']."'");
mysql_query("DELETE FROM `rt_mob` WHERE `id`='".$bts['id']."'");
}
else
{
$exp=$sila;
mysql_query("UPDATE `rt_mob` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `rt_usr` SET `att`='".$att."' WHERE `id`='".$bt['id']."'");
if($udata['lvl']<16)
{$vrs=5;}
if($udata['lvl']>15 and $udata['lvl']<31)
{$vrs=4;}
if($udata['lvl']>30 and $udata['lvl']<39)
{$vrs=2;}
if($udata['lvl']>38)
{$vrs=1;}
$exp=$exp*$vrs;
$vipss=mysql_query("SELECT * FROM `vip` WHERE `usr`='".$udata['id']."'");
$nvips=mysql_num_rows($vipss);
if($nvips!=0)
{
$exp=round($exp+$exp/100*30);
}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
if($m==7)
{
if($bt['status']==0)
{
if($skill['lvl']==1)
{$sila=70;}
if($skill['lvl']==2)
{$sila=140;}
if($skill['lvl']==3)
{$sila=210;}
if($skill['lvl']==4)
{$sila=280;}
if($skill['lvl']==5)
{$sila=350;}
if($skill['lvl']==6)
{$sila=420;}
if($skill['lvl']==7)
{$sila=500;}
if($skill['lvl']==8)
{$sila=600;}
if($skill['lvl']==9)
{$sila=700;}
if($skill['lvl']==10)
{$sila=800;}
$tm=time()+50;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='7' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание молнии</font>, ".$bts['name']." -".$sila."хп.</font>'
");
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$bts['name']."</font>'
");
$nai=$udata['reit_oh']+1;
$ds=$udata['dost2a']+1;
mysql_query("UPDATE `users` SET `reit_oh`='".$nai."', `dost2a`='".$ds."' WHERE `id`='".$udata['id']."'");
mysql_query("DELETE FROM `rt_mob` WHERE `id`='".$bts['id']."'");
}
else
{
$exp=$sila;
mysql_query("UPDATE `rt_mob` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `rt_usr` SET `att`='".$att."' WHERE `id`='".$bt['id']."'");
if($udata['lvl']<16)
{$vrs=5;}
if($udata['lvl']>15 and $udata['lvl']<31)
{$vrs=4;}
if($udata['lvl']>30 and $udata['lvl']<39)
{$vrs=2;}
if($udata['lvl']>38)
{$vrs=1;}
$exp=$exp*$vrs;
$vipss=mysql_query("SELECT * FROM `vip` WHERE `usr`='".$udata['id']."'");
$nvips=mysql_num_rows($vipss);
if($nvips!=0)
{
$exp=round($exp+$exp/100*30);
}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
if($m==9)
{
if($bt['status']==0)
{
$sila=40*$skill['lvl'];
$sh=$sila/2;
$tm=time()+30;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='9' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание вампира</font>, ".$bts['name']." -".$sila."хп, ваше хп + ".$sh."</font>'
");
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$bts['name']."</font>'
");
$nai=$udata['reit_oh']+1;
$ds=$udata['dost2a']+1;
mysql_query("UPDATE `users` SET `reit_oh`='".$nai."', `dost2a`='".$ds."' WHERE `id`='".$udata['id']."'");
mysql_query("DELETE FROM `rt_mob` WHERE `id`='".$bts['id']."'");
}
else
{
$exp=$sila;
mysql_query("UPDATE `rt_mob` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
$hps=$bt['hp']+$sh;
if($hps>$udata['hp'])
{
$hps=$udata['hp'];
}
mysql_query("UPDATE `rt_usr` SET `att`='".$att."', `hp`='".$hps."' WHERE `id`='".$bt['id']."'");
if($udata['lvl']<16)
{$vrs=5;}
if($udata['lvl']>15 and $udata['lvl']<31)
{$vrs=4;}
if($udata['lvl']>30 and $udata['lvl']<39)
{$vrs=2;}
if($udata['lvl']>38)
{$vrs=1;}
$exp=$exp*$vrs;
$vipss=mysql_query("SELECT * FROM `vip` WHERE `usr`='".$udata['id']."'");
$nvips=mysql_num_rows($vipss);
if($nvips!=0)
{
$exp=round($exp+$exp/100*30);
}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
if($m==8)
{
$sila=80*$skill['lvl'];
$tm=time()+40;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='8' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание исциления</font> ваше хп + ".$sila."</font>'
");
$hps=$bt['hp']+$sila;
if($hps>$udata['hp'])
{
$hps=$udata['hp'];
}
mysql_query("UPDATE `rt_usr` SET `hp`='".$hps."' WHERE `id`='".$bt['id']."'");
}
if($m==5)
{
if($bt['status']==0)
{
if($skill['lvl']==1)
{$sila=15;$t=5;}
if($skill['lvl']==2)
{$sila=30;$t=6;}
if($skill['lvl']==3)
{$sila=45;$t=7;}
if($skill['lvl']==4)
{$sila=60;$t=8;}
if($skill['lvl']==5)
{$sila=75;$t=9;}
if($skill['lvl']==6)
{$sila=90;$t=10;}
if($skill['lvl']==7)
{$sila=105;$t=11;}
if($skill['lvl']==8)
{$sila=120;$t=12;}
if($skill['lvl']==9)
{$sila=135;$t=14;}
if($skill['lvl']==10)
{$sila=150;$t=15;}
$tm=time()+60;
$ts=time()+$t;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='5' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `arena__m_mob` SET `sfer_5_time`='".$ts."' WHERE `id`='".$bts['id']."'");
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание стана</font>, ".$bts['name']." -".$sila."хп, +".$t."сек. оглушение</font>'
");
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$bts['name']."</font>'
");
$nai=$udata['reit_oh']+1;
$ds=$udata['dost2a']+1;
mysql_query("UPDATE `users` SET `reit_oh`='".$nai."', `dost2a`='".$ds."' WHERE `id`='".$udata['id']."'");
mysql_query("DELETE FROM `rt_mob` WHERE `id`='".$bts['id']."'");
}
else
{
$exp=$sila;
mysql_query("UPDATE `rt_mob` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `rt_usr` SET `att`='".$att."' WHERE `id`='".$bt['id']."'");
if($udata['lvl']<16)
{$vrs=5;}
if($udata['lvl']>15 and $udata['lvl']<31)
{$vrs=4;}
if($udata['lvl']>30 and $udata['lvl']<39)
{$vrs=2;}
if($udata['lvl']>38)
{$vrs=1;}
$exp=$exp*$vrs;
$vipss=mysql_query("SELECT * FROM `vip` WHERE `usr`='".$udata['id']."'");
$nvips=mysql_num_rows($vipss);
if($nvips!=0)
{
$exp=round($exp+$exp/100*30);
}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
}
header('location: ?');exit;
}
if(isset($_GET['elic']))
{
$els=mysql_real_escape_string($_GET['elic']);
$elic=mysql_query("SELECT * FROM `elic` WHERE `id`='".$els."' and `usr`='".$udata['id']."' and `status`='on'");
$cd=mysql_num_rows($elic);
if($cd==0)
{
header('location: ?');exit;
}
else
{
$el=mysql_fetch_array($elic);
if($el['time']>time())
{
$lg='<img src=img/main/e22.png> <font color=#999999>Зелье еще не готово.</font>';
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg."'
");
header('location: ?');exit;
}
if($bt['hp']==$udata['hp'] or $bt['hp']==0)
{
$lg='<img src=img/main/e22.png> <font color=#999999>нет эффекта.</font>';
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg."'
");
header('location: ?');exit;
}
$hp=$bt['hp']+$el['ef'];
if($hp>$udata['hp'])
{
$hp=$udata['hp'];
}
mysql_query("UPDATE `rt_usr` SET `hp`='".$hp."' WHERE `id`='".$bt['id']."'");
$elk=$el['kol']-1;
if($elk==0)
{
mysql_query("DELETE FROM `elic` WHERE `id`='".$el['id']."'");
}
else
{
$time=time()+$el['rest'];
mysql_query("UPDATE `elic` SET `kol`='".$elk."', `time`='".$time."' WHERE `id`='".$el['id']."'");
}
if($el['ef']!=20000)
{
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/p21.png> <font color=#009900>Ты испил зелья и исцелился +".$el['ef']." <img src=img/main/p6.png></font>'
");
}
else
{
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/p21.png> <font color=#009900>Ты испил зелья и ваше здоровье востановилось <img src=img/main/p6.png></font>'
");
}
$ds=$udata['dost3a']+1;
mysql_query("UPDATE `users` SET `dost3a`='".$ds."' WHERE `id`='".$udata['id']."'");
header('location: ?');exit;
}
}
$en=mysql_num_rows(mysql_query("SELECT * FROM `rt_mob` WHERE `usr`='".$bt['usr']."' and `time_us`<'".time()."'"));
if($en!=0)
{
$ed=mysql_query("SELECT * FROM `rt_mob` WHERE `usr`='".$bt['usr']."' and `time_us`<'".time()."'");
while($ens=mysql_fetch_array($ed))
{
if($ens['sfer_so']>time())
{
}
else
{
$r=rand(1,8);
if($r==1)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `rt_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' ORDER BY `id` DESC"));
}
if($r==2)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `rt_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' ORDER BY `id` ASC"));
}
if($r==3)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `rt_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' ORDER BY `hp` DESC"));
}
if($r==4)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `rt_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' ORDER BY `hp` ASC"));
}
if($r==5)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `rt_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' ORDER BY `sila` ASC"));
}
if($r==6)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `rt_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' ORDER BY `sila` DESC"));
}
if($r==7)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `rt_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' ORDER BY `arm` DESC"));
}
if($r==8)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `rt_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' ORDER BY `arm` ASC"));
}
if($btt['tip']=='usr')
{
$ssb=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$btt['usr']."'"));
$en_namet=' <img src=img/main/c'.$ssb['klass'].'.png> <img src=img/main/r'.$ssb['rasa'].'.png><font color=#ff0000>'.$ssb['usr'].'</font>';
}
if($btt['tip']=='pit')
{
$ssb=mysql_fetch_array(mysql_query("SELECT * FROM `pit` WHERE `id`='".$btt['pit']."' and `usr`='".$btt['usr']."'"));
$en_namet=' <font color=#ff9900>'.$ssb['name'].'</font>';
}
$blok=rand(1,100);
if($ssb['blok']>=$blok and $btt['tip']=='usr')
{
$lg12='<img src=img/main/b23.png> Вы заблокировали атаку <font color=#ffff00><font color=#00ff99>'.$ens['name'].'</font></font>.';
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$ssb['id']."',
`text`='".$lg12."'
");
$tim=time()+10;
mysql_query("UPDATE `rt_mob` SET `time_us`='".$tim."' WHERE `id`='".$ens['id']."'");
}
else
{
if($btt['tip']=='pit')
{
if($btt['mag_ney_time']>time())
{
$lg='<img src=img/main/b1.png> '.$en_namet.' уклонился от атаки <font color=#00ff99>'.$ens['name'].'</font>';
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg."'
");
}
$tim=time()+10;
mysql_query("UPDATE `rt_mob` SET `time_us`='".$tim."' WHERE `id`='".$ens['id']."'");
}
$dmg=$ens['sila'];
if($ens['sfer_11_time']>=time())
{
$dmg=round($dmg-$dmg/100*$ens['sfer_11_ef']);
}
$armr=$btt['arm'];
$dmg=$dmg-$armr;
if($btt['sfer_6_time']>=time())
{
$dmg=round($dmg-$dmg/100*$btt['sfer_6_ef']);
if($dmg<$ens['sila']/100*5)
{
$dmg=round($ens['sila']/100*5);
}
}
else
{
if($dmg<$ens['sila']/100*10)
{
$dmg=round($ens['sila']/100*10);
}
}
$m_dmg=round($ens['sila']/8);
$h_us=$btt['hp']-$dmg-$m_dmg;
$lg12='<img src=img/main/b23.png> <font color=#ff0000><font color=#00ff99>'.$ens['name'].'</font> ударил '.$en_namet.' -'.$dmg.' -<font color=#ff00ff>'.$m_dmg.'</font></font>.';
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg12."'
");
if($h_us<=0)
{
$lg12='<img src=img/main/b23.png> <font color=#ff0000><font color=#00ff99>'.$ens['name'].'</font> сокрушил '.$en_namet.'</font>.';
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg12."'
");
if($btt['tip']!='pit')
{
mysql_query("UPDATE `rt_usr` SET `hp`='0', `att2`='".$dmg."', `status`='2' WHERE `id`='".$btt['id']."'");
}
else
{
mysql_query("DELETE FROM `rt_usr` WHERE `id`='".$btt['id']."'");
}
}
else
{
$att2=$dmg+$m_dmg;
mysql_query("UPDATE `rt_usr` SET `hp`='".$h_us."', `att2`='".$att2."' WHERE `id`='".$btt['id']."'");
if($btt['sfer_10_time']>=time())
{
$yrs=round(($dmg+$m_dmg)/100*$btt['sfer_10_ef']);
if($yrs<1)
{
$yrs=1;
}
$hpz=$ens['hp']-$yrs;
$lgz='<img src=img/main/b10.png> <font color=#00ff00>заклинание возврата обожгло</font>
<font color=#00ff99>'.$ens['name'].'</font> <font color=#00ff00>-'.$yrs.'</font>';
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lgz."'
");
if($hpz<=0)
{
$lg2='<img src=img/main/b17.png>'.$en_namet.'</a> <font color=#ff0000>
сокрушает '.$bts['name'].'</font>';
mysql_query("INSERT INTO `log_rt` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg2."'
");
$ds=$ssb['dost2a']+1;
mysql_query("UPDATE `users` SET `dost2a`='".$ds."' WHERE `id`='".$ssb['id']."'");
mysql_query("DELETE FROM `rt_mob` WHERE `id`='".$ens['id']."'");
}
else
{
mysql_query("UPDATE `rt_mob` SET `hp`='".$hpz."' WHERE `id`='".$ens['id']."'");
}
mysql_query("UPDATE `rt_usr` SET `att`='".$yrs."' WHERE `id`='".$btt['id']."'");
}
}
$tim=time()+10;
mysql_query("UPDATE `rt_mob` SET `time_us`='".$tim."' WHERE `id`='".$ens['id']."'");
}
}
}
}
if(isset($_GET['leav']))
{
if($bt['status']==1)
{
if($udata['rt']==0){$udata['rt']=1;}
$rt=$udata['rt']+1;
$rt_reit=$udata['rt_reit']+$udata['rt'];
if($time<=$bt['time'])
{
$b=floor($udata['rt']/2);
if($b<1){$b=1;}
$rt_reit=$rt_reit+$b;
}
if($bt['bonus']==1)
{
$mon=$udata['money']+50;
mysql_query("UPDATE `users` SET `money`='".$mon."' WHERE `id`='".$udata['id']."'");
}
elseif($bt['bonus']==2)
{
$mon=$udata['money']+75;
mysql_query("UPDATE `users` SET `money`='".$mon."' WHERE `id`='".$udata['id']."'");
}
elseif($bt['bonus']==3)
{
$mon=$udata['money']+100;
mysql_query("UPDATE `users` SET `money`='".$mon."' WHERE `id`='".$udata['id']."'");
}
elseif($bt['bonus']==4)
{
$mon=$udata['money']+125;
mysql_query("UPDATE `users` SET `money`='".$mon."' WHERE `id`='".$udata['id']."'");
}
elseif($bt['bonus']==5)
{
$mon=$udata['money']+150;
mysql_query("UPDATE `users` SET `money`='".$mon."' WHERE `id`='".$udata['id']."'");
}
elseif($bt['bonus']==6)
{
$mon=$udata['money']+175;
$soul=$udata['soul_res']+25;
mysql_query("UPDATE `users` SET `money`='".$mon."', `soul_res`='".$soul."' WHERE `id`='".$udata['id']."'");
}
elseif($bt['bonus']==7)
{
$mon=$udata['money']+200;
$soul=$udata['soul_res']+40;
mysql_query("UPDATE `users` SET `money`='".$mon."', `soul_res`='".$soul."' WHERE `id`='".$udata['id']."'");
}
elseif($bt['bonus']==8)
{
$mon=$udata['money']+225;
$soul=$udata['soul_res']+70;
mysql_query("UPDATE `users` SET `money`='".$mon."', `soul_res`='".$soul."' WHERE `id`='".$udata['id']."'");
}
elseif($bt['bonus']==9)
{
$mon=$udata['money']+250;
$soul=$udata['soul_res']+100;
mysql_query("UPDATE `users` SET `money`='".$mon."', `soul_res`='".$soul."' WHERE `id`='".$udata['id']."'");
}
elseif($bt['bonus']==10)
{
$mon=$udata['money']+300;
$soul=$udata['soul_res']+125;
mysql_query("UPDATE `users` SET `money`='".$mon."', `soul_res`='".$soul."' WHERE `id`='".$udata['id']."'");
}
elseif($bt['bonus']==11)
{
$soul=$udata['money']+500;
$res=$udata['soul_res']+150;
mysql_query("UPDATE `users` SET `jem`='".$soul."', `soul_res`='".$res."' WHERE `id`='".$udata['id']."'");
}
mysql_query("UPDATE `users` SET `rt`='".$rt."', `rt_reit`='".$rt_reit."' WHERE `id`='".$udata['id']."'");
}
else
{
$rt=$udata['rt_p']-1;
mysql_query("UPDATE `users` SET `rt_p`='".$rt."' WHERE `id`='".$udata['id']."'");
}
mysql_query("DELETE FROM `rt_usr` WHERE `usr`='".$udata['id']."'");
mysql_query("DELETE FROM `rt_mob` WHERE `usr`='".$udata['id']."'");
mysql_query("DELETE FROM `log_rt` WHERE `usr`='".$udata['id']."'");
mysql_query("UPDATE `mag` SET
`time`='0' WHERE `usr`='".$udata['id']."'");
header('location: rt.php');exit;
}
if(isset($_GET['enemy']))
{
$id=mysql_real_escape_string($_GET['enemy']);
$enemy=mysql_num_rows(mysql_query("SELECT * FROM `rt_mob` WHERE `id`='".$id."' and `usr`='".$udata['id']."'"));
if($enemy!=0)
{
mysql_query("UPDATE `rt_usr` SET `enemy`='".$id."' WHERE `id`='".$bt['id']."'");
}
header('location: ?');exit;
}
include('b_rt2.php');
include('files/head.php');
echo '
<div class="v2 brs bls v8 bts bbs p v12"><font color=#00ccff>
<img src=img/main/p6.png>'.$bt['hp'].' | '.$hpw.'
<font color=#ff0000>'.$bt['att'].'</font> | <font color=#ff0000>'.$bt['att2'].'</font>';
if($bts_num!=0)
{
echo ' | '.$bts['name'].' <img src=img/main/p6.png>'.$bts['hp'].'';
}
$q = mysql_query("SELECT COUNT(*) FROM `msg_kont` WHERE `usr1` = '".$udata['id']."' AND `read` = '1';");
$new_mail = mysql_result($q, 0);
if($new_mail > 0)
{
echo"
<a href="mail.php"><img src=img/main/e1.png></a>";
}
if($udata['clan']!=0)
{
$fridaa=mysql_query("SELECT * FROM `sectors` WHERE `clan`='".$udata['clan']."' and `att_clan`!='0'");
$fra=mysql_num_rows($fridaa);
if($fra!=0)
{
echo'<a href=clan.php?gi=ter><img src=img/main/st.png></a>';
}
}
echo'</font> </div>';
$giza=mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id`='".$udata['clan']."'"));
if($giza['gorn_time']>time() and $udata['gorn']==1)
{
echo '<div class="v6 rr rt rl p">'.$giza['gorn'].'<br>
<img src=img/main/e55.png><a href=clan.php?gorn_def>Закрыть</a>
</div>';
}
echo '<div class="v3 bts brs bls b p v12">Битва</div><div class="v2 bts brs bls bbs p t2">';
if($bt['status']==0)
{
if($bt['enemy']==0)
{
echo '<img src=img/mob/0.jpg><br>';
}
else
{
echo '<img src=img/mob/rt/'.$bts['img'].'.jpg><br>
<a href=?kick><div class="v2s p"><img src=img/main/b17.png> <font color=#ffff00>бить '.$bts['name'].'</font> <font color=#ffffff>['.$bts['hp'].']</font></div></a>
';
}
$tn=time();
$mobs=mysql_query("SELECT * FROM `mag` WHERE `usr`='".$udata['id']."' and `status`='on' ORDER BY `id`");
$rows=mysql_num_rows($mobs);
if($rows==0)
{
}
else
{
while($mag=mysql_fetch_array($mobs))
{
if($mag['mag']==1)
{
$name='заклинание удара';
}
if($mag['mag']==2)
{
$name='заклинание случайности';
}
if($mag['mag']==3)
{
$name='заклинание усиления';
}
if($mag['mag']==4)
{
$name='заклинание пробивания';
}
if($mag['mag']==5)
{
$name='заклинание стана';
}
if($mag['mag']==6)
{
$name='заклинание обороны';
}
if($mag['mag']==7)
{
$name='заклинание молний';
}
if($mag['mag']==8)
{
$name='заклинание исцеления';
}
if($mag['mag']==9)
{
$name='заклинание вампира';
}
if($mag['mag']==10)
{
$name='заклинание возврата';
}
if($mag['mag']==11)
{
$name='заклинание ослабления';
}
if($mag['mag']==12)
{
$name='заклинание барьера';
}
if($mag['mag']==13)
{
$name='заклинание сингулярности';
}
if($mag['mag']==14)
{
$name='заклинание хаоса';
}
if($mag['time']<=$tn)
{
echo '<a href=?mag='.$mag['mag'].'>
<div class="v2s p"><img src=img/main/b10.png> <font color=#ffff00>'.$name.'</font></div></a>';
}
else
{
$mag['time']=$mag['time']-time();
$mag['time']=$mag['time']." с.";
echo '<a href=?mag='.$mag['mag'].'>
<div class="v2s p"><img src=img/main/b10.png> <font color=#555500>'.$name.'</font><font color=#ffffff> ['.$mag['time'].']</font></div></a>';
}
}
}
$eq=mysql_query("SELECT * FROM `elic` WHERE `usr`='".$udata['id']."' and `tip`='hp' and `status`='on'");
$rowse=mysql_num_rows($eq);
if($rowse==0)
{
}
else
{
while($el=mysql_fetch_array($eq))
{
if($el['time']<=$tn)
{
echo '<img src=img/elic/'.htmlspecialchars($el['tip']).''.$el['ef'].'.png> <a href=?elic='.$el['id'].'>пить</a> ';
}
else
{
$el['time']=$el['time']-time();
if($el['time']<60){
$el['time']=$el['time']." с.</font>";
}
echo '<img src=img/elic/'.htmlspecialchars($el['tip']).''.$el['ef'].'.png> '.$el['time'].' ';
}
}
}
echo '<br><br><a href=?leav><img src=img/main/p21.png> Покинуть бой</a>';
echo '</div>';
echo '<div class="v3 bts brs bls b p v12">Твой противник:</div>';
echo '<div class="v2 bts brs bls bbs p t2">';
$aqs=mysql_query("SELECT * FROM `rt_mob` WHERE `usr`='".$udata['id']."'");
while($mob=mysql_fetch_array($aqs))
{
echo '<a href=?enemy='.$mob['id'].'><font color=#00ff99>'.$mob['name'].'</font></a> <img src=img/main/p6.png>'.$mob['hp'].', ';
}
echo '</div>';
}
elseif($bt['status']==1)
{
echo '<div align=center><img src=img/inter/win.jpg></div>
<img src=img/main/b18.png> Вы успешно прошли данный этаж.<br>';
$time=$bt['trt'];
$h=floor($time/3600);
$m=floor(($time-($h*3600))/60);
$s=$time-($h*3600)-($m*60);
$trt=$h.':'.$m.':'.$s;
echo '<img src=img/main/e28.png> <font color=#ff9900>Время прохождения:</font> '.$trt.' ';
echo '<br>';
if($time<=$bt['time'])
{
$b=floor($udata['rt']/2);
if($b<1){$b=1;}
echo '<img src=img/main/e28.png> <font color=#ff9900>Дополнительный рейтинг:</font> +'.$b.'<br>';
}
if($bt['bonus']==1){echo '<img src=img/main/e28.png> Победа принесла вам: <img src=img/main/p5.png>50<br>';}
if($bt['bonus']==2){echo '<img src=img/main/e28.png> Победа принесла вам: <img src=img/main/p5.png>75<br>';}
if($bt['bonus']==3){echo '<img src=img/main/e28.png> Победа принесла вам: <img src=img/main/p5.png>100<br>';}
if($bt['bonus']==4){echo '<img src=img/main/e28.png> Победа принесла вам: <img src=img/main/p5.png>125<br>';}
if($bt['bonus']==5){echo '<img src=img/main/e28.png> Победа принесла вам: <img src=img/main/p5.png>150<br>';}
if($bt['bonus']==6){echo '<img src=img/main/e28.png> Победа принесла вам: <img src=img/main/p5.png>175 <img src=img/main/i27.png>25<br>';}
if($bt['bonus']==7){echo '<img src=img/main/e28.png> Победа принесла вам: <img src=img/main/p5.png>200 <img src=img/main/i27.png>40<br>';}
if($bt['bonus']==8){echo '<img src=img/main/e28.png> Победа принесла вам: <img src=img/main/p5.png>225 <img src=img/main/i27.png>70<br>';}
if($bt['bonus']==9){echo '<img src=img/main/e28.png> Победа принесла вам: <img src=img/main/p5.png>250 <img src=img/main/i27.png>100<br>';}
if($bt['bonus']==10){echo '<img src=img/main/e28.png> Победа принесла вам: <img src=img/main/p5.png>300 <img src=img/main/i27.png>125<br>';}
if($bt['bonus']==11){echo '<img src=img/main/e28.png> Победа принесла вам: <img src=img/main/p5.png>500 <img src=img/main/i27.png>150<br>';}
echo'
<a href=?leav><img src=img/main/p21.png> Покинуть бой</a>
</div>
';
}
elseif($bt['status']==2)
{
echo '<div align=center><img src=img/inter/lose.jpg></div>
<img src=img/main/b18.png> Вы проиграли! Бой завершен!<br>
<a href=?leav><img src=img/main/p21.png> Покинуть бой</a>
</div>
';
}
$mobs=mysql_query("SELECT * FROM `log_rt` WHERE `usr`='".$udata['id']."' ORDER BY `id` DESC LIMIT 10");
$rows=mysql_num_rows($mobs);
if($rows==0)
{
}
else
{
echo '<div class="v3 bts brs bls b p v12">Лог боя:</div><div class="v2 bts brs bls bbs p t2">';
while($log=mysql_fetch_array($mobs))
{
echo $log['text'].'<br>';
}
}
}
echo '</div>';
include('files/dwn.php');
?>