View file techno/arena2.php

File size: 9.07Kb
<?
define('PROTECTOR', 1);

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

@include('files/db.php');
@include('files/auth.php');
@include('files/func.php');
@include('files/core.php');
@include('files/head.php');
@include('files/zag.php');
$time=time();
$exp=round((($udata[exp]-$ol)/($op-$ol))*100);



echo"Доступные противники</div><div class='menu'>";
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><div class=\"logtext\"><font color='green'>Ваш уровень разбойника $set[razb]</br></font>";
if(!isset($_GET['ataka'])){echo"<font color='green'>Чем сильнее противник, тем больше опыта и монет получишь за победу!</font></div><div class='menu'>";}

if(isset($_GET['ataka'])){
$log1=rand($udata[lvl]-3,$udata[lvl]-1);
$log2=rand($udata[lvl],$udata[lvl]+1);
$log3=rand($udata[lvl]+2,$udata[lvl]+4);
$boy1=mysql_query("SELECT * FROM `users` WHERE `lvl`='$log1' ORDER BY RAND() LIMIT 1");
$boys1 = mysql_fetch_array($boy1);
$boy2=mysql_query("SELECT * FROM `users` WHERE `lvl`='$log2' and `usr`!='$log' ORDER BY RAND() LIMIT 1");
$boys2 = mysql_fetch_array($boy2);
$boy3=mysql_query("SELECT * FROM `users` WHERE `lvl`='$log3' ORDER BY RAND() LIMIT 1");
$boys3 = mysql_fetch_array($boy3);
$rand=rand(0,100);
$mprand=rand(3,6);
if($set[arenainv]==0){
$ost=5-round(($time-$set[artime])/60);
echo"</div><div class=\"logtext\"><font color='green'>У вас больше нет доступных боёв! До следующего боя
$ost минут</div></font><div class=\"menu\">";
}elseif($udata[hp]<=0 OR $udata[mp]<=0){
echo"</div><div class=\"logtext\"><font color='green'>У вас не хватает здоровья или энергии!</div></font><div class=\"menu\">";
}
ELSE{

if($udata[lvl]>=0 and $udata[lvl]<=5){$koef1=rand(2,4);$koef2=rand(4,8);$koef3=rand(6,10);$bon1=rand(1,4)*1.5;$bon2=rand(2,6)*1.5;$bon3=rand(6,8)*1.5;}
if($udata[lvl]>5 and $udata[lvl]<=10){$koef1=rand(2,4);$koef2=rand(4,8);$koef3=rand(6,10);$bon1=rand(1,4)*1.5;$bon2=rand(5,15)*1.5;$bon3=rand(10,20)*1.5;}
if($udata[lvl]>10 and $udata[lvl]<=20){$koef1=rand(8,16);$koef2=rand(10,20);$koef3=rand(20,30);$bon1=rand(8,16)*1.6;$bon2=rand(10,20)*1.6;$bon3=rand(20,30)*1.6;}
if($udata[lvl]>20 and $udata[lvl]<=30){$koef1=rand(14,22);$koef2=rand(15,25);$koef3=rand(30,40);$bon1=rand(14,22)*1.7;$bon2=rand(15,25)*1.7;$bon3=rand(30,40)*1.7;}
if($udata[lvl]>30 and $udata[lvl]<=40){$koef1=rand(20,28);$koef2=rand(20,35);$koef3=rand(40,50);$bon1=rand(20,28)*1.8;$bon2=rand(20,35)*1.8;$bon3=rand(40,50)*1.8;}
if($udata[lvl]>40 and $udata[lvl]<=50){$koef1=rand(26,32);$koef2=rand(30,45);$koef3=rand(50,60);$bon1=rand(26,32)*1.9;$bon2=rand(30,45)*1.9;$bon3=rand(50,60)*1.9;}
if($udata[lvl]>50 and $udata[lvl]<=60){$koef1=rand(30,36);$koef2=rand(35,55);$koef3=rand(50,65);$bon1=rand(30,36)*2;$bon2=rand(35,55)*2;$bon3=rand(50,70)*2;}

if(!empty($_GET[user1])){$shans=82;$var=round($koef1+$set[razb]*1.5);$bon=round($bon1+$set[razb]*3);$user=$_GET[user1];}
if(!empty($_GET[user2])){$shans=66;$var=round($koef2+$set[razb]*1.5);$bon=round($bon2+$set[razb]*3);$user=$_GET[user2];}
if(!empty($_GET[user3])){$shans=40;$var=round($koef3+$set[razb]*2);$bon=round($bon3+$set[razb]*3);$user=$_GET[user3];}
$stat=$_GET[stat];
$my=$udata[sila]+$udata[hpall]+$udata[lovk]+$udata[prot];
if(($my-$stat)>=10){$shans=90;}
if($shans>=$rand){
$inv=$set[arenainv]-1;
$win=$udata[arenawins]+1;
$los=$udata[arenaloses];
$uron=3+rand(0,$udata[hp]/5);
$uron=round($uron);
$udar=round($uron+$uron/6);
echo"</div><div class=\"logtext\"><font color='green'>Вы победили!</br></font>$log нанес урона: $udar</br>
$user нанес урона: $uron</br>Вы отобрали $var монет и получили $bon опыта!
</div><div class=\"menu\">";}
else{
$inv=$set[arenainv]-1;
$win=$udata[arenawins];
$los=$udata[arenaloses]+1;
$var=-1*round($var/4);
$bon=round($bon/2);
$uron=1+rand(0,$udata[hp]/5);
$uron=round($uron);
$udar=round($uron-$uron/6);
echo"</div><div class=\"logtext\"><font color='red'>Поражение!</br></font>$log нанес урона: $udar</br>
$user нанес урона: $uron</br>У вас отобрали $var монет, но вы получили $bon опыта.
</div><div class=\"menu\">";}

mysql_query("UPDATE `users` SET `money` = '$udata[money]'+'$var', `exp`='$udata[exp]'+'$bon', `hp`= '$udata[hp]'-'$uron'
, `mp`='$udata[mp]'-'$mprand', `arenawins`='$win',`arenaloses`='$los' WHERE `usr` = '$log'");
mysql_query("UPDATE `set` SET `arenainv`='$inv', `artime`='$time' WHERE `usr` = '$log'");

}
}
if(empty($boys1[usr])){$log1=rand($udata[lvl]-3,$udata[lvl]-1);
$boy1=mysql_query("SELECT * FROM `users` WHERE `lvl`='$log1' ORDER BY RAND() LIMIT 1");
$boys1 = mysql_fetch_array($boy1);
$avto = mysql_num_rows($boy1);if($avto==0){$log1=rand($udata[lvl]-3,$udata[lvl]-1);
$boy1=mysql_query("SELECT * FROM `users` WHERE `lvl`='$log1' ORDER BY RAND() LIMIT 1");
$boys1 = mysql_fetch_array($boy1);}
}
if(empty($boys2[usr])){$log2=rand($udata[lvl],$udata[lvl]+1);
$boy2=mysql_query("SELECT * FROM `users` WHERE `lvl`='$log2' and `usr`!='$log' ORDER BY RAND() LIMIT 1");
$boys2 = mysql_fetch_array($boy2);
$avto = mysql_num_rows($boy2);if($avto==0){$log2=rand($udata[lvl]-3,$udata[lvl]-1);
$boy2=mysql_query("SELECT * FROM `users` WHERE `lvl`='$log2' ORDER BY RAND() LIMIT 1");
$boys2 = mysql_fetch_array($boy2);}
}
if(empty($boys3[usr])){$log3=rand($udata[lvl]+2,$udata[lvl]+3);
$boy3=mysql_query("SELECT * FROM `users` WHERE `lvl`='$log3' ORDER BY RAND() LIMIT 1");
$boys3 = mysql_fetch_array($boy3);
$avto = mysql_num_rows($boy3);if($avto==0){$log3=rand($udata[lvl]-3,$udata[lvl]-1);
$boy3=mysql_query("SELECT * FROM `users` WHERE `lvl`='$log3' ORDER BY RAND() LIMIT 1");
$boys3 = mysql_fetch_array($boy3);}
}
if(empty($boys1[usr])){echo"<b>Нет подходящего игрока</b></br>";}else{
$stat1=$boys1[sila]+$boys1[hp]+$boys1[lovk]+$boys1[prot];
echo"<b>$boys1[usr]</b></br>";}
echo"<img class='float-left' src='pic/avatar/human/C.jpg' width='50' height='80'/>
<img src='pic/main/redup.png' alt='*'/>Уровень: $boys1[lvl]</br>
<img src='pic/main/red_warrior.png' alt='*'/>Сила: $boys1[sila]</br>
<img src='pic/main/red_healer.png' alt='*'/>Здоровье: $boys1[hp]</br><img src='pic/main/exp.png' alt='*'/>Ловкость: $boys1[lovk]</br><img src='pic/main/def.png' alt='*'/>
Защита: $boys1[prot]</br>
<form action=\"arena.php?ataka&user1=$boys1[usr]&stat=$stat1\" method=\"post\">
<input class=\"button\" type=\"submit\" value=\"Атаковать!\" /></form>
</div><div class='menu'>";

if(empty($boys2[usr])){echo"<b>Нет подходящего игрока</b></br>";}else{
$stat2=$boys2[sila]+$boys2[hp]+$boys2[lovk]+$boys2[prot];
echo"<b>$boys2[usr]</b></br>";}
echo"<img class='float-left' src='pic/avatar/human/B.jpg' width='50' height='80'/>
<img src='pic/main/redup.png' alt='*'/>Уровень: $boys2[lvl]</br>
<img src='pic/main/red_warrior.png' alt='*'/>Сила: $boys2[sila]</br>
<img src='pic/main/red_healer.png' alt='*'/>Здоровье: $boys2[hp]</br><img src='pic/main/exp.png' alt='*'/>Ловкость: $boys2[lovk]</br><img src='pic/main/def.png' alt='*'/>
Защита: $boys2[prot]</br>
<form action=\"arena.php?ataka&user2=$boys2[usr]&stat=$stat2\" method=\"post\">
<input class=\"button\" type=\"submit\" value=\"Атаковать!\" /></form>
</div><div class='menu'>";

if(empty($boys3[usr])){echo"<b>Нет подходящего игрока</b></br>";}else{
$stat3=$boys3[sila]+$boys3[hp]+$boys3[lovk]+$boys3[prot];
echo"<b>$boys3[usr]</b></br>";}
echo"<img class='float-left' src='pic/avatar/human/A.jpg' width='50' height='80'/>
<img src='pic/main/redup.png' alt='*'/>Уровень: $boys3[lvl]</br><img src='pic/main/red_warrior.png' alt='*'/>Сила: $boys3[sila]</br>
<img src='pic/main/red_healer.png' alt='*'/>Здоровье: $boys3[hp]</br><img src='pic/main/exp.png' alt='*'/>Ловкость: $boys3[lovk]</br><img src='pic/main/def.png' alt='*'/>
Защита: $boys3[prot]</br>
<form action=\"arena.php?ataka&user3=$boys3[usr]&stat=$stat3\" method=\"post\">
<input class=\"button\" type=\"submit\" value=\"Атаковать!\" /></form>
</div><div class='menu'>
";

echo"<img src='pic/main/hero.png' alt='*'/> $log <img src='pic/main/redup.png' alt='*'/> $udata[lvl] <img src='pic/main/red_warrior.png' alt='*'/> $udata[sila]
<img src='pic/main/red_healer.png' alt='*'/> $udata[hpall] <img src='pic/main/exp.png' alt='*'/> $udata[lovk] <img src='pic/main/def.png' alt='*'/>
 $udata[prot]</br> ";
$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"$elm[name] ($elm[kol] шт.) [<a href=\"elexirs.php?id=$elm[id]\">исп.</a>]<br/>";
}}
echo"</div><div class='menu'><a href=\"arena.php?\">Другие противники</a>";
@include('files/down.php');
?>