Файл: pdz_b.php
Строк: 195
<?
define('PROTECTOR', 1);
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
$textl='Подземелья';
include($path.'files/core.php');
$npdz=mysql_num_rows(mysql_query("SELECT * FROM `pdz_usr` WHERE `usr`='".$udata['id']."'"));
if($npdz==0)
{
header('location: pdz.php');exit;
}
$mobs=mysql_query("SELECT * FROM `craft` WHERE `usr`='".$udata['id']."'");
$rows=mysql_num_rows($mobs);
if($rows!=0)
{
header('location: work.php');exit;
}
$mobs2=mysql_query("SELECT * FROM `avan_usr` WHERE `usr`='".$udata['id']."'");
$rows2=mysql_num_rows($mobs2);
if($rows2!=0)
{
header('location: avan.php');exit;
}
$mobs3=mysql_query("SELECT * FROM `battle` WHERE `usr`='".$udata['id']."'");
$rows3=mysql_num_rows($mobs3);
if($rows3!=0)
{
header('location: battle.php');exit;
}
$mobs4=mysql_query("SELECT * FROM `ohota` WHERE `usr`='".$udata['id']."'");
$rows4=mysql_num_rows($mobs4);
if($rows4!=0)
{
header('location: b_oh.php');exit;
}
$mobs5=mysql_query("SELECT * FROM `okr_usr` WHERE `usr`='".$udata['id']."'");
$rows5=mysql_num_rows($mobs5);
if($rows5!=0)
{
header('location: b_okr.php');exit;
}
$mobs6=mysql_query("SELECT * FROM `str_usr` WHERE `usr`='".$udata['id']."'");
$rows6=mysql_num_rows($mobs6);
if($rows6!=0)
{
header('location: b_str.php');exit;
}
$mobs7=mysql_query("SELECT * FROM `terr_usr` WHERE `usr`='".$udata['id']."'");
$rows7=mysql_num_rows($mobs7);
if($rows7!=0)
{
header('location: terr_b.php');exit;
}
$mobs8=mysql_query("SELECT * FROM `arena_m_usr` WHERE `usr`='".$udata['id']."'");
$rows8=mysql_num_rows($mobs8);
if($rows8!=0)
{
header('location: ar_m_b.php');exit;
}
$mobs8=mysql_query("SELECT * FROM `arena_duel_usr` WHERE `usr`='".$udata['id']."' and `ok`='2'");
$rows8=mysql_num_rows($mobs8);
if($rows8!=0)
{
header('location: ar_d_b.php');exit;
}
$mobs9=mysql_query("SELECT * FROM `arena_usr` WHERE `usr`='".$udata['id']."'");
$rows9=mysql_num_rows($mobs9);
if($rows9!=0)
{
header('location: ar_bz.php');exit;
}
$bt=mysql_fetch_array(mysql_query("SELECT * FROM `pdz_usr` WHERE `usr`='".$udata['id']."'"));
$pdz_kom=mysql_fetch_array(mysql_query("SELECT * FROM `pdz_kom` WHERE `id`='".$bt['arr']."'"));
$pdz=mysql_fetch_array(mysql_query("SELECT * FROM `pdz` WHERE `id`='".$pdz_kom['pdz']."'"));
$pe=mysql_query("SELECT * FROM `pdz_usr` WHERE `arr`='".$pdz_kom['id']."' and `tip`='usr'");
$numpe=mysql_num_rows($pe);
if($pdz_kom['status']!=0)
{
header('location: pdz_bt.php');exit;
}
if(isset($_GET['leave']))
{
if($udata['id']==$pdz_kom['lider'])
{
mysql_query("DELETE FROM `pdz_usr` WHERE `arr`='".$pdz_kom['id']."'");
mysql_query("DELETE FROM `pdz_kom` WHERE `id`='".$pdz_kom['id']."'");
}
else
{
mysql_query("DELETE FROM `pdz_usr` WHERE `usr`='".$udata['id']."'");
}
header('location: pdz.php');exit;
}
if(isset($_GET['start']))
{
if($udata['id']==$pdz_kom['lider'])
{
if($numpe>=1)
{
if($pdz_kom['lvl']==10){$pmon=50;$pkl=10;$pjet=20;}
if($pdz_kom['lvl']==15){$pmon=70;$pkl=13;$pjet=35;}
if($pdz_kom['lvl']==20){$pmon=90;$pkl=16;$pjet=50;}
if($pdz_kom['lvl']==25){$pmon=130;$pkl=20;$pjet=70;}
if($pdz_kom['lvl']==30){$pmon=170;$pkl=24;$pjet=90;}
if($pdz_kom['lvl']==33){$pmon=220;$pkl=28;$pjet=120;}
if($pdz_kom['lvl']==36){$pmon=280;$pkl=32;$pjet=150;}
if($pdz_kom['lvl']==36){$pmon=350;$pkl=36;$pjet=190;}
if($pdz_kom['lvl']==39){$pmon=400;$pkl=40;$pjet=235;}
if($pdz_kom['lvl']==42){$pmon=450;$pkl=44;$pjet=280;}
if($pdz_kom['lvl']==45){$pmon=500;$pkl=48;$pjet=325;}
if($pdz_kom['lvl']==47){$pmon=550;$pkl=52;$pjet=380;}
if($pdz_kom['lvl']==50){$pmon=600;$pkl=60;$pjet=420;}
if($pdz_kom['voln']==3){$pmon=$pmon;$pkl=$pkl;$pjet=$pjet;}
elseif($pdz_kom['voln']==5){$pmon=round($pmon+$pmon/100*25);$pkl=round($pkl+$pkl/100*10);$pjet=round($pjet+$pjet/100*25);}
elseif($pdz_kom['voln']==7){$pmon=round($pmon+$pmon/100*40);$pkl=round($pkl+$pkl/100*20);$pjet=round($pjet+$pjet/100*40);}
elseif($pdz_kom['voln']==10){$pmon=round($pmon+$pmon/100*65);$pkl=round($pkl+$pkl/100*30);$pjet=round($pjet+$pjet/100*65);}
elseif($pdz_kom['voln']==15){$pmon=round($pmon+$pmon/100*85);$pkl=round($pkl+$pkl/100*40);$pjet=round($pjet+$pjet/100*85);}
elseif($pdz_kom['voln']==20){$pmon=round($pmon+$pmon/100*110);$pkl=round($pkl+$pkl/100*55);$pjet=round($pjet+$pjet/100*110);}
mysql_query("UPDATE `pdz_kom` SET `status`='1', `pmon`='".$pmon."', `pkl`='".$pkl."', `pjet`='".$pjet."' WHERE `id`='".$pdz_kom['id']."'");
$mobs1=mysql_query("SELECT * FROM `pdz_mb` WHERE `skill`='0' and `pdz`='".$pdz_kom['pdz']."'");
$mob1=mysql_fetch_array($mobs1);
$neb_mob_num1=mysql_num_rows(mysql_query("SELECT * FROM `pdz_mob` WHERE `arr`='".$pdz_kom['pdz']."'"));
if($neb_mob_num1==0)
{
for($neb_mob_num1=0; $neb_mob_num1++<5;)
{
$hp=$pdz_kom['lvl']*$mob1['hp'];
$sila=$pdz_kom['lvl']*$mob1['sila'];
$arm=$pdz_kom['lvl']*$mob1['arm'];
$ss=$pdz_kom['lvl']*$mob1['st_sila'];
if($pdz_kom['sl']==1){$hp=$hp*1;$sila=$sila*1;$arm=$arm*1;$ss=$ss*1;}
elseif($pdz_kom['sl']==2){$hp=$hp*1.4;$sila=$sila*1.3;$arm=$arm*1.2;$ss=$ss*1.3;}
elseif($pdz_kom['sl']==3){$hp=$hp*2;$sila=$sila*1.7;$arm=$arm*1.5;$ss=$ss*1.7;}
elseif($pdz_kom['sl']==4){$hp=$hp*3;$sila=$sila*2.2;$arm=$arm*1.8;$ss=$ss*2.2;}
elseif($pdz_kom['sl']==5){$hp=$hp*4.3;$sila=$sila*3;$arm=$arm*2.2;$ss=$ss*3;}
elseif($pdz_kom['sl']==6){$hp=$hp*6;$sila=$sila*4;$arm=$arm*2.7;$ss=$ss*4;}
if($pdz_kom['lvl']<=15){$hp=floor($hp/2);$sila=floor($sila/2);$arm=floor($arm/2);$ss=floor($ss/2);}
mysql_query("INSERT INTO `pdz_mob` SET
`id`='',
`arr`='".$pdz_kom['id']."',
`tip`='mob',
`name`='".$mob1['name']."',
`hp`='".$hp."',
`hp_max`='".$hp."',
`arm`='".$arm."',
`sila`='".$sila."',
`st_sila`='".$ss."',
`skill`='".$mob1['skill']."'
");
}
}
$mobsq=mysql_query("SELECT * FROM `pdz_usr` WHERE `arr`='".$pdz_kom['id']."' and `tip`!='pit'");
while($lus=mysql_fetch_array($mobsq))
{
$t=date('H');
mysql_query("INSERT INTO `pdz_blok` SET
`id`='',
`usr`='".$lus['usr']."',
`pdz`='".$pdz['id']."',
`t`='".$t."'
");
}
}
else
{
}
}
header('location: ?');exit;
}
include($path.'files/head.php');
include($path.'files/zag.php');
echo '<table width=100%>
<tr>
<td width=35%>
<a href=game.php><div style="background: #882222; border-radius: 7px 0 0 7px" class="m p bts bbs brs bls" align=center>Главная</div></a>
</td><td>';
echo '<a href=?><div class="line bts brs bls bbs p m" style="border-radius: 0 7px 7px 0">
<font color=#ffffff>Подземелья
</font>
</div></a></td></tr></table>';
echo '<div class="bat bts brs bls bbs p">';
$lider=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$pdz_kom['lider']."'"));
if($pdz_kom['sl']==1){$c='#888888';}
elseif($pdz_kom['sl']==2){$c='#22ff22';}
elseif($pdz_kom['sl']==3){$c='#ff22ff';}
elseif($pdz_kom['sl']==4){$c='#ffff22';}
elseif($pdz_kom['sl']==5){$c='#ff2222';}
echo '
<div style="background:url(img/pdz/'.$pdz['img'].'.png) 50% 0 no-repeat; background-size: cover">
<table width=100%>
<tr><td>
<div class="p" style="background: #222222; opacity: 0.8" align=center><font color='.$c.'><b>'.$pdz['name'].'</b></font> ('.$pdz_kom['lvl'].'/'.$pdz_kom['voln'].')</div>
</td></tr></table>
<div style=" padding: 35px">';
echo '</div>';
echo'</div>';
echo '<table width=100%>';
echo '<tr>';
echo '<td width=50%>';
echo'<a href=?start><div style="position: relative;
font-weight: bold;
color: #ffff00;
text-decoration: none;
text-shadow: 0 -1px 1px #cc5500;
user-select: none;
padding: 3px 0 3px 3px;
outline: none;
border-radius: 1px;
background: rgb(0,120,150);
background-size: 100% 100%, auto;
background-position: 50% 50%;
box-shadow: inset rgb(0,170,200) 0 -1px 1px, inset 0 1px 1px rgb(0,170,200), rgb(0,170,200) 0 0 0 1px, #000 0 10px 15px -10px;
margin-left: 5px;
margin-right: 5px;
margin-top: 4px; text-align: center">Начать</div></a>';
echo '</td>';
echo '<td width=50%>';
echo'<a href=?leave><div style="position: relative;
font-weight: bold;
color: #ffff00;
text-decoration: none;
text-shadow: 0 -1px 1px #cc5500;
user-select: none;
padding: 3px 0 3px 3px;
outline: none;
border-radius: 1px;
background: rgb(0,120,0);
background-size: 100% 100%, auto;
background-position: 50% 50%;
box-shadow: inset rgb(0,170,0) 0 -1px 1px, inset 0 1px 1px rgb(0,170,0), rgb(0,170,0) 0 0 0 1px, #000 0 10px 15px -10px;
margin-left: 5px;
margin-right: 5px;
margin-top: 4px; text-align: center"><font color=#ff2222>';
if($udata['id']==$pdz_kom['lider'])
{
echo 'Распустить';
}
else
{
echo 'Покинуть';
}
echo'</font></div></a>';
echo '</td>';
echo '</tr>';
echo '</table>';
echo '</div></div>';
echo '<div class="v8"><div class="line m bbs bts brs bls b p v12">Участники</div>
<div class="bat bts brs bls bbs p t2">';
while($pdz_usr=mysql_fetch_array($pe))
{
$us=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$pdz_usr['usr']."'"));
if($us['admin']>0 and $us['admin']<6)
{
echo '<img src=img/main/md.png> ';
}
elseif($us['admin']>5)
{
echo '<img src=img/main/admin.png> ';
}
echo '<img src=img/main/c'.$us['klass'].'.png> <img src=img/main/r'.$us['rasa'].'.png> ';
echo '<a href=info.php?id='.$us['id'].'>'.$us['usr'].'</a> <img src=img/main/p10.png> '.$us['lvl'].'<br>';
}
echo '</div></div>';
include('files/down.php');
?>