battles/user_abilities.php
2019-01-09 21:49:59 +02:00

454 lines
17 KiB
PHP
Raw 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
/**
* Copyright (c) 2019.
* Author: Igor Barkov <lopar.4ever@gmail.com>
* Project name: Battles-Game
* One file to rule 'em all!
*/
session_start();
if (!isset($_SESSION['uid'])) header("Location: index.php");
require_once 'functions.php';
?>
<!doctype html>
<html>
<head>
<link rel=stylesheet href="css/main.css">
<meta charset="utf-8">
</head>
<body>
<div style="text-align: right;"><input type="button" onClick="location.href='main.php';" value="Вернуться"></div>
<h2>Особые умения</h2>
<div align=center id=hint3></div>
<?php
# ORDEN PHP
$al = db::c()->query('SELECT `accses`,`name` FROM `aligns` WHERE `align` = ?i', $user['align'])->fetch_assoc();
$moj = expa($al['accses']);
function imp($array)
{
$str = '';
foreach ($array as $k => $v) $str .= $k . ";" . $v . ";";
return $str;
}
function expa($str)
{
$rarray = '';
$array = explode(";", $str);
for ($i = 0; $i <= count($array) - 2; $i = $i + 2) $rarray[$array[$i]] = $array[$i + 1];
return $rarray;
}
if (in_array($_POST['use'], array_keys($moj))) {
//echo $_GET['use'];
$abil = mysql_fetch_array(mysql_query("SELECT `abil` FROM `users` WHERE `id`='{$user['id']}';"));
$abil = unserialize($abil['abil']);
switch ($_POST['use']) {
case "cure150":
include("./magic/cure150.php");
break;
case "al_neut_power":
if ($abil[0] > 0 && $user['align'] == 2) {
include("./magic/al_neut_power.php");
if ($outok == 1) {
$abil[0] -= 1;
mysql_query("UPDATE `users` SET `abil`='" . serialize($abil) . "' WHERE `id`='{$user['id']}';");
}
} elseif ($user['align'] != 2) include("./magic/al_neut_power.php");
break;
case "ct1":
if ($abil[0] > 0 && $user['align'] == 6) {
include("./magic/ct1.php");
if ($outok == 1) {
$abil[0] -= 1;
mysql_query("UPDATE `users` SET `abil`='" . serialize($abil) . "' WHERE `id`='{$user['id']}';");
}
} elseif ($user['align'] != 6) include("./magic/ct1.php");
break;
case "ct2":
if ($abil[1] > 0 && $user['align'] == 6) {
include("./magic/ct2.php");
if ($outok == 1) {
$abil[1] -= 1;
mysql_query("UPDATE `users` SET `abil`='" . serialize($abil) . "' WHERE `id`='{$user['id']}';");
}
} elseif ($user['align'] != 6) include("./magic/ct2.php");
break;
case "ct3":
if ($abil[2] > 0 && $user['align'] == 6) {
include("./magic/ct3.php");
if ($outok == 1) {
$abil[2] -= 1;
mysql_query("UPDATE `users` SET `abil`='" . serialize($abil) . "' WHERE `id`='{$user['id']}';");
}
} elseif ($user['align'] != 6) include("./magic/ct3.php");
break;
case "sleep":
include("./magic/sleep.php");
break;
case "sleepf":
include("./magic/sleepf.php");
break;
case "sleep_off":
include("./magic/sleep_off.php");
break;
case "sleepf_off":
include("./magic/sleepf_off.php");
break;
case "haos":
include("./magic/haos.php");
break;
case "haos_off":
include("./magic/haos_off.php");
break;
case "obezl":
include("./magic/obezl.php");
break;
case "obezl_off":
include("./magic/obezl_off.php");
break;
case "death":
include("./magic/death.php");
break;
case "death_off":
include("./magic/death_off.php");
break;
case "ldadd":
include("./magic/ldadd.php");
break;
case "pal_off":
include("./magic/pal_off.php");
break;
case "marry":
include("./magic/marry.php");
break;
case "unmarry":
include("./magic/unmarry.php");
break;
case "ct_all":
include("./magic/ct_all.php");
break;
case "check":
include("./magic/check.php");
break;
case "attack":
include("./magic/eattack.php");
break;
case "attack_t":
include("./magic/attack_t.php");
if ($skipper == 1) /* header("Location:fbattle.php");*/
die("<script>location.href='fbattle.php';</script>");
break;
case "battack":
include("./magic/ebattack.php");
break;
case "attackk_close":
if ($abil[1] > 0 && $user['align'] == 2) {
include("./magic/attackk_close.php");
if ($outok == 1) {
$abil[1] -= 1;
mysql_query("UPDATE `users` SET `abil`='" . serialize($abil) . "' WHERE `id`='{$user['id']}';");
die("<script>location.href='fbattle.php';</script>");
}
} else {
include("./magic/attackk_close.php");
die("<script>location.href='fbattle.php';</script>");
}
break;
case "attackk_open":
if ($abil[1] > 0 && $user['align'] == 2) {
include("./magic/attackk_open.php");
if ($outok == 1) {
$abil[2] -= 1;
mysql_query("UPDATE `users` SET `abil`='" . serialize($abil) . "' WHERE `id`='{$user['id']}';");
die("<script>location.href='fbattle.php';</script>");
}
} else {
include("./magic/attackk_open.php");
die("<script>location.href='fbattle.php';</script>");
}
break;
case "brat":
include("./magic/brat.php");
if ($skipper == 1) /* header("Location:fbattle.php"); */
die("<script>location.href='fbattle.php';</script>");
break;
case "vampir":
include("./magic/vampir.php");
break;
case "crush":
include("./magic/devastate.php");
break;
case "def":
include("./magic/defence.php");
break;
case "bexit":
include("./magic/bexit.php");
break;
case "vip":
include("./magic/vips.php");
break;
case "dlight":
include("./magic/dlight.php");
break;
case "ddark":
include("./magic/ddark.php");
break;
case "dneit":
include("./magic/dneit.php");
break;
case "un_align":
include("./magic/un_align.php");
break;
}
}
echo "<table><tr><td><br><br>";
foreach ($moj as $k => $v) {
//echo $k;
switch ($k) {
case "sleep":
$script_name = "runmagic0";
$magic_name = "Наложить заклятие молчания";
break;
case "sleepf":
$script_name = "runmagicf";
$magic_name = "Наложить заклятие форумного молчания";
break;
case "cure150":
$script_name = "runmagic1";
$magic_name = "Лечение(150)";
break;
case "al_neut_power":
$script_name = "RunMagicSelf";
$magic_name = "Сила нейтралитета";
break;
case "ct1":
$script_name = "runmagic1";
$magic_name = "Исцелить легкую травму";
break;
case "ct2":
$script_name = "runmagic1";
$magic_name = "Исцелить среднюю травму";
break;
case "ct3":
$script_name = "runmagic1";
$magic_name = "Исцелить тяжелую травму";
break;
case "sleep_off":
$script_name = "runmagic1";
$magic_name = "Снять заклятие молчания";
break;
case "sleepf_off":
$script_name = "runmagic1";
$magic_name = "Снять заклятие форумного молчания";
break;
case "haos":
$script_name = "runmagic2";
$magic_name = "Наложить заклятие хаоса";
break;
case "haos_off":
$script_name = "runmagic1";
$magic_name = "Снять заклятие хаоса";
break;
case "death":
$script_name = "runmagic1";
$magic_name = "Наложить заклятие смерти";
break;
case "death_off":
$script_name = "runmagic1";
$magic_name = "Снять заклятие смерти";
break;
case "obezl":
$script_name = "runmagic2";
$magic_name = "Наложить заклятие обезличивания";
break;
case "obezl_off":
$script_name = "runmagic1";
$magic_name = "Снять заклятие обезличивания";
break;
case "pal_off":
$script_name = "runmagic1";
$magic_name = "Лишить звания Паладин";
break;
case "attack":
$script_name = "runmagic1";
$magic_name = "Нападение";
break;
case "attack_t":
$script_name = "runmagic1";
$magic_name = "Нападение на Темного";
break;
case "battack":
$script_name = "runmagic1";
$magic_name = "Кровавое нападение";
break;
case "attackk_close":
$script_name = "runmagic1";
$magic_name = "Кулачное закрытое кровавое нападение";
break;
case "attackk_open":
$script_name = "runmagic1";
$magic_name = "Кулачное закрытое нападение";
break;
case "marry":
$script_name = "runmagic4";
$magic_name = "Зарегистрировать брак";
break;
case "unmarry":
$script_name = "runmagic4";
$magic_name = "Расторгнуть брак";
break;
case "hidden":
$script_name = "runmagic1";
$magic_name = "Заклятие невидимости";
break;
case "teleport":
$script_name = "runmagic";
$magic_name = "Телепортация";
break;
case "check":
$script_name = "runmagic1";
$magic_name = "Поставить проверку";
break;
case "ct_all":
$script_name = "runmagic1";
$magic_name = "Вылечить от травм";
break;
case "pal_buttons":
$script_name = "runmagic1";
$magic_name = "Отметить о прохождении проверки";
break;
case "vampir":
$script_name = "runmagic1";
$magic_name = "Вампиризм (выпить энергию другого игрока)";
break;
case "brat":
$script_name = "runmagic1";
$magic_name = "Помочь темному собрату (вмешаться в поединок)";
break;
case "dneit":
$script_name = "runmagic1";
$magic_name = "Присвоить склонность (Нейтральное Братство)";
break;
case "dpal":
$script_name = "runmagic";
$magic_name = "Присвоить склонность (Паладин)";
break;
case "ddark":
$script_name = "runmagic1";
$magic_name = "Присвоить склонность (Темное Братство)";
break;
case "dlight":
$script_name = "runmagic1";
$magic_name = "Присвоить склонность (Светлое Братство)";
break;
case "un_align":
$script_name = "runmagic1";
$magic_name = "Лишить склонности";
break;
case "note":
$script_name = "runmagic";
$magic_name = "Редактировать личное дело";
break;
case "sys":
$script_name = "runmagic";
$magic_name = "Отправить в чат системное сообщение";
break;
case "scanner":
$script_name = "runmagic";
$magic_name = "Показать лог действий модератора";
break;
case "rep":
$script_name = "runmagic";
$magic_name = "Отчет о переводах";
break;
case "rost":
$script_name = "runmagic";
$magic_name = "Присвоить статус";
break;
case "ldadd":
$script_name = "";
$magic_name = "Записать причину отправки в Хаос";
break;
case "crush":
$script_name = "runmagic1";
$magic_name = "Сокрушение";
break;
case "def":
$script_name = "runmagic1";
$magic_name = "Защита от оружия";
break;
case "bexit":
$script_name = "runmagic1";
$magic_name = "Выйти из боя";
break;
}
if ($script_name) {
$action_ok = 1;
$abil = db::c()->query('SELECT `abil` FROM `users` WHERE `id`= ?i', $_SESSION['uid'])->fetch_assoc();
$abil = unserialize($abil['abil']);
if ($user['align'] == 2) {
if ($k == 'al_neut_power') {
if ($abil[0] < 1) $action_ok = 0;
}
if ($k == 'attackk_close') {
if ($abil[1] < 1) $action_ok = 0;
}
if ($k == 'attackk_open') {
if ($abil[2] < 1) $action_ok = 0;
}
}
if ($user['align'] == 6) {
if ($k == 'ct1') {
if ($abil[0] < 1) $action_ok = 0;
}
if ($k == 'ct2') {
if ($abil[1] < 1) $action_ok = 0;
}
if ($k == 'ct3') {
if ($abil[2] < 1) $action_ok = 0;
}
}
}
if ($action_ok > 0) print "<a onclick=\"javascript:$script_name('$magic_name','$k','target','target1') \" href='#'><img src='i/magic/" . $k . ".gif' title='" . $magic_name . "'></a>&nbsp;";
}
if ($user['align'] == 2) // Нейтралы
{
$abil = db::c()->query('SELECT `abil` FROM `users` WHERE `id`= ?i', $_SESSION['uid'])->fetch_assoc();
$abil = unserialize($abil['abil']);
for ($i = 0; $i < 3; $i++) if (!$abil[$i]) $abil[$i] = 0;
echo("<br />Осталось использований:<br />");
echo("<img src='i/magic/al_neut_power.gif' title='Сила нейтралитета'> Сила нейтралитета - " . $abil[0] . "<br />");
echo("<img src='i/magic/attackk_close.gif' title='Кулачное закрытое кровавое нападение'> Кулачное закрытое кровавое нападение - " . $abil[1] . "<br />");
echo("<img src='i/magic/attackk_open.gif' title='Кулачное закрытое нападение'> Кулачное закрытое нападение - " . $abil[2] . "<br />");
}
if ($user['align'] == 6) // Свет
{
$abil = db::c()->query('SELECT `abil` FROM `users` WHERE `id`= ?i', $_SESSION['uid'])->fetch_assoc();
$abil = unserialize($abil['abil']);
for ($i = 0; $i < 3; $i++) if (!$abil[$i]) $abil[$i] = 0;
echo("<br />Осталось использований:<br />");
echo("<img src='i/magic/ct1.gif' title='Исцелить легкую травму'> Исцелить легкую травму - " . $abil[0] . "<br />");
echo("<img src='i/magic/ct2.gif' title='Исцелить среднюю травму'> Исцелить среднюю травму - " . $abil[1] . "<br />");
echo("<img src='i/magic/ct3.gif' title='Исцелить тяжелую травму'> Исцелить тяжелую травму - " . $abil[2] . "<br />");
}
echo "</td></tr></table>";