Файл: cron/avan/av1.php
Строк: 190
<?
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 `avan_mob` WHERE `time_us`<'".time()."'"));
if($en!=0)
{
$ed=mysql_query("SELECT * FROM `avan_mob` WHERE `time_us`<'".time()."'");
while($ens=mysql_fetch_array($ed))
{
if($ens['sfer_so']>time())
{
}
else
{
$bnt=mysql_result(mysql_query("SELECT COUNT(*) FROM `avan_usr` WHERE `arr`='".$ens['arr']."' and `status`='0'"),0);
if($bnt==1)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `avan_usr` WHERE `status`='0' and `arr`='".$ens['arr']."' ORDER BY `id` DESC"));
}
else
{
$r=rand(1,$bnt);
$r=$r-1;
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `avan_usr` WHERE `status`='0' and `arr`='".$ens['arr']."' ORDER BY `id` DESC 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 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_avan` SET
`id`='',
`usr`='".$ssb['id']."',
`text`='".$lg12."', `arr`='".$av['id']."'
");
$tim=time()+10;
mysql_query("UPDATE `avan_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_avan` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg."', `arr`='".$av['id']."'
");
}
}
$dmg=$ens['sila'];
if($ens['sfer_r']>=time())
{
$dmg=round($dmg-$dmg/100*$ens['sfer_rp']);
}
$armr=$btt['arm'];
$dmg=$dmg-$armr;
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;}
$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);
}
}
$m_dmg=round($ens['sila']/2);
$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_avan` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg12."', `arr`='".$av['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_avan` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg12."', `arr`='".$av['id']."'
");
if($btt['tip']!='pit')
{
mysql_query("UPDATE `avan_usr` SET `hp`='0', `att2`='".$dmg."', `status`='2' WHERE `id`='".$btt['id']."'");
}
else
{
mysql_query("DELETE FROM `avan_usr` WHERE `id`='".$btt['id']."'");
}
}
else
{
$att2=$dmg+$m_dmg;
mysql_query("UPDATE `avan_usr` SET `hp`='".$h_us."', `att2`='".$att2."' WHERE `id`='".$btt['id']."'");
if($btt['sfer_p']>=time())
{
$mobss=mysql_query("SELECT * FROM `mag` WHERE `usr`='".$btt['usr']."' 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(($dmg+$m_dmg)/100*$sks);
if($yrs<1)
{
$yrs=1;
}
if($ens['tip']==2)
{
$yrs=round($yrs/2);
}
if($ens['tip']==3)
{
$yrs=round($yrs*2);
}
if($ens['tip']==4)
{
$yrs=0;
}
$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_avan` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lgz."', `arr`='".$av['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_avan` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg2."', `arr`='".$av['id']."'
");
$nai=$ssb['reit_oh']+1;
$ds=$ssb['dost2a']+1;
if($ssb['lvl']>$ssb['rang'])
{
$rang=3;
}
else
{
$rang=0;
}
$vipss=mysql_query("SELECT * FROM `vip` WHERE `usr`='".$ssb['id']."'");
$nvips=mysql_num_rows($vipss);
if($nvips!=0)
{
$rang=$rang*2;
}
$rang=$ssb['exp_rang']+$rang;
mysql_query("UPDATE `users` SET `reit_oh`='".$nai."', `dost2a`='".$ds."', `exp_rang`='".$rang."' WHERE `id`='".$ssb['id']."'");
$ra=rand(1,3);
if($ra==1)
{
$kl=$ssb['kl']+1;
mysql_query("UPDATE `users` SET `kl`='".$kl."' WHERE `id`='".$ssb['id']."'");
$lg3='<img src=img/main/p12.png>
<a href=info.php?id='.$ssb['id'].'><font color=#ffff00>'.$ssb['usr'].'</font></a> <font color=#00ff00>
получает <img src=img/main/r16.png>1</font>';
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg3."', `arr`='".$av['id']."'
");
}
if($ra==2)
{
$kl=$ssb['kl']+1;
$fm=$ssb['fm']+1;
mysql_query("UPDATE `users` SET `kl`='".$kl."', `fm`='".$fm."' WHERE `id`='".$ssb['id']."'");
$lg3='<img src=img/main/p12.png>
<a href=info.php?id='.$udata['id'].'><font color=#ffff00>'.$ssb['usr'].'</font></a> <font color=#00ff00>
получает <img src=img/ssb/r16.png>1 <img src=img/main/r17.png>1</font>';
mysql_query("INSERT INTO `log_avan` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg3."', `arr`='".$av['id']."'
");
}
mysql_query("DELETE FROM `avan_mob` WHERE `id`='".$ens['id']."'");
}
else
{
mysql_query("UPDATE `avan_mob` SET `hp`='".$hpz."' WHERE `id`='".$ens['id']."'");
}
mysql_query("UPDATE `avan_usr` SET `att`='".$yrs."' WHERE `id`='".$btt['id']."'");
}
}
$tim=time()+10;
mysql_query("UPDATE `avan_mob` SET `time_us`='".$tim."' WHERE `id`='".$ens['id']."'");
}
}
}
}
?>