Файл: bnn.php
Строк: 163
<?
$time=time();
$kmobs=mysql_query("SELECT * FROM `nebes_mob` WHERE `etaz`='".$bt['etaz']."' and `tip`='mob' and `time`<'".$time."'");
$kmobn=mysql_num_rows($kmobs);
if($kmobn!=0)
{
while($km=mysql_fetch_array($kmobs))
{
$kr=rand(1,2);
if($kr==1)
{
$num=mysql_num_rows(mysql_query("SELECT * FROM `nebes_mob` WHERE `etaz`='".$km['etaz']."' and `tip`='usr' and `status`='0'"));
if($num>0)
{
if($num==1)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `nebes_mob` WHERE `etaz`='".$km['etaz']."' and `tip`='usr' and `status`='0'"));
}
elseif($num==2)
{
$r=rand(1,2);
if($r==1)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `nebes_mob` WHERE `etaz`='".$km['etaz']."' and `tip`='usr' and `status`='0' ORDER BY `id`"));
}
else
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `nebes_mob` WHERE `etaz`='".$km['etaz']."' and `tip`='usr' and `status`='0' ORDER BY `id` DESC"));
}
}
else
{
$ra=rand(1,$num);
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `nebes_mob` WHERE `etaz`='".$km['etaz']."' and `tip`='usr' and `status`='0' ORDER BY `id` LIMIT ".$ra.",1"));
}
$us=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$btt['usr']."'"));
$blok=rand(1,100);
if($us['blok']>=$blok)
{
$lg=''.$us['usr'].' заблокировал атаку '.$km['name'].'';
mysql_query("INSERT INTO `log_nebes` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg."'
");
}
else
{
$silas=$km['sila'];
if($km['sfer_r']>time())
{
$silas=round($silas-$silas/100*$km['sfer_rp']);
}
$arms=$btt['arm'];
if($btt['sfer_sh']>time())
{
$mobss=mysql_query("SELECT * FROM `mag` WHERE `usr`='".$btt['usr']."' and `mag`='6' and `status`='on'");
$skills=mysql_fetch_array($mobss);
if($skills['lvl']==1)
{
$sks=10;
}
if($skills['lvl']==2)
{
$sks=15;
}
if($skills['lvl']==3)
{
$sks=20;
}
if($skills['lvl']==4)
{
$sks=25;
}
if($skills['lvl']==5)
{
$sks=30;
}
if($skills['lvl']==6)
{
$sks=35;
}
if($skills['lvl']==7)
{
$sks=45;
}
if($skills['lvl']==8)
{
$sks=55;
}
if($skills['lvl']==9)
{
$sks=65;
}
if($skills['lvl']==10)
{
$sks=75;
}
$arms=$arms+$us['arm']/100*$sks;
}
$silas=round($silas-$arms);
if($silas<$km['sila']/100*10)
{
$silas=round($km['sila']/100*10);
}
$hps=$btt['hp']-$silas;
$lg=''.$km['name'].' <font color=#ff0000>ударил</font> '.$us['usr'].' <font color=#ff0000>-'.$silas.'</font>';
mysql_query("INSERT INTO `log_nebes` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg."'
");
if($hps<=0)
{
$hps=0;
$lg2='<font color=#ff0000>'.$km['name'].' сокрушил '.$us['usr'].'</font>';
mysql_query("INSERT INTO `log_nebes` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg2."'
");
mysql_query("UPDATE `nebes_mob` SET `hp`='".$hps."', `status`='2' WHERE `id`='".$btt['id']."'");
}
else
{
if($btt['sfer_p']>time())
{
$mobss=mysql_query("SELECT * FROM `mag` WHERE `usr`='".$us['id']."' and `mag`='10' and `status`='on'");
$skills=mysql_fetch_array($mobss);
if($skills['lvl']==1)
{
$sks=5;
}
if($skills['lvl']==2)
{
$sks=10;
}
if($skills['lvl']==3)
{
$sks=15;
}
if($skills['lvl']==4)
{
$sks=20;
}
if($skills['lvl']==5)
{
$sks=25;
}
if($skills['lvl']==6)
{
$sks=30;
}
if($skills['lvl']==7)
{
$sks=35;
}
if($skills['lvl']==8)
{
$sks=40;
}
if($skills['lvl']==9)
{
$sks=45;
}
if($skills['lvl']==10)
{
$sks=50;
}
$yrs=round($silas+$silas/100*$sks);
if($yrs<1)
{
$yrs=1;
}
$hpz=$km['hp']-$yrs;
$lgz='<img src=img/main/b10.png> <font color=#00ff00>заклинание возврата обожгла
<font color=#999999>'.$km['name'].'</font> -'.$yrs.'</font>';
mysql_query("INSERT INTO `log_nebes` SET
`id`='',
`usr`='".$usb['id']."',
`text`='".$lgz."'
");
if($hpz<=0)
{
$nai=$us['reit_oh']+1;
$ds=$us['dost2a']+1;
mysql_query("UPDATE `users` SET `reit_oh`='".$nai."', `dost2a`='".$ds."' WHERE `id`='".$us['id']."'");
$hpz=0;
$lg2='<img src=img/main/b7.png> <a href=>'.$us['usr'].'</a> убил '.$km['name'].'';
mysql_query("INSERT INTO `log_nebes` SET
`id`='',
`usr`='".$us['id']."',
`text`='".$lg2."'
");
$r=rand(1,10);
if($r==1)
{
$mif=$us['mifril']+1;
mysql_query("UPDATE `users` SET `mifril`='".$mif."' WHERE `id`='".$us['id']."'");
$lg2s='<img src=img/main/e9.png> <font color=#00ff00>Вы выбили <img src=img/main/m1.png>1</font>';
mysql_query("INSERT INTO `log_nebes` SET
`id`='',
`usr`='".$us['id']."',
`text`='".$lg2s."'
");
}
if($km['tip']=='boss')
{
$mob2=mysql_fetch_array(mysql_query("SELECT * FROM `nebes` WHERE `etaz`='".$km['etaz']."' and `tip`='boss'"));
$t=time()+5400;
mysql_query("UPDATE `nebes` SET `time`='".$t."' WHERE `id`='".$mob2['id']."'");
mysql_query("UPDATE `nebes_mob` SET `status`='1' WHERE `etaz`='".$km['etaz']."' and `status`='0'");
}
mysql_query("DELETE FROM `nebes_mob` WHERE `id`='".$km['id']."'");
mysql_query("UPDATE `nebes_mob` SET `enemy`='0' WHERE `id`='".$btt['id']."'");
}
else
{
mysql_query("UPDATE `nebes_mob` SET `hp`='".$hpz."' WHERE `id`='".$km['id']."'");
}
}
mysql_query("UPDATE `nebes_mob` SET `hp`='".$hps."' WHERE `id`='".$btt['id']."'");
}
}
}
}
$rt=rand(14,25);
$rt=time()+$rt;
mysql_query("UPDATE `nebes_mob` SET `time`='".$rt."' WHERE `id`='".$km['id']."'");
}
header('location: ?');
}
else
{
$kboss=mysql_query("SELECT * FROM `nebes_mob` WHERE `etaz`='".$bt['etaz']."' and `tip`='boss'");
$kbn=mysql_num_rows($kboss);
if($kbn!=0)
{
$km=mysql_fetch_array($kboss);
if($km['time']<time())
{
$bnb=mysql_query("SELECT * FROM `nebes_mob` WHERE `etaz`='".$km['etaz']."' and `tip`='usr' and `status`='0'");
while($btt=mysql_fetch_array($bnb))
{
$us=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$btt['usr']."'"));
$r=rand(1,2);
if($r==1)
{
$blok=rand(1,100);
if($us['blok']>=$blok)
{
$lg=''.$us['usr'].' заблокировал атаку '.$km['name'].'';
mysql_query("INSERT INTO `log_nebes` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg."'
");
}
else
{
$silas=$km['sila'];
if($km['sfer_r']>time())
{
$silas=round($silas-$silas/100*$km['sfer_rp']);
}
$arms=$btt['arm'];
if($btt['sfer_sh']>time())
{
$mobss=mysql_query("SELECT * FROM `mag` WHERE `usr`='".$btt['usr']."' and `mag`='6' and `status`='on'");
$skills=mysql_fetch_array($mobss);
if($skills['lvl']==1)
{
$sks=10;
}
if($skills['lvl']==2)
{
$sks=15;
}
if($skills['lvl']==3)
{
$sks=20;
}
if($skills['lvl']==4)
{
$sks=25;
}
if($skills['lvl']==5)
{
$sks=30;
}
if($skills['lvl']==6)
{
$sks=35;
}
if($skills['lvl']==7)
{
$sks=45;
}
if($skills['lvl']==8)
{
$sks=55;
}
if($skills['lvl']==9)
{
$sks=65;
}
if($skills['lvl']==10)
{
$sks=75;
}
$arms=$arms+$us['arms']/100*$sks;
}
$silas=round($silas-$arms);
if($silas<$km['sila']/100*10)
{
$silas=round($km['sila']/100*10);
}
$hps=$btt['hp']-$silas;
$lg=''.$km['name'].' <font color=#ff0000>ударил</font> '.$us['usr'].' <font color=#ff0000>-'.$silas.'</font>';
mysql_query("INSERT INTO `log_nebes` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg."'
");
if($hps<=0)
{
$hps=0;
$lg2='<font color=#ff0000>'.$km['name'].' сокрушил '.$us['usr'].'</font>';
mysql_query("INSERT INTO `log_nebes` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg2."'
");
mysql_query("UPDATE `nebes_mob` SET `hp`='".$hps."', `status`='2' WHERE `id`='".$btt['id']."'");
}
else
{
if($btt['sfer_p']>time())
{
$mobss=mysql_query("SELECT * FROM `mag` WHERE `usr`='".$us['id']."' and `mag`='10' and `status`='on'");
$skills=mysql_fetch_array($mobss);
if($skills['lvl']==1)
{
$sks=5;
}
if($skills['lvl']==2)
{
$sks=10;
}
if($skills['lvl']==3)
{
$sks=15;
}
if($skills['lvl']==4)
{
$sks=20;
}
if($skills['lvl']==5)
{
$sks=25;
}
if($skills['lvl']==6)
{
$sks=30;
}
if($skills['lvl']==7)
{
$sks=35;
}
if($skills['lvl']==8)
{
$sks=40;
}
if($skills['lvl']==9)
{
$sks=45;
}
if($skills['lvl']==10)
{
$sks=50;
}
$yrs=round($silas+$silas/100*$sks);
if($yrs<1)
{
$yrs=1;
}
$hpz=$km['hp']-$yrs;
$lgz='<img src=img/main/b10.png> <font color=#00ff00>заклинание возврата обожгла
<font color=#999999>'.$km['name'].'</font> -'.$yrs.'</font>';
mysql_query("INSERT INTO `log_nebes` SET
`id`='',
`usr`='".$usb['id']."',
`text`='".$lgz."'
");
if($hpz<=0)
{
$nai=$us['reit_oh']+1;
$ds=$us['dost2a']+1;
mysql_query("UPDATE `users` SET `reit_oh`='".$nai."', `dost2a`='".$ds."' WHERE `id`='".$us['id']."'");
$hpz=0;
$lg2='<img src=img/main/b7.png> <a href=>'.$us['usr'].'</a> убил '.$km['name'].'';
mysql_query("INSERT INTO `log_nebes` SET
`id`='',
`usr`='".$us['id']."',
`text`='".$lg2."'
");
$r=rand(1,10);
if($r==1)
{
$mif=$us['mifril']+1;
mysql_query("UPDATE `users` SET `mifril`='".$mif."' WHERE `id`='".$us['id']."'");
$lg2s='<img src=img/main/e9.png> <font color=#00ff00>Вы выбили <img src=img/main/m1.png>1</font>';
mysql_query("INSERT INTO `log_nebes` SET
`id`='',
`usr`='".$us['id']."',
`text`='".$lg2s."'
");
}
if($us['lvl']<16)
{
$vr=5;
}
if($us['lvl']>15 and $us['lvl']<31)
{
$vr=4;
}
if($us['lvl']>30 and $us['lvl']<39)
{
$vr=2;
}
if($us['lvl']>38)
{
$vr=1;
}
$exp=$km['hp']*$vr;
if($km['tip']=='boss')
{
$mob2=mysql_fetch_array(mysql_query("SELECT * FROM `nebes` WHERE `etaz`='".$km['etaz']."' and `tip`='boss'"));
$t=time()+5400;
mysql_query("UPDATE `nebes` SET `time`='".$t."' WHERE `id`='".$mob2['id']."'");
mysql_query("UPDATE `nebes_mob` SET `status`='1' WHERE `etaz`='".$km['etaz']."' and `status`='0'");
}
mysql_query("DELETE FROM `nebes_mob` WHERE `id`='".$km['id']."'");
mysql_query("UPDATE `nebes_mob` SET `enemy`='0' WHERE `id`='".$btt['id']."'");
}
else
{
if($us['lvl']<16)
{
$vr=5;
}
if($us['lvl']>15 and $us['lvl']<31)
{
$vr=4;
}
if($us['lvl']>30 and $us['lvl']<39)
{
$vr=2;
}
if($us['lvl']>38)
{
$vr=1;
}
$exp=$silas*$vr;
mysql_query("UPDATE `nebes_mob` SET `hp`='".$hpz."' WHERE `id`='".$km['id']."'");
}
$exp=$us['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$us['id']."'");
}
mysql_query("UPDATE `nebes_mob` SET `hp`='".$hps."' WHERE `id`='".$btt['id']."'");
}
}
}
}
$rt=rand(14,25);
$rt=time()+$rt;
mysql_query("UPDATE `nebes_mob` SET `time`='".$rt."' WHERE `id`='".$km['id']."'");
}
}
}
?>