Файл: l2ps_v5/udar.php
Строк: 436
<?php
include("files/ini.php");
include("files/data.php");
$ref=rand(1,3);
$ref2=rand(1,3);
if($udata37==""){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;}
/////////////////////////////////////////////////
$test = mysql_query("SELECT * FROM `armor_item` WHERE `login`='$log' and `name`='$udata11' LIMIT 1");
$ts=mysql_fetch_array($test);
$elita=mysql_query("SELECT * FROM `bonusstats` WHERE `login`='$log' and `vid`='$ts[armor_type]' LIMIT 1 ");
$stats=mysql_fetch_array($elita);
$ts1=mysql_num_rows($elita);
if($ts1==1){
$udata3=$udata3+$stats[kol];}else{$udata3=$udata3;}
switch($tip) {
case 'weapon':
if($udata16<="0"){ header ("Location: gk.php?&go=lose"); exit;}
if($id=""){
$a = @mysql_query("select * from `okrestnosti` WHERE `mob4`='$udata37' ORDER BY RAND() DESC LIMIT 1 ");
while($arr=mysql_fetch_array($a)){
$mob0=$arr['mob0'];
$mob2=$arr['mob2'];
$mob3=$arr['mob3'];
$mob5=$arr['mob5'];
$mob6=$arr['mob6'];
$mob7=$arr['mob7'];
$mob8=$arr['mob8'];
$mob9=$arr['mob9'];
$mob10=$arr['mob10'];
$mob11=$arr['mob11'];
$mob12=$arr['mob12'];
$id=$arr['id'];
$debaff = mysql_query("SELECT * FROM `npc_debaff` WHERE `npc_id`='".abs(intval($t[mob_id]))."' LIMIT 4");
if(mysql_num_rows($debaff)>=1){
while($d=mysql_fetch_array($debaff)){
if($d[persent]=="ON"){
if($d[type]=="pdef"){$power=round(($arr[mob6]/100)*$d[att]); $arr[mob6]=$arr[mob6]-$power;}
if($d[type]=="mdef"){$power=round(($arr[mob12]/100)*$d[att]); $arr[mob12]=$arr[mob12]-$power;}
if($d[type]=="patt"){$power=round(($arr[mob15]/100)*$d[att]); $arr[mob5]=$arr[mob5]-$power;}
if($d[type]=="mdef"){$power=round(($arr[mob11]/100)*$d[att]); $arr[mob11]=$arr[mob11]-$power;}
}else{
if($d[type]=="pdef"){ $arr[mob6]=$arr[mob6]-$d[att];}
if($d[type]=="mdef"){ $arr[mmob12]=$arr[mob12]-$d[att];}
if($d[type]=="patt"){ $arr[mob5]=$arr[mob5]-$d[att];}
if($d[type]=="mdef"){ $arr[mob11]=$arr[mob11]-$d[att];}
}
}
}
$brow=htmlspecialchars(stripslashes(getenv('HTTP_USER_AGENT')));
$ip=htmlspecialchars(stripslashes($_SERVER['REMOTE_ADDR']));
$tmp = @mysql_query("SELECT * FROM `tmp_battle` WHERE `user`='$log' and `id_monstr`='$id' and `monstr_dead`='no' ");
if (mysql_affected_rows()==0)
{
mysql_query("INSERT INTO `tmp_battle` VALUES ('', '".$log."', 'no','".$mob0."','".$id."','no','0','".$ip."/".$brow."')");}
}}
$tmp = @mysql_query("SELECT * FROM `tmp_battle` WHERE `user`='$log' and `monstr_dead`='no' and `id_monstr`='".abs(intval($_GET[id]))."' ");
if (mysql_affected_rows()==0)
{header ("Location: okrestnosti.php?monstr"); exit;}
$qi = mysql_query("select * from `npc` WHERE `mob4`='".$udata37."' and `mob7`<('".time()."'-'300') and `id`='".abs(intval($_GET[id]))."' ");
if (mysql_affected_rows()==0)
{
header ("Location: okrestnosti.php?monstr"); exit;}
if($id=""){
$test = mysql_query("SELECT * FROM `okrestnosti` WHERE `mob4`='$udata37' ORDER BY RAND() desc LIMIT 1");
$ts=mysql_fetch_array($test);
$_GET[id]=$ts[id];}
$a = @mysql_query("select * from `okrestnosti` WHERE `mob4`='$udata37' and `mob7`<('".time()."'-'300') and `id`='".abs(intval($_GET[id]))."' ");
if (mysql_affected_rows()==0)
{
header ("Location: okrestnosti.php?monstr"); exit;}
while($arr=mysql_fetch_array($a)){
$time = date("H:i:s");
$hp=trim($udata16);
$allhp=trim($udata17);
$mob1=$arr['mob1'];
$mob2=$arr['mob2'];
$mob3=$arr['mob3'];
$mob5=$arr['mob5'];
$mob0=$arr['mob0'];
$mob6=$arr['mob6'];
$mob7=$arr['mob7'];
$mob8=$arr['mob8'];
$mob9=$arr['mob9'];
$mob10=$arr['mob10'];
$mob11=$arr['mob11'];
$mob12=$arr['mob12'];
$id=$arr['id'];
if($udata16<="0"){
$udata48=deadmob;
mysql_query("UPDATE `users` SET `udata48`='$udata48' WHERE `udata0`='".mysql_real_escape_string($log)."'");
header ("Location: gk.php?&go=lose");
exit;}
if($udata37=="$udata20 Castle"){
if($mob0!="Стена"){
$stena = mysql_query("SELECT * FROM `okrestnosti` WHERE `mob4`='$udata20 Castle' AND `mob7`<('".time()."'-'300') AND `mob0`='Стена' LIMIT 1");
$go = mysql_num_rows($stena);
if($go==1){echo'Сначало нужно разрушить стену!';include_once'files/down.php';exit;}
}
if($mob0!="Guard" AND $mob0!="Стена"){
$stena1 = mysql_query("SELECT * FROM `okrestnosti` WHERE `mob4`='$udata20 Castle' AND `mob7`<('".time()."'-'300') AND `mob0`='Guard'");
$go1 = mysql_num_rows($stena1);
if($go1>=1){echo'Сначало нужно убить всех Guard`ов.';include_once'files/down.php';exit;}
}
}
if($mob8=="RaidBoss" and $mob0!="Стена" and $mob0!="Кристал"){
$dp2=$udata9+10;
$dm2=$udata9-10;
if($dp2<$mob1){include_once("sys/zag.php");echo"Разница уровней больше или меньше 10";
include_once'files/down1.php';exit;}
if($dm2>$mob1){include_once("sys/zag.php");echo"Разница уровней больше или меньше 10";
include_once'files/down1.php';exit;}
}
$tmp = @mysql_query("SELECT * FROM `tmp_battle` WHERE `user`='$log' and `id_monstr`='".abs(intval($_GET[id]))."'");
if (mysql_affected_rows()==0)
{header ("Location: okrestnosti.php?monstr"); exit;}
$allhp2=trim($mob3);
$die=trim($udat[5]);
$hp2=trim($mob2);
$pit = mysql_query("SELECT * from `pit` WHERE `usr`='".$log."' and `active`='yes' LIMIT 1");
if (mysql_affected_rows()==0)
{
}else{
$pi=mysql_fetch_array($pit);
if($pi[name]=="Дракон"){
$randpit=rand(1,2); }else
if($pi[name]=="Волк"){
$randpit=rand(1,3); }
if($randpit=="1"){
$tmp = @mysql_query("SELECT * FROM `tmp_battle` WHERE `user`='$log' and `id_monstr`='".abs(intval($_GET[id]))."'");
$tm=mysql_fetch_array($tmp);
$udarpit=$pi[attack];
$tm[uron]=$tm[uron]+$udarpit;
mysql_query("UPDATE `tmp_battle` SET `uron`='$tm[uron]' WHERE `user`='$log' and `id_monstr`='".abs(intval($_GET[id]))."' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - $pi[name] нанес $udarpit урона монстру.', '".$log."')");
$udk1=$mob2-$udarpit;
mysql_query("UPDATE `npc` SET `mob2`='$udk1' WHERE `id`='".abs(intval($_GET[id]))."'");
}else{
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - $pi[name] промахнулся', '".$log."')");}
$randdef=rand(1,3);
if($randdef=="1"){
$met=$mob5;
if($mob8=="RaidBoss"){
$udarrr=rand($mob11,$mob12);
}else{$udarrr=$met-$pi[def];}
if($udarrr<"0"){ $udarrr="0";}
$pi[hp]=$pi[hp]-$udarrr;
mysql_query("UPDATE `pit` SET `hp`='$pi[hp]' WHERE `usr`='$log' and `active`='yes' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - $pi[name] не успел увернутся от удара и в него попали. Урон: $udarrr', '".$log."')");
}
if($pi[hp]<=0){
mysql_query("UPDATE `pit` SET `hp`='$pi[allhp]',`active`='no' WHERE `usr`='$log' and `active`='yes' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - $pi[name] умер.', '".$log."')");
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
$pitmag = mysql_query("SELECT * from `pitmag` WHERE `login`='".$log."' AND `vid`='petatk' LIMIT 1");
if (mysql_affected_rows()==0)
{
}else{
$pi=mysql_fetch_array($pitmag);
if($pi[vid]=="petatk"){
$randpit=rand(1,3);
if($randpit=="1" or $randpit=="2"){
$tmp = @mysql_query("SELECT * FROM `tmp_battle` WHERE `user`='$log' and `id_monstr`='".abs(intval($_GET[id]))."'");
$tm=mysql_fetch_array($tmp);
$udarpit=$pi[attack];
$tm[uron]=$tm[uron]+$udarpit;
mysql_query("UPDATE `tmp_battle` SET `uron`='$tm[uron]' WHERE `user`='$log' and `id_monstr`='".abs(intval($_GET[id]))."' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - $pi[name] нанес $udarpit урона монстру.', '".$log."')");
$udk1=$mob2-$udarpit;
mysql_query("UPDATE `okrestnosti` SET `mob2`='$udk1' WHERE `id`='".abs(intval($_GET[id]))."'");
}else{
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - $pi[name] промахнулся', '".$log."')");}
$randdef=rand(1,2);
if($randdef=="1"){
$met=$mob5;
if($mob8=="RaidBoss"){
$udarrr=rand($mob11,$mob12);
}else{$udarrr=$met-$pi[def];}
if($udarrr<"0"){ $udarrr="0";}
$pi[hp]=$pi[hp]-$udarrr;
mysql_query("UPDATE `pitmag` SET `hp`='$pi[hp]' WHERE `login`='$log' AND `vid`='petatk' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - $pi[name] не успел увернутся от удара и в него попали. Урон: $udarrr', '".$log."')");
}
if($pi[hp]<=0){
mysql_query("DELETE FROM `pitmag` WHERE `login`='$log' AND `vid`='petatk' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - $pi[name] убит.', '".$log."')");
}
}}
if($yad==""){
$ref=rand(1,2);
if($ref=="1"){
$p_att=$udata4-$mob6;
if($p_att<"0"){ $p_att="0";}
if($mob8=="RaidBoss"){
$raiduron=$udata4/2;
$p_att=rand($mob5,$mob6);
}
$tmp = @mysql_query("SELECT * FROM `tmp_battle` WHERE `user`='$log' and `id_monstr`='".abs(intval($_GET[id]))."'");
$tm=mysql_fetch_array($tmp);
if($p_att>=$mob2){$p_att=$mob2;}
$tm[uron]=$tm[uron]+$p_att;
mysql_query("UPDATE `tmp_battle` SET `uron`='$tm[uron]' WHERE `user`='$log' and `id_monstr`='".abs(intval($_GET[id]))."' LIMIT 1");
$okudar=rand(1,3);
if($okudar=="1"){
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы решительно ударили во врага. <b>Урон $p_att</b>', '".$log."')");
}else{
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Враг пытался увернутся, но вы сильно ударили во врага. <b>Урон $p_att</b>', '".$log."')"); }
$p_att=$mob2-$p_att;
mysql_query("UPDATE `okrestnosti` SET `mob2`='$p_att' WHERE `id`='".abs(intval($_GET[id]))."'");
}else{
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы засомневались и промахнулись.', '".$log."')");}}else{
$thread = mysql_query("SELECT * from `questkristina_mobs` WHERE `login`='".$log."' and `mob_id`='".$id."' LIMIT 1");
$avto=mysql_num_rows($thread);
if($avto==0){
$random=rand(1,100);
if($random<=80){
$thread = mysql_query("SELECT * from `questkristina` WHERE `login`='".$log."' LIMIT 1");
$avto=mysql_fetch_array($thread);
$kills=$avto[kills]+1;
mysql_query("UPDATE `questkristina` SET `kills`='$kills' WHERE `login`='$log'");
$ostatok=500-$avto[kills]-1;
mysql_query("INSERT INTO `questkristina_mobs` VALUES ('".$log."', '".$id."')");
if($ostatok==0){$ostatok="Все мобы отравлены, задание выполнено, возвращайтесь к Кристине!";
mysql_query("Delete from `questkristina_mobs` WHERE `login`='".$log."' ");}
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы успешно отравили монстра. Осталось отравить: $ostatok.', '".$log."')");
}else{
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Отравление неудалось.', '".$log."')");
}}else{mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы уже отравили этого монстра.', '".$log."')");}}
$refin=rand(1,3);
if($refin=="1"){
$met=$mob5;
$rtip=rand(1,2);
if($rtip=="1"){
if($mob8=="RaidBoss"){
$udarr=rand($mob5,$mob6);
}else{$udarr=$met-$udata3;}
if($udarr<"0"){ $udarr="0";}
$udata16=$udata16-$udarr;
mysql_query("UPDATE `users` SET `udata16`='$udata16' WHERE `udata0`='$log'");
}else{
if($mob8=="RaidBoss"){
$udarr=rand($mob11,$mob12);
}else{$udarr=$met2-$udata82;}
if($udarr<"0"){ $udarr="0";}
$udata16=$udata16-$udarr;
mysql_query("UPDATE `users` SET `udata16`='$udata16' WHERE `udata0`='$log'");
}
$okpopad=rand(1,3);
if($okpopad=="1"){
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы не успели увернуться от удара. <b>Урон $udarr</b>', '".$log."')");
}else{
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы засомневались и в вас попали. <b>Урон $udarr</b>', '".$log."')");}
}else{
$okprom=rand(1,3);
if($okprom=="1"){
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы отскочили от удара', '".$log."')"); }else{
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы пригнулись и монстр промахнулся.', '".$log."')");
}
}
if($udata16<="0"){
$udata48=deadmob;
mysql_query("UPDATE `users` SET `udata48`='$udata48' WHERE `udata0`='".mysql_real_escape_string($log)."'");
header ("Location: gk.php?&go=lose");
exit;}
header ("Location: ataka.php?&startan=$startan&id=$id");
}
break;
case 'mag':
if($udata16<="0"){ header ("Location: gk.php?&go=lose"); exit;}
$tmp = mysql_query("SELECT * FROM `tmp_battle` WHERE `user`='$log' and `monstr_dead`='no' and `id_monstr`='".abs(intval($_GET[id]))."' ");
if (mysql_num_rows($tmp)==0){header ("Location: okrestnosti.php?monstr"); exit;}
$qi = mysql_query("SELECT * FROM `okrestnosti` WHERE `mob4`='$udata37' and `mob7`<('".time()."'-'300') and `id`='".abs(intval($_GET[id]))."' LIMIT 1");
if (mysql_num_rows($qi)==0){header ("Location: okrestnosti.php?monstr"); exit;}
$n=mysql_fetch_array($qi);
$time = date("H:i:s");
$mob1=$n['mob1'];
$mob2=$n['mob2'];
$mob3=$n['mob3'];
$mob5=$n['mob5'];
$mob0=$n['mob0'];
$mob6=$n['mob6'];
$mob7=$n['mob7'];
$mob8=$n['mob8'];
$mob9=$n['mob9'];
$mob10=$n['mob10'];
$mob11=$n['mob11'];
$mob12=$n['mob12'];
$id=$n['id'];
$debaff = mysql_query("SELECT * FROM `npc_debaff` WHERE `npc_id`='".abs(intval($t[mob_id]))."' LIMIT 4");
if(mysql_num_rows($debaff)>=1){
while($d=mysql_fetch_array($debaff)){
if($d[persent]=="ON"){
if($d[type]=="pdef"){$power=round(($n[mob6]/100)*$d[att]); $n[mob6]=$n[mob6]-$power;}
if($d[type]=="mdef"){$power=round(($n[mob12]/100)*$d[att]); $n[mob12]=$n[mob12]-$power;}
if($d[type]=="patt"){$power=round(($n[mob15]/100)*$d[att]); $n[mob5]=$n[mob5]-$power;}
if($d[type]=="mdef"){$power=round(($n[mob11]/100)*$d[att]); $n[mob11]=$n[mob11]-$power;}
}else{
if($d[type]=="pdef"){ $n[mob6]=$n[mob6]-$d[att];}
if($d[type]=="mdef"){ $n[mmob12]=$n[mob12]-$d[att];}
if($d[type]=="patt"){ $n[mob5]=$n[mob5]-$d[att];}
if($d[type]=="mdef"){ $n[mob11]=$n[mob11]-$d[att];}
}
}
}
if($n[stan_time]<time()){
$refi=rand(1,2);
if($refi=="1"){
$met=$mob5;
$met2=$mob11;
$rtip=rand(1,2);
if($rtip=="1"){
if($mob8=="RaidBoss"){
$udarr=rand($mob5,$mob6);
}else{$udarr=$met-$udata3;}
if($udarr<"0"){ $udarr="0";}
$udata16=$udata16-$udarr;
mysql_query("UPDATE `users` SET `udata16`='$udata16' WHERE `udata0`='$log'");
}else{
if($mob8=="RaidBoss"){
$udarr=rand($mob11,$mob12);
}else{$udarr=$met2-$udata82;}
if($udarr<"0"){ $udarr="0";}
$udata16=$udata16-$udarr;
mysql_query("UPDATE `users` SET `udata16`='$udata16' WHERE `udata0`='$log'");
}
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы не успели отвернутся от удара, урон $udarr', '".$log."')");
}else{
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы отпрыгнули от удара', '".$log."')");
}
if($udata16<="0"){
$udata48=deadmob;
mysql_query("UPDATE `users` SET `udata48`='$udata48' WHERE `udata0`='".mysql_real_escape_string($log)."'");
header ("Location: gk.php?&go=lose");
exit;}
header ("Location: ataka.php?&id=$id&startan=$startan&");
}else{mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Моб в стане!', '".$log."')"); header ("Location: ataka.php?&id=$id&startan=$startan&");}
//////////////////////////////////////////////////////////////////Атака магией ..........////////////////////////////////////////
$skill = @mysql_query("SELECT * FROM `l2pirates_skills` WHERE `user_id`='$USER_ID' and `id`='".abs(intval($_GET[id_mag]))."' and `battle`='ON' LIMIT 1 ");
$s = mysql_fetch_array($skill);
if(mysql_num_rows($skill)==0){
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Ошибка. Умение не сушествует или не включено в бой.', '".$log."')");
header ("Location: /ataka.php?id=$n[id]"); exit;}
if($s[timer]>time()){
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Умение ещё не готово.', '".$log."')");
header ("Location: /ataka.php?id=$n[id]"); exit;}
if($udata29<$s[mp]){
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Нехватает MP', '".$log."')");
header ("Location: /ataka.php?id=$n[id]"); exit;}
////////////////////////////////////////////////////type[udar]//////////////////////////////////////////////////////////
if($s[type]=="udar" or $s[type]=="hpu"){
$p_att = $udata4+$s[udar_att];
//////////////////////////////////////Soulshot/Spiritshot/////////////////////////////////////////////
$tttt = mysql_query("SELECT * FROM `weapon_item` WHERE `login`='$log' and `name`='$udata12' ");
$ts=mysql_fetch_array($tttt);
if($ts[soulshots]!=0){
$test1 = mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `uda2`='spiritshots' and `uda3`>'$ts[spiritshots]' and `uda6`='$ts[crystal_type]' LIMIT 1");
$testttt1=mysql_num_rows($test1);
$rowi1=mysql_fetch_array($test1);
$test = mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `uda2`='soulshot' and `uda3`>'$ts[soulshots]' and `uda6`='$ts[crystal_type]' LIMIT 1");
$testttt=mysql_num_rows($test);
$rowii=mysql_fetch_array($test);
if($testttt!=0){
$uda3=$rowii[uda3]-$ts[soulshots];
mysql_query("UPDATE `item` SET `uda3`='$uda3' WHERE `uda7`='$log' and `uda2`='soulshot' and `uda6`='$ts[crystal_type]' LIMIT 1");
$p_att=$p_att*2;}elseif($testttt1!=0){
$uda3=$rowi1[uda3]-$ts[spiritshots];
mysql_query("UPDATE `item` SET `uda3`='$uda3' WHERE `uda7`='$log' and `uda2`='spiritshots' and `uda6`='$ts[crystal_type]' LIMIT 1");
$p_att=$p_att*2;}
}elseif($ts[spiritshots]!=0){
$test1 = mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `uda2`='spiritshots' and `uda3`>'$ts[spiritshots]' and `uda6`='$ts[crystal_type]' LIMIT 1");
$testttt1=mysql_num_rows($test1);
if($testttt1!=0){
$uda3=$rowi1[uda3]-$ts[spiritshots];
mysql_query("UPDATE `item` SET `uda3`='$uda3' WHERE `uda7`='$log' and `uda2`='spiritshots' and `uda6`='$ts[crystal_type]' LIMIT 1");
$p_att=$p_att*2;}
}
if($p_att<"0"){ $p_att="0";}
////////////////////////////////////////////
$tttt = mysql_query("SELECT * FROM `weapon_item` WHERE `login`='$log' and `name`='$udata12' ");
$ts=mysql_fetch_array($tttt);
if($ts[soulshots]!=0){
$test1 = mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `uda2`='spiritshots' and `uda3`>'$ts[spiritshots]' and `uda6`='$ts[crystal_type]' LIMIT 1");
$testttt1=mysql_num_rows($test1);
$rowi1=mysql_fetch_array($test1);
$test = mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `uda2`='soulshot' and `uda3`>'$ts[soulshots]' and `uda6`='$ts[crystal_type]' LIMIT 1");
$testttt=mysql_num_rows($test);
$rowii=mysql_fetch_array($test);
if($testttt!=0){
$uda3=$rowii[uda3]-$ts[soulshots];
mysql_query("UPDATE `item` SET `uda3`='$uda3' WHERE `uda7`='$log' and `uda2`='soulshot' and `uda6`='$ts[crystal_type]' LIMIT 1");
$p_att=$p_att*2;}elseif($testttt1!=0){
$uda3=$rowi1[uda3]-$ts[spiritshots];
mysql_query("UPDATE `item` SET `uda3`='$uda3' WHERE `uda7`='$log' and `uda2`='spiritshots' and `uda6`='$ts[crystal_type]' LIMIT 1");
$p_att=$p_att*2;}
}elseif($ts[spiritshots]!=0){
$test1 = mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `uda2`='spiritshots' and `uda3`>'$ts[spiritshots]' and `uda6`='$ts[crystal_type]' LIMIT 1");
$testttt1=mysql_num_rows($test1);
if($testttt1!=0){
$uda3=$rowi1[uda3]-$ts[spiritshots];
mysql_query("UPDATE `item` SET `uda3`='$uda3' WHERE `uda7`='$log' and `uda2`='spiritshots' and `uda6`='$ts[crystal_type]' LIMIT 1");
$p_att=$p_att*2;}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////
if($n[mob8]=="RaidBoss"){$p_att = rand(1,$udata4);}else{if($p_att>=$n[mob2]){$p_att = $n[mob2];}}
$mob_hp = $n[mob2] - $p_att;
if($s[type]=="hpu"){
if($s[absor_persent]=="ON"){
$hp_u = round(($p_att/100)*$s[absor]);
if($udata16!=$udata17){
$udata16 = $udata16+$hp_u;
if($udata16>$udata17){$udata16=$udata17;}
mysql_query("UPDATE `users` SET `udata16` = '$udata16' WHERE `udata0` = '$udata0' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы поглотили $hp_u HP'', '".$log."')");
}
}
}
$tmp =@mysql_query("SELECT * FROM `tmp_battle` WHERE `user`='$log' and `id_monstr`='".abs(intval($_GET[id]))."'");
$tm=mysql_fetch_array($tmp);
$tm[uron]=$tm[uron]+$p_att;
mysql_query("UPDATE `tmp_battle` SET `uron`='$tm[uron]' WHERE `user`='$log' and `id_monstr`='".abs(intval($_GET[id]))."' LIMIT 1");
if($mob_hp>=1){
mysql_query("UPDATE `npc` SET `mob2` = '$mob_hp' WHERE `id` = '$n[id]' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы нанесли <b>".mysql_real_escape_string($n[mob0])."</b> <font color=green>$p_att</font> урона', '".$log."')");
}else
if($mob_hp<=0){
$mob_hp=$n[mob3];
if($n[mob8]=="RaidBoss"){
$rf = rand(86400,259200);
$time = time()+$rf;
}else{
$time = time()+300;
}
mysql_query("UPDATE `okrestnosti` SET `mob2` = '$mob_hp',`time` = '$time' WHERE `id` = '$n[id]' LIMIT 1");
mysql_query("UPDATE `tmp_battle` SET `monstr_dead`='yes' WHERE `user`='$log' and `id_monstr`='".abs(intval($_GET[id]))."' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." -Вы нанесли <b>".mysql_real_escape_string($n[mob0])."</b> <font color=green>$p_att</font> урона', '".$log."')");
header ("Location: okrestnosti.php?go=win&id=$_GET[id]"); exit;
}
}
////////////////////////////////////////////////////////////////////////type[hp]///////////////////////////////////////////////////////
if($s[type]=="hp"){
if($udata16!=$udata17){
$udata16 = $udata16+$s[udar_att];
if($udata16>$udata17){$udata16=$udata17;}
mysql_query("UPDATE `users` SET `udata16` = '$udata16' WHERE `udata0` = '$udata0' LIMIT 1");
mysql_query("INSERT INTO `history_battle` VALUES ('', 'Вы востановили $s[udar_att] HP', '".$USER_ID."')");
}
}
////////////////////////////////////////////////////////////////////////type[stan]///////////////////////////////////////////////////////
if($s[type]=="stan"){
$stan_rand = rand(1,3);
if($stan_rand==1){
mysql_query("UPDATE `okrestnosti` SET `stan_time` = ('$s[stan_time]'+'".time()."') WHERE `id` = '$n[id]' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Stan атака прошла удачно, монстр обиздвижен на $s[stan_time] секунд', '".$log."')");
}else{
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Stan атака не прошла', '".$log."')");
}
}
////////////////////////////////////////////////////////////////////////type[debaff]///////////////////////////////////////////////////////
if($s[type]=="debaff"){
$weapon = mysql_query("SELECT * FROM `npc_debaff` WHERE `npc_id`='$n[id]' and `type`='$s[dbaff_type]' LIMIT 1");
if(mysql_num_rows($weapon)==1){
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - На монстра уже наложен такой тип умения.', '".$log."')");
header ("Location: /combat/"); exit;}
$time = time()+$s[dbaff_time];
mysql_query("INSERT INTO `npc_debaff` (`npc_id`, `type`, `persent`, `att`, `time`,`time_d`) VALUES ('$n[id]', '$s[dbaff_type]', '$s[dbaff_persent]', '$s[dbaff_att]','$time','".time()."');");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы наложили $s[name] на $s[dbaff_time] секунд.', '".$log."')");
}
mysql_query("UPDATE `users` SET `udata29` = ('$udata29'-'$s[mp]') WHERE `udata0` = '$udata0' LIMIT 1");
mysql_query("UPDATE `l2pirates_skills` SET `timer` = ('".time()."'+'$s[time]') WHERE `id` = '$s[id]' LIMIT 1");
header ("Location: /ataka.php?id=$n[id]");
break;
}
?>