Чистка оптимизация и унификация кода.
This commit is contained in:
parent
8a2dfea36b
commit
427149b90e
229
admin/admin.php
229
admin/admin.php
@ -202,10 +202,6 @@ $aligns = db::c()->query('SELECT `img`,`align`,`name` FROM `aligns` ORDER BY `al
|
||||
<legend><a href='#' onclick='show("sk3")'>Кланы</a></legend>
|
||||
<div id=sk3 style='display:none;'>
|
||||
<?php
|
||||
|
||||
// $cl_reg_ar=mysql_query("SELECT * FROM `reg_klan` LIMIT 1");
|
||||
// $cl_reg_curr=mysql_fetch_assoc($cl_reg_ar);
|
||||
// $cl_reg_ar = $db->query('SELECT * FROM `reg_klan` LIMIT 1');
|
||||
$cl_reg_curr = db::c()->query('SELECT * FROM `reg_klan` LIMIT 1')->fetch_assoc();
|
||||
// Clan adder : add clan
|
||||
if ($_POST['clan_reg'] == 'add_clan') {
|
||||
@ -213,67 +209,42 @@ $aligns = db::c()->query('SELECT `img`,`align`,`name` FROM `aligns` ORDER BY `al
|
||||
$ser_cl_rights[$cl_reg_curr['owner']][0] = 1;
|
||||
$ser_cl_rights[$cl_reg_curr['owner']][1] = 1;
|
||||
$cl_rights = serialize($ser_cl_rights);
|
||||
// $add_clan = mysql_query('
|
||||
// INSERT INTO `clans` (`short`, `name`, `descr`, `glava`, `vozm`, `align`, `homepage`)
|
||||
// VALUES ("'.$cl_reg_curr['abr'].'", "'.$cl_reg_curr['name'].'", "'.$cl_reg_curr['descr'].'",
|
||||
// "'.$cl_reg_curr['owner'].'", "'.$cl_rights.'", "'.$cl_reg_curr['align'].'", "'.$cl_reg_curr['http'].'")
|
||||
// ');
|
||||
$add_clan = db::c()->query('INSERT INTO `clans` (`short`, `name`, `descr`, `glava`, `vozm`, `align`) VALUES ("?s","?s","?s","?s","?s",?i)',
|
||||
$cl_reg_curr['abbr'], $cl_reg_curr['name'], $cl_reg_curr['descr'], $cl_reg_curr['owner'], $cl_rights, $cl_reg_curr['align']);
|
||||
|
||||
|
||||
if ($add_clan) {
|
||||
echo("<p>Заявка на клан <b>" . $cl_reg_curr['name'] . "</b> подтверждена успешно!</p>");
|
||||
// $cl_reg_tmp=mysql_fetch_assoc(mysql_query("select * from clans where name='".$cl_reg_curr['name']."'"));
|
||||
// mysql_query("delete from reg_klan where id='".$cl_reg_curr['id']."'");
|
||||
// $clan_msg_rec_q = $db->query('SELECT FROM `users` WHERE `id` = ?i', $cl_reg_curr['owner']);
|
||||
// $clan_msg_rec=mysql_fetch_assoc(mysql_query("SELECT * FROM USERS where id='".$cl_reg_curr['owner']."'"));
|
||||
// mysql_query("update users set align='".$cl_reg_curr['align']."',klan='".$cl_reg_tmp['id']."',status='<font color=#008080><b>Глава клана</b></font>' where id='".$cl_reg_curr['owner']."'");
|
||||
echo "<p>Заявка на клан <b>" . $cl_reg_curr['name'] . "</b> подтверждена успешно!</p>";
|
||||
db::c()->query('DELETE FROM `reg_klan` WHERE `id` = ?i', $cl_reg_curr['id']);
|
||||
$cl_reg_tmp = db::c()->query('SELECT `id` FROM `clans` WHERE `name` = "?s"', $cl_reg_curr['name'])->fetch_assoc();
|
||||
$clan_msg_rec = db::c()->query('SELECT FROM `users` WHERE `id` = ?i', $cl_reg_curr['owner'])->fetch_assoc();
|
||||
$clan_msg_rec = db::c()->query('SELECT login FROM `users` WHERE `id` = ?i', $cl_reg_curr['owner'])->fetch_assoc();
|
||||
db::c()->query('UPDATE `users` SET `align` = ?i, `klan` = ?i, `status` = "?s" WHERE `id` = ?i', $cl_reg_curr['align'], $cl_reg_tmp['id'], "<b style='color:#008080'>Глава клана</b>", $cl_reg_curr['owner']);
|
||||
$_POST['grn'] = $clan_msg_rec['login'];
|
||||
$_POST['gr'] = "Ваша заявка на создание клана " . $cl_reg_curr['name'] . " принята!";
|
||||
} else echo("Ошибка подтверждения регистрации!");
|
||||
} else {
|
||||
echo "Ошибка подтверждения регистрации!";
|
||||
}
|
||||
} elseif ($_POST['clan_reg'] == 'not_add_clan') { /* Clan ader : don't add clan*/
|
||||
echo("<p>Заявка на клан <b>" . $cl_reg_curr['name'] . "</b> отклонена!</p>");
|
||||
// mysql_query("delete from reg_klan where id='".$cl_reg_curr['id']."'");
|
||||
// $clan_msg_rec=mysql_fetch_assoc(mysql_query("SELECT * FROM USERS where id='".$cl_reg_curr['owner']."'"));
|
||||
echo "<p>Заявка на клан <b>" . $cl_reg_curr['name'] . "</b> отклонена!</p>";
|
||||
db::c()->query('DELETE FROM `reg_klan` WHERE `id` = ?i', $cl_reg_curr['id']);
|
||||
// $clan_msg_rec_q = $db->query('SELECT FROM `users` WHERE `id` = ?i', $cl_reg_curr['owner']);
|
||||
$clan_msg_rec = db::c()->query('SELECT FROM `users` WHERE `id` = ?i', $cl_reg_curr['owner'])->fetch_assoc();
|
||||
$clan_msg_rec = db::c()->query('SELECT login FROM `users` WHERE `id` = ?i', $cl_reg_curr['owner'])->fetch_assoc();
|
||||
$_POST['grn'] = $clan_msg_rec['login'];
|
||||
$_POST['gr'] = "Ваша заявка на создание клана " . $cl_reg_curr['name'] . " отклонена!";
|
||||
// Moneyback
|
||||
$clan_moneyback = 1200;
|
||||
// switch($cl_reg_curr['align']) {
|
||||
// case 2:$clan_moneyback=1200;break;
|
||||
// case 3:$clan_moneyback=1200;break;
|
||||
// case 6:$clan_moneyback=1200;break;
|
||||
// };
|
||||
// $temp=mysql_query("UPDATE `users` set `money` = money+'$clan_moneyback' WHERE `id` = '".$cl_reg_curr['owner']."' LIMIT 1;");
|
||||
$temp = db::c()->query('UPDATE `users` SET `money` = `money` + ?i WHERE `id` = ?i LIMIT 1', $clan_moneyback, $cl_reg_curr['owner']);
|
||||
// if(!($temp)) echo(mysql_error()); /*В теории сейчас в класс вшит обработчик ошибок.*/
|
||||
}
|
||||
|
||||
// $clan_q_base=mysql_query("select * from reg_klan");
|
||||
// $clan_q=mysql_num_rows($clan_q_base);
|
||||
$clan_q = db::c()->query('SELECT * FROM `reg_klan`')->getNumRows();
|
||||
// Clan adder
|
||||
if ($clan_q) {
|
||||
echo("<p>Заявок в очереди на рассмотрение: <b>$clan_q</b></p>");
|
||||
// $clan_msg_rec=mysql_fetch_assoc(mysql_query("SELECT * FROM USERS where id='".$cl_reg_curr['owner']."'"));
|
||||
// if ($_POST['clan_reg']) mysql_query("delete from reg_klan where id='".$cl_reg_curr['id']."'");
|
||||
echo "<p>Заявок в очереди на рассмотрение: <b>$clan_q</b></p>";
|
||||
$clan_msg_rec = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i', $cl_reg_curr['owner'])->fetch_assoc();
|
||||
if ($_POST['clan_reg']) db::c()->query('DELETE FROM `reg_klan` WHERE `id` = ?i', $cl_reg_curr['id']);
|
||||
echo("<p>Текущая заявка:</p>");
|
||||
if ($_POST['clan_reg']) {
|
||||
db::c()->query('DELETE FROM `reg_klan` WHERE `id` = ?i', $cl_reg_curr['id']);
|
||||
}
|
||||
echo "<p>Текущая заявка:</p>";
|
||||
echo "<table class='adm'><tr><th>Прислал</th><th>Название</th><th>Краткое название</th><th>Сайт</th><th>Направленность</th><th>Описание</th><th>Дата/Время подачи</th></tr>";
|
||||
echo "<tr><td>{$cl_reg_curr['owner']} aka {$clan_msg_rec['login']}</td><td>{$cl_reg_curr['name']}</td><td>{$cl_reg_curr['abr']}</td><td>{$cl_reg_curr['http']}</td><td>{$cl_reg_curr['align']}</td><td>{$cl_reg_curr['descr']}</td><td>{$cl_reg_curr['date']}</td></tr>";
|
||||
echo "</table>";
|
||||
echo("<p><input type='radio' name='clan_reg' value='add_clan' >Подтвердить <br /><input type='radio' name='clan_reg' value='not_add_clan' >Отменить <br /><input type='submit' value='Закончить' ></p>");
|
||||
} else echo("Заявки на регистрацию кланов отсутствуют");
|
||||
|
||||
echo "<p><input type='radio' name='clan_reg' value='add_clan' >Подтвердить <br /><input type='radio' name='clan_reg' value='not_add_clan' >Отменить <br /><input type='submit' value='Закончить' ></p>";
|
||||
} else {
|
||||
echo "Заявки на регистрацию кланов отсутствуют";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</fieldset>
|
||||
@ -291,7 +262,7 @@ $aligns = db::c()->query('SELECT `img`,`align`,`name` FROM `aligns` ORDER BY `al
|
||||
<td><input name="name" placeholder="Название"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name="img" placeholder="Картинка"></td>
|
||||
<td><input name="image" placeholder="Картинка"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><select name="shop">
|
||||
@ -306,132 +277,59 @@ $aligns = db::c()->query('SELECT `img`,`align`,`name` FROM `aligns` ORDER BY `al
|
||||
<td><input name=count placeholder="Количество (шт.)"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><select name="type">
|
||||
<td><select name="item_type">
|
||||
<option value="0" selected disabled>Тип предмета</option>
|
||||
<option value="3">Оружие</option>
|
||||
<option value="11">Сапоги</option>
|
||||
<option value="9">Перчатки</option>
|
||||
<option value="4">Броня</option>
|
||||
<option value="8">Шлемы</option>
|
||||
<option value="10">Щиты</option>
|
||||
<option value="1">Серьги</option>
|
||||
<option value="2">Ожерелья</option>
|
||||
<option value="5">Кольца</option>
|
||||
<option value="12">Заклинания</option>
|
||||
<option value="1">Шлем</option>
|
||||
<option value="2">Броня</option>
|
||||
<option value="3">Поножи</option>
|
||||
<option value="4">Сапоги</option>
|
||||
<option value="5">Перчатки</option>
|
||||
<option value="6">Оружие</option>
|
||||
<option value="7">Щит</option>
|
||||
<option value="8">Пояс</option>
|
||||
<option value="9">Кольцо</option>
|
||||
<option value="10">Амулет</option>
|
||||
<option value="20">Расходник</option>
|
||||
<option value="50">Всё остальное</option>
|
||||
<option value="100">Хлам</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><input name=massa placeholder="Масса"></td>
|
||||
<td><input name=weight placeholder="Масса"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=needident placeholder="Нужно идентифицировать">чекбокс?</td>
|
||||
<td><input name=durability placeholder="Макс. износ"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=letter placeholder="Кол-во знаков">что это?</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=isrep placeholder="Подлежит ремонту">чекбокс?</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=goden placeholder="Годен (дней)"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><select name="razdel">
|
||||
<option value="0" selected disabled>Раздел магазина</option>
|
||||
<option value="1">Оружие: Кастеты, ножи</option>
|
||||
<option value="11">Оружие: Топоры</option>
|
||||
<option value="12">Оружие: Дубины, Булавы</option>
|
||||
<option value="13">Оружие: Мечи</option>
|
||||
<option disabled>--------------------</option>
|
||||
<option value="2">Одежда: Сапоги</option>
|
||||
<option value="21">Одежда: Перчатки</option>
|
||||
<option value="22">Одежда: Броня: легкая</option>
|
||||
<option value="23">Одежда: Броня: тяжелая</option>
|
||||
<option value="24">Одежда: Шлемы</option>
|
||||
<option value="3">Щиты</option>
|
||||
<option disabled>--------------------</option>
|
||||
<option value="4">Ювелирные товары: Серьги</option>
|
||||
<option value="41">Ювелирные товары: Ожерелья</option>
|
||||
<option value="42">Ювелирные товары: Кольца</option>
|
||||
<option disabled>--------------------</option>
|
||||
<option value="5">Заклинания: Нейтральные</option>
|
||||
<option value="51">Заклинания: Боевые, Защитные</option>
|
||||
<option value="6">Аммуниция</option>
|
||||
<option disabled>--------------------</option>
|
||||
<option value="7">Артефакты: Букеты</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=maxdur placeholder="Макс. износ"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=cost placeholder="Цена (кр.)"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=ecost placeholder="Цена (екр.)"></td>
|
||||
<td><input name=price placeholder="Цена (кр.)"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="additem">
|
||||
<th>Требования</th>
|
||||
<tr>
|
||||
<td><input name=nlevel placeholder="Уровень"></td>
|
||||
<td><input name=need_level placeholder="Уровень"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=nsila placeholder="Сила"></td>
|
||||
<td><input name=need_strength placeholder="Сила"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=nlovk placeholder="Ловкость"></td>
|
||||
<td><input name=need_dexterity placeholder="Ловкость"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=ninta placeholder="Интуиция"></td>
|
||||
<td><input name=need_intuition placeholder="Интуиция"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=nvinos placeholder="Выносливость"></td>
|
||||
<td><input name=need_endurance placeholder="Выносливость"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=nintel placeholder="Интеллект"></td>
|
||||
<td><input name=need_intelligence placeholder="Интеллект"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=nmudra placeholder="Мудрость"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=nnoj placeholder="Ум.ножи"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=ntopor placeholder="Ум.топоры"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=ndubina placeholder="Ум.дубины"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=nmech placeholder="Ум.мечи"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=nalign placeholder="Склонность"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=nfire placeholder="Мастерство огня"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=nwater placeholder="Мастерство воды"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=nair placeholder="Мастерство воздуха"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=nearth placeholder="Мастерство земли"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=nlight placeholder="Светлая магия"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=ngray placeholder="Серая магия"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input name=ndark placeholder="Темная магия"></td>
|
||||
<td><input name=need_wisdom placeholder="Мудрость"></td>
|
||||
</tr>
|
||||
|
||||
<th>Характеристики</th>
|
||||
<tr>
|
||||
<td><input name=minu placeholder="Мин.урон"></td>
|
||||
@ -571,7 +469,6 @@ switch ($_POST['use']) { /* Подключаем строго тот свито
|
||||
case "ct3":
|
||||
include("../magic/ct3.php");
|
||||
break;
|
||||
|
||||
case "sleep":
|
||||
include("../magic/sleep.php");
|
||||
break;
|
||||
@ -605,7 +502,6 @@ switch ($_POST['use']) { /* Подключаем строго тот свито
|
||||
case "ldadd":
|
||||
include("../magic/ldadd.php");
|
||||
break;
|
||||
|
||||
case "attack":
|
||||
include("../magic/eattack.php");
|
||||
break;
|
||||
@ -621,7 +517,6 @@ switch ($_POST['use']) { /* Подключаем строго тот свито
|
||||
case "attackk_open":
|
||||
include("../magic/attackk_open.php");
|
||||
break;
|
||||
|
||||
case "pal_off":
|
||||
include("../magic/pal_off.php");
|
||||
break;
|
||||
@ -672,7 +567,6 @@ switch ($_POST['use']) { /* Подключаем строго тот свито
|
||||
echo "<div class=abils><span class='legend'>Абилки:</span>Пока что привязаны к общей системе. Работают выборочно.<br>";
|
||||
$script_name = $magic_name = '';
|
||||
foreach ($moj as $k => $v) {
|
||||
#echo $k;
|
||||
switch ($k) { /* 45 скриптов на 36 умелок? Неплохо… */
|
||||
case "vip":
|
||||
$script_name = "vipad";
|
||||
@ -856,7 +750,9 @@ foreach ($moj as $k => $v) {
|
||||
break;
|
||||
}
|
||||
# Эта строка генерирует свитки с навыком. Но нам нужен просто перечень всего…
|
||||
if ($script_name) print "<a onclick=\"$script_name('$magic_name','$k','target','target1') \" href='#'><img src='i/magic/" . $k . ".gif' title='" . $magic_name . "'></a> ";
|
||||
if ($script_name) {
|
||||
print "<a onclick=\"$script_name('$magic_name','$k','target','target1') \" href='#'><img src='i/magic/" . $k . ".gif' title='" . $magic_name . "'></a> ";
|
||||
}
|
||||
}
|
||||
echo "</div>";
|
||||
?>
|
||||
@ -872,31 +768,6 @@ echo "</div>";
|
||||
<button onclick="vipad('Test','0','0','0')">vipad</button>
|
||||
<button onclick="runmagicgold('Test','0','0','0')">new window test</button>
|
||||
|
||||
<form method='post'>
|
||||
<legend>Выдать чёртов ВИП
|
||||
<small>и переписать функцию выдачи как будет время</small>
|
||||
</legend>
|
||||
<input name="target">
|
||||
<select name="vip_type">
|
||||
<option selected disabled>Тип</option>
|
||||
<option value=1>Silver</option>
|
||||
<option value=2>Gold</option>
|
||||
<option value=3>Platinum</option>
|
||||
</select>
|
||||
<select name="time">
|
||||
<option selected disabled>Срок</option>
|
||||
<option value="1">1 Месяц</option>
|
||||
<option value="2">2 Месяца</option>
|
||||
<option value="3">3 Месяца</option>
|
||||
<option value="4">4 Месяца</option>
|
||||
<option value="5">5 Месяцев</option>
|
||||
<option value="6">6 Месяцев</option>
|
||||
<option value="99999999">Бесконечно</option>
|
||||
</select>
|
||||
<input type="hidden" name="use" value="vip">
|
||||
<input type="submit">
|
||||
</form>
|
||||
|
||||
<form method='post'>
|
||||
<legend>Добавить в «дело» игрока заметку о нарушении правил, прокрутке и пр.</legend>
|
||||
<input name='ldnick' placeholder='Логин'> <input name='ldtext' size='50' placeholder='Сообщение'>
|
||||
@ -995,8 +866,12 @@ if ($_POST['login'] && $_POST['krest']) {
|
||||
$rang = '';
|
||||
break;
|
||||
}
|
||||
if ($_POST['krest'] == -1) db::c()->query('UPDATE `users` SET `align`="?s", `status`="?s" WHERE `login` = "?s" LIMIT 1;', '0', '', $_POST['login']);
|
||||
else db::c()->query('UPDATE `users` SET `align` = "?s", `status` = "?s" WHERE `login` = "?s"', $_POST['krest'], $rang, $_POST['login']);
|
||||
if ($_POST['krest'] == -1) {
|
||||
db::c()->query('UPDATE `users` SET `align`="?s", `status`="?s" WHERE `login` = "?s" LIMIT 1;', '0', '', $_POST['login']);
|
||||
}
|
||||
else {
|
||||
db::c()->query('UPDATE `users` SET `align` = "?s", `status` = "?s" WHERE `login` = "?s"', $_POST['krest'], $rang, $_POST['login']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1206,9 +1081,7 @@ if ($_POST['login'] && $_POST['krest']) {
|
||||
Hint3Name = '';
|
||||
Hint3Closed = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var xmlHttpp = [];
|
||||
|
||||
function ajax_func(func, iid, getpar, postpar) {
|
||||
|
@ -8,37 +8,42 @@
|
||||
session_start();
|
||||
require_once "../functions.php";
|
||||
|
||||
if (empty($user['admin'])) {
|
||||
echo "<!DOCTYPE HTML><html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL {$_SERVER['SCRIPT_NAME']} was not found on this server.</p><hr><address>Apache/2.2.22 (@RELEASE@) Server at Hetzner Datacenter 426</address></body></html>";
|
||||
if (!$user->admin) {
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_POST['player'])) {
|
||||
$p = db::c()->query('SELECT `id`, `login` FROM `users` WHERE `id` = "?s" OR `login` = "?s"', $_POST['player'], $_POST['player'])->fetch_assoc();
|
||||
$_SESSION['player_id'] = $p['id'];
|
||||
$_SESSION['player_name'] = $p['login'];
|
||||
$player = $_POST['player'] ?? null;
|
||||
$undress_char = $_POST['undress_char'] ?? null;
|
||||
$end = $_POST['end'] ?? null;
|
||||
$del = $_POST['del'] ?? null;
|
||||
|
||||
if ($player) {
|
||||
$row = db::c()->query('SELECT id, login FROM users WHERE id = "?s" OR login = "?s"', $player, $player)->fetch_assoc();
|
||||
$_SESSION['player_id'] = $row['id'];
|
||||
$_SESSION['player_name'] = $row['login'];
|
||||
unset($row);
|
||||
}
|
||||
|
||||
if (isset($_POST['undress_char'])) undressall($_SESSION['player_id']);
|
||||
|
||||
if (isset($_POST['end'])) {
|
||||
if ($undress_char) {
|
||||
undressall($_SESSION['player_id']);
|
||||
}
|
||||
if ($end) {
|
||||
unset($_SESSION['player_id']);
|
||||
unset($_SESSION['player_name']);
|
||||
}
|
||||
|
||||
if (isset($_SESSION['player_id']))
|
||||
$inv = db::c()->query('SELECT `id`,`name`,`koll`,`img` FROM `inventory` WHERE `owner` = ?i ORDER BY `id` DESC', $_SESSION['player_id']);
|
||||
|
||||
if (input::post('del')) {
|
||||
$itemdel = db::c()->query('SELECT `type`,`dressed` FROM `inventory` WHERE `id`=?i', input::post('del'))->fetch_assoc();
|
||||
if ($itemdel['dressed'] == 1) {
|
||||
dropitem($itemdel['type']);
|
||||
if ($itemdel['type'] == 5) {
|
||||
if (isset($_SESSION['player_id'])) {
|
||||
$inv = db::c()->query('SELECT item_id, name, image FROM inventory WHERE owner = ?i ORDER BY id DESC', $_SESSION['player_id']);
|
||||
}
|
||||
if ($del) {
|
||||
$itemdel = db::c()->query('SELECT item_type, dressed_slot FROM inventory WHERE id=?i', $del)->fetch_assoc();
|
||||
if ($itemdel['dressed_slot'] == 1) {
|
||||
dropitem($itemdel['item_type']);
|
||||
if ($itemdel['item_type'] == 5) {
|
||||
dropitem(6);
|
||||
dropitem(7);
|
||||
}
|
||||
}
|
||||
db::c()->query('DELETE FROM `inventory` WHERE `id` = ?i', input::post('del'));
|
||||
db::c()->query('DELETE FROM `inventory` WHERE `id` = ?i', $del);
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
|
188
clan.php
188
clan.php
@ -1,84 +1,104 @@
|
||||
<?php
|
||||
ob_start("ob_gzhandler");
|
||||
session_start();
|
||||
if ($_SESSION['uid'] == null) header("Location: index.php");
|
||||
include_once 'config.php';
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
}
|
||||
include_once 'functions.php';
|
||||
$status = null;
|
||||
$action = filter_input(INPUT_POST,'action');
|
||||
$login = filter_input(INPUT_POST,'login');
|
||||
|
||||
if (!$user['klan']) {
|
||||
if (!$user->clan) {
|
||||
die(err('Вы не состоите в клане!'));
|
||||
}
|
||||
$klan = db::c()->query('SELECT * FROM `clans` WHERE `id` = ?i', $user['klan'])->fetch_assoc();
|
||||
$polno = [];
|
||||
$polno = unserialize($klan['vozm']);
|
||||
try {
|
||||
$clanRow = db::c()->query('SELECT * FROM `clans` WHERE `id` = ?i', $user['klan'])->fetch_assoc();
|
||||
$polno = unserialize($clanRow['vozm']) ?? [];
|
||||
} catch (Exception $e) {
|
||||
echo "MYSQL_ERROR: Таблицы clans не существует! Вся панель — одна сплошная ошибка!";
|
||||
}
|
||||
define('COST_ADD_MEMBER', 100);
|
||||
define('COST_REMOVE_MEMBER', 30);
|
||||
define('CASTLE_REPUTATION_NEEDED', 1000000);
|
||||
define('CASTLE_COST', 25000);
|
||||
$status = null;
|
||||
$action = $_POST['action'] ?? 0;
|
||||
$login = $_POST['login'] ?? 0;
|
||||
$zamok = $_POST['zamok'] ?? null;
|
||||
$kr = $_POST['kr'] ?? null;
|
||||
$kolv = $_POST['kolv'] ?? null;
|
||||
$newClanStatus = $_POST['new_status'] ?? null;
|
||||
$vin = $_POST['vin'] ?? null;
|
||||
$tus = $_POST['tus'] ?? null;
|
||||
|
||||
if (isset($_POST['zamok'])) {
|
||||
if ($zamok) {
|
||||
db::c()->query('UPDATE `clans` SET `zamok` = 1 WHERE `glava` = ?i', $_SESSION['uid']);
|
||||
$status = "Начат сбор средств на строительство Кланового Замка.";
|
||||
header("Location: clan.php");
|
||||
}
|
||||
|
||||
if (isset($_POST['kr']) && ($_POST['kolv'] > 0)) {
|
||||
if ($user['money'] >= $_POST['kolv']) {
|
||||
db::c()->query('UPDATE `clans` SET `zbor` = `zbor` + ?i WHERE `id` = ?i', $_POST['kolv'], $user['klan']);
|
||||
db::c()->query('UPDATE `users` SET `money` = `money` - ?i WHERE `id` = ?i', $_POST['kolv'], $user['id']);
|
||||
if ($kr && $kolv > 0) {
|
||||
if ($user->money >= $kolv) {
|
||||
db::c()->query('UPDATE `clans` SET `zbor` = `zbor` + ?i WHERE `id` = ?i', $kolv, $user->clan);
|
||||
db::c()->query('UPDATE `users` SET `money` = `money` - ?i WHERE `id` = ?i', $kolv, $user->id);
|
||||
header("Location: clan.php");
|
||||
} else $status = 'Не хватает денег!';
|
||||
} else {
|
||||
$status = 'Не хватает денег!';
|
||||
}
|
||||
|
||||
if (!empty($login) AND $action == 'add_member' AND $polno[$user['id']][0] == 1) {
|
||||
$sok = db::c()->query('SELECT `id`,`level`,`klan` FROM `users` WHERE `align` = 0 AND `login` = "?s"', $login)->fetch_assoc();
|
||||
$proverka = db::c()->query('SELECT 1 FROM `effects` WHERE `type` = 20 AND `owner` = ?i', $sok['id'])->getNumRows();
|
||||
if (!$proverka) echo "Нет проверки!";
|
||||
elseif (!empty($sok['klan'])) echo 'Персонаж уже состоит в клане!';
|
||||
elseif ($sok['level'] > 0 && $user['money'] >= 100) {
|
||||
db::c()->query('UPDATE `users` SET `money` = `money` - 100 WHERE `id` = ?i', $_SESSION['uid']);
|
||||
db::c()->query('UPDATE `users` SET `status` = "?s", `klan` = "?s", `align` = ?i WHERE `id` = ?i', 'Боец', $klan['id'], $klan['align'], $sok['id']);
|
||||
}
|
||||
if ($login && $action == 'add_member' && $polno[$user['id']][0] == 1) {
|
||||
$sok = db::c()->query('SELECT id, level, clan FROM users WHERE align = 0 AND login = "?s"', $login)->fetch_assoc();
|
||||
$proverka = db::c()->query('SELECT 1 FROM users_effects WHERE type = 20 AND owner_id = ?i', $sok['id'])->getNumRows();
|
||||
if (!$proverka) {
|
||||
echo "Нет проверки!";
|
||||
} elseif ($sok['clan']) {
|
||||
echo 'Персонаж уже состоит в клане!';
|
||||
} elseif ($sok['level'] > 0 && $user->money >= COST_ADD_MEMBER) {
|
||||
db::c()->query('UPDATE users SET money = money - ?i WHERE `id` = ?i', COST_ADD_MEMBER, $_SESSION['uid']);
|
||||
db::c()->query('UPDATE users SET clan = "?s", align = ?i WHERE id = ?i', $clanRow['id'], $clanRow['align'], $sok['id']);
|
||||
$status = 'Персонаж «' . $login . '» успешно принят в клан.';
|
||||
} else $status = 'Не хватает денег, или персонажа не существует.';
|
||||
} else {
|
||||
$status = 'Не хватает денег, или персонажа не существует.';
|
||||
}
|
||||
|
||||
if (!empty($login) AND $action == 'remove_member' AND $polno[$user['id']][0] == 1) {
|
||||
$sok = db::c()->query('SELECT `id` FROM `users` WHERE `klan` = "?s" AND `login` = "?s"', $klan['id'], $login)->fetch_assoc();
|
||||
if ($sok['id'] != $klan['glava'] AND $user['money'] >= 30) {
|
||||
db::c()->query('UPDATE `users` SET `money` = `money` - 30 WHERE `id` = ?i', $_SESSION['uid']);
|
||||
db::c()->query('UPDATE `users` SET `klan` = null, `align` = 0 WHERE `id` = ?i', $sok['id']);
|
||||
}
|
||||
if ($login && $action == 'remove_member' && $polno[$user['id']][0] == 1) {
|
||||
$sok = db::c()->query('SELECT id FROM users WHERE clan = "?s" AND login = "?s"', $clanRow['id'], $login)->fetch_assoc();
|
||||
if ($sok['id'] != $clanRow['glava'] && $user->money >= COST_REMOVE_MEMBER) {
|
||||
db::c()->query('UPDATE users SET money = money - ?i WHERE id = ?i', COST_REMOVE_MEMBER, $_SESSION['uid']);
|
||||
db::c()->query('UPDATE users SET clan = "?s", align = 0 WHERE id = ?i', '', $sok['id']);
|
||||
$status = 'Персонаж «' . $login . '» покинул клан.';
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($login) AND $action == 'change_owner' AND $klan['glava'] == $_SESSION['uid']) {
|
||||
$sok = db::c()->query('SELECT `id` FROM `users` WHERE `klan` = "?s" AND `login` = "?s"', $klan['id'], $login)->fetch_assoc();
|
||||
db::c()->query('UPDATE `clans` SET `glava` = ?i WHERE `id` = ?i', $sok['id'], $klan['id']);
|
||||
db::c()->query('UPDATE `users` SET `status` = null WHERE `id` = ?i', $sok['id']);
|
||||
db::c()->query('UPDATE `users` SET `status` = "?s" WHERE `id` = ?i', 'Боец', $_SESSION['uid']);
|
||||
$klan['glava'] = $sok['id'];
|
||||
if ($login && $action == 'change_owner' && $clanRow['glava'] == $_SESSION['uid']) {
|
||||
$sok = db::c()->query('SELECT id FROM users WHERE clan = "?s" AND login = "?s"', $clanRow['id'], $login)->fetch_assoc();
|
||||
db::c()->query('UPDATE clans SET glava = ?i WHERE id = ?i', $sok['id'], $clanRow['id']);
|
||||
db::c()->query('UPDATE users SET status = "?s" WHERE id = ?i', '', $sok['id']);
|
||||
db::c()->query('UPDATE users SET status = "?s" WHERE id = ?i', 'Боец', $_SESSION['uid']);
|
||||
$clanRow['glava'] = $sok['id'];
|
||||
}
|
||||
|
||||
if (!empty($login) AND $action == 'edit_status') {
|
||||
$sok = db::c()->query('SELECT `id`, `status` FROM `users` WHERE `klan` = "?s" AND `login` = "?s"', $klan['id'], $login)->fetch_assoc();
|
||||
if ($sok['id'] != $klan['glava']) {
|
||||
if (!empty($_POST['new_status'])) {
|
||||
$st = strip_tags(str_replace("<", "<", str_replace(">", ">", $_POST['new_status'])), "<B><I><U>");
|
||||
db::c()->query('UPDATE `users` SET `status` = "?s" WHERE `id` = ?i', $st, $sok['id']);
|
||||
if ($login && $action == 'edit_status') {
|
||||
$sok = db::c()->query('SELECT id, status FROM users WHERE clan = "?s" AND login = "?s"', $clanRow['id'], $login)->fetch_assoc();
|
||||
if ($sok['id'] != $clanRow['glava']) {
|
||||
if ($newClanStatus) {
|
||||
$st = strip_tags(str_replace("<", "<", str_replace(">", ">", $newClanStatus)), "<B><I><U>");
|
||||
db::c()->query('UPDATE users SET status = "?s" WHERE id = ?i', $st, $sok['id']);
|
||||
$sok['status'] = $st;
|
||||
}
|
||||
if ($klan['glava'] == $_SESSION['uid']) {
|
||||
if (!empty($_POST['vin'])) $polno[$sok['id']][0] = 1;
|
||||
else $polno[$sok['id']][0] = 0;
|
||||
|
||||
if (!empty($_POST['tus'])) $polno[$sok['id']][1] = 1;
|
||||
else $polno[$sok['id']][1] = 0;
|
||||
|
||||
db::c()->query('UPDATE `clans` SET `vozm` = "?s" WHERE `id` = ?i', serialize($polno), $klan['id']);
|
||||
if ($clanRow['glava'] == $_SESSION['uid']) {
|
||||
if ($vin) {
|
||||
$polno[$sok['id']][0] = 1;
|
||||
} else {
|
||||
$polno[$sok['id']][0] = 0;
|
||||
}
|
||||
if ($tus) {
|
||||
$polno[$sok['id']][1] = 1;
|
||||
} else {
|
||||
$polno[$sok['id']][1] = 0;
|
||||
}
|
||||
db::c()->query('UPDATE clans SET vozm = "?s" WHERE id = ?i', serialize($polno), $clanRow['id']);
|
||||
}
|
||||
} else {
|
||||
$status = 'Главу клана редактировать запрещено!';
|
||||
}
|
||||
} else $status = 'Главу клана редактировать запрещено!';
|
||||
}
|
||||
|
||||
$clan_memberlist = db::c()->query('SELECT `id`, `login`, `status`, `level`, `room`, `align`, (select `id` from `online` WHERE `date` >= ?i AND `id` = users.`id`) AS `online` FROM `users` WHERE `klan` = ?i ORDER BY `online` DESC , `login` ASC', (time() - 60), $klan['id']);
|
||||
$clan_memberlist = db::c()->query('SELECT `id`, `login`, `status`, `level`, `room`, `align`, (select `id` from `online` WHERE `date` >= ?i AND `id` = users.`id`) AS `online` FROM `users` WHERE `klan` = ?i ORDER BY `online` DESC , `login` ASC', (time() - 60), $clanRow['id']);
|
||||
|
||||
?>
|
||||
<!doctype html>
|
||||
@ -89,36 +109,38 @@ $clan_memberlist = db::c()->query('SELECT `id`, `login`, `status`, `level`, `roo
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<button onclick="location.href='main.php'">Вернуться</button> <?php if (!empty($status)) err($status); ?></div>
|
||||
<button onclick="location.href='main.php'">Вернуться</button>
|
||||
<?php if (!empty($status)) {err($status);} ?>
|
||||
</div>
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
<td>
|
||||
<p style="width: 50%; vertical-align: top;" rowspan=2>
|
||||
<h3><img src="./i/clan/<?= $klan['short'] ?>.gif"><?= $klan['name'] ?></h3>
|
||||
<h3><img src="./i/clan/<?= $clanRow['short'] ?>.gif"><?= $clanRow['name'] ?></h3>
|
||||
Количество рейтинговых очков клана: <span
|
||||
style="color: #428f21; font-size: larger;"><?= $klan['rating'] ?></span><br>
|
||||
style="color: #428f21; font-size: larger;"><?= $clanRow['rating'] ?></span><br>
|
||||
|
||||
<?php if ($polno[$user['id']][0] == 1): ?>
|
||||
<div>
|
||||
<span id="add_member">
|
||||
<input type="submit" onclick="use('add_member')" value="Принять в клан">
|
||||
</span>
|
||||
(стоимость услуги: <B>100</B> кр.)
|
||||
(стоимость услуги: <B><?= COST_ADD_MEMBER ?></B> кр.)
|
||||
</div>
|
||||
<div>
|
||||
<span id="remove_member">
|
||||
<input type="submit" onclick="use('remove_member')" value="Выгнать из клана">
|
||||
</span>
|
||||
(стоимость услуги: <B>30</B> кр.)
|
||||
(стоимость услуги: <B><?= COST_REMOVE_MEMBER ?></B> кр.)
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($polno[$user['id']][1] == 1 OR $klan['glava'] == $user['id']): ?>
|
||||
<?php if (!empty($login) AND $action == 'edit_status' AND $sok['id'] != $klan['glava']): ?>
|
||||
<?php if ($polno[$user['id']][1] == 1 || $clanRow['glava'] == $user['id']): ?>
|
||||
<?php if ($login && $action == 'edit_status' && $sok['id'] != $clanRow['glava']): ?>
|
||||
<form method='post'>
|
||||
<input placeholder='Статус' name='new_status'>
|
||||
<input type="hidden" name="login" value="<?= $login ?>">
|
||||
<?php if ($klan['glava'] == $user['id']): ?>
|
||||
<?php if ($clanRow['glava'] == $user['id']): ?>
|
||||
<?php if ($polno[$sok['id']][0] == 1): ?>
|
||||
<br><input type=checkbox name=vin checked> Может принимать/выгонять членов клана
|
||||
<?php else: ?>
|
||||
@ -142,37 +164,37 @@ $clan_memberlist = db::c()->query('SELECT `id`, `login`, `status`, `level`, `roo
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($klan['glava'] == $user['id']): ?>
|
||||
<?php if ($clanRow['glava'] == $user['id']): ?>
|
||||
<div>
|
||||
<span id="change_owner">
|
||||
<input type="submit" onclick="use('change_owner')" value="Сменить главу клана">
|
||||
</span>
|
||||
(сложить с себя полномочия, назначив <b style="color: teal;">Главой Клана</b> другого персонажа)
|
||||
</div>
|
||||
<?php if (empty($klan['zamok'])): ?>
|
||||
<?php if ($klan['rating'] < 1000000): ?>
|
||||
Недостаточно рейтинга для постройки замка. <?= showProgressBar($klan['rating'], 1000000) ?>
|
||||
<?php if (empty($clanRow['zamok'])): ?>
|
||||
<?php if ($clanRow['rating'] < CASTLE_REPUTATION_NEEDED): ?>
|
||||
Недостаточно рейтинга для постройки замка. <?= showProgressBar($clanRow['rating'], CASTLE_REPUTATION_NEEDED) ?>
|
||||
<?php else: ?>
|
||||
<form method="post">
|
||||
<button type="submit" name="zamok" value="zamok">Построить Замок</button>
|
||||
(собрать силами всего клана 25000 кр.)<BR>
|
||||
(собрать силами всего клана <?= CASTLE_COST ?> кр.)<BR>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($klan['zamok'] == 1): ?>
|
||||
<?php if ($clanRow['zamok'] == 1): ?>
|
||||
<p>
|
||||
<?php if ($klan['zbor'] < 25000): ?>
|
||||
<?php if ($clanRow['zbor'] < CASTLE_COST): ?>
|
||||
Сбор средств на постройку кланового замка:
|
||||
<?= showProgressBar($klan['zbor'], 25000) ?>
|
||||
<?= showProgressBar($clanRow['zbor'], CASTLE_COST) ?>
|
||||
<form method="post">
|
||||
<input name="kolv" size="10">
|
||||
<button type="submit" name="kr" value="kr">Пожертвовать</button>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
Средства на постройку кланового замка собраны!
|
||||
<?= showProgressBar(25000, 25000) ?>
|
||||
<?= showProgressBar(CASTLE_COST, CASTLE_COST) ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
@ -186,11 +208,19 @@ $clan_memberlist = db::c()->query('SELECT `id`, `login`, `status`, `level`, `roo
|
||||
</tr>
|
||||
<?php
|
||||
while ($row = $clan_memberlist->fetch_assoc()):
|
||||
if ($row['id'] == $klan['glava']) $row['status'] = '<b style="color: #008080;">Глава клана</b>';
|
||||
if (empty($row['status'])) $row['status'] = 'Боец';
|
||||
if (empty($row['online'])) $rrm = 'Персонаж не в игре';
|
||||
elseif ($row['room'] > 500 AND $row['room'] < 561) $rrm = 'Башня смерти';
|
||||
else $rrm = $rooms[$row['room']];
|
||||
if ($row['id'] == $clanRow['glava']) {
|
||||
$row['status'] = '<b style="color: #008080;">Глава клана</b>';
|
||||
}
|
||||
if (empty($row['status'])) {
|
||||
$row['status'] = 'Боец';
|
||||
}
|
||||
if (empty($row['online'])) {
|
||||
$rrm = 'Персонаж не в игре';
|
||||
} elseif ($row['room'] > 500 && $row['room'] < 561) {
|
||||
$rrm = 'Башня смерти';
|
||||
} else {
|
||||
$rrm = $rooms[$row['room']];
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><?= Nick::id($row['id'])->full() ?></td>
|
||||
|
@ -41,6 +41,9 @@ class User
|
||||
// Пока несуществующие, для совместимости.
|
||||
public $married = 'Someone или нет.';
|
||||
public $experience = 200;
|
||||
public $battle = 0;
|
||||
public $in_tower = 0; // Скорее башню похороним чем запустим...
|
||||
public $zayavka = 0;
|
||||
// Динамически рассчитываемые
|
||||
public $maxHealth = 5;
|
||||
public $maxMana = 5;
|
||||
|
@ -1567,7 +1567,7 @@ class fbattle
|
||||
include "../darkness_quest.php";
|
||||
|
||||
$this->exp[$v] = round($this->exp[$v]);
|
||||
$dop_exp = check_proc($this->user['id']);
|
||||
$dop_exp = 100; //процент опыта
|
||||
if ($dop_exp > 100) {
|
||||
$add = ($dop_exp - 100);
|
||||
$this->exp[$v] += round(($this->exp[$v] * $add) / 100, 0);
|
||||
@ -1641,7 +1641,7 @@ class fbattle
|
||||
}
|
||||
|
||||
$this->exp[$v] = round($this->exp[$v]);
|
||||
$dop_exp = check_proc($this->user['id']);
|
||||
$dop_exp = 100; //процент опыта
|
||||
if ($dop_exp > 100) {
|
||||
$add = ($dop_exp - 100);
|
||||
$this->exp[$v] += round(($this->exp[$v] * $add) / 100, 0);
|
||||
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2018.
|
||||
* Author: Igor Barkov <lopar.4ever@gmail.com>
|
||||
* Project name: Battles-Game
|
||||
*/
|
||||
|
||||
class input
|
||||
{
|
||||
public static function get($name) {
|
||||
$var = trim(filter_input(INPUT_GET,$name));
|
||||
if (isset($var) AND !empty($var))
|
||||
return $var;
|
||||
else return null;
|
||||
}
|
||||
|
||||
public static function post($name) {
|
||||
$var = trim(filter_input(INPUT_POST,$name));
|
||||
if (isset($var) AND !empty($var))
|
||||
return $var;
|
||||
else return null;
|
||||
}
|
||||
|
||||
public static function check($name) {
|
||||
# Срезаем с значения переменной табы, пробелы, другие невидимые символы по краям.
|
||||
# Проверяем, что у переменной точно есть значение.
|
||||
if (!empty(trim(filter_input(INPUT_GET,$name)))) return trim(filter_input(INPUT_GET,$name));
|
||||
if (!empty(trim(filter_input(INPUT_POST,$name)))) return trim(filter_input(INPUT_POST,$name));
|
||||
return null;
|
||||
}
|
||||
}
|
58
contacts.php
58
contacts.php
@ -1,46 +1,49 @@
|
||||
<?php
|
||||
ob_start("ob_gzhandler");
|
||||
session_start();
|
||||
if ($_SESSION['uid'] == null) header("Location: index.php");
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
}
|
||||
require_once 'config.php';
|
||||
|
||||
if (input::post('friendadd')) {
|
||||
$q = db::c()->query('SELECT `id` FROM `users` WHERE `login` = "?s"', input::post('friendadd'))->fetch_assoc();
|
||||
$friendadd = $_POST['friendadd'] ?? null;
|
||||
$friendremove = $_POST['friendremove'] ?? null;
|
||||
$friendedit = $_POST['friendedit'] ?? null;
|
||||
$comment = $_POST['comment'] ?? '';
|
||||
if ($friendadd) {
|
||||
$q = db::c()->query('SELECT `id` FROM `users` WHERE `login` = "?s"', $friendadd)->fetch_assoc();
|
||||
$q2 = db::c()->query('SELECT 1 FROM `friends` WHERE `user` = ?i AND `friend` = ?i', $_SESSION['uid'], $q['id']);
|
||||
|
||||
if (!$q['id']) $status = 'Персонаж не найден.';
|
||||
elseif ($q['id'] == $_SESSION['uid']) $status = 'Себя добавить нельзя.';
|
||||
elseif ($q2->getNumRows()) $status = 'Персонаж уже есть в списке.';
|
||||
else {
|
||||
db::c()->query('INSERT INTO `friends` (`user`, `friend`, `comment`) VALUES (?i,?i,"?s")', $_SESSION['uid'], $q['id'], input::post('comment'));
|
||||
if (!$q['id']) {
|
||||
$status = 'Персонаж не найден.';
|
||||
} elseif ($q['id'] == $_SESSION['uid']) {
|
||||
$status = 'Себя добавить нельзя.';
|
||||
} elseif ($q2->getNumRows()) {
|
||||
$status = 'Персонаж уже есть в списке.';
|
||||
} else {
|
||||
db::c()->query('INSERT INTO `friends` (`user`, `friend`, `comment`) VALUES (?i,?i,"?s")', $_SESSION['uid'], $q['id'], $comment);
|
||||
$status = 'Контакт добавлен.';
|
||||
}
|
||||
}
|
||||
|
||||
if (input::post('friendremove')) {
|
||||
$q = db::c()->query('SELECT `id` FROM `users` WHERE `login` = "?s"', input::post('friendremove'))->fetch_assoc();
|
||||
if ($friendremove) {
|
||||
$q = db::c()->query('SELECT `id` FROM `users` WHERE `login` = "?s"', $friendremove)->fetch_assoc();
|
||||
$q2 = db::c()->query('SELECT 1 FROM `friends` WHERE `user` = ?i AND `friend` = ?i', $_SESSION['uid'], $q['id']);
|
||||
|
||||
if (!$q['id'] OR !$q2->getNumRows()) $status = 'Персонаж не найден.';
|
||||
else {
|
||||
if (!$q['id'] || !$q2->getNumRows()) {
|
||||
$status = 'Персонаж не найден.';
|
||||
} else {
|
||||
db::c()->query('DELETE FROM `friends` WHERE `user` = ?i AND `friend` = ?i', $_SESSION['uid'], $q['id']);
|
||||
$status = 'Контакт удалён.';
|
||||
}
|
||||
}
|
||||
|
||||
if (input::post('friendedit')) {
|
||||
$q = db::c()->query('SELECT `id` FROM `users` WHERE `login` = "?s"', input::post('friendedit'))->fetch_assoc();
|
||||
if ($friendedit) {
|
||||
$q = db::c()->query('SELECT `id` FROM `users` WHERE `login` = "?s"', $friendedit)->fetch_assoc();
|
||||
$q2 = db::c()->query('SELECT 1 FROM `friends` WHERE `user` = ?i AND `friend` = ?i', $_SESSION['uid'], $q['id']);
|
||||
|
||||
if (!$q2['friend']) $status = 'Персонаж не найден.';
|
||||
else {
|
||||
db::c()->query('UPDATE `friends` SET `comment` = "?s" WHERE `user` = ?i AND `friend` = ?i', input::post('comment'), $_SESSION['uid'], $q['id']);
|
||||
if (!$q2['friend']) {
|
||||
$status = 'Персонаж не найден.';
|
||||
} else {
|
||||
db::c()->query('UPDATE `friends` SET `comment` = "?s" WHERE `user` = ?i AND `friend` = ?i', $comment, $_SESSION['uid'], $q['id']);
|
||||
$status = 'Контакт изменён.';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$admins_list = db::c()->query('SELECT `id` FROM `users` WHERE `admin` = 1 ORDER BY `login` ASC', (time() - 60));
|
||||
$admins_list = db::c()->query('SELECT `id` FROM `users` WHERE `admin` = 1 ORDER BY `login`', (time() - 60));
|
||||
$contacts_list = db::c()->query('SELECT `friend`,`comment` FROM `friends` WHERE `friend` > 0 AND `user` = ?i', $_SESSION['uid']);
|
||||
?>
|
||||
<!doctype html>
|
||||
@ -84,8 +87,7 @@ $contacts_list = db::c()->query('SELECT `friend`,`comment` FROM `friends` WHERE
|
||||
<small><?= $row['comment'] ?></small>
|
||||
</TD>
|
||||
<TD width="1%">
|
||||
<input type='button' style="background: darkgrey; border: 1px solid grey; border-radius: 2px;" value="Редактировать"
|
||||
onclick='use("comment","wow")'>
|
||||
<input type='button' style="background: darkgrey; border: 1px solid grey; border-radius: 2px;" value="Редактировать" onclick='use("comment","wow")'>
|
||||
<!-- editcontact("<?= $us['login'] ?>", "<?= $row['comment'] ?>") -->
|
||||
</TD>
|
||||
</TR>
|
||||
|
@ -335,7 +335,7 @@ class fbattle
|
||||
}
|
||||
|
||||
$this->exp[$v] = round($this->exp[$v]);
|
||||
$dop_exp = check_proc($this->user['id']);
|
||||
$dop_exp = 100; //процент опыта
|
||||
if ($dop_exp > 100) {
|
||||
$add = ($dop_exp - 100);
|
||||
$this->exp[$v] += round(($this->exp[$v] * $add) / 100, 0);
|
||||
@ -406,7 +406,7 @@ class fbattle
|
||||
}
|
||||
|
||||
$this->exp[$v] = round($this->exp[$v]);
|
||||
$dop_exp = check_proc($this->user['id']);
|
||||
$dop_exp = 100; //процент опыта
|
||||
if ($dop_exp > 100) {
|
||||
$add = ($dop_exp - 100);
|
||||
$this->exp[$v] += round(($this->exp[$v] * $add) / 100, 0);
|
||||
|
@ -356,7 +356,7 @@ $fbattle = new fbattle($user['battle']);
|
||||
$ads = '.';
|
||||
}
|
||||
|
||||
echo '<center><br /><b><font color=red>Бой закончен! Всего вами нанесено урона ' . $damage[$user['id']] . ' HP. Получено опыта ' . (int)$exp[$user['id']] . ' (' . check_proc($user['id']) . '%)' . $ads . '</FONT></B><br /><input type="submit" value="Вернуться" name="end" /><br /></center>';
|
||||
echo '<center><br /><b><font color=red>Бой закончен! Всего вами нанесено урона ' . $damage[$user['id']] . ' HP. Получено опыта ' . (int)$exp[$user['id']] . ' (100%)' . $ads . '</FONT></B><br /><input type="submit" value="Вернуться" name="end" /><br /></center>';
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
|
103
functions.php
103
functions.php
@ -200,38 +200,6 @@ function savecavedata($cavedata, $caveleader, $floor)
|
||||
fclose($f1);
|
||||
}
|
||||
|
||||
function topsethp()
|
||||
{
|
||||
global $user;
|
||||
if ($user['hp'] >= $user['maxhp'] || $user['battle']) {
|
||||
return "top.setHP($user[hp], $user[maxhp], 0)";
|
||||
}
|
||||
$fulltime = timetoheals($user);
|
||||
$delay = round(1 / ($user['maxhp'] / $fulltime) * 1000);
|
||||
return "top.setHP($user[hp], $user[maxhp], $delay);";
|
||||
}
|
||||
|
||||
function check_proc($u)
|
||||
{
|
||||
$r = 100;
|
||||
$usr = db::c()->query('SELECT `id`, `vip`, `vip_time` FROM `users` WHERE `id` = ?i', $u)->fetch_assoc_array();
|
||||
if ($usr['vip_time'] > time()) {
|
||||
if ($usr['vip'] == 1) {
|
||||
$r += 10;
|
||||
} elseif ($usr['vip'] == 2) {
|
||||
$r += 15;
|
||||
} elseif ($usr['vip'] == 3) {
|
||||
$r += 20;
|
||||
}
|
||||
}
|
||||
$effes = db::c()->query('SELECT SUM(`proc_exp`) AS `sums` FROM `effects` WHERE proc_exp > 0 AND owner = ?i', $usr['id'])->fetch_assoc_array();
|
||||
|
||||
if ($effes['sums'] > 0) {
|
||||
$r += $effes['sums'];
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
function GiveExp($id, $exp)
|
||||
{
|
||||
db::c()->query('UPDATE users SET exp = exp + ?i WHERE id = ?i', $exp, $id);
|
||||
@ -242,31 +210,13 @@ function GiveRep($id, $rep)
|
||||
db::c()->query('UPDATE users SET doblest = (doblest + ?i), rep_laba = (rep_laba + ?i) WHERE `id` = ?i', $rep, $rep, $id);
|
||||
}
|
||||
|
||||
|
||||
// полоска НР
|
||||
function setHP($hp, $maxhp)
|
||||
{
|
||||
if ($hp < $maxhp * 0.33) {
|
||||
$polosa = 'i/1red.gif';
|
||||
} elseif ($hp < $maxhp * 0.66) {
|
||||
$polosa = 'i/1yellow.gif';
|
||||
} else {
|
||||
$polosa = 'i/1green.gif';
|
||||
}
|
||||
$polosa_width = (122 * ($hp / $maxhp));
|
||||
$silver_polosa_width = (122 - 122 * ($hp / $maxhp));
|
||||
return <<<HTML
|
||||
<IMG SRC=i/herz.gif WIDTH=10 HEIGHT=10 ALT="Уровень жизни">
|
||||
<IMG SRC=$polosa WIDTH=$polosa_width HEIGHT=10 ALT="Уровень жизни" id=HP1>
|
||||
<IMG SRC=i/1silver.gif WIDTH=$silver_polosa_width HEIGHT=10 ALT="Уровень жизни" id=HP2>
|
||||
<span id='hp_value'>$hp / $maxhp</span>
|
||||
HTML;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $current
|
||||
* @param $maximum
|
||||
* Генератор прогрессбара.
|
||||
* @param $current - Текущее значение.
|
||||
* @param $maximum - Максимальное значение.
|
||||
* @param string $line_color - Цвет полоски прогрессбара.
|
||||
* @param string $bg_color - Фон прогрессбара.
|
||||
* @return string
|
||||
*/
|
||||
function showProgressBar($current, $maximum, $line_color = 'limegreen', $bg_color = 'silver')
|
||||
{
|
||||
@ -471,18 +421,6 @@ function show_eff_inf($u, $type)
|
||||
return $r;
|
||||
}
|
||||
|
||||
function timetoheals($user)
|
||||
{
|
||||
$efs = db::c()->query('SELECT SUM(`speed`) AS `speed` FROM `effects` WHERE `owner` = ?i', $user['id'])->fetch_assoc_array();
|
||||
$efs['speed'] += 0;
|
||||
if ($efs['speed'] > 0) {
|
||||
$fulltime = $efs['speed'] * 2000;
|
||||
} else {
|
||||
$fulltime = 2000;
|
||||
}
|
||||
return $fulltime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $time
|
||||
* @param $vars
|
||||
@ -499,32 +437,9 @@ function addActions($time, $vars, $vls, $uid)
|
||||
return $ins;
|
||||
}
|
||||
|
||||
|
||||
function plusorminus($n, $shownum = 1)
|
||||
function undressall($user_id)
|
||||
{
|
||||
if (empty($shownum)) {
|
||||
if ($n >= 2) {
|
||||
return "++";
|
||||
}
|
||||
if ($n > 0) {
|
||||
return "+";
|
||||
}
|
||||
if ($n < 0) {
|
||||
return "-";
|
||||
}
|
||||
}
|
||||
if ($n >= 0) {
|
||||
return "+$n";
|
||||
} else {
|
||||
return $n;
|
||||
}
|
||||
}
|
||||
|
||||
function undressall($id)
|
||||
{
|
||||
for ($i = 1; $i <= 26; $i++) {
|
||||
dropitemid($i, $id);
|
||||
}
|
||||
db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot BETWEEN 1 AND 12 AND owner_id = ?i', $user_id);
|
||||
}
|
||||
|
||||
function dropitemid($slot, $id)
|
||||
@ -941,7 +856,7 @@ function destructitem($id)
|
||||
}
|
||||
|
||||
// использовать магию
|
||||
function usemagic($id)
|
||||
function usemagic($id, $target)
|
||||
{
|
||||
global $user;
|
||||
$row = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND id = ?i', $user['id'], $id)->fetch_assoc_array();
|
||||
|
@ -56,7 +56,7 @@ if($user['room'] == 1052) {
|
||||
$dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `laba_act` WHERE `uid` = "'.$user['id'].'" AND `lib` = "'.$user['laba'].'" AND `vars` = "dielaba" LIMIT 1'));
|
||||
$dies = $dies[0];
|
||||
$map_d = json_decode($map['data']);
|
||||
$usersDng = setHP($user['hp'], $user['maxhp'], 0);
|
||||
$usersDng = showProgressBar($user['hp'], $user['maxhp']);
|
||||
$errors = '';
|
||||
$effed = '';
|
||||
$mapsee = '';
|
||||
|
509
main.php
509
main.php
@ -12,228 +12,200 @@ if (!isset($_SESSION['uid'])) {
|
||||
|
||||
require_once 'functions.php';
|
||||
|
||||
$tmaz = time();
|
||||
try {
|
||||
db::c()->query('UPDATE `online` SET `real_time` = ?i WHERE `user_id` = ?i', time(), $user['id']);
|
||||
db::c()->query('UPDATE `online` SET `real_time` = ?i WHERE `user_id` = ?i', time(), $user->id);
|
||||
} catch (\Krugozor\Database\Mysql\Exception $e) {
|
||||
echo "<div class='debug' '>Ошибка: " . $e->getMessage() . "<br> Стек: " . $e->getTraceAsString() . "</div>";
|
||||
}
|
||||
|
||||
if (!empty($user['battle'])) {
|
||||
if ($user->battle) {
|
||||
header('location: fbattle.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
//БС
|
||||
if ($user->in_tower == 1) {
|
||||
header('Location: towerin.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
//БС
|
||||
if (isset($user['in_tower']) && $user['in_tower'] == 1) {
|
||||
header('Location: towerin.php');
|
||||
die();
|
||||
// Инициализируем входящие GET\POST переменные.
|
||||
$goto = $_GET['goto'] ?? null;
|
||||
$obraz = $_GET['obraz'] ?? null;
|
||||
$del = $_GET['del'] ?? null;
|
||||
$effectId = $_GET['efid'] ?? null;
|
||||
$brons = $_GET['modif_bron'] ?? null;
|
||||
$stats = $_GET['modif_stat'] ?? null;
|
||||
$mfs = $_GET['modif_mf'] ?? null;
|
||||
$ids = $_GET['ids'] ?? null;
|
||||
$setShadow = $_POST['setshadow'] ?? null;
|
||||
$edit = $_GET['edit'] ?? null;
|
||||
// Подготавливаем отображение инфы и предметов.
|
||||
$showUser = new User($_SESSION['uid']);
|
||||
$getItemsBonuses = new DressedItems($_SESSION['uid']);
|
||||
$data_query = 'SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot = 0 AND on_sale = 0';
|
||||
$data = db::c()->query($data_query, $_SESSION['uid']);
|
||||
$iteminfo = [];
|
||||
while ($row = $data->fetch_assoc()) {
|
||||
$iteminfo[] = new InventoryItem($row);
|
||||
}
|
||||
|
||||
/* === проверяем соответствие комнаты и скрипта === */
|
||||
if (in_array($user['room'], [20, 21, 26, 48, 51, 52, 651, 2655, 2601, 2701, 2702, 2111], 1)) {
|
||||
if (in_array($user->room, [20, 21, 26, 48, 51, 52, 651, 2655, 2601, 2701, 2702, 2111], 1)) {
|
||||
header('Location: city.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($user['room'] == 22) {
|
||||
if ($user->room == 22) {
|
||||
header('Location: shop.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 23) {
|
||||
if ($user->room == 23) {
|
||||
header('Location: repair.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 25) {
|
||||
if ($user->room == 25) {
|
||||
header('Location: comission.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 27) {
|
||||
if ($user->room == 27) {
|
||||
header('Location: post.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 29) {
|
||||
if ($user->room == 29) {
|
||||
header('Location: bank.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 31) {
|
||||
if ($user->room == 31) {
|
||||
header('Location: tower.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 30) {
|
||||
if ($user->room == 30) {
|
||||
header('Location: clan_create.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 34) {
|
||||
if ($user->room == 34) {
|
||||
header('Location: fshop.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 42) {
|
||||
if ($user->room == 42) {
|
||||
header('Location: lotery.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 43) {
|
||||
if ($user->room == 43) {
|
||||
header('Location: znahar.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 44) {
|
||||
if ($user->room == 44) {
|
||||
header('Location: new_year.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 45) {
|
||||
if ($user->room == 45) {
|
||||
header('Location: clan_castle.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 47) {
|
||||
if ($user->room == 47) {
|
||||
header('Location: wall_build.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 49) {
|
||||
if ($user->room == 49) {
|
||||
header('Location: dig.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 50) {
|
||||
if ($user->room == 50) {
|
||||
header('Location: ashop.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 53) {
|
||||
if ($user->room == 53) {
|
||||
header('Location: library.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 61) {
|
||||
if ($user->room == 61) {
|
||||
header('Location: akadem.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 650) {
|
||||
if ($user->room == 650) {
|
||||
header('Location: ul_clans.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
|
||||
//Храм древнх
|
||||
if ($user['room'] == 203) {
|
||||
if ($user->room == 203) {
|
||||
header('Location: church.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
//ЦХ
|
||||
if ($user['room'] == 600) {
|
||||
if ($user->room == 600) {
|
||||
header('Location: c_haos.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 601) {
|
||||
if ($user->room == 601) {
|
||||
header('Location: c_haos_in.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 602) {
|
||||
if ($user->room == 602) {
|
||||
header('Location: c_park.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 603) {
|
||||
if ($user->room == 603) {
|
||||
header('Location: aren_of_angels.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 620) {
|
||||
if ($user->room == 620) {
|
||||
header('Location: enter_cave.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 621) {
|
||||
if ($user->room == 621) {
|
||||
header('Location: cave.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 660) {
|
||||
if ($user->room == 660) {
|
||||
header('Location: hostel.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 661) {
|
||||
if ($user->room == 661) {
|
||||
header('Location: hostel_room.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 662) {
|
||||
if ($user->room == 662) {
|
||||
header('Location: quest_room.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 760) {
|
||||
if ($user->room == 760) {
|
||||
header('Location: c_forest.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 1000) {
|
||||
if ($user->room == 1000) {
|
||||
header('Location: solib/enterbezdna.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 1001) {
|
||||
if ($user->room == 1001) {
|
||||
header('Location: solib/dungeon.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 1051) {
|
||||
if ($user->room == 1051) {
|
||||
header('Location: lab_enter.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 1052) {
|
||||
if ($user->room == 1052) {
|
||||
header('Location: labirint.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 402) {
|
||||
if ($user->room == 402) {
|
||||
header('Location: vxod.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 403) {
|
||||
if ($user->room == 403) {
|
||||
header('Location: canalizaciya.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 1054) {
|
||||
if ($user->room == 1054) {
|
||||
header('Location: fontan_luck.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 1055) {
|
||||
if ($user->room == 1055) {
|
||||
header('Location: group_arena.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 666) {
|
||||
if ($user->room == 666) {
|
||||
header('Location: jail.php');
|
||||
die();
|
||||
}
|
||||
|
||||
function stack($it_id)
|
||||
{
|
||||
global $user;
|
||||
$it_id = (int)$it_id;
|
||||
$stack = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i AND `owner` = ?i', $it_id, $user['id']);
|
||||
if (db::c()->getAffectedRows() === 1) {
|
||||
$stack = $stack->fetch_assoc();
|
||||
$similar = mysql_fetch_array(mysql_query("SELECT SUM(`koll`) FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` != '" . $stack['id'] . "' AND `name` = '" . $stack['name'] . "' AND `present` = '" . $stack['present'] . "' AND `duration` = '" . $stack['duration'] . "' AND `maxdur` = '" . $stack['maxdur'] . "' AND `laba` = '" . $stack['laba'] . "' AND `gmeshok` = '" . $stack['gmeshok'] . "' AND `dressed` = 0 AND `goden` = 0 AND `setsale` = 0 AND `koll` >= 1 AND `isrep` = '" . $stack['isrep'] . "' AND FORMAT(`cost`/`koll`, 2) = FORMAT(" . ($stack['cost'] / $stack['koll']) . ", 2) AND FORMAT(`point`/`koll`, 2) = FORMAT(" . ($stack['point'] / $stack['koll']) . ", 2) AND FORMAT(`bcost`/`koll`, 2) = FORMAT(" . ($stack['bcost'] / $stack['koll']) . ", 2)"));
|
||||
if ($similar[0] >= 1) {
|
||||
mysql_query("UPDATE `inventory` SET `cost` = (`cost`+`cost`/`koll`*" . $similar[0] . "), `point` = (`point`+`point`/`koll`*" . $similar[0] . "), `bcost` = (`bcost`+`bcost`/`koll`*" . $similar[0] . "), `massa` = (`massa`+`massa`/`koll`*" . $similar[0] . "), `koll` = (`koll`+" . $similar[0] . "), `gmeshok` = (`gmeshok`+`gmeshok`*" . $similar[0] . ") WHERE `id` = '" . $stack['id'] . "' LIMIT 1");
|
||||
mysql_query("DELETE FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` != '" . $stack['id'] . "' AND `name` = '" . $stack['name'] . "' AND `present` = '" . $stack['present'] . "' AND `duration` = '" . $stack['duration'] . "' AND `maxdur` = '" . $stack['maxdur'] . "' AND `dressed` = 0 AND `goden` = 0 AND `koll` >= 1 AND `setsale` = 0 AND `gmeshok` = '" . $stack['gmeshok'] . "' AND `laba` = '" . $stack['laba'] . "' AND `isrep` = '" . $stack['isrep'] . "' AND FORMAT(`cost`/`koll`, 2)=FORMAT(" . $stack['cost'] / $stack['koll'] . ", 2) AND FORMAT(`point`/`koll`, 2) = FORMAT(" . ($stack['point'] / $stack['koll']) . ", 2) AND FORMAT(`bcost`/`koll`, 2) = FORMAT(" . ($stack['bcost'] / $stack['koll']) . ", 2) ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function unstack($it_id, $it_count)
|
||||
{
|
||||
global $user;
|
||||
$it_id = (int)$it_id;
|
||||
$it_count = (int)$it_count;
|
||||
$it_count = abs($it_count);
|
||||
|
||||
try {
|
||||
$dress = db::c()->query('SELECT * FROM inventory WHERE owner = ?i AND id = ?i', $user['id'], $it_id)->fetch_assoc_array();
|
||||
} catch (\Krugozor\Database\Mysql\Exception $e) {
|
||||
echo "<div style='background-color: #ffaaaa;'>Ошибка: " . $e->getMessage() . "<br> В файле: " . $e->getFile() . " (" . $e->getLine() . ")</div>";
|
||||
}
|
||||
if (isset($dress['id'])) {
|
||||
if ($it_count <= $dress['koll'] && $it_count > 0) {
|
||||
if ($dress['koll'] == $it_count) {
|
||||
db::c()->query('DELETE FROM inventory WHERE owner = ?i AND id = ?i', $user['id'], $dress['id']);
|
||||
} else {
|
||||
mysql_query("UPDATE `inventory` SET `cost` = (`cost`-`cost`/`koll`*" . $it_count . "), `point` = (`point`-`point`/`koll`*" . $it_count . "), `bcost` = (`bcost`-`bcost`/`koll`*" . $it_count . "), `massa` = (`massa`-`massa`/`koll`*" . $it_count . "), `koll` = (`koll`-" . $it_count . ") WHERE `id` = '$dress[id]' AND `owner` = '$user[id]' LIMIT 1");
|
||||
}
|
||||
mysql_query("INSERT INTO `inventory` (`name`, `upgrade`, `modif`, `podgon`, `duration`, `maxdur`, `cost`, `bcost`, `point`, `nlevel`, `nsila`, `nlovk`, `ninta`, `nvinos`, `nintel`, `nmudra`, `nnoj`, `ntopor`, `ndubina`, `nmech`, `nalign`, `minu`, `maxu`, `gsila`, `glovk`, `ginta`, `gintel`, `ghp`, `mfkrit`, `mfakrit`, `mfuvorot`, `mfauvorot`, `gnoj`, `gtopor`, `gdubina`, `gmech`, `img`, `text`, `owner`, `dressed`, `bron1`, `bron2`, `bron3`, `bron4`, `dategoden`, `magic`, `type`, `present`, `sharped`, `massa`, `goden`, `needident`, `nfire`, `nwater`, `nair`, `nearth`, `nlight`, `ngray`, `ndark`, `gfire`, `gwater`, `gair`, `gearth`, `glight`, `ggray`, `gdark`, `free_bron`, `free_stat`, `free_mf`, `letter`, `isrep`, `update`, `setsale`, `prototype`, `otdel`, `bs`, `gmp`, `includemagic`, `includemagicdex`, `includemagicmax`, `includemagicname`, `includemagicuses`, `includemagiccost`, `gmeshok`, `tradesale`, `podzem`, `x_mis`, `artefact`, `destinyinv`, `encicl`, `foronetrip`, `koll`) VALUES ('" . $dress['name'] . "', '" . $dress['upgrade'] . "', '" . $dress['modif'] . "', '" . $dress['podgon'] . "', '" . $dress['duration'] . "', '" . $dress['maxdur'] . "', '" . ($dress['cost'] / $dress['koll'] * $it_count) . "', '" . ($dress['bcost'] / $dress['koll'] * $it_count) . "', '" . ($dress['point'] / $dress['koll'] * $it_count) . "', '" . $dress['nlevel'] . "', '" . $dress['nsila'] . "', '" . $dress['nlovk'] . "', '" . $dress['ninta'] . "', '" . $dress['nvinos'] . "', '" . $dress['nintel'] . "', '" . $dress['nmudra'] . "', '" . $dress['nnoj'] . "', '" . $dress['ntopor'] . "', '" . $dress['ndubina'] . "', '" . $dress['nmech'] . "', '" . $dress['nalign'] . "', '" . $dress['minu'] . "', '" . $dress['maxu'] . "', '" . $dress['gsila'] . "', '" . $dress['glovk'] . "', '" . $dress['ginta'] . "', '" . $dress['gintel'] . "', '" . $dress['ghp'] . "', '" . $dress['mfkrit'] . "', '" . $dress['mfakrit'] . "', '" . $dress['mfuvorot'] . "', '" . $dress['mfauvorot'] . "', '" . $dress['gnoj'] . "', '" . $dress['gtopor'] . "', '" . $dress['gdubina'] . "', '" . $dress['gmech'] . "', '" . $dress['img'] . "', '" . $dress['text'] . "', '" . $dress['owner'] . "', '" . $dress['dressed'] . "', '" . $dress['bron1'] . "', '" . $dress['bron2'] . "', '" . $dress['bron3'] . "', '" . $dress['bron4'] . "', '" . $dress['dategoden'] . "', '" . $dress['magic'] . "', '" . $dress['type'] . "', '" . $dress['present'] . "', '" . $dress['sharped'] . "', '" . ($dress['massa'] / $dress['koll'] * $it_count) . "', '" . $dress['goden'] . "', '" . $dress['needident'] . "', '" . $dress['nfire'] . "', '" . $dress['nwater'] . "', '" . $dress['nair'] . "', '" . $dress['nearth'] . "', '" . $dress['nlight'] . "', '" . $dress['ngray'] . "', '" . $dress['ndark'] . "', '" . $dress['gfire'] . "', '" . $dress['gwater'] . "', '" . $dress['gair'] . "', '" . $dress['gearth'] . "', '" . $dress['glight'] . "', '" . $dress['ggray'] . "', '" . $dress['gdark'] . "', '" . $dress['free_bron'] . "', '" . $dress['free_bron'] . "', '" . $dress['free_mf'] . "', '" . $dress['letter'] . "', '" . $dress['isrep'] . "', '" . $dress['update'] . "', '" . $dress['setsale'] . "', '" . $dress['prototype'] . "', '" . $dress['otdel'] . "', '" . $dress['bs'] . "', '" . $dress['gmp'] . "', '" . $dress['includemagic'] . "', '" . $dress['includemagicdex'] . "', '" . $dress['includemagicmax'] . "', '" . $dress['includemagicname'] . "', '" . $dress['ggrincludemagicusesay'] . "', '" . $dress['includemagiccost'] . "', '" . ($dress['gmeshok'] / $dress['koll'] * $it_count) . "', '" . $dress['tradesale'] . "', '" . $dress['podzem'] . "', '" . $dress['x_mis'] . "', '" . $dress['artefact'] . "', '" . $dress['destinyinv'] . "', '" . $dress['encicl'] . "', '" . $dress['foronetrip'] . "', '" . $it_count . "')");
|
||||
return mysql_insert_id();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
exit();
|
||||
}
|
||||
|
||||
function del_efs($id, $type)
|
||||
@ -249,7 +221,6 @@ function del_efs($id, $type)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// одеть предмет
|
||||
function dressitem($id)
|
||||
{
|
||||
@ -328,37 +299,32 @@ function dressitem($id)
|
||||
}
|
||||
}
|
||||
|
||||
function undressallself()
|
||||
{
|
||||
db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot BETWEEN 1 AND 12 AND owner_id = ?i', $_SESSION['uid']);
|
||||
}
|
||||
|
||||
// Входим и выходим если можем.
|
||||
if (isset($_GET['goto'])) {
|
||||
if ($goto) {
|
||||
$imove = true;
|
||||
$d = db::c()->query('SELECT SUM(`weight`) AS `sum_weight` FROM `inventory` WHERE `owner` = ?i AND `on_sale` = 0', $user['id'])->fetch_assoc();
|
||||
$eff = db::c()->query('SELECT 1 FROM `users_effects` WHERE `owner_id` = ?i AND (`type` = 14 OR `type` = 13)', $user['id']);
|
||||
$d = db::c()->query('SELECT SUM(weight) AS sum_weight FROM inventory WHERE owner_id = ?i AND on_sale = 0', $user->id)->fetch_assoc();
|
||||
$eff = db::c()->query('SELECT 1 FROM `users_effects` WHERE `owner_id` = ?i AND (`type` = 14 OR `type` = 13)', $user->id);
|
||||
//(масса: <?= $getItemsBonuses->getItemsWeight() . '/' . $showUser->strength * 4
|
||||
|
||||
if ($d['sum_weight'] > $user['strength'] * 4 && $_GET['got']) {
|
||||
if ($d['sum_weight'] > $user->strength * 4 && $goto) {
|
||||
err('У вас переполнен рюкзак, вы не можете передвигаться...');
|
||||
$imove = false;
|
||||
}
|
||||
if ($eff->getNumRows() && $_GET['got']) {
|
||||
if ($eff->getNumRows() && $goto) {
|
||||
err('У вас тяжелая травма, вы не можете передвигатся...');
|
||||
$imove = false;
|
||||
}
|
||||
if ($_GET['goto'] == 'plo' && empty($user['zayavka']) && $imove === true) {
|
||||
db::c()->query('UPDATE `users`,`online` SET `users`.`room` = 20,`online`.`room` = 20 WHERE `online`.`id` = `users`.`id` AND `online`.`id` = ?i', $_SESSION['uid']);
|
||||
if ($goto == 'plo' && !$user->zayavka && $imove === true) {
|
||||
db::c()->query('UPDATE users, online SET users.room = 20, online.room = 20 WHERE online.user_id = users.id AND online.users_id = ?i', $_SESSION['uid']);
|
||||
header('Location: city.php');
|
||||
die("<i>Топ-топ-топ...</i>");
|
||||
exit("<i>Топ-топ-топ...</i>");
|
||||
} else {
|
||||
err('Подали заявку на бой и убегаете из клуба? Нехорошо...');
|
||||
}
|
||||
if ($_GET['goto'] == 'arena' && $user['room'] === 20 && $imove === true) {
|
||||
db::c()->query('UPDATE `users`, `online` SET `users`.`room` = 1, `online`.`room` = 1 WHERE `online`.`id` = `users`.`id` AND `online`.`id` = ?i', $_SESSION['uid']);
|
||||
if ($goto == 'arena' && $user->room === 20 && $imove === true) {
|
||||
db::c()->query('UPDATE users, online SET users.room = 1, online.room = 1 WHERE online.user_id = users.id AND online.user_id = ?i', $_SESSION['uid']);
|
||||
header('Location: main.php');
|
||||
die("<i>Топ-топ-топ...</i>");
|
||||
exit("<i>Топ-топ-топ...</i>");
|
||||
}
|
||||
}
|
||||
|
||||
@ -366,21 +332,6 @@ if (isset($_GET['use'])) {
|
||||
usemagic($_GET['use'], $_POST['target']);
|
||||
}
|
||||
|
||||
unset($_SESSION['stackall']);
|
||||
|
||||
if (isset($_GET["stack"])) {
|
||||
$_GET["stack"] = (int)$_GET["stack"];
|
||||
$rec = db::c()->query('SELECT `id` FROM `inventory` WHERE `id` = ?i AND `owner` = ?i AND `setsale` = 0', $_GET['stack'], $user['id'])->fetch_assoc();
|
||||
if (isset($rec['id'])) {
|
||||
stack($rec['id']);
|
||||
unset($rec);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['unstack'])) {
|
||||
unstack((int)$_GET['unstack'], (int)$_POST["qty"]);
|
||||
}
|
||||
|
||||
function setShadow($image)
|
||||
{
|
||||
global $user;
|
||||
@ -397,67 +348,57 @@ function setShadow($image)
|
||||
}
|
||||
}
|
||||
|
||||
$obraz = filter_input(INPUT_GET, 'obraz');
|
||||
if ($obraz && ($user['shadow'] == 'g0.gif' || $user['shadow'] == 'man0.gif')) {
|
||||
if ($obraz && ($user->shadow == 'g0.gif' || $user->shadow == 'man0.gif')) {
|
||||
setShadow($obraz);
|
||||
}
|
||||
|
||||
if (isset($_GET['del']) && $_GET['del'] == 1 && $_GET['efid'] > 0) {
|
||||
$pl = db::c()->query('SELECT `id`, `type` FROM `users_effects` WHERE `owner_id` = ?i AND `id` = ?i', $user['id'], (int)$_GET['efid'])->fetch_assoc();
|
||||
if (isset($pl['id'])) {
|
||||
echo del_efs($pl['id'], $pl['type']);
|
||||
if ($del == 1 && $effectId > 0) {
|
||||
$pl = db::c()->query('SELECT type FROM users_effects WHERE owner_id = ?i AND effect_id = ?i', $user['id'], $effectId)->fetch_assoc();
|
||||
if (isset($pl['type'])) {
|
||||
echo del_efs($effectId, $pl['type']);
|
||||
} else {
|
||||
echo "<span class='error'>Эффект не найден!</span>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET['modif_bron'])) {
|
||||
$brons = $_GET['modif_bron'];
|
||||
$ids = $_GET['ids'];
|
||||
if ($brons && $ids) {
|
||||
try {
|
||||
$cur = db::c()->query('SELECT free_bron, bron1, bron2, bron3, bron4 FROM inventory WHERE owner = ?i AND id = ?i', $user['id'], $ids)->fetch_assoc();
|
||||
} catch (\Krugozor\Database\Mysql\Exception $e) {
|
||||
echo "<div style='background-color: #ffaaaa;'>Ошибка: " . $e->getMessage() . "<br> В файле: " . $e->getFile() . " (" . $e->getLine() . ")</div>";
|
||||
}
|
||||
if ($cur['free_bron'] > 0 && $cur[$brons] > 0) {
|
||||
mysql_query("UPDATE `inventory` SET `free_bron` = (`free_bron`-1), `" . $brons . "` = (`" . $brons . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1");
|
||||
db::c()->query('UPDATE inventory SET free_bron = free_bron - 1, ?f = ?f +1 WHERE owner_id = ?i AND item_id = ?i', $brons, $brons, $user->id, $ids);
|
||||
echo "<span class='success'>Параметр брони увеличен!</span>";
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['modif_stat'])) {
|
||||
$stats = $_GET['modif_stat'];
|
||||
$ids = $_GET['ids'];
|
||||
$cur = mysql_fetch_assoc(mysql_query("SELECT `id`, `free_stat`, `gsila`, `glovk`, `ginta`, `gintel` FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"));
|
||||
if (isset($cur['id']) && $cur['free_stat'] > 0 && $cur[$stats] > 0) {
|
||||
mysql_query("UPDATE `inventory` SET `free_stat` = (`free_stat`-1), `" . $stats . "` = (`" . $stats . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1");
|
||||
if ($stats && $ids) {
|
||||
$cur = db::c()->query('SELECT free_stat, gsila, glovk, ginta, gintel FROM inventory WHERE owner_id = ?i AND item_id = ?i', $user->id, $ids);
|
||||
if ($cur['free_stat'] > 0 && $cur[$stats] > 0) {
|
||||
db::c()->query('UPDATE inventory SET free_stat = free_stat - 1, ?f = ?f +1 WHERE owner_id = ?i AND item_id = ?i', $stats, $stats, $user->id, $ids);
|
||||
echo "<span class='success'>Параметр увеличен!</span>";
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['modif_mf'])) {
|
||||
$mfs = $_GET['modif_mf'];
|
||||
$ids = $_GET['ids'];
|
||||
$cur = mysql_fetch_assoc(mysql_query("SELECT `id`, `free_mf`, `mfkrit`, `mfakrit`, `mfuvorot`, `mfauvorot` FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"));
|
||||
if ($mfs && $ids) {
|
||||
$cur = db::c()->query('SELECT free_mf, mfkrit, mfuvorot, mfakrit, mfauvorot FROM inventory WHERE owner_id = ?i AND item_id = ?i', $user->id, $ids);
|
||||
if (isset($cur['id']) && $cur['free_mf'] > 0 && $cur[$mfs] > 0) {
|
||||
mysql_query("UPDATE `inventory` SET `free_mf` = (`free_mf`-1), `" . $mfs . "` = (`" . $mfs . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1");
|
||||
db::c()->query('UPDATE inventory SET free_mf = free_mf - 1, ?f = ?f +1 WHERE owner_id = ?i AND item_id = ?i', $mfs, $mfs, $user->id, $ids);
|
||||
echo "<span class='success'>Параметр увеличен!</span>";
|
||||
}
|
||||
}
|
||||
|
||||
if (input::post('setshadow')) {
|
||||
if ($setShadow) {
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<link rel=stylesheet href="css/main.css">
|
||||
<link rel=stylesheet href="css/btn.css">
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="text-align: right;">
|
||||
<input type=button value="Вернуться" onClick="location.href='main.php?edit=<?= mt_rand() ?>';">
|
||||
<input type=button value="Вернуться" onClick="location.href='main.php?edit=<?= mt_rand() ?>';" class="button">
|
||||
</div>
|
||||
<table style="padding:5px; margin:auto;">
|
||||
<caption><b style="color: red;">Внимание! Образ персонажа выбирается только один раз.</b></caption>
|
||||
@ -487,31 +428,35 @@ if (input::post('setshadow')) {
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
|
||||
if (isset($_GET['edit'])) {
|
||||
if ($edit) {
|
||||
$ups = $_GET['ups'] ?? null;
|
||||
$upm = $_GET['upm'] ?? null;
|
||||
$use = $_GET['use'] ?? null;
|
||||
$useTarget = $_POST['target'] ?? null;
|
||||
$drop = $_GET['drop'] ?? null;
|
||||
$dress = $_GET['dress'] ?? null;
|
||||
$undress = $_GET['undress'] ?? null;
|
||||
$destruct = $_GET['destruct'] ?? null;
|
||||
|
||||
if (input::get('ups')) {
|
||||
addOnePoint(input::get('ups'), 'stat');
|
||||
if ($ups) {
|
||||
addOnePoint($ups, 'stat');
|
||||
}
|
||||
|
||||
if (input::get('upm')) {
|
||||
addOnePoint(input::get('upm'), 'mastery');
|
||||
if ($upm) {
|
||||
addOnePoint($upm, 'mastery');
|
||||
}
|
||||
|
||||
if (isset($_GET['drop'])) {
|
||||
if ($drop) {
|
||||
$items = new DressedItems($_SESSION['uid']);
|
||||
$items->undressItem($_GET['drop']);
|
||||
$items->undressItem($drop);
|
||||
}
|
||||
|
||||
//Пока что одеваем предмет отсюда.
|
||||
if (isset($_GET['dress'])) {
|
||||
echo dressitem($_GET['dress']);
|
||||
if ($dress) {
|
||||
echo dressitem($dress);
|
||||
}
|
||||
|
||||
if (input::get('destruct')) {
|
||||
$q = db::c()->query('SELECT `id`, `dressed`, `name`, `duration`, `maxdur` FROM `inventory` WHERE `owner` = ?i AND `id` = ?i', $_SESSION['uid'], input::get('destruct'));
|
||||
if ($destruct) {
|
||||
$q = db::c()->query('SELECT `id`, `dressed`, `name`, `duration`, `maxdur` FROM `inventory` WHERE `owner` = ?i AND `id` = ?i', $_SESSION['uid'], $destruct);
|
||||
if ($q->getNumRows()) {
|
||||
$q = $q->fetch_assoc();
|
||||
if (empty($q['dressed'])) {
|
||||
@ -525,27 +470,13 @@ if (isset($_GET['edit'])) {
|
||||
err('Ошибка: предмет не найден!');
|
||||
}
|
||||
}
|
||||
|
||||
if (input::get('use')) {
|
||||
$q = db::c()->query('SELECT `id`, `koll` FROM `inventory` WHERE `id` = ?i AND `owner` = ?i', input::get('use'), $_SESSION['uid']);
|
||||
if ($q->getNumRows()) {
|
||||
$q = $q->fetch_assoc();
|
||||
if ($q['koll'] > 1) {
|
||||
$id = unstack($q['id'], 1);
|
||||
usemagic($id, $_POST['target']);
|
||||
} else {
|
||||
usemagic($_GET['use'], $_POST['target']);
|
||||
if ($use) {
|
||||
usemagic($use, $useTarget);
|
||||
}
|
||||
} else {
|
||||
err('Ошибка: предмет не найден!');
|
||||
if ($undress) {
|
||||
undressall($_SESSION['uid']);
|
||||
}
|
||||
}
|
||||
|
||||
if (input::get('undress')) {
|
||||
undressallself();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!doctype html>
|
||||
@ -566,29 +497,13 @@ if (isset($_GET['edit'])) {
|
||||
$(".tooltip").tipTip({maxWidth: "auto", edgeOffset: 0, fadeIn: 300, fadeOut: 500});
|
||||
});
|
||||
|
||||
function gotohref(filename) {
|
||||
location.href = filename;
|
||||
}
|
||||
|
||||
function saveComplect() {
|
||||
new miDialog({title: 'Сохранить комплект'}, {edit: 1}, function () {
|
||||
document.location = '/main.php?' + $.param(this.data);
|
||||
},
|
||||
$('<div>Название комплекта :<br /><div style="font-size: smaller;"><b>может содеражать только буквы (англ / русс) и цифры.</b></div></div>').append(miDialog._oneInput({name: 'savecomplect'})), {width: 250});
|
||||
}
|
||||
|
||||
let Hint3Name = '';
|
||||
|
||||
function okno(title, script, name, coma, errk) {
|
||||
function okno(title, script, name, errk) {
|
||||
let errkom = '';
|
||||
let com = '';
|
||||
if (errk === 1) {
|
||||
errkom = 'Нельзя использовать символы: /\:*?"<>|+%<br>';
|
||||
com = coma
|
||||
}
|
||||
if (errk === 2) {
|
||||
errkom = 'Такой комплект уже существует<br>';
|
||||
com = coma
|
||||
}
|
||||
document.getElementById("hint3").innerHTML = '<table width=100% cellspacing=1 cellpadding=0 bgcolor=CCC3AA><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: pointer" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' +
|
||||
'<form action="' + script + '" method=POST><table width=100% cellspacing=0 cellpadding=2 bgcolor=FFF6DD><tr><INPUT TYPE=hidden name=sd4 value="6"><td colspan=2><span class="error">' +
|
||||
@ -599,71 +514,17 @@ if (isset($_GET['edit'])) {
|
||||
document.getElementById(name).focus();
|
||||
Hint3Name = name;
|
||||
}
|
||||
|
||||
const delay = 30;
|
||||
let TimerOn = -1, tkHP, maxHP, speed = 750;
|
||||
const stLen = 185, redHP = 0.33, yellowHP = 0.66;
|
||||
|
||||
function setHPlocal() {
|
||||
tkHP > maxHP && (tkHP = maxHP);
|
||||
let a = Math.round(tkHP) + "/" + maxHP;
|
||||
a = stLen - (a.length + 2) * 7;
|
||||
const b = Math.round((a - 1) / maxHP * tkHP);
|
||||
a -= b;
|
||||
const HP = document.getElementById("hp_value");
|
||||
const HP1 = document.getElementById("HP1");
|
||||
const HP2 = document.getElementById("HP2");
|
||||
if (HP) {
|
||||
HP1.width = b, HP2.width = a, HP1.src = tkHP / maxHP < redHP ? "i/1red.gif" : tkHP / maxHP < yellowHP ? "i/1yellow.gif" : "i/1green.gif", HP.innerHTML = Math.round(tkHP) + "/" + maxHP;
|
||||
}
|
||||
tkHP += maxHP / 53 / 230 * (speed / 100);
|
||||
TimerOn = tkHP < maxHP ? setTimeout("setHPlocal()", delay * 100) : -1
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$('a').live('click', function () {
|
||||
if ($(this).attr('ajax') !== undefined) {
|
||||
const ajaxModule = $(this).attr('ajax');
|
||||
|
||||
switch (ajaxModule) {
|
||||
case'mZeInventory':
|
||||
$('#mZeInventory').html('<div align="center" style="padding:10px;background-color:#d4d2d2;color:grey;"><b>Загрузка...</b></div>');
|
||||
$.ajax({
|
||||
url: $(this).attr('href') + '&mZeAjax=' + ajaxModule,
|
||||
cache: false,
|
||||
dataType: 'html',
|
||||
success: function (html) {
|
||||
$('#mZeInventory').html(html);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<title>Окно игры</title>
|
||||
</HEAD>
|
||||
<body>
|
||||
<?php
|
||||
try {
|
||||
$online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time() - 60));
|
||||
} catch (Exception $e) {
|
||||
echo '<div class="debug">В таблице online нет ячейки real_time так как неясно что она делает. Ошибка обращения в базу.</div>';
|
||||
}
|
||||
?>
|
||||
<div id=hint3 class=ahint></div>
|
||||
<div id="hint4" style="position: absolute;"></div>
|
||||
<div id="chpassbank" style="display:none; position:absolute; top:50px; left:250px;"></div>
|
||||
<table width=100%>
|
||||
<TR>
|
||||
<td style="vertical-align: top; width: 350px">
|
||||
<?php
|
||||
$showUser = new User($_SESSION['uid']);
|
||||
$getItemsBonuses = new DressedItems($_SESSION['uid']);
|
||||
$showUser->showUserDoll(0, 1);
|
||||
?> <!-- Первый столбец -->
|
||||
<?php $showUser->showUserDoll(0, 1); ?> <!-- Первый столбец -->
|
||||
<div align="center">
|
||||
<a href='main.php?edit=1&undress=all'>Снять все</a><BR>
|
||||
<div class="effectList" style="padding-top: 15px; max-height: 150px; width: 220px;">
|
||||
@ -676,16 +537,15 @@ try {
|
||||
<div>
|
||||
<br>Уровень: <strong><?= $showUser->level ?></strong>
|
||||
<br>Опыт: <strong><?= $showUser->experience ?></strong>
|
||||
<br>Побед: <strong><?= 'нет поля' ?></strong>
|
||||
<br>Поражений: <strong><?= 'нет поля' ?></strong>
|
||||
<br>Ничьих: <strong><?= 'нет поля' ?></strong>
|
||||
<br>Побед: <strong>??</strong>
|
||||
<br>Поражений: <strong>??</strong>
|
||||
<br>Ничьих: <strong>??</strong>
|
||||
<br>Деньги: <strong><?= $showUser->money ?></strong> кр.
|
||||
<HR>
|
||||
</div>
|
||||
<!--Параметры-->
|
||||
<div>
|
||||
<div class="container">
|
||||
|
||||
Сила: <?= ($showUser->free_stat_points ? $showUser->getStrength(1) . '(' . strval($showUser->strength + $getItemsBonuses->getStrengthBonus()) . ')' : $showUser->strength + $getItemsBonuses->getStrengthBonus()) ?>
|
||||
<br>
|
||||
Ловкость: <?= ($showUser->free_stat_points ? $showUser->getDexterity(1) . '(' . strval($showUser->dexterity + $getItemsBonuses->getDexterityBonus()) . ')' : $showUser->dexterity + $getItemsBonuses->getDexterityBonus()) ?>
|
||||
@ -711,18 +571,15 @@ try {
|
||||
Урон: <?= $showUser->minDamage + $getItemsBonuses->getMinPhysDamage() ?>
|
||||
- <?= $showUser->maxDamage + $getItemsBonuses->getMaxPhysDamage() ?> <br>
|
||||
<br>
|
||||
<div style="color: gray;">
|
||||
Защита от огня: ?? <br>
|
||||
Защита от воды: ?? <br>
|
||||
Защита от вохдуха: ?? <br>
|
||||
Защита от земли: ?? <br>
|
||||
Защита от яда: ?? <br>
|
||||
</div>
|
||||
Броня головы: <?= $showUser->headArmor ?> <br>
|
||||
Броня корпуса: <?= $showUser->chestArmor ?> <br>
|
||||
Броня ног: <?= $showUser->legArmor ?> <br>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td valign=top>
|
||||
@ -733,37 +590,28 @@ try {
|
||||
title="Образы">
|
||||
<?php endif; ?>
|
||||
<div class="button-group">
|
||||
<button class="button primary" onclick="gotohref('zayavka.php')">Поединки</button>
|
||||
<button class="button" onclick="gotohref('module_quest.php')">Активные задания</button>
|
||||
<button class="button" onclick="gotohref('main.php?edit=1')">Инвентарь</button>
|
||||
<?php if ($user['room'] === 20): ?>
|
||||
<button class="button icon move" onclick="gotohref('main.php?goto=arena')">Войти внутрь
|
||||
<button class="button primary" onclick="window.location.href='zayavka.php';">Поединки</button>
|
||||
<button class="button" onclick="window.location.href='module_quest.php';">Активные задания
|
||||
</button>
|
||||
<?php if ($user->room === 20): ?>
|
||||
<button class="button icon move" onclick="window.location.href='main.php?goto=arena';">Войти
|
||||
внутрь
|
||||
</button>
|
||||
<?php else: ?>
|
||||
<button class="button icon move" onclick="gotohref('main.php?goto=plo')">Выйти на улицу
|
||||
<button class="button icon move" onclick="window.location.href='main.php?goto=plo';">Выйти
|
||||
на улицу
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
<button class="button icon loop" onclick="gotohref('main.php')">Обновить страницу</button>
|
||||
<button class="button icon loop" onclick="window.location.href='main.php';">Обновить страницу
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="mZeInventory"> <!--рюкзак-->
|
||||
<div> <!--рюкзак-->
|
||||
<table BORDER=0 WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#A5A5A5">
|
||||
<caption>Рюкзак
|
||||
(масса: <?= '?? /' . $showUser->strength * 4 ?>)
|
||||
</caption>
|
||||
<?php
|
||||
$data_query = 'SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot = 0 AND on_sale = 0';
|
||||
$data = db::c()->query($data_query, $_SESSION['uid']);
|
||||
|
||||
$groupNum = [];
|
||||
$viewInventory = [];
|
||||
$getItems = [];
|
||||
$row = [];
|
||||
$iteminfo = [];
|
||||
while ($row = $data->fetch_assoc()) {
|
||||
$iteminfo[] = new InventoryItem($row);
|
||||
}
|
||||
|
||||
foreach ($iteminfo as $ii) {
|
||||
echo "<tr><td width='100' align='center' bgcolor='#d3d3d3'>";
|
||||
$ii->printImage();
|
||||
@ -771,17 +619,6 @@ try {
|
||||
echo "<td valign='top' bgcolor='#d3d3d3'>";
|
||||
$ii->printInfo();
|
||||
}
|
||||
|
||||
if ($viewInventory && $getItems) {
|
||||
foreach ($viewInventory as $viewCategiryes) {
|
||||
echo $viewCategiryes['header'];
|
||||
foreach ($viewCategiryes['ids'] as $viewItem) {
|
||||
echo $getItems[$viewItem];
|
||||
}
|
||||
echo $viewCategiryes['fooder'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($data->getNumRows() == 0) {
|
||||
echo "<tr><th colspan='3' align=center bgcolor=#C7C7C7>Пусто";
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ print"<table width=\"440\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
|
||||
<tr>
|
||||
<td align=\"left\"><b style='font-size:12px;'>".$ber['login']."[".$ber["level"]."]</b><IMG alt=\"Инфо\" src=\"i/inf.gif\" width=12 height=12></td>
|
||||
<td align=\"left\">";
|
||||
echo setHP($ber['hp'],$ber['maxhp']);
|
||||
echo showProgressBar($ber['hp'],$ber['maxhp']);
|
||||
print"</td>";
|
||||
if($ber['id'] == $glav_id){
|
||||
print"<td align=\"left\" ><IMG alt=\"Лидер группы\" src=\"http://img.combats.com/i/misc/lead1.gif\" width=24 height=15>";
|
||||
|
95
repair.php
95
repair.php
@ -1,56 +1,75 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (empty($_SESSION['uid'])) {header("Location: index.php");}
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
}
|
||||
require_once("functions.php");
|
||||
$d = db::c()->query('SELECT SUM(`massa`) FROM `inventory` WHERE `dressed` = 0 AND `owner` = ?i', $_SESSION['uid'])->fetch_assoc();
|
||||
if ($user['room'] != 23) {
|
||||
if ($user->room != 23) {
|
||||
header("Location: main.php");
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['battle'] != 0) {
|
||||
if ($user->battle) {
|
||||
header('location: fbattle.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
define('GRAV_LIMIT', 32);
|
||||
define('GRAV_COST', 30);
|
||||
define('REPAIR_STATUS', [
|
||||
'OK_GRAV_ADDED' => 'Гравировка добавлена!',
|
||||
'OK_GRAV_REMOVED' => 'Гравировка удалена!',
|
||||
'OK_REPAIRED' => 'Предмет отремонтирован!',
|
||||
'ERROR_SIZE_LIMIT' => 'Превышен лимит в ' . GRAV_LIMIT . ' символа!',
|
||||
'ERROR_NO_MONEY' => 'Недостаточно денег!',
|
||||
]);
|
||||
$gravirovkaText = $_POST['gravirovka_text'] ?? null;
|
||||
$itemId = $_POST['itemId'] ?? null;
|
||||
$gravirovkaRemove = $_POST['gravirovka_remove'] ?? null;
|
||||
$action = $_POST['action'] ?? null;
|
||||
$goto = $_POST['goto'] ?? null;
|
||||
|
||||
// Гравировка 30 кред. Максимум 32 символа.
|
||||
if (input::post('gravirovka_text') AND input::post('itemId')) {
|
||||
if (30 <= $user['money']) {
|
||||
if (33 > iconv_strlen(input::post('gravirovka_text'))) {
|
||||
db::c()->query('UPDATE `inventory` SET `text` = "?s" WHERE `dressed` = 0 AND `setsale` = 0 AND `owner` = ?i AND `id` = ?i', input::post('gravirovka_text'), $_SESSION['uid'], input::post('itemId'));
|
||||
db::c()->query('UPDATE `users` SET `money` = `money` - 30 WHERE `id` = ?i', $_SESSION['uid']);
|
||||
$status = 'Гравировка добавлена!';
|
||||
} else {$status = 'Превышен лимит в 32 символа!';}
|
||||
} else {$status = 'Недостаточно денег!';}
|
||||
if ($gravirovkaText && $itemId) {
|
||||
if ($user->money >= GRAV_COST) {
|
||||
if (iconv_strlen($gravirovkaText) <= GRAV_LIMIT) {
|
||||
db::c()->query('UPDATE `inventory` SET `text` = "?s" WHERE `dressed` = 0 AND `setsale` = 0 AND `owner` = ?i AND `id` = ?i', $gravirovkaText, $_SESSION['uid'], $itemId);
|
||||
db::c()->query('UPDATE `users` SET `money` = `money` - ?i WHERE `id` = ?i', GRAV_COST, $_SESSION['uid']);
|
||||
$status = REPAIR_STATUS['OK_GRAV_ADDED'];
|
||||
} else {
|
||||
$status = REPAIR_STATUS['ERROR_SIZE_LIMIT'];
|
||||
}
|
||||
} else {
|
||||
$status = REPAIR_STATUS['ERROR_NO_MONEY'];
|
||||
}
|
||||
}
|
||||
|
||||
// Снять гравировку.
|
||||
if (input::post('gravirovka_remove')) {
|
||||
if (30 <= $user['money']) {
|
||||
db::c()->query('UPDATE `inventory` SET `text` = ?n WHERE `dressed` = 0 AND `setsale` = 0 AND `id` = ?i AND `owner` = ?i', null, input::post('gravirovka_remove'), $_SESSION['uid']);
|
||||
db::c()->query('UPDATE `users` SET `money` = `money` - 30 WHERE `id` = ?i', $_SESSION['uid']);
|
||||
$status = 'Гравировка удалена!';
|
||||
} else {$status = 'Недостаточно денег!';}
|
||||
if ($gravirovkaRemove) {
|
||||
if ($user->money >= GRAV_COST) {
|
||||
db::c()->query('UPDATE `inventory` SET `text` = ?n WHERE `dressed` = 0 AND `setsale` = 0 AND `id` = ?i AND `owner` = ?i', null, $gravirovkaRemove, $_SESSION['uid']);
|
||||
db::c()->query('UPDATE `users` SET `money` = `money` - ?i WHERE `id` = ?i', GRAV_COST, $_SESSION['uid']);
|
||||
$status = REPAIR_STATUS['OK_GRAV_REMOVED'];
|
||||
} else {
|
||||
$status = REPAIR_STATUS['ERROR_NO_MONEY'];
|
||||
}
|
||||
}
|
||||
|
||||
// Ремонт 0,5 кред за единицу.
|
||||
if (input::post('action') == 'repair' AND input::post('itemId')) {
|
||||
$q = db::c()->query('SELECT `name`, `duration` FROM `inventory` WHERE id = ?i', input::post('itemId'))->fetch_assoc();
|
||||
if (ceil($q['duration'] / 2) < $user['money']) {
|
||||
db::c()->query('UPDATE `inventory` SET `maxdur` = `maxdur` - 1, `duration` = 0 WHERE `dressed` = 0 AND `setsale` = 0 AND `id` = ?i AND `owner` = ?i', input::post('itemId'), $_SESSION['uid']);
|
||||
if ($action == 'repair' && $itemId) {
|
||||
$q = db::c()->query('SELECT `name`, `duration` FROM `inventory` WHERE id = ?i', $itemId)->fetch_assoc();
|
||||
if ($user->money > ceil($q['duration'] / 2)) {
|
||||
db::c()->query('UPDATE `inventory` SET `maxdur` = `maxdur` - 1, `duration` = 0 WHERE `dressed` = 0 AND `setsale` = 0 AND `id` = ?i AND `owner` = ?i', $itemId, $_SESSION['uid']);
|
||||
db::c()->query('UPDATE `users` SET `money` = `money` - ?i WHERE `id` = ?i', ceil($q['duration'] / 2), $_SESSION['uid']);
|
||||
addToDelo('Отремонтирован предмет «' . $q['name'] . '» id:(' . input::post('itemId') . ') за ' . ceil($q['duration'] / 2) . ' кр.');
|
||||
$status = 'Предмет отремонтирован!';
|
||||
} else {$status = 'Недостаточно денег!';}
|
||||
addToDelo('Отремонтирован предмет «' . $q['name'] . '» id:(' . $itemId . ') за ' . ceil($q['duration'] / 2) . ' кр.');
|
||||
$status = REPAIR_STATUS['OK_REPAIRED'];
|
||||
} else {
|
||||
$status = REPAIR_STATUS['ERROR_NO_MONEY'];
|
||||
}
|
||||
|
||||
if (input::post('goto') == 'remont') {
|
||||
}
|
||||
if ($goto == 'remont') {
|
||||
$remont_query = db::c()->query('SELECT `id`,`name`,`img`,`duration`,`maxdur` FROM `inventory` WHERE `type` < 12 AND `dressed` = 0 AND `isrep` = 1 AND `setsale` = 0 AND `duration` > 0 AND `owner` = ?i ORDER BY `update` DESC', $_SESSION['uid']);
|
||||
}
|
||||
|
||||
if (input::post('goto') == 'gravirovka') {
|
||||
if ($goto == 'gravirovka') {
|
||||
$gravirovka_query = db::c()->query('SELECT `id`,`name`,`img`,`text` FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 3 AND `name` NOT LIKE "?S" AND `setsale` = 0 OR `text` <> "?s" AND `owner` = ?i AND `dressed` = 0 AND `setsale` = 0 ORDER by `update` DESC', $_SESSION['uid'], '%Букет%', '', $_SESSION['uid']);
|
||||
}
|
||||
|
||||
?>
|
||||
<!doctype html>
|
||||
<HTML lang="ru">
|
||||
@ -82,7 +101,7 @@ if (input::post('goto') == 'gravirovka') {
|
||||
<span class="legend">Зал гравировки</span>
|
||||
<form method="post">
|
||||
<input type="hidden" name="goto" value="gravirovka">
|
||||
<input type="submit" value="Войти">
|
||||
<input type="submit" value="Войти" disabled>
|
||||
</form>
|
||||
<span class="wrap">Нанесение надписей на оружие и удаление надписей из любого обмундирования.
|
||||
Максимум 32 символа!</span>
|
||||
@ -92,7 +111,7 @@ if (input::post('goto') == 'gravirovka') {
|
||||
<span class="wrap"><?= $status ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if (input::post('goto') == 'remont'):
|
||||
<?php if ($goto == 'remont'):
|
||||
while ($row = $remont_query->fetch_assoc()): ?>
|
||||
<div class="appblock">
|
||||
<span class="legend"><?= $row['name'] ?></span>
|
||||
@ -109,7 +128,7 @@ if (input::post('goto') == 'gravirovka') {
|
||||
</div>
|
||||
<?php endwhile; endif; ?>
|
||||
|
||||
<?php if (input::post('goto') == 'gravirovka'):
|
||||
<?php if ($goto == 'gravirovka'):
|
||||
while ($row = $gravirovka_query->fetch_assoc()): ?>
|
||||
<div class="appblock">
|
||||
<span class="legend"><?= $row['name'] ?></span>
|
||||
@ -135,7 +154,7 @@ if (input::post('goto') == 'gravirovka') {
|
||||
<?php endwhile; endif; ?>
|
||||
|
||||
<?php
|
||||
if (input::post('goto') == 'modding') {
|
||||
if ($goto == 'modding') {
|
||||
$data = mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = '{$_SESSION['uid']}' AND `dressed` = 0 AND `name` NOT LIKE '% (мф)%' AND `name` NOT LIKE '%Букет%' AND `setsale`=0 ORDER by `update` DESC; ");
|
||||
while ($row = mysql_fetch_array($data)) {
|
||||
?>
|
||||
@ -154,7 +173,7 @@ if (input::post('goto') == 'gravirovka') {
|
||||
}
|
||||
}
|
||||
|
||||
if (input::post('goto') == 'podgon') {
|
||||
if ($goto == 'podgon') {
|
||||
$data = mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = '{$user['id']}' AND `dressed` = 0 AND `modif`='1' AND `podgon`<'5' AND `name` NOT LIKE '%Букет%' AND `setsale`=0 ORDER by `update` DESC; ");
|
||||
while ($row = mysql_fetch_array($data)) {
|
||||
?>
|
||||
|
@ -11,10 +11,9 @@ if ($user['battle'] != 0) {
|
||||
}
|
||||
|
||||
db::c()->query('LOCK TABLES `bots` WRITE, `battle` WRITE, `logs` WRITE, `users` WRITE, `inventory` WRITE, `zayavka` WRITE, `effects` WRITE, `online` WRITE, `clans` WRITE');
|
||||
|
||||
if ((input::check('do') == "clear") AND $user['admin'] == 1) {
|
||||
$do = $_GET['do'] ?? null;
|
||||
if ($do == "clear" && $user->admin == 1) {
|
||||
db::c()->query('UPDATE `zayavka` SET `coment` = "?s" WHERE `id` = ?i', '<em>Вырезано цензурой!</em>', $_GET['zid']);
|
||||
|
||||
}
|
||||
|
||||
if (!empty($_GET['del']) && $user['admin'] == 1) { //удаление заявки на бой.
|
||||
|
Loading…
Reference in New Issue
Block a user