<?
ob_start();
Error_Reporting(E_ALL);
////////////////////////////////////////////////////////
list($msec,$sec)=explode(chr(32),microtime());
$gtime=$sec+$msec;
////////////////////////////////////////////////////////
include_once("inclydings/sesi.php");
include 'inclydings/antixak.php';
include 'inclydings/ini.php';
include("inclydings/who.php");
include("inclydings/hearder.php");
$text = @file("L2dbnam/esql2db/reg/$log.dat");
if ($text!=""){
$udata = explode(":||:",$text[0]);
$login=trim($udata[0]);
$password=trim($udata[1]);}
////////////////////////////////////////////////////////

if (isset($user)) {
switch($go) {
default:

if(!@file("L2dbnam/esql2db/tmp/$log.dat")){
echo"Вы не в бою"; include 'inclydings/down.php'; exit;
}

$text = @file("L2dbnam/esql2db/tmp/$log.dat");
$udat = explode(":||:",$text[0]);
$text = @file("L2dbnam/esql2db/reg/$log.dat");
$udata = explode(":||:",$text[0]);
$mobhp=trim($udat[0]);
$mobhpall=trim($udat[1]);
$atakamob=trim($udat[2]);
$hp=trim($udata[16]);
$allhp=trim($udata[17]);
$ataka=trim($udata[4]);
$mp=trim($udata[29]);
$allmp=trim($udata[30]);
$mob=trim($udat[3]);
$logs=trim($udat[4]);
if($udata[16]<"0"){
header ("Location: lose.php?$sd"); exit;}
if($udat[0]<="0"){
$zzz="$udata[0]:||:$mob:||:";
$fp=fopen("L2dbnam/esql2db/respaun2/$mob.dat","w");
flock ($fp,LOCK_EX);
fputs($fp,"$zzz\r\n");
flock ($fp,LOCK_UN);
fclose($fp);

$zzz = @file("L2dbnam/esql2db/drop/d.dat");

$time = time()+"30";
$ttt = "zzzzzzzzzzz^|^$time";
$fp=fopen("L2dbnam/esql2db/respaun/$mob.dat","w");
flock ($fp,LOCK_EX);
fputs($fp,"$ttt\r\n");
flock ($fp,LOCK_UN);
fclose($fp);

header ("Location: win.php?$sd");
exit;}
echo"Жизни: $hp/$allhp<br/>
Мана: $mp/$allmp<br/>
HP моба: $mobhp/$mobhpall<br/>";
echo"Атака оружием<br/>";
echo"<a href=\"udar.php?$sd\"><img src=pik4erspic/skill/atack.gif alt=pic weight=16 height=16>Атаковать</a><br/>";
if($udata[27]=="wizard"){
echo"Супер удары<br/>";
}else{
echo"Супер удары<br/>";
}
if(!@file("L2dbnam/esql2db/mag/$log.dat")){
if($udata[27]=="wizard"){
echo"Магии нет";}else{
echo"Скилов нет";}
}else{
$file = @file("L2dbnam/esql2db/mag/$log.dat");
$total = count($file);
for ($i = 0; $i < $total; $i++){
$file = @file("L2dbnam/esql2db/mag/$log.dat");
$data = explode("||",$file[$i]);
if($data[4]=="combat"){
echo"<a href=\"udar.php?$sd&name=$data[8]&tip=mag&gorod=$gorod&id=$i\"><img src=pik4erspic/skill/$data[7].gif  alt=pic weight=16 height=16>$data[7]</a> - [+$data[0] урона]<br/>";
}}}
echo"<hr>Лог боя<br/>______<br/>$logs<br/>";
echo'<hr/><b>Использовать эликсир</b><br/>';
$filel = file("L2dbnam/esql2db/item/$log.dat");
$filel = array_reverse($filel);
$totall = count($filel);
for ($il = 0; $il < $totall; $il++){
$datal = explode(":||:",$filel[$il]);

if($datal[2]=="vesh2"){

$datal_0[]=$datal[0];
$datal_1[]=$datal[1];
$datal_2[]=$datal[2];
$datal_3[]=$datal[3];
$datal_4[]=$datal[4];
$datal_id[]=$il;
}}

if(empty($datal_4)){echo"У вас нет эликсиров."; include_once"inclydings/down.php"; exit;}
foreach($datal_0 as $kl=>$vl)
{

$dat_screenl[]="<img src=pik4erspic/sell2/$datal_4[$kl].gif height=16 width=16 alt=pic><a href=\"tovesh.php?$sd&tip=$datal_2[$kl]&name=$datal_4[$kl]&id=$datal_id[$kl]\">$datal_4[$kl]</a> [$datal_3[$kl]]<br/>";
}


$totall = count($dat_screenl);


if (empty($_GET['start'])) $startl = 0;
else $startl = $_GET['start'];
if ($totall < $startl + 10){ $endl = $totall; }
else {$endl = $startl + 10; }
for ($il = $startl; $il < $endl; $il++){

echo"$dat_screenl[$il]";

}
}
}else{echo"Пароль или ник неверен.Возможно сессия устарела.Попробуйте авторизироваться заново...!";}
include_once"inclydings/down.php";
