Файл: b_okr_kick.php
Строк: 292
<?
define('PROTECTOR', 1);
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
$num=mysql_num_rows(mysql_query("SELECT * FROM `okr_usrs` WHERE `usr`='".$udata['id']."'"));
if($num!=0)
{
$or=mysql_fetch_array(mysql_query("SELECT * FROM `okr_usrs` WHERE `usr`='".$udata['id']."'"));
$mobs=mysql_num_rows(mysql_query("SELECT * FROM `okr_mobs` WHERE `okr`='".$or['okr']."' and `x`='".$udata['ok_x']."' and `y`='".$udata['ok_y']."' and `id`='".$or['enemy']."'"));
if($mobs!=0)
{
$mb=mysql_fetch_array(mysql_query("SELECT * FROM `okr_mobs` WHERE `okr`='".$or['okr']."' and `x`='".$udata['ok_x']."' and `y`='".$udata['ok_y']."' and `id`='".$or['enemy']."'"));
$sila=$st['sila'];
$krit=$st['krit']*10;
$fire=$st['sila_fire'];
$water=$st['sila_water'];
$air=$st['sila_air'];
$ground=$st['sila_ground'];
if($or['sfer_3_time']>=time())
{$baf_3=$or['sfer_3_ef'];}else{$baf_3=0;}//усиление
if($mb['sfer_4_time']>=time())
{$baf_4=$mb['sfer_4_ef'];}else{$baf_4=0;}//пробивание
$sila=round($sila+$sila/100*$baf_3);
$arm=$mb['arm'];
$dfire=$mb['arm_fire'];
$dwater=$mb['arm_water'];
$dair=$mb['arm_air'];
$dground=$mb['arm_ground'];
$arm=round($arm-$arm/100*$baf_4);
$ydar=$sila-$arm;
if($ydar<$sila*0.1){$ydar=round($sila*0.1);}
$time=$or['ataka_time'];
$sfer=0;
if($time>time())
{
$sek=$time-time();
if($sek>=5){$prom=1;}
elseif($sek==4){$prom=0;$ydar=round($ydar*0.2);}
elseif($sek==3){$prom=0;$ydar=round($ydar*0.3);}
elseif($sek==2){$prom=0;$ydar=round($ydar*0.5);}
elseif($sek==1){$prom=0;$ydar=round($ydar*0.8);}
}
else
{
$prom=0;$ydar=$ydar;$sfer=1;
}
$krit_ydar=rand(1,1000);
if($krit_ydar<=$krit){$ydar=$ydar*2;$kr=1;}
$ydar_f=$fire-$dfire;
if($ydar_f<0){$ydar_f=0;}
$ydar_w=$water-$dwater;
if($ydar_w<0){$ydar_w=0;}
$ydar_a=$air-$dair;
if($ydar_a<0){$ydar_a=0;}
$ydar_g=$ground-$dground;
if($ydar_g<0){$ydar_g=0;}
if($ydar_f>0){$yf='<font color=#c70000>-'.$ydar_f.'</font>';}else{$yf='';}
if($ydar_w>0){$yw='<font color=#0084f0>-'.$ydar_w.'</font>';}else{$yw='';}
if($ydar_a>0){$ya='<font color=#999999>-'.$ydar_a.'</font>';}else{$ya='';}
if($ydar_g>0){$yg='<font color=#ab7d5c>-'.$ydar_g.'</font>';}else{$yg='';}
if($prom!=0)
{
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='<img src=img/main/b1.png> Промах'
");
}
else
{
if($sfer==1)
{
$spell=mysql_query("SELECT * FROM `mag` WHERE `usr`='".$udata['id']."' and `status`='on'");
while($sp=mysql_fetch_array($spell))
{
$tn=$sp['time']-$st['sfer_time'];
mysql_query("UPDATE `mag` SET `time`='".$tn."' WHERE `id`='".$sp['id']."'");
}
}
if($kr==1){$ky='<img src=img/main/b8.png><font color=#ff0000>(КРИТ)</font>';}
else{$ky='<img src=img/main/b17.png>';}
if($mb['rang']=='D'){$c='#999999';}
elseif($mb['rang']=='C'){$c='#00cc00';}
elseif($mb['rang']=='B'){$c='#0000cc';}
elseif($mb['rang']=='A'){$c='#cc00cc';}
elseif($mb['rang']=='S'){$c='#ff9900';}
elseif($mb['rang']=='SS'){$c='#ff2222';}
$hp=$mb['hp']-$ydar-$ydar_f-$ydar_w-$ydar_a-$ydar_g;
$pit='';
if($hp>0)
{
////////////////////
////УРОН ПИТОМЦА////
////////////////////
$tr=mysql_query("SELECT * FROM `pit` WHERE `usr`='".$udata['id']."' and `status`='1'");
$num=mysql_num_rows($tr);
if($num!=0)
{
$t=mysql_fetch_array($tr);
if($or['ataka_time_pit']<time())
{
$re=$t['sila'];
if($or['mag_yr_time']>=time())
{
$re=$re+$re/100*$or['mag_yr'];
}
if($or['mag_kr_time']>=time())
{
$re=$re*2;
}
$pit='<br><img src=img/pit/'.htmlspecialchars($t['tip']).'/'.htmlspecialchars($t['img']).'.jpg width=18px> <font color='.$c.'>'.$mb['name'].'</font> - <font color=#ff00ff>'.$re.'</font>';
$exps=$t['exp']+$re;
if($t['lvl']<=10)
{$sp=10;
}elseif($t['lvl']>=11 and $t['lvl']<=20)
{$sp=9;
}elseif($t['lvl']>20 and $t['lvl']<=30)
{$sp=8;
}elseif($t['lvl']>30 and $t['lvl']<=40)
{$sp=7;
}elseif($t['lvl']>40)
{$sp=6;
}
$tim=time()+$sp;
mysql_query("UPDATE `okr_usrs` SET `ataka_time_pit`='".$tim."' WHERE `id`='".$or['id']."'");
mysql_query("UPDATE `pit` SET `exp`='".$exps."' WHERE `id`='".$t['id']."'");
$hp=$hp-$re;
}
}
/////
/////
}
$dead='';
if($hp<=0){$hp=0;
$dead='<img src=img/main/b18.png> <font color='.$c.'>'.$mb['name'].'</font> <font color=#ff9900>повержен</font>';
$orig=mysql_fetch_array(mysql_query("SELECT * FROM `okr_mob` WHERE `id`='".$mb['orig']."'"));
$resp=time()+$orig['time'];
mysql_query("UPDATE `okr_mob` SET `resp`='".$resp."', `status`='0' WHERE `id`='".$orig['id']."'");
$gi=mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id`='".$udata['clan']."'"));
$gus=mysql_fetch_array(mysql_query("SELECT * FROM `clan_users` WHERE `clan`='".$gi['id']."' and `usr`='".$udata['id']."'"));
if($gus['kv_s']==1 and $gus['kv_s_n']<1 and $orig['name']=="Разбойник")
{
$rand=rand(1,5);
if($rand<=1)
{
$nd=$gus['kv_s_n']+1;
$dead=$dead.'<br><img src=img/main/e30.png><font color=#ffffff># Задание Гильдии: найдены ключи.</font>';
mysql_query("UPDATE `clan_users` SET `kv_s_n`='".$nd."' WHERE `id`='".$gus['id']."'");
}
}
if($gus['kv_s']==6 and $gus['kv_s_n']<10 and $orig['name']=="Упырь")
{
$rand=rand(1,5);
if($rand<=5)
{
$nd=$gus['kv_s_n']+1;
$dead=$dead.'<br><img src=img/main/e30.png><font color=#ffffff># Задание Гильдии: '.$nd.' из 10.</font>';
mysql_query("UPDATE `clan_users` SET `kv_s_n`='".$nd."' WHERE `id`='".$gus['id']."'");
}
}
if($gus['kv_s']==4 and $gus['kv_s_n']<50 and $orig['lvl']>=15 and $orig['lvl']<=30)
{
$rand=rand(1,5);
if($rand<=1)
{
$nd=$gus['kv_s_n']+1;
$dead=$dead.'<br><img src=img/main/e30.png><font color=#ffffff># Задание Гильдии: '.$nd.' из 50.</font>';
mysql_query("UPDATE `clan_users` SET `kv_s_n`='".$nd."' WHERE `id`='".$gus['id']."'");
}
}
if($mb['drop_lvl_max']>=$udata['lvl'])
{
$rand_item=rand(1,1000);
$rand_res=rand(1,1000);
$rand_key=rand(1,1000);
$drop_item=$mb['drop_item']*10;
$drop_res=$mb['drop_res']*10;
$drop_key=$mb['drop_key']*10;
if($rand_res<=$drop_res)
{
$dres=rand(1,100);
if($dres<=18)
{
$kl=rand(1,3);
$ukl=$udata['kl']+$kl;
mysql_query("UPDATE `users` SET `kl`='".$ukl."' WHERE `id`='".$udata['id']."'");
$dead=$dead.'<img src=img/main/e9.png> Получен ресурс: <img src=img/main/r16.png>'.$kl.'';
}
elseif($dres>18 and $dres<=36)
{
$fm=rand(1,3);
$ufm=$udata['fm']+$fm;
mysql_query("UPDATE `users` SET `fm`='".$ufm."' WHERE `id`='".$udata['id']."'");
$dead=$dead.'<img src=img/main/e9.png> Получен ресурс: <img src=img/main/r17.png>'.$fm.'';
}
elseif($dres>36 and $dres<=54)
{
$kd=rand(1,2);
$ukd=$udata['kl']+$kl;
mysql_query("UPDATE `users` SET `kl`='".$ukd."' WHERE `id`='".$udata['id']."'");
$dead=$dead.'<img src=img/main/e9.png> Получен ресурс: <img src=img/main/r16.png>'.$kd.'';
}
elseif($dres>54 and $dres<=72)
{
$mon=rand(1,5);
$umon=$udata['money']+$mon;
mysql_query("UPDATE `users` SET `money`='".$umon."' WHERE `id`='".$udata['id']."'");
$dead=$dead.'<img src=img/main/e9.png> Получено золото: <img src=img/main/p10.png>'.$mon.'';
}
elseif($dres>72 and $dres<=77)
{
$cat=rand(1,10000);
if($cat<=9000)
{
$umon=$udata['es_n']+1;
mysql_query("UPDATE `users` SET `es_n`='".$umon."' WHERE `id`='".$udata['id']."'");
$dead=$dead.'<img src=img/main/e9.png> Получено: <font color=#ff9900>Эссенция Начала</font> <img src=img/runes/1/1.png>1';
}
elseif($cat>9000 and $cat<=9950)
{
$umon=$udata['es_i']+1;
mysql_query("UPDATE `users` SET `es_i`='".$umon."' WHERE `id`='".$udata['id']."'");
$dead=$dead.'<img src=img/main/e9.png> Получено: <font color=#ff9900>Эссенция Истока</font> <img src=img/runes/1/2.png>1';
}
elseif($cat>9950)
{
$umon=$udata['es_h']+1;
mysql_query("UPDATE `users` SET `es_h`='".$umon."' WHERE `id`='".$udata['id']."'");
$dead=$dead.'<img src=img/main/e9.png> Получено: <font color=#ff9900>Эссенция Хаоса</font> <img src=img/runes/1/3.png>1';
}
}
elseif($dres>77 and $dres<=100)
{
if($mb['stihia']==0)
{
$mon=rand(1,5);
$umon=$udata['money']+$mon;
mysql_query("UPDATE `users` SET `money`='".$umon."' WHERE `id`='".$udata['id']."'");
$dead=$dead.'<img src=img/main/e9.png> Получено золото: <img src=img/main/p10.png>'.$mon.'';
}
elseif($mb['stihia']==1)
{
$mon=rand(1,2);
$umon=$udata['res_fire']+$mon;
mysql_query("UPDATE `users` SET `res_fire`='".$umon."' WHERE `id`='".$udata['id']."'");
$dead=$dead.'<img src=img/main/e9.png> Получен осколок огненной души: <img src=img/main/el4.png>'.$mon.'';
}
elseif($mb['stihia']==2)
{
$mon=rand(1,2);
$umon=$udata['res_water']+$mon;
mysql_query("UPDATE `users` SET `res_water`='".$umon."' WHERE `id`='".$udata['id']."'");
$dead=$dead.'<img src=img/main/e9.png> Получен осколок водяной души: <img src=img/main/el3.png>'.$mon.'';
}
elseif($mb['stihia']==3)
{
$mon=rand(1,2);
$umon=$udata['res_air']+$mon;
mysql_query("UPDATE `users` SET `res_air`='".$umon."' WHERE `id`='".$udata['id']."'");
$dead=$dead.'<img src=img/main/e9.png> Получен осколок воздушной души: <img src=img/main/el2.png>'.$mon.'';
}
elseif($mb['stihia']==4)
{
$mon=rand(1,2);
$umon=$udata['res_ground']+$mon;
mysql_query("UPDATE `users` SET `res_ground`='".$umon."' WHERE `id`='".$udata['id']."'");
$dead=$dead.'<img src=img/main/e9.png> Получен осколок земляной души: <img src=img/main/el1.png>'.$mon.'';
}
elseif($mb['stihia']==5)
{
$mon=rand(1,10);
$umon=$udata['money']+$mon;
mysql_query("UPDATE `users` SET `money`='".$umon."' WHERE `id`='".$udata['id']."'");
$dead=$dead.'<img src=img/main/e9.png> Получено золото: <img src=img/main/p10.png>'.$mon.'';
}
}
}
if($rand_key<=$drop_key)
{
$key=rand(1,100);
if($key<=80)
{
$k1=$udata['key1']+1;
mysql_query("UPDATE `users` SET `key1`='".$k1."' WHERE `id`='".$udata['id']."'");
$dead=$dead.'<img src=img/main/e9.png> Получен обычный ключ';
}
elseif($key>80 and $key<=99)
{
$k1=$udata['key2']+1;
mysql_query("UPDATE `users` SET `key2`='".$k1."' WHERE `id`='".$udata['id']."'");
$dead=$dead.'<img src=img/main/e9.png> Получен редкий ключ';
}
elseif($key>99)
{
$k1=$udata['key3']+1;
mysql_query("UPDATE `users` SET `key3`='".$k1."' WHERE `id`='".$udata['id']."'");
$dead=$dead.'<img src=img/main/e9.png> Получен легендарный ключ';
}
}
}
mysql_query("DELETE FROM `okr_mobs` WHERE `id`='".$mb['id']."'");
mysql_query("UPDATE `okr_usrs` SET `enemy`='0' WHERE `enemy`='".$mb['id']."'");
$exp=$mb['hp'];
}
else
{
mysql_query("UPDATE `okr_mobs` SET `hp`='".$hp."' WHERE `id`='".$mb['id']."'");
$exp=$ydar+$ydar_f+$ydar_w+$ydar_a+$ydar_g;
}
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='".$ky." <font color=".$c.">".$mb['name']."</font> -".$ydar." ".$yf." ".$yw." ".$ya." ".$yg."".$pit."<br>".$dead."'
");
}
$ezd=mysql_query("SELECT * FROM `users_ezd` WHERE `usr`='".$udata['id']."'");
$nez=mysql_num_rows($ezd);
if($nez==0)
{
$t=time()+7;
}
else
{
$ez=mysql_fetch_array($ezd);
if($ez['lvl']<20){$t=time()+7;}
elseif($ez['lvl']>=20 and $ez['lvl']<40){$t=time()+6;}
elseif($ez['lvl']>=40){$t=time()+5;}
}
mysql_query("UPDATE `okr_usrs` SET `ataka_time`='".$t."' WHERE `id`='".$or['id']."'");
if($udata['lvl']<16)
{$vrs=15;}
if($udata['lvl']>15 and $udata['lvl']<31)
{$vrs=4;}
if($udata['lvl']>30 and $udata['lvl']<39)
{$vrs=2;}
if($udata['lvl']>38)
{$vrs=1;}
$exp=$exp*$vrs;
if($udata['vip_exp']>=100 and $udata['vip_exp']<250)
{$vip_lvl=1;}
elseif($udata['vip_exp']>=250 and $udata['vip_exp']<500)
{$vip_lvl=2;}
elseif($udata['vip_exp']>=500 and $udata['vip_exp']<1300)
{$vip_lvl=3;}
elseif($udata['vip_exp']>=1300 and $udata['vip_exp']<2500)
{$vip_lvl=4;}
elseif($udata['vip_exp']>=2500 and $udata['vip_exp']<5000)
{$vip_lvl=5;}
elseif($udata['vip_exp']>=5000){$vip_lvl=6;}
if($vip_lvl==1){$exp=$exp+$exp/100*5;}
if($vip_lvl==2){$exp=$exp+$exp/100*10;}
if($vip_lvl==3){$exp=$exp+$exp/100*15;}
if($vip_lvl==4){$exp=$exp+$exp/100*20;}
if($vip_lvl==5){$exp=$exp+$exp/100*30;}
if($vip_lvl==6){$exp=$exp+$exp/100*50;}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
else
{
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='Противник не найден'
");
}
}
header('location: '.$_SERVER['HTTP_REFERER'].'');exit;
?>