Файл: l2ps_v5/udar2.php
Строк: 92
<?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;}
switch($tip) {
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_affected_rows()==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]))."' ");
if (mysql_affected_rows()==0)
{
header ("Location: okrestnosti.php?monstr"); exit;}
$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;}
$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);
$hp2=trim($mob2);
$qi = mysql_query("SELECT * from `mag` WHERE `mag10`='".$log."' and `id`='".$name."' LIMIT 1");
if (mysql_affected_rows()==0)
{
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - У вас нет такой магии.', '".$log."')"); header ("Location: ataka.php?&id=$id&startan=$startan&"); exit;
}
else
{
while($rowi=mysql_fetch_array($qi))
{
if($udata29<$rowi['mag1']){
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Нехватает МР', '".$log."')"); header ("Location: ataka.php?&id=$id&startan=$startan&"); exit;}
if($rowi[mag5]=="addhp"){
$udata16=$udata16+$rowi[mag0];
if($udata16>$udata17){$udata16=$udata17;}
mysql_query("UPDATE `users` SET `udata16`='$udata16' WHERE `udata0`='$log' LIMIT 1");
$udata29=$udata29-$rowi[mag1];
mysql_query("UPDATE `users` SET `udata29`='$udata29' WHERE `udata0`='$log' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы пополнили себе здоровье на $rowi[mag0] единиц.', '".$log."')");
}
if($rowi[mag5]=="pethpadd"){
$qi1 = mysql_query("SELECT * from `pitmag` WHERE `login`='".$log."' LIMIT 1");
$avto=mysql_num_rows($qi1);
if($avto==0){
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - У вас нет помощника.', '".$log."')"); header ("Location: ataka.php?&id=$id&startan=$startan&"); exit;
}
$qi1 = mysql_query("SELECT * from `pitmag` WHERE `login`='".$log."' ");
while($pet=mysql_fetch_array($qi1)){
$hp=$pet[hp]+$rowi[mag0];
if($hp>$pet[allhp]){$hp=$pet[allhp];}
mysql_query("UPDATE `pitmag` SET `hp`='$hp' WHERE `login`='$log' AND `name`='$pet[name]' ");
}
$udata29=$udata29-$rowi[mag1];
mysql_query("UPDATE `users` SET `udata29`='$udata29' WHERE `udata0`='$log' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы пополнили помощникам здоровье на $rowi[mag0] единиц.', '".$log."')");
}
//////////////////////////////////////////////
if($rowi[mag5]=="petmpadd"){
$qi1 = mysql_query("SELECT * from `pitmag` WHERE `login`='".$log."' LIMIT 1");
$avto=mysql_num_rows($qi1);
if($avto==0){
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - У вас нет помощника.', '".$log."')"); header ("Location: ataka.php?&id=$id&startan=$startan&"); exit;
}
$qi1 = mysql_query("SELECT * from `pitmag` WHERE `login`='".$log."' ");
while($pet=mysql_fetch_array($qi1)){
$mp=$pet[mp]+$rowi[mag0];
if($mp>$pet[allmp]){$mp=$pet[allmp];}
mysql_query("UPDATE `pitmag` SET `mp`='$mp' WHERE `login`='$log' AND `name`='$pet[name]' ");
}
$udata29=$udata29-$rowi[mag1];
mysql_query("UPDATE `users` SET `udata29`='$udata29' WHERE `udata0`='$log' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы пополнили помощникам здоровье на $rowi[mag0] единиц.', '".$log."')");
}
///////////////////////////////////////////////////////////
if($rowi[mag5]=="grouphp"){
$qi1 = mysql_query("SELECT * from `paty` WHERE `paty0`='$log' or `paty1`='$log' ");
$paty1=mysql_num_rows($qi1);
if($paty1==0){mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы не в пати.', '".$log."')"); header ("Location: ataka.php?&id=$id&startan=$startan&"); exit;}
while($paty=mysql_fetch_array($qi1)){
$us = mysql_query("SELECT * from `users` WHERE `udata0`='$paty[paty0]' or `udata0`='$paty[paty1]' ");
while($users=mysql_fetch_array($us)){
$hp=$users[udata16]+$rowi[mag0];
if($hp>$users[udata17]){$hp=$users[udata17];}
mysql_query("UPDATE `users` SET `udata16`='$hp' WHERE `udata0`='$paty[paty0]' or `udata0`='$paty[paty1]' ");
}}
$udata29=$udata29-$rowi[mag1];
mysql_query("UPDATE `users` SET `udata29`='$udata29' WHERE `udata0`='$log' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы пополнили здоровье игрокам в пати на $rowi[mag0] единиц.', '".$log."')");
}
if($rowi[mag5]=="groupatk"){
$qi1 = mysql_query("SELECT * from `paty` WHERE `paty0`='$log' or `paty1`='$log' ");
$paty1=mysql_num_rows($qi1);
if($paty1==0){mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы не в пати.', '".$log."')"); header ("Location: ataka.php?&id=$id&startan=$startan&"); exit;}
while($paty=mysql_fetch_array($qi1)){
$us = mysql_query("SELECT * from `users` WHERE `udata0`='$paty[paty0]' or `udata0`='$paty[paty1]' ");
while($users=mysql_fetch_array($us)){
$actime=time()+1800;
mysql_query("INSERT INTO
`baffs` SET
`login` = '$users[udata0]',
`sila` = '$rowi[mag0]',
`time` = '$actime',
`active` = 'off',
`name` = 'baffatk'");
}}
$udata29=$udata29-$rowi[mag1];
mysql_query("UPDATE `users` SET `udata29`='$udata29' WHERE `udata0`='$log' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы дали бафф игрокам в пати на $rowi[mag0] процентов.', '".$log."')");
}
if($rowi[mag5]=="yad"){
if($rowi[mag15]=="off"){
$mb = mysql_query("SELECT * from `okrestnosti` WHERE `id`='".abs(intval($_GET[id]))."' ");
while($mob=mysql_fetch_array($mb)){
$actime=time();
mysql_query("INSERT INTO
`yad` SET
`sila` = '$rowi[mag0]',
`id_mob` = '$mob[id]'");
}}else{
$random=rand(1,3);
$mb = mysql_query("SELECT * from `okrestnosti` WHERE `mob4`='$udata39' LIMIT $random");
while($mob=mysql_fetch_array($mb)){
$actime=time();
mysql_query("INSERT INTO
`yad` SET
`sila` = '$rowi[mag0]',
`id_mob` = '$mob[id]'");
}}
$udata29=$udata29-$rowi[mag1];
mysql_query("UPDATE `users` SET `udata29`='$udata29' WHERE `udata0`='$log' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы отравили врага.', '".$log."')");
}
if($rowi[mag5]=="dezyad"){
mysql_query("DELETE FROM `yad` WHERE `login`='$log' LIMIT 1");
$udata29=$udata29-$rowi[mag1];
mysql_query("UPDATE `users` SET `udata29`='$udata29' WHERE `udata0`='$log' LIMIT 1");
mysql_query("INSERT INTO `battle_log` VALUES ('', '".$time." - Вы излечились от яда.', '".$log."')");
}
header ("Location: ataka.php?&id=$id&startan=$startan&");
break;
}}}}
include_once"files/down.php";
?>