Файл: cron/oh/oh1.php
Строк: 163
<?
define('PROTECTOR', 1);
$db_host = "localhost";
$db_user = "root";
$db_table = "sidonia";
$db_pass = "";
$connect = @ mysql_pconnect($db_host, $db_user, $db_pass) or die('cannot connect to server');
@ mysql_select_db($db_table) or die('cannot connect to db');
@ mysql_query("SET NAMES 'utf8'", $connect);
$en=mysql_num_rows(mysql_query("SELECT * FROM `local_mob` WHERE `time_us`<'".time()."'"));
if($en!=0)
{
$ed=mysql_query("SELECT * FROM `local_mob` WHERE `time_us`<'".time()."'");
while($ens=mysql_fetch_array($ed))
{
if($ens['sfer_5_time']>time())
{
}
else
{
$r=rand(1,8);
if($r==1)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `labir_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' and `x`='".$ens['x']."' and `y`='".$ens['y']."' ORDER BY `id` DESC"));
}
if($r==2)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `labir_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' and `x`='".$ens['x']."' and `y`='".$ens['y']."' ORDER BY `id` ASC"));
}
if($r==3)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `labir_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' and `x`='".$ens['x']."' and `y`='".$ens['y']."' ORDER BY `hp` DESC"));
}
if($r==4)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `labir_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' and `x`='".$ens['x']."' and `y`='".$ens['y']."' ORDER BY `hp` ASC"));
}
if($r==5)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `labir_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' and `x`='".$ens['x']."' and `y`='".$ens['y']."' ORDER BY `sila` ASC"));
}
if($r==6)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `labir_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' and `x`='".$ens['x']."' and `y`='".$ens['y']."' ORDER BY `sila` DESC"));
}
if($r==7)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `labir_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' and `x`='".$ens['x']."' and `y`='".$ens['y']."' ORDER BY `arm` DESC"));
}
if($r==8)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `labir_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' and `x`='".$ens['x']."' and `y`='".$ens['y']."' 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)
{
$lg12='<img src=img/main/b23.png> Вы заблокировали атаку <font color=#ffff00><font color=#00ff99>'.$ens['name'].'</font></font>.';
mysql_query("INSERT INTO `log_labir` SET
`id`='',
`usr`='".$ssb['id']."',
`text`='".$lg12."'
");
$tim=time()+10;
mysql_query("UPDATE `local_mob` SET `time_us`='".$tim."' WHERE `id`='".$ens['id']."'");
}
elseif($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_labir` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg."'
");
$tim=time()+10;
mysql_query("UPDATE `local_mob` SET `time_us`='".$tim."' WHERE `id`='".$ens['id']."'");
}
else
{
$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())
{
$sks=$btt['sfer_6_ef'];
$dmg=round($dmg-$dmg/100*$sks);
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);
}
}
$h_us=$btt['hp']-$dmg;
if($btt['tip']!='mob')
{
$lg12='<img src=img/main/b23.png> <font color=#ff0000><font color=#00ff99>'.$ens['name'].'</font> ударил '.$en_namet.' -'.$dmg.'</font>.';
mysql_query("INSERT INTO `log_labir` 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_labir` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg12."'
");
if($btt['tip']!='pit')
{
mysql_query("UPDATE `labir_usr` SET `hp`='0', `att2`='".$dmg."', `status`='2' WHERE `id`='".$btt['id']."'");
}
else
{
mysql_query("DELETE FROM `labir_usr` WHERE `id`='".$btt['id']."'");
}
}
else
{
$att2=$dmg;
mysql_query("UPDATE `labir_usr` SET `hp`='".$h_us."', `att2`='".$att2."' WHERE `id`='".$btt['id']."'");
if($btt['sfer_10_time']>=time())
{
$mobss=mysql_query("SELECT * FROM `mag` WHERE `usr`='".$btt['usr']."' and `mag`='10' and `status`='on'");
$skills=mysql_fetch_array($mobss);
$yrs=round($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_labir` 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_labir` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg2."'
");
$nai=$ssb['reit_oh']+1;
$ds=$ssb['dost2a']+1;
mysql_query("UPDATE `users` SET `reit_oh`='".$nai."', `dost2a`='".$ds."' WHERE `id`='".$ssb['id']."'");
mysql_query("DELETE FROM `local_mob` WHERE `id`='".$ens['id']."'");
}
else
{
mysql_query("UPDATE `local_mob` SET `hp`='".$hpz."' WHERE `id`='".$ens['id']."'");
}
mysql_query("UPDATE `labir_usr` SET `att`='".$yrs."' WHERE `id`='".$btt['id']."'");
}
}
$tim=time()+10;
mysql_query("UPDATE `local_mob` SET `time_us`='".$tim."' WHERE `id`='".$ens['id']."'");
}
}
}
}
?>