Файл: l2ps_v5/atakaarena.php
Строк: 226
<?php
include("files/ini.php");
include("files/data.php");
$ref=rand(1,3);
$ref2=rand(1,3);
$game = mysql_query("SELECT * FROM `arena` WHERE `login`='$log' LIMIT 1 ");
$boi=mysql_num_rows($game);
if($boi==0){include_once("files/zag.php");echo'Вы находитесь не на арене!';include_once'files/down.php';exit;}
$elita=mysql_query("SELECT * FROM `peklowin` WHERE `usr`='$log' and `ok`='ataka' LIMIT 1");
if(mysql_num_rows($elita)==1){
$udata4=$udata4*1.15;}else{$udata4=$udata4;}
$elita=mysql_query("SELECT * FROM `peklowin` WHERE `usr`='$log' and `ok`='lov' LIMIT 1");
if(mysql_num_rows($elita)==1){
$udata3=$udata3*1.15;}else{$udata3=$udata3;}
$elita=mysql_query("SELECT * FROM `peklowin` WHERE `usr`='$log' and `ok`='pvp' LIMIT 1");
if(mysql_num_rows($elita)==1){
$udata4=$udata4*1.15;}else{$udata4=$udata4;}
$elita=mysql_query("SELECT * FROM `peklowin` WHERE `usr`='$log' and `ok`='pvpc' LIMIT 1");
if(mysql_num_rows($elita)==1){
$udata4=$udata4*1.15;}else{$udata4=$udata4;}
$test = mysql_query("SELECT * FROM `weapon_item` WHERE `login`='$log' and `name`='$udata12' LIMIT 1");
$ts=mysql_fetch_array($test);
if($ts[weaponType]=="dual"){$ts[weaponType]=7;}
if($ts[weaponType]=="sword"){$ts[weaponType]=1;}
if($ts[weaponType]=="bow"){$ts[weaponType]=2;}
if($ts[weaponType]=="blunt"){$ts[weaponType]=3;}
if($ts[weaponType]=="dagger"){$ts[weaponType]=4;}
if($ts[weaponType]=="pole"){$ts[weaponType]=5;}
if($ts[weaponType]=="dualfist"){$ts[weaponType]=6;}
if($ts[weaponType]=="etc"){$ts[weaponType]=10;}
$elita=mysql_query("SELECT * FROM `bonusstats` WHERE `login`='$log' and `vid`='$ts[weaponType]' LIMIT 1 ");
$stats=mysql_fetch_array($elita);
$ts1=mysql_num_rows($elita);
if($ts1==1){
$udata4=$udata4+$stats[kol];}else{$udata4=$udata4;}
switch($tip) {
case 'ydar':
$oke = mysql_query("SELECT * FROM `stan` WHERE `login`='$log' LIMIT 1 ");
$ar=mysql_num_rows($oke);
if($ar==1){ header ("Location: arena.php?"); exit;}
$a = @mysql_query("select * from `arena` WHERE `login`='$vrag' AND `hp`>'0' AND `lvl`>'20' ");
if (mysql_affected_rows()==0)
{
$ok = mysql_query("SELECT * FROM `arena` WHERE `login`!='$log' AND `hp`>'0' AND `login`!='$vrag' AND `lvl`>'20' ORDER BY RAND() LIMIT 1 ");
$arr1=mysql_num_rows($ok);
if($arr1==0){
$time = date("H:i:s");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Никого нет.', '".$log."')"); header ("Location: arena.php?"); exit;}
}
else{$ok = mysql_query("SELECT * FROM `arena` WHERE `login`='$vrag' LIMIT 1 ");}
while($arr=mysql_fetch_array($ok)){
$time = date("H:i:s");
if($udata16<="0"){
header ("Location: arena.php?&go=dead");}
if($arr[login]==$log){mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы неможете бить самого себя.', '".$log."')"); header ("Location: arena.php?"); exit;}
if($arr[lvl]<20){mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Игрок слижком низкого лвла чтоб его бить.', '".$log."')"); header ("Location: arena.php?"); exit;}
$time = date("H:i:s");
$hp=trim($udata16);
$allhp=trim($udata17);
$nick=$arr['login'];
$hpatk=$arr['hp'];
$hpatkall=$arr['hpall'];
$atk=$arr['atk'];
$zashita=$arr['zashita'];
$id=$arr['id'];
$allhp2=trim($hpatkall);
$die=trim($udat[5]);
$hp2=trim($hpatk);
$refka=rand(1,2);
if($refka=="1"){
$atkmin=$udata4/2;
$ref=rand($atkmin,$udata4);
$udk=$ref-$zashita;
if($udk<"0"){ $udk="0";}
$game = mysql_query("SELECT * FROM `arena` WHERE `login`='$log' LIMIT 1 ");
$boi=mysql_fetch_array($game);
$kolatk=$boi[kolatk]+$udk;
mysql_query("UPDATE `arena` SET `kolatk`='$kolatk' WHERE `login`='$log'");
$okudar=rand(1,3);
if($okudar=="1"){
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы решительно ударили во врага. <b>Урон $udk</b>', '".$log."')");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - По вам попал игрок $log. <b>Урон $udk</b>', '".$nick."')");
}else{
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Враг пытался увернутся, но вы сильно ударили во врага. <b>Урон $udk</b>', '".$log."')");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы неуспели увернутся и по вам попал игрок $log. <b>Урон $udk</b>', '".$nick."')");
}
$udk=$hp2-$udk;
mysql_query("UPDATE `arena` SET `hp`='$udk' WHERE `login`='$nick'");
mysql_query("UPDATE `users` SET `udata16`='$udk' WHERE `udata0`='$nick'");
mysql_query("UPDATE `arena` SET `vrag`='$nick', `hpvrag`='$udk' WHERE `login`='$log'");
}else{
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы засомневались и промахнулись.', '".$log."')");}
if($udata16<="0"){ header ("Location: arena.php?");
exit; }
header ("Location: arena.php?&vrag=$nick");
}
break;
case 'mag':
$oke = mysql_query("SELECT * FROM `stan` WHERE `login`='$log' LIMIT 1 ");
$ar=mysql_num_rows($oke);
if($ar==1){ header ("Location: arena.php?"); exit;}
$a = @mysql_query("select * from `arena` WHERE `login`='$vrag' AND `hp`>'0' AND `lvl`>'20' ");
if (mysql_affected_rows()==0)
{
$ok = mysql_query("SELECT * FROM `arena` WHERE `login`!='$log' AND `hp`>'0' AND `login`!='$vrag' AND `lvl`>'20' ORDER BY RAND() LIMIT 1 ");
$arr1=mysql_num_rows($ok);
if($arr1==0){
$time = date("H:i:s");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Никого нет.', '".$log."')"); header ("Location: arena.php?"); exit;}
}
else{$ok = mysql_query("SELECT * FROM `arena` WHERE `login`='$vrag' LIMIT 1 ");}
while($arr=mysql_fetch_array($ok)){
$time = date("H:i:s");
if($udata16<="0"){
header ("Location: arena.php?&go=dead");}
if($arr[login]==$log){mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы неможете бить самого себя.', '".$log."')"); header ("Location: arena.php?"); exit;}
if($arr[lvl]<20){mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Игрок слижком низкого лвла чтоб его бить.', '".$log."')"); header ("Location: arena.php?"); exit;}
$time = date("H:i:s");
$hp=trim($udata16);
$allhp=trim($udata17);
$nick=$arr['login'];
$hpatk=$arr['hp'];
$hpatkall=$arr['hpall'];
$atk=$arr['atk'];
$zashita=$arr['zashita'];
$id=$arr['id'];
$allhp2=trim($hpatkall);
$die=trim($udat[5]);
$hp2=trim($hpatk);
$qi = mysql_query("SELECT * from `mag` WHERE `mag10`='".$log."' and `id`='".$name."' ");
if (mysql_affected_rows()==0)
{
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - У вас нет такой магии.', '".$log."')"); header ("Location: arena.php?&vrag=$nick"); exit;
}
else
{
while($rowi=mysql_fetch_array($qi))
{
if($udata29<$rowi[mag1]){
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Нехватает МР', '".$log."')"); header ("Location: arena.php?&vrag=$nick"); exit;}
if($rowi[mag5]=="stan"){
$random=rand(1,100);
if($random<$rowi[mag0]){
$timer=time()+$rowi[mag17];
mysql_query("INSERT INTO `stan` VALUES ('$nick', '$timer')");
$udata29=$udata29-$rowi[mag1];
mysql_query("UPDATE `users` SET `udata29`='$udata29' WHERE `udata0`='$log'");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Стан прошел успешно.', '".$log."')");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вас оглушил $log. ', '".$nick."')");
}else{mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Стан не прошел.', '".$log."')");}
header ("Location: arena.php?&vrag=$nick"); exit;}
if($rowi[mag16]=="on"){
$randoms=rand(1,7);
if($randoms==1){
$udata4=$udata4*2;
}
}
/////////////////////////////////////////////////////////////////////////////////
if($rowi[mag17]!==""){
$random=rand(1,7);
if($random==1){
$timer=time()+$rowi[mag17];
mysql_query("INSERT INTO `stan` VALUES ('$nick', '$timer')");
$udata29=$udata29-$rowi[mag1];
mysql_query("UPDATE `users` SET `udata29`='$udata29' WHERE `udata0`='$log'");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Стан прошел успешно.', '".$log."')");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вас оглушили. ', '".$nick."')");
}}
/////////////////////////////////////////////////////////////////////////////////
if($rowi[mag5]=="takehp"){
$hpatk=$hpatk-$rowi[mag0];
mysql_query("UPDATE `arena` SET `hp`='$hpatk' WHERE `id`='$id' LIMIT 1");
$udata16=$udata16+$rowi[mag0];
if($udata16>$udata17){ $udata16=$udata17;}
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы похитили ".$rowi[mag0]." здоровья.', '".$log."')");
$udata29=$udata29-$rowi[mag1];
mysql_query("UPDATE `users` SET `udata29`='$udata29' WHERE `udata0`='$log'");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - У вас похители ".$rowi[mag0]." хп. ', '".$nick."')");
mysql_query("UPDATE `users` SET `udata16`='$udata16' WHERE `udata0`='$log' LIMIT 1"); header ("Location: arena.php?&vrag=$nick"); exit;}
$test = mysql_query("SELECT * FROM `weapon_item` WHERE `login`='$log' and `name`='$udata12' ");
$ts=mysql_fetch_array($test);
if($ts[weaponType]=="dual"){$ts[weaponType]=7;}
if($ts[weaponType]=="sword"){$ts[weaponType]=1;}
if($ts[weaponType]=="bow"){$ts[weaponType]=2;}
if($ts[weaponType]=="blunt"){$ts[weaponType]=3;}
if($ts[weaponType]=="dagger"){$ts[weaponType]=4;}
if($ts[weaponType]=="pole"){$ts[weaponType]=5;}
if($ts[weaponType]=="dualfist"){$ts[weaponType]=6;}
if($ts[weaponType]=="etc"){$ts[weaponType]=10;}
if($ts[weaponType]==$rowi[mag12] or $ts[weaponType]==$rowi[mag13] or $ts[weaponType]==$rowi[mag14] or $rowi[mag12]=="" or $rowi[mag12]=="8" or $rowi[mag12]=="9"){
$udar=round($udata4+$rowi['mag0']);
$refka=rand(1,2);
$atkmin=$udata4/2;
$ref=rand($atkmin,$udata4);
$udk=$ref-$zashita;
$udk=round($udk+$rowi['mag0']);
if($udk<"0"){ $udk="0";}
$game = mysql_query("SELECT * FROM `arena` WHERE `login`='$log' LIMIT 1 ");
$boi=mysql_fetch_array($game);
$kolatk=$boi[kolatk]+$udk;
mysql_query("UPDATE `arena` SET `kolatk`='$kolatk' WHERE `login`='$log'");
$tttt = mysql_query("SELECT * FROM `weapon_item` WHERE `login`='$log' and `name`='$udata12' ");
$ts=mysql_fetch_array($tttt);
$qii = mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `uda2`='soulshots' and `uda3`>'$ts[soulshots]' and `uda0`='active' and `uda6`='$ts[crystal_type]' LIMIT 1");
if (mysql_affected_rows()==1)
{
$qii1 = mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `uda2`='spiritshots' and `uda3`>'$ts[spiritshots]' and `uda0`='active' and `uda6`='$ts[crystal_type]' LIMIT 1");
if (mysql_affected_rows()==1)
{
while($rowii=mysql_fetch_array($qii))
{
if($rowii[uda3]>$ts[soulshots]){
$uda3=$rowii[uda3]-$ts[soulshots];
mysql_query("UPDATE `item` SET `uda3`='$uda3' WHERE `uda7`='$log' and `uda2`='soulshots' and `uda0`='active' and `uda6`='$ts[crystal_type]' LIMIT 1");}
}
$qii = mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `uda2`='spiritshots' and `uda3`>'$ts[spiritshots]' and `uda0`='active' and `uda6`='$ts[crystal_type]' LIMIT 1");
while($rowii=mysql_fetch_array($qii))
{
if($rowii[uda3]>$ts[spiritshots]){
$uda3=$rowii[uda3]-$ts[spiritshots];
mysql_query("UPDATE `item` SET `uda3`='$uda3' WHERE `uda7`='$log' and `uda2`='spiritshots' and `uda0`='active' and `uda6`='$ts[crystal_type]' LIMIT 1");}
}
$udk=$udk*2;
}}
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы нанесли $udk урона.', '".$log."')");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы неуспели увернутся и по вам попали. <b>Урон $udk</b>', '".$nick."')");
$udata29=$udata29-$rowi[mag1];
mysql_query("UPDATE `users` SET `udata29`='$udata29' WHERE `udata0`='$log'");
$udk=$hpatk-$udk;
mysql_query("UPDATE `arena` SET `hp`='$udk' WHERE `login`='$nick'");
mysql_query("UPDATE `users` SET `udata16`='$udk' WHERE `udata0`='$nick'");
mysql_query("UPDATE `arena` SET `vrag`='$nick', `hpvrag`='$udk' WHERE `login`='$log'");
header ("Location: arena.php?&vrag=$nick");
}else{
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Ваш тип оружия неподходит к этому скилу!', '".$log."')"); header ("Location: arena.php?&vrag=$nick");
}
}
}
}
break;
}
?>