55 lines
2.2 KiB
PHP
55 lines
2.2 KiB
PHP
<?php
|
||
// magic идентификацыя
|
||
if ($_SESSION['uid'] == null) header("Location: index.php");
|
||
|
||
$us = mysql_fetch_array(mysql_query("SELECT *, (select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '9' ;"));
|
||
if ($user['intel'] >= 1) {
|
||
$int=$magic['chanse'] + ($user['intel'] - 1)*3;
|
||
if ($int>98){$int=99;}
|
||
}
|
||
else {$int=0;}
|
||
|
||
|
||
if(!$us) {
|
||
$bots = mysql_fetch_array(mysql_query ('SELECT * FROM `bots` WHERE `name` = \''.$_POST['target'].'\' LIMIT 1;'));
|
||
}
|
||
//echo
|
||
echo "<font color=red><B>";
|
||
if ($bots) { echo "Нельзя лечить клонов!"; }
|
||
elseif ($us['battle'] != $user['battle']) { echo "Персонаж находится в поединке!"; }
|
||
elseif ($user['room'] != $us['room'] && !$us['battle']) { echo "Персонаж в другой комнате!"; }
|
||
elseif ($us['battle'] && !in_array($us['id'],$fbattle->team_mine)) { echo "Нельзя лечить противников!"; }
|
||
else {
|
||
|
||
if (rand(1,100) < $int) {
|
||
|
||
if ($user['sex'] == 1) {$action="";}
|
||
else {$action="а";}
|
||
|
||
if(($us['hp']+15) > $us['maxhp']) {
|
||
$hp = $us['maxhp'];
|
||
} else {
|
||
$hp = $us['hp']+15;
|
||
}
|
||
if ($user['battle'] > 0) {
|
||
//$fbattle->AddToLog('<span class=date>'.date("H:i").'</span> '.nick5($user['id'],$fbattle->my_class).' использовал'.$action.' заклятие восстановления энергии '.(($us['id']!=$user['id'])?"на ".nick5($us['id'],$fbattle->my_class):"").' и восстановил'.$action.' уровень жизни <B>+15</B> ['.($hp).'/'.$us['maxhp'].']<BR>');
|
||
|
||
mysql_query("UPDATE `battle` SET `to1` = '".time()."', `to2` = '".time()."' WHERE `id` = ".$user['battle']." LIMIT 1;");
|
||
|
||
//$fbattle->write_log ();
|
||
}
|
||
|
||
mysql_query("UPDATE `users` SET `hp` = ".$hp." WHERE `id` = ".$us['id'].";");
|
||
echo "Вы восстановили 15 НР персонажу ".$us['login']."!";
|
||
$bet=1;
|
||
} else {
|
||
echo "Свиток рассыпался в ваших руках...";
|
||
$bet=1;
|
||
}
|
||
|
||
}
|
||
echo "</B></FONT>";
|
||
|
||
|
||
?>
|