Файл: test2.php
Строк: 96
<?
$time=time();
$m=mysql_query("SELECT * FROM `ohota_mob` WHERE `time`<='".$time."'");
$mn=mysql_num_rows($m);
if($mn!=0)
{
while($mobas=mysql_fetch_array($m))
{
$vsw=mysql_query("SELECT * FROM `ohota` WHERE `usr`='".$mobas['usr']."' and `tip`='ohot'");
$vswq=mysql_fetch_array($vsw);
if($vswq['status']==0)
{
$bn=mysql_num_rows(mysql_query("SELECT * FROM `ohota` WHERE `usr`='".$mobas['usr']."'"));
if($bn!=1)
{
$r=rand(1,2);
if($r==2)
{
$att_pit=mysql_query("SELECT * FROM `ohota` WHERE `usr`='".$mobas['usr']."' and `tip`='pit'");
$at_pit=mysql_fetch_array($att_pit);
$trrrs=mysql_query("SELECT * FROM `pit` WHERE `id`='".$at_pit['pit']."' and `usr`='".$mobas['usr']."'");
$trrr=mysql_fetch_array($trrrs);
if($at_pit['mag_ney_time']>time())
{
$lke='<img src=img/main/b1.png> <font color=#ff9900>'.$trrr['name'].'</font> уклонился от атаки '.$enz['name'].'';
mysql_query("INSERT INTO `log_ohota` SET
`id`='',
`usr`='".$mobas['id']."',
`text`='".$lke."'
");
$tt=time()+10;
mysql_query("UPDATE `ohota_mob` SET `time`='".$tt."' WHERE `id`='".$mobas['id']."'");
}
else
{
$silaw=$mobas['sila'];
if($mobas['sfer_r']>=time())
{
$silaw=$silaw-$silaw/100*$mobas['sfer_rp'];
}
if($mobas['mag_pr_time']>=time())
{
$silaw=round($silaw-$silaw/100*$mobas['mag_pr']);
}
$arm=$at_pit['arm'];
$at=round($silaw-$arm);
if($at<$mobas['sila']/100*10)
{
$at=round($mobas['sila']/100*10);
}
$hpwe=$at_pit['hp']-$at;
$lke2='<img src=img/main/b1.png> <font color=#ff0000>'.$mobas['name'].' наносит удар </font><font color=#ff9900>'.$trrr['name'].'</font> <font color=#ff0000>-'.$at.'</font>';
mysql_query("INSERT INTO `log_ohota` SET
`id`='',
`usr`='".$trrr['usr']."',
`text`='".$lke2."'
");
if($hpwe<=0)
{
$lke3='<img src=img/main/b7.png> <font color=#ff0000>'.$mobas['name'].' сокрушил </font><font color=#ff9900>'.$trrr['name'].'</font>';
mysql_query("INSERT INTO `log_ohota` SET
`id`='',
`usr`='".$trrr['usr']."',
`text`='".$lke3."'
");
mysql_query("DELETE FROM `ohota` WHERE `id`='".$at_pit['id']."'");
}
else
{
mysql_query("UPDATE `ohota` SET `hp`='".$hpwe."' WHERE `id`='".$at_pit['id']."'");
}
$tt=time()+10;
mysql_query("UPDATE `ohota_mob` SET `time`='".$tt."' WHERE `id`='".$mobas['id']."'");
}
}
else
{
$attu_pit=mysql_query("SELECT * FROM `ohota` WHERE `usr`='".$mobas['usr']."' and `tip`='ohot'");
$atu_pit=mysql_fetch_array($attu_pit);
$trrrs=mysql_query("SELECT * FROM `users` WHERE `id`='".$atu_pit['usr']."'");
$trrr=mysql_fetch_array($trrrs);
$bg=rand(1,100);
if($bg<=$trrr['blok'])
{
$lke='<img src=img/main/b1.png> <font color=#ff0000>Вы заблокировали атаку '.$mobas['name'].'</font>';
mysql_query("INSERT INTO `log_ohota` SET
`id`='',
`usr`='".$mobas['usr']."',
`text`='".$lke."'
");
$tt=time()+10;
mysql_query("UPDATE `ohota_mob` SET `time`='".$tt."' WHERE `id`='".$mobas['id']."'");
}
else
{
$silaw=$mobas['sila'];
if($mobas['sfer_r']>=time())
{
$silaw=$silaw-$silaw/100*$mobas['sfer_rp'];
}
if($mobas['mag_pr_time']>=time())
{
$silaw=round($silaw-$silaw/100*$mobas['mag_pr']);
}
$arm=$atu_pit['arm'];
if($atu_pit['sfer_sh']>=time())
{
$mobss=mysql_query("SELECT * FROM `mag` WHERE `usr`='".$atu_pit['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;
}
$arm=$arm+$trrr['arm']/100*$sks;
}
$at=round($silaw-$arm);
if($at<$mobas['sila']/100*10)
{
$at=round($mobas['sila']/100*10);
}
$hpwe=$atu_pit['hp']-$at;
$lke2='<img src=img/main/b1.png> <font color=#ff0000>'.$mobas['name'].' наносит удар </font><a href=info.php?id='.$trrr['id'].'>'.$trrr['usr'].'</a> <font color=#ff0000>-'.$at.'</font>';
mysql_query("INSERT INTO `log_ohota` SET
`id`='',
`usr`='".$mobas['usr']."',
`text`='".$lke2."'
");
if($hpwe<=0)
{
$lke3='<img src=img/main/b7.png> <font color=#ff0000>'.$mobas['name'].' сокрушил </font><a href=info.php?id='.$trrr['id'].'>'.$trrr['usr'].'</a>';
mysql_query("INSERT INTO `log_ohota` SET
`id`='',
`usr`='".$trrr['id']."',
`text`='".$lke3."'
");
mysql_query("UPDATE `ohota` SET `status`='2', `hp`='0' WHERE `id`='".$atu_pit['id']."'");
}
else
{
mysql_query("UPDATE `ohota` SET `hp`='".$hpwe."' WHERE `id`='".$atu_pit['id']."'");
}
$tt=time()+10;
mysql_query("UPDATE `ohota_mob` SET `time`='".$tt."' WHERE `id`='".$mobas['id']."'");
}
}
}
else
{
$attu_pit=mysql_query("SELECT * FROM `ohota` WHERE `usr`='".$mobas['usr']."' and `tip`='ohot'");
$atu_pit=mysql_fetch_array($attu_pit);
$trrrs=mysql_query("SELECT * FROM `users` WHERE `id`='".$atu_pit['usr']."'");
$trrr=mysql_fetch_array($trrrs);
$bg=rand(1,100);
if($bg<=$trrr['blok'])
{
$lke='<img src=img/main/b1.png> <font color=#ff0000>Вы заблокировали атаку '.$mobas['name'].'</font>';
mysql_query("INSERT INTO `log_ohota` SET
`id`='',
`usr`='".$mobas['usr']."',
`text`='".$lke."'
");
$tt=time()+10;
mysql_query("UPDATE `ohota_mob` SET `time`='".$tt."' WHERE `id`='".$mobas['id']."'");
}
else
{
$silaw=$mobas['sila'];
if($mobas['sfer_r']>=time())
{
$silaw=$silaw-$silaw/100*$mobas['sfer_rp'];
}
if($mobas['mag_pr_time']>=time())
{
$silaw=round($silaw-$silaw/100*$mobas['mag_pr']);
}
$arm=$at_pit['arm'];
if($at_pit['sfer_sh']>=time())
{
$mobss=mysql_query("SELECT * FROM `mag` WHERE `usr`='".$at_pit['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;
}
$arm=$arm+$trrr['arm']/100*$sks;
}
$at=round($silaw-$arm);
if($at<$mobas['sila']/100*10)
{
$at=round($mobas['sila']/100*10);
}
$hpwe=$at_pit['hp']-$at;
$lke2='<img src=img/main/b1.png> <font color=#ff0000>'.$mobas['name'].' наносит удар </font><font color=#ff9900>'.$trrr['usr'].'</font> <font color=#ff0000>-'.$at.'</font>';
mysql_query("INSERT INTO `log_ohota` SET
`id`='',
`usr`='".$mobas['usr']."',
`text`='".$lke2."'
");
if($hpwe<=0)
{
$lke3='<img src=img/main/b7.png> <font color=#ff0000>'.$mobas['name'].' сокрушил </font><font color=#ff9900>'.$trrr['usr'].'</font>';
mysql_query("INSERT INTO `log_ohota` SET
`id`='',
`usr`='".$mobas['usr']."',
`text`='".$lke3."'
");
mysql_query("UPDATE `ohota` SET `status`='0', `hp`='0' WHERE `id`='".$atu_pit['id']."'");
}
else
{
mysql_query("UPDATE `ohota` SET `hp`='".$hpwe."' WHERE `id`='".$atu_pit['id']."'");
}
$tt=time()+10;
mysql_query("UPDATE `ohota_mob` SET `time`='".$tt."' WHERE `id`='".$mobas['id']."'");
}
}
}
}
}
?>