battles/magic/invisible.php

30 lines
1.7 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
if($user['battle']) {
echo "<font color=red><b>Не в бою<b></font>";
} elseif(!$user['in_tower']) {
if($_SESSION['uid'] == null) { header("Location: ../../index.php"); }
$magictime = time()+(60*60*2);
$eff = mysql_fetch_row(mysql_query("SELECT `id` FROM `effects` WHERE `owner` = '$user[id]' AND `type` = 1022 LIMIT 1"));
$vip = mysql_fetch_array(mysql_query('SELECT `id`, `uid`, `invisible` FROM `abils_vip` WHERE `uid` = "'.$user['id'].'" LIMIT 1'));
if(isset($vip['id']) && $vip['invisible'] > 0) {
if($_POST['target'] == $user['login']) {
if($eff) {
mysql_query("UPDATE `effects` SET `time` = '$magictime' WHERE `id` = '$eff' LIMIT 1");
echo '<font color=red><b>Успешно наложено заклятие невидимости!<b></font>';
} elseif(isset($user['id'])) {
mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`) values ('".$user['id']."', 'Заклятие невидимости', '{$magictime}', '1022')");
mysql_query("UPDATE `users` SET `invis` = 1 WHERE `id` = '{$user['id']}' LIMIT 1");
echo '<font color=red><b>Успешно наложено заклятие невидимости!<b></font>';
}
$vip['invisible'] -= 1;
mysql_query('UPDATE `abils_vip` SET `invisible` = "'.$vip['invisible'].'" WHERE `id` = "'.$vip['id'].'" LIMIT 1');
} else {
echo '<font color=red><b>Свиток может быть использован только на себя<b></font>';
}
} else {
echo '<font color=red><b>Магия была исчерпана ...<b></font>';
}
} else {
echo "<font color=red><b>В Башне Смерти нельзя использовать свиток невидимости!<b></font>";
}