2023-03-31 18:42:06 +00:00
< ? php
2022-06-06 21:30:34 +00:00
if ( ! defined ( 'GAME' ))
{
die ();
}
if ( $p [ 'attack' ] == 1 )
{
$uu = mysql_fetch_array ( mysql_query ( 'SELECT * FROM `users` WHERE `login` = "' . mysql_real_escape_string ( $_POST [ 'logingo' ]) . '" LIMIT 1' ));
if ( isset ( $uu [ 'id' ]))
{
if ( $u -> room [ 'noatack' ] == 1 ) {
2023-01-10 16:29:32 +00:00
$uer = 'В данной комнате запрещены нападения!' ;
2022-06-06 21:30:34 +00:00
} elseif ( $uu [ 'id' ] == $u -> info [ 'id' ]) {
2023-01-10 16:29:32 +00:00
$uer = 'Нападать на себя НЕЛЬЗЯ! :)' ;
2022-06-06 21:30:34 +00:00
} elseif ( $uu [ 'room' ] != $u -> info [ 'room' ]) {
2023-01-10 16:29:32 +00:00
$uer = 'ВЫ находитесь в разных комнатах<br>' ;
2022-06-06 21:30:34 +00:00
} else {
$ua = mysql_fetch_array ( mysql_query ( 'SELECT `s`.*,`u`.* FROM `stats` AS `s` LEFT JOIN `users` AS `u` ON `s`.`id` = `u`.`id` WHERE `s`.`id` = "' . mysql_real_escape_string ( $uu [ 'id' ]) . '" LIMIT 1' ));
if ( isset ( $ua [ 'id' ]) && $ua [ 'online' ] > time () - 520 ) {
2023-01-10 16:29:32 +00:00
$usta = $u -> getStats ( $ua [ 'id' ], 0 ); // статы цели
$minHp = floor ( $usta [ 'hpAll' ] / 100 * 33 ); // минимальный запас здоровья цели при котором можно напасть
2022-06-06 21:30:34 +00:00
if ( $ua [ 'battle' ] > 0 ) {
$uabt = mysql_fetch_array ( mysql_query ( 'SELECT * FROM `battle` WHERE `id` = "' . $ua [ 'battle' ] . '" AND `team_win` = "-1" LIMIT 1' ));
if ( ! isset ( $uabt [ 'id' ])) {
$ua [ 'battle' ] = 0 ;
}
}
if ( $ua [ 'battle' ] == 0 && $minHp > $usta [ 'hpNow' ] ) {
2023-01-10 16:29:32 +00:00
$uer = 'Нельзя напасть, у противника не восстановилось здоровье' ;
2022-06-06 21:30:34 +00:00
} elseif ( isset ( $uabt [ 'id' ]) && $uabt [ 'type' ] == 500 && $ua [ 'team' ] == 1 ) {
2023-01-10 16:29:32 +00:00
$uer = 'Нельзя сражаться на стороне монстров!' ;
2022-06-06 21:30:34 +00:00
} elseif ( isset ( $uabt [ 'id' ]) && $uabt [ 'invis' ] > 0 ) {
2023-01-10 16:29:32 +00:00
$uer = 'Нельзя вмешиваться в невидимый бой!' ;
2022-06-06 21:30:34 +00:00
} elseif ( $magic -> testTravma ( $ua [ 'id' ] , 3 ) == true ) {
2023-01-10 16:29:32 +00:00
$uer = 'Противник тяжело травмирован, нельзя напасть!' ;
2022-06-06 21:30:34 +00:00
} elseif ( $magic -> testTravma ( $u -> info [ 'id' ] , 2 ) == true ) {
2023-01-10 16:29:32 +00:00
$uer = 'Вы травмированы, нельзя напасть!' ;
2022-06-06 21:30:34 +00:00
} elseif ( $ua [ 'room' ] == $u -> info [ 'room' ] && ( $minHp <= $usta [ 'hpNow' ] || $ua [ 'battle' ] > 0 ))
{
mysql_query ( 'UPDATE `stats` SET `hpNow` = "' . $usta [ 'hpNow' ] . '",`mpNow` = "' . $usta [ 'mpNow' ] . '" WHERE `id` = "' . $usta [ 'id' ] . '" LIMIT 1' );
$goodt = $magic -> atackUser ( $u -> info [ 'id' ], $ua [ 'id' ], $ua [ 'team' ], $ua [ 'battle' ], $ua [ 'bbexp' ], $ua [ 'type_pers' ]);
$sx = '' ;
if ( $u -> info [ 'sex' ] == 1 )
{
2023-01-10 16:29:32 +00:00
$sx = 'а ' ;
2022-06-06 21:30:34 +00:00
}
2023-01-10 16:29:32 +00:00
$rtxt = '[img[items/pal_button8.gif]] ' . $rang . ' "' . $u -> info [ 'cast_login' ] . '" совершил' . $sx . ' нападение на персонажа "' . $uu [ 'login' ] . '".' ;
2022-06-06 21:30:34 +00:00
if ( $goodt > 0 )
{
2023-01-28 02:24:37 +00:00
$cmsg = new ChatMessage ();
$cmsg -> setCity ( $u -> info [ 'city' ]);
$cmsg -> setRoom ( $u -> info [ 'room' ]);
$cmsg -> setText ( $rtxt );
$cmsg -> setType ( 6 );
$cmsg -> setTypeTime ( 1 );
( new Chat ()) -> sendMsg ( $cmsg );
2022-06-06 21:30:34 +00:00
}
unset ( $goodt );
header ( 'location: main.php' );
}
} else {
2023-01-10 16:29:32 +00:00
$uer = 'Персонаж должен находиться в онлайне' ;
2022-06-06 21:30:34 +00:00
}
2023-01-10 16:29:32 +00:00
/* $upd = mysql_query ( 'UPDATE `eff_users` SET `delete` = "' . time () . '" WHERE `uid` = "' . $uu [ 'id' ] . '" AND `name` LIKE "%травма"' );
2022-06-06 21:30:34 +00:00
if ( $upd )
{
$sx = '' ;
if ( $u -> info [ 'sex' ] == 1 )
{
2023-01-10 16:29:32 +00:00
$sx = 'а ' ;
2022-06-06 21:30:34 +00:00
}
2023-01-10 16:29:32 +00:00
$rtxt = '[img[items/cure3.gif]] ' . $rang . ' "' . $u -> info [ 'cast_login' ] . '" излечил' . $sx . ' персонажа "' . $uu [ 'login' ] . '" от травм.' ;
2023-01-28 02:24:37 +00:00
$cmsg = new ChatMessage ();
$cmsg -> setCity ( $u -> info [ 'city' ]);
$cmsg -> setRoom ( $u -> info [ 'room' ]);
$cmsg -> setText ( $rtxt );
$cmsg -> setType ( 6 );
$cmsg -> setTypeTime ( 1 );
( new Chat ()) -> sendMsg ( $cmsg );
2023-01-10 16:29:32 +00:00
$rtxt = $rang . ' "' . $u -> info [ 'login' ] . '" излечил' . $sx . ' от травм' ;
2022-06-06 21:30:34 +00:00
mysql_query ( " INSERT INTO `users_delo` (`uid`,`ip`,`city`,`time`,`text`,`login`,`type`) VALUES (' " . $uu [ 'id' ] . " ',' " . $_SERVER [ 'REMOTE_ADDR' ] . " ',' " . $u -> info [ 'city' ] . " ',' " . time () . " ',' " . $rtxt . " ',' " . $u -> info [ 'login' ] . " ',0) " );
2023-01-10 16:29:32 +00:00
$uer = 'Вы успешно излечили персонажу "' . $uu [ 'login' ] . '" от травм.' ;
2022-06-06 21:30:34 +00:00
} else {
2023-01-10 16:29:32 +00:00
$uer = 'Н е удалось использовать данное заклятие' ;
2022-06-06 21:30:34 +00:00
} */
}
} else {
2023-01-10 16:29:32 +00:00
$uer = 'Персонаж не найден в этом городе' ;
2022-06-06 21:30:34 +00:00
}
} else {
2023-01-10 16:29:32 +00:00
$uer = 'У В а с нет прав на использование данного заклятия' ;
2022-06-06 21:30:34 +00:00
}
?>