Файл: cron/arena/ar1.php
Строк: 155
<?
define('PROTECTOR', 1);
$db_host = "localhost";
$db_user = "aweik_sida";
$db_table = "aweik_sida";
$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);
$en=mysql_num_rows(mysql_query("SELECT * FROM `arena_m_mob` WHERE `time_us`<'".time()."'"));
if($en!=0)
{
$ed=mysql_query("SELECT * FROM `arena_m_mob` WHERE `time_us`<'".time()."'");
while($ens=mysql_fetch_array($ed))
{
if($ens['sfer_so']>time())
{
}
else
{
$r=rand(1,8);
if($r==1)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `arena_m_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' ORDER BY `id` DESC"));
}
if($r==2)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `arena_m_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' ORDER BY `id` ASC"));
}
if($r==3)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `arena_m_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' ORDER BY `hp` DESC"));
}
if($r==4)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `arena_m_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' ORDER BY `hp` ASC"));
}
if($r==5)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `arena_m_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' ORDER BY `sila` ASC"));
}
if($r==6)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `arena_m_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' ORDER BY `sila` DESC"));
}
if($r==7)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `arena_m_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' ORDER BY `arm` DESC"));
}
if($r==8)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `arena_m_usr` WHERE `usr`='".$ens['usr']."' and `status`='0' 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 and $btt['tip']=='usr')
{
$lg12='<img src=img/main/b23.png> Вы заблокировали атаку <font color=#ffff00><font color=#00ff99>'.$ens['name'].'</font></font>.';
mysql_query("INSERT INTO `log_arena_m` SET
`id`='',
`usr`='".$ssb['id']."',
`text`='".$lg12."'
");
$tim=time()+10;
mysql_query("UPDATE `arena_m_mob` SET `time_us`='".$tim."' WHERE `id`='".$ens['id']."'");
}
else
{
if($btt['tip']=='pit')
{
if($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_arena_m` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg."'
");
}
$tim=time()+10;
mysql_query("UPDATE `arena_m_mob` SET `time_us`='".$tim."' WHERE `id`='".$ens['id']."'");
}
$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())
{
$dmg=round($dmg-$dmg/100*$btt['sfer_6_ef']);
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);
}
}
$m_dmg=round($ens['sila']/4);
$h_us=$btt['hp']-$dmg-$m_dmg;
$lg12='<img src=img/main/b23.png> <font color=#ff0000><font color=#00ff99>'.$ens['name'].'</font> ударил '.$en_namet.' -'.$dmg.' -<font color=#ff00ff>'.$m_dmg.'</font></font>.';
mysql_query("INSERT INTO `log_arena_m` 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_arena_m` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg12."'
");
if($btt['tip']!='pit')
{
mysql_query("UPDATE `arena_m_usr` SET `hp`='0', `att2`='".$dmg."', `status`='2' WHERE `id`='".$btt['id']."'");
}
else
{
mysql_query("DELETE FROM `arena_m_usr` WHERE `id`='".$btt['id']."'");
}
}
else
{
$att2=$dmg+$m_dmg;
mysql_query("UPDATE `arena_m_usr` SET `hp`='".$h_us."', `att2`='".$att2."' WHERE `id`='".$btt['id']."'");
if($btt['sfer_10_time']>=time())
{
$yrs=round(($dmg+$m_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_arena_m` 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_arena_m` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg2."'
");
$ds=$ssb['dost2a']+1;
mysql_query("UPDATE `users` SET `dost2a`='".$ds."' WHERE `id`='".$ssb['id']."'");
mysql_query("DELETE FROM `arena_m_mob` WHERE `id`='".$ens['id']."'");
}
else
{
mysql_query("UPDATE `arena_m_mob` SET `hp`='".$hpz."' WHERE `id`='".$ens['id']."'");
}
mysql_query("UPDATE `arena_m_usr` SET `att`='".$yrs."' WHERE `id`='".$btt['id']."'");
}
}
$tim=time()+10;
mysql_query("UPDATE `arena_m_mob` SET `time_us`='".$tim."' WHERE `id`='".$ens['id']."'");
}
}
}
}
?>