View file techno/bitva.php

File size: 23.04Kb
<?
error_reporting(0);
define('PROTECTOR', 1);

$head = 'okrestnosti';//фикс. места

$textl='Охота на монстров';
@include('files/db.php');
@include('files/auth.php');
@include('files/func.php');
@include('files/mobdie.php');
going();
ryd();
@include('files/core.php');
@include('files/head.php');
@include('files/zag.php');
$time=time();
mysql_query("UPDATE regenerator SET last = '$time' WHERE usr = '$log'");//сбиваем регенерацию

$req = mysql_query("SELECT * FROM `bitva`");
$avto=mysql_num_rows($req);
$mags = mysql_query("SELECT * FROM `mag` WHERE `usr` = '$log' LIMIT 1");
$umen = mysql_fetch_array($mags);
$piton = mysql_query("SELECT * FROM `pit` WHERE `usr` = '$log' and `status`='on' LIMIT 1");
$pov=mysql_num_rows($piton);
$pit = mysql_fetch_array($piton);
switch($_GET[mod]){

default:
echo"<center><b>Локации с монстрами</b></center>$div";
if($avto>=1){
While($bitva = mysql_fetch_array($req)){
echo"<img src='pic/skull.png'>";
if($udata[lvl]>$bitva[mlvl]){$font="<font color=\"gray\">";}
if($udata[lvl]<$bitva[lvl]){$font="<font color=\"chocolate\">";}
if($udata[lvl]>=$bitva[lvl] AND $udata[lvl]<=$bitva[mlvl]){$font="<font color=\"#f4d06e\">";}
echo"<a href=\"bitva.php?mod=go&id=$bitva[id]\">$font $bitva[name] </a></font><br/>";
}}else{
echo'Нет башен!<br/>';}
break;

case 'go':
if(empty($_GET[id])){echo"Не выбрано место!";break;}else{
$id=htmlspecialchars(stripslashes(addslashes($_GET['id'])));
$req = mysql_query("SELECT * FROM `bitva`WHERE `id`='$id'");
$bitva = mysql_fetch_array($req);
if($udata[lvl]<$bitva[lvl] and $log!==Admin)
{echo"<font color=\"chocolate\"><img src='pic/main/fp.png' alt='*'/> Локацию можно открыть c $bitva[lvl]-го уровня
</br><a href=\"bitva.php?\">Назад</a>";break;}
if($udata[prava]==6){echo"<a href=\"mod_panel.php?mod=6&b=$id\">Изменить мобов</a> $bitva[lvl]/$bitva[mlvl]</br><a href=\"mobcreat.php?id=$id\">Создать моба</a></br>";}
if($udata[prava]==6){echo"<a href=\"adm_panel.php?mod=6&b=$id\">Изменить мобов</a>  $bitva[lvl]/$bitva[mlvl]</br><a href=\"mobcreat.php?id=$id\">Создать моба</a></br>";}
$exp=round((($udata[exp]-$ol)/($op-$ol))*100);
$proc=($udata[hp]/$udata[hpall])*100;
echo"<center><b>$bitva[name]</b></center>$div";
echo'<div style="background:#666666;height:1px;width:100%;padding:0;margin:6px 0;">
<div style="background:#FFDF8C; height:1px; width:'.$exp.'%;"></div>
</div>';
echo"<div class='stat_bar'><div class='progress blue' style='width:$proc%'></div></div>";
///////////////////LIMIT/////////////
$lime = mysql_query("SELECT * FROM `limit` WHERE `usr`='$log' ") or die (mysql_error());
$avtol=mysql_num_rows($lime);
if($avtol==0){
mysql_query("INSERT INTO
`limit` SET `usr` = '$log', `mob` = '0', `mobtime` = '0' ") or die (mysql_error());}
$lim = mysql_fetch_array($lime);
if($lim[mob]>10){
$limit=$time+30;
mysql_query("UPDATE `limit` SET `mobtime` = '$limit', `mob`='$lim[mob]'-'10' WHERE `usr` = '$log' ");}
if($lim[mobtime]>$time){
$ost=$lim[mobtime]-$time;
$rand=rand(10000000,10000000000);
echo"<div class='dot'><center>Ваш воин устал, необходимо отдохнуть</br> <img src='pic/update.png' alt='*'/> <a href=\"bitva.php?mod=go&id=$id&r=$rand\">Ждать $ost сек.</a></center></div><br/>";
}

//////////АТАКА///////////////ИЗМЕНЕНО
if(isset($_GET[ataka]) && !empty($_GET[mob])){

if($lim[mobtime]<$time){
$_GET[mob]=htmlspecialchars(stripslashes(addslashes($_GET['mob'])));
$req = mysql_query("SELECT * FROM `mobs` WHERE `id`='$_GET[mob]' ");
$avt=mysql_num_rows($req);
$mob = mysql_fetch_array($req);
$tem = mysql_query("SELECT * FROM `temp` WHERE `user`='$log' and `id`='$_GET[mob]'");
$avtosss=mysql_num_rows($tem);
if($avtosss==0){
mysql_query("INSERT INTO
        `temp` SET
        `id` = '$mob[id]',
        `name` = '$mob[name]',
        `lvl` = '$mob[lvl]',
        `hp` = '$mob[hp]',
        `hpall` = '$mob[hp]',
        `uron` = '$mob[uron]',
        `prot` = '$mob[prot]',
        `krit` = '$mob[krit]',
        `ukrit` = '$mob[ukrit]',
        `lovk` = '$mob[lovk]',
        `money` = '$mob[money]',
        `exp` = '$mob[exp]',
        `tip` = '$mob[tip]',
        `oponent` = '0',
        `image` = '0',
        `status` = 'on',
        `bitva` = '$mob[bitva]',
        `user` = '$log',
        `ltime` = '$time'") or die (mysql_error());
}
$tem = mysql_query("SELECT * FROM `temp` WHERE `user`='$log' and `id`='$_GET[mob]'");
$mob = mysql_fetch_array($tem);

/*if($avt=0){echo"<img src=\"pic/no.png\" alt=\"*\"/> Нет такого монстра!";exit;}

if($udata[mp]<=0){$lov=1; $utex = "<font color='#ff3333'> Не хватает энергии!</font>";
echo"<div class='event1'></br>";
echo"$utex</br>";
echo"</div>";break;
}*/


if($udata[lovk]<$mob[lovk]){$sl=rand(1,100);
$shans_lovk=round(($mob[lovk]-$udata[lovk])*5);}
$r=rand(1,2);
if($shans_lovk>$sl and $r==1){$mb=1;
$msg=rand(0,2);
if($msg=="0"){$utex="<font color='chocolate'> $mob[name] пригнулся!</font>";}
if($msg=="1"){$utex="<font color='chocolate'> $mob[name] блокировал твою атаку!</font>";}
if($msg=="2"){$utex="<font color='chocolate'> $mob[name] увернулся!</font>";}
}

if($mob[lovk]<$udata[lovk]){$ms_l=rand(1,100);$mshans_lovk=round(($udata[lovk]-$mob[lovk])*4);}
if($ms_l>$mshans_lovk){$ub=1;
$msg=rand(0,2);
if($msg=="0"){$mtex="<font color='chocolate'> Ты пригнулся!</font>";}
if($msg=="1"){$mtex="<font color='chocolate'> Ты блокировал атаку!</font>";}
if($msg=="2"){$mtex="<font color='chocolate'> Ты увернулся!</font>";}

}
if($ub!=1){
$m=$mob[uron];
$aya=rand(0,100);

/**/
if($aya<=$umen[bronya]){$tex="Сработала Крепкая броня!";}
$udar=round(rand($m-$m/7,$m+$m/7))-$udata[prot];
if($udar<=0){$udar=rand(0,2);}


$msg=rand(0,2);
if($msg=="0"){$mtex="$mob[name] наносит сильный удар! <font color='red'>-$udar $tex</font>";}
if($msg=="1"){$mtex="$mob[name] атакует! <font color='red'>-$udar $tex</font>";}
if($msg=="2"){$mtex="$mob[name] метко бьёт! <font color='red'>-$udar $tex</font>";}
$myhp=$udata[hp]-$udar;
$krit=rand(1,100);
$myhp=$udata[hp]-$udar;
if($krit<=$mob[krit]){
$mno=round(($udar/100)*$mob[ukrit]);
$udar=$udar+$mno;
$myhp=$udata[hp]-$udar;

$msg=rand(0,2);
if($msg=="0"){$mtex="$mob[name] наносит крит-урон! <font color='red'>-$udar $tex</font>";}
if($msg=="1"){$mtex="$mob[name] бьёт крит-удар! <font color='red'>-$udar $tex</font>";}
if($msg=="2"){$mtex="$mob[name] наносит крит-атаку! <font color='red'>-$udar $tex</font>";}
}
mysql_query("UPDATE `users` SET `hp`='$myhp', `mp`='$udata[mp]'-'1' WHERE `usr`='$log'") or die (mysql_error());
}
if($mb!=1){
$aya=rand(0,100);
if($aya<=$umen[yarost]){$text="Сработала Точная атака!";$u=$udata[sila]+round(($udata[sila]/100)*30);}else{
$u=$udata[sila];}
$uron=round(rand($u-($u/8),$u+($u/8))-$mob[prot]);
if($uron<=0){$uron=rand(0,1);}
$msg=rand(0,2);
if($msg=="0"){$utex="Ты наносишь урон $mob[name] ! <font color='#71cc71'>-$uron $text</font>";}
if($msg=="1"){$utex="Ты атакуешь $mob[name] ! <font color='#71cc71'>-$uron $text</font>";}
if($msg=="2"){$utex="Ты попал в $mob[name] ! <font color='#71cc71'>-$uron $text</font>";}
$newmob=$mob[hp]-$uron;
if($udata[lvl]<=30){$kr=100;}
if($udata[lvl]>30){$kr=200;}
if($udata[lvl]>50){$kr=300;}
$krit=rand(1,$kr);
if($krit<=$udata[krit]){
if($umen[vihr]>0)
{$texs="Сработал Вихрь критов!";
$mno=round(($uron/100)*($udata[ukrit]+$umen[vihr]));}else{
$mno=round(($uron/100)*$udata[ukrit]);}
$uron=$uron+$mno;
if($uron<=0){$uron=rand(0,2);}
$msg=rand(0,2);
if($msg=="0"){$utex="Ты наносишь крит-урон $mob[name]! <font color='#71cc71'>-$uron $texs</font>";}
if($msg=="1"){$utex="Ты произвел крит-атаку $mob[name]! <font color='#71cc71'>-$uron $texs</font>";}
if($msg=="2"){$utex="Ты атакуешь критом $mob[name]! <font color='#71cc71'>-$uron $texs</font>";}
$newmob=$mob[hp]-$uron;

}

mysql_query("UPDATE `temp` SET `hp`='$newmob' WHERE `id`='$mob[id]'") or die (mysql_error());
}
}
}


///////////////THE END////////////////////
$temper = mysql_query("SELECT * FROM `temp` WHERE `bitva`='$id' and `user`='$log' and `status`='off'");
$av=mysql_num_rows($temper);
$avol=$av+5;
While($templar = mysql_fetch_array($temper)){}
$resen = mysql_query("SELECT * FROM `mobs` WHERE `bitva`='$id' and `id`!='$templar[id]'ORDER BY RAND() ") or die (mysql_error());
$avtos=mysql_num_rows($resen);

$res = mysql_query("SELECT * FROM `mobs` WHERE `bitva`='$id' and `id`!='$templar[id]' ORDER BY `lvl` ASC LIMIT $avol") or die (mysql_error());
$avto=mysql_num_rows($res);
}

$tem = mysql_query("SELECT * FROM `temp` WHERE `bitva`='$id' and `user`='$log' and `id`='$mobs[id]' ") or die (mysql_error());
$temp = mysql_fetch_array($tem);
While($mobs = mysql_fetch_array($res)){
$tem = mysql_query("SELECT * FROM `temp` WHERE `bitva`='$id' and `user`='$log' and `id`='$mobs[id]'");
$temp = mysql_fetch_array($tem);
echo"<font color=\"#ffc22b\">";
if($mobs[status]==on and $mobs[hp]>0){
if($udata[lvl]>$mobs[lvl]){$font="<font color=\"gray\">";}
if($udata[lvl]<$mobs[lvl]){$font="<font color=\"chocolate\">";}
if($udata[lvl]==$mobs[lvl]){$font="<font color=\"#f4d06e\">";}
if($mobs[id]!==$temp[id]){
echo"<img src=\"monstrs/$mobs[name].jpg\" alt=\"*\"/> <a href=\"bitva.php?mod=go&ataka&mob=$mobs[id]&id=$id\">$font $mobs[name] </a>
(<img src=\"pic/game/mob/hp.gif\" alt=\"i\">$mobs[hp])</font><a href=\"bitva.php?mod=info&id=$mobs[id]\"> <img src=\"pic/main/info.gif\" alt=\"i\"></a><br/>";
}else{
if($temp[status]==on and $temp[hp]>=0){
echo"<img src=\"monstrs/$temp[name].jpg\" alt=\"*\"/> <a href=\"bitva.php?mod=go&ataka&mob=$temp[id]&id=$id\">$font $temp[name] </a>
(<img src=\"pic/game/mob/hp.gif\" alt=\"i\">$temp[hp])</font><a href=\"bitva.php?mod=info&id=$temp[id]\"> 
<img src=\"pic/main/info.gif\" alt=\"i\"></a><br/>";}
}
}
}
if($avto==0){
echo'Все монстры убиты!<br/>';break;}

$temo = mysql_fetch_array($resen);
$rand=rand(10000000,10000000000);
echo"</br>";

//////////АТАКА///////////////
if(isset($_GET[ataka])){

if(empty($_GET[mob])){echo"<img src=\"pic/no.png\" alt=\"*\"/> Не выбран монстр!";break;}else{
if($lim[mobtime]<$time){
//$_GET[mob]=htmlspecialchars(stripslashes(addslashes($_GET['mob'])));
//$req = mysql_query("SELECT * FROM `mobs` WHERE `id`='$_GET[mob]' ");
//$avt=mysql_num_rows($req);
//$mob = mysql_fetch_array($req);
//$tem = mysql_query("SELECT * FROM `temp` WHERE `user`='$log' and `id`='$_GET[mob]'");
//$avto=mysql_num_rows($tem);
/*if($avto==0){
mysql_query("INSERT INTO
        `temp` SET
        `id` = '$mob[id]',
        `name` = '$mob[name]',
        `lvl` = '$mob[lvl]',
        `hp` = '$mob[hp]',
        `hpall` = '$mob[hp]',
        `uron` = '$mob[uron]',
        `prot` = '$mob[prot]',
        `krit` = '$mob[krit]',
        `ukrit` = '$mob[ukrit]',
        `lovk` = '$mob[lovk]',
        `money` = '$mob[money]',
        `exp` = '$mob[exp]',
        `tip` = '$mob[tip]',
        `oponent` = '0',
        `image` = '0',
        `status` = 'on',
        `bitva` = '$mob[bitva]',
        `user` = '$log',
        `ltime` = '$time'") or die (mysql_error());
}*/
//$tem = mysql_query("SELECT * FROM `temp` WHERE `user`='$log' and `id`='$_GET[mob]'");
//$mob = mysql_fetch_array($tem);

if($avt=0){echo"<img src=\"pic/no.png\" alt=\"*\"/> Нет такого монстра!";exit;}

if($udata[mp]<=0){$lov=1; $utex = "<font color='#ff3333'> Не хватает энергии!</font>";
echo"<div class='event1'></br>";
echo"$utex</br>";
echo"</div>";break;
}

/*
if($udata[lovk]<$mob[lovk]){$sl=rand(1,100);
$shans_lovk=round(($mob[lovk]-$udata[lovk])*5);}
$r=rand(1,2);
if($shans_lovk>$sl and $r==1){$mb=1;
$msg=rand(0,2);
if($msg=="0"){$utex="<font color='chocolate'> $mob[name] пригнулся!</font>";}
if($msg=="1"){$utex="<font color='chocolate'> $mob[name] блокировал твою атаку!</font>";}
if($msg=="2"){$utex="<font color='chocolate'> $mob[name] увернулся!</font>";}
}

if($mob[lovk]<$udata[lovk]){$ms_l=rand(1,100);$mshans_lovk=round(($udata[lovk]-$mob[lovk])*4);}
if($ms_l>$mshans_lovk){$ub=1;
$msg=rand(0,2);
if($msg=="0"){$mtex="<font color='chocolate'> Ты пригнулся!</font>";}
if($msg=="1"){$mtex="<font color='chocolate'> Ты блокировал атаку!</font>";}
if($msg=="2"){$mtex="<font color='chocolate'> Ты увернулся!</font>";}

}
if($ub!=1){
$m=$mob[uron];
$aya=rand(0,100);


if($aya<=$umen[bronya]){$tex="Сработала Крепкая броня!";$udata[prot]=$udata[prot]+round(($udata[prot]/100)*25);}
$udar=round(rand($m-$m/7,$m+$m/7))-$udata[prot];
if($udar<=0){$udar=rand(0,2);}


$msg=rand(0,2);
if($msg=="0"){$mtex="$mob[name] наносит сильный удар! <font color='red'>-$udar $tex</font>";}
if($msg=="1"){$mtex="$mob[name] атакует! <font color='red'>-$udar $tex</font>";}
if($msg=="2"){$mtex="$mob[name] метко бьёт! <font color='red'>-$udar $tex</font>";}
$myhp=$udata[hp]-$udar;
$krit=rand(1,100);
$myhp=$udata[hp]-$udar;
if($krit<=$mob[krit]){
$mno=round(($udar/100)*$mob[ukrit]);
$udar=$udar+$mno;
$myhp=$udata[hp]-$udar;

$msg=rand(0,2);
if($msg=="0"){$mtex="$mob[name] наносит крит-урон! <font color='red'>-$udar $tex</font>";}
if($msg=="1"){$mtex="$mob[name] бьёт крит-удар! <font color='red'>-$udar $tex</font>";}
if($msg=="2"){$mtex="$mob[name] наносит крит-атаку! <font color='red'>-$udar $tex</font>";}
}
mysql_query("UPDATE `users` SET `hp`='$myhp', `mp`='$udata[mp]'-'1' WHERE `usr`='$log'") or die (mysql_error());
}
if($mb!=1){
$aya=rand(0,100);
if($aya<=$umen[yarost]){$text="Сработала Точная атака!";$u=$udata[sila]+round(($udata[sila]/100)*30);}else{
$u=$udata[sila];}
$uron=round(rand($u-($u/8),$u+($u/8))-$mob[prot]);
if($uron<=0){$uron=rand(0,1);}
$msg=rand(0,2);
if($msg=="0"){$utex="Ты наносишь урон $mob[name] ! <font color='#71cc71'>-$uron $text</font>";}
if($msg=="1"){$utex="Ты атакуешь $mob[name] ! <font color='#71cc71'>-$uron $text</font>";}
if($msg=="2"){$utex="Ты попал в $mob[name] ! <font color='#71cc71'>-$uron $text</font>";}
$newmob=$mob[hp]-$uron;
if($udata[lvl]<=30){$kr=100;}
if($udata[lvl]>30){$kr=200;}
if($udata[lvl]>50){$kr=300;}
$krit=rand(1,$kr);
if($krit<=$udata[krit]){
if($umen[vihr]>0)
{$texs="Сработал Вихрь критов!";
$mno=round(($uron/100)*($udata[ukrit]+$umen[vihr]));}else{
$mno=round(($uron/100)*$udata[ukrit]);}
$uron=$uron+$mno;
if($uron<=0){$uron=rand(0,2);}
$msg=rand(0,2);
if($msg=="0"){$utex="Ты наносишь крит-урон $mob[name]! <font color='#71cc71'>-$uron $texs</font>";}
if($msg=="1"){$utex="Ты произвел крит-атаку $mob[name]! <font color='#71cc71'>-$uron $texs</font>";}
if($msg=="2"){$utex="Ты атакуешь критом $mob[name]! <font color='#71cc71'>-$uron $texs</font>";}
$newmob=$mob[hp]-$uron;

}

mysql_query("UPDATE `temp` SET `hp`='$newmob' WHERE `id`='$mob[id]'") or die (mysql_error());
}*/

////////////ПОБЕДА!!!/////ПРОИГРЫШ///////

if($udata[hp]<0){
$nlos=$udata[loses]+1;
mysql_query("UPDATE users SET loses = '$nlos' , hp = '0' WHERE usr = '$log'");
$utex="<font color='red'>Вы Проиграли.</font>";
echo '<html><head><title>На главную</title><meta http-equiv="refresh" content="1; url=index.php"></head><body>';
}//Конец//

if($mob[hp]<0){
$sett = mysql_query("SELECT * FROM `set` WHERE `usr` = '$log' LIMIT 1");
$set = mysql_fetch_array($sett);

$nwins=$udata[wins]+1;
$summ = rand($mob[exp]-$mob[exp]/10,$mob[exp]+$mob[exp]/10);
if($set[vip]=="on"){$nexp=round($udata[exp]+($summ*2));}else{
$nexp=round($udata[exp]+$summ);}//расчет опыта!
if($pov==1){$pi=$nexp-$udata[exp]; $po=$pi/2+$pit[exp];
mysql_query("UPDATE `pit` SET `exp` = '$po' WHERE `usr` = '$log' and `status`='on'");
}
$clexp=$nexp-$udata[exp];
$mainexp=$clexp+$udata[clanexp];
$req = mysql_query("SELECT * FROM `clan` where `lider` = '$udata[clan]'");
$clan = mysql_fetch_array($req);
$exep = $clexp+$clan[exp];
$summa=$nexp-$udata[exp];
/////Дроп////////
$res=rand(0,60);
$per=3+$set[razb];
$shans=rand(0,$per);
if($shans>=$res){
$drops=rand(1,12);
$resd = mysql_query("SELECT * FROM `mdrop` WHERE `id`='$drops'") or die (mysql_error());
$res = mysql_fetch_array($resd);
$drop="Выпало: $res[name]";
$prov = mysql_query("SELECT * FROM `res` WHERE `usr`='$log' and `name` = '$res[name]' and `tip`='$res[tip]'") or die (mysql_error());
$avto=mysql_num_rows($prov);
if($avto==0){
mysql_query("INSERT INTO
        `res` SET
        `usr` = '$log',
        `name` = '$res[name]',
        `lat_name` = '$res[lat_name]',
        `tip` = '$res[tip]',
        `what` = '$res[what]',
        `give` = '$res[give]',
        `kol` = '1',
        `cena` = '$res[cena]'") or die (mysql_error());}else{
$dr = mysql_fetch_array($prov);
$nkol = $dr[kol]+1;
mysql_query("UPDATE `res` SET `kol` = '$nkol' WHERE `usr` = '$log' and `name`='$dr[name]'");
}
}
///////////end drops////////
$summma=$udata[money]-$nmoney;
if($set[razb]<5){$set[razb]=5;}
$sm=rand(0,$set[razb]);
$shans=rand(1,31);
if($sm>=$shans){
if($set[vip]=="on"){$koef=2;}else{$koef=1;}
$nmoney=round($udata[money]+(rand($mob[money]-$mob[money]/10,$mob[money]+$mob[money]/10)*$koef));
$summma=$nmoney-$udata[money];
$utex="<font color='#71cc71'>Вы победили $mob[name] ! +$summa опыта +$summma монет $drop</font>";}else{
$nmoney=$udata[money];
$utex="<font color='#71cc71'>Вы победили $mob[name] ! +$summa опыта $drop</font>";}

mysql_query("UPDATE `clan` SET `exp` = '$exep' WHERE `lider` = '$udata[clan]'");
mysql_query("UPDATE users SET wins = '$nwins',exp='$nexp',money='$nmoney', clanexp='$mainexp' WHERE usr = '$log'");
mysql_query("UPDATE `temp` SET `status`='off', `ltime`='$time', `hp`='$mob[hpall]' WHERE `id`='$mob[id]'");
mysql_query("UPDATE `limit` SET `mob`='$lim[mob]'+'1' WHERE `usr` = '$log' ");
//////////ОРУЖИЕ/////////
$rew = mysql_query("SELECT * FROM `weapon` WHERE `usr`='$log' and `image`='yes'") or die(mysql_error());
While($weap=mysql_fetch_array($rew)){
if($weap[proch]>0){
$mob=$weap[mob]+1;
mysql_query("UPDATE `weapon` SET `mob` =  '$mob' WHERE`id`= '$weap[id]'") or die(mysql_error());
if($weap[zakal]==1){$km=800;}else{$km=500;}
if($weap[mob]>=$km){
$proch=$weap[proch]-1;
if($weap[zakal]==1){$k=200;}else{$k=100;}
$sila=round($weap[sila]-($weap[sila]/$k));
$lovk=round($weap[lovk]-($weap[lovk]/$k));
$prot=round($weap[prot]-($weap[prot]/$k));
$krit=round($weap[krit]-($weap[krit]/$k));
$ukrit=round($weap[ukrit]-($weap[ukrit]/$k));
$hp=round($weap[hp]-($weap[hp]/$k));
$mp=round($weap[mp]-($weap[mp]/$k));
$cena=round($weap[cena]-($weap[cena]/$k));
/////
$usila=round($udata[sila]-($weap[sila]/$k));
$ulovk=round($udata[lovk]-($weap[lovk]/$k));
$uprot=round($udata[prot]-($weap[prot]/$k));
$upkrit=round($udata[krit]-($weap[krit]/$k));
$uukrit=round($udata[ukrit]-($weap[ukrit]/$k));
$uhp=round($udata[hpall]-($weap[hp]/$k));
$ump=round($udata[mpall]-($weap[mp]/$k));
/////
mysql_query("UPDATE `weapon` SET 
`mob` =  '$weap[mob]'-'$km',
`proch` =  '$proch',
`cena` =  '$cena',
`sila` =  '$sila',
`lovk` =  '$lovk',
`prot` =  '$prot',
`krit` =  '$krit',
`ukrit` =  '$ukrit',
`hp` =  '$hp',
`mp` =  '$mp'
 WHERE`id`= '$weap[id]'");

mysql_query("UPDATE `users` SET 
`sila` =  '$usila',
`lovk` =  '$ulovk',
`prot` =  '$uprot',
`krit` =  '$upkrit',
`ukrit` =  '$uukrit',
`hpall` =  '$uhp',
`mpall` =  '$ump'
 WHERE `usr`= '$log'");
}
}}
//////////КОНЕЦ//////////
echo"<div class='evento'><div class='nevbbb'>";
echo"$utex</br>";
echo"</div><div class='evento'>";
}else{
///////////ПИТЫ///////////
if($pov==1 and $mob[ltime]!=$time){
$pataka=rand($pit[ataka]-$pit[ataka]/8,$pit[ataka]+$pit[ataka]/8);
$ataka=round($pataka);
$uvorot=rand(0,100);
$tem = mysql_query("SELECT * FROM `temp` WHERE `user`='$log' and `id`='$mob[id]'");
$mob = mysql_fetch_array($tem);
$newmobs=$mob[hp]-$ataka;

if($pit[lovk]>=$uvorot){
$msg=rand(0,2);
if($msg=="0"){$msp="ударил";}
if($msg=="1"){$msp="укусил";}
if($msg=="2"){$msp="поцарапал";}
$ptex="<b>$pit[name]</b> $msp врага <font color='chocolate'>-$ataka!</font>";

mysql_query("UPDATE `temp` SET `hp`='$newmobs' WHERE `id`='$mob[id]'") or die (mysql_error());
}else{

$ptex="<font color='chocolate'><b>$pit[name]</b> получил травму,но атаковал -$ataka</font>";
$hp=$pit[hp]-1;
mysql_query("UPDATE `pit` SET `hp` = '$hp' WHERE `id`='$pit[id]' and `usr`='$log'") or die (mysql_error());
mysql_query("UPDATE `temp` SET `hp`='$newmobs' WHERE `id`='$mob[id]'") or die (mysql_error());
if($pit[hp]<0){mysql_query("UPDATE `pit` SET `dies`='$pit[dies]'+'1', `status`='die' WHERE `id`='$pit[id]' and `usr`='$log'") or die (mysql_error());
$ptex="<font color='red'><b>$pit[name]</b> получил травму и погиб</font>";
}
}
}

///////////КОНЕЦ//////////
if($udata[lvl]>$mob[lvl]){$font="<font color=\"gray\">";}
if($udata[lvl]<$mob[lvl]){$font="<font color=\"chocolate\">";}
if($udata[lvl]==$mob[lvl]){$font="<font color=\"#f4d06e\">";}
$rand=rand(10000000,10000000000);
if($newmob>0){
echo"<div class='nevbbb'><img src=\"pic/main/sword.gif\" alt=\"*\"/> <a href=\"bitva.php?mod=go&ataka&mob=$mob[id]&id=$id&r=$rand\">
Добивать $font $mob[name] </a>(<img src=\"pic/game/mob/hp.gif\" alt=\"i\">$newmob)</font></div>";
}else{
$id=htmlspecialchars(stripslashes(addslashes($_GET['id'])));
Header("Location: ?mod=go&ataka&mob=$mob[id]&id=$id");
exit();
}
echo"<div class='evento'><div class='nevbbb'>";
$rand=rand(1,2);
if($rand==1){echo"$utex</br>$mtex</br>$ptex";}
if($rand==2){echo"$mtex</br>$utex</br>$ptex";}
echo"</font></font></div><div class='evento'>";

}
}
}




}
if($pov==1){echo"</font><font color ='white'><img src='pic/pit/$pit[ava]'  width='20' height='20'  alt='*'/> Ваш помощник: <b>$pit[name]</b> <img src=\"pic/game/mob/hp.gif\" alt=\"i\"> <b>$pit[hp]</b>";}

echo"<div class='nevbbb'></font></font>";
$el = mysql_query("SELECT * FROM `res` WHERE `usr` = '$log' and `tip`='elexir' and `kol`>'0' ORDER by `cena` DESC LIMIT 4");
$avt=mysql_num_rows($el);
if($avt>=1){
While($elm = mysql_fetch_array($el)){
echo" <font color=white>$elm[name] ($elm[kol] шт.)</font> <a href=\"elexirs.php?id=$elm[id]\">[исп]</a></font><br/>";
}}echo"</div></div></div>";

break;


case 'info':
$id = htmlspecialchars(addslashes(stripslashes($_GET['id'])));
$req = mysql_query("SELECT * FROM `mobs` WHERE `id` = '$id' LIMIT 1");
////////////////////////////
if (mysql_num_rows($req)==0){echo"Такого монстра не существует.".mysql_num_rows($req);@include('files/down.php');exit;}
$mob = mysql_fetch_array($req);
echo"<b>$mob[name]</b><br/>";
echo"Уровень: $mob[lvl]<br/>";
echo"Жизни: $mob[hp]<br/>";
echo"Урон: $mob[uron]<br/>";
echo"Защита: $mob[prot]<br/>";
echo"Ловкость: $mob[lovk]<br/>";
echo"Крит: $mob[krit]%<br/>";
echo"Крит-урон: $mob[ukrit]%<br/>";
echo"Опыта: $mob[exp]<br/>";
echo"Монет: $mob[money]<br/>";
echo"<a href=\"bitva.php?\">Назад</a>";
break;
/////страница!!начало
if(isset($_GET[ataka])){
header ("Location: bitva.php?mod=go&id=$id&r=$rand");}
}
@include('files/down.php');
?>