Файл: bs_battle.php
Строк: 1735
<?
define('PROTECTOR', 1);
$textl='Битва';
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
$lv=time();
$last=date('d.m.Y - H:i:s');
mysql_query("UPDATE `users` SET
`lv`='".$lv."',
`last`='".$last."',
`mesto`='".$textl."'
WHERE `id`='".$udata['id']."'");
$bat=mysql_query("SELECT * FROM `clan_battle_b_usr` WHERE `usr`='".$udata['id']."' and `tip`!='pit'");
$num=mysql_num_rows($bat);
if($num==0)
{
header('location: game.php');exit;
}
else
{
$bt=mysql_fetch_array($bat);
$bz=mysql_fetch_array(mysql_query("SELECT * FROM `clan_battle_b` WHERE `clan`='".$bt['kom']."' and `time`<'".time()."'"));
$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']."'"));
$arena=mysql_num_rows(mysql_query("SELECT * FROM `clan_battle_b` WHERE `clan`='".$bt['kom']."' and `time`<'".time()."'"));
if($arena==0)
{
header('location: bs_b.php');exit;
}
$lvl=$udata['lvl']+1;
$exzn=mysql_num_rows(mysql_query("SELECT * FROM `lvl` WHERE `lvl`='".$lvl."'"));
if($exzn!=0)
{
$ex=mysql_fetch_array(mysql_query("SELECT * FROM `lvl` WHERE `lvl`='".$lvl."'"));
if($udata['exp']>=$ex['exp'])
{
$kl=$udata['lvl']+1;
if($udata['klass']==1)
{
$hp=$udata['hp1']+2;
$sila=$udata['sila1']+3;
$arm=$udata['arm1']+1;
}
if($udata['klass']==2)
{
$hp=$udata['hp1']+3;
$sila=$udata['sila1']+1;
$arm=$udata['arm1']+2;
}
if($udata['klass']==3)
{
$hp=$udata['hp1']+1;
$sila=$udata['sila1']+2;
$arm=$udata['arm1']+3;
}
mysql_query("UPDATE `users` SET `lvl`='".$kl."', `hp1`='".$hp."', `sila1`='".$sila."', `arm1`='".$arm."' WHERE `id`='".$udata['id']."'");
if($udata['ref']!=0)
{
$refer=mysql_query("SELECT * FROM `users` WHERE `id`='".$udata['ref']."'");
$ref=mysql_fetch_array($refer);
if($kl==30)
{
$ref_m=$ref['money']+100;
mysql_query("UPDATE `users` SET `money`='".$ref_m."' WHERE `id`='".$ref['id']."'");
$rows211=mysql_num_rows(mysql_query("SELECT * FROM `msg_kont` WHERE `usr1`='".$ref['id']."' and `usr2`='0'"));
if($rows211==0)
{
mysql_query("INSERT INTO `msg_kont` SET
`id`='',
`usr1`='".$ref['id']."',
`usr2`='0',
`read`='1',
`time`='".time()."'
");
}else
{
$rows21=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$ref['id']."'"));
mysql_query("UPDATE `msg_kont` SET `read`='1', `time`='".time()."' WHERE `usr2`='0' and `usr1`='".$ref['id']."'");
}
$rows21=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$ref['id']."'"));
$text='<font color=#cccccc>Ваш реферал '.$udata['usr'].' прокачался до 30 уровня. За это вы получаете <img src=img/main/p5.png>100.</font>
';
mysql_query("INSERT INTO `msg_dialog` SET
`id`='',
`dialog`='".$rows21['id']."',
`vhod`='1',
`time`='".time()."',
`text`='".$text."',
`usr`='".$ref['id']."'
");
}
if($kl==40)
{
$ref_m=$ref['jem']+5;
mysql_query("UPDATE `users` SET `jem`='".$ref_m."' WHERE `id`='".$ref['id']."'");
$rows211=mysql_num_rows(mysql_query("SELECT * FROM `msg_kont` WHERE `usr1`='".$ref['id']."' and `usr2`='0'"));
if($rows211==0)
{
mysql_query("INSERT INTO `msg_kont` SET
`id`='',
`usr1`='".$ref['id']."',
`usr2`='0',
`read`='1',
`time`='".time()."'
");
}else
{
$rows21=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$ref['id']."'"));
mysql_query("UPDATE `msg_kont` SET `read`='1', `time`='".time()."' WHERE `usr2`='0' and `usr1`='".$ref['id']."'");
}
$rows21=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$ref['id']."'"));
$text='<font color=#cccccc>Ваш реферал '.$udata['usr'].' прокачался до 40 уровня. За это вы получаете <img src=img/main/p13.png>5.</font>
';
mysql_query("INSERT INTO `msg_dialog` SET
`id`='',
`dialog`='".$rows21['id']."',
`vhod`='1',
`time`='".time()."',
`text`='".$text."',
`usr`='".$ref['id']."'
");
}
if($kl==45)
{
$ref_m=$ref['jem']+15;
mysql_query("UPDATE `users` SET `jem`='".$ref_m."' WHERE `id`='".$ref['id']."'");
$rows211=mysql_num_rows(mysql_query("SELECT * FROM `msg_kont` WHERE `usr1`='".$ref['id']."' and `usr2`='0'"));
if($rows211==0)
{
mysql_query("INSERT INTO `msg_kont` SET
`id`='',
`usr1`='".$ref['id']."',
`usr2`='0',
`read`='1',
`time`='".time()."'
");
}else
{
$rows21=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$ref['id']."'"));
mysql_query("UPDATE `msg_kont` SET `read`='1', `time`='".time()."' WHERE `usr2`='0' and `usr1`='".$ref['id']."'");
}
$rows21=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$ref['id']."'"));
$text='<font color=#cccccc>Ваш реферал '.$udata['usr'].' прокачался до 45 уровня. За это вы получаете <img src=img/main/p13.png>15.</font>
';
mysql_query("INSERT INTO `msg_dialog` SET
`id`='',
`dialog`='".$rows21['id']."',
`vhod`='1',
`time`='".time()."',
`text`='".$text."',
`usr`='".$ref['id']."'
");
}
if($kl==50)
{
$ref_m=$ref['jem']+30;
mysql_query("UPDATE `users` SET `jem`='".$ref_m."' WHERE `id`='".$ref['id']."'");
$rows211=mysql_num_rows(mysql_query("SELECT * FROM `msg_kont` WHERE `usr1`='".$ref['id']."' and `usr2`='0'"));
if($rows211==0)
{
mysql_query("INSERT INTO `msg_kont` SET
`id`='',
`usr1`='".$ref['id']."',
`usr2`='0',
`read`='1',
`time`='".time()."'
");
}else
{
$rows21=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$ref['id']."'"));
mysql_query("UPDATE `msg_kont` SET `read`='1', `time`='".time()."' WHERE `usr2`='0' and `usr1`='".$ref['id']."'");
}
$rows21=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$ref['id']."'"));
$text='<font color=#cccccc>Ваш реферал '.$udata['usr'].' прокачался до 50 уровня. За это вы получаете <img src=img/main/p13.png>30.</font>
';
mysql_query("INSERT INTO `msg_dialog` SET
`id`='',
`dialog`='".$rows21['id']."',
`vhod`='1',
`time`='".time()."',
`text`='".$text."',
`usr`='".$ref['id']."'
");
}
}
mysql_query("UPDATE `clan_battle_b_usr` SET `hp`='".$udata['hp']."', `arm`='".$udata['arm']."', `sila`='".$udata['sila']."' WHERE `id`='".$bt['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='Ваш уровень повысился до ".$lvl."!'
");
header('location: ?');exit;
}}
if(isset($_GET['leave']))
{
if($bt['status']==1)
{
$numu=mysql_num_rows(mysql_query("SELECT * FROM `clan_battle_b_usr` WHERE `kom`='".$bz['clan']."'"));
if($numu==1)
{
mysql_query("DELETE FROM `clan_battle_b` WHERE `id`='".$bz['id']."'");
}
mysql_query("DELETE FROM `clan_battle_b_usr` WHERE `usr`='".$udata['id']."'");
mysql_query("DELETE FROM `log_clan_b` WHERE `usr`='".$udata['id']."'");
mysql_query("UPDATE `mag` SET `time`='0' WHERE `usr`='".$udata['id']."'");
}
elseif($bt['status']==2)
{
$numu=mysql_num_rows(mysql_query("SELECT * FROM `clan_battle_b_usr` WHERE `kom`='".$bz['clan']."'"));
if($numu==1)
{
mysql_query("DELETE FROM `clan_battle_b` WHERE `id`='".$bz['id']."'");
}
mysql_query("DELETE FROM `clan_battle_b_usr` WHERE `usr`='".$udata['id']."'");
mysql_query("DELETE FROM `log_clan_b` WHERE `usr`='".$udata['id']."'");
mysql_query("UPDATE `mag` SET `time`='0' WHERE `usr`='".$udata['id']."'");
}
header('location: ?');exit;
}
if(isset($_GET['enemy']))
{
$id=mysql_real_escape_string($_GET['enemy']);
$enemy=mysql_num_rows(mysql_query("SELECT * FROM `clan_battle_b_usr` WHERE `status`='0' and `kom`='".$bz['enemy_clan']."' and `id`='".$id."' and `time_kill`<'".time()."'"));
if($enemy!=0)
{
mysql_query("UPDATE `clan_battle_b_usr` SET `enemy`='".$id."' WHERE `id`='".$bt['id']."'");
}
header('location: ?');exit;
}
if(isset($_GET['elic']))
{
$els=mysql_real_escape_string($_GET['elic']);
$elic=mysql_query("SELECT * FROM `elic` WHERE `id`='".$els."' and `usr`='".$udata['id']."' and `status`='on'");
$cd=mysql_num_rows($elic);
if($cd==0)
{
header('location: ?');exit;
}
else
{
$el=mysql_fetch_array($elic);
if($el['time']>time())
{
$lg='<img src=img/main/e22.png> <font color=#999999>Зелье еще не готово.</font>';
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg."'
");
header('location: ?');exit;
}
if($bt['hp']==$udata['hp'] or $bt['hp']==0)
{
$lg='<img src=img/main/e22.png> <font color=#999999>нет эффекта.</font>';
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='".$lg."'
");
header('location: ?');exit;
}
$hp=$bt['hp']+$el['ef'];
if($hp>$udata['hp'])
{
$hp=$udata['hp'];
}
mysql_query("UPDATE `clan_battle_b_usr` SET `hp`='".$hp."' WHERE `id`='".$bt['id']."'");
$elk=$el['kol']-1;
if($elk==0)
{
mysql_query("DELETE FROM `elic` WHERE `id`='".$el['id']."'");
}
else
{
$time=time()+$el['rest'];
mysql_query("UPDATE `elic` SET `kol`='".$elk."', `time`='".$time."' WHERE `id`='".$el['id']."'");
}
if($el['ef']!=20000)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/p21.png> <font color=#009900>Ты испил зелья и исцелился +".$el['ef']." <img src=img/main/p6.png></font>'
");
}
else
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/p21.png> <font color=#009900>Ты испил зелья и ваше здоровье востановилось <img src=img/main/p6.png></font>'
");
}
$ds=$udata['dost3a']+1;
mysql_query("UPDATE `users` SET `dost3a`='".$ds."' WHERE `id`='".$udata['id']."'");
header('location: ?');exit;
}
}
$enemy=mysql_num_rows(mysql_query("SELECT * FROM `clan_battle_b_usr` WHERE `status`='0' and `b`='".$bt['b']."' and `kom`='".$bz['enemy_clan']."' and `id`='".$bt['enemy']."' and `time_kill`<'".time()."'"));
if($enemy==0 and $bt['enemy']!=0)
{
if($bt['enemy']!=1)
{
mysql_query("UPDATE `clan_battle_b_usr` SET `enemy`='0' WHERE `id`='".$bt['id']."'");
header('location: ?');exit;
}
else
{
$ew=mysql_query("SELECT * FROM `clan_battle_b_bs` WHERE `kod`='".$bz['kod']."' and `clan`!='".$bz['clan']."'");
$bvc=mysql_num_rows($ew);
if($bvc==0)
{
mysql_query("UPDATE `clan_battle_b_usr` SET `enemy`='0' WHERE `id`='".$bt['id']."'");
header('location: ?');exit;
}
}
}
$bts=mysql_fetch_array(mysql_query("SELECT * FROM `clan_battle_b_usr` WHERE `id`='".$bt['enemy']."'"));
if($bts['tip']=='usr')
{
$ussb=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$bts['usr']."'"));
$en_name=' <img src=img/main/c'.$ussb['klass'].'.png> <img src=img/main/r'.$ussb['rasa'].'.png><font color=#ff9900>'.$ussb['usr'].'</font>';
if($ussb['ava']==0)
{
$img='<img src=img/pers/'.$ussb['klass'].''.$ussb['pol'].'.png>
';
}
else
{
$img='<img src=img/pers/ava/'.$ussb['ava'].'.png>';
}
}
$bsh=mysql_num_rows(mysql_query("SELECT * FROM `clan_battle_b_bs` WHERE `kod`='".$bz['kod']."' and `clan`='".$bz['clan']."'"));
if($bsh!=0)
{
$udata['sila']=floor($udata['sila']+$udata['sila']/100*20);
$obn=1;
}
if(isset($_GET['kick']))
{
if($bt['status']==0 and $bt['time_kill']<time() and $bts['time_kill']<time() and $bt['enemy']!=0)
{
if($bt['enemy']==1)
{
$ew=mysql_query("SELECT * FROM `clan_battle_b_bs` WHERE `kod`='".$bz['kod']."' and `clan`!='".$bz['clan']."'");
$bts=mysql_fetch_array($ew);
$bts['arm']=0;
$bts['sfer_6_time']=0;
$bts['sfer_10_time']=0;
$bts['sfer_4_time']=0;
$ussb['blok']=0;
$en_name=$bts['name'];
}
$max_sila=$udata['sila'];
$min_sila=round($max_sila/100*10);if($min_sila<1){$min_sila=1;}
$blok=$ussb['blok'];
$krit=$udata['krit'];
$arm=$bts['arm'];
$bsh2=mysql_num_rows(mysql_query("SELECT * FROM `clan_battle_b_bs` WHERE `kod`='".$bz['kod']."' and `clan`='".$bz['enemy_clan']."'"));
if($bsh2!=0)
{
$atm=floor($arm+$arm/100*20);
}
if($bt['sfer_3_time']>=time())
{$baf_3=$bt['sfer_3_ef'];}else{$baf_3=0;}//усиление
if($bts['sfer_4_time']>=time())
{$baf_4=$bts['sfer_4_ef'];}else{$baf_4=0;}//пробивание
if($bt['sfer_5_time']>=time())
{$baf_5=$bt['sfer_5_time']-time();}else{$baf_5=0;}//стан
if($bts['sfer_6_time']>=time())
{$baf_6=$bts['sfer_6_ef'];}else{$baf_6=0;}//оборона
if($bts['sfer_10_time']>=time())
{$baf_10=$bts['sfer_10_ef'];}else{$baf_10=0;}//пламя
if($bt['sfer_11_time']>=time())
{$baf_11=$bt['sfer_11_ef'];}else{$baf_11=0;}//ослабление
if($bt['sfer_12_time']>=time())
{$baf_12=$bt['sfer_12_ef'];}else{$baf_12=0;}//барьер
$time=$bt['time_us'];
if($time>time())
{
$sek=$time-time();
if($sek>=5){$prom=1;}
elseif($sek==4){$prom=0;$max_sila=round($max_sila-$max_sila/100*rand(70,80));$min_sila=round($min_sila/4);}
elseif($sek==3){$prom=0;$max_sila=round($max_sila-$max_sila/100*rand(50,70));$min_sila=round($min_sila/3);}
elseif($sek==2 or $sek==1){$prom=0;$max_sila=round($max_sila-$max_sila/100*rand(20,50));$min_sila=round($min_sila/2);}
}
if($baf_5!=0)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b1.png><font color=#999999>Вы оглушены еще ".$baf_5."сек.</font>'
");
}
else
{
if($prom==1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b1.png><font color=#999999>Промах!</font>'
");
}
else
{
$sila=$max_sila;
$sila=round($sila+$sila/100*$baf_3);
$arm=round($arm-$arm/100*$baf_4);
$sila=$sila-$arm;
if($sila<$min_sila){$sila=round($min_sila-$min_sila/100*$baf_11);}
$sila=round($sila-$sila/100*$baf_6);
if($sila<1){$sila=1;}
$kr=rand(1,100);if($kr<=$krit){$sila=$sila*2;$k_sila=1;}else{$k_sila=0;}
$bl=rand(1,100);if($bl<=$blok){$blok_us=1;}else{$blok_us=0;}
$sila=round($sila-$sila/100*$baf_11);
if($blok_us==1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b23.png>".$en_name."<font color=#990000> заблокировал вашу атаку</font>'
");
if($bt['enemy']!=1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b23.png><font color=#cccccc>Вы заблокировали атаку <img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font></font>'
");
}
$att=0;
$att2=0;
}
else
{
if($k_sila==1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b8.png><font color=#ff0000>Вы наносите критический удар ".$en_name." <b>-".$sila."</b></font>'
");
if($bt['enemy']!=1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b8.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> наносит вам критический удар <b>-".$sila."</b></font>'
");
}
}
else
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b8.png><font color=#00ff99>Вы наносите удар ".$k." ".$en_name." -".$sila."</font>'
");
if($bt['enemy']!=1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b8.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> наносит вам удар -".$sila."</font>'
");
}
}
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
if($bt['enemy']!=1)
{
$time_kill=time()+30;
$hp=$ussb['hp'];
if($bts['tip']=='usr')
{
$reit=$bt['kil']+10;
$kil=$gus['reit_b']+1;
mysql_query("UPDATE `clan_users` SET `b_kill`='".$kil."' WHERE `id`='".$gus['id']."'");
}
elseif($bts['tip']=='pit')
{
$reit=$bt['kil']+3;
mysql_query("DELETE FROM `clan_battle_b_usr` WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `clan_battle_b_usr` SET `kil`='".$reit."' WHERE `id`='".$bt['id']."'");
$rand=rand(1,15);
if($rand==1)
{
$e=$udata['wood']+1;
mysql_query("UPDATE `users` SET `wood`='".$e."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr1.png><font color=#ffffff>Вы получили ресурс гильдии. Дерево.</font>'
");
}
}
else
{
$rand=rand(1,15);
if($rand==1)
{
$e=$udata['steel']+1;
mysql_query("UPDATE `users` SET `steel`='".$e."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr2.png><font color=#ffffff>Вы получили ресурс гильдии. Железо.</font>'
");
}
$hp=30000;
mysql_query("UPDATE `clan_battle_b_bs` SET `clan`='".$bz['clan']."' WHERE `id`='".$bts['id']."'");
$reit=$bt['kil']+25;
mysql_query("UPDATE `clan_battle_b_usr` SET `kil`='".$reit."' WHERE `id`='".$bt['id']."'");
}
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$en_name."</font>'
");
if($bt['enemy']!=1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b7.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> сокрушает вас</font>'
");
$nai=$udata['reit_nai']+1;
$ds=$udata['dost1a']+1;
mysql_query("UPDATE `users` SET `reit_nai`='".$nai."', `dost1a`='".$ds."' WHERE `id`='".$udata['id']."'");
}
$totem=mysql_fetch_array(mysql_query("SELECT * FROM `clan_totem` WHERE `id`='1'"));
if($totem['clan']==$gi['id'])
{
$jr=rand(1,100);
if($jr<=2)
{
$j=$udata['jem']+1;
mysql_query("UPDATE `users` SET `jem`='".$j."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr2.png><font color=#ffffff>Вы получили <img src=img/main/p13.png>1.</font>'
");
}
}
}
else
{
$exp=$sila;
if($bt['enemy']!=1)
{
$time_kill=time()-1;
}
$hp=$hp;
if($baf_10!=0)
{
$yr=round($sila/100*$baf_10);
$yr=round($yr-$yr/100*$baf_12);
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b8.png><font color=#ff0000>Вас обожгло заклинание возврата -".$yr."</font>'
");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b8.png><font color=#00ff00>заклинание возврата обожгло <img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> -".$yr."</font>'
");
$hps=$bt['hp']-$yr;
if($hps<1){$hps=1;}
mysql_query("UPDATE `clan_battle_b_usr` SET `hp`='".$hps."', `att2`='".$yr."' WHERE `id`='".$bt['id']."'");
}
}
if($bt['enemy']!=1)
{
mysql_query("UPDATE `clan_battle_b_usr` SET `hp`='".$hp."', `time_kill`='".$time_kill."', `att2`='".$att2."' WHERE `id`='".$bts['id']."'");
}
else
{
mysql_query("UPDATE `clan_battle_b_bs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
if($udata['lvl']<16)
{$vrs=5;}
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;
$vipss=mysql_query("SELECT * FROM `vip` WHERE `usr`='".$udata['id']."'");
$nvips=mysql_num_rows($vipss);
if($nvips!=0)
{
$exp=round($exp+$exp/100*30);
}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
$t=time()+7;
mysql_query("UPDATE `clan_battle_b_usr` SET `time_us`='".$t."', `att`='".$att."' WHERE `id`='".$bt['id']."'");
}
}
header('location: ?');exit;
}
if(isset($_GET['mag']))
{
$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($bt['enemy']==1)
{
$ew=mysql_query("SELECT * FROM `clan_battle_b_bs` WHERE `kod`='".$bz['kod']."'");
$bts=mysql_fetch_array($ew);
$bts['sfer_12_time']=0;
$en_name=$bts['name'];
}
if($m==3)
{
$sila=3*$skill['lvl'];
$tm=time()+90;
$ts=time()+60;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='3' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `clan_battle_b_usr` SET `sfer_3_time`='".$ts."', `sfer_3_ef`='".$sila."' WHERE `id`='".$bt['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание усиления</font>, физические атаки +".$sila."% урона.</font>'
");
$enus=mysql_query("SELECT * FROM `clan_battle_b_usr` WHERE `enemy`='".$bt['id']."'");
$n_enus=mysql_num_rows($enus);
if($n_enus!=0)
{
while($eb=mysql_fetch_array($enus))
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$eb['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание усиления</font>, физические атаки +".$sila."% урона.</font>'
");
}
}
}
if($m==4)
{
if($bt['status']==0 and $bt['time_kill']<time() and $bts['time_kill']<time() and $bt['enemy']!=0)
{
if($bt['enemy']==1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#888888>Данное заклинание не даст эффекта.</font>'
");
}
else
{
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;}
$tm=time()+60;
$ts=time()+40;
mysql_query("UPDATE `mag` SET`time`='".$tm."' WHERE `mag`='4' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `clan_battle_b_usr` SET `sfer_4_time`='".$ts."', `sfer_4_ef`='".$sila."' WHERE `id`='".$bts['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание пробивания</font>, ".$en_name." -".$sila."% брони.</font>'
");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание пробивания</font>, ваша броня -".$sila."%.</font>'
");
}
}
}
if($m==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;}
$tm=time()+90;
$ts=time()+30;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='6' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `clan_battle_b_usr` SET `sfer_6_time`='".$ts."', `sfer_6_ef`='".$sila."' WHERE `id`='".$bt['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание обороны</font>, +".$sila."% защиты от физических атак.</font>'
");
$enus=mysql_query("SELECT * FROM `clan_battle_b_usr` WHERE `enemy`='".$bt['id']."'");
$n_enus=mysql_num_rows($enus);
if($n_enus!=0)
{
while($eb=mysql_fetch_array($enus))
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$eb['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание обороны</font>, +".$sila."% от физических атак.</font>'
");
}
}
}
if($m==10)
{
$sila=5*$skill['lvl'];
$tm=time()+60;
$ts=time()+30;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='10' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `clan_battle_b_usr` SET `sfer_10_time`='".$ts."', `sfer_10_ef`='".$sila."' WHERE `id`='".$bt['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание возврата</font>, ".$sila."% урона возвращается противнику.</font>'
");
$enus=mysql_query("SELECT * FROM `clan_battle_b_usr` WHERE `enemy`='".$bt['id']."'");
$n_enus=mysql_num_rows($enus);
if($n_enus!=0)
{
while($eb=mysql_fetch_array($enus))
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$eb['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание возврата</font>, ".$sila."% возвращается противнику.</font>'
");
}
}
}
if($m==11)
{
if($bt['status']==0 and $bt['time_kill']<time() and $bts['time_kill']<time() and $bt['enemy']!=0)
{
if($bt['enemy']==1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#888888>Данное заклинание не даст эффекта.</font>'
");
}
else
{
$sila=5*$skill['lvl'];
$tm=time()+30;
$ts=time()+20;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='11' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `clan_battle_b_usr` SET `sfer_11_time`='".$ts."', `sfer_11_ef`='".$sila."' WHERE `id`='".$bts['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание ослабления</font>, ".$en_name." -".$sila."% урона.</font>'
");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание ослабления</font>, ваш урон -".$sila."%.</font>'
");
}
}
}
if($m==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;}
$tm=time()+60;
$ts=time()+20;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='12' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `clan_battle_b_usr` SET `sfer_12_time`='".$ts."', `sfer_12_ef`='".$sila."' WHERE `id`='".$bt['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание барьера</font>, +".$sila."% защиты от заклинаний.</font>'
");
$enus=mysql_query("SELECT * FROM `clan_battle_b_usr` WHERE `enemy`='".$bt['id']."'");
$n_enus=mysql_num_rows($enus);
if($n_enus!=0)
{
while($eb=mysql_fetch_array($enus))
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$eb['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание барьера</font>, +".$sila."% защиты от заклинаний.</font>'
");
}
}
}
if($m==1)
{
if($bt['status']==0 and $bt['time_kill']<time() and $bts['time_kill']<time() and $bt['enemy']!=0)
{
if($bts['sfer_12_time']>=time())
{$baf_12=$bts['sfer_12_ef'];}else{$baf_12=0;}//барьер
$sila=5*$skill['lvl']+5;
$sila=round($sila-$sila/100*$baf_12);
if($obn==1)
{
$sila=floor($sila+$sila/100*20);
}
$tm=time()+5;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='1' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание атаки</font>, ".$en_name." -".$sila."хп.</font>'
");
if($bt['enemy']!=1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание атаки</font> -".$sila."хп.</font>'
");
}
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
if($bt['enemy']!=1)
{
$time_kill=time()+30;
$hp=$ussb['hp'];
if($bts['tip']=='usr')
{
$reit=$bt['kil']+10;
$kil=$gus['reit_b']+1;
mysql_query("UPDATE `clan_users` SET `b_kill`='".$kil."' WHERE `id`='".$gus['id']."'");
}
elseif($bts['tip']=='pit')
{
$reit=$bt['kil']+3;
mysql_query("DELETE FROM `clan_battle_b_usr` WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `clan_battle_b_usr` SET `kil`='".$reit."' WHERE `id`='".$bt['id']."'");
$rand=rand(1,15);
if($rand==1)
{
$e=$udata['wood']+1;
mysql_query("UPDATE `users` SET `wood`='".$e."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr1.png><font color=#ffffff>Вы получили ресурс гильдии. Дерево.</font>'
");
}
}
else
{
$rand=rand(1,15);
if($rand==1)
{
$e=$udata['steel']+1;
mysql_query("UPDATE `users` SET `steel`='".$e."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr2.png><font color=#ffffff>Вы получили ресурс гильдии. Железо.</font>'
");
}
$hp=30000;
mysql_query("UPDATE `clan_battle_b_bs` SET `clan`='".$bz['clan']."' WHERE `id`='".$bts['id']."'");
$reit=$bt['kil']+25;
mysql_query("UPDATE `clan_battle_b_usr` SET `kil`='".$reit."' WHERE `id`='".$bt['id']."'");
}
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$en_name."</font>'
");
if($bt['enemy']!=1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b7.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> сокрушает вас</font>'
");
$nai=$udata['reit_nai']+1;
$ds=$udata['dost1a']+1;
mysql_query("UPDATE `users` SET `reit_nai`='".$nai."', `dost1a`='".$ds."' WHERE `id`='".$udata['id']."'");
}
$totem=mysql_fetch_array(mysql_query("SELECT * FROM `clan_totem` WHERE `id`='1'"));
if($totem['clan']==$gi['id'])
{
$jr=rand(1,100);
if($jr<=2)
{
$j=$udata['jem']+1;
mysql_query("UPDATE `users` SET `jem`='".$j."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr2.png><font color=#ffffff>Вы получили <img src=img/main/p13.png>1.</font>'
");
}
}
}
else
{
$exp=$sila;
if($bt['enemy']!=1)
{
$time_kill=time()-1;
}
$hp=$hp;
}
if($bt['enemy']!=1)
{
mysql_query("UPDATE `clan_battle_b_usr` SET `hp`='".$hp."', `time_kill`='".$time_kill."', `att2`='".$att2."' WHERE `id`='".$bts['id']."'");
}
else
{
mysql_query("UPDATE `clan_battle_b_bs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `clan_battle_b_usr` SET `att`='".$att."' WHERE `id`='".$bt['id']."'");
if($udata['lvl']<16)
{$vrs=5;}
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;
$vipss=mysql_query("SELECT * FROM `vip` WHERE `usr`='".$udata['id']."'");
$nvips=mysql_num_rows($vipss);
if($nvips!=0)
{
$exp=round($exp+$exp/100*30);
}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
if($m==2)
{
if($bt['status']==0 and $bt['time_kill']<time() and $bts['time_kill']<time() and $bt['enemy']!=0)
{
if($bts['sfer_12_time']>=time())
{$baf_12=$bts['sfer_12_ef'];}else{$baf_12=0;}//барьер
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);}
$sila=round($sila-$sila/100*$baf_12);
if($obn==1)
{
$sila=floor($sila+$sila/100*20);
}
$tm=time()+50;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='2' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание случайности</font>, ".$en_name." -".$sila."хп.</font>'
");
if($bt['enemy']!=1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание случайности</font> -".$sila."хп.</font>'
");
}
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
if($bt['enemy']!=1)
{
$time_kill=time()+30;
$hp=$ussb['hp'];
if($bts['tip']=='usr')
{
$reit=$bt['kil']+10;
$kil=$gus['reit_b']+1;
mysql_query("UPDATE `clan_users` SET `b_kill`='".$kil."' WHERE `id`='".$gus['id']."'");
}
elseif($bts['tip']=='pit')
{
$reit=$bt['kil']+3;
mysql_query("DELETE FROM `clan_battle_b_usr` WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `clan_battle_b_usr` SET `kil`='".$reit."' WHERE `id`='".$bt['id']."'");
$rand=rand(1,15);
if($rand==1)
{
$e=$udata['wood']+1;
mysql_query("UPDATE `users` SET `wood`='".$e."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr1.png><font color=#ffffff>Вы получили ресурс гильдии. Дерево.</font>'
");
}
}
else
{
$rand=rand(1,15);
if($rand==1)
{
$e=$udata['steel']+1;
mysql_query("UPDATE `users` SET `steel`='".$e."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr2.png><font color=#ffffff>Вы получили ресурс гильдии. Железо.</font>'
");
}
$hp=30000;
mysql_query("UPDATE `clan_battle_b_bs` SET `clan`='".$bz['clan']."' WHERE `id`='".$bts['id']."'");
$reit=$bt['kil']+25;
mysql_query("UPDATE `clan_battle_b_usr` SET `kil`='".$reit."' WHERE `id`='".$bt['id']."'");
}
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$en_name."</font>'
");
if($bt['enemy']!=1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b7.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> сокрушает вас</font>'
");
$nai=$udata['reit_nai']+1;
$ds=$udata['dost1a']+1;
mysql_query("UPDATE `users` SET `reit_nai`='".$nai."', `dost1a`='".$ds."' WHERE `id`='".$udata['id']."'");
}
$totem=mysql_fetch_array(mysql_query("SELECT * FROM `clan_totem` WHERE `id`='1'"));
if($totem['clan']==$gi['id'])
{
$jr=rand(1,100);
if($jr<=2)
{
$j=$udata['jem']+1;
mysql_query("UPDATE `users` SET `jem`='".$j."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr2.png><font color=#ffffff>Вы получили <img src=img/main/p13.png>1.</font>'
");
}
}
}
else
{
$exp=$sila;
if($bt['enemy']!=1)
{
$time_kill=time()-1;
}
$hp=$hp;
}
if($bt['enemy']!=1)
{
mysql_query("UPDATE `clan_battle_b_usr` SET `hp`='".$hp."', `time_kill`='".$time_kill."', `att2`='".$att2."' WHERE `id`='".$bts['id']."'");
}
else
{
mysql_query("UPDATE `clan_battle_b_bs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `clan_battle_b_usr` SET `att`='".$att."' WHERE `id`='".$bt['id']."'");
if($udata['lvl']<16)
{$vrs=5;}
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;
$vipss=mysql_query("SELECT * FROM `vip` WHERE `usr`='".$udata['id']."'");
$nvips=mysql_num_rows($vipss);
if($nvips!=0)
{
$exp=round($exp+$exp/100*30);
}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
if($m==13)
{
if($bt['status']==0 and $bt['time_kill']<time() and $bts['time_kill']<time() and $bt['enemy']!=0)
{
if($bts['sfer_12_time']>=time())
{$baf_12=$bts['sfer_12_ef'];}else{$baf_12=0;}//барьер
$sila=3*$skill['lvl'];
$sila=round($bts['hp']/100*$sila);
$sila=round($sila-$sila/100*$baf_12);
if($obn==1)
{
$sila=floor($sila+$sila/100*20);
}
if($sila>10000)
{
$sila=10000;
}
$tm=time()+60;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='13' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание сингулярности</font>, ".$en_name." -".$sila."хп.</font>'
");
if($bt['enemy']!=1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание сингулярности</font> -".$sila."хп.</font>'
");
}
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
if($bt['enemy']!=1)
{
$time_kill=time()+30;
$hp=$ussb['hp'];
if($bts['tip']=='usr')
{
$reit=$bt['kil']+10;
$kil=$gus['reit_b']+1;
mysql_query("UPDATE `clan_users` SET `b_kill`='".$kil."' WHERE `id`='".$gus['id']."'");
}
elseif($bts['tip']=='pit')
{
$reit=$bt['kil']+3;
mysql_query("DELETE FROM `clan_battle_b_usr` WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `clan_battle_b_usr` SET `kil`='".$reit."' WHERE `id`='".$bt['id']."'");
$rand=rand(1,15);
if($rand==1)
{
$e=$udata['wood']+1;
mysql_query("UPDATE `users` SET `wood`='".$e."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr1.png><font color=#ffffff>Вы получили ресурс гильдии. Дерево.</font>'
");
}
}
else
{
$rand=rand(1,15);
if($rand==1)
{
$e=$udata['steel']+1;
mysql_query("UPDATE `users` SET `steel`='".$e."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr2.png><font color=#ffffff>Вы получили ресурс гильдии. Железо.</font>'
");
}
$hp=30000;
mysql_query("UPDATE `clan_battle_b_bs` SET `clan`='".$bz['clan']."' WHERE `id`='".$bts['id']."'");
$reit=$bt['kil']+25;
mysql_query("UPDATE `clan_battle_b_usr` SET `kil`='".$reit."' WHERE `id`='".$bt['id']."'");
}
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$en_name."</font>'
");
if($bt['enemy']!=1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b7.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> сокрушает вас</font>'
");
$nai=$udata['reit_nai']+1;
$ds=$udata['dost1a']+1;
mysql_query("UPDATE `users` SET `reit_nai`='".$nai."', `dost1a`='".$ds."' WHERE `id`='".$udata['id']."'");
}
$totem=mysql_fetch_array(mysql_query("SELECT * FROM `clan_totem` WHERE `id`='1'"));
if($totem['clan']==$gi['id'])
{
$jr=rand(1,100);
if($jr<=2)
{
$j=$udata['jem']+1;
mysql_query("UPDATE `users` SET `jem`='".$j."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr2.png><font color=#ffffff>Вы получили <img src=img/main/p13.png>1.</font>'
");
}
}
}
else
{
$exp=$sila;
if($bt['enemy']!=1)
{
$time_kill=time()-1;
}
$hp=$hp;
}
if($bt['enemy']!=1)
{
mysql_query("UPDATE `clan_battle_b_usr` SET `hp`='".$hp."', `time_kill`='".$time_kill."', `att2`='".$att2."' WHERE `id`='".$bts['id']."'");
}
else
{
mysql_query("UPDATE `clan_battle_b_bs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `clan_battle_b_usr` SET `att`='".$att."' WHERE `id`='".$bt['id']."'");
if($udata['lvl']<16)
{$vrs=5;}
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;
$vipss=mysql_query("SELECT * FROM `vip` WHERE `usr`='".$udata['id']."'");
$nvips=mysql_num_rows($vipss);
if($nvips!=0)
{
$exp=round($exp+$exp/100*30);
}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
if($m==14)
{
if($bt['status']==0 and $bt['time_kill']<time() and $bts['time_kill']<time() and $bt['enemy']!=0)
{
if($bts['sfer_12_time']>=time())
{$baf_12=$bts['sfer_12_ef'];}else{$baf_12=0;}//барьер
$sila=50*$skill['lvl'];
$sila=round($sila-$sila/100*$baf_12);
if($obn==1)
{
$sila=floor($sila+$sila/100*20);
}
$tm=time()+40;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='14' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание хаоса</font>, ".$en_name." -".$sila."хп.</font>'
");
if($bt['enemy']!=1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание хаоса</font> -".$sila."хп.</font>'
");
}
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
if($bt['enemy']!=1)
{
$time_kill=time()+30;
$hp=$ussb['hp'];
if($bts['tip']=='usr')
{
$reit=$bt['kil']+10;
$kil=$gus['reit_b']+1;
mysql_query("UPDATE `clan_users` SET `b_kill`='".$kil."' WHERE `id`='".$gus['id']."'");
}
elseif($bts['tip']=='pit')
{
$reit=$bt['kil']+3;
mysql_query("DELETE FROM `clan_battle_b_usr` WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `clan_battle_b_usr` SET `kil`='".$reit."' WHERE `id`='".$bt['id']."'");
$rand=rand(1,15);
if($rand==1)
{
$e=$udata['wood']+1;
mysql_query("UPDATE `users` SET `wood`='".$e."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr1.png><font color=#ffffff>Вы получили ресурс гильдии. Дерево.</font>'
");
}
}
else
{
$rand=rand(1,15);
if($rand==1)
{
$e=$udata['steel']+1;
mysql_query("UPDATE `users` SET `steel`='".$e."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr2.png><font color=#ffffff>Вы получили ресурс гильдии. Железо.</font>'
");
}$hp=30000;
mysql_query("UPDATE `clan_battle_b_bs` SET `clan`='".$bz['clan']."' WHERE `id`='".$bts['id']."'");
$reit=$bt['kil']+25;
mysql_query("UPDATE `clan_battle_b_usr` SET `kil`='".$reit."' WHERE `id`='".$bt['id']."'");
}
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$en_name."</font>'
");
if($bt['enemy']!=1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b7.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> сокрушает вас</font>'
");
$nai=$udata['reit_nai']+1;
$ds=$udata['dost1a']+1;
mysql_query("UPDATE `users` SET `reit_nai`='".$nai."', `dost1a`='".$ds."' WHERE `id`='".$udata['id']."'");
}
$totem=mysql_fetch_array(mysql_query("SELECT * FROM `clan_totem` WHERE `id`='1'"));
if($totem['clan']==$gi['id'])
{
$jr=rand(1,100);
if($jr<=2)
{
$j=$udata['jem']+1;
mysql_query("UPDATE `users` SET `jem`='".$j."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr2.png><font color=#ffffff>Вы получили <img src=img/main/p13.png>1.</font>'
");
}
}
}
else
{
$exp=$sila;
if($bt['enemy']!=1)
{
$time_kill=time()-1;
}
$hp=$hp;
}
if($bt['enemy']!=1)
{
mysql_query("UPDATE `clan_battle_b_usr` SET `hp`='".$hp."', `time_kill`='".$time_kill."', `att2`='".$att2."' WHERE `id`='".$bts['id']."'");
}
else
{
mysql_query("UPDATE `clan_battle_b_bs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `clan_battle_b_usr` SET `att`='".$att."' WHERE `id`='".$bt['id']."'");
if($udata['lvl']<16)
{$vrs=5;}
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;
$vipss=mysql_query("SELECT * FROM `vip` WHERE `usr`='".$udata['id']."'");
$nvips=mysql_num_rows($vipss);
if($nvips!=0)
{
$exp=round($exp+$exp/100*30);
}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
if($m==7)
{
if($bt['status']==0 and $bt['time_kill']<time() and $bts['time_kill']<time() and $bt['enemy']!=0)
{
if($bts['sfer_12_time']>=time())
{$baf_12=$bts['sfer_12_ef'];}else{$baf_12=0;}//барьер
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;}
$sila=round($sila-$sila/100*$baf_12);
if($obn==1)
{
$sila=floor($sila+$sila/100*20);
}
$tm=time()+50;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='7' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание молнии</font>, ".$en_name." -".$sila."хп.</font>'
");
if($bt['enemy']!=1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание молнии</font>, -".$sila."хп.</font>'
");
}
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
if($bt['enemy']!=1)
{
$time_kill=time()+30;
$hp=$ussb['hp'];
if($bts['tip']=='usr')
{
$reit=$bt['kil']+10;
$kil=$gus['reit_b']+1;
mysql_query("UPDATE `clan_users` SET `b_kill`='".$kil."' WHERE `id`='".$gus['id']."'");
}
elseif($bts['tip']=='pit')
{
$reit=$bt['kil']+3;
mysql_query("DELETE FROM `clan_battle_b_usr` WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `clan_battle_b_usr` SET `kil`='".$reit."' WHERE `id`='".$bt['id']."'");
$rand=rand(1,15);
if($rand==1)
{
$e=$udata['wood']+1;
mysql_query("UPDATE `users` SET `wood`='".$e."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr1.png><font color=#ffffff>Вы получили ресурс гильдии. Дерево.</font>'
");
}
}
else
{
$rand=rand(1,15);
if($rand==1)
{
$e=$udata['steel']+1;
mysql_query("UPDATE `users` SET `steel`='".$e."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr2.png><font color=#ffffff>Вы получили ресурс гильдии. Железо.</font>'
");
}$hp=30000;
mysql_query("UPDATE `clan_battle_b_bs` SET `clan`='".$bz['clan']."' WHERE `id`='".$bts['id']."'");
$reit=$bt['kil']+25;
mysql_query("UPDATE `clan_battle_b_usr` SET `kil`='".$reit."' WHERE `id`='".$bt['id']."'");
}
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$en_name."</font>'
");
if($bt['enemy']!=1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b7.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> сокрушает вас</font>'
");
$nai=$udata['reit_nai']+1;
$ds=$udata['dost1a']+1;
mysql_query("UPDATE `users` SET `reit_nai`='".$nai."', `dost1a`='".$ds."' WHERE `id`='".$udata['id']."'");
}
$totem=mysql_fetch_array(mysql_query("SELECT * FROM `clan_totem` WHERE `id`='1'"));
if($totem['clan']==$gi['id'])
{
$jr=rand(1,100);
if($jr<=2)
{
$j=$udata['jem']+1;
mysql_query("UPDATE `users` SET `jem`='".$j."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr2.png><font color=#ffffff>Вы получили <img src=img/main/p13.png>1.</font>'
");
}
}
}
else
{
$exp=$sila;
if($bt['enemy']!=1)
{
$time_kill=time()-1;
}
$hp=$hp;
}
if($bt['enemy']!=1)
{
mysql_query("UPDATE `clan_battle_b_usr` SET `hp`='".$hp."', `time_kill`='".$time_kill."', `att2`='".$att2."' WHERE `id`='".$bts['id']."'");
}
else
{
mysql_query("UPDATE `clan_battle_b_bs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `clan_battle_b_usr` SET `att`='".$att."' WHERE `id`='".$bt['id']."'");
if($udata['lvl']<16)
{$vrs=5;}
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;
$vipss=mysql_query("SELECT * FROM `vip` WHERE `usr`='".$udata['id']."'");
$nvips=mysql_num_rows($vipss);
if($nvips!=0)
{
$exp=round($exp+$exp/100*30);
}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
if($m==9)
{
if($bt['status']==0 and $bt['time_kill']<time() and $bts['time_kill']<time() and $bt['enemy']!=0)
{
if($bt['sfer_12_time']>=time())
{$baf_12=$bt['sfer_12_ef'];}else{$baf_12=0;}//барьер
$sila=40*$skill['lvl'];
$sh=$sila/2;
$sila=round($sila-$sila/100*$baf_12);
$tm=time()+30;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='9' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание вампира</font>, ".$en_name." -".$sila."хп, ваше хп + ".$sh."</font>'
");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание вампира</font>, -".$sila."хп, востановив свое хп + ".$sh."</font>'
");
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
if($bt['enemy']!=1)
{
$time_kill=time()+30;
$hp=$ussb['hp'];
if($bts['tip']=='usr')
{
$reit=$bt['kil']+10;
$kil=$gus['reit_b']+1;
mysql_query("UPDATE `clan_users` SET `b_kill`='".$kil."' WHERE `id`='".$gus['id']."'");
}
elseif($bts['tip']=='pit')
{
$reit=$bt['kil']+3;
mysql_query("DELETE FROM `clan_battle_b_usr` WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `clan_battle_b_usr` SET `kil`='".$reit."' WHERE `id`='".$bt['id']."'");
$rand=rand(1,15);
if($rand==1)
{
$e=$udata['wood']+1;
mysql_query("UPDATE `users` SET `wood`='".$e."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr1.png><font color=#ffffff>Вы получили ресурс гильдии. Дерево.</font>'
");
}
}
else
{
$rand=rand(1,15);
if($rand==1)
{
$e=$udata['steel']+1;
mysql_query("UPDATE `users` SET `steel`='".$e."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr2.png><font color=#ffffff>Вы получили ресурс гильдии. Железо.</font>'
");
}$hp=30000;
mysql_query("UPDATE `clan_battle_b_bs` SET `clan`='".$bz['clan']."' WHERE `id`='".$bts['id']."'");
$reit=$bt['kil']+25;
mysql_query("UPDATE `clan_battle_b_usr` SET `kil`='".$reit."' WHERE `id`='".$bt['id']."'");
}
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$en_name."</font>'
");
if($bt['enemy']!=1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b7.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> сокрушает вас</font>'
");
$nai=$udata['reit_nai']+1;
$ds=$udata['dost1a']+1;
mysql_query("UPDATE `users` SET `reit_nai`='".$nai."', `dost1a`='".$ds."' WHERE `id`='".$udata['id']."'");
}
$totem=mysql_fetch_array(mysql_query("SELECT * FROM `clan_totem` WHERE `id`='1'"));
if($totem['clan']==$gi['id'])
{
$jr=rand(1,100);
if($jr<=2)
{
$j=$udata['jem']+1;
mysql_query("UPDATE `users` SET `jem`='".$j."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr2.png><font color=#ffffff>Вы получили <img src=img/main/p13.png>1.</font>'
");
}
}
}
else
{
$exp=$sila;
if($bt['enemy']!=1)
{
$time_kill=time()-1;
}
$hp=$hp;
}
if($bt['enemy']!=1)
{
mysql_query("UPDATE `clan_battle_b_usr` SET `hp`='".$hp."', `time_kill`='".$time_kill."', `att2`='".$att2."' WHERE `id`='".$bts['id']."'");
}
else
{
mysql_query("UPDATE `clan_battle_b_bs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
$hps=$bt['hp']+$sh;
if($hps>$udata['hp'])
{
$hps=$udata['hp'];
}
mysql_query("UPDATE `clan_battle_b_usr` SET `att`='".$att."', `hp`='".$hps."' WHERE `id`='".$bt['id']."'");
if($udata['lvl']<16)
{$vrs=5;}
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;
$vipss=mysql_query("SELECT * FROM `vip` WHERE `usr`='".$udata['id']."'");
$nvips=mysql_num_rows($vipss);
if($nvips!=0)
{
$exp=round($exp+$exp/100*30);
}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
if($m==8)
{
$sila=80*$skill['lvl'];
$tm=time()+40;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='8' and `usr`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание исциления</font> ваше хп + ".$sila."</font>'
");
$hps=$bt['hp']+$sila;
if($hps>$udata['hp'])
{
$hps=$udata['hp'];
}
mysql_query("UPDATE `clan_battle_b_usr` SET `hp`='".$hps."' WHERE `id`='".$bt['id']."'");
}
if($m==5)
{
if($bt['status']==0 and $bt['time_kill']<time() and $bts['time_kill']<time() and $bt['enemy']!=0)
{
if($bts['sfer_12_time']>=time())
{$baf_12=$bts['sfer_12_ef'];}else{$baf_12=0;}//барьер
if($skill['lvl']==1)
{$sila=15;$t=5;}
if($skill['lvl']==2)
{$sila=30;$t=6;}
if($skill['lvl']==3)
{$sila=45;$t=7;}
if($skill['lvl']==4)
{$sila=60;$t=8;}
if($skill['lvl']==5)
{$sila=75;$t=9;}
if($skill['lvl']==6)
{$sila=90;$t=10;}
if($skill['lvl']==7)
{$sila=105;$t=11;}
if($skill['lvl']==8)
{$sila=120;$t=12;}
if($skill['lvl']==9)
{$sila=135;$t=14;}
if($skill['lvl']==10)
{$sila=150;$t=15;}
$sila=round($sila-$sila/100*$baf_12);
if($obn==1)
{
$sila=floor($sila+$sila/100*20);
}
$tm=time()+60;
$ts=time()+$t;
mysql_query("UPDATE `mag` SET `time`='".$tm."' WHERE `mag`='5' and `usr`='".$udata['id']."'");
mysql_query("UPDATE `clan_battle_b_usr` SET `sfer_5_time`='".$ts."' WHERE `id`='".$bts['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b10.png><font color=#009900>Вы использовали <font color=#0099ff>Заклинание стана</font>, ".$en_name." -".$sila."хп, +".$t."сек. оглушение</font>'
");
if($bt['enemy']!=1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b10.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> использовал <font color=#0099ff>Заклинание стана</font>, -".$sila."хп, +".$t."сек. оглушения</font>'
");
}
$att=$sila;
$att2=$sila;
$hp=$bts['hp']-$sila;
if($hp<=0)
{
$exp=$bts['hp'];
if($bt['enemy']!=1)
{
$time_kill=time()+30;
$hp=$ussb['hp'];
if($bts['tip']=='usr')
{
$reit=$bt['kil']+10;
$kil=$gus['reit_b']+1;
mysql_query("UPDATE `clan_users` SET `b_kill`='".$kil."' WHERE `id`='".$gus['id']."'");
}
elseif($bts['tip']=='pit')
{
$reit=$bt['kil']+3;
mysql_query("DELETE FROM `clan_battle_b_usr` WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `clan_battle_b_usr` SET `kil`='".$reit."' WHERE `id`='".$bt['id']."'");
$rand=rand(1,15);
if($rand==1)
{
$e=$udata['wood']+1;
mysql_query("UPDATE `users` SET `wood`='".$e."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr1.png><font color=#ffffff>Вы получили ресурс гильдии. Дерево.</font>'
");
}
}
else
{
$rand=rand(1,15);
if($rand==1)
{
$e=$udata['steel']+1;
mysql_query("UPDATE `users` SET `steel`='".$e."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr2.png><font color=#ffffff>Вы получили ресурс гильдии. Железо.</font>'
");
}$hp=30000;
mysql_query("UPDATE `clan_battle_b_bs` SET `clan`='".$bz['clan']."' WHERE `id`='".$bts['id']."'");
$reit=$bt['kil']+25;
mysql_query("UPDATE `clan_battle_b_usr` SET `kil`='".$reit."' WHERE `id`='".$bt['id']."'");
}
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/b7.png><font color=#ffff00>Вы сокрушаете ".$en_name."</font>'
");
if($bt['enemy']!=1)
{
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$bts['usr']."',
`text`='<img src=img/main/b7.png><font color=#ff0000><img src=img/main/c".$udata['klass'].".png> <img src=img/main/r".$udata['rasa'].".png><font color=#ff9900>".$udata['usr']."</font> сокрушает вас</font>'
");
$nai=$udata['reit_nai']+1;
$ds=$udata['dost1a']+1;
mysql_query("UPDATE `users` SET `reit_nai`='".$nai."', `dost1a`='".$ds."' WHERE `id`='".$udata['id']."'");
}
$totem=mysql_fetch_array(mysql_query("SELECT * FROM `clan_totem` WHERE `id`='1'"));
if($totem['clan']==$gi['id'])
{
$jr=rand(1,100);
if($jr<=2)
{
$j=$udata['jem']+1;
mysql_query("UPDATE `users` SET `jem`='".$j."' WHERE `id`='".$udata['id']."'");
mysql_query("INSERT INTO `log_clan_b` SET
`id`='',
`usr`='".$udata['id']."',
`text`='<img src=img/main/cr2.png><font color=#ffffff>Вы получили <img src=img/main/p13.png>1.</font>'
");
}
}
}
else
{
$exp=$sila;
if($bt['enemy']!=1)
{
$time_kill=time()-1;
}
$hp=$hp;
}
if($bt['enemy']!=1)
{
mysql_query("UPDATE `clan_battle_b_usr` SET `hp`='".$hp."', `time_kill`='".$time_kill."', `att2`='".$att2."' WHERE `id`='".$bts['id']."'");
}
else
{
mysql_query("UPDATE `clan_battle_b_bs` SET `hp`='".$hp."' WHERE `id`='".$bts['id']."'");
}
mysql_query("UPDATE `clan_battle_b_usr` SET `att`='".$att."' WHERE `id`='".$bt['id']."'");
if($udata['lvl']<16)
{$vrs=5;}
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;
$vipss=mysql_query("SELECT * FROM `vip` WHERE `usr`='".$udata['id']."'");
$nvips=mysql_num_rows($vipss);
if($nvips!=0)
{
$exp=round($exp+$exp/100*30);
}
$exp=$udata['exp']+$exp;
mysql_query("UPDATE `users` SET `exp`='".$exp."' WHERE `id`='".$udata['id']."'");
}
}
}
header('location: ?');exit;
}
if(isset($_GET['bst']))
{
$ew=mysql_query("SELECT * FROM `clan_battle_b_bs` WHERE `kod`='".$bz['kod']."'");
$we=mysql_fetch_array($ew);
if($we['clan']!=$bz['clan'])
{
mysql_query("UPDATE `clan_battle_b_usr` SET `enemy`='1' WHERE `id`='".$bt['id']."'");
}
header('location: ?');exit;
}
$kill1=mysql_result(mysql_query("SELECT SUM(kil) FROM `clan_battle_b_usr` WHERE `kom`='".$bz['clan']."'"),0);
$kill2=mysql_result(mysql_query("SELECT SUM(kil) FROM `clan_battle_b_usr` WHERE `kom`='".$bz['enemy_clan']."'"),0);
$ku=mysql_num_rows(mysql_query("SELECT * FROM `clan_battle_b_usr` WHERE `kom`='".$bz['enemy_clan']."' and `kod`='".$bz['kod']."'"));
$ew=mysql_query("SELECT * FROM `clan_battle_b_bs` WHERE `kod`='".$bz['kod']."'");
$we=mysql_fetch_array($ew);
if($bt['status']==0)
{
if($kill1>=500)
{
mysql_query("UPDATE `clan_battle_b_usr` SET `status`='1' WHERE `status`='0' and `kom`='".$bz['clan']."'");
$gi1=mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id`='".$bz['clan']."'"));
$gi2=mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id`='".$bz['enemy_clan']."'"));
if($gi1['reit']>100 and $gi2['reit']>100)
{
if($gi1['reit']>$gi2['reit'])
{
$r=$gi1['reit']-$gi2['reit'];
if($r<floor($gi1['reit']/2))
{
$reit1=20;
}
else
{
$reit1=5;
}
}
else
{
$reit1=50;
}
}
elseif($gi1['reit']<100 and $gi2['reit']<100)
{
if($gi1['reit']>$gi2['reit'])
{
$r=$gi1['reit']-$gi2['reit'];
if($r<floor($gi1['reit']/2))
{
$reit1=20;
}
else
{
$reit1=5;
}
}
else
{
$reit1=50;
}
}
elseif($gi1['reit']>100 and $gi2['reit']<=100)
{
$reit1=0;
}
elseif($gi1['reit']<=100 and $gi2['reit']>100)
{
$reit1=75;
}
$rows21=mysql_num_rows(mysql_query("SELECT * FROM `msg_kont` WHERE `usr1`='2' and `usr2`='0'"));
if($rows21==0)
{
mysql_query("INSERT INTO `msg_kont` SET
`id`='',
`usr1`='2',
`usr2`='0',
`read`='1',
`time`='".time()."'
");
}else
{
$rows2=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='2'"));
mysql_query("UPDATE `msg_kont` SET `read`='1', `time`='".time()."' WHERE `usr2`='0' and `usr1`='2'");
}
$rows2=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='2'"));
$text='<font color=#ff2222>Бой БС: <a href=clans.php?id='.$gi1['id'].'><font color=#ffff00>'.$gi1['name'].'</font></a>('.$kill1.'; +'.$reit1.') VS
<a href=clans.php?id='.$gi2['id'].'><font color=#ffff00>'.$gi2['name'].'</font></a>('.$kill2.').</font>';
mysql_query("INSERT INTO `msg_dialog` SET
`id`='',
`dialog`='".$rows2['id']."',
`vhod`='1',
`time`='".time()."',
`text`='".$text."',
`usr`='2'
");
$totem=mysql_fetch_array(mysql_query("SELECT * FROM `clan_totem` WHERE `id`='1'"));
if($totem['clan']==$gi1['id'])
{
$reit1=floor($reit1+$reit1/100*50);
}
$reit2=$gi2['reit']-20;
$reit1=$gi1['reit']+$reit1;
if($reit2<0){$reit2=0;}
mysql_query("UPDATE `clan` SET `reit`='".$reit1."' WHERE `id`='".$gi1['id']."'");
mysql_query("UPDATE `clan` SET `reit`='".$reit2."' WHERE `id`='".$gi2['id']."'");
mysql_query("UPDATE `clan_battle_b_usr` SET `status`='2' WHERE `status`='0' and `kom`='".$bz['enemy_clan']."'");
mysql_query("DELETE FROM `clan_battle_b_bs` WHERE `clan`='".$bz['clan']."'");
mysql_query("DELETE FROM `clan_battle_b_bs` WHERE `clan`='".$bz['enemy_clan']."'");
$trs=time()+60;
mysql_query("UPDATE `clan_battle_b` SET `close`='".$trs."' WHERE `kod`='".$bz['kod']."'");
header('location: ?');exit;
}
if($kill2>=500)
{
mysql_query("UPDATE `clan_battle_b_usr` SET `status`='1' WHERE `status`='0' and `kom`='".$bz['enemy_clan']."'");
$gi1=mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id`='".$bz['clan']."'"));
$gi2=mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id`='".$bz['enemy_clan']."'"));
$reit1=$gi1['reit']-20;
if($gi2['reit']>100 and $gi1['reit']>100)
{
if($gi2['reit']>$gi1['reit'])
{
$r=$gi2['reit']-$gi1['reit'];
if($r<floor($gi2['reit']/2))
{
$reit2=20;
}
else
{
$reit2=5;
}
}
else
{
$reit2=50;
}
}
elseif($gi1['reit']<100 and $gi2['reit']<100)
{
if($gi2['reit']>$gi1['reit'])
{
$r=$gi2['reit']-$gi1['reit'];
if($r<floor($gi2['reit']/2))
{
$reit2=20;
}
else
{
$reit2=5;
}
}
else
{
$reit2=50;
}
}
elseif($gi2['reit']>100 and $gi1['reit']<=100)
{
$reit2=0;
}
elseif($gi2['reit']<=100 and $gi1['reit']>100)
{
$reit2=75;
}
$rows21=mysql_num_rows(mysql_query("SELECT * FROM `msg_kont` WHERE `usr1`='2' and `usr2`='0'"));
if($rows21==0)
{
mysql_query("INSERT INTO `msg_kont` SET
`id`='',
`usr1`='2',
`usr2`='0',
`read`='1',
`time`='".time()."'
");
}else
{
$rows2=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='2'"));
mysql_query("UPDATE `msg_kont` SET `read`='1', `time`='".time()."' WHERE `usr2`='0' and `usr1`='2'");
}
$rows2=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='2'"));
$text='<font color=#ff2222>Бой БС: <a href=clans.php?id='.$gi1['id'].'><font color=#ffff00>'.$gi1['name'].'</font></a>('.$kill2.') VS
<a href=clans.php?id='.$gi2['id'].'><font color=#ffff00>'.$gi2['name'].'</font></a>('.$kill2.'; +'.$reit2.').</font>';
mysql_query("INSERT INTO `msg_dialog` SET
`id`='',
`dialog`='".$rows2['id']."',
`vhod`='1',
`time`='".time()."',
`text`='".$text."',
`usr`='2'
");
$totem=mysql_fetch_array(mysql_query("SELECT * FROM `clan_totem` WHERE `id`='1'"));
if($totem['clan']==$gi2['id'])
{
$reit2=floor($reit2+$reit2/100*50);
}
$reit2=$gi2['reit']+$reit2;
if($reit1<0){$reit1=0;}
mysql_query("UPDATE `clan` SET `reit`='".$reit1."' WHERE `id`='".$gi1['id']."'");
mysql_query("UPDATE `clan` SET `reit`='".$reit2."' WHERE `id`='".$gi2['id']."'");
mysql_query("UPDATE `clan_battle_b_usr` SET `status`='2' WHERE `status`='0' and `kom`='".$bz['clan']."'");
mysql_query("DELETE FROM `clan_battle_b_bs` WHERE `clan`='".$bz['clan']."'");
mysql_query("DELETE FROM `clan_battle_b_bs` WHERE `clan`='".$bz['enemy_clan']."'");
$trs=time()+60;
mysql_query("UPDATE `clan_battle_b` SET `close`='".$trs."' WHERE `kod`='".$bz['kod']."'");
header('location: ?');exit;
}
}
include('files/head.php');
echo '
<div class="v2 brs bls v8 bts bbs p v12"><font color=#00ccff>
<img src=img/main/p6.png>'.$bt['hp'].' | '.$hpw.'
<font color=#ff0000>'.$bt['att'].'</font> | <font color=#ff0000>'.$bt['att2'].'</font>';
if($bt['enemy']!=0)
{
echo' | '.$en_name.' <img src=img/main/p6.png>'.$bts['hp'].'';
}
$q = mysql_query("SELECT COUNT(*) FROM `msg_kont` WHERE `usr1` = '".$udata['id']."' AND `read` = '1';");
$new_mail = mysql_result($q, 0);
if($new_mail > 0)
{
echo"
<a href="mail.php"><img src=img/main/e1.png></a>";
}
if($udata['clan']!=0)
{
$fridaa=mysql_query("SELECT * FROM `sectors` WHERE `clan`='".$udata['clan']."' and `att_clan`!='0'");
$fra=mysql_num_rows($fridaa);
if($fra!=0)
{
echo'<a href=clan.php?gi=ter><img src=img/main/st.png></a>';
}
}
if($we['clan']==0){$color='999999';}
elseif($we['clan']==$bz['clan']){$color='00ff00';}
elseif($we['clan']==$bz['enemy_clan']){$color='ff0000';}
echo '<br><img src=img/main/p11.png> <font color=#'.$color.'>'.$we['name'].'</font> <img src=img/main/p6.png>'.$we['hp'].'
<img src=img/main/e12.png>';
$time=$bz['close']-time();
$h=floor($time/3600);
$m=floor(($time-($h*3600))/60);
$s=$time-($h*3600)-($m*60);
$tim=$h.':'.$m.':'.$s;
echo '<font color=#0099ff><i>'.$tim.'</i></font><br>';
echo '<table width=100%><tr>
<td colspan=1 align=left><font color=#009900>свои:</font> <b>'.$kill1.'</b></td>
<td colspan=1 align=right><b>'.$kill2.'</b> <font color=#ff0000>:враги</font></td>
</tr></table>';
echo'</font></div>';
$giza=mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id`='".$udata['clan']."'"));
if($giza['gorn_time']>time() and $udata['gorn']==1)
{
echo '<div class="v6 rr rt rl p">'.$giza['gorn'].'<br>
<img src=img/main/e55.png><a href=clan.php?gorn_def>Закрыть</a>
</div>';
}
echo '<div class=v8><div class="v3 bts brs bls b p v12">Бой</div><div class="v2 bts brs bls bbs p t2">';
if($bt['status']==0)
{
if($bt['time_kill']>time())
{
echo '<img src=img/main/i25.png> <font color=#ff0000>Ваш персонаж мертв. Воскрешение через:</font><br>';
$time=$bt['time_kill']-time();
$h=floor($time/3600);
$m=floor(($time-($h*3600))/60);
$s=$time-($h*3600)-($m*60);
$tim=$h.':'.$m.':'.$s;
echo '<img src=img/main/i25.png> <font color=#00ff99>'.$tim.'</font>';
}
else
{
if($bt['enemy']==0)
{
echo '<table>
<tr>
<td><img src=img/mob/0.jpg></td>
<td> -<i>Нет противника.</i></td>
</tr>
</table>';
$tn=time();
$mobs=mysql_query("SELECT * FROM `mag` WHERE `usr`='".$udata['id']."' and `status`='on' ORDER BY `id`");
$rows=mysql_num_rows($mobs);
if($rows==0)
{
}
else
{
while($mag=mysql_fetch_array($mobs))
{
if($mag['mag']==1)
{
$name='заклинание удара';
}
if($mag['mag']==2)
{
$name='заклинание случайности';
}
if($mag['mag']==3)
{
$name='заклинание усиления';
}
if($mag['mag']==4)
{
$name='заклинание пробивания';
}
if($mag['mag']==5)
{
$name='заклинание стана';
}
if($mag['mag']==6)
{
$name='заклинание обороны';
}
if($mag['mag']==7)
{
$name='заклинание молний';
}
if($mag['mag']==8)
{
$name='заклинание исцеления';
}
if($mag['mag']==9)
{
$name='заклинание вампира';
}
if($mag['mag']==10)
{
$name='заклинание возврата';
}
if($mag['mag']==11)
{
$name='заклинание ослабления';
}
if($mag['mag']==12)
{
$name='заклинание барьера';
}
if($mag['mag']==13)
{
$name='заклинание сингулярности';
}
if($mag['mag']==14)
{
$name='заклинание хаоса';
}
if($mag['time']<=$tn)
{
echo '<a href=?mag='.$mag['mag'].'>
<div class="v2s p"><img src=img/main/b10.png> <font color=#ffff00>'.$name.'</font></div></a>';
}
else
{
$mag['time']=$mag['time']-time();
$mag['time']=$mag['time']." с.";
echo '<a href=?mag='.$mag['mag'].'>
<div class="v2s p"><img src=img/main/b10.png> <font color=#555500>'.$name.'</font><font color=#ffffff> ['.$mag['time'].']</font></div></a>';
}
}
}
$eq=mysql_query("SELECT * FROM `elic` WHERE `usr`='".$udata['id']."' and `tip`='hp' and `status`='on'");
$rowse=mysql_num_rows($eq);
if($rowse==0)
{
}
else
{
while($el=mysql_fetch_array($eq))
{
if($el['time']<=$tn)
{
echo '<img src=img/elic/'.$el['tip'].''.$el['ef'].'.png> <a href=?elic='.$el['id'].'>пить</a> ';
}
else
{
$el['time']=$el['time']-time();
if($el['time']<60){
$el['time']=$el['time']." с.</font>";
}
echo '<img src=img/elic/'.$el['tip'].''.$el['ef'].'.png> '.$el['time'].' ';
}
}
}
}
elseif($bt['enemy']==1)
{
$ew=mysql_query("SELECT * FROM `clan_battle_b_bs` WHERE `kod`='".$bz['kod']."'");
$we=mysql_fetch_array($ew);
echo '<table>
<tr>
<td><img src=img/mob/0.jpg></td>
<td> -<i>'.$we['name'].'</i><br>
<img src=img/main/p6.png>'.$we['hp'].'
</td>
</tr>
</table>';
echo '<a href=?kick>
<div class="v2s p"><img src=img/main/b8.png> <font color=#ffff00>бить Башню</font></div></a>';
$tn=time();
$mobs=mysql_query("SELECT * FROM `mag` WHERE `usr`='".$udata['id']."' and `status`='on' ORDER BY `id`");
$rows=mysql_num_rows($mobs);
if($rows==0)
{
}
else
{
while($mag=mysql_fetch_array($mobs))
{
if($mag['mag']==1)
{
$name='заклинание удара';
}
if($mag['mag']==2)
{
$name='заклинание случайности';
}
if($mag['mag']==3)
{
$name='заклинание усиления';
}
if($mag['mag']==4)
{
$name='заклинание пробивания';
}
if($mag['mag']==5)
{
$name='заклинание стана';
}
if($mag['mag']==6)
{
$name='заклинание обороны';
}
if($mag['mag']==7)
{
$name='заклинание молний';
}
if($mag['mag']==8)
{
$name='заклинание исцеления';
}
if($mag['mag']==9)
{
$name='заклинание вампира';
}
if($mag['mag']==10)
{
$name='заклинание возврата';
}
if($mag['mag']==11)
{
$name='заклинание ослабления';
}
if($mag['mag']==12)
{
$name='заклинание барьера';
}
if($mag['mag']==13)
{
$name='заклинание сингулярности';
}
if($mag['mag']==14)
{
$name='заклинание хаоса';
}
if($mag['time']<=$tn)
{
echo '<a href=?mag='.$mag['mag'].'>
<div class="v2s p"><img src=img/main/b10.png> <font color=#ffff00>'.$name.'</font></div></a>';
}
else
{
$mag['time']=$mag['time']-time();
$mag['time']=$mag['time']." с.";
echo '<a href=?mag='.$mag['mag'].'>
<div class="v2s p"><img src=img/main/b10.png> <font color=#555500>'.$name.'</font><font color=#ffffff> ['.$mag['time'].']</font></div></a>';
}
}
}
$eq=mysql_query("SELECT * FROM `elic` WHERE `usr`='".$udata['id']."' and `tip`='hp' and `status`='on'");
$rowse=mysql_num_rows($eq);
if($rowse==0)
{
}
else
{
while($el=mysql_fetch_array($eq))
{
if($el['time']<=$tn)
{
echo '<img src=img/elic/'.$el['tip'].''.$el['ef'].'.png> <a href=?elic='.$el['id'].'>пить</a> ';
}
else
{
$el['time']=$el['time']-time();
if($el['time']<60){
$el['time']=$el['time']." с.</font>";
}
echo '<img src=img/elic/'.$el['tip'].''.$el['ef'].'.png> '.$el['time'].' ';
}
}
}
}
else
{
echo '<table>
<tr>
<td>'.$img.'</td>
<td> -<i>'.$en_name.'</i><br>
<img src=img/main/p6.png>'.$bts['hp'].'
</td>
</tr>
</table>';
echo '<a href=?kick>
<div class="v2s p"><img src=img/main/b8.png> <font color=#ffff00>бить '.$en_name.'</font></div></a>';
$tn=time();
$mobs=mysql_query("SELECT * FROM `mag` WHERE `usr`='".$udata['id']."' and `status`='on' ORDER BY `id`");
$rows=mysql_num_rows($mobs);
if($rows==0)
{
}
else
{
while($mag=mysql_fetch_array($mobs))
{
if($mag['mag']==1)
{
$name='заклинание удара';
}
if($mag['mag']==2)
{
$name='заклинание случайности';
}
if($mag['mag']==3)
{
$name='заклинание усиления';
}
if($mag['mag']==4)
{
$name='заклинание пробивания';
}
if($mag['mag']==5)
{
$name='заклинание стана';
}
if($mag['mag']==6)
{
$name='заклинание обороны';
}
if($mag['mag']==7)
{
$name='заклинание молний';
}
if($mag['mag']==8)
{
$name='заклинание исцеления';
}
if($mag['mag']==9)
{
$name='заклинание вампира';
}
if($mag['mag']==10)
{
$name='заклинание возврата';
}
if($mag['mag']==11)
{
$name='заклинание ослабления';
}
if($mag['mag']==12)
{
$name='заклинание барьера';
}
if($mag['mag']==13)
{
$name='заклинание сингулярности';
}
if($mag['mag']==14)
{
$name='заклинание хаоса';
}
if($mag['time']<=$tn)
{
echo '<a href=?mag='.$mag['mag'].'>
<div class="v2s p"><img src=img/main/b10.png> <font color=#ffff00>'.$name.'</font></div></a>';
}
else
{
$mag['time']=$mag['time']-time();
$mag['time']=$mag['time']." с.";
echo '<a href=?mag='.$mag['mag'].'>
<div class="v2s p"><img src=img/main/b10.png> <font color=#555500>'.$name.'</font><font color=#ffffff> ['.$mag['time'].']</font></div></a>';
}
}
}
$eq=mysql_query("SELECT * FROM `elic` WHERE `usr`='".$udata['id']."' and `tip`='hp' and `status`='on'");
$rowse=mysql_num_rows($eq);
if($rowse==0)
{
}
else
{
while($el=mysql_fetch_array($eq))
{
if($el['time']<=$tn)
{
echo '<img src=img/elic/'.$el['tip'].''.$el['ef'].'.png> <a href=?elic='.$el['id'].'>пить</a> ';
}
else
{
$el['time']=$el['time']-time();
if($el['time']<60){
$el['time']=$el['time']." с.</font>";
}
echo '<img src=img/elic/'.$el['tip'].''.$el['ef'].'.png> '.$el['time'].' ';
}
}
}
}
$ew=mysql_query("SELECT * FROM `clan_battle_b_bs` WHERE `kod`='".$bz['kod']."'");
$we=mysql_fetch_array($ew);
if($we['clan']!=$bz['clan'])
{
echo '<br><img src=img/main/p12.png> <a href=?bst>Бить Башню</a>';
}
}
}
elseif($bt['status']==1)
{
echo '<img src=img/main/i25.png> <font color=#00ff99>Ваша команда выйграла этот поединок. Ваша награда:</font>';
echo '<div class="v5 v8 p">';
echo 'Вы славно сражались и принесли победу своей гильдии.';
echo'</div>';
echo '<img src=img/main/p12.png> <a href=?leave>Покинуть бой</a>';
}
elseif($bt['status']==2)
{
echo '<img src=img/main/i25.png> <font color=#ff0000>Ваша команда проиграла этот поединок. Ваша награда:</font>';
echo '<div class="v5 v8 p">';
echo 'Удача сегодня не на вашей стороне. Вы проиграли.';
echo'</div>';
echo '<img src=img/main/p11.png> <a href=?leave>Покинуть бой</a>';
}
echo '</div></div>';
$enemy=mysql_num_rows(mysql_query("SELECT * FROM `clan_battle_b_usr` WHERE `status`='0' and `kom`='".$bz['enemy_clan']."' and `kod`='".$bz['kod']."'"));
if($enemy!=0)
{
echo '<div class=v8><div class="v3 bts brs bls b p v12">Противники</div><div class="v2 bts brs bls bbs p t2">';
$eny=mysql_query("SELECT * FROM `clan_battle_b_usr` WHERE `status`='0' and `time_kill`<'".time()."' and `kom`='".$bz['enemy_clan']."' and `kod`='".$bz['kod']."'");
while($en=mysql_fetch_array($eny))
{
if($en['tip']=='usr')
{
$uss=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$en['usr']."'"));
echo ' <img src=img/main/c'.$uss['klass'].'.png> <img src=img/main/r'.$uss['rasa'].'.png> <a href=?enemy='.$en['id'].'><font color=#ffff00>'.$uss['usr'].'</font></a> [<img src=img/main/p6.png><font color=#ff0000>'.$en['hp'].'</font>] <img src=img/main/p10.png>'.$uss['lvl'].', ';
}
if($en['tip']=='pit')
{
$uss=mysql_fetch_array(mysql_query("SELECT * FROM `pit` WHERE `id`='".$en['pit']."' and `usr`='".$en['usr']."'"));
echo ' <a href=?enemy='.$en['id'].'><font color=#ff9900>'.$uss['name'].'</font></a> [<img src=img/main/p6.png><font color=#ff0000>'.$en['hp'].'</font>] <img src=img/main/p10.png>'.$uss['lvl'].', ';
}
if($en['tip']=='mob')
{
echo ' <a href=?enemy='.$en['id'].'><font color=#00ff99>'.$en['name'].'</font></a> [<img src=img/main/p6.png><font color=#ff0000>'.$en['hp'].'</font>], ';
}
}
echo '</div></div>';
}
$mobs=mysql_query("SELECT * FROM `log_clan_b` WHERE `usr`='".$udata['id']."' ORDER BY `id` DESC LIMIT 10");
$rows=mysql_num_rows($mobs);
if($rows==0)
{
}
else
{
echo '<div class=v8><div class="v3 bts brs bls b p v12">Лог боя:</div><div class="v2 bts brs bls bbs p t2">';
while($log=mysql_fetch_array($mobs))
{
echo $log['text'].'<br>';
}
}
}
echo '</div></div>';
echo '<div class="v3 bts brs bls b p v12"><font color=#998800>Лог игроков:</font></div><div class="v2 bts brs bls bbs p t2">';
$mobsq=mysql_query("SELECT * FROM `clan_battle_b_usr` WHERE `kom`='".$bz['clan']."' and `usr`>'1' and `status`!='2' and `tip`!='pit' ORDER BY `kil` DESC");
while($lus=mysql_fetch_array($mobsq))
{
$us=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$lus['usr']."'"));
echo '<img src=img/main/c'.$us['klass'].'.png> <img src=img/main/r'.$us['rasa'].'.png> <a href=info.php?id='.$us['id'].'>'.$us['usr'].'</a>
['.$lus['kil'].']<br>';
}
echo '</div>';
include('files/dwn.php');
?>