battles/magic/usability_klan/heal35.php

33 lines
1.6 KiB
PHP
Raw Normal View History

2018-01-28 16:40:49 +00:00
<?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` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1"));
$vip = mysql_fetch_array(mysql_query('SELECT `id`, `klan`, `heal35` FROM `abils_klan` WHERE `klan` = "'.$user['klan'].'" LIMIT 1'));
$battle = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle` WHERE `id` = "'.$user['battle'].'" LIMIT 1'));
$t1 = explode(";", $battle['t1']);
if(in_array($user['id'], $t1)) {
$ttt = 1;
} else {
$ttt = 2;
}
if($user['battle'] <= 0) {
echo 'Это боевая магия ...';
} elseif($vip['heal35'] <= 0) {
echo 'Магия исчерпала себя ...';
} elseif($user['battle'] > 0 && $user['hp'] == $user['maxhp']) {
echo 'Ваше здоровье, и так полное ...';
} elseif($user['battle'] > 0 && $user['hp'] <= 0) {
echo 'Вы мертвы ...';
} else {
$vip['heal35'] -= 1;
if($user['invis'] == 1) { $lod = '<i><b>невидимка</b></i>'; } else { $lod = nick::id($user['id'])->short(); }
2018-01-28 16:40:49 +00:00
$hp = floor($user['hp']+35);
addlog($battle['id'], '<span class=date>'.date("H:i").'</span> '.$lod.' использовал заклятие Воcстановление энергии 35%.<BR>');
$user['hp'] += $hp;
if($user['hp'] > $user['maxhp']) {
$user['hp'] = $user['maxhp'];
}
mysql_query('UPDATE `users` SET `hp` = "'.$user['hp'].'" WHERE `id` = "'.$user['id'].'" LIMIT 1');
mysql_query('UPDATE `abils_klan` SET `heal35` = "'.$vip['heal35'].'" WHERE `klan` = "'.$vip['klan'].'" LIMIT 1');
echo 'Успешно';
}