Файл: b_terr_mag.php
Строк: 621
<?
define('PROTECTOR', 1);
$textl='Битва';
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
$bat=mysql_query("SELECT * FROM `terr_usr` WHERE `usr`='".$udata['id']."'");
$bt=mysql_fetch_array($bat);
$bts=mysql_fetch_array(mysql_query("SELECT * FROM `terr_usr` WHERE `id`='".$bt['enemy']."' and `arr`='".$bt['arr']."' and `kom`!='".$bt['kom']."'"));
if($bts['tip']!='pit')
{
$us=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bts['usr']."'"));
}
else
{
$us=mysql_fetch_array(mysql_query("SELECT * FROM `pit` WHERE `id`='".$bts['pit']."'"));
$us['usr']=$us['name'];
}
if($bts['tip']!='pit')
{
if($us['ava']==0)
{
$img='<img src=img/pers/'.$us['klass'].''.$us['pol'].'.png>
';
}
else
{
$img='<img src=img/pers/ava/'.$us['ava'].'.png>';
}
$en_name=' <img src=img/main/c'.$us['klass'].'.png> <img src=img/main/r'.$us['rasa'].'.png><font color=#ff9900>'.$us['usr'].'</font>';
}
else
{
$us['usr']=$us['name'];
$en_name=' <font color=#ff9900>'.$us['usr'].'</font>';
$img= '<img src=img/pit/'.$us['tip'].'/'.$us['img'].'.jpg width=90px><br>';
}
$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($bt['sfer_5_time']>=time())
{$baf_5=$bt['sfer_5_time']-time();}else{$baf_5=0;}//стан
if($baf_5!=0)
{
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b1.png><font color=#999999>Вы оглушены еще ".$baf_5."сек.</font>',
`terr`='".$se['id']."'
");
header('location: b_terr.php');exit;
}
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 `terr_usr` SET `sfer_3_time`='".$ts."', `sfer_3_ef`='".$sila."' WHERE `id`='".$bt['id']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание усиления</font>, физические атаки +".$sila."% урона.</font>',
`terr`='".$se['id']."'
");
$enus=mysql_query("SELECT * FROM `terr_usr` WHERE `enemy`='".$bt['id']."'");
$n_enus=mysql_num_rows($enus);
if($n_enus!=0)
{
while($eb=mysql_fetch_array($enus))
{
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$eb['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание усиления</font>, физические атаки +".$sila."% урона.</font>',
`terr`='".$se['id']."'
");
}
}
}
if($m==4)
{
if($bt['status']==0 and $bt['enemy']!=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 `terr_usr` SET `sfer_4_time`='".$ts."', `sfer_4_ef`='".$sila."' WHERE `id`='".$bts['id']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание пробивания</font>, ".$en_name." -".$sila."% брони.</font>',
`terr`='".$se['id']."'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание пробивания</font>, ваша броня -".$sila."%.</font>',
`terr`='".$se['id']."'
");
}
}
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 `terr_usr` SET `sfer_6_time`='".$ts."', `sfer_6_ef`='".$sila."' WHERE `id`='".$bt['id']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание обороны</font>, +".$sila."% защиты от физических атак.</font>',
`terr`='".$se['id']."'
");
$enus=mysql_query("SELECT * FROM `terr_usr` WHERE `enemy`='".$bt['id']."'");
$n_enus=mysql_num_rows($enus);
if($n_enus!=0)
{
while($eb=mysql_fetch_array($enus))
{
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$eb['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание обороны</font>, +".$sila."% от физических атак.</font>',
`terr`='".$se['id']."'
");
}
}
}
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 `terr_usr` SET `sfer_10_time`='".$ts."', `sfer_10_ef`='".$sila."' WHERE `id`='".$bt['id']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание возврата</font>, ".$sila."% урона возвращается противнику.</font>',
`terr`='".$se['id']."'
");
$enus=mysql_query("SELECT * FROM `terr_usr` WHERE `enemy`='".$bt['id']."'");
$n_enus=mysql_num_rows($enus);
if($n_enus!=0)
{
while($eb=mysql_fetch_array($enus))
{
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$eb['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание возврата</font>, ".$sila."% возвращается противнику.</font>',
`terr`='".$se['id']."'
");
}
}
}
if($m==11)
{
if($bt['status']==0 and $bt['enemy']!=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 `terr_usr` SET `sfer_11_time`='".$ts."', `sfer_11_ef`='".$sila."' WHERE `id`='".$bts['id']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание ослабления</font>, ".$en_name." -".$sila."% урона.</font>',
`terr`='".$se['id']."'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание ослабления</font>, ваш урон -".$sila."%.</font>',
`terr`='".$se['id']."'
");
}
}
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 `terr_usr` SET `sfer_12_time`='".$ts."', `sfer_12_ef`='".$sila."' WHERE `id`='".$bt['id']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание барьера</font>, +".$sila."% защиты от заклинаний.</font>',
`terr`='".$se['id']."'
");
$enus=mysql_query("SELECT * FROM `terr_usr` WHERE `enemy`='".$bt['id']."'");
$n_enus=mysql_num_rows($enus);
if($n_enus!=0)
{
while($eb=mysql_fetch_array($enus))
{
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$eb['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание барьера</font>, +".$sila."% защиты от заклинаний.</font>',
`terr`='".$se['id']."'
");
}
}
}
if($m==1)
{
if($bt['status']==0 and $bt['enemy']!=0)
{
if($bt['sfer_12_time']>=time())
{$baf_12=$bt['sfer_12_ef'];}else{$baf_12=0;}//барьер
$sila=5*$skill['lvl']+5;
$sila=round($sila-$sila/100*$baf_12);
$tm=time()+5;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='1' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание атаки</font>, ".$en_name." -".$sila."хп.</font>',
`terr`='".$se['id']."'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание атаки</font> -".$sila."хп.</font>',
`terr`='".$se['id']."'
");
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
$kill=$gus['reit_b']+1;
$hp=0;
mysql_query("UPDATE `terr_usr` SET `status`='2' WHERE `id`='".$bts['id']."'");
$err=time()+1800;
mysql_query("UPDATE `users` SET `err`='".$err."' WHERE `id`='".$bts['usr']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$en_name."</font>',
`terr`='".$se['id']."'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b7.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> сокрушает вас</font>',
`terr`='".$se['id']."'
");
if($bts['tip']=='usr')
{
$us1=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bts['usr']."'"));
$us2=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bt['usr']."'"));
$us1['hp1']=$us1['hp1']+$us1['hp2'];
$us1['sila1']=$us1['sila1']+$us1['sila2'];
$us1['arm1']=$us1['arm1']+$us1['arm2'];
$ss1=$us1['hp1']+$us1['sila1']+$us1['arm1'];
$us2['hp1']=$us2['hp1']+$us2['hp2'];
$us2['sila1']=$us2['sila1']+$us2['sila2'];
$us2['arm1']=$us2['arm1']+$us2['arm2'];
$ss2=$us2['hp1']+$us2['sila1']+$us2['arm1'];
$lgf='<a href=info.php?id='.$us1['id'].'>'.$us1['usr'].'</a>('.$ss1.')<br>'.$us1['ip'].'</td><td align=center colspan=1><-</td><td colspan=2><a href=info.php?id='.$us1['id'].'>'.$us2['usr'].'</a>('.$ss2.')<br>'.$us2['ip'].'';
mysql_query("INSERT INTO `adm_res` SET
`id`='',
`usr`='".$bt['kod']."',
`tip`='terrs',
`text`='".$lgf."',
`time`='".time()."'
");
}
$nai=$udata['reit_nai']+1;
$ds=$udata['dost1a']+1;
mysql_query("UPDATE `users` SET `reit_nai`='".$nai."', `dost1a`='".$ds."' WHERE `id`='".$udata['id']."'");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['killer_exp']+1;
mysql_query("UPDATE `users_dost` SET `killer_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
}
else
{
$exp=$sila;
$kill=$gus['reit_b']+0;
$hp=$hp;
}
mysql_query("UPDATE `terr_usr` SET `hp`='".$hp."', `att2`='".$att2."' WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `terr_usr` SET `att`='".$att."' WHERE `id`='".$bt['id']."'");
mysql_query("UPDATE `clan_users` SET `reit_b`='".$kill."' WHERE `usr`='".$bt['usr']."'");
if($udata['lvl']<16)
{$vrs=15;}
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;
if($udata['vip_exp']>=100 and $udata['vip_exp']<250)
{$vip_lvl=1;}
elseif($udata['vip_exp']>=250 and $udata['vip_exp']<500)
{$vip_lvl=2;}
elseif($udata['vip_exp']>=500 and $udata['vip_exp']<1300)
{$vip_lvl=3;}
elseif($udata['vip_exp']>=1300 and $udata['vip_exp']<2500)
{$vip_lvl=4;}
elseif($udata['vip_exp']>=2500 and $udata['vip_exp']<5000)
{$vip_lvl=5;}
elseif($udata['vip_exp']>=5000){$vip_lvl=6;}
if($vip_lvl==1){$exp=$exp+$exp/100*5;}
if($vip_lvl==2){$exp=$exp+$exp/100*10;}
if($vip_lvl==3){$exp=$exp+$exp/100*15;}
if($vip_lvl==4){$exp=$exp+$exp/100*20;}
if($vip_lvl==5){$exp=$exp+$exp/100*30;}
if($vip_lvl==6){$exp=$exp+$exp/100*50;}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
if($m==2)
{
if($bt['status']==0 and $bt['enemy']!=0)
{
if($bt['sfer_12_time']>=time())
{$baf_12=$bt['sfer_12_ef'];}else{$baf_12=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);}
$sila=round($sila-$sila/100*$baf_12);
$tm=time()+50;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='2' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание случайности</font>, ".$en_name." -".$sila."хп.</font>',
`terr`='".$se['id']."'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание случайности</font> -".$sila."хп.</font>',
`terr`='".$se['id']."'
");
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
$kill=$gus['reit_b']+1;
$hp=0;
mysql_query("UPDATE `terr_usr` SET `status`='2' WHERE `id`='".$bts['id']."'");
$err=time()+1800;
mysql_query("UPDATE `users` SET `err`='".$err."' WHERE `id`='".$bts['usr']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$en_name."</font>',
`terr`='".$se['id']."'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b7.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> сокрушает вас</font>',
`terr`='".$se['id']."'
");
if($bts['tip']=='usr')
{
$us1=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bts['usr']."'"));
$us2=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bt['usr']."'"));
$us1['hp1']=$us1['hp1']+$us1['hp2'];
$us1['sila1']=$us1['sila1']+$us1['sila2'];
$us1['arm1']=$us1['arm1']+$us1['arm2'];
$ss1=$us1['hp1']+$us1['sila1']+$us1['arm1'];
$us2['hp1']=$us2['hp1']+$us2['hp2'];
$us2['sila1']=$us2['sila1']+$us2['sila2'];
$us2['arm1']=$us2['arm1']+$us2['arm2'];
$ss2=$us2['hp1']+$us2['sila1']+$us2['arm1'];
$lgf='<a href=info.php?id='.$us1['id'].'>'.$us1['usr'].'</a>('.$ss1.')<br>'.$us1['ip'].'</td><td align=center colspan=1><-</td><td colspan=2><a href=info.php?id='.$us1['id'].'>'.$us2['usr'].'</a>('.$ss2.')<br>'.$us2['ip'].'';
mysql_query("INSERT INTO `adm_res` SET
`id`='',
`usr`='".$bt['kod']."',
`tip`='terrs',
`text`='".$lgf."',
`time`='".time()."'
");
}
$nai=$udata['reit_nai']+1;
$ds=$udata['dost1a']+1;
mysql_query("UPDATE `users` SET `reit_nai`='".$nai."', `dost1a`='".$ds."' WHERE `id`='".$udata['id']."'");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['killer_exp']+1;
mysql_query("UPDATE `users_dost` SET `killer_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
}
else
{
$exp=$sila;
$kill=$gus['reit_b']+0;
$hp=$hp;
}
mysql_query("UPDATE `terr_usr` SET `hp`='".$hp."', `att2`='".$att2."' WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `terr_usr` SET `att`='".$att."' WHERE `id`='".$bt['id']."'");
mysql_query("UPDATE `clan_users` SET `reit_b`='".$kill."' WHERE `usr`='".$bt['usr']."'");
if($udata['lvl']<16)
{$vrs=15;}
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;
if($udata['vip_exp']>=100 and $udata['vip_exp']<250)
{$vip_lvl=1;}
elseif($udata['vip_exp']>=250 and $udata['vip_exp']<500)
{$vip_lvl=2;}
elseif($udata['vip_exp']>=500 and $udata['vip_exp']<1300)
{$vip_lvl=3;}
elseif($udata['vip_exp']>=1300 and $udata['vip_exp']<2500)
{$vip_lvl=4;}
elseif($udata['vip_exp']>=2500 and $udata['vip_exp']<5000)
{$vip_lvl=5;}
elseif($udata['vip_exp']>=5000){$vip_lvl=6;}
if($vip_lvl==1){$exp=$exp+$exp/100*5;}
if($vip_lvl==2){$exp=$exp+$exp/100*10;}
if($vip_lvl==3){$exp=$exp+$exp/100*15;}
if($vip_lvl==4){$exp=$exp+$exp/100*20;}
if($vip_lvl==5){$exp=$exp+$exp/100*30;}
if($vip_lvl==6){$exp=$exp+$exp/100*50;}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
if($m==13)
{
if($bt['status']==0 and $bt['enemy']!=0)
{
if($bt['sfer_12_time']>=time())
{$baf_12=$bt['sfer_12_ef'];}else{$baf_12=0;}//барьер
$sila=3*$skill['lvl'];
$sila=round($bts['hp']/100*$sila);
$sila=round($sila-$sila/100*$baf_12);
$tm=time()+60;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='13' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание сингулярности</font>, ".$en_name." -".$sila."хп.</font>',
`terr`='".$se['id']."'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание сингулярности</font> -".$sila."хп.</font>',
`terr`='".$se['id']."'
");
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
$kill=$gus['reit_b']+1;
$hp=0;
mysql_query("UPDATE `terr_usr` SET `status`='2' WHERE `id`='".$bts['id']."'");
$err=time()+1800;
mysql_query("UPDATE `users` SET `err`='".$err."' WHERE `id`='".$bts['usr']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$en_name."</font>',
`terr`='".$se['id']."'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b7.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> сокрушает вас</font>',
`terr`='".$se['id']."'
");
if($bts['tip']=='usr')
{
$us1=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bts['usr']."'"));
$us2=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bt['usr']."'"));
$us1['hp1']=$us1['hp1']+$us1['hp2'];
$us1['sila1']=$us1['sila1']+$us1['sila2'];
$us1['arm1']=$us1['arm1']+$us1['arm2'];
$ss1=$us1['hp1']+$us1['sila1']+$us1['arm1'];
$us2['hp1']=$us2['hp1']+$us2['hp2'];
$us2['sila1']=$us2['sila1']+$us2['sila2'];
$us2['arm1']=$us2['arm1']+$us2['arm2'];
$ss2=$us2['hp1']+$us2['sila1']+$us2['arm1'];
$lgf='<a href=info.php?id='.$us1['id'].'>'.$us1['usr'].'</a>('.$ss1.')<br>'.$us1['ip'].'</td><td align=center colspan=1><-</td><td colspan=2><a href=info.php?id='.$us1['id'].'>'.$us2['usr'].'</a>('.$ss2.')<br>'.$us2['ip'].'';
mysql_query("INSERT INTO `adm_res` SET
`id`='',
`usr`='".$bt['kod']."',
`tip`='terrs',
`text`='".$lgf."',
`time`='".time()."'
");
}
$nai=$udata['reit_nai']+1;
$ds=$udata['dost1a']+1;
mysql_query("UPDATE `users` SET `reit_nai`='".$nai."', `dost1a`='".$ds."' WHERE `id`='".$udata['id']."'");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['killer_exp']+1;
mysql_query("UPDATE `users_dost` SET `killer_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
}
else
{
$exp=$sila;
$kill=$gus['reit_b']+0;
$hp=$hp;
}
mysql_query("UPDATE `terr_usr` SET `hp`='".$hp."', `att2`='".$att2."' WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `terr_usr` SET `att`='".$att."' WHERE `id`='".$bt['id']."'");
mysql_query("UPDATE `clan_users` SET `reit_b`='".$kill."' WHERE `usr`='".$bt['usr']."'");
if($udata['lvl']<16)
{$vrs=15;}
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;
if($udata['vip_exp']>=100 and $udata['vip_exp']<250)
{$vip_lvl=1;}
elseif($udata['vip_exp']>=250 and $udata['vip_exp']<500)
{$vip_lvl=2;}
elseif($udata['vip_exp']>=500 and $udata['vip_exp']<1300)
{$vip_lvl=3;}
elseif($udata['vip_exp']>=1300 and $udata['vip_exp']<2500)
{$vip_lvl=4;}
elseif($udata['vip_exp']>=2500 and $udata['vip_exp']<5000)
{$vip_lvl=5;}
elseif($udata['vip_exp']>=5000){$vip_lvl=6;}
if($vip_lvl==1){$exp=$exp+$exp/100*5;}
if($vip_lvl==2){$exp=$exp+$exp/100*10;}
if($vip_lvl==3){$exp=$exp+$exp/100*15;}
if($vip_lvl==4){$exp=$exp+$exp/100*20;}
if($vip_lvl==5){$exp=$exp+$exp/100*30;}
if($vip_lvl==6){$exp=$exp+$exp/100*50;}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
if($m==14)
{
if($bt['status']==0 and $bt['enemy']!=0)
{
if($bt['sfer_12_time']>=time())
{$baf_12=$bt['sfer_12_ef'];}else{$baf_12=0;}//барьер
$sila=50*$skill['lvl'];
$sila=round($sila-$sila/100*$baf_12);
$tm=time()+40;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='14' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание хаоса</font>, ".$en_name." -".$sila."хп.</font>',
`terr`='".$se['id']."'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание хаоса</font> -".$sila."хп.</font>',
`terr`='".$se['id']."'
");
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
$kill=$gus['reit_b']+1;
$hp=0;
mysql_query("UPDATE `terr_usr` SET `status`='2' WHERE `id`='".$bts['id']."'");
$err=time()+1800;
mysql_query("UPDATE `users` SET `err`='".$err."' WHERE `id`='".$bts['usr']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$en_name."</font>',
`terr`='".$se['id']."'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b7.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> сокрушает вас</font>',
`terr`='".$se['id']."'
");
if($bts['tip']=='usr')
{
$us1=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bts['usr']."'"));
$us2=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bt['usr']."'"));
$us1['hp1']=$us1['hp1']+$us1['hp2'];
$us1['sila1']=$us1['sila1']+$us1['sila2'];
$us1['arm1']=$us1['arm1']+$us1['arm2'];
$ss1=$us1['hp1']+$us1['sila1']+$us1['arm1'];
$us2['hp1']=$us2['hp1']+$us2['hp2'];
$us2['sila1']=$us2['sila1']+$us2['sila2'];
$us2['arm1']=$us2['arm1']+$us2['arm2'];
$ss2=$us2['hp1']+$us2['sila1']+$us2['arm1'];
$lgf='<a href=info.php?id='.$us1['id'].'>'.$us1['usr'].'</a>('.$ss1.')<br>'.$us1['ip'].'</td><td align=center colspan=1><-</td><td colspan=2><a href=info.php?id='.$us1['id'].'>'.$us2['usr'].'</a>('.$ss2.')<br>'.$us2['ip'].'';
mysql_query("INSERT INTO `adm_res` SET
`id`='',
`usr`='".$bt['kod']."',
`tip`='terrs',
`text`='".$lgf."',
`time`='".time()."'
");
}
$nai=$udata['reit_nai']+1;
$ds=$udata['dost1a']+1;
mysql_query("UPDATE `users` SET `reit_nai`='".$nai."', `dost1a`='".$ds."' WHERE `id`='".$udata['id']."'");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['killer_exp']+1;
mysql_query("UPDATE `users_dost` SET `killer_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
}
else
{
$exp=$sila;
$kill=$gus['reit_b']+0;
$hp=$hp;
}
mysql_query("UPDATE `terr_usr` SET `hp`='".$hp."', `att2`='".$att2."' WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `terr_usr` SET `att`='".$att."' WHERE `id`='".$bt['id']."'");
mysql_query("UPDATE `clan_users` SET `reit_b`='".$kill."' WHERE `usr`='".$bt['usr']."'");
if($udata['lvl']<16)
{$vrs=15;}
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;
if($udata['vip_exp']>=100 and $udata['vip_exp']<250)
{$vip_lvl=1;}
elseif($udata['vip_exp']>=250 and $udata['vip_exp']<500)
{$vip_lvl=2;}
elseif($udata['vip_exp']>=500 and $udata['vip_exp']<1300)
{$vip_lvl=3;}
elseif($udata['vip_exp']>=1300 and $udata['vip_exp']<2500)
{$vip_lvl=4;}
elseif($udata['vip_exp']>=2500 and $udata['vip_exp']<5000)
{$vip_lvl=5;}
elseif($udata['vip_exp']>=5000){$vip_lvl=6;}
if($vip_lvl==1){$exp=$exp+$exp/100*5;}
if($vip_lvl==2){$exp=$exp+$exp/100*10;}
if($vip_lvl==3){$exp=$exp+$exp/100*15;}
if($vip_lvl==4){$exp=$exp+$exp/100*20;}
if($vip_lvl==5){$exp=$exp+$exp/100*30;}
if($vip_lvl==6){$exp=$exp+$exp/100*50;}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
if($m==7)
{
if($bt['status']==0 and $bt['enemy']!=0)
{
if($bt['sfer_12_time']>=time())
{$baf_12=$bt['sfer_12_ef'];}else{$baf_12=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;}
$sila=round($sila-$sila/100*$baf_12);
$tm=time()+50;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='7' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание молнии</font>, ".$en_name." -".$sila."хп.</font>',
`terr`='".$se['id']."'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание молнии</font>, -".$sila."хп.</font>',
`terr`='".$se['id']."'
");
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
$kill=$gus['reit_b']+1;
$hp=0;
mysql_query("UPDATE `terr_usr` SET `status`='2' WHERE `id`='".$bts['id']."'");
$err=time()+1800;
mysql_query("UPDATE `users` SET `err`='".$err."' WHERE `id`='".$bts['usr']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$en_name."</font>',
`terr`='".$se['id']."'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b7.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> сокрушает вас</font>',
`terr`='".$se['id']."'
");
if($bts['tip']=='usr')
{
$us1=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bts['usr']."'"));
$us2=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bt['usr']."'"));
$us1['hp1']=$us1['hp1']+$us1['hp2'];
$us1['sila1']=$us1['sila1']+$us1['sila2'];
$us1['arm1']=$us1['arm1']+$us1['arm2'];
$ss1=$us1['hp1']+$us1['sila1']+$us1['arm1'];
$us2['hp1']=$us2['hp1']+$us2['hp2'];
$us2['sila1']=$us2['sila1']+$us2['sila2'];
$us2['arm1']=$us2['arm1']+$us2['arm2'];
$ss2=$us2['hp1']+$us2['sila1']+$us2['arm1'];
$lgf='<a href=info.php?id='.$us1['id'].'>'.$us1['usr'].'</a>('.$ss1.')<br>'.$us1['ip'].'</td><td align=center colspan=1><-</td><td colspan=2><a href=info.php?id='.$us1['id'].'>'.$us2['usr'].'</a>('.$ss2.')<br>'.$us2['ip'].'';
mysql_query("INSERT INTO `adm_res` SET
`id`='',
`usr`='".$bt['kod']."',
`tip`='terrs',
`text`='".$lgf."',
`time`='".time()."'
");
}
$nai=$udata['reit_nai']+1;
$ds=$udata['dost1a']+1;
mysql_query("UPDATE `users` SET `reit_nai`='".$nai."', `dost1a`='".$ds."' WHERE `id`='".$udata['id']."'");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['killer_exp']+1;
mysql_query("UPDATE `users_dost` SET `killer_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
}
else
{
$exp=$sila;
$kill=$gus['reit_b']+0;
$hp=$hp;
}
mysql_query("UPDATE `terr_usr` SET `hp`='".$hp."', `att2`='".$att2."' WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `terr_usr` SET `att`='".$att."' WHERE `id`='".$bt['id']."'");
mysql_query("UPDATE `clan_users` SET `reit_b`='".$kill."' WHERE `usr`='".$bt['usr']."'");
if($udata['lvl']<16)
{$vrs=15;}
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;
if($udata['vip_exp']>=100 and $udata['vip_exp']<250)
{$vip_lvl=1;}
elseif($udata['vip_exp']>=250 and $udata['vip_exp']<500)
{$vip_lvl=2;}
elseif($udata['vip_exp']>=500 and $udata['vip_exp']<1300)
{$vip_lvl=3;}
elseif($udata['vip_exp']>=1300 and $udata['vip_exp']<2500)
{$vip_lvl=4;}
elseif($udata['vip_exp']>=2500 and $udata['vip_exp']<5000)
{$vip_lvl=5;}
elseif($udata['vip_exp']>=5000){$vip_lvl=6;}
if($vip_lvl==1){$exp=$exp+$exp/100*5;}
if($vip_lvl==2){$exp=$exp+$exp/100*10;}
if($vip_lvl==3){$exp=$exp+$exp/100*15;}
if($vip_lvl==4){$exp=$exp+$exp/100*20;}
if($vip_lvl==5){$exp=$exp+$exp/100*30;}
if($vip_lvl==6){$exp=$exp+$exp/100*50;}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
if($m==9)
{
if($bt['status']==0 and $bt['enemy']!=0)
{
if($bt['sfer_12_time']>=time())
{$baf_12=$bt['sfer_12_ef'];}else{$baf_12=0;}//барьер
$sila=40*$skill['lvl'];
$sh=$sila/2;
$sila=round($sila-$sila/100*$baf_12);
$tm=time()+30;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='9' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание вампира</font>, ".$en_name." -".$sila."хп, ваше хп + ".$sh."</font>',
`terr`='".$se['id']."'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание вампира</font>, -".$sila."хп, востановив свое хп + ".$sh."</font>',
`terr`='".$se['id']."'
");
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
$kill=$gus['reit_b']+1;
$hp=0;
mysql_query("UPDATE `terr_usr` SET `status`='2' WHERE `id`='".$bts['id']."'");
$err=time()+1800;
mysql_query("UPDATE `users` SET `err`='".$err."' WHERE `id`='".$bts['usr']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$en_name."</font>',
`terr`='".$se['id']."'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b7.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> сокрушает вас</font>',
`terr`='".$se['id']."'
");
if($bts['tip']=='usr')
{
$us1=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bts['usr']."'"));
$us2=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bt['usr']."'"));
$us1['hp1']=$us1['hp1']+$us1['hp2'];
$us1['sila1']=$us1['sila1']+$us1['sila2'];
$us1['arm1']=$us1['arm1']+$us1['arm2'];
$ss1=$us1['hp1']+$us1['sila1']+$us1['arm1'];
$us2['hp1']=$us2['hp1']+$us2['hp2'];
$us2['sila1']=$us2['sila1']+$us2['sila2'];
$us2['arm1']=$us2['arm1']+$us2['arm2'];
$ss2=$us2['hp1']+$us2['sila1']+$us2['arm1'];
$lgf='<a href=info.php?id='.$us1['id'].'>'.$us1['usr'].'</a>('.$ss1.')<br>'.$us1['ip'].'</td><td align=center colspan=1><-</td><td colspan=2><a href=info.php?id='.$us1['id'].'>'.$us2['usr'].'</a>('.$ss2.')<br>'.$us2['ip'].'';
mysql_query("INSERT INTO `adm_res` SET
`id`='',
`usr`='".$bt['kod']."',
`tip`='terrs',
`text`='".$lgf."',
`time`='".time()."'
");
}
$nai=$udata['reit_nai']+1;
$ds=$udata['dost1a']+1;
mysql_query("UPDATE `users` SET `reit_nai`='".$nai."', `dost1a`='".$ds."' WHERE `id`='".$udata['id']."'");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['killer_exp']+1;
mysql_query("UPDATE `users_dost` SET `killer_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
}
else
{
$exp=$sila;
$kill=$gus['reit_b']+0;
$hp=$hp;
}
mysql_query("UPDATE `terr_usr` SET `hp`='".$hp."', `att2`='".$att2."' WHERE `id`='".$bts['id']."'");
$hps=$bt['hp']+$sh;
if($hps>$udata['hp'])
{
$hps=$udata['hp'];
}
mysql_query("UPDATE `terr_usr` SET `att`='".$att."', `hp`='".$hps."' WHERE `id`='".$bt['id']."'");
mysql_query("UPDATE `clan_users` SET `reit_b`='".$kill."' WHERE `usr`='".$bt['usr']."'");
if($udata['lvl']<16)
{$vrs=15;}
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;
if($udata['vip_exp']>=100 and $udata['vip_exp']<250)
{$vip_lvl=1;}
elseif($udata['vip_exp']>=250 and $udata['vip_exp']<500)
{$vip_lvl=2;}
elseif($udata['vip_exp']>=500 and $udata['vip_exp']<1300)
{$vip_lvl=3;}
elseif($udata['vip_exp']>=1300 and $udata['vip_exp']<2500)
{$vip_lvl=4;}
elseif($udata['vip_exp']>=2500 and $udata['vip_exp']<5000)
{$vip_lvl=5;}
elseif($udata['vip_exp']>=5000){$vip_lvl=6;}
if($vip_lvl==1){$exp=$exp+$exp/100*5;}
if($vip_lvl==2){$exp=$exp+$exp/100*10;}
if($vip_lvl==3){$exp=$exp+$exp/100*15;}
if($vip_lvl==4){$exp=$exp+$exp/100*20;}
if($vip_lvl==5){$exp=$exp+$exp/100*30;}
if($vip_lvl==6){$exp=$exp+$exp/100*50;}
$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_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание исциления</font> ваше хп + ".$sila."</font>',
`terr`='".$se['id']."'
");
$hps=$bt['hp']+$sila;
if($hps>$udata['hp'])
{
$hps=$udata['hp'];
}
mysql_query("UPDATE `terr_usr` SET `hp`='".$hps."' WHERE `id`='".$bt['id']."'");
}
if($m==5)
{
if($bt['status']==0 and $bt['enemy']!=0)
{
if($bt['sfer_12_time']>=time())
{$baf_12=$bt['sfer_12_ef'];}else{$baf_12=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;}
$sila=round($sila-$sila/100*$baf_12);
$tm=time()+60;
$ts=time()+$t;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='5' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `terr_usr` SET `sfer_5_time`='".$ts."' WHERE `id`='".$bts['id']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание стана</font>, ".$en_name." -".$sila."хп, +".$t."сек. оглушение</font>',
`terr`='".$se['id']."'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание стана</font>, -".$sila."хп, +".$t."сек. оглушения</font>',
`terr`='".$se['id']."'
");
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
$kill=$gus['reit_b']+1;
$hp=0;
mysql_query("UPDATE `terr_usr` SET `status`='2' WHERE `id`='".$bts['id']."'");
$err=time()+1800;
mysql_query("UPDATE `users` SET `err`='".$err."' WHERE `id`='".$bts['usr']."'");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$en_name."</font>',
`terr`='".$se['id']."'
");
mysql_query("INSERT INTO `log_terr` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b7.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> сокрушает вас</font>',
`terr`='".$se['id']."'
");
if($bts['tip']=='usr')
{
$us1=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bts['usr']."'"));
$us2=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bt['usr']."'"));
$us1['hp1']=$us1['hp1']+$us1['hp2'];
$us1['sila1']=$us1['sila1']+$us1['sila2'];
$us1['arm1']=$us1['arm1']+$us1['arm2'];
$ss1=$us1['hp1']+$us1['sila1']+$us1['arm1'];
$us2['hp1']=$us2['hp1']+$us2['hp2'];
$us2['sila1']=$us2['sila1']+$us2['sila2'];
$us2['arm1']=$us2['arm1']+$us2['arm2'];
$ss2=$us2['hp1']+$us2['sila1']+$us2['arm1'];
$lgf='<a href=info.php?id='.$us1['id'].'>'.$us1['usr'].'</a>('.$ss1.')<br>'.$us1['ip'].'</td><td align=center colspan=1><-</td><td colspan=2><a href=info.php?id='.$us1['id'].'>'.$us2['usr'].'</a>('.$ss2.')<br>'.$us2['ip'].'';
mysql_query("INSERT INTO `adm_res` SET
`id`='',
`usr`='".$bt['kod']."',
`tip`='terrs',
`text`='".$lgf."',
`time`='".time()."'
");
}
$nai=$udata['reit_nai']+1;
$ds=$udata['dost1a']+1;
mysql_query("UPDATE `users` SET `reit_nai`='".$nai."', `dost1a`='".$ds."' WHERE `id`='".$udata['id']."'");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['killer_exp']+1;
mysql_query("UPDATE `users_dost` SET `killer_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
}
else
{
$exp=$sila;
$kill=$gus['reit_b']+0;
$hp=$hp;
}
mysql_query("UPDATE `terr_usr` SET `hp`='".$hp."', `att2`='".$att2."' WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `terr_usr` SET `att`='".$att."' WHERE `id`='".$bt['id']."'");
mysql_query("UPDATE `clan_users` SET `reit_b`='".$kill."' WHERE `usr`='".$bt['usr']."'");
if($udata['lvl']<16)
{$vrs=15;}
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;
if($udata['vip_exp']>=100 and $udata['vip_exp']<250)
{$vip_lvl=1;}
elseif($udata['vip_exp']>=250 and $udata['vip_exp']<500)
{$vip_lvl=2;}
elseif($udata['vip_exp']>=500 and $udata['vip_exp']<1300)
{$vip_lvl=3;}
elseif($udata['vip_exp']>=1300 and $udata['vip_exp']<2500)
{$vip_lvl=4;}
elseif($udata['vip_exp']>=2500 and $udata['vip_exp']<5000)
{$vip_lvl=5;}
elseif($udata['vip_exp']>=5000){$vip_lvl=6;}
if($vip_lvl==1){$exp=$exp+$exp/100*5;}
if($vip_lvl==2){$exp=$exp+$exp/100*10;}
if($vip_lvl==3){$exp=$exp+$exp/100*15;}
if($vip_lvl==4){$exp=$exp+$exp/100*20;}
if($vip_lvl==5){$exp=$exp+$exp/100*30;}
if($vip_lvl==6){$exp=$exp+$exp/100*50;}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
}
header('location: b_terr.php');exit;
?>