Файл: b_okr_mag.php
Строк: 1204
<?
define('PROTECTOR', 1);
$textl='Битва';
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
$bat=mysql_query("SELECT * FROM `okr_usrs` WHERE `usr`='".$udata['id']."'");
$bt=mysql_fetch_array($bat);
$bts_mob=mysql_query("SELECT * FROM `okr_mobs` WHERE `id`='".$bt['enemy']."'");
$num=mysql_num_rows($bts_mob);
if($num!=0)
{
$bts=mysql_fetch_array($bts_mob);
if($bts['rang']=='D'){$c='#999999';}
elseif($bts['rang']=='C'){$c='#00cc00';}
elseif($bts['rang']=='B'){$c='#0000cc';}
elseif($bts['rang']=='A'){$c='#cc00cc';}
elseif($bts['rang']=='S'){$c='#ff9900';}
elseif($bts['rang']=='SS'){$c='#ff2222';}
$m=mysql_real_escape_string($_GET['mag']);
$tn=time();
$mobs=mysql_query("SELECT * FROM `mag` WHERE `usr`='".$udata['id']."' and `mag`='".$m."' and `time`<='".$tn."' and `status`='on'");
$rows=mysql_num_rows($mobs);
if($rows!=0)
{
$skill=mysql_fetch_array($mobs);
if($skill['mag']==1)
{
if($skill['lvl']==1)
{$sila=10;}
if($skill['lvl']==2)
{$sila=15;}
if($skill['lvl']==3)
{$sila=20;}
if($skill['lvl']==4)
{$sila=25;}
if($skill['lvl']==5)
{$sila=30;}
if($skill['lvl']==6)
{$sila=35;}
if($skill['lvl']==7)
{$sila=40;}
if($skill['lvl']==8)
{$sila=45;}
if($skill['lvl']==9)
{$sila=50;}
if($skill['lvl']==10)
{$sila=55;}
if($bt['mag_mast_time']>=time())
{$sila=round($sila+$sila/100*$bt['mag_mast']);}
$hp=$bts['hp']-$sila;
$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($bt['ataka_time_pit']<time())
{
$re=$t['sila'];
if($bt['mag_yr_time']>=time())
{
$re=$re+$re/100*$bt['mag_yr'];
}
if($bt['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.'>'.$bts['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`='".$bt['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.'>'.$bts['name'].'</font> <font color=#ff9900>повержен</font>';
$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']."'"));
$orig=mysql_fetch_array(mysql_query("SELECT * FROM `okr_mob` WHERE `id`='".$bts['orig']."'"));
$resp=time()+$orig['time'];
mysql_query("UPDATE `okr_mob` SET `resp`='".$resp."', `status`='0' WHERE `id`='".$orig['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']>=16 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']."'");
}
}
mysql_query("DELETE FROM `okr_mobs` WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `okr_usrs` SET `enemy`='0' WHERE `enemy`='".$bts['id']."'");
$exp=$bts['hp'];
}
else
{
mysql_query("UPDATE `okr_mobs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
$exp=$sila;
}
$lg2='<img src=img/mag/sfera_1.jpg width=18px> <font color='.$c.'>'.$bts['name'].'</font> - '.$sila.''.$pit.'<br>'.$dead.'';
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='".$lg2."'
");
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']."'");
$tm=time()+5;
mysql_query("UPDATE `mag` SET
`time`='".$tm."'
WHERE `mag`='1' and `usr`='".$udata['id']."'");
}
if($skill['mag']==2)
{
if($skill['lvl']==1)
{$sila=rand(10,100);}
if($skill['lvl']==2)
{$sila=rand(30,200);}
if($skill['lvl']==3)
{$sila=rand(50,300);}
if($skill['lvl']==4)
{$sila=rand(70,400);}
if($skill['lvl']==5)
{$sila=rand(90,500);}
if($skill['lvl']==6)
{$sila=rand(110,600);}
if($skill['lvl']==7)
{$sila=rand(130,700);}
if($skill['lvl']==8)
{$sila=rand(150,800);}
if($skill['lvl']==9)
{$sila=rand(170,900);}
if($skill['lvl']==10)
{$sila=rand(190,1000);}
if($bt['mag_mast_time']>=time())
{$sila=round($sila+$sila/100*$bt['mag_mast']);}
$hp=$bts['hp']-$sila;
$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($bt['ataka_time_pit']<time())
{
$re=$t['sila'];
if($bt['mag_yr_time']>=time())
{
$re=$re+$re/100*$bt['mag_yr'];
}
if($bt['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.'>'.$bts['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`='".$bt['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.'>'.$bts['name'].'</font> <font color=#ff9900>повержен</font>';
$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']."'"));
$orig=mysql_fetch_array(mysql_query("SELECT * FROM `okr_mob` WHERE `id`='".$bts['orig']."'"));
$resp=time()+$orig['time'];
mysql_query("UPDATE `okr_mob` SET `resp`='".$resp."', `status`='0' WHERE `id`='".$orig['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']>=16 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']."'");
}
}
mysql_query("DELETE FROM `okr_mobs` WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `okr_usrs` SET `enemy`='0' WHERE `enemy`='".$bts['id']."'");
$exp=$bts['hp'];
}
else
{
mysql_query("UPDATE `okr_mobs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
$exp=$sila;
}
$lg2='<img src=img/mag/sfera_14.jpg width=18px> <font color='.$c.'>'.$bts['name'].'</font> - '.$sila.''.$pit.'<br>'.$dead.'';
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='".$lg2."'
");
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']."'");
$tm=time()+50;
mysql_query("UPDATE `mag` SET
`time`='".$tm."'
WHERE `mag`='2' and `usr`='".$udata['id']."'");
}
if($skill['mag']==5)
{
if($skill['lvl']==1)
{$sila=15;$tst=5;}
if($skill['lvl']==2)
{$sila=30;$tst=6;}
if($skill['lvl']==3)
{$sila=45;$tst=7;}
if($skill['lvl']==4)
{$sila=60;$tst=8;}
if($skill['lvl']==5)
{$sila=75;$tst=9;}
if($skill['lvl']==6)
{$sila=90;$tst=10;}
if($skill['lvl']==7)
{$sila=105;$tst=11;}
if($skill['lvl']==8)
{$sila=120;$tst=12;}
if($skill['lvl']==9)
{$sila=135;$tst=14;}
if($skill['lvl']==10)
{$sila=150;$tst=15;}
if($bt['mag_mast_time']>=time())
{$sila=round($sila+$sila/100*$bt['mag_mast']);}
$hp=$bts['hp']-$sila;
$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($bt['ataka_time_pit']<time())
{
$re=$t['sila'];
if($bt['mag_yr_time']>=time())
{
$re=$re+$re/100*$bt['mag_yr'];
}
if($bt['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.'>'.$bts['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`='".$bt['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.'>'.$bts['name'].'</font> <font color=#ff9900>повержен</font>';
$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']."'"));
$orig=mysql_fetch_array(mysql_query("SELECT * FROM `okr_mob` WHERE `id`='".$bts['orig']."'"));
$resp=time()+$orig['time'];
mysql_query("UPDATE `okr_mob` SET `resp`='".$resp."', `status`='0' WHERE `id`='".$orig['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']>=16 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']."'");
}
}
mysql_query("DELETE FROM `okr_mobs` WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `okr_usrs` SET `enemy`='0' WHERE `enemy`='".$bts['id']."'");
$exp=$bts['hp'];
}
else
{
$ts=time()+$tst;
mysql_query("UPDATE `okr_mobs` SET `hp`='".$hp."', `sfer_5_time`='".$ts."' WHERE `id`='".$bts['id']."'");
$exp=$sila;
}
$lg2='<img src=img/mag/sfera_13.jpg width=18px> <font color=#ff2222>(СТАН: '.$tst.'c)</font> <font color='.$c.'>'.$bts['name'].'</font> - '.$sila.''.$pit.'<br>'.$dead.'';
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='".$lg2."'
");
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']."'");
$tm=time()+60;
mysql_query("UPDATE `mag` SET
`time`='".$tm."'
WHERE `mag`='5' and `usr`='".$udata['id']."'");
}
if($skill['mag']==7)
{
if($skill['lvl']==1)
{
$sila=70;
}
if($skill['lvl']==2)
{
$sila=140;
}
if($skill['lvl']==3)
{
$sila=210;
}
if($skill['lvl']==4)
{
$sila=280;
}
if($skill['lvl']==5)
{
$sila=350;
}
if($skill['lvl']==6)
{
$sila=420;
}
if($skill['lvl']==7)
{
$sila=500;
}
if($skill['lvl']==8)
{
$sila=600;
}
if($skill['lvl']==9)
{
$sila=700;
}
if($skill['lvl']==10)
{
$sila=800;
}
if($bt['mag_mast_time']>=time())
{$sila=round($sila+$sila/100*$bt['mag_mast']);}
$hp=$bts['hp']-$sila;
$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($bt['ataka_time_pit']<time())
{
$re=$t['sila'];
if($bt['mag_yr_time']>=time())
{
$re=$re+$re/100*$bt['mag_yr'];
}
if($bt['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.'>'.$bts['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`='".$bt['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.'>'.$bts['name'].'</font> <font color=#ff9900>повержен</font>';
$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']."'"));
$orig=mysql_fetch_array(mysql_query("SELECT * FROM `okr_mob` WHERE `id`='".$bts['orig']."'"));
$resp=time()+$orig['time'];
mysql_query("UPDATE `okr_mob` SET `resp`='".$resp."', `status`='0' WHERE `id`='".$orig['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']>=16 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']."'");
}
}
mysql_query("DELETE FROM `okr_mobs` WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `okr_usrs` SET `enemy`='0' WHERE `enemy`='".$bts['id']."'");
$exp=$bts['hp'];
}
else
{
mysql_query("UPDATE `okr_mobs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
$exp=$sila;
}
$lg2='<img src=img/mag/sfera_5.jpg width=18px> <font color='.$c.'>'.$bts['name'].'</font> - '.$sila.''.$pit.'<br>'.$dead.'';
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='".$lg2."'
");
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']."'");
$tm=time()+50;
mysql_query("UPDATE `mag` SET
`time`='".$tm."'
WHERE `mag`='7' and `usr`='".$udata['id']."'");
}
if($skill['mag']==9)
{
if($skill['lvl']==1)
{
$sila=40;
}
if($skill['lvl']==2)
{
$sila=80;
}
if($skill['lvl']==3)
{
$sila=120;
}
if($skill['lvl']==4)
{
$sila=160;
}
if($skill['lvl']==5)
{
$sila=200;
}
if($skill['lvl']==6)
{
$sila=240;
}
if($skill['lvl']==7)
{
$sila=280;
}
if($skill['lvl']==8)
{
$sila=320;
}
if($skill['lvl']==9)
{
$sila=360;
}
if($skill['lvl']==10)
{
$sila=400;
}
$sh=$sila/2;
if($bt['mag_mast_time']>=time())
{$sila=round($sila+$sila/100*$bt['mag_mast']);}
$hp=$bts['hp']-$sila;
$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($bt['ataka_time_pit']<time())
{
$re=$t['sila'];
if($bt['mag_yr_time']>=time())
{
$re=$re+$re/100*$bt['mag_yr'];
}
if($bt['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.'>'.$bts['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`='".$bt['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.'>'.$bts['name'].'</font> <font color=#ff9900>повержен</font>';
$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']."'"));
$orig=mysql_fetch_array(mysql_query("SELECT * FROM `okr_mob` WHERE `id`='".$bts['orig']."'"));
$resp=time()+$orig['time'];
mysql_query("UPDATE `okr_mob` SET `resp`='".$resp."', `status`='0' WHERE `id`='".$orig['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']>=16 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']."'");
}
}
mysql_query("DELETE FROM `okr_mobs` WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `okr_usrs` SET `enemy`='0' WHERE `enemy`='".$bts['id']."'");
$exp=$bts['hp'];
}
else
{
mysql_query("UPDATE `okr_mobs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
$exp=$sila;
}
$lg2='<img src=img/mag/sfera_11.jpg width=18px> <font color='.$c.'>'.$bts['name'].'</font> - '.$sila.'<br>
<img src=img/mag/sfera_11.jpg width=18px> <font color=#00ffff>Ваше здоровье +'.$sn.'</font>
'.$pit.'<br>'.$dead.'';
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='".$lg2."'
");
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']."'");
$hps=$st['hp']+$sh;
if($hps>$st['hp_max'])
{
$hps=$st['hp_max'];
}
mysql_query("UPDATE `users_stats` SET `hp`='".$hps."' WHERE `usr`='".$udata['id']."'");
$tm=time()+30;
mysql_query("UPDATE `mag` SET
`time`='".$tm."'
WHERE `mag`='9' and `usr`='".$udata['id']."'");
}
if($skill['mag']==13)
{
if($skill['lvl']==1)
{
$sila=3;
}
if($skill['lvl']==2)
{
$sila=6;
}
if($skill['lvl']==3)
{
$sila=9;
}
if($skill['lvl']==4)
{
$sila=12;
}
if($skill['lvl']==5)
{
$sila=15;
}
if($skill['lvl']==6)
{
$sila=18;
}
if($skill['lvl']==7)
{
$sila=21;
}
if($skill['lvl']==8)
{
$sila=24;
}
if($skill['lvl']==9)
{
$sila=27;
}
if($skill['lvl']==10)
{
$sila=30;
}
$sila=round($bts['hp']/100*$sila);
if($bt['mag_mast_time']>=time())
{$sila=round($sila+$sila/100*$bt['mag_mast']);}
$hp=$bts['hp']-$sila;
$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($bt['ataka_time_pit']<time())
{
$re=$t['sila'];
if($bt['mag_yr_time']>=time())
{
$re=$re+$re/100*$bt['mag_yr'];
}
if($bt['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.'>'.$bts['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`='".$bt['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.'>'.$bts['name'].'</font> <font color=#ff9900>повержен</font>';
$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']."'"));
$orig=mysql_fetch_array(mysql_query("SELECT * FROM `okr_mob` WHERE `id`='".$bts['orig']."'"));
$resp=time()+$orig['time'];
mysql_query("UPDATE `okr_mob` SET `resp`='".$resp."', `status`='0' WHERE `id`='".$orig['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']>=16 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']."'");
}
}
mysql_query("DELETE FROM `okr_mobs` WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `okr_usrs` SET `enemy`='0' WHERE `enemy`='".$bts['id']."'");
$exp=$bts['hp'];
}
else
{
mysql_query("UPDATE `okr_mobs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
$exp=$sila;
}
$lg2='<img src=img/mag/sfera_8.jpg width=18px> <font color='.$c.'>'.$bts['name'].'</font> - '.$sila.''.$pit.'<br>'.$dead.'';
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='".$lg2."'
");
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']."'");
$tm=time()+60;
mysql_query("UPDATE `mag` SET
`time`='".$tm."'
WHERE `mag`='13' and `usr`='".$udata['id']."'");
}
if($skill['mag']==14)
{
if($skill['lvl']==1)
{
$sila=50;
}
if($skill['lvl']==2)
{
$sila=100;
}
if($skill['lvl']==3)
{
$sila=150;
}
if($skill['lvl']==4)
{
$sila=200;
}
if($skill['lvl']==5)
{
$sila=250;
}
if($skill['lvl']==6)
{
$sila=300;
}
if($skill['lvl']==7)
{
$sila=350;
}
if($skill['lvl']==8)
{
$sila=400;
}
if($skill['lvl']==9)
{
$sila=450;
}
if($skill['lvl']==10)
{
$sila=500;
}
if($bt['mag_mast_time']>=time())
{$sila=round($sila+$sila/100*$bt['mag_mast']);}
$hp=$bts['hp']-$sila;
$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($bt['ataka_time_pit']<time())
{
$re=$t['sila'];
if($bt['mag_yr_time']>=time())
{
$re=$re+$re/100*$bt['mag_yr'];
}
if($bt['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.'>'.$bts['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`='".$bt['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.'>'.$bts['name'].'</font> <font color=#ff9900>повержен</font>';
$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']."'"));
$orig=mysql_fetch_array(mysql_query("SELECT * FROM `okr_mob` WHERE `id`='".$bts['orig']."'"));
$resp=time()+$orig['time'];
mysql_query("UPDATE `okr_mob` SET `resp`='".$resp."', `status`='0' WHERE `id`='".$orig['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']>=16 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']."'");
}
}
mysql_query("DELETE FROM `okr_mobs` WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `okr_usrs` SET `enemy`='0' WHERE `enemy`='".$bts['id']."'");
$exp=$bts['hp'];
}
else
{
mysql_query("UPDATE `okr_mobs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
$exp=$sila;
}
$lg2='<img src=img/mag/sfera_6.jpg width=18px> <font color='.$c.'>'.$bts['name'].'</font> - '.$sila.''.$pit.'<br>'.$dead.'';
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='".$lg2."'
");
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']."'");
$tm=time()+40;
mysql_query("UPDATE `mag` SET
`time`='".$tm."'
WHERE `mag`='14' and `usr`='".$udata['id']."'");
}
if($skill['mag']==3)
{
if($skill['lvl']==1)
{
$sila=3;
}
if($skill['lvl']==2)
{
$sila=6;
}
if($skill['lvl']==3)
{
$sila=9;
}
if($skill['lvl']==4)
{
$sila=12;
}
if($skill['lvl']==5)
{
$sila=15;
}
if($skill['lvl']==6)
{
$sila=18;
}
if($skill['lvl']==7)
{
$sila=21;
}
if($skill['lvl']==8)
{
$sila=24;
}
if($skill['lvl']==9)
{
$sila=27;
}
if($skill['lvl']==10)
{
$sila=30;
}
$hp=$bts['hp'];
$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($bt['ataka_time_pit']<time())
{
$re=$t['sila'];
if($bt['mag_yr_time']>=time())
{
$re=$re+$re/100*$bt['mag_yr'];
}
if($bt['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.'>'.$bts['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`='".$bt['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.'>'.$bts['name'].'</font> <font color=#ff9900>повержен</font>';
$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']."'"));
$orig=mysql_fetch_array(mysql_query("SELECT * FROM `okr_mob` WHERE `id`='".$bts['orig']."'"));
$resp=time()+$orig['time'];
mysql_query("UPDATE `okr_mob` SET `resp`='".$resp."', `status`='0' WHERE `id`='".$orig['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']>=16 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']."'");
}
}
mysql_query("DELETE FROM `okr_mobs` WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `okr_usrs` SET `enemy`='0' WHERE `enemy`='".$bts['id']."'");
}
else
{
mysql_query("UPDATE `okr_mobs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
$lg2='<img src=img/mag/sfera_3.jpg width=18px> Усиление урона: +'.$sila.'%'.$pit.'<br>'.$dead.'';
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='".$lg2."'
");
$tm=time()+90;
$ts=time()+60;
mysql_query("UPDATE `mag` SET
`time`='".$tm."'
WHERE `mag`='3' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `okr_usrs` SET `sfer_3_time`='".$ts."', `sfer_3_ef`='".$sila."' WHERE `id`='".$bt['id']."'");
}
if($skill['mag']==4)
{
if($skill['lvl']==1)
{
$sila=10;
}
if($skill['lvl']==2)
{
$sila=15;
}
if($skill['lvl']==3)
{
$sila=20;
}
if($skill['lvl']==4)
{
$sila=25;
}
if($skill['lvl']==5)
{
$sila=30;
}
if($skill['lvl']==6)
{
$sila=35;
}
if($skill['lvl']==7)
{
$sila=45;
}
if($skill['lvl']==8)
{
$sila=55;
}
if($skill['lvl']==9)
{
$sila=65;
}
if($skill['lvl']==10)
{
$sila=75;
}
$hp=$bts['hp'];
$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($bt['ataka_time_pit']<time())
{
$re=$t['sila'];
if($bt['mag_yr_time']>=time())
{
$re=$re+$re/100*$bt['mag_yr'];
}
if($bt['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.'>'.$bts['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`='".$bt['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.'>'.$bts['name'].'</font> <font color=#ff9900>повержен</font>';
$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']."'"));
$orig=mysql_fetch_array(mysql_query("SELECT * FROM `okr_mob` WHERE `id`='".$bts['orig']."'"));
$resp=time()+$orig['time'];
mysql_query("UPDATE `okr_mob` SET `resp`='".$resp."', `status`='0' WHERE `id`='".$orig['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']>=16 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']."'");
}
}
mysql_query("DELETE FROM `okr_mobs` WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `okr_usrs` SET `enemy`='0' WHERE `enemy`='".$bts['id']."'");
}
else
{
mysql_query("UPDATE `okr_mobs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
$lg2='<img src=img/mag/sfera_9.jpg width=18px> Защита <font color='.$c.'>'.$bts['name'].'</font> -'.$sila.'%'.$pit.'<br>'.$dead.'';
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='".$lg2."'
");
$tm=time()+60;
$ts=time()+40;
mysql_query("UPDATE `mag` SET
`time`='".$tm."'
WHERE `mag`='4' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `okr_mobs` SET `sfer_4_time`='".$ts."', `sfer_4_ef`='".$sila."' WHERE `id`='".$bts['id']."'");
}
if($skill['mag']==6)
{
if($skill['lvl']==1)
{
$sila=10;
}
if($skill['lvl']==2)
{
$sila=15;
}
if($skill['lvl']==3)
{
$sila=20;
}
if($skill['lvl']==4)
{
$sila=25;
}
if($skill['lvl']==5)
{
$sila=30;
}
if($skill['lvl']==6)
{
$sila=35;
}
if($skill['lvl']==7)
{
$sila=45;
}
if($skill['lvl']==8)
{
$sila=55;
}
if($skill['lvl']==9)
{
$sila=65;
}
if($skill['lvl']==10)
{
$sila=75;
}
$hp=$bts['hp'];
$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($bt['ataka_time_pit']<time())
{
$re=$t['sila'];
if($bt['mag_yr_time']>=time())
{
$re=$re+$re/100*$bt['mag_yr'];
}
if($bt['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.'>'.$bts['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`='".$bt['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.'>'.$bts['name'].'</font> <font color=#ff9900>повержен</font>';
$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']."'"));
$orig=mysql_fetch_array(mysql_query("SELECT * FROM `okr_mob` WHERE `id`='".$bts['orig']."'"));
$resp=time()+$orig['time'];
mysql_query("UPDATE `okr_mob` SET `resp`='".$resp."', `status`='0' WHERE `id`='".$orig['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']>=16 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']."'");
}
}
mysql_query("DELETE FROM `okr_mobs` WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `okr_usrs` SET `enemy`='0' WHERE `enemy`='".$bts['id']."'");
}
else
{
mysql_query("UPDATE `okr_mobs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
$lg2='<img src=img/mag/sfera_2.jpg width=18px> Защита от урона +'.$sila.'%'.$pit.'<br>'.$dead.'';
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='".$lg2."'
");
$tm=time()+90;
$ts=time()+30;
mysql_query("UPDATE `mag` SET
`time`='".$tm."'
WHERE `mag`='6' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `okr_usrs` SET `sfer_6_time`='".$ts."', `sfer_6_ef`='".$sila."' WHERE `id`='".$bt['id']."'");
}
if($skill['mag']==8)
{
if($skill['lvl']==1)
{
$silaq=80;
}
if($skill['lvl']==2)
{
$silaq=160;
}
if($skill['lvl']==3)
{
$silaq=240;
}
if($skill['lvl']==4)
{
$silaq=320;
}
if($skill['lvl']==5)
{
$silaq=400;
}
if($skill['lvl']==6)
{
$silaq=480;
}
if($skill['lvl']==7)
{
$silaq=560;
}
if($skill['lvl']==8)
{
$silaq=640;
}
if($skill['lvl']==9)
{
$silaq=720;
}
if($skill['lvl']==10)
{
$silaq=800;
}
$hp=$bts['hp'];
$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($bt['ataka_time_pit']<time())
{
$re=$t['sila'];
if($bt['mag_yr_time']>=time())
{
$re=$re+$re/100*$bt['mag_yr'];
}
if($bt['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.'>'.$bts['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`='".$bt['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.'>'.$bts['name'].'</font> <font color=#ff9900>повержен</font>';
$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']."'"));
$orig=mysql_fetch_array(mysql_query("SELECT * FROM `okr_mob` WHERE `id`='".$bts['orig']."'"));
$resp=time()+$orig['time'];
mysql_query("UPDATE `okr_mob` SET `resp`='".$resp."', `status`='0' WHERE `id`='".$orig['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']>=16 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']."'");
}
}
mysql_query("DELETE FROM `okr_mobs` WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `okr_usrs` SET `enemy`='0' WHERE `enemy`='".$bts['id']."'");
}
else
{
mysql_query("UPDATE `okr_mobs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
$lg2='<img src=img/mag/sfera_4.jpg width=18px> <font color=#00ffff>Ваше здоровье +'.$silaq.'</font>'.$pit.'<br>'.$dead.'';
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='".$lg2."'
");
$hp=$st['hp']+$silaq;
if($hp>$st['hp_max'])
{
$hp=$st['hp_max'];
}
$tm=time()+40;
mysql_query("UPDATE `mag` SET
`time`='".$tm."'
WHERE `mag`='8' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `users_stats` SET `hp`='".$hp."' WHERE `usr`='".$udata['id']."'");
}
if($skill['mag']==10)
{
if($skill['lvl']==1)
{
$sila=5;
}
if($skill['lvl']==2)
{
$sila=10;
}
if($skill['lvl']==3)
{
$sila=15;
}
if($skill['lvl']==4)
{
$sila=20;
}
if($skill['lvl']==5)
{
$sila=25;
}
if($skill['lvl']==6)
{
$sila=30;
}
if($skill['lvl']==7)
{
$sila=35;
}
if($skill['lvl']==8)
{
$sila=40;
}
if($skill['lvl']==9)
{
$sila=45;
}
if($skill['lvl']==10)
{
$sila=50;
}
$hp=$bts['hp'];
$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($bt['ataka_time_pit']<time())
{
$re=$t['sila'];
if($bt['mag_yr_time']>=time())
{
$re=$re+$re/100*$bt['mag_yr'];
}
if($bt['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.'>'.$bts['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`='".$bt['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.'>'.$bts['name'].'</font> <font color=#ff9900>повержен</font>';
$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']."'"));
$orig=mysql_fetch_array(mysql_query("SELECT * FROM `okr_mob` WHERE `id`='".$bts['orig']."'"));
$resp=time()+$orig['time'];
mysql_query("UPDATE `okr_mob` SET `resp`='".$resp."', `status`='0' WHERE `id`='".$orig['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']>=16 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']."'");
}
}
mysql_query("DELETE FROM `okr_mobs` WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `okr_usrs` SET `enemy`='0' WHERE `enemy`='".$bts['id']."'");
}
else
{
mysql_query("UPDATE `okr_mobs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
$lg2='<img src=img/mag/sfera_10.jpg width=18px> Отражение урона -'.$sila.'%'.$pit.'<br>'.$dead.'';
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='".$lg2."'
");
$tm=time()+60;
$ts=time()+30;
mysql_query("UPDATE `mag` SET
`time`='".$tm."'
WHERE `mag`='10' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `okr_usrs` SET `sfer_10_time`='".$ts."', `sfer_10_ef`='".$sila."' WHERE `id`='".$bt['id']."'");
}
if($skill['mag']==12)
{
if($skill['lvl']==1)
{
$sila=7;
}
if($skill['lvl']==2)
{
$sila=15;
}
if($skill['lvl']==3)
{
$sila=22;
}
if($skill['lvl']==4)
{
$sila=30;
}
if($skill['lvl']==5)
{
$sila=37;
}
if($skill['lvl']==6)
{
$sila=45;
}
if($skill['lvl']==7)
{
$sila=52;
}
if($skill['lvl']==8)
{
$sila=60;
}
if($skill['lvl']==9)
{
$sila=67;
}
if($skill['lvl']==10)
{
$sila=75;
}
$hp=$bts['hp'];
$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($bt['ataka_time_pit']<time())
{
$re=$t['sila'];
if($bt['mag_yr_time']>=time())
{
$re=$re+$re/100*$bt['mag_yr'];
}
if($bt['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.'>'.$bts['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`='".$bt['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.'>'.$bts['name'].'</font> <font color=#ff9900>повержен</font>';
$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']."'"));
$orig=mysql_fetch_array(mysql_query("SELECT * FROM `okr_mob` WHERE `id`='".$bts['orig']."'"));
$resp=time()+$orig['time'];
mysql_query("UPDATE `okr_mob` SET `resp`='".$resp."', `status`='0' WHERE `id`='".$orig['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']>=16 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']."'");
}
}
mysql_query("DELETE FROM `okr_mobs` WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `okr_usrs` SET `enemy`='0' WHERE `enemy`='".$bts['id']."'");
}
else
{
mysql_query("UPDATE `okr_mobs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
$lg2='<img src=img/mag/sfera_7.jpg width=18px> Защита от магии -'.$sila.'%'.$pit.'<br>'.$dead.'';
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='".$lg2."'
");
$tm=time()+60;
$ts=time()+20;
mysql_query("UPDATE `mag` SET
`time`='".$tm."'
WHERE `mag`='12' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `okr_usrs` SET `sfer_12_time`='".$ts."', `sfer_12_ef`='".$sila."' WHERE `id`='".$bt['id']."'");
}
if($skill['mag']==11)
{
if($skill['lvl']==1)
{
$sila=5;
}
if($skill['lvl']==2)
{
$sila=10;
}
if($skill['lvl']==3)
{
$sila=15;
}
if($skill['lvl']==4)
{
$sila=20;
}
if($skill['lvl']==5)
{
$sila=25;
}
if($skill['lvl']==6)
{
$sila=30;
}
if($skill['lvl']==7)
{
$sila=35;
}
if($skill['lvl']==8)
{
$sila=40;
}
if($skill['lvl']==9)
{
$sila=45;
}
if($skill['lvl']==10)
{
$sila=50;
}
$hp=$bts['hp'];
$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($bt['ataka_time_pit']<time())
{
$re=$t['sila'];
if($bt['mag_yr_time']>=time())
{
$re=$re+$re/100*$bt['mag_yr'];
}
if($bt['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.'>'.$bts['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`='".$bt['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.'>'.$bts['name'].'</font> <font color=#ff9900>повержен</font>';
$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']."'"));
$orig=mysql_fetch_array(mysql_query("SELECT * FROM `okr_mob` WHERE `id`='".$bts['orig']."'"));
$resp=time()+$orig['time'];
mysql_query("UPDATE `okr_mob` SET `resp`='".$resp."', `status`='0' WHERE `id`='".$orig['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']>=16 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']."'");
}
}
mysql_query("DELETE FROM `okr_mobs` WHERE `id`='".$bts['id']."'");
mysql_query("UPDATE `okr_usrs` SET `enemy`='0' WHERE `enemy`='".$bts['id']."'");
}
else
{
mysql_query("UPDATE `okr_mobs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
$lg2='<img src=img/mag/sfera_12.jpg width=18px> Атака <font color='.$c.'>'.$bts['name'].'</font> -'.$sila.'%'.$pit.'<br>'.$dead.'';
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='".$lg2."'
");
$tm=time()+30;
$ts=time()+20;
mysql_query("UPDATE `mag` SET
`time`='".$tm."'
WHERE `mag`='11' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `okr_mobs` SET `sfer_11_time`='".$ts."', `sfer_11_ef`='".$sila."' WHERE `id`='".$bts['id']."'");
}
}
}
header('location: '.$_SERVER['HTTP_REFERER'].'');exit;
?>