Файл: cron/str/str1.php
Строк: 195
<?
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 `stt_usr` WHERE `tip`='mob' and `time_us`<'".time()."'"));
if($en!=0)
{
$ed=mysql_query("SELECT * FROM `stt_usr` WHERE `tip`='mob' and `time_us`<'".time()."'");
while($ens=mysql_fetch_array($ed))
{
if($ens['sfer_5_time']>=time())
{$baf_5=$ens['sfer_5_time']-time();}else{$baf_5=0;}//стан
if($baf_5!=0)
{
}
else
{
$r=rand(1,8);
if($r==1)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$ens['arr']."' and `b`='".$ens['b']."' and `status`='0' and `kom`!='".$ens['kom']."' ORDER BY `id` DESC"));
}
if($r==2)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$ens['arr']."' and `b`='".$ens['b']."' and `status`='0' and `kom`!='".$ens['kom']."' ORDER BY `id`"));
}
if($r==3)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$ens['arr']."' and `b`='".$ens['b']."' and `status`='0' and `kom`!='".$ens['kom']."' ORDER BY `hp` DESC"));
}
if($r==4)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$ens['arr']."' and `b`='".$ens['b']."' and `status`='0' and `kom`!='".$ens['kom']."' ORDER BY `hp`"));
}
if($r==5)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$ens['arr']."' and `b`='".$ens['b']."' and `status`='0' and `kom`!='".$ens['kom']."' ORDER BY `sila`"));
}
if($r==6)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$ens['arr']."' and `b`='".$ens['b']."' and `status`='0' and `kom`!='".$ens['kom']."' ORDER BY `sila` DESC"));
}
if($r==7)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$ens['arr']."' and `b`='".$ens['b']."' and `status`='0' and `kom`!='".$ens['kom']."' ORDER BY `arm` DESC"));
}
if($r==8)
{
$btt=mysql_fetch_array(mysql_query("SELECT * FROM `stt_usr` WHERE `arr`='".$ens['arr']."' and `b`='".$ens['b']."' and `status`='0' and `kom`!='".$ens['kom']."' ORDER BY `arm`"));
}
if($btt['tip']=='str')
{
$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>';
}
if($btt['tip']=='mob')
{
$en_namet=' <font color=#00ff99>'.$btt['name'].'</font>';
}
if($btt['sfer_4_time']>=time())
{$baf_4=$btt['sfer_4_ef'];}else{$baf_4=0;}//пробивание
if($btt['sfer_6_time']>=time())
{$baf_6=$btt['sfer_6_ef'];}else{$baf_6=0;}//оборона
if($btt['sfer_10_time']>=time())
{$baf_10=$btt['sfer_10_ef'];}else{$baf_10=0;}//пламя
if($ens['sfer_11_time']>=time())
{$baf_11=$ens['sfer_11_ef'];}else{$baf_11=0;}//ослабление
if($btt['tip']=='str')
{
$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_str` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg12."'
");
$tim=time()+10;
mysql_query("UPDATE `stt_usr` SET `time_us`='".$tim."' WHERE `id`='".$ens['id']."'");
}
}
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_str` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg."'
");
}
}
$dmg=$ens['sila'];
$dmg=round($dmg-$dmg/100*$baf_11);
$btt['arm']=round($btt['arm']-$btt['arm']/100*$baf_4);
$armr=$btt['arm'];
$dmg=$dmg-$armr;
if($baf_6!=0)
{
$dmg=round($dmg-$dmg/100*$baf_6);
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_str` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg12."'
");
}
if($h_us<=0)
{
if($btt['tip']!='mob')
{
$lg12='<img src=img/main/b23.png> <font color=#ff0000><font color=#00ff99>'.$ens['name'].'</font> сокрушил '.$en_namet.'</font>.';
mysql_query("INSERT INTO `log_str` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg12."'
");
}
if($btt['tip']=='str')
{
mysql_query("UPDATE `stt_usr` SET `hp`='0', `att2`='".$dmg."', `status`='2' WHERE `id`='".$btt['id']."'");
}
else
{
mysql_query("DELETE FROM `stt_usr` WHERE `id`='".$btt['id']."'");
}
}
else
{
mysql_query("UPDATE `stt_usr` SET `hp`='".$h_us."', `att2`='".$dmg."' WHERE `id`='".$btt['id']."'");
if($baf_10!=0)
{
$yrs=round($dmg/100*$baf_10);
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_str` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lgz."'
");
if($hpz<=0)
{
$nai=$ssb['reit_oh']+1;
$ds=$ssb['dost2a']+1;
mysql_query("UPDATE `users` SET `reit_oh`='".$nai."', `dost2a`='".$ds."' WHERE `id`='".$ssb['id']."'");
$lg2='<img src=img/main/b17.png><font color=#ffff00>'.$ssb['usr'].'</font></a> <font color=#ff0000>
сокрушает <font color=#00ff99>'.$ens['name'].'</font></font>';
mysql_query("INSERT INTO `log_str` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg2."'
");
$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/p5.png>1</font>';
mysql_query("INSERT INTO `log_str` SET
`id`='',
`usr`='".$btt['usr']."',
`text`='".$lg3."'
");
$mon=$ssb['money']+1;
$rang=1;
$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 `money`='".$mon."', `exp_rang`='".$rang."' WHERE `id`='".$ssb['id']."'");
$att2=$sila;
mysql_query("DELETE FROM `stt_usr` WHERE `id`='".$ens['id']."'");
}
else
{
mysql_query("UPDATE `stt_usr` SET `hp`='".$hpz."', `att2`='".$att2."' WHERE `id`='".$ens['id']."'");
}
mysql_query("UPDATE `stt_usr` SET `att`='".$att2."' WHERE `id`='".$btt['id']."'");
}
}
$tim=time()+10;
mysql_query("UPDATE `stt_usr` SET `time_us`='".$tim."' WHERE `id`='".$ens['id']."'");
}
}
}
?>