<?
########################################
# Создал kpachbiu 22.09.2009 #
# Изменил #
########################################
#define('INSIDE', true);
$now=time();
include("inc/db_connect.php");
$back="<input type=button value=Вернуться onclick='window.location.href=\"street4.php?tmp=\"+Math.random();\"\"' class=standbut>";
$stat = mysql_fetch_array(mysql_query("SELECT * FROM `players` WHERE `user` = '".$_COOKIE['user']."' AND `pass` = '".$_COOKIE['pass']."' LIMIT 1"));
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']) { header("Location: repair.php"); exit; }
elseif ($stat['r_time']) { header("Location: vault.php"); exit; }
elseif ($stat[battle]) { header("Location: battle.php"); exit; }
elseif ($stat['room']!= "2" ) { header("Location: main.php"); exit; }
else {
mysql_query("UPDATE players SET lpv=$now WHERE user='".$stat['user']."'");
include("inc/main/changed.php");
if (isset($_GET['attack'])) {
$result=(mysql_query("SELECT * FROM `fight_with_clon` WHERE user='".mysql_real_escape_string($stat['user'])."'")) OR die(mysql_error());
$query=mysql_num_rows($result);
//echo" в таблице ".mysql_num_rows($result)."записей";
if ($query == 0) {
$create=mysql_query("INSERT INTO 'fight_with_clon' SELECT * FROM 'players' WHERE user='".mysql_real_escape_string ($stat['user'])."'");
echo" в таблице ".mysql_num_rows($result)."записей".$stat['user']."";
} else
//$select=("SELECT * FROM 'fight_with_clon' WHERE user='".mysql_real_escape_string($stat['user'])."'");
$chl=mysql_fetch_array($result);
//if ($chl['user'] == $stat['user']) $msg="Нападение на самого себя - это уже мазохизм...";
//elseif ($chl['rank'] !=60) $msg="Персонаж [u]$login[/u] не является ботом!";
//elseif ($stat['travma']>$now) $msg="С травмой в бой нельзя!";
if ($stat['travma']>$now) $msg="С травмой в бой нельзя!";
//elseif ($stat['level']!=$chl['level']) $msg="Выбери равного противника!";
elseif ($chl['room']!=2) $msg="Для нападния Вам необходимо находится в одной комнате!";
elseif ($stat['hp_now']<(($stat['hp']+$stat['vitality']*5)*0.33)) $msg="Вы слишком ослаблены для боя!";
elseif ($chl['hp_now'] <= 5) $msg="Персонаж [u]$login[/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"));
$chl['vitality']+=$_obj['vitality'];
$chl['hp_max']=$chl['vitality']*5+$_obj['hp'];
$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] AND up=$stat[up]"));
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, status) values($battime+600,1,1,'1','1','180',1)");
$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>";
}
}
//<input onfocus="this.select()" type="text" readonly value="<! echo $get["name"]; !>" size="<!=strlen($get["name"]);!>" />
$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=#dedede 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>
<script language=\"JavaScript\" src=\"i/ch-online.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>
var imgpath = '".$stat[img_path]."';
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=$stat[img_path]/i/vault/navigation/hp/_helth.gif width='10' height=10 border=0 alt='Уровень жизни: $stat[hp_now]/$stat[hp_max]'><img src=$stat[img_path]/i/vault/navigation/hp/helth.gif height='10' width='$widthhp' border=0 alt='Уровень жизни: $stat[hp_now]/$stat[hp_max]'><img src=$stat[img_path]/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>
<input type=button value=Обновить onclick='window.location.href=\"fight_with_clon.php?tmp=\"+Math.random();\"\"' class=standbut> ";
//Кнопки Обновить и Вернуться
if ($stat['room'] == 2) echo" $back";
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>
</table>";
echo"
</td>
</tr>
</table>
</td>
<td align=center>
<img src='$stat[img_path]/i/trening.jpg'>
</td>
<td width=0 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>
<form method=get enctype=multipart/form-data>
<input type=submit name=attack class=input value=Провестибой style=WIDTH:120px>
</form>
</td>
</tr>
</table>
";
//
echo "</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</fieldset>
";
echo"</td>
</tr>
</table>
";
}
mysql_close($link);
#echo"[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 отважных рыцарей на бой с ним.
#
"
?>