<?
$now=time();
include("inc/db_connect.php");
$stat = mysql_fetch_array(mysql_query("SELECT * FROM `players` WHERE user='".addslashes($user)."' AND pass='".addslashes($pass)."'"));
mysql_query("SET CHARSET cp1251");
if ($stat['bloked']) echo"<script>top.location='index.php?action=logout'</script>";
if ($stat[t_time]) { header("Location: prison.php"); exit; }
elseif ($stat['v_time']) { header("Location: ambulance.php"); exit; }
elseif ($stat['k_time']) { header("Location: academy.php"); exit; }
elseif ($stat['w_time']) { header("Location: works.php"); exit; }
elseif ($stat['o_time']>$now) { header("Location: repair.php"); exit; }
elseif ($stat[battle]) { header("Location: battle.php"); exit; }
elseif ($stat['room']<=200 && $stat['room']>=230) { header("Location: main.php"); exit; }
else {
mysql_query("UPDATE players SET lpv=$now WHERE user='".$stat['user']."'");
include("inc/main/changed.php");
$VaultInfo = mysql_fetch_array(mysql_query("SELECT * FROM `vault` WHERE id='".$stat['room']."'"));
if ($Heal) {
if ($stat['vault_move'] == 1) $msg = "Вы не можете лечиться во время перемещения!";
elseif ($stat['r_action'] == 1) $msg = "Вы не можете лечиться во время добычи руды!";
elseif ($stat['room'] == 200) $msg = "Здесь колодец пустой!";
else {
if ($VaultInfo['heal'] >= $now) $msg = "Кто-то оказался быстрее и выпил всю энергию из Колодца Жизни!";
else {
if ($stat['hp_now'] < $stat['hp_max']) {
$VaultInfo['heal'] = $now + 180;
mysql_query("UPDATE `vault` SET heal='".$VaultInfo['heal']."' WHERE id='".$VaultInfo['id']."'");
mysql_query("UPDATE `players` SET hp_now='".$stat['hp_max']."' WHERE user='".$stat['user']."'");
$stat['hp_now'] = $stat['hp_max'];
$msg = "Ваш уровень жизни полностью восстановлен!";
} else $msg = "Вы не нуждаетесь в лечении!";
}
}
}
if ($work) {
$instr = mysql_query("SELECT * FROM objects, slots WHERE objects.user='".$stat['user']."' AND slots.id=".$stat['id']." AND objects.tip=15 AND objects.min='1|0|0|0|0|0|0|0' AND objects.id IN (slots.3)");
if (mysql_num_rows ($instr)) {
$instrument = mysql_fetch_array($instr);
if ($stat[ustal_now]>=35) { // не устал
if ($stat['vault_move'] == 0) {
if ($stat['r_action'] == 0) {
$izn_instr = mysql_fetch_array(mysql_query("SELECT * FROM objects WHERE min='1|0|0|0|0|0|0|0' AND objects.tip=15 AND user='".$stat['user']."'"));
$instr_inf=explode("|",$izn_instr['inf']);
$iznos=($instr_inf[6]+1);
if ($instr_inf[7] > $iznos ) {
mysql_query("UPDATE objects SET inf='".$instr_inf['0']."|".$instr_inf['1']."|".$instr_inf['2']."|".$instr_inf['3']."|".$instr_inf['4']."|".$instr_inf['5']."|".$iznos."|".$instr_inf['7']."' WHERE id='".$izn_instr['id']."'");
}
else
{
mysql_query("UPDATE objects SET inf='".$instr_inf['0']."|".$instr_inf['1']."|".$instr_inf['2']."|".$instr_inf['3']."|".$instr_inf['4']."|".$instr_inf['5']."|".$iznos."|".$instr_inf['7']."' WHERE id='".$izn_instr['id']."'");
mysql_query("UPDATE slots set slots.3=0 WHERE slots.id=".$stat['id']."");
}
mysql_query("UPDATE players set r_time=$now+1800, r_action=1, ustal_now=ustal_now-35 where id=$stat[id]");
echo"<script LANGUAGE=\"JavaScript\">top.frames['main'].location = \"vault.php\";</SCRIPT>";
} else $msg = "Вы добываете руду!";
} else $msg = "Вы добываете руду!";
} else $msg="Да вы батенька заработались! Идите-ка посражайтесь.";
} else $msg="Без кирки добывать руду нельзя!.";
}
if ($stat['r_action'] == 1) {
if ($stat['r_time']-2 < $now) {
mysql_query("UPDATE `players` SET r_time=0, r_action=0 WHERE user='".$stat['user']."'");
$stat['r_time'] = 0;
$stat['r_action'] = 0;
$res=rand(0,9);
if ($res == 5) {
$resurs=array();
$resurs[0]="alexandrit|Александрит";
$resurs[1]="almaz|Алмаз";
$resurs[2]="amazonit|Амазонит";
$resurs[3]="biruza|Бирюза";
$resurs[4]="pirit|Пирит";
$resurs[5]="opal|Опал";
$resurs[6]="rubin|Рубин";
$resurs[7]="sapfir|Сапфир";
$res_type=$resurs[rand(0,7)];
mysql_query("INSERT INTO `objects` (`user`,`inf`,`min`,`tip`,`time`, `about`) VALUES ('".$stat['user']."','".$res_type."|10|0|0|0|0|1','0|0|0|0|0|0|0|0','16','".time()."', 'Неограненный камень')");
require_once("inc/chat/functions.php");
insert_msg("Поздравляем! Вы добыли драгоценный камень в кол-ве [b][u]1 ед[/u][/b]!","","","1",$stat['user'],"",$stat['room']);
}
else {
mysql_query("INSERT INTO `objects` (`user`,`inf`,`min`,`tip`,`time`, `about`) VALUES ('".$stat['user']."','ruda|Руда|4|0|0|0|0|1','0|0|0|0|0|0|0|0','16','".time()."', 'Руда')");
require_once("inc/chat/functions.php");
insert_msg("Вы добыли руду в кол-ве [b][u]1 ед[/u][/b]!","","","1",$stat['user'],"",$stat['room']);
}
exit;
}
}
if ($Attack) {
if ($stat['vault_move'] == 1) $msg = "Вы не можете напасть во время перемещения!";
elseif ($stat['r_action'] == 1) $msg = "Вы не можете напасть во время добычи руды!";
else {
if (empty($login)) $msg = "Укажите логин!";
else {
$chl=mysql_fetch_array(mysql_query("SELECT * FROM players where user='".addslashes($login)."'"));
if ($chl['user'] == $stat['user']) $msg="Нападение на самого себя - это уже мазохизм...";
elseif ($chl['room'] == 200) $msg="Здесь не место для битв!";
elseif ($chl['immun'] > $now) $nms="На персонаже уже стоит защита от нападения!";
elseif ($chl['r_action'] == 1) $msg="Он занят!";
elseif ($ctime-$chl['lpv'] > 180 && $chl['rank'] != 60) $nms="Персонаж [u]$login[/u] отстутствует!";
elseif ($chl['room'] < 200 || $chl['room'] > 230) $nms="Для нападния Вам необходимо находится в одной комнате!";
elseif ($stat['hp_now'] < (($stat['hp']+$stat['vitality']*5)*0.33)) $msg="Вы слишком ослаблены для боя!";
elseif ($chl['hp_now'] <= 5 && $chl['rank']<>60) $msg="Персонаж [u]$login[/u] слишком слаб для поединка!";
elseif (((time()-$chl['lpv'])<10) && ($chl['battle'] == $chl['last_battle'] || !$chl['battle']) && $chl['rank']==60) $msg="Бот [u]".$chl['user']."[/u] еще не восстановил свой уровень жизни!";
else {
require_once("inc/chat/functions.php");
insert_msg("Разъярённый [b][u]$stat[user][/u][/b] собрался с силами и напал на Вас!","","","1",$chl['user'],"",$chl['room']);
$battime="$now";
if ($chl['rank']==60 && ($chl['battle'] == $chl['last_battle'] || !$chl['battle'])) {
$_obj=mysql_fetch_array(mysql_query("SELECT SUM(objects.`hp`) as `hp`, SUM(objects.`vitality`) as `vitality` FROM slots, objects WHERE slots.id='".$chl['id']."' AND objects.user='".$chl['user']."' AND objects.id IN (slots.1,slots.2,slots.3,slots.4,slots.5,slots.6,slots.7,slots.8,slots.9,slot
s.10,slots.11,slots.12,slots.13,slots.14,slots.15,slots.16,slots.17,slots.18,slo
t
s.19) LIMIT 1"));
$MySkills = explode("|",$chl['rase_skill']);
$chl['gnom']=$MySkills['3']*5;
$chl['vitality']+=$_obj['vitality'];
$chl['hp_max']=ceil(($chl['vitality']*5+$_obj['hp'])*(1+($chl['gnom']/100)));
$chl['hp_now']=$chl['hp_max'];
mysql_query ("UPDATE `players` SET `hp_now` = '".$chl['hp_now']."', `battle` = NULL, `lpv`='".time()."' WHERE `id` = '".$chl['id']."'");
$chl['battle'] = NULL;
}
if ($chl['battle']) {
$prt=mysql_fetch_array(mysql_query("SELECT side as side,time as time from participants where time=$chl[battle] and id=$chl[id]"));
switch ($prt['side']) {
case 0: $side=1; break;
case 1: $side=0; break;
}
$levels=mysql_fetch_array(mysql_query("SELECT base FROM levels WHERE level=$stat[level]"));
mysql_query("INSERT INTO participants (`time`, `id`, `side`, `base`,`hp`) values('$prt[time]', '$stat[id]', '$side', '$levels[base]', $stat[hp_now])");
$b_id_id=mysql_fetch_array(mysql_query("SELECT MAX(id) as id from battles where offer=$prt[time]"));
$b_id_id['id']+=1;
mysql_query("insert into battles (offer, time, id, attacker, defender, kick, block, type, damage, comment) values ($prt[time], '$battime', '$b_id_id[id]', '', '', '', '', NULL, '', '<script language=JavaScript>show_inf(\"$stat[user]\",\"$stat[id]\",\"$stat[level]\",\"$stat[rank]\",\"$stat[tribe]\");</script> вмешался в поединок!')");
$b_id=$prt[time];
mysql_query("UPDATE players, offers SET players.battle=".$prt['time'].", players.side=".$side.", offers.type=2 where players.id=$stat[id] && offers.time=$prt[time]");
} else {
$bdate=date("d.m.y H:i",$battime);
mysql_query("INSERT INTO offers (time, type, size_left, size_right, done, timeout) values($battime+600,1,1,'1','1','180')");
$levels_my = mysql_fetch_array(mysql_query("SELECT base FROM levels WHERE level=$stat[level]"));
$levels_opp = mysql_fetch_array(mysql_query("SELECT base FROM levels WHERE level=$chl[level]"));
mysql_query("INSERT INTO participants (time, id, side, hp, base) values($battime+600, '$stat[id]', '0', '".$stat['hp_now']."', '".$levels_my['base']."')");
mysql_query("INSERT INTO participants (time, id, side, hp, base) values($battime+600, '$chl[id]', '1', '".$chl['hp_now']."', '".$levels_opp['base']."')");
mysql_query("insert into battles (offer, time, id, attacker, defender, kick, block, type, damage, comment) values ($battime, $battime, '0', '', '', '', '', NULL, '', '[i]Часы показывали [u]$bdate[/u] когда бой между [/i]<font color=CFA87A>[b]$stat[user][/b]</font> и <font color=679958>[b]$chl[user][/b]</font> [i]начался![/i]')");
mysql_query("update players set battle=$battime+600, side=0 where id='$stat[id]'");
mysql_query("update players set battle=$battime+600, side=1 where id='$chl[id]'");
$b_id=$battime;
}
echo"<script>parent.main.location=\"battle.php?tmp=\"+Math.random();\"\"</script>";
}
}
}
}
// Переход
if ($GoIn && ($GoIn == "top" || $GoIn == "bottom" || $GoIn == "left" || $GoIn == "right")) {
if ($stat['vault_move'] == 1) $msg = "Вы уже перемещаетесь!";
elseif ($stat['r_action'] == 1) $msg = "Вы добываете руду!";
else {
$GoInfo = mysql_fetch_array(mysql_query("SELECT * FROM `vault` WHERE id='".$VaultInfo[$GoIn.'_id']."'"));
if ($GoInfo['id']) {
$stat['vault_time'] = $now + $GoInfo['time'];
$stat['vault_room'] = $GoInfo['id'];
$stat['vaul_move'] = 1;
mysql_query("UPDATE `players` SET vault_room='".$GoInfo['id']."', vault_time='".$stat['vault_time']."', vault_move=1 WHERE user='".$stat['user']."'");
$GoToText = "Топаем в [b][u]".$GoInfo['title']."[/u][/b]";
}
}
}
if ($stat['vault_move'] == 1) {
if ($stat['vault_time']-2 < $now) {
mysql_query("UPDATE `players` SET room=vault_room, vault_room=0, vault_time=0, vault_move=0 WHERE user='".$stat['user']."'");
$_ROOM['TO_CHANGE'] = $stat['vault_room'];
include("inc/rooms.php");
$stat['vault_time'] = 0;
$stat['vault_room'] = 0;
$stat['vaul_move'] = 0;
echo"
<script LANGUAGE=\"JavaScript\">
<!--
top.frames['main'].location = \"vault.php\";
top.frames['voc_who_visible'].location = top.frames['voc_who_visible'].location;
top.frames['voc_who'].location = \"chat/who.php?session=$session\";
top.frames['chat'].location = top.frames['chat'].location;
//-->
</SCRIPT>
";
exit;
}
}
$VaultRoom['200'] = "Врата Подземелья";
$VaultRoom['201'] = "Большой Коридор";
$VaultRoom['202'] = "Зал Странствий";
$VaultRoom['203'] = "Зал Призраков";
$VaultRoom['204'] = "Зал Бездны";
$VaultRoom['205'] = "Тупиковый Тоннель";
$VaultRoom['206'] = "Зал Хаоса";
$VaultRoom['207'] = "Зал Призраков №2";
$VaultRoom['208'] = "Оружейный Зал";
$VaultRoom['209'] = "Зал Мучений";
$VaultRoom['210'] = "Зал Сумрака";
$VaultRoom['211'] = "Зал Добычи";
$widthhp=$stat['hp_now']/$stat['hp_max']*181;
if ($widthhp==0) $widthhp+=2;
if ($widthhp==1) $widthhp+=1;
if ($widthhp>1) $widthhp-=1;
include("inc/html_header.php");
echo"<body bgcolor=#EBEDEC leftmargin=0 topmargin=0>
<DIV id=hint1></DIV>
<div id=mainform style='position:absolute; left:30px; top:30px'></div>";
echo"<script LANGUAGE=\"JavaScript\" SRC=\"i/time.js\"></SCRIPT>
<script LANGUAGE=\"JavaScript\" SRC=\"i/show_inf.js\"></SCRIPT>
<script LANGUAGE=\"JavaScript\" SRC=\"i/login_form.js\"></SCRIPT>";
print"<table width=100% cellspacing=0 cellpadding=5 border=0>
<tr>
<TD width=1></TD>
<td width=600 valign=top>
<TABLE cellspacing=0 cellpadding=0>
<tr>
<TD valign=top>
<script language=JavaScript>
show_inf('$stat[user]','$stat[id]','$stat[level]','$stat[rank]','$stat[tribe]');
</SCRIPT>
</TD>
<TD WIDTH=10></TD>
<TD valign=top>
<table cellspacing=0 cellpadding=0 border=0 align=center height=12>
<tr>
<td width=200 title='Уровень жизни: $stat[hp_now]/$stat[hp_max]' align=left valign=bottom width=200><img src=i/vault/navigation/hp/_helth.gif width='10' height=10 border=0 alt='Уровень жизни: $stat[hp_now]/$stat[hp_max]'><img src=i/vault/navigation/hp/helth.gif height='10' width='$widthhp' border=0 alt='Уровень жизни: $stat[hp_now]/$stat[hp_max]'><img src=i/vault/navigation/hp/_helth_.gif width='10' height=10 border=0 alt='Уровень жизни: $stat[hp_now]/$stat[hp_max]'></td>
</tr>
</table>
</TD>
<TD WIDTH=5></TD>
<TD valign=top><FONT COLOR=RED>[b]$stat[hp_now] / $stat[hp_max][/b]</FONT></TD>
</TR>
</TABLE>
</td>
<td align=right valign=top>
<img src='i/refresh.gif' style='CURSOR: Hand' alt='Обновить' onclick='window.location.href=\"vault.php?tmp=\"+Math.random();\"\"'>";
if ($stat['room'] == 200) echo"
<img src='i/back.gif' style='CURSOR: Hand' alt='Вернуться' onclick='window.location.href=\"world.php?room=105&tmp=\"+Math.random();\"\"'>";
echo"</td>
</tr>
</table>";
echo"
<table width=100% cellspacing=0 cellpadding=3 border=0>
<tr>
<td align=right>
<center><font class=title>".$VaultInfo['title']."</font></center>
";
if (!empty($msg)) echo"<center><font color=red>[b]$msg[/b]</font></center>
";
echo"
<fieldset style='WIDTH: 98.6%'><legend>Территория подземелья</legend>
<table width=100% cellspacing=0 cellpadding=5>
<tr>
<td align=center>
<table cellspacing=0 cellpadding=0 border=0 width=100%>
<tr>
<td width=170 align=left valign=top>
<table cellspacing=0 cellpadding=5 style='border-style: outset; border-width: 2' border=1 width=150>
<tr>
<td align=center>
[b]Навигация[/b]<HR color=silver>
<table cellspacing=0 cellpadding=0 border=0>
<tr height=45>
<td width=45></td><td width=45 align=center valign=center><IMG SRC='i/vault/navigation/";
if ($VaultInfo['top_id']) echo"active/top.gif' onclick='top.frames[\"main\"].location = \"vault.php?GoIn=top&\"+Math.random();' alt='Перейти в ".$VaultRoom[$VaultInfo['top_id']]."' style='CURSOR: Hand'"; else echo"n_active/top.gif' alt='Нет прохода'";
echo"></td><td width=45></td>
</tr>
<tr height=45>
<td width=45 align=center valign=center><IMG SRC='i/vault/navigation/";
if ($VaultInfo['left_id']) echo"active/left.gif' onclick='top.frames[\"main\"].location = \"vault.php?GoIn=left&\"+Math.random();' alt='Перейти в ".$VaultRoom[$VaultInfo['left_id']]."' style='CURSOR: Hand'"; else echo"n_active/left.gif' alt='Нет прохода'";
echo"></td><td width=45 align=center valign=center><IMG SRC='i/vault/navigation/center.gif'></td><td width=45 align=center valign=center><IMG SRC='i/vault/navigation/";
if ($VaultInfo['right_id']) echo"active/right.gif' onclick='top.frames[\"main\"].location = \"vault.php?GoIn=right&\"+Math.random();' alt='Перейти в ".$VaultRoom[$VaultInfo['right_id']]."' style='CURSOR: Hand'"; else echo"n_active/right.gif' alt='Нет прохода'";
echo"></td>
</tr>
<tr height=45>
<td width=45></td><td width=45 align=center valign=center><IMG SRC='i/vault/navigation/";
if ($VaultInfo['bottom_id']) echo"active/bottom.gif' onclick='top.frames[\"main\"].location = \"vault.php?GoIn=bottom&\"+Math.random();' alt='Перейти в ".$VaultRoom[$VaultInfo['bottom_id']]."' style='CURSOR: Hand'"; else echo"n_active/bottom.gif' alt='Нет прохода'";
echo"></td><td width=45></td>
</tr>
</table>";
if ($stat['vault_time'] > $now) {
echo"<HR color=silver>Топаем в [b][u]".$VaultRoom[$stat[vault_room]]."[/u][/b]<HR color=silver><tABLE cellspacing=0 cellpadding=0><tr><td>Ещё:</td><td>[b][size="1"]<div id=move></div>[/size][/b]<script>ShowTime('move',",$stat['vault_time']-$now+rand(1,3),",1);</script></td></tr></table>";
}
if ($stat['r_time'] > $now) {
echo"<HR color=silver>Добываем руду<HR color=silver><tABLE cellspacing=0 cellpadding=0><tr><td>Ещё:</td><td>[b][size="1"]<div id=know></div>[/size][/b]<script>ShowTime('know',",$stat['r_time']-$now,",1);</script></td></tr></table>";
}
echo"
</td>
</tr>
</table>
</td>
<td align=center valign=top>
".$VaultInfo['text'];
$YES = 0;
if ($YES) {
echo"<HR color=silver>
<TABLE cellspacing=0 cellpadding=0 border=0 width=100%>
<TR>
<TD align=left>
[b][i]В комнате разбросаны предметы:[/i][/b]
</TD>
</TR>
</TABLE>
";
}
echo"</td>
<td width=170 align=right valign=top>
<table cellspacing=0 cellpadding=5 style='border-style: outset; border-width: 2' border=1 width=150>
<tr>
<td align=center >
[b]Действия[/b]<HR color=silver>
<input type=button class=input value='Нападение' style='WIDTH: 120px' onclick=\"java script:ShowForm('Нападение','vault.php?Attack=$now','','','1','attack','1','0');\"><HR color=silver>
<input type=button class=input value='Добыча руды' style='WIDTH: 120px' onclick='top.frames[\"main\"].location = \"vault.php?work=\"+Math.random();\"\"'><HR color=silver>
<input type=button class=input value='Колодец Жизни' style='WIDTH: 120px'";
if ($VaultInfo['heal'] >= $now) echo" disabled"; else echo" onclick='top.frames[\"main\"].location = \"vault.php?Heal=\"+Math.random();'";
echo">
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</fieldset>
";
echo"</td>
</tr>
</table>
";
}
#[b]<FONT color=red>Пока злой <img src='i/align20.gif' width=12 height=12>Демон [/b][666] [url="'inf.php?1000'"]<img src='i/inf.gif'>[/url][b] по ту сторону ворот полон сил, Вы не сможете попасть в подземелье.
Но 10.01.2006 он готов будет пустить в подземелье 10 отважных рыцарей на бой с ним.
#Ждать осталось совсем не много. Не сойди с пути.</FONT>[/b]
#
?>
<BODY bgcolor=EBEDEC leftmargin=0 topmargin=0 background='i/backgrounds/vault.jpg' style='background-attachment: fixed;'>