Файл: b_str_kick_str.php
Строк: 202
<?
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 `stt_usr` WHERE `usr`='".$udata['id']."' and `tip`!='pit'");
$bt=mysql_fetch_array($bat);
if($bt['status']==0)
{
$sq=mysql_query("SELECT * FROM `straz` WHERE `arr`='".$bt['arr']."' and `id`='".$bt['b']."'");
$s=mysql_fetch_array($sq);
if($s['rasa']!=$bt['kom'])
{
$max_sila=$bt['sila'];
$min_sila=round($max_sila/100*10);if($min_sila<1){$min_sila=1;}
$blok=0;
$krit=$udata['krit'];
$arm=$s['arm'];
if($bt['sfer_3_time']>=time())
{$baf_3=$bt['sfer_3_ef'];}else{$baf_3=0;}//усиление
if($bt['sfer_5_time']>=time())
{$baf_5=$bt['sfer_5_time']-time();}else{$baf_5=0;}//стан
if($bt['sfer_11_time']>=time())
{$baf_11=$bt['sfer_11_ef'];}else{$baf_11=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)
{
$lg='<img src=img/main/b1.png> <font color=#999999>Вы оглушены еще '.$baf_5['time'].'с.</font>';
mysql_query("INSERT INTO `log_str` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg."'
");
}
else
{
if($prom==1)
{
mysql_query("INSERT INTO `log_str` 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);
$sila=$sila-$arm;
if($sila<$min_sila){$sila=round($min_sila-$min_sila/100*$baf_11);}
if($sila<1){$sila=1;}
$n_s1=mysql_num_rows(mysql_query("SELECT * FROM `straz` WHERE `arr`='".$bt['arr']."' and `rasa`='".$bt['kom']."'"));
$n_s2=mysql_num_rows(mysql_query("SELECT * FROM `straz` WHERE `arr`='".$bt['arr']."' and `rasa`!='".$bt['kom']."'"));
if($n_s1<$n_s2)
{
$sila=round($sila+$sila/2);
}
$k=rand(1,100);
$sila=round($sila-$sila/100*$baf_11);
if($k<=$udata['krit'])
{
$sila=$sila*2;
$vital_moln=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `usr`='".$udata['id']."' and `tip`='vital' and `status`='on' and `img`='1'"));
if($vital_moln!=0)
{
$moln=round($sila/100*5);
$lm=' <font color=#ff00ff>-'.$moln.'</font>';
}
else
{
$moln=0;
$lm='';
}
$vital_life=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `usr`='".$udata['id']."' and `tip`='vital' and `status`='on' and `img`='2'"));
if($vital_life!=0)
{
$live=round($sila/100*5);
$ll='; <font color=#00ff44>+'.$live.'хп</font>';
$bthp=$bt['hp']+$live;
if($bt['hp']>=$udata['hp']){$bthp=$udata['hp'];}
mysql_query("UPDATE `stt_usr` SET `hp`='".$bthp."' WHERE `id`='".$bt['id']."'");
}
else
{
$live=0;
$ll='';
}
$lg='<img src=img/main/b8.png><img src=img/main/b49.png>
<a href=info.php?id='.$udata['id'].'><font color=#ffff00>'.$udata['usr'].'</font></a> <font color=#ff0000>
наносит сокрушительный удар <font color=#ff9900>Страж</font> -<b>'.$sila.'</b>'.$lm.''.$ll.'</font>';
}
else
{
$vital_moln=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `usr`='".$udata['id']."' and `tip`='vital' and `status`='on' and `img`='1'"));
if($vital_moln!=0)
{
$moln=round($sila/100*5);
$lm=' <font color=#ff00ff>-'.$moln.'</font>';
}
else
{
$moln=0;
$lm='';
}
$vital_life=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `usr`='".$udata['id']."' and `tip`='vital' and `status`='on' and `img`='2'"));
if($vital_life!=0)
{
$live=round($sila/100*5);
$ll='; <font color=#00ff44>+'.$live.'хп</font>';
$bthp=$bt['hp']+$live;
if($bthp>=$udata['hp']){$bthp=$udata['hp'];}
mysql_query("UPDATE `stt_usr` SET `hp`='".$bthp."' WHERE `id`='".$bt['id']."'");
}
else
{
$live=0;
$ll='';
}
$lg='<img src=img/main/b2.png><img src=img/main/b49.png>
<a href=info.php?id='.$udata['id'].'><font color=#ffff00>'.$udata['usr'].'</font></a> <font color=#00cc00>
пронзает <font color=#ff9900>Страж</font> -'.$sila.''.$lm.''.$ll.'</font>';
}
mysql_query("INSERT INTO `log_str` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg."'
");
$hp_str=$s['hp']-$sila-$moln;
if($hp_str<=0)
{
if($udata['kv_d']==28)
{
$kol=$udata['kv_d_n']+1;
mysql_query("INSERT INTO `log_str` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/e9.png> Статус: <font color=#ffffff>".$kol." из 1</font>'
");
mysql_query("UPDATE `users` SET `kv_d_n`='".$kol."' WHERE `id`='".$udata['id']."'");
}
$nai=$udata['reit_oh']+1;
mysql_query("UPDATE `users` SET `reit_oh`='".$nai."' WHERE `id`='".$udata['id']."'");
$dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$dk=$dost['hunter_exp']+1;
mysql_query("UPDATE `users_dost` SET `hunter_exp`='".$dk."' WHERE `id`='".$dost['id']."'");
$lg2='<img src=img/main/b17.png><img src=img/main/b49.png>
<a href=info.php?id='.$udata['id'].'><font color=#ffff00>'.$udata['usr'].'</font></a> <font color=#ff0000>
уничтожает <font color=#ff9900>Страж</font></font>';
mysql_query("INSERT INTO `log_str` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg2."'
");
$lg4='<img src=img/main/p12.png>
<a href=info.php?id='.$udata['id'].'><font color=#ffff00>'.$udata['usr'].'</font></a> <font color=#00ff00>
получает <img src=img/main/p5.png>1.</font>';
mysql_query("INSERT INTO `log_str` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg4."'
");
$mon=$udata['money']+1;
mysql_query("UPDATE `users` SET `money`='".$mon."' WHERE `id`='".$udata['id']."'");
$kill=rand(1,10);
if($kill==1)
{
$b_sila=$bt['arr']*rand(3,5);
$lg3='<img src=img/main/p12.png>
<a href=info.php?id='.$udata['id'].'><font color=#ffff00>'.$udata['usr'].'</font></a> <font color=#00ff00>
получает благословление. +<img src=img/main/b2.png>'.$b_sila.' до конца боя.</font>';
mysql_query("INSERT INTO `log_str` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg3."'
");
$us_sila=$bt['sila']+$b_sila;
mysql_query("UPDATE `stt_usr` SET `sila`='".$us_sila."' WHERE `id`='".$bt['id']."'");
}
if($kill==2)
{
$b_arm=$bt['arr']*rand(3,5);
$lg3='<img src=img/main/p12.png>
<a href=info.php?id='.$udata['id'].'><font color=#ffff00>'.$udata['usr'].'</font></a> <font color=#00ff00>
получает благословление. +<img src=img/main/b23.png>'.$b_arm.' до конца боя.</font>';
mysql_query("INSERT INTO `log_str` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg3."'
");
$us_sila=$bt['arm']+$b_arm;
mysql_query("UPDATE `stt_usr` SET `arm`='".$us_sila."' WHERE `id`='".$bt['id']."'");
}
if($kill==3)
{
$lm=$udata['lvl']-3;
$lmx=$udata['lvl']+3;
$i1=mysql_fetch_array(mysql_query("SELECT * FROM `torg_ob` WHERE `lvl`>='".$lm."' and `lvl`<='".$lm."' ORDER BY `id` ASC"));
$i2=mysql_fetch_array(mysql_query("SELECT * FROM `torg_ob` WHERE `lvl`>='".$lm."' and `lvl`<='".$lm."' ORDER BY `id` DESC"));
$item=rand($i1['id'],$i2['id']);
if($item!=0)
{
$t=mysql_fetch_array(mysql_query("SELECT * FROM `torg_ob` WHERE `id`='".$item."'"));
mysql_query("INSERT INTO `item` SET
`id`='',
`usr`='".$udata['id']."',
`name`='<font color=#998800>".$t['name']."</font>',
`cena`='".$t['cena']."',
`lvl`='".$t['lvl']."',
`img`='".$t['img']."',
`hp`='".$t['hp']."',
`arm`='".$t['arm']."',
`sila`='".$t['sila']."',
`tip`='".$t['tip']."',
`lic`='1',
`pr`='".$t['pr']."',
`status`='off'
");
$lg3='<img src=img/main/p12.png>
<a href=info.php?id='.$udata['id'].'><font color=#ffff00>'.$udata['usr'].'</font></a> <font color=#00ff00>
получает вещь: <font color=#998800>'.$t['name'].'</font>.</font>';
mysql_query("INSERT INTO `log_str` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg3."'
");
}
}
mysql_query("UPDATE `straz` SET `hp`='".$s['hp_max']."', `rasa`='".$bt['kom']."' WHERE `id`='".$s['id']."'");
$exp=$s['hp'];
}
else
{
mysql_query("UPDATE `straz` SET `hp`='".$hp_str."' WHERE `id`='".$s['id']."'");
$exp=$sila;
}
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']."'");
$ezd=mysql_query("SELECT * FROM `users_ezd` WHERE `usr`='".$udata['id']."'");
$nez=mysql_num_rows($ezd);
if($nez==0)
{
$t=time()+7;
}
else
{
$ez=mysql_fetch_array($ezd);
if($ez['lvl']<20){$t=time()+7;}
elseif($ez['lvl']>=20 and $ez['lvl']<40){$t=time()+6;}
elseif($ez['lvl']>=40){$t=time()+5;}
}
$ur=$bt['ur']+$sila;
mysql_query("UPDATE `stt_usr` SET `time_us`='".$t."', `att`='".$sila."', `ur`='".$ur."' WHERE `id`='".$bt['id']."'");
}
}
}
}
header('location: b_str.php');exit;
?>