Файл: cron/pdz/pdz7.php
Строк: 131
<?
define('PROTECTOR', 1);
$db_host = "localhost";
$db_user = "aweik_sidonias";
$db_table = "aweik_sidonias";
$db_pass = "08091993Lex";
$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);
sleep(30);
$en=mysql_num_rows(mysql_query("SELECT * FROM `pdz_mob` WHERE `time_us`<'".time()."'"));
if($en!=0)
{
$ed=mysql_query("SELECT * FROM `pdz_mob` WHERE `time_us`<'".time()."'");
while($ens=mysql_fetch_array($ed))
{
if($ens['sfer_5_time']>time())
{
}
else
{
$bnt=mysql_result(mysql_query("SELECT COUNT(*) FROM `pdz_usr` WHERE `arr`='".$pdz_kom['id']."' and `status`='0'"),0);
if($bnt==1)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `pdz_usr` WHERE `status`='0' and `arr`='".$pdz_kom['id']."' ORDER BY `id`"));
}
else
{
$bnt=$bnt-1;
$r=rand(0,$bnt);
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `pdz_usr` WHERE `status`='0' and `arr`='".$pdz_kom['id']."' ORDER BY `id` LIMIT ".$r.",1"));
}
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_pdz` SET
`id`='',
`usr`='".$ssb['id']."',
`text`='".$lg12."',
`pdz`='".$pdz_kom['id']."'
");
$tim=time()+10;
mysql_query("UPDATE `pdz_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_pdz` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg."',
`pdz`='".$pdz_kom['id']."'
");
$tim=time()+10;
mysql_query("UPDATE `pdz_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-$ens['st_sila'];
if($btt['tip']!='mob')
{
$lg12='<img src=img/main/b23.png> <font color=#ff0000><font color=#00ff99>'.$ens['name'].'</font> ударил '.$en_namet.' -'.$dmg.' <font color=#ff00ff>-'.$ens['st_sila'].'</font></font>.';
mysql_query("INSERT INTO `log_pdz` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg12."',
`pdz`='".$pdz_kom['id']."'
");
}
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_pdz` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg12."',
`pdz`='".$pdz_kom['id']."'
");
if($btt['tip']!='pit')
{
mysql_query("UPDATE `pdz_usr` SET `hp`='0', `att2`='".$dmg."', `status`='2' WHERE `id`='".$btt['id']."'");
}
else
{
mysql_query("DELETE FROM `pdz_usr` WHERE `tip`='pit' and `id`='".$btt['id']."'");
}
}
else
{
$att2=$dmg+$ens['st_sila'];
mysql_query("UPDATE `pdz_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+$ens['st_sila'])/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_pdz` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lgz."',
`pdz`='".$pdz_kom['id']."'
");
if($hpz<=0)
{
$lg2='<img src=img/main/b17.png>'.$en_namet.'</a> <font color=#ff0000>
сокрушает '.$bts['name'].'</font>';
mysql_query("INSERT INTO `log_pdz` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg2."',
`pdz`='".$pdz_kom['id']."'
");
$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 `pdz_mob` WHERE `id`='".$ens['id']."'");
}
else
{
mysql_query("UPDATE `pdz_mob` SET `hp`='".$hpz."' WHERE `id`='".$ens['id']."'");
}
$yrr=$btt['yr']+$dmg;
mysql_query("UPDATE `pdz_usr` SET `att`='".$yrs."', `yr`='".$yrr."' WHERE `id`='".$btt['id']."'");
}
}
$tim=time()+10;
mysql_query("UPDATE `pdz_mob` SET `time_us`='".$tim."' WHERE `id`='".$ens['id']."'");
}
}
}
}
?>