<?
$now=time();
include("inc/db_connect.php");
include("inc/noflood.php");
include("XSSandSQLInject.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]=="1") echo"<script>top.location='index.php?action=logout'</script>";
if ($stat['t_time']) { header("Location: prison.php"); exit; }
elseif ($stat['k_time']) { header("Location: academy.php"); exit; }
elseif ($stat[battle]) { header("Location: battle.php"); exit; }
elseif ($stat['r_time']) { header("Location: vault.php"); exit; }
elseif ($stat['room'] != 97) { header("Location: main.php"); exit; }
else {
$chl=mysql_fetch_array(mysql_query("SELECT id, v_time, k_time, bot, user, room, level, hp_now, battle, last_battle, vitality, travma, rank, lpv, rase_skill FROM players where id=11"));
mysql_query("UPDATE players SET lpv=$now WHERE user='".$stat['user']."'");
include("inc/main/changed.php");
if ($chl['bot']>$now) {
echo"<script src='i/time.js'></script>";
echo"<center><table cellspacing=0 cellpadding=3>
<tr>
<td><font color=blue>[b]Сейчас клон отдыхает после поединков он сможет с тобой сразиться через:[/b]</font></td>
<td id=know style='COLOR:blue; FONT-WEIGHT: Bold; TEXT-DECORATION: Underline'></td>
</tr>
</table>
<script>ShowTime('know',",$chl['bot']-$now,");</script>";
}
else { mysql_query("UPDATE players set bot=0 where id=11");
echo"<center><font color=blue>[b]Нападай!!![/b]</font></center>";
}
if ($Attack) {
$chl=mysql_fetch_array(mysql_query("SELECT id, v_time, k_time, bot, user, room, level, hp_now, battle, last_battle, vitality, travma, rank, lpv, rase_skill FROM players where id='11'"));
if ($chl['user'] == $stat['user']) $msg="Нападение на самого себя - это уже мазохизм...";
elseif ($chl['rank'] != 60) $msg="Нападать на игроков сдесь запрещено!";
elseif ($chl['bot']>$now) $msg="Клон восстанавливает свой уровень жизни!";
elseif ($chl['room'] != 97) $msg="Для нападния Вам необходимо находится в одной комнате!";
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 {
mysql_query("UPDATE players set botik=2 where user='$stat[user]'");
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>";
}
}
$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=#8080a0 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=\"antarase.php?tmp=\"+Math.random();\"\"'>";
if ($stat['room'] == 97) echo"
<img src='i/back.gif' style='CURSOR: Hand' alt='Вернуться' onclick='window.location.href=\"world.php?room=0&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=400>
<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>
</td>
<td width=0 align=right valign=top>
<table cellspacing=0 cellpadding=5 style='border-style: outset; border-width: 2' border=1 width=200>
<tr>
<td align=center >
[b]Действия[/b]<HR color=silver>
<center><input type=button class=lbut value='Напасть на Клона' style='WIDTH: 190px' onclick='top.frames[\"main\"].location = \"klon.php?Attack=\"+Math.random();\"\"'></center>
</td>
</tr>
</table>
</td>";
echo"</td>
</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]
#
?>