2018-01-28 16:40:49 +00:00
< ? php
$us = mysql_fetch_array ( mysql_query ( " SELECT *,(select `id` from `online` WHERE `real_time` >= " . ( time () - 60 ) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = ' { $_POST [ 'target' ] } ' LIMIT 1; " ));
$owntravma = mysql_fetch_array ( mysql_query ( " SELECT * FROM `effects` WHERE `owner` = " . $us [ 'id' ] . " AND (type=13 OR ND type=12 OR type=14); " ));
$magic = mysql_fetch_array ( mysql_query ( " SELECT `chanse` FROM `magic` WHERE `id` = '23' ; " ));
$raid_t = mysql_fetch_array ( mysql_query ( " SELECT * FROM variables WHERE var='raid_on_status' limit 1; " ));
$hm = mysql_fetch_array ( mysql_query ( " SELECT `value` FROM `variables` WHERE `var` = 'haos_match' LIMIT 1; " ));
$hm = unserialize ( $hm [ 'value' ]);
$us_b = mysql_fetch_array ( mysql_query ( " SELECT `type`,`open` FROM `battle` WHERE `id`=' { $us [ 'battle' ] } '; " ));
$def = mysql_fetch_array ( mysql_query ( " SELECT id FROM effects WHERE type=22 AND owner= " . $us [ 'id' ] . " LIMIT 1; " ));
$effect = mysql_fetch_array ( mysql_query ( " SELECT `id` FROM `effects` WHERE `owner` = ' { $us [ 'id' ] } ' AND `time` > ' " . time () . " ' AND `type` = '227' LIMIT 1 " ));
$forb_battle = array ();
if ( $raid_t [ 'value' ] > 0 )
$forb_battle [] = $raid_t [ 'value' ];
foreach ( $hm as $lv => $num )
if ( $num > 0 )
$forb_battle [] = $num ;
$int = 101 ;
if ( $user [ 'battle' ] > 0 ) {
echo " Н е в бою..." ;
}
elseif ( ! $us [ 'online' ]) {
echo " Персонаж не в игре! " ;
} elseif ( $us [ 'battle' ] > 0 ) {
echo " Персонаж в бою! " ;
} elseif ( $def [ 'id' ] > 0 ) {
echo " Персонаж защищен от кулачного нападения! " ;
} elseif ( $us [ 'align' ] == 2.99 ) {
echo " Н е атакуйте Администратора!" ;
} elseif ( $user [ 'zayavka' ] > 0 ) {
echo " Вы ожидаете поединка... " ;
2020-08-30 16:28:15 +00:00
} elseif ( in_array ( $us [ 'room' ], Config :: $unkilable [ 'rooms' ])) {
2018-01-28 16:40:49 +00:00
echo " В данной комнате запрещены нападения ..." ;
2020-08-30 16:28:15 +00:00
} elseif ( in_array ( $us [ 'id' ], Config :: $unkilable [ 'users' ])) {
2018-01-28 16:40:49 +00:00
echo " Персонаж под защитой от нападений ... " ;
} elseif ( isset ( $effect [ 'id' ])) {
echo " Персонаж под защитой от нападений ... " ;
} elseif ( $owntravma [ 'id' ] && ! $us [ 'battle' ]) {
echo " Персонаж тяжело травмирован... " ;
} elseif ( $user [ 'room' ] != $us [ 'room' ]) {
echo " Персонаж в другой комнате! " ;
} elseif ( $us [ 'room' ] == 31 || $us [ 'room' ] == 46 || $us [ 'room' ] == 47 || $us [ 'room' ] == 48 || $us [ 'room' ] == 49 || $us [ 'room' ] == 600 || $us [ 'room' ] == 601 || $us [ 'room' ] == 45 || $us [ 'room' ] == 602 || $us [ 'room' ] == 43 || $us [ 'room' ] == 45 ) {
echo " Нападения в этой локации запрещены! " ;
} elseif ( $us [ 'align' ] == 2.9 ) {
echo " Нападения на Ангела строго запрещено! " ;
} elseif ( $us [ 'align' ] == 8.11 ) {
echo " Нападение на Гвардейца Света запрещено! " ;
} elseif ( $us [ 'align' ] == 8.21 ) {
echo " Нападение на Гвардейца Тьмы запрещено! " ;
} elseif ( $us [ 'align' ] == 8.31 ) {
echo " Нападение на Гвардейца Нейтралитета запрещено! " ;
} elseif ( $us [ 'align' ] > 1 && $us [ 'align' ] < 2 ) {
echo " Нападение на Паладина запрещено! " ;
} elseif ( $us [ 'align' ] == 4.99 ) {
echo " Нападение на Комментатора запрещено! " ;
} elseif ( $us [ 'level' ] < 1 ) {
echo " Новички находятся под защитой Мироздателя! " ;
} elseif ( $us [ 'hp' ] < $us [ 'maxhp' ] * 0.33 && ! $us [ 'battle' ]) {
echo " Жертва слишком слаба! " ;
} elseif ( $user [ 'hp' ] < $user [ 'maxhp' ] * 0.33 ) {
echo " Вы слишком ослаблены для нападения! " ;
} elseif (( $us [ 'room' ] == 101 ) && ( $us [ 'battle' ] = 0 )) {
echo " Н е вам начинать сражение Тьмы и Света!" ;
} elseif ( mt_rand ( 1 , 100 ) < $int ) {
if ( $user [ 'sex' ] == 1 ) { $action = " напал " ;} else { $action = " напала " ;}
if ( $user [ 'align' ] > '2' && $user [ 'align' ] < '3' ) {
$angel = " Ангел " ;
} elseif ( $user [ 'align' ] > '1' && $user [ 'align' ] < '2' ) {
$angel = " Персонаж " ;
}
$jert = mysql_fetch_array ( mysql_query ( " SELECT * FROM `users` WHERE `login` = ' { $_POST [ 'target' ] } ' LIMIT 1; " ));
if ( $jert [ 'id' ] != $user [ 'id' ]) {
addch ( " <img src=i/magic/attackk_close.gif> <B> { $user [ 'login' ] } </B>, применив магию закрытого кулачного кровавого нападения, внезапно " . $action . " на " { $_POST [ 'target' ] } " " );
2020-08-27 12:17:02 +00:00
addchp ( '<font color=red>Внимание!</font> Н а вас ' . $action . ' <B>' . $user [ 'login' ] . '</B>.<BR>\'; top.frames[\'main\'].location=\'fbattle.php\'; var z = \' ' , '{[]}' . Nick :: id ( $jert [ 'id' ]) -> short () . '{[]}' );
2018-01-28 16:40:49 +00:00
//destructitem($row['id']);
$bet = 1 ;
//а р х
if ( $jert [ 'id' ] > _BOTSEPARATOR_ ) {
$arha = mysql_fetch_array ( mysql_query ( 'SELECT * FROM `bots` WHERE `prototype` = ' . $jert [ 'id' ] . ' LIMIT 1;' ));
$jert [ 'battle' ] = $arha [ 'battle' ];
$jert [ 'id' ] = $arha [ 'id' ];
$bot = 1 ;
}
{
// начинаем бой
//$bet=1;
// если чел в заявке, выбиваем е г о
if ( $jert [ 'zayavka' ]) {
$fict1 = mysql_fetch_array ( mysql_query ( " SELECT * FROM `zayavka` WHERE `team1` LIKE ' { $jert [ 'id' ] } ;%' OR `team1` LIKE '%; { $jert [ 'id' ] } ;%' LIMIT 1; " ));
$fict2 = mysql_fetch_array ( mysql_query ( " SELECT * FROM `zayavka` WHERE `team2` LIKE ' { $jert [ 'id' ] } ;%' OR `team2` LIKE '%; { $jert [ 'id' ] } ;%' LIMIT 1; " ));
if ( $fict1 ) { $team = 1 ; }
elseif ( $fict2 ) { $team = 2 ; }
mysql_query ( " UPDATE `users` SET `zayavka` = '' WHERE `id` = { $jert [ 'id' ] } LIMIT 1; " );
$z = mysql_fetch_array ( mysql_query ( " SELECT `team { $team } ` FROM `zayavka` WHERE `id`= " . $jert [ 'zayavka' ] . " ; " ));
$teams = str_replace ( $jert [ 'id' ] . " ; " , " " , $z [ 0 ]);
mysql_query ( " UPDATE `zayavka` SET team { $team } = ' { $teams } ' WHERE id = { $jert [ 'zayavka' ] } ; " );
}
if ( rand ( 0 , 100 ) < 80 )
undressall ( $jert [ 'id' ]);
undressall ( $user [ 'id' ]);
$teams = array ();
$teams [ $user [ 'id' ]][ $jert [ 'id' ]] = array ( 0 , 0 , time ());
$teams [ $jert [ 'id' ]][ $user [ 'id' ]] = array ( 0 , 0 , time ());
$sv = array ( 3 , 4 , 5 );
//$tou = array_rand($sv,1);
mysql_query ( " INSERT INTO `battle`
(
`id` , `coment` , `teams` , `timeout` , `type` , `status` , `t1` , `t2` , `to1` , `to2` , `blood` , `open`
)
VALUES
(
NULL , '' , '".serialize($teams)."' , '".$sv[rand(0,2)]."' , '1' , '0' , '".$user[' id ']."' , '".$jert[' id ']."' , '".time()."' , '".time()."' , '1' , '0'
) " );
$id = mysql_insert_id ();
// апдейтим врага
if ( $bot ) {
mysql_query ( " UPDATE `bots` SET `battle` = { $id } WHERE `id` = { $jert [ 'id' ] } LIMIT 1; " );
} else {
mysql_query ( " UPDATE `users` SET `battle` = { $id } WHERE `id` = { $jert [ 'id' ] } LIMIT 1; " );
}
// создаем лог
2020-08-27 12:17:02 +00:00
$rr = " <b> " . Nick :: id ( $user [ 'id' ]) -> full ( 1 ) . " </b> и <b> " . Nick :: id ( $jert [ 'id' ]) -> full ( 1 ) . " </b> " ;
addch ( " <a href=logs.php?log= " . $id . " target=_blank>Бой</a> между <B><b> " . Nick :: id ( $user [ 'id' ]) -> short () . " </b> и <b> " . Nick :: id ( $jert [ 'id' ]) -> short () . " </b> начался. " , $user [ 'room' ]);
2018-01-28 16:40:49 +00:00
//mysql_query("INSERT INTO `logs` (`id`,`log`) VALUES('{$id}',"Часы показывали <span class=date>".date("Y.m.d H.i")."</span>, когда ".$rr." бросили вызов друг другу. <BR>");
addlog ( $id , " Часы показывали <span class=date> " . date ( " Y.m.d H.i " ) . " </span>, когда " . $rr . " бросили вызов друг другу. <BR> " );
mysql_query ( " UPDATE users SET `battle` = { $id } ,`zayavka`=0 WHERE `id`= { $user [ 'id' ] } OR `id` = { $jert [ 'id' ] } " );
$outok = 1 ;
header ( " Location:fbattle.php " );
//die("<script>location.href='fbattle.php';</script>");
}
} else {
echo '<font color=red>Мазохист?...</font>' ;
}
//$bet=1;
} else {
echo " Свиток рассыпался в ваших руках... " ;
$bet = 1 ;
}