battles/functions.php

2567 lines
128 KiB
PHP
Raw Normal View History

2018-01-28 16:40:49 +00:00
<?php
/**
* Copyright (c) 2018.
* Author: Igor Barkov <lopar.4ever@gmail.com>
* Project name: Battles-Game
*/
2018-01-28 16:40:49 +00:00
require_once 'config.php';
/**
* Класс-заглушка для работы глобальных переменных в функциях.
* Возвращает массив данных таблицы users.
*/
2019-01-16 01:00:08 +00:00
if (isset($_SESSION['uid'])) $user = (new users_row($_SESSION['uid']))->result();
2018-03-03 00:14:58 +00:00
if (isset($user['id']) && $user['block'] == 1) {
die();
}
2018-01-28 16:40:49 +00:00
define("HPADDICTIONEFFECT", 33);
$ip = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP);
2018-01-28 16:40:49 +00:00
if (isset($_GET['goto']) and isset($_GET['tStamp']) and isset($_GET['vcode'])) {
if ($_GET['vcode'] == md5(sha1($_GET['goto'] . $_GET['tStamp']))) {
db::c()->query('UPDATE `users`,`online` SET `users`.`room` = ?i, `online`.`room` = ?i WHERE `online`.`id` = `users`.`id` AND `online`.`id` = ?i', $_GET['goto'], $_GET['goto'], $_SESSION['uid']);
2018-01-28 16:40:49 +00:00
$user['room'] = intval($_GET['goto']);
}
}
function createbot($bot, $login = "")
{
$rec = db::c()->query('SELECT `id`, `login`, `maxhp` FROM `users` WHERE `id` = "?s" LIMIT 1', $bot)->fetch_assoc();
if (isset($rec['id'])) {
if ($login) {
$rec['login'] = $login;
}
$botname = $rec['login'];
2018-12-10 20:16:42 +00:00
db::c()->query('INSERT INTO `bots` (`name`, `prototype`, `hp`) VALUES ("?s", "?s", "?s")', $botname, $bot, $rec['maxhp']);
$nid = db::c()->getLastInsertId();
2018-12-27 14:46:00 +00:00
return ["id" => $nid, "login" => $botname];
2018-01-28 16:40:49 +00:00
} else {
return false;
}
}
#####Для нападалок. Сперва комнаты в которых нельзя напасть, потом персонаж на которого нельзя напасть.
$unkilable = [
'rooms' => [620, 621, 1051, 1052],
'users' => [10962, 10964, 10965]
];
2018-01-28 16:40:49 +00:00
$canalenters = [620];
$caverooms = [621];
$userslots = ['sergi', 'kulon', 'perchi', 'weap', 'bron', 'r1', 'r2', 'r3', 'helm', 'shit', 'boots', 'rybax', 'plaw', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9', 'm10'];
2018-01-28 16:40:49 +00:00
function getuserdata($id = 0)
{
2018-12-27 14:46:00 +00:00
if (!$id) $id = isset($_SESSION['uid']) ? $_SESSION['uid'] : null; // Хорошее решение проверок, кстати.
if (!$id) return [];
2018-01-28 16:40:49 +00:00
$rec = db::c()->query('SELECT `hp`, `maxhp`, `fullhptime`, `battle` FROM `users` WHERE `id` = "?s"', $id)->fetch_assoc();
if ($rec['hp'] < $rec['maxhp'] && time() > $rec['fullhptime'] && !$rec['battle'] && ($rec['hp'] > 0)) {
2018-03-04 02:13:54 +00:00
// regenhp($rec, 0);
2018-01-28 16:40:49 +00:00
if ($rec['hp'] == $rec['maxhp']) {
$rec['hp']--;
}
}
return $rec;
}
if (!isset($user)) {
$user = getuserdata();
}
2018-12-27 14:46:00 +00:00
$var_map = [
2018-01-28 16:40:49 +00:00
'cell_1' => 'Березовая роща', 'cell_2' => 'Березовая просека', 'cell_3' => 'Тёмный угол', 'cell_4' => 'Мрачная опушка',
'cell_5' => 'Тёмное урочище', 'cell_6' => 'Бурелом', 'cell_7' => 'Старая ива', 'cell_8' => 'Разнолесье',
'cell_9' => 'Сосновая тропа', 'cell_10' => 'Забытая дорога', 'cell_11' => 'Новая дорога', 'cell_12' => 'Мщаник',
'cell_13' => 'Ясная поляна', 'cell_14' => 'Заросший тракт', 'cell_15' => 'Смутный ельник', 'cell_16' => 'Сосновый бор',
'cell_17' => 'Тихоход', 'cell_18' => 'Сосновый гай', 'cell_19' => 'Смешаный лес', 'cell_20' => 'Темная поляна',
'cell_21' => 'Осенний угол', 'cell_22' => 'Грибное место', 'cell_23' => 'Опушка', 'cell_24' => 'Рыжий лес',
'cell_25' => 'Полесье'
2018-12-27 14:46:00 +00:00
];
2018-01-28 16:40:49 +00:00
function get_out($u)
{
$pers = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $u . '" LIMIT 1'));
undressall($pers['id']);
mysql_query('UPDATE `inventory` SET `owner` = "' . $pers['id'] . '" WHERE `owner` = "' . ($pers['id'] + _BOTSEPARATOR_) . '"');
###
$row = mysql_query('SELECT * FROM `effects` WHERE `owner` = "' . ($pers['id'] + _BOTSEPARATOR_) . '"');
2018-12-27 14:46:00 +00:00
$travm = [11, 12, 13, 14];
2018-01-28 16:40:49 +00:00
while ($efs = mysql_fetch_array($row)) {
if (in_array($efs['type'], $travm)) {
$pers['sila'] -= $efs['sila'];
$pers['lovk'] -= $efs['lovk'];
$pers['inta'] -= $efs['inta'];
$pers['vinos'] -= $efs['vinos'];
} else {
$pers['sila'] += $efs['sila'];
$pers['lovk'] += $efs['lovk'];
$pers['inta'] += $efs['inta'];
$pers['vinos'] += $efs['vinos'];
$pers['maxhp'] += $efs['hp'];
}
2018-12-10 20:16:42 +00:00
$efs['owner'] = $_SESSION['uid'];
mysql_query('UPDATE `effects` SET `owner` = "' . $efs['owner'] . '" WHERE `id` = "' . $efs['id'] . '" LIMIT 1');
mysql_query('UPDATE `users` SET `sila` = "' . $pers['sila'] . '", `lovk` = "' . $pers['lovk'] . '", `inta` = "' . $pers['inta'] . '", `vinos` = "' . $pers['vinos'] . '", `maxhp` = "' . $pers['maxhp'] . '" WHERE `id` = "' . $pers['id'] . '" LIMIT 1');
2018-01-28 16:40:49 +00:00
}
###
}
function takeshopitem($item, $table = "shop", $present = '', $onlyonetrip = '', $fields = 0, $uid = 0, $koll = 1, $podzem = 0)
2018-01-28 16:40:49 +00:00
{
global $user;
2018-12-10 20:16:42 +00:00
$flds = [];
$goden = '';
2018-01-28 16:40:49 +00:00
if (!$uid) {
$uid = $user['id'];
}
$r = mysql_query("SHOW FIELDS FROM $table");
$r2 = mysql_query("SHOW FIELDS FROM inventory");
while ($rec = mysql_fetch_assoc($r2)) {
$flds[$rec['Field']] = 1;
}
$rec1 = mysql_fetch_array(mysql_query("SELECT * FROM `$table` WHERE `id` = '$item' LIMIT 1"));
if ($rec1['koll']) {
mysql_query("UPDATE `inventory` SET `koll` = (`koll`+$koll), `massa` = (`massa`+" . ($rec1['massa'] * $koll) . "), `cost` = (`cost`+" . $rec1['cost'] . ") WHERE `owner` = '$uid' AND `prototype` = '$item' LIMIT 1");
2018-12-27 14:46:00 +00:00
if (mysql_affected_rows() > 0) return ["img" => $rec1['img'], "name" => $rec1['name']];
2018-01-28 16:40:49 +00:00
$rec1['koll'] = $koll;
$rec1['massa'] *= $koll;
}
if ($rec1['onlyone']) {
$i = mysql_fetch_row(mysql_query("SELECT `id` FROM `inventory` WHERE `owner` = '$uid' AND `prototype` = '$item'"));
if ($i) {
2018-12-27 14:46:00 +00:00
return ["error" => "У вас слишком много таких вещей."];
2018-01-28 16:40:49 +00:00
}
}
if ($present) {
$rec1['present'] = $present;
$rec1['cost'] = 0;
$rec1['ecost'] = 0;
}
$sql = "";
while ($rec = mysql_fetch_assoc($r)) {
2018-12-10 20:16:42 +00:00
if (!$flds[$rec['Field']]) continue;
2018-01-28 16:40:49 +00:00
if ($rec['Field'] == "dategoden") {
$goden = $rec1[$rec['Field']];
}
if ($rec['Field'] == "goden") {
$goden = $rec1[$rec['Field']];
}
if ($rec['Field'] == "id" || $rec['Field'] == "prototype" || $rec['Field'] == "dategoden") continue;
$sql .= ", `$rec[Field]` = '" . $rec1[$rec['Field']] . "' ";
}
if ($podzem) {
$rec1['podzem'] = $podzem;
}
if ($fields['goden']) {
$goden = $fields["goden"];
}
2018-12-10 20:16:42 +00:00
mysql_query("INSERT INTO `inventory` SET " . ($present ? "`present` = '$present'," : "") . ($rec1['podzem'] ? "`podzem` = '$rec1[podzem]'," : "") . " `owner` = '$uid', `otdel` = $rec1[razdel] , `prototype` = '$item' " . ($onlyonetrip ? ", `foronetrip` = 1" : "") . ($goden ? ", `dategoden` = '" . ($goden * 60 * 60 * 24 + time()) . "'" : "") . " $sql");
2018-12-27 14:46:00 +00:00
return ["img" => $rec1['img'], "name" => $rec1['name'], "id" => mysql_insert_id()];
2018-01-28 16:40:49 +00:00
}
2018-12-27 14:46:00 +00:00
$abils_array = ['attack', 'sleep', 'sleepf'];
$ab_user = ['sleep15', 'sleep30', 'closebattle', 'heal20', 'heal35', 'heal50', 'travmoff', 'attack', 'bloodattack', 'death', 'comment', 'openbattle', 'reamdeath', 'clone', 'unclone'];
2018-01-28 16:40:49 +00:00
define('_BOTSEPARATOR_', 10000000);
2018-03-03 11:52:34 +00:00
$exptable = [
0 => [0, 0, 0, 0, 0, 20],
20 => [1, 0, 0, 0, 0, 45],
45 => [1, 0, 0, 2, 0, 75],
75 => [1, 0, 0, 4, 0, 110],
110 => [3, 1, 1, 8, 1, 160], # Это первый уровень
160 => [1, 0, 0, 2, 0, 215],
215 => [1, 0, 0, 2, 0, 280],
280 => [1, 0, 0, 4, 0, 350],
350 => [1, 0, 0, 8, 0, 410],
410 => [3, 1, 1, 16, 1, 530], # Это второй уровень
530 => [1, 0, 0, 8, 0, 670],
670 => [1, 0, 0, 12, 0, 830],
830 => [1, 0, 0, 16, 0, 950],
950 => [1, 0, 0, 24, 0, 1100],
1100 => [1, 0, 0, 32, 0, 1300],
1300 => [3, 1, 1, 40, 1, 1450], # Это третий уровень
1450 => [1, 0, 0, 10, 0, 1650],
1650 => [1, 0, 0, 20, 0, 1850],
1850 => [1, 0, 0, 30, 0, 2050],
2050 => [1, 0, 0, 40, 0, 2200],
2200 => [1, 0, 0, 50, 0, 2500],
2500 => [5, 1, 1, 70, 1, 2900], # Это четвёртый уровень
2900 => [1, 0, 0, 10, 0, 3350],
3350 => [1, 0, 0, 20, 0, 3800],
3800 => [1, 0, 0, 30, 0, 4200],
4200 => [1, 0, 0, 40, 0, 4600],
4600 => [1, 0, 0, 50, 0, 5000],
5000 => [3, 1, 1, 80, 1, 6000], # Это пятый уровень
6000 => [1, 0, 0, 15, 0, 7000],
7000 => [1, 0, 0, 30, 0, 8000],
8000 => [1, 0, 0, 40, 0, 9000],
9000 => [1, 0, 0, 50, 0, 10000],
10000 => [1, 0, 0, 40, 0, 11000],
11000 => [1, 0, 0, 50, 0, 12000],
12000 => [1, 0, 0, 60, 0, 12500],
12500 => [3, 1, 1, 90, 1, 14000], # Это шестой уровень
14000 => [1, 0, 0, 20, 0, 15500],
15500 => [1, 0, 0, 30, 0, 17000],
17000 => [1, 0, 0, 50, 0, 19000],
19000 => [1, 0, 0, 55, 0, 21000],
21000 => [1, 0, 0, 50, 0, 23000],
23000 => [1, 0, 0, 55, 0, 27000],
27000 => [1, 0, 0, 50, 0, 30000],
30000 => [5, 1, 1, 100, 1, 60000], # Это седьмой уровень
60000 => [1, 0, 0, 100, 0, 75000],
75000 => [1, 0, 0, 100, 0, 150000],
150000 => [1, 0, 0, 150, 0, 175000],
175000 => [1, 0, 0, 50, 0, 200000],
200000 => [1, 0, 0, 100, 0, 225000],
225000 => [1, 0, 0, 50, 0, 250000],
250000 => [1, 0, 0, 100, 0, 260000],
260000 => [1, 0, 0, 50, 0, 280000],
280000 => [1, 0, 0, 100, 0, 300000],
300000 => [5, 1, 1, 700, 1, 1500000], # Это восьмой уровень
1500000 => [1, 0, 0, 500, 0, 1750000],
1750000 => [1, 0, 0, 200, 0, 2000000],
2000000 => [1, 0, 0, 300, 0, 2175000],
2175000 => [1, 0, 0, 100, 0, 2300000],
2300000 => [1, 0, 0, 100, 0, 2400000],
2400000 => [1, 0, 0, 100, 0, 2500000],
2500000 => [1, 0, 0, 200, 0, 2600000],
2600000 => [1, 0, 0, 100, 0, 2800000],
2800000 => [1, 0, 0, 200, 0, 3000000],
3000000 => [5, 1, 2, 1000, 1, 6000000], # Это девятый уровень
6000000 => [1, 0, 0, 200, 0, 6500000],
6500000 => [1, 0, 0, 250, 0, 7500000],
7500000 => [1, 0, 0, 200, 0, 8500000],
8500000 => [1, 0, 0, 250, 0, 9000000],
9000000 => [1, 0, 0, 400, 0, 9250000],
9250000 => [1, 0, 0, 250, 0, 9500000],
9500000 => [1, 0, 0, 400, 0, 9750000],
9750000 => [1, 0, 0, 350, 0, 9900000],
9900000 => [1, 0, 0, 500, 0, 10000000],
10000000 => [9, 1, 3, 2000, 1, 13000000], # Это десятый уровень
13000000 => [2, 0, 0, 200, 0, 14000000],
14000000 => [2, 0, 0, 200, 0, 15000000],
15000000 => [2, 0, 0, 200, 0, 16000000],
16000000 => [2, 0, 0, 200, 0, 17000000],
17000000 => [2, 0, 0, 200, 0, 17500000],
17500000 => [2, 0, 0, 200, 0, 18000000],
18000000 => [2, 0, 0, 200, 0, 19000000],
19000000 => [2, 0, 0, 200, 0, 19500000],
19500000 => [2, 0, 0, 200, 0, 20000000],
20000000 => [2, 0, 0, 250, 0, 30000000],
30000000 => [2, 0, 0, 200, 0, 32000000],
32000000 => [2, 0, 0, 250, 0, 34000000],
34000000 => [2, 0, 0, 200, 0, 35000000],
35000000 => [2, 0, 0, 250, 0, 36000000],
36000000 => [2, 0, 0, 200, 0, 38000000],
38000000 => [2, 0, 0, 250, 0, 40000000],
40000000 => [2, 0, 0, 200, 0, 42000000],
42000000 => [2, 0, 0, 250, 0, 44000000],
44000000 => [2, 0, 0, 350, 0, 47000000],
47000000 => [2, 0, 0, 300, 0, 50000000],
50000000 => [2, 0, 0, 350, 0, 52000000],
52000000 => [10, 1, 3, 3000, 1, 58000000], # Это одиннадцатый уровень
58000000 => [1, 0, 0, 350, 0, 65000000],
65000000 => [1, 0, 0, 300, 0, 72000000],
72000000 => [1, 0, 0, 350, 0, 77000000],
77000000 => [1, 0, 0, 350, 0, 82000000],
82000000 => [1, 0, 0, 300, 0, 87000000],
87000000 => [1, 0, 0, 350, 0, 92000000],
92000000 => [1, 0, 0, 350, 0, 100000000],
100000000 => [1, 0, 0, 350, 0, 120000000],
120000000 => [2, 0, 0, 400, 0, 140000000],
140000000 => [2, 0, 0, 400, 0, 160000000],
160000000 => [2, 0, 0, 600, 0, 180000000],
180000000 => [2, 0, 0, 400, 0, 210000000],
210000000 => [2, 0, 0, 400, 0, 240000000],
240000000 => [10, 2, 4, 5000, 1, 260000000], # Это двеннадцатый уровень
260000000 => [2, 0, 0, 400, 0, 320000000],
320000000 => [2, 0, 0, 400, 0, 400000000],
400000000 => [3, 0, 0, 600, 0, 455000000],
455000000 => [2, 0, 0, 150, 0, 510000000],
510000000 => [2, 0, 0, 100, 0, 600000000],
600000000 => [2, 0, 0, 300, 0, 750000000],
750000000 => [5, 0, 0, 700, 0, 770000000],
770000000 => [1, 0, 0, 400, 0, 815000000],
815000000 => [1, 0, 0, 200, 0, 860000000],
860000000 => [1, 0, 0, 600, 0, 1000000000],
1000000000 => [1, 0, 0, 300, 0, 1100000000],
1100000000 => [1, 0, 0, 450, 0, 1250000000],
1250000000 => [1, 0, 0, 450, 0, 1500000000],
1500000000 => [10, 1, 5, 8000, 1, 9999999999], # Это тринадцатый уровень
];
2018-01-28 16:40:49 +00:00
$rooms = [
2018-01-28 16:40:49 +00:00
"0" => "Секретная Комната",
"1" => "Комната Новичков",
"2" => "Комната Новичков 2",
"3" => "Комната Новичков 3",
"4" => "Комната Новичков 4",
"5" => "Зал Воинов ",
"6" => "Зал Воинов 1",
"7" => "Зал Воинов 2",
"8" => "Торговый зал",
"9" => "Рыцарский зал",
"10" => "Башня рыцарей-магов",
"11" => "Колдовской мир",
"12" => "Этажи духов",
"13" => "Астральные этажи",
"14" => "Огненный мир",
"15" => "Зал Паладинов",
"16" => "Совет Белого Братства",
"17" => "Зал Тьмы",
"18" => "Царство Тьмы",
"19" => "Будуар",
"20" => "Центральная площадь",
"2702" => "Центральная площадь",
"21" => "Страшилкина улица",
"22" => "Магазин",
"23" => "Ремонтная мастерская",
"24" => "Памятник Архангелу",
"25" => "Комиссионный магазин",
"26" => "Большая парковая улица",
"2655" => "Арена Богов",
"2601" => "Замковая Площадь",
"27" => "Почта",
"28" => "Регистратура кланов",
"29" => "Банк",
"30" => "Регистратура кланов",
"31" => "Башня смерти",
"32" => "Готический замок",
"33" => "Лабиринт хаоса",
"34" => "Цветочный магазин",
"35" => "Сувенирный магазин",
"36" => "Зал Стихий",
"37" => "Готический замок - приемная",
"38" => "Готический замок - арсенал",
"39" => "Готический замок - внутренний двор",
"40" => "Готический замок - мастерские",
"41" => "Готический замок - комнаты отдыха",
"42" => "Лотерея Сталкеров",
"43" => "Хижина Знахаря",
"44" => "Новогодняя елка",
"45" => "Замок Мэра",
"47" => "Замок (строительство)",
"48" => "Обитель Хаоса",
"49" => "Проход к Цитадели Хаоса",
"50" => "Магазин Берёзка",
"51" => "Парковая улица",
"52" => "Квартал Законников",
"53" => "Библиотека",
"54" => "Зал Света",
"55" => "Царство Света",
"56" => "Царство Стихий",
"57" => "Зал Клановых Войн",
"101" => "Противостояние сил",
"200" => "Турнир", "401" => "Врата Ада",
// БС
"501" => "Восточная Крыша",
"502" => "Бойница",
"503" => "Келья 3",
"504" => "Келья 2",
"505" => "Западная Крыша 2",
"506" => "Келья 4",
"507" => "Келья 1",
"508" => "Служебная комната",
"509" => "Зал Отдыха 2",
"510" => "Западная Крыша 1",
"511" => "Выход на Крышу",
"512" => "Зал Статуй 2",
"513" => "Храм",
"514" => "Восточная комната",
"515" => "Зал Отдыха 1",
"516" => "Старый Зал 2",
"517" => "Старый Зал 1",
"518" => "Красный Зал 3",
"519" => "Зал Статуй 1",
"520" => "Зал Статуй 3",
"521" => "Трапезная 3",
"522" => "Зал Ожиданий",
"523" => "Оружейная",
"524" => "Красный Зал-Окна",
"525" => "Красный Зал",
"526" => "Гостинная",
"527" => "Трапезная 1",
"528" => "Внутренний Двор",
"529" => "Внутр.Двор-Вход",
"530" => "Желтый Коридор",
"531" => "Мраморный Зал 1",
"532" => "Красный Зал 2",
"533" => "Библиотека 1",
"534" => "Трапезная 2",
"535" => "Проход Внутр. Двора",
"536" => "Комната с Камином",
"537" => "Библиотека 3",
"538" => "Выход из Мрам.Зала",
"539" => "Красный Зал-Коридор",
"540" => "Лестница в Подвал 1",
"541" => "Южный Внутр. Двор",
"542" => "Трапезная 4",
"543" => "Мраморный Зал 3",
"544" => "Мраморный Зал 2",
"545" => "Картинная Галерея 1",
"546" => "Лестница в Подвал 2",
"547" => "Проход Внутр. Двора 2",
"548" => "Внутр.Двор-Выход",
"549" => "Библиотека 2",
"550" => "Картинная Галерея 3",
"551" => "Картинная Галерея 2",
"552" => "Лестница в Подвал 3",
"553" => "Терасса",
"554" => "Оранжерея",
"555" => "Зал Ораторов",
"556" => "Лестница в Подвал 4",
"557" => "Темная Комната",
"558" => "Винный Погреб",
"559" => "Комната в Подвале",
"560" => "Подвал",
"600" => "Вход в Цитадель Хаоса",
"601" => "Цитадель Хаоса",
"602" => "Городской парк",
"603" => "Арена Ангелов",
620 => "Вход в Рудник",
621 => "Рудник",
660 => "Гостиница, холл",
661 => "Гостиница",
662 => "Памятник Архангелу",
760 => "Тёмный Лес",
// Клановая улица
"650" => "Клановая улица",
"651" => "Клановая улица",
"652" => "Клановый Замок",
//
"1000" => "Вход в рудник",
"1001" => "Рудник",
1051 => "Вход в Лабиринты",
1052 => "Лабиринты",
1053 => "Храмовая лавка",
1054 => "Фонтан Удачи",
1055 => "Групповое сражение",
// Тайный проход из Клуба в Замок Законников
"2000" => "Подземный проход",
"2001" => "Подземный проход (1)",
"2002" => "Подземный проход (2)",
"2003" => "Подземный проход (3)",
"2004" => "Подземный проход (4)",
"2005" => "Подземный проход (5)",
"2006" => "Подземный проход (6)",
"2007" => "Подземный проход (7)",
"2008" => "Подземный проход (8)",
"2009" => "Подземный проход (9)",
"2010" => "Подземный проход (10)",
"2011" => "Подземный проход (11)",
"2012" => "Подземный проход (12)",
"2013" => "Подземный проход (13)",
"2014" => "Подземный проход (14)",
"2015" => "Подземный проход (15)",
"2016" => "Подземный проход (16)",
"2017" => "Подземный проход (17)",
"2018" => "Подземный проход (18)",
"2019" => "Подземный проход (19)",
"2020" => "Подземный проход (20)",
"2021" => "Подземный проход (21)",
"2022" => "Подземный проход (22)",
"2023" => "Подземный проход (23)",
"2024" => "Подземный проход (24)",
"2025" => "Подземный проход (25)",
"2026" => "Подземный проход (26)",
"2027" => "Подземный проход (27)",
"2028" => "Подземный проход (28)",
"2029" => "Подземный проход (29)",
"2030" => "Подземный проход (30)",
"2031" => "Подземный проход (31)",
"2032" => "Подземный проход (32)",
"2033" => "Подземный проход (33)",
"2034" => "Подземный проход (34)",
"2035" => "Подземный проход (35)",
"2036" => "Подземный проход (36)",
"2037" => "Подземный проход (37)",
"2038" => "Подземный проход (38)",
"2039" => "Подземный проход (39)",
"2040" => "Подземный проход (40)",
"2041" => "Подземный проход (41)",
"2042" => "Подземный проход (42)",
"2043" => "Подземный проход (43)",
"2044" => "Подземный проход (44)",
"2045" => "Подземный проход (45)",
"2046" => "Подземный проход (46)",
"2047" => "Подземный проход (47)",
"2048" => "Подземный проход (48)",
"2049" => "Подземный проход (49)",
"2050" => "Подземный проход (50)",
"2051" => "Подземный проход (51)",
"2052" => "Подземный проход (52)",
"2053" => "Подземный проход (53)",
"2054" => "Подземный проход (54)",
"2055" => "Подземный проход (55)",
"2056" => "Подземный проход (56)",
"2057" => "Подземный проход (57)",
"2100" => "Сектор 2100"
];
2018-01-28 16:40:49 +00:00
//эффективность магии
2018-12-27 14:46:00 +00:00
$elem_align = [
"a" => ["a" => "1", "e" => "0", "f" => "0.5", "w" => "0.5"],
"e" => ["a" => "0", "e" => "1", "f" => "0.5", "w" => "0.5"],
"f" => ["a" => "0.5", "e" => "0.5", "f" => "1", "w" => "0"],
"w" => ["a" => "0.5", "e" => "0.5", "f" => "0", "w" => "1"],
];
$elem_bonus = [
"a" => ["a" => "1", "e" => "0.75", "f" => "1.25", "w" => "1"],
"e" => ["a" => "1.25", "e" => "1", "f" => "1", "w" => "0.75"],
"f" => ["a" => "0.75", "e" => "1", "f" => "1", "w" => "1.25"],
"w" => ["a" => "1", "e" => "1.25", "f" => "0.75", "w" => "1"],
];
2018-01-28 16:40:49 +00:00
header("Cache-Control: no-cache");
function level_up($uid)
{
global $exptable;
$us = db::c()->query('SELECT `id`, `login`, `level`, `money`, `exp`, `vinos`, `nextup`, `stats`, `master`, `maxhp`, `ip`, `in_tower` FROM `users` WHERE `id` =?i', $uid)->fetch_assoc();
2018-01-28 16:40:49 +00:00
if (isset($us['id'])) {
if ($us['exp'] >= $us['nextup'] && !$us['in_tower']) {
if ($exptable[$us['nextup']][4] == 1) {
addch("Персонаж <b>{$us['login']}</b> перешел на " . ($us['level'] + 1) . " уровень.");
2018-01-28 16:40:49 +00:00
addchp('<font color=red>Внимание!</font> Вы перешли на новый уровень. За это Вы получаете: ' . $exptable[$us['nextup']][3] . ' кр.', '{[]}' . $us['login'] . '{[]}');
} elseif ($exptable[$us['nextup']][4] == 0) {
addchp('<font color=red>Внимание!</font> Вы перешли на новый АП. За это Вы получаете: ' . $exptable[$us['nextup']][3] . ' кр.', '{[]}' . $us['login'] . '{[]}');
}
$us['nextup'] = $exptable[$us['nextup']][5];
$us['stats'] += $exptable[$us['nextup']][0];
$us['master'] += $exptable[$us['nextup']][1];
$us['vinos'] += $exptable[$us['nextup']][2];
$us['maxhp'] += ($exptable[$us['nextup']][2] * 6);
$us['money'] += $exptable[$us['nextup']][3];
db::c()->query('UPDATE `users` SET `nextup` = ?i, `stats` = ?i, `master` = ?i, `vinos` = ?i, `maxhp` = ?i, `money` = ?i, `level` = ?i WHERE `id` = ?i', $us['nextup'], $us['stats'], $us['master'], $us['vinos'], $us['maxhp'], $us['money'], $us['level'], $us['id']);
2018-01-28 16:40:49 +00:00
}
}
}
######## FIXME ВЕЧНЫЕ 12-ТКИ!!!!!!!!!!!!
2019-01-16 01:00:08 +00:00
if (isset($_SESSION['uid']))
$in_user = db::c()->query('SELECT `id`, `exp`, `nextup`, `level` FROM `users` WHERE `id` = ?i', $_SESSION['uid'])->fetch_assoc();
2018-01-28 16:40:49 +00:00
if (isset($in_user['id']) && ($in_user['exp'] >= $in_user['nextup']) && $in_user['level'] < 13) {
level_up($in_user['id']);
}
########
function savecavedata($cavedata, $caveleader, $floor)
{
$f1 = fopen("cavedata/$caveleader-$floor.dat", "wb+");
flock($f1, LOCK_EX);
fwrite($f1, serialize($cavedata));
flock($f1, LOCK_UN);
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 nick($user)
{
$r = '';
if ($user['align'] > 0) {
$al = $user['align'];
} else {
$al = 0;
}
if ($user['klan'] != '') {
$cl = '<img title="' . ClanImage($user['klan']) . '" src="i/klan/' . ClanImage($user['klan']) . '.gif" />';
} else {
$cl = '';
}
$r .= '<div id="HP"><img src="i/align_' . $al . '.gif" />' . $cl . '';
$r .= '<b>' . $user['login'] . '</b> [' . $user['level'] . '] <a href="inf.php?' . $user['id'] . '" target="_blank"><img src="i/inf.gif" width="12" height="11" /></a>';
$r .= ' <img src="i/herz.gif" width="10" height="10" /> <img src="i/1green.gif" width="' . (150 * ($user['hp'] / $user['maxhp'])) . '" height="10" name="HP1" /><img src="i/1silver.gif" width="' . (150 - 150 * ($user['hp'] / $user['maxhp'])) . '" height="10" name="HP2" />: <span id=\'hp_value\'>' . $user['hp'] . '</span>/' . $user['maxhp'] . '</div>';
$r .= '';
return $r;
}
2018-01-28 16:40:49 +00:00
function nick4($id, $st)
{
2018-03-01 16:56:17 +00:00
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
2018-01-28 16:40:49 +00:00
if ($user[0]) {
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$id}' AND `type` = '1022' LIMIT 1"));
if ($effect) {
$user['level'] = '??';
$user['login'] = '</a><b><i>невидимка</i></b>';
$user['align'] = '0';
$user['klan'] = '';
$user['id'] = '';
$user['hp'] = '??';
$user['maxhp'] = '??';
}
return "<span onclick=\"top.AddTo('" . $user['login'] . "')\" oncontextmenu=\"return OpenMenu(event," . $user['level'] . ")\" class={$st}>" . $user['login'] . "</span> [" . $user['hp'] . "/" . $user['maxhp'] . "]";
}
}
function check_proc($u)
{
$r = 100;
$usr = mysql_fetch_array(mysql_query('SELECT `id`, `vip`, `vip_time` FROM `users` WHERE `id` = "' . $u . '" LIMIT 1'));
if ($usr['vip_time'] > time()) {
if ($usr['vip'] == 1) {
$r += 10;
} elseif ($usr['vip'] == 2) {
$r += 15;
} elseif ($usr['vip'] == 3) {
$r += 20;
}
}
$effes = mysql_fetch_array(mysql_query('SELECT SUM(`proc_exp`) AS `sums` FROM `effects` WHERE `owner` = "' . $usr['id'] . '" AND `proc_exp` > 0'));
if ($effes['sums'] > 0) {
$r += $effes['sums'];
}
return $r;
}
function ClanImage($clan_id)
{
$clanimg = db::c()->query('SELECT `short` FROM `clans` WHERE `id` = ?i ', $clan_id)->fetch_assoc();
2018-01-28 16:40:49 +00:00
if ($clanimg['short']) {
return $clanimg['short'];
2018-01-28 16:40:49 +00:00
} else {
return "1x1";
2018-01-28 16:40:49 +00:00
}
}
function GiveExp($id, $exp)
{
mysql_query("UPDATE `users` SET `exp` = (`exp`+'" . $exp . "') WHERE `id` = '" . $id . "' LIMIT 1");
}
function GiveRep($id, $rep)
{
mysql_query("UPDATE `users` SET `doblest` = (`doblest`+$rep), `rep_laba` = (`rep_laba`+$rep) WHERE `id` = '" . $id . "' LIMIT 1");
}
// полоска НР
function setHP($hp, $maxhp)
2018-01-28 16:40:49 +00:00
{
$rr = '';
if ($hp < $maxhp * 0.33) {
$polosa = 'i/1red.gif';
} elseif ($hp < $maxhp * 0.66) {
$polosa = 'i/1yellow.gif';
} else {
$polosa = 'i/1green.gif';
}
$rr .= "<IMG SRC=i/herz.gif WIDTH=10 HEIGHT=10 ALT=\"Уровень жизни\"><IMG SRC='{$polosa}' WIDTH=";
$rr .= (122 * ($hp / $maxhp));
$rr .= ' HEIGHT=10 ALT="Уровень жизни" name=HP1 id=HP1><IMG SRC=i/1silver.gif WIDTH=';
$rr .= (122 - 122 * ($hp / $maxhp));
$rr .= ' HEIGHT=10 ALT="Уровень жизни" name=HP2 id=HP2>';
$rr .= '<span id=\'hp_value\'>' . $hp . '/' . $maxhp . '</span>';
return $rr;
}
2018-12-27 13:18:55 +00:00
/**
2018-12-27 23:13:46 +00:00
* @param $current
* @param $maximum
2018-12-27 13:18:55 +00:00
*/
2018-12-27 23:13:46 +00:00
function showProgressBar($current, $maximum, $line_color = 'limegreen', $bg_color = 'silver')
2018-12-27 12:59:45 +00:00
{
2018-12-27 23:13:46 +00:00
$bar = round($current / $maximum * 100);
2018-12-27 13:18:55 +00:00
$output = <<<HTML
2018-12-27 23:13:46 +00:00
<div style="width: 100%; height: 16px; background: $bg_color; overflow: hidden; border-radius: 3px;">
<div style="height: 16px; background: $line_color; border-radius: 3px; width: $bar%;"></div>
2018-12-27 12:59:45 +00:00
</div>
2018-12-27 13:18:55 +00:00
<div style="width: 100%; height: 16px; font-size: 14px; text-align: center; margin-top: -16px;">
2018-12-27 23:13:46 +00:00
$current / $maximum
2018-12-27 12:59:45 +00:00
</div>
2018-12-27 13:18:55 +00:00
HTML;
return $output;
2018-12-27 12:59:45 +00:00
}
2018-01-28 16:40:49 +00:00
function echoscroll($slot)
{
global $user;
2018-03-08 22:30:57 +00:00
2018-01-28 16:40:49 +00:00
if ($user['battle']) {
$script = 'fbattle';
} else {
$script = 'main';
}
2018-03-08 22:30:57 +00:00
$all_magic = 0;
if ($user['battle'] > 0) {
$bat = db::c()->query('SELECT `magic` FROM `battle` WHERE `id` = ?i', $user['battle'])->fetch_assoc();
$all_magic = unserialize($bat['magic']);
}
2018-03-08 22:14:29 +00:00
$dress = db::c()->query('SELECT `id`, `magic`, `name`, `img`, `duration`, `maxdur` FROM `inventory` WHERE `id` = ?i', $user[$slot])->fetch_assoc();
$need_charge = db::c()->query('SELECT `needcharge` FROM `magic` WHERE `id` = ?i', $dress['magic'])->fetch_assoc();
2018-03-08 22:30:57 +00:00
2018-01-28 16:40:49 +00:00
if (($user[$slot] > 0) && ($all_magic[$user['id']] < 1 || $need_charge['needcharge'] == 0)) {
$row['id'] = $user[$slot];
if ($dress['magic']) {
$magic = db::c()->query('SELECT * FROM `magic` WHERE `id` = ?i', $dress['magic'])->fetch_assoc();
2018-01-28 16:40:49 +00:00
echo "<a onclick=\"";
if ($magic['targeted'] == 1) {
echo "okno('Введите название предмета', '" . $script . ".php?use={$row['id']}', 'target'); ";
} else
if ($magic['targeted'] == 2) {
echo "findlogin('Введите имя персонажа', '" . $script . ".php?use={$row['id']}', 'target'); ";
} else {
echo "if(confirm('Использовать сейчас?')) { window.location='" . $script . ".php?use=" . $row['id'] . "';}";
}
echo "\"href='#'>";
}
echo '<img class=\'tooltip\' src="i/sh/' . $dress['img'] . '" width=\'40\' title="<b>' . $dress['name'] . '</b><br /> Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '" height=\'25\' /></a>';
} elseif (($user[$slot] > 0) && ($all_magic[$user['id']] >= 1) && $need_charge['needcharge'] > 0) {
echo "<img src=\"i/sh/magicclock.gif\" width=\"40\" height=\"25\" title='Произведите размен ударами и магия снова станет доступна' />";
} else {
echo "<img class=\"tooltip\" src=\"i/w13.gif\" width=\"40\" height=\"25\" title='<b>Пустой слот магия</b>' />";
}
}
// ссылка на магию
function showhrefmagic($dress)
{
$user = db::c()->query('SELECT `battle` FROM `users` WHERE `id` = ?i', $_SESSION['uid'])->fetch_assoc();
2018-12-27 16:13:40 +00:00
$magic = db::c()->query('SELECT * FROM `magic` WHERE `id` = ?i', $dress['includemagic'])->fetch_assoc();
2018-01-28 16:40:49 +00:00
$r = '';
2018-12-27 16:13:40 +00:00
$script = 'main';
if ($user['battle']) $script = 'fbattle';
2018-01-28 16:40:49 +00:00
$r .= "<a onclick=\"";
if ($magic['targeted'] == 1) {
$r .= "okno('Введите название предмета', '{$script}.php?use={$dress['id']}', 'target')";
} elseif ($magic['targeted'] == 2) {
$r .= "findlogin('" . $magic['name'] . "', '{$script}.php?use={$dress['id']}', 'target')";
} else {
$r .= "if (confirm('Использовать сейчас?')) window.location='" . $script . ".php?use=" . $dress['id'] . "';";
}
$r .= "\"href='#'>";
$r .= "<img src=\"i/sh/{$dress['img']}\" style=\"filter:shadow(color=red, direction=90, strength=3);\" title=\"" . $dress['name'] . (($dress['text'] != null) ? "<br />На оружии выгравировано '{$dress['text']}'" : "") . "\"><br>";
2018-01-28 16:40:49 +00:00
return $r;
}
function timeOut($ttm)
{
$out = '';
$time_still = $ttm;
$tmp = floor($time_still / 2592000);
$id = 0;
if ($tmp > 0) {
$id++;
if ($id < 3) {
$out .= $tmp . " мес. ";
}
$time_still = $time_still - $tmp * 2592000;
}
$tmp = floor($time_still / 86400);
if ($tmp > 0) {
$id++;
if ($id < 3) {
$out .= $tmp . " дн. ";
}
$time_still = $time_still - $tmp * 86400;
}
$tmp = floor($time_still / 3600);
if ($tmp > 0) {
$id++;
if ($id < 3) {
$out .= $tmp . " ч. ";
}
$time_still = $time_still - $tmp * 3600;
}
$tmp = floor($time_still / 60);
if ($tmp > 0) {
$id++;
if ($id < 3) {
$out .= $tmp . " мин. ";
}
}
if ($out == '') {
if ($time_still < 0) {
$time_still = 0;
}
$out = $time_still . ' сек.';
}
return $out;
}
2018-11-01 15:08:24 +00:00
function show_eff_inf($u, $type)
{
$img = [
1 => "travma.gif", 2 => "magic/sleep.gif", 3 => "magic/sleepf.gif", 4 => "magic/haos.gif",
5 => "magic/obezl.gif", 6 => "expx15.gif", 7 => "euphoria.png", 8 => "sleep_obj.gif",
10 => "magic/chains.gif", 11 => "travma.gif", 12 => "travma.gif", 13 => "travma.gif",
14 => "travma.gif", 20 => "check.gif", 21 => "magic/al_neut_power.gif", 22 => "magic/fist_def.gif",
201 => "magic/defence.gif", 202 => "magic/devastate.gif", 203 => "magic/spell_luck.gif", 215 => "magic/wis_air_def1.gif",
216 => "magic/wis_air_def2.gif", 217 => "magic/wis_air_def3.gif", 218 => "magic/wis_earth_def1.gif", 219 => "magic/wis_earth_def2.gif",
220 => "magic/wis_earth_def3.gif", 221 => "magic/wis_fire_def1.gif", 222 => "magic/wis_fire_def2.gif", 223 => "magic/wis_fire_def3.gif",
224 => "magic/wis_water_def1.gif", 225 => "magic/wis_water_def2.gif", 226 => "magic/wis_water_def3.gif", 227 => "magic/attack_defence.gif",
1022 => "sh/hidden.gif"
2018-11-01 15:08:24 +00:00
];
2018-01-28 16:40:49 +00:00
$r = '';
$and = '';
2018-12-10 20:16:42 +00:00
$adds = '';
2018-01-28 16:40:49 +00:00
if ($type == 1) {
$and = " AND `type` != 1022";
2018-01-28 16:40:49 +00:00
}
$effs = db::c()->query('SELECT * FROM `effects` WHERE `owner` = ?i' . $and, $u)->fetch_assoc();
2018-11-01 15:08:24 +00:00
$etype = $effs['type'];
2018-01-28 16:40:49 +00:00
if ($type == 1) {
while ($effs) {
2018-11-01 15:08:24 +00:00
if ($etype == 11 || $etype == 12 || $etype == 13 || $etype == 14) {
if ($etype == 11) {
2018-01-28 16:40:49 +00:00
$adds = 'Легкая ';
2018-11-01 15:08:24 +00:00
} elseif ($etype == 12) {
2018-01-28 16:40:49 +00:00
$adds = 'Средняя ';
2018-11-01 15:08:24 +00:00
} elseif ($etype == 13) {
2018-01-28 16:40:49 +00:00
$adds = 'Тяжелая ';
2018-11-01 15:08:24 +00:00
} elseif ($etype == 14) {
2018-01-28 16:40:49 +00:00
$adds = 'Неизлечимая ';
} else {
$adds = '';
}
} else {
$adds = '';
}
$r .= '<div>';
2018-11-01 15:08:24 +00:00
$r .= '<img class="image" src="/i/{$img[$etype]}">';
2018-01-28 16:40:49 +00:00
$r .= '<span class="title">' . $adds . $effs['name'] . '</span>';
if ($effs['sleep'] != 0) {
$r .= '<div class="timeleft">Эффект заморожен</div>';
} else {
$r .= '<div class="timeleft">' . timeOut($effs['time'] - time()) . '</div>';
}
$r .= '</div>';
}
} else {
while ($effs) {
2018-01-28 16:40:49 +00:00
$r .= '<div>';
2018-11-01 15:08:24 +00:00
$r .= '<img class="image" src="/i/' . $img[$etype] . '" /> <a href=\'main.php?edit=1&del=1&efid=' . $effs['id'] . '\' onclick=\'return confirm("Удалить ' . $adds . $effs['name'] . '?")\'><img src=\'i/clear.gif\' style=\'float: right;\' /></a>';
2018-01-28 16:40:49 +00:00
$r .= '<span class="title">' . $adds . $effs['name'] . '</span>';
if ($effs['sleep'] != 0) {
$r .= '<div class="timeleft">Эффект заморожен</div>';
} else {
$r .= '<div class="timeleft">' . timeOut($effs['time'] - time()) . '</div>';
}
$r .= '</div>';
}
}
return $r;
}
function timetoheals($user)
{
$efs = mysql_fetch_array(mysql_query('SELECT SUM(`speed`) AS `speed` FROM `effects` WHERE `owner` = "' . $user['id'] . '" LIMIT 1'));
$efs['speed'] += 0;
if ($efs['speed'] > 0) {
$fulltime = $efs['speed'] * 2000;
} else {
$fulltime = 2000;
}
return $fulltime;
}
2018-12-27 14:46:00 +00:00
/**
* Функция отображения персонажа для других персонажей везде и для себя в бою.
*
* @param $id
* @param int $battle - в бою ли персонаж
* @param int $me - на себя ли я смотрю
2018-12-27 14:46:00 +00:00
*
* @return string
*/
2018-12-27 19:17:16 +00:00
function showinf_pers($id, $battle = 0, $me = 0) //FIXME 37 запросов! ТРИДЦАТЬ СЕМЬ! Чтобы отобразить предметы на персонаже.
2018-01-28 16:40:49 +00:00
{
global $rooms;
$r = '';
2018-12-27 14:46:00 +00:00
$user = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i', $id)->fetch_assoc();
2018-12-27 22:24:35 +00:00
function item($image, $bg_color = '#AAA', $border_color = '#EEE')
2018-12-27 22:24:35 +00:00
{
return '<img src="' . $image . '" style="width: 48px; height: 48px; border-radius: 5px; border: 1px solid rgba(0, 0, 0, 0.25);
2018-12-27 22:49:50 +00:00
padding: 7px; display: inline-block; background-repeat: no-repeat;
2018-12-27 22:24:35 +00:00
background-color: ' . $bg_color . '; background-image: radial-gradient(circle, ' . $border_color . ', ' . $bg_color . ');">';
}
2018-12-27 14:46:00 +00:00
if ($id > _BOTSEPARATOR_) {
// Если ID большой, берём бота из базы ботов, подставляем имя и здоровье из прототипа в юзерах.
$bots = db::c()->query('SELECT `name`, `hp` FROM `bots` WHERE `id` = ?i', $id)->fetch_assoc();
$user = db::c()->query('SELECT * FROM `users` WHERE `id` = (SELECT `prototype` FROM `bots` WHERE `bots`.`id` = ?i)', $id)->fetch_assoc();
$user['login'] = $bots['name'];
$user['hp'] = $bots['hp'];
2018-01-28 16:40:49 +00:00
} else {
$invis = $user['invis'];
}
2018-12-27 16:13:40 +00:00
if ($invis and $user['id'] != $_SESSION['uid']) {
2018-12-27 14:57:52 +00:00
$r = <<<HTML
2018-12-27 15:04:05 +00:00
<div style="text-align: center;">
2018-12-27 15:14:21 +00:00
<b><i>невидимка</i></b><br><br><img src="i/shadow/0.gif">
2018-12-27 15:04:05 +00:00
</div>
2018-12-27 16:13:40 +00:00
<td style="width: 100%; vertical-align: top;">
2018-12-27 14:57:52 +00:00
HTML;
} else {
2018-12-27 19:30:53 +00:00
$r .= '<div style="text-align: center">';
if (!empty($user['align'])) $r .= "<img src='/i/align_{$user['align']}.gif' > ";
2018-12-27 19:37:22 +00:00
if ($user['block']) $r .= "<span class='private'><s>{$user['login']}</s></span>";
else $r .= "<b>$user[login]</b> ";
if (!empty($user['klan'])) $r .= "<img src='/i/klan/" . ClanImage($user['klan']) . ".gif' > ";
2018-12-27 20:11:36 +00:00
$r .= '</div>';
2018-01-28 16:40:49 +00:00
2018-12-27 23:13:46 +00:00
$r .= showProgressBar($user['hp'], $user['maxhp']);
2018-12-27 22:49:50 +00:00
$r .= "<table style='width: 100%; text-align: center;'>";
$r .= '<tr><td width=62 valign=top><table width=100%><tr><td>';
2018-01-28 16:40:49 +00:00
2018-12-27 14:57:52 +00:00
if ($user['sergi'] > 0) {
2018-12-27 16:13:40 +00:00
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['sergi'])->fetch_assoc();
if ($dress['includemagicdex'] && ($battle && $me)) {
2018-12-27 14:57:52 +00:00
$r .= showhrefmagic($dress);
} else {
2018-12-27 16:13:40 +00:00
$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=60 height=20 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
2018-12-27 14:57:52 +00:00
}
2018-01-28 16:40:49 +00:00
} else {
2018-12-27 20:17:54 +00:00
#$r .= '<img src="i/w1.gif" width="60" height="20" class="tooltip" title="Пустой слот Серьги" />';
2018-12-27 22:30:35 +00:00
$r .= item('i/1x1.gif');
2018-01-28 16:40:49 +00:00
}
2018-12-27 14:57:52 +00:00
$r .= '</td></tr><tr><td>';
2018-01-28 16:40:49 +00:00
2018-12-27 14:57:52 +00:00
if ($user['kulon'] > 0) {
2018-12-27 18:35:47 +00:00
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['kulon'])->fetch_assoc();
2018-12-27 16:13:40 +00:00
if ($dress['includemagicdex'] && ($battle && $me)) {
2018-12-27 14:57:52 +00:00
$r .= showhrefmagic($dress);
} else {
2018-12-27 16:13:40 +00:00
$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=60 height=20 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
2018-12-27 14:57:52 +00:00
}
2018-01-28 16:40:49 +00:00
} else {
2018-12-27 20:17:54 +00:00
#$r .= '<img src="i/w2.gif" width=60 height=20 class="tooltip" title="Пустой слот Ожерелье" />';
2018-12-27 22:30:35 +00:00
$r .= item('i/1x1.gif');
2018-01-28 16:40:49 +00:00
}
2018-12-27 14:57:52 +00:00
$r .= '</td></tr><tr><td>';
2018-01-28 16:40:49 +00:00
2018-12-27 14:57:52 +00:00
if ($user['weap'] > 0) {
2018-12-27 18:35:47 +00:00
$dress = db::c()->query('SELECT `minu`, `maxu`, `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['weap'])->fetch_assoc();
2018-12-27 16:13:40 +00:00
if ($dress['includemagicdex'] && ($battle && $me)) {
2018-12-27 14:57:52 +00:00
$r .= showhrefmagic($dress);
} else {
2018-12-27 16:13:40 +00:00
$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=60 height=60 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
2018-12-27 14:57:52 +00:00
}
2018-01-28 16:40:49 +00:00
} else {
2018-12-27 20:11:36 +00:00
#$r .= '<img class=\'tooltip\' src="i/w3.gif" width=60 height=60 title="Пустой слот Оружие" />';
2018-12-27 22:30:35 +00:00
$r .= item('i/1x1.gif');
2018-01-28 16:40:49 +00:00
}
2018-12-27 14:57:52 +00:00
$r .= '</td></tr><tr><td>';
2018-01-28 16:40:49 +00:00
2018-12-27 14:57:52 +00:00
if ($user['bron'] > 0 || $user['rybax'] > 0 || $user['plaw'] > 0) {
$title = '';
$d = '';
if ($user['plaw']) {
$d = $user['plaw'];
if ($user['bron']) {
2018-12-27 18:35:47 +00:00
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['bron'])->fetch_assoc();
$title .= '<br />--------------------<br /><b>' . $dress['name'] . '</b>' . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "");
2018-12-27 14:57:52 +00:00
}
if ($user['rybax']) {
2018-12-27 18:35:47 +00:00
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['rybax'])->fetch_assoc();
$title .= '<br />--------------------<br /><b>' . $dress['name'] . '</b>' . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "");
2018-12-27 14:57:52 +00:00
}
} elseif ($user['bron']) {
$d = $user['bron'];
if ($user['rybax']) {
2018-12-27 18:35:47 +00:00
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['rybax'])->fetch_assoc();
$title .= '<br />--------------------<br /><b>' . $dress['name'] . '</b>' . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "");
2018-12-27 14:57:52 +00:00
}
} elseif ($user['rybax']) {
$d = $user['rybax'];
2018-01-28 16:40:49 +00:00
}
2018-12-27 19:17:16 +00:00
2018-12-27 18:35:47 +00:00
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $d)->fetch_assoc();
2018-12-27 16:13:40 +00:00
if ($dress['includemagicdex'] && $battle && $me) {
2018-12-27 14:57:52 +00:00
$r .= showhrefmagic($dress);
} else {
2018-12-27 16:13:40 +00:00
$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=60 height=80 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
2018-01-28 16:40:49 +00:00
}
} else {
2018-12-27 20:17:54 +00:00
#$r .= '<img class=\'tooltip\' src="i/w4.gif" width=60 height=80 title="Пустой слот Броня" />';
2018-12-27 22:30:35 +00:00
$r .= item('i/1x1.gif');
2018-01-28 16:40:49 +00:00
}
2018-12-27 22:38:16 +00:00
$r .= '</td></tr>';
$r .= '</table></td>';
2018-01-28 16:40:49 +00:00
2018-12-27 23:40:31 +00:00
$r .= '<td valign=top><img src="i/shadow/' . $user['shadow'] . '" width="96" height="270" onerror=" this.src = \'i/shadow/0.gif\';"></td><td width="62" valign=top><table width=100%><tr><td>';
2018-01-28 16:40:49 +00:00
2018-12-27 14:57:52 +00:00
if ($user['helm'] > 0) {
2018-12-27 18:35:47 +00:00
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['helm'])->fetch_assoc();
2018-12-27 16:13:40 +00:00
if ($dress['includemagicdex'] && ($battle && $me)) {
2018-12-27 14:57:52 +00:00
$r .= showhrefmagic($dress);
} else {
2018-12-27 16:13:40 +00:00
$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=60 height=60 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
2018-12-27 14:57:52 +00:00
}
2018-01-28 16:40:49 +00:00
} else {
2018-12-27 20:17:54 +00:00
#$r .= '<img class=\'tooltip\' src="i/w9.gif" width=60 height=60 title="Пустой слот Шлем" />';
2018-12-27 22:30:35 +00:00
$r .= item('i/1x1.gif');
2018-01-28 16:40:49 +00:00
}
2018-12-27 14:57:52 +00:00
$r .= '</td></tr><tr><td>';
2018-01-28 16:40:49 +00:00
2018-12-27 14:57:52 +00:00
if ($user['perchi'] > 0) {
2018-12-27 18:35:47 +00:00
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['perchi'])->fetch_assoc();
2018-12-27 16:13:40 +00:00
if ($dress['includemagicdex'] && ($battle && $me)) {
2018-12-27 14:57:52 +00:00
$r .= showhrefmagic($dress);
} else {
2018-12-27 16:13:40 +00:00
$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=60 height=40 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
2018-12-27 14:57:52 +00:00
}
2018-01-28 16:40:49 +00:00
} else {
2018-12-27 20:17:54 +00:00
#$r .= '<img class=\'tooltip\' src="i/w11.gif" width=60 height=40 alt="Пустой слот Перчатки" />';
2018-12-27 22:30:35 +00:00
$r .= item('i/1x1.gif');
2018-01-28 16:40:49 +00:00
}
2018-12-27 14:57:52 +00:00
$r .= '</td></tr><tr><td>';
2018-01-28 16:40:49 +00:00
2018-12-27 14:57:52 +00:00
if ($user['shit'] > 0) {
2018-12-27 18:35:47 +00:00
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['shit'])->fetch_assoc();
2018-12-27 16:13:40 +00:00
if ($dress['includemagicdex'] && ($battle && $me)) {
2018-12-27 14:57:52 +00:00
$r .= showhrefmagic($dress);
} else {
2018-12-27 16:13:40 +00:00
$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=60 height=60 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
2018-12-27 14:57:52 +00:00
}
2018-01-28 16:40:49 +00:00
} else {
2018-12-27 20:17:54 +00:00
#$r .= '<img class=\'tooltip\' src="i/w10.gif" width=60 height=60 title="Пустой слот Щит" />';
2018-12-27 22:30:35 +00:00
$r .= item('i/1x1.gif');
2018-01-28 16:40:49 +00:00
}
2018-12-27 14:57:52 +00:00
$r .= '</td></tr><tr><td>';
2018-01-28 16:40:49 +00:00
2018-12-27 14:57:52 +00:00
if ($user['boots'] > 0) {
2018-12-27 18:35:47 +00:00
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['boots'])->fetch_assoc();
2018-12-27 16:13:40 +00:00
if ($dress['includemagicdex'] && ($battle && $me)) {
2018-12-27 14:57:52 +00:00
$r .= showhrefmagic($dress);
} else {
2018-12-27 16:13:40 +00:00
$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=60 height=40 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
2018-12-27 14:57:52 +00:00
}
2018-01-28 16:40:49 +00:00
} else {
2018-12-27 20:17:54 +00:00
#$r .= '<img class=\'tooltip\' src="i/w12.gif" width=60 height=40 title="Пустой слот Oбувь" />';
2018-12-27 22:24:35 +00:00
$r .= item('i/1x1.gif');
2018-01-28 16:40:49 +00:00
}
2018-12-27 16:13:40 +00:00
$data = db::c()->query('SELECT * FROM `online` WHERE `date` >= ?i AND `id` = ?i', time() - 60, $user['id'])->fetch_assoc();
2018-01-28 16:40:49 +00:00
2018-12-27 14:57:52 +00:00
$r .= '</td></tr></table></td></tr></table>';
2018-01-28 16:40:49 +00:00
2018-12-27 22:11:30 +00:00
$r .= '<div style="text-align: center">';
2018-12-27 23:16:35 +00:00
// TODO Не забыть включить отображение всплывашки с названием предмета!
2018-12-27 22:34:59 +00:00
if ($user['r1'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['r1'])->fetch_assoc();
if ($dress['includemagicdex'] && ($battle && $me)) {
$r .= showhrefmagic($dress);
} else {
2018-12-27 23:16:35 +00:00
#$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=20 height=20 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
$r .= item('i/sh/' . $dress['img']) . " ";
2018-12-27 22:34:59 +00:00
}
} else {
#$r .= '<img class=\'tooltip\' src="i/w6.gif" width=20 height=20 title="Пустой слот Кольцо" />';
$r .= item('i/1x1.gif') . " ";
2018-12-27 22:34:59 +00:00
}
if ($user['r2'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['r2'])->fetch_assoc();
if ($dress['includemagicdex'] && ($battle && $me)) {
$r .= showhrefmagic($dress);
} else {
2018-12-27 23:16:35 +00:00
#$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=20 height=20 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
$r .= item('i/sh/' . $dress['img']) . " ";
2018-12-27 22:34:59 +00:00
}
} else {
#$r .= '<img class=\'tooltip\' src="i/w6.gif" width=20 height=20 title="Пустой слот Кольцо" />';
$r .= item('i/1x1.gif') . " ";
2018-12-27 22:34:59 +00:00
}
if ($user['r3'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `text`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['r3'])->fetch_assoc();
if ($dress['includemagicdex'] && ($battle && $me)) {
$r .= showhrefmagic($dress);
} else {
2018-12-27 23:01:23 +00:00
#$r .= '<img class="tooltip" src="i/sh/' . $dress['img'] . '" width=20 height=20 title="<b>' . $dress['name'] . "</b>" . ((!empty($dress['text'])) ? "<br><i>{$dress['text']}</i>" : "") . '" />';
$r .= item('i/sh/' . $dress['img']) . " ";
2018-12-27 22:34:59 +00:00
}
} else {
#$r .= '<img class=\'tooltip\' src="i/w6.gif" width=20 height=20 title="Пустой слот Кольцо" />';
$r .= item('i/1x1.gif') . " ";
2018-12-27 22:34:59 +00:00
}
2018-12-27 22:11:30 +00:00
$r .= '</div>';
2018-12-27 14:57:52 +00:00
$r .= '<center><table cellPadding=0 cellSpacing=0 width="100%"><tbody>';
2018-01-28 16:40:49 +00:00
2018-12-27 14:57:52 +00:00
if (!$battle) {
2018-01-28 16:40:49 +00:00
2018-12-27 16:13:40 +00:00
$r .= '<tr><td align=middle colSpan=2><b><small>' . GAMEDOMAIN . '</small></b></td></tr><tr><td colSpan=2>';
if ($data['id'] != null && $user['id'] != 326) {
if ($data['room'] > 500 && $data['room'] < 561) {
$rrm = 'Башня смерти, участвует в турнире';
2018-01-28 16:40:49 +00:00
} else {
2018-12-27 16:13:40 +00:00
$rrm = $rooms[$data['room']];
2018-01-28 16:40:49 +00:00
}
2018-12-27 16:13:40 +00:00
$r .= '<center>Персонаж сейчас находится в игре.<b>"' . $rrm . '"</b></center>';
} else {
$r .= "<center>Персонаж не в игре.</center>";
}
2018-01-28 16:40:49 +00:00
2018-12-27 16:13:40 +00:00
if ($user['battle'] > 0 && $user['invis'] == 0) {
$r .= '<br />Персонаж сейчас в <a target="_blank" href="logs.php?log=' . $user['battle'] . '">поединке</a>';
2018-01-28 16:40:49 +00:00
}
2018-12-27 16:13:40 +00:00
$r .= '</center>';
$r .= '<div class="effectList" style="padding-top: 15px;">';
$r .= show_eff_inf($user['id'], 1);
$r .= '</div></td></tr>';
2018-12-27 14:57:52 +00:00
$r .= '</tbody></table></center></td>';
2018-12-27 16:13:40 +00:00
$r .= '<td valign=top>';
2018-12-27 14:57:52 +00:00
$r .= 'Сила: ' . $user['sila'] . '<br>';
$r .= 'Ловкость: ' . $user['lovk'] . '<br>';
$r .= 'Интуиция: ' . $user['inta'] . '<br>';
$r .= 'Выносливость: ' . $user['vinos'] . '<br>';
2018-12-27 16:13:40 +00:00
$r .= 'Интеллект: ' . $user['intel'] . '<br>';
$r .= 'Мудрость: ' . $user['mudra'] . '<br>';
2018-12-27 14:57:52 +00:00
$r .= '<hr style=\'width: 50%; float: left;\' /><br />';
2018-12-27 16:13:40 +00:00
2018-12-27 14:57:52 +00:00
$r .= 'Уровень: ' . $user['level'] . '<br>';
2018-12-27 16:13:40 +00:00
$r .= 'Побед: <span>' . $user['win'] . '</span><br>';
$r .= 'Поражений: <span>' . $user['lose'] . '</span><br>';
$r .= 'Ничьих: <span>' . $user['nich'] . '</span><br>';
2018-12-27 14:57:52 +00:00
2018-12-27 16:13:40 +00:00
if ($user['klan']) {
2018-12-27 14:57:52 +00:00
$clann = db::c()->query('SELECT `name`, `glava` FROM `clans` WHERE `id` = ?i', $user['klan'])->fetch_assoc();
2018-12-27 19:17:16 +00:00
$r .= $clann['name'];
2018-12-27 20:17:54 +00:00
if ($clann['glava'] == $user['id']) $r .= " - <span style='color:teal;'>Глава клана</span><br>";
2018-12-27 19:17:16 +00:00
elseif (!empty($user['status'])) $r .= " - " . $user['status'] . "<br>";
2018-12-27 14:57:52 +00:00
}
2018-12-27 16:13:40 +00:00
if ($user['borntime']) {
2018-12-27 14:57:52 +00:00
$date1 = explode(" ", $user['borntime']);
$date2 = explode("-", $date1[0]);
$date3 = "" . $date2[2] . "-" . $date2[1] . "-" . $date2[0] . "";
$r .= 'День рождения персонажа: ' . $date3 . '<br>';
}
2018-12-27 16:13:40 +00:00
if ($user['palcom']) $r .= "<br><span class=private>{$user['palcom']}</span>";
$r .= '<hr />';
2018-12-27 14:57:52 +00:00
} else {
$r .= '<tr><td colSpan=2 style="padding-left: 25px;">';
$r .= 'Сила: ' . $user['sila'] . '<br>';
$r .= 'Ловкость: ' . $user['lovk'] . '<br>';
$r .= 'Интуиция: ' . $user['inta'] . '<br>';
$r .= 'Выносливость: ' . $user['vinos'] . '<br>';
2018-12-27 16:13:40 +00:00
$r .= 'Интеллект: ' . $user['intel'] . '<br>';
$r .= 'Мудрость: ' . $user['mudra'] . '<br>';
2018-12-27 14:57:52 +00:00
$r .= '</td></tr></table>';
2018-01-28 16:40:49 +00:00
}
}
return $r;
}
2018-03-08 21:53:15 +00:00
/**
* Смотрим на себя в главном окне игры.
2018-12-27 14:46:00 +00:00
*
2018-03-08 21:53:15 +00:00
* @param int $pas
*/
2018-10-30 18:46:12 +00:00
function showpersout($pas = 0) //FIXME Сделать по человечески!
2018-01-28 16:40:49 +00:00
{
2018-03-08 21:53:15 +00:00
global $user;
2018-01-28 16:40:49 +00:00
echo '<CENTER>';
2018-03-08 21:53:15 +00:00
nick::id($user['id'])->full();
2018-01-28 16:40:49 +00:00
if ($user['block']) {
2018-03-08 21:53:15 +00:00
echo "<br><span class=private>Персонаж заблокирован!</span>";
2018-01-28 16:40:49 +00:00
}
?>
<TABLE cellspacing=0 cellpadding=0>
<tr>
<TD colspan=3 width=100%>
<?= setHP($user['hp'], $user['maxhp']) ?>
2018-01-28 16:40:49 +00:00
</td>
</tr>
<?
2018-03-08 21:53:15 +00:00
if (($user['level'] > 3) && !$pas) { ?>
2018-01-28 16:40:49 +00:00
<TR>
<TD colspan=3>
<?
echoscroll('m1');
echoscroll('m2');
echoscroll('m3');
echoscroll('m4');
echoscroll('m5');
?>
</TD>
</TR>
<TR>
<TD colspan=3>
<?
echoscroll('m6');
echoscroll('m7');
echoscroll('m8');
echoscroll('m9');
echoscroll('m10');
?>
</TD>
</TR>
<?
2018-01-28 16:40:49 +00:00
} ?>
<TR>
<TD width=62 valign=top>
<TABLE width=100% cellspacing=0 cellpadding=0>
<TR>
<TD><?php
if ($user['sergi'] > 0) {
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['sergi'])->fetch_assoc();
2018-03-08 21:53:15 +00:00
if ($dress['includemagicdex'] && !$pas) {
2018-01-28 16:40:49 +00:00
echo showhrefmagic($dress);
} else {
echo '<img class=\'tooltip\' ' . ((($dress['maxdur'] - 2) <= $dress['duration'] && $dress['duration'] > 2 && !$pas) ? " style='background-image:url(i/blink.gif);' " : "") . ' src="i/sh/' . $dress['img'] . '" width=60 height=20 title="<b>' . $dress['name'] . "</b><br />Прочность " . $dress['duration'] . "/" . $dress['maxdur'] . "" . "" . (($dress['ghp'] > 0) ? "<br />Уровень жизни " . plusorminus($dress['ghp']) : "") . (($dress['text'] != null) ? "<br />На серьгах выгравировано '{$dress['text']}'" : "") . (($dress['gsila'] != 0) ? "<br />Сила " . plusorminus($dress['gsila']) : "") . (($dress['glovk'] != 0) ? "<br />Ловкость " . plusorminus($dress['glovk']) : "") . (($dress['ginta'] != 0) ? "<br />Интуиция " . plusorminus($dress['ginta']) : "") . (($dress['gintel'] != 0) ? "<br />Интеллект " . plusorminus($dress['gintel']) : "") . (($dress['bron1'] != 0) ? "<br />Броня головы: " . plusorminus($dress['bron1']) : "") . (($dress['bron2'] != 0) ? "<br />Броня корпуса: " . plusorminus($dress['bron2']) : "") . (($dress['bron3'] != 0) ? "<br />Броня пояса: " . plusorminus($dress['bron3']) : "") . (($dress['bron4'] != 0) ? "<br />Броня ног: " . plusorminus($dress['bron4']) : "") . '" />';
}
} else {
2018-10-30 18:46:12 +00:00
echo '<img src="i/w1.gif" width=60 height=20 class="tooltip" title="Пустой слот Серьги" />';
2018-01-28 16:40:49 +00:00
}
?></TD>
</TR>
<TR>
<TD><?php
if ($user['kulon'] > 0) {
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['kulon'])->fetch_assoc();
2018-03-08 21:53:15 +00:00
if ($dress['includemagicdex'] && !$pas) {
2018-01-28 16:40:49 +00:00
echo showhrefmagic($dress);
} else {
echo '<img class=\'tooltip\' ' . ((($dress['maxdur'] - 2) <= $dress['duration'] && $dress['duration'] > 2 && !$pas) ? " style='background-image:url(i/blink.gif);' " : "") . ' src="i/sh/' . $dress['img'] . '" width=60 height=20 title="<b>' . $dress['name'] . "</b><br />Прочность " . $dress['duration'] . "/" . $dress['maxdur'] . "" . "" . (($dress['ghp'] > 0) ? "<br />Уровень жизни " . plusorminus($dress['ghp']) : "") . (($dress['text'] != null) ? "<br />На ожерелье выгравировано '{$dress['text']}'" : "") . (($dress['gsila'] != 0) ? "<br />Сила " . plusorminus($dress['gsila']) : "") . (($dress['glovk'] != 0) ? "<br />Ловкость " . plusorminus($dress['glovk']) : "") . (($dress['ginta'] != 0) ? "<br />Интуиция " . plusorminus($dress['ginta']) : "") . (($dress['gintel'] != 0) ? "<br />Интеллект " . plusorminus($dress['gintel']) : "") . (($dress['bron1'] != 0) ? "<br />Броня головы: " . plusorminus($dress['bron1']) : "") . (($dress['bron2'] != 0) ? "<br />Броня корпуса: " . plusorminus($dress['bron2']) : "") . (($dress['bron3'] != 0) ? "<br />Броня пояса: " . plusorminus($dress['bron3']) : "") . (($dress['bron4'] != 0) ? "<br />Броня ног: " . plusorminus($dress['bron4']) : "") . '" />';
}
} else {
echo '<img src="i/w2.gif" width=60 height=20 class="tooltip" title="Пустой слот Ожерелье" />';
}
?></TD>
</TR>
<TR>
<TD><?php
if ($user['weap'] > 0) {
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['weap'])->fetch_assoc();
2018-03-08 21:53:15 +00:00
if ($dress['includemagicdex'] && !$pas) {
2018-01-28 16:40:49 +00:00
echo showhrefmagic($dress);
} else {
echo '<img class=\'tooltip\' ' . ((($dress['maxdur'] - 2) <= $dress['duration'] && $dress['duration'] > 2 && !$pas) ? " style='background-image:url(i/blink.gif);' " : "") . ' src="i/sh/' . $dress['img'] . '" width=60 height=60 title="<b>' . $dress['name'] . "</b><br />Прочность " . $dress['duration'] . "/" . $dress['maxdur'] . "" . "" . (($dress['ghp'] > 0) ? "<br />Уровень жизни " . plusorminus($dress['ghp']) : "") . (($dress['minu'] > 0) ? "<br />Урон {$dress['minu']}-{$dress['maxu']}" : "") . (($dress['text'] != null) ? "<br />На оружии выгравировано '{$dress['text']}'" : "") . (($dress['gsila'] != 0) ? "<br />Сила " . plusorminus($dress['gsila']) : "") . (($dress['glovk'] != 0) ? "<br />Ловкость " . plusorminus($dress['glovk']) : "") . (($dress['ginta'] != 0) ? "<br />Интуиция " . plusorminus($dress['ginta']) : "") . (($dress['gintel'] != 0) ? "<br />Интеллект " . plusorminus($dress['gintel']) : "") . (($dress['bron1'] != 0) ? "<br />Броня головы: " . plusorminus($dress['bron1']) : "") . (($dress['bron2'] != 0) ? "<br />Броня корпуса: " . plusorminus($dress['bron2']) : "") . (($dress['bron3'] != 0) ? "<br />Броня пояса: " . plusorminus($dress['bron3']) : "") . (($dress['bron4'] != 0) ? "<br />Броня ног: " . plusorminus($dress['bron4']) : "") . '" />';
}
} else {
echo '<img class=\'tooltip\' src="i/w3.gif" width=60 height=60 title="Пустой слот Оружие" />';
}
?></A></TD>
</TR>
<TR>
<TD><?php
if ($user['bron'] > 0 || $user['rybax'] > 0 || $user['plaw'] > 0) {
$title = '';
2018-12-10 20:16:42 +00:00
$d = '';
2018-01-28 16:40:49 +00:00
if ($user['plaw']) {
$d = $user['plaw'];
if ($user['bron']) {
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['bron'])->fetch_assoc();
2018-01-28 16:40:49 +00:00
$title .= '<br />--------------------<br /><b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '' . (($dress['ghp'] > 0) ? '<br />Уровень жизни ' . plusorminus($dress['ghp']) : '') . (($dress['text'] != null) ? '<br />На одежде вышито ' . $dress['text'] . '' : '') . (($dress['gsila'] != 0) ? '<br />Сила ' . plusorminus($dress['gsila']) . '' : '') . (($dress['glovk'] != 0) ? '<br />Ловкость ' . plusorminus($dress['glovk']) . '' : '') . (($dress['ginta'] != 0) ? '<br />Интуиция ' . plusorminus($dress['ginta']) . '' : '') . (($dress['gintel'] != 0) ? '<br />Интеллект ' . plusorminus($dress['gintel']) . '' : '') . (($dress['bron1'] != 0) ? '<br />Броня головы: ' . plusorminus($dress['bron1']) . '' : '') . (($dress['bron2'] != 0) ? '<br />Броня корпуса: ' . plusorminus($dress['bron2']) . '' : '') . (($dress['bron3'] != 0) ? '<br />Броня пояса: ' . plusorminus($dress['bron3']) . '' : '') . (($dress['bron4'] != 0) ? '<br />Броня ног: ' . plusorminus($dress['bron4']) . '' : '');
}
if ($user['rybax']) {
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['rybax'])->fetch_assoc();
2018-01-28 16:40:49 +00:00
$title .= '<br />--------------------<br /><b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '' . (($dress['ghp'] > 0) ? '<br />Уровень жизни ' . plusorminus($dress['ghp']) : '') . (($dress['text'] != null) ? '<br />На одежде вышито ' . $dress['text'] . '' : '') . (($dress['gsila'] != 0) ? '<br />Сила ' . plusorminus($dress['gsila']) . '' : '') . (($dress['glovk'] != 0) ? '<br />Ловкость ' . plusorminus($dress['glovk']) . '' : '') . (($dress['ginta'] != 0) ? '<br />Интуиция ' . plusorminus($dress['ginta']) . '' : '') . (($dress['gintel'] != 0) ? '<br />Интеллект ' . plusorminus($dress['gintel']) . '' : '') . (($dress['bron1'] != 0) ? '<br />Броня головы: ' . plusorminus($dress['bron1']) . '' : '') . (($dress['bron2'] != 0) ? '<br />Броня корпуса: ' . plusorminus($dress['bron2']) . '' : '') . (($dress['bron3'] != 0) ? '<br />Броня пояса: ' . plusorminus($dress['bron3']) . '' : '') . (($dress['bron4'] != 0) ? '<br />Броня ног: ' . plusorminus($dress['bron4']) . '' : '');
}
} elseif ($user['bron']) {
$d = $user['bron'];
if ($user['rybax']) {
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['rybax'])->fetch_assoc();
2018-01-28 16:40:49 +00:00
$title .= "<br />--------------------<br /><b>$dress[name]</b><br />Прочность $dress[duration]/$dress[maxdur]" . (($dress['ghp'] > 0) ? "<br />Уровень жизни " . plusorminus($dress['ghp']) : "") . (($dress['text'] != null) ? "<br />На одежде вышито '{$dress['text']}'" : "") . (($dress['gsila'] != 0) ? "<br />Сила " . plusorminus($dress['gsila']) : "") . (($dress['glovk'] != 0) ? "<br />Ловкость " . plusorminus($dress['glovk']) : "") . (($dress['ginta'] != 0) ? "<br />Интуиция " . plusorminus($dress['ginta']) : "") . (($dress['gintel'] != 0) ? "<br />Интеллект " . plusorminus($dress['gintel']) : "") . (($dress['bron1'] != 0) ? "<br />Броня головы: " . plusorminus($dress['bron1']) : "") . (($dress['bron2'] != 0) ? "<br />Броня корпуса: " . plusorminus($dress['bron2']) : "") . (($dress['bron3'] != 0) ? "<br />Броня пояса: " . plusorminus($dress['bron3']) : "") . (($dress['bron4'] != 0) ? "<br />Броня ног: " . plusorminus($dress['bron4']) : "") . '"';
}
} elseif ($user['rybax']) {
$d = $user['rybax'];
}
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $d)->fetch_assoc();
2018-03-08 21:53:15 +00:00
if ($dress['includemagicdex'] && !$pas) {
2018-01-28 16:40:49 +00:00
echo showhrefmagic($dress);
} else {
echo '<img class=\'tooltip\' ' . ((($dress['maxdur'] - 2) <= $dress['duration'] && $dress['duration'] > 2 && !$pas) ? " style='background-image:url(i/blink.gif);' " : "") . ' src="i/sh/' . $dress['img'] . '" width=60 height=80 title="<b>' . $dress['name'] . "</b><br />Прочность " . $dress['duration'] . "/" . $dress['maxdur'] . "" . "" . (($dress['ghp'] > 0) ? "<br />Уровень жизни " . plusorminus($dress['ghp']) : "") . (($dress['text'] != null) ? "<br />На одежде вышито '{$dress['text']}'" : "") . (($dress['gsila'] != 0) ? "<br />Сила " . plusorminus($dress['gsila']) : "") . (($dress['glovk'] != 0) ? "<br />Ловкость " . plusorminus($dress['glovk']) : "") . (($dress['ginta'] != 0) ? "<br />Интуиция " . plusorminus($dress['ginta']) : "") . (($dress['gintel'] != 0) ? "<br />Интеллект " . plusorminus($dress['gintel']) : "") . (($dress['bron1'] != 0) ? "<br />Броня головы: " . plusorminus($dress['bron1']) : "") . (($dress['bron2'] != 0) ? "<br />Броня корпуса: " . plusorminus($dress['bron2']) : "") . (($dress['bron3'] != 0) ? "<br />Броня пояса: " . plusorminus($dress['bron3']) : "") . (($dress['bron4'] != 0) ? "<br />Броня ног: " . plusorminus($dress['bron4']) : "") . $title . '" />';
}
} else {
echo '<img class=\'tooltip\' src="i/w4.gif" width=60 height=80 title="Пустой слот Броня" />';
}
?></a></TD>
</TR>
<TR>
<TD>
<TABLE cellspacing=0 cellpadding=0>
<tr>
<td><?php
if ($user['r1'] > 0) {
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['r1'])->fetch_assoc();
2018-03-08 21:53:15 +00:00
if ($dress['includemagicdex'] && !$pas) {
2018-01-28 16:40:49 +00:00
showhrefmagic($dress);
} else {
echo '<img class=\'tooltip\' ' . ((($dress['maxdur'] - 2) <= $dress['duration'] && $dress['duration'] > 2 && !$pas) ? " style='background-image:url(i/blink.gif);' " : "") . ' src="i/sh/' . $dress['img'] . '" width=20 height=20 title="<b>' . $dress['name'] . "</b><br />Прочность " . $dress['duration'] . "/" . $dress['maxdur'] . "" . "" . (($dress['ghp'] > 0) ? "<br />Уровень жизни " . plusorminus($dress['ghp']) : "") . (($dress['text'] != null) ? "<br />На кольце выгравировано '{$dress['text']}'" : "") . (($dress['gsila'] != 0) ? "<br />Сила " . plusorminus($dress['gsila']) : "") . (($dress['glovk'] != 0) ? "<br />Ловкость " . plusorminus($dress['glovk']) : "") . (($dress['ginta'] != 0) ? "<br />Интуиция " . plusorminus($dress['ginta']) : "") . (($dress['gintel'] != 0) ? "<br />Интеллект " . plusorminus($dress['gintel']) : "") . (($dress['bron1'] != 0) ? "<br />Броня головы: " . plusorminus($dress['bron1']) : "") . (($dress['bron2'] != 0) ? "<br />Броня корпуса: " . plusorminus($dress['bron2']) : "") . (($dress['bron3'] != 0) ? "<br />Броня пояса: " . plusorminus($dress['bron3']) : "") . (($dress['bron4'] != 0) ? "<br />Броня ног: " . plusorminus($dress['bron4']) : "") . '" />';
}
} else {
echo '<img class=\'tooltip\' src="i/w6.gif" width=20 height=20 title="Пустой слот Кольцо" />';
}
?></A></td>
<td><?php
if ($user['r2'] > 0) {
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['r2'])->fetch_assoc();
2018-03-08 21:53:15 +00:00
if ($dress['includemagicdex'] && !$pas) {
2018-01-28 16:40:49 +00:00
echo showhrefmagic($dress);
} else {
echo '<img class=\'tooltip\' ' . ((($dress['maxdur'] - 2) <= $dress['duration'] && $dress['duration'] > 2 && !$pas) ? " style='background-image:url(i/blink.gif);' " : "") . ' src="i/sh/' . $dress['img'] . '" width=20 height=20 title="<b>' . $dress['name'] . "</b><br />Прочность " . $dress['duration'] . "/" . $dress['maxdur'] . "" . "" . (($dress['ghp'] > 0) ? "<br />Уровень жизни " . plusorminus($dress['ghp']) : "") . (($dress['text'] != null) ? "<br />На кольце выгравировано '{$dress['text']}'" : "") . (($dress['gsila'] != 0) ? "<br />Сила " . plusorminus($dress['gsila']) : "") . (($dress['glovk'] != 0) ? "<br />Ловкость " . plusorminus($dress['glovk']) : "") . (($dress['ginta'] != 0) ? "<br />Интуиция " . plusorminus($dress['ginta']) : "") . (($dress['gintel'] != 0) ? "<br />Интеллект " . plusorminus($dress['gintel']) : "") . (($dress['bron1'] != 0) ? "<br />Броня головы: " . plusorminus($dress['bron1']) : "") . (($dress['bron2'] != 0) ? "<br />Броня корпуса: " . plusorminus($dress['bron2']) : "") . (($dress['bron3'] != 0) ? "<br />Броня пояса: " . plusorminus($dress['bron3']) : "") . (($dress['bron4'] != 0) ? "<br />Броня ног: " . plusorminus($dress['bron4']) : "") . '" />';
}
} else {
echo '<img class=\'tooltip\' src="i/w6.gif" width=20 height=20 title="Пустой слот Кольцо" />';
}
?></A></td>
<td><?php
if ($user['r3'] > 0) {
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['r3'])->fetch_assoc();
2018-03-08 21:53:15 +00:00
if ($dress['includemagicdex'] && !$pas) {
2018-01-28 16:40:49 +00:00
echo showhrefmagic($dress);
} else {
echo '<img class=\'tooltip\' ' . ((($dress['maxdur'] - 2) <= $dress['duration'] && $dress['duration'] > 2 && !$pas) ? " style='background-image:url(i/blink.gif);' " : "") . ' src="i/sh/' . $dress['img'] . '" width=20 height=20 title="<b>' . $dress['name'] . "</b><br />Прочность " . $dress['duration'] . "/" . $dress['maxdur'] . "" . "" . (($dress['ghp'] > 0) ? "<br />Уровень жизни " . plusorminus($dress['ghp']) : "") . (($dress['text'] != null) ? "<br />На кольце выгравировано '{$dress['text']}'" : "") . (($dress['gsila'] != 0) ? "<br />Сила " . plusorminus($dress['gsila']) : "") . (($dress['glovk'] != 0) ? "<br />Ловкость " . plusorminus($dress['glovk']) : "") . (($dress['ginta'] != 0) ? "<br />Интуиция " . plusorminus($dress['ginta']) : "") . (($dress['gintel'] != 0) ? "<br />Интеллект " . plusorminus($dress['gintel']) : "") . (($dress['bron1'] != 0) ? "<br />Броня головы: " . plusorminus($dress['bron1']) : "") . (($dress['bron2'] != 0) ? "<br />Броня корпуса: " . plusorminus($dress['bron2']) : "") . (($dress['bron3'] != 0) ? "<br />Броня пояса: " . plusorminus($dress['bron3']) : "") . (($dress['bron4'] != 0) ? "<br />Броня ног: " . plusorminus($dress['bron4']) : "") . '" />';
}
} else {
echo '<img class=\'tooltip\' src="i/w6.gif" width=20 height=20 title="Пустой слот Кольцо" />';
}
?></A></td>
</tr>
</table>
</TD>
</TR>
</TABLE>
</TD>
<TD valign=top><img src="i/shadow/<?= $user['shadow'] ?>" width=76 height=209 alt="<?= $user['login'] ?>">
</TD>
<TD width=62 valign=top>
<TABLE width=100% cellspacing=0 cellpadding=0>
<TR>
<TD><?php
if ($user['helm'] > 0) {
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['helm'])->fetch_assoc();
2018-03-08 21:53:15 +00:00
if ($dress['includemagicdex'] && !$pas) {
2018-01-28 16:40:49 +00:00
echo showhrefmagic($dress);
} else {
echo '<img class=\'tooltip\' ' . ((($dress['maxdur'] - 2) <= $dress['duration'] && $dress['duration'] > 2 && !$pas) ? " style='background-image:url(i/blink.gif);' " : "") . ' src="i/sh/' . $dress['img'] . '" width=60 height=60 title="<b>' . $dress['name'] . "</b><br />Прочность " . $dress['duration'] . "/" . $dress['maxdur'] . "" . "" . (($dress['ghp'] > 0) ? "<br />Уровень жизни " . plusorminus($dress['ghp']) : "") . (($dress['text'] != null) ? "<br />На шлеме выгравировано '{$dress['text']}'" : "") . (($dress['gsila'] != 0) ? "<br />Сила " . plusorminus($dress['gsila']) : "") . (($dress['glovk'] != 0) ? "<br />Ловкость " . plusorminus($dress['glovk']) : "") . (($dress['ginta'] != 0) ? "<br />Интуиция " . plusorminus($dress['ginta']) : "") . (($dress['gintel'] != 0) ? "<br />Интеллект " . plusorminus($dress['gintel']) : "") . (($dress['bron1'] != 0) ? "<br />Броня головы: " . plusorminus($dress['bron1']) : "") . (($dress['bron2'] != 0) ? "<br />Броня корпуса: " . plusorminus($dress['bron2']) : "") . (($dress['bron3'] != 0) ? "<br />Броня пояса: " . plusorminus($dress['bron3']) : "") . (($dress['bron4'] != 0) ? "<br />Броня ног: " . plusorminus($dress['bron4']) : "") . '" />';
}
} else {
echo '<img class=\'tooltip\' src="i/w9.gif" width=60 height=60 title="Пустой слот Шлем" />';
}
?></A></TD>
</TR>
<TR>
<TD><?php
if ($user['perchi'] > 0) {
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['perchi'])->fetch_assoc();
2018-03-08 21:53:15 +00:00
if ($dress['includemagicdex'] && !$pas) {
2018-01-28 16:40:49 +00:00
echo showhrefmagic($dress);
} else {
echo '<img class=\'tooltip\' ' . ((($dress['maxdur'] - 2) <= $dress['duration'] && $dress['duration'] > 2 && !$pas) ? " style='background-image:url(i/blink.gif);' " : "") . ' src="i/sh/' . $dress['img'] . '" width=60 height=40 title="<b>' . $dress['name'] . "</b><br />Прочность " . $dress['duration'] . "/" . $dress['maxdur'] . "" . "" . (($dress['ghp'] > 0) ? "<br />Уровень жизни " . plusorminus($dress['ghp']) : "") . (($dress['text'] != null) ? "<br />На перчатках выгравировано '{$dress['text']}'" : "") . (($dress['gsila'] != 0) ? "<br />Сила " . plusorminus($dress['gsila']) : "") . (($dress['glovk'] != 0) ? "<br />Ловкость " . plusorminus($dress['glovk']) : "") . (($dress['ginta'] != 0) ? "<br />Интуиция " . plusorminus($dress['ginta']) : "") . (($dress['gintel'] != 0) ? "<br />Интеллект " . plusorminus($dress['gintel']) : "") . '" />';
}
} else {
echo '<img class=\'tooltip\' src="i/w11.gif" width=60 height=40 alt="Пустой слот Перчатки" />';
}
?></A></TD>
</TR>
<TR>
<TD><?php
if ($user['shit'] > 0) {
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['shit'])->fetch_assoc();
2018-03-08 21:53:15 +00:00
if ($dress['includemagicdex'] && !$pas) {
2018-01-28 16:40:49 +00:00
echo showhrefmagic($dress);
} else {
echo '<img class=\'tooltip\' ' . ((($dress['maxdur'] - 2) <= $dress['duration'] && $dress['duration'] > 2 && !$pas) ? " style='background-image:url(i/blink.gif);' " : "") . ' src="i/sh/' . $dress['img'] . '" width=60 height=60 title="<b>' . $dress['name'] . "</b><br />Прочность " . $dress['duration'] . "/" . $dress['maxdur'] . "" . "" . (($dress['ghp'] > 0) ? "<br />Уровень жизни " . plusorminus($dress['ghp']) : "") . (($dress['text'] != null) ? "<br />На щите выгравировано '{$dress['text']}'" : "") . (($dress['gsila'] != 0) ? "<br />Сила " . plusorminus($dress['gsila']) : "") . (($dress['glovk'] != 0) ? "<br />Ловкость " . plusorminus($dress['glovk']) : "") . (($dress['ginta'] != 0) ? "<br />Интуиция " . plusorminus($dress['ginta']) : "") . (($dress['gintel'] != 0) ? "<br />Интеллект " . plusorminus($dress['gintel']) : "") . (($dress['bron1'] != 0) ? "<br />Броня головы: " . plusorminus($dress['bron1']) : "") . (($dress['bron2'] != 0) ? "<br />Броня корпуса: " . plusorminus($dress['bron2']) : "") . (($dress['bron3'] != 0) ? "<br />Броня пояса: " . plusorminus($dress['bron3']) : "") . (($dress['bron4'] != 0) ? "<br />Броня ног: " . plusorminus($dress['bron4']) : "") . '" />';
}
} else {
echo '<img class=\'tooltip\' src="i/w10.gif" width=60 height=60 title="Пустой слот Щит" />';
}
?></A></TD>
</TR>
<TR>
<TD><?php
if ($user['boots'] > 0) {
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i', $user['boots'])->fetch_assoc();
2018-03-08 21:53:15 +00:00
if ($dress['includemagicdex'] && !$pas) {
2018-01-28 16:40:49 +00:00
echo showhrefmagic($dress);
} else {
echo '<img class=\'tooltip\' ' . ((($dress['maxdur'] - 2) <= $dress['duration'] && $dress['duration'] > 2 && !$pas) ? " style='background-image:url(i/blink.gif);' " : "") . ' src="i/sh/' . $dress['img'] . '" width=60 height=40 title="<b>' . $dress['name'] . "</b><br />Прочность " . $dress['duration'] . "/" . $dress['maxdur'] . "" . "" . (($dress['ghp'] > 0) ? "<br />Уровень жизни " . plusorminus($dress['ghp']) : "") . (($dress['text'] != null) ? "<br />На ботинках выгравировано '{$dress['text']}'" : "") . (($dress['gsila'] != 0) ? "<br />Сила " . plusorminus($dress['gsila']) : "") . (($dress['glovk'] != 0) ? "<br />Ловкость " . plusorminus($dress['glovk']) : "") . (($dress['ginta'] != 0) ? "<br />Интуиция " . plusorminus($dress['ginta']) : "") . (($dress['gintel'] != 0) ? "<br />Интеллект " . plusorminus($dress['gintel']) : "") . (($dress['bron1'] != 0) ? "<br />Броня головы: " . plusorminus($dress['bron1']) : "") . (($dress['bron2'] != 0) ? "<br />Броня корпуса: " . plusorminus($dress['bron2']) : "") . (($dress['bron3'] != 0) ? "<br />Броня пояса: " . plusorminus($dress['bron3']) : "") . (($dress['bron4'] != 0) ? "<br />Броня ног: " . plusorminus($dress['bron4']) : "") . '" />';
}
} else {
echo '<img class=\'tooltip\' src="i/w12.gif" width=60 height=40 title="Пустой слот Oбувь" />';
}
2018-03-08 21:53:15 +00:00
?>
</A>
</TD>
2018-01-28 16:40:49 +00:00
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
<TABLE cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<?
2018-03-08 21:53:15 +00:00
if (!$pas) {
2018-03-08 22:14:29 +00:00
// FIXME Научиться отображать травмы
// if ($trt) {
// echo "<TR><TD><IMG height=25 src=\"i/travma.gif\" width=40></TD><TD><SMALL>У персонажа $trt травма.</SMALL></TD></TR>";
// }
$dd = db::c()->query('SELECT `time`, `type` FROM `effects` WHERE `owner` = ?i', $user['id']);
2018-03-23 21:47:46 +00:00
$param_bonus = [];
2018-03-08 22:30:57 +00:00
array_fill_keys($param_bonus, 0);
2018-03-08 22:14:29 +00:00
while ($row = $dd->fetch_assoc()) {
2018-01-28 16:40:49 +00:00
if ($row['time'] < time()) {
$row['time'] = time();
}
if ($row['type'] == 21) {
2018-03-08 22:30:57 +00:00
$param_bonus = [];
2018-01-28 16:40:49 +00:00
$param_bonus['sila'] = $row['sila'];
$param_bonus['lovk'] = $row['lovk'];
$param_bonus['inta'] = $row['inta'];
$param_bonus['vinos'] = $row['vinos'];
}
}
?>
</TBODY></TABLE></CENTER>
</TD>
2018-03-08 21:53:15 +00:00
<TD valign=top style='width:450px;'></TD>
Сила: <?= $user['sila'] ?>
<?php if (isset($param_bonus['sila'])) echo " <b><font color=green>(+" . $param_bonus['sila'] . ")</font></b>"; ?>
<BR>
Ловкость: <?= $user['lovk'] ?>
<?php if (isset($param_bonus['lovk'])) echo " <b><font color=green>(+" . $param_bonus['lovk'] . ")</font></b>"; ?>
<BR>
Интуиция: <?= $user['inta'] ?>
<?php if (isset($param_bonus['inta'])) echo " <b><font color=green>(+" . $param_bonus['inta'] . ")</font></b>"; ?>
<BR>
Выносливость:<?= $user['vinos'] ?>
<?php if (isset($param_bonus['vinos'])) echo " <b><font color=green>(+" . $param_bonus['vinos'] . ")</font></b>"; ?>
<BR>
Интеллект: <?= $user['intel'] ?><BR>
Мудрость: <?= $user['mudra'] ?><BR>
2018-03-08 21:04:15 +00:00
2018-03-08 21:53:15 +00:00
<?php if ($user['stats'] > 0 || $user['master'] > 0): ?>
2018-01-28 16:40:49 +00:00
<a href="main.php?edit=1">+ Способности</a>
2018-03-08 21:53:15 +00:00
<?php endif; ?>
2018-01-28 16:40:49 +00:00
2018-03-08 21:53:15 +00:00
<hr>
Опыт: <b><?= $user['exp'] ?></b> (<?= $user['nextup'] ?>) <br>
Уровень: <?= $user['level'] ?><br>
Побед: <?= $user['win'] ?><br>
Поражений: <?= $user['lose'] ?><br>
Ничьих: <?= $user['nich'] ?><br>
2018-01-28 16:40:49 +00:00
2018-03-08 21:04:15 +00:00
<?
2018-03-09 18:43:30 +00:00
$ekr_bank = db::c()->query('SELECT SUM(`ekr`) AS `bank_ekr`,SUM(`cr`) AS `bank_cr` FROM `bank` WHERE `id`= ?i', $user['id'])->fetch_assoc();
2018-03-08 21:53:15 +00:00
?>
2018-01-28 16:40:49 +00:00
Деньги: <b><?= $user['money'] ?></b> кр.<br>
В банке: <b><?= $ekr_bank['bank_cr'] ?></b> кр. / <b><?= $ekr_bank['bank_ekr'] ?></b> eкр.<br>
2018-01-28 16:40:49 +00:00
2018-03-08 21:53:15 +00:00
<?
if ($user['klan']) {
echo "Клан: " . ClanImage($user['klan']) . "<BR>";
2018-03-30 19:28:22 +00:00
2018-01-28 16:40:49 +00:00
}
} else {
?>
<TR>
<TD colSpan=2 style="padding-left:25px;">
Сила: <?= $user['sila'] ?><BR>
Ловкость: <?= $user['lovk'] ?><BR>
Интуиция: <?= $user['inta'] ?><BR>
Выносливость: <?= $user['vinos'] ?><BR>
Интеллект: <?= $user['intel'] ?><BR>
Мудрость: <?= $user['mudra'] ?><BR>
2018-01-28 16:40:49 +00:00
</td>
</tr></table>
<?
}
}
2018-03-01 10:57:27 +00:00
/**
* @param $time
* @param $vars
* @param $vls
* @param $uid
2018-12-27 14:46:00 +00:00
*
2018-03-01 10:57:27 +00:00
* @return bool
*/
2018-01-28 16:40:49 +00:00
function addActions($time, $vars, $vls, $uid)
{
2018-03-01 10:57:27 +00:00
db::c()->query('LOCK TABLES `actions` WRITE');
2018-12-10 20:16:42 +00:00
$ins = db::c()->query('INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES (?i, ?i, "?s", ?i, "?s", "?s", "?s")', $uid, $time, "capitalcity", 0, $vars, $_SERVER['HTTP_X_REAL_IP'], $vls);
2018-03-01 10:57:27 +00:00
db::c()->query('UNLOCK TABLES');
2018-01-28 16:40:49 +00:00
if ($ins) {
return true;
} else {
return false;
}
}
function plusorminus($n, $shownum = 1)
{
if (empty($shownum)) {
2018-01-28 16:40:49 +00:00
if ($n >= 2) return "++";
if ($n > 0) return "+";
if ($n < 0) return "-";
}
if ($n >= 0) {
return "+$n";
} else {
return $n;
}
}
function showitem2()
{
/**
* Проверяем одевается ли предмет
*/
function isWereable()
{
if (
(empty($row['nsila']) OR $user['sila'] >= $row['nsila']) AND
(empty($row['nlovk']) OR $user['lovk'] >= $row['nlovk']) AND
(empty($row['ninta']) OR $user['inta'] >= $row['ninta']) AND
(empty($row['nvinos']) OR $user['vinos'] >= $row['nvinos']) AND
(empty($row['nintel']) OR $user['intel'] >= $row['nintel']) AND
(empty($row['nmudra']) OR $user['mudra'] >= $row['nmudra']) AND
(empty($row['nlevel']) OR $user['level'] >= $row['nlevel']) AND
(empty($row['nalign']) OR $user['align'] >= $row['nalign'])
) return true; else return false;
}
}
2018-01-28 16:40:49 +00:00
function undressall($id)
{
for ($i = 1; $i <= 26; $i++) {
dropitemid($i, $id);
}
}
function dropitemid($slot, $id)
{
$user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $id . '" LIMIT 1'));
switch ($slot) {
case 1:
$slot1 = 'sergi';
break;
case 2:
$slot1 = 'kulon';
break;
case 3:
$slot1 = 'weap';
break;
case 4:
$slot1 = 'bron';
break;
case 5:
$slot1 = 'r1';
break;
case 6:
$slot1 = 'r2';
break;
case 7:
$slot1 = 'r3';
break;
case 8:
$slot1 = 'helm';
break;
case 9:
$slot1 = 'perchi';
break;
case 10:
$slot1 = 'shit';
break;
case 11:
$slot1 = 'boots';
break;
case 12:
$slot1 = 'm1';
break;
case 13:
$slot1 = 'm2';
break;
case 14:
$slot1 = 'm3';
break;
case 15:
$slot1 = 'm4';
break;
case 16:
$slot1 = 'm5';
break;
case 17:
$slot1 = 'm6';
break;
case 18:
$slot1 = 'm7';
break;
case 19:
$slot1 = 'm8';
break;
case 20:
$slot1 = 'm9';
break;
case 21:
$slot1 = 'm10';
break;
case 22:
$slot1 = 'rybax';
break;
case 23:
$slot1 = 'plaw';
break;
2018-12-10 20:16:42 +00:00
default:
$slot1 = '';
break;
2018-01-28 16:40:49 +00:00
}
if (mysql_query('UPDATE `users`, `inventory` SET `users`.`' . $slot1 . '` = 0, `inventory`.`dressed` = 0, `users`.`sila` = `users`.`sila` - `inventory`.`gsila`, `users`.`lovk` = `users`.`lovk` - `inventory`.`glovk`, `users`.`inta` = `users`.`inta` - `inventory`.`ginta`, `users`.`intel` = `users`.`intel` - `inventory`.`gintel`, `users`.`maxhp` = `users`.`maxhp` - `inventory`.`ghp`, `users`.`noj` = `users`.`noj` - `inventory`.`gnoj`, `users`.`topor` = `users`.`topor` - `inventory`.`gtopor`, `users`.`dubina` = `users`.`dubina` - `inventory`.`gdubina`, `users`.`mec` = `users`.`mec` - `inventory`.`gmech`, `users`.`mfire` = `users`.`mfire` - `inventory`.`gfire`, `users`.`mwater` = `users`.`mwater` - `inventory`.`gwater`, `users`.`mair` = `users`.`mair` - `inventory`.`gair`, `users`.`mearth` = `users`.`mearth` - `inventory`.`gearth`, `users`.`mlight` = `users`.`mlight` - `inventory`.`glight`, `users`.`mgray` = `users`.`mgray` - `inventory`.`ggray`, `users`.`mdark` = `users`.`mdark` - `inventory`.`gdark`, `users`.`fkrit` = `users`.`fkrit` - `inventory`.`mfkrit`, `users`.`fakrit` = `users`.`fakrit` - `inventory`.`mfakrit`, `users`.`fuvorot` = `users`.`fuvorot` - `inventory`.`mfuvorot`, `users`.`fauvorot` = `users`.`fauvorot` - `inventory`.`mfauvorot`, `users`.`ubron1` = `users`.`ubron1` - `inventory`.`bron1`, `users`.`ubron2` = `users`.`ubron2` - `inventory`.`bron2`, `users`.`ubron3` = `users`.`ubron3` - `inventory`.`bron3`, `users`.`ubron4` = `users`.`ubron4` - `inventory`.`bron4`, `users`.`uminu` = `users`.`uminu` - `inventory`.`minu`, `users`.`umaxu` = `users`.`umaxu` - `inventory`.`maxu` WHERE `inventory`.`id` = `users`.`' . $slot1 . '` AND `inventory`.`dressed` = 1 AND `inventory`.`owner` = "' . $user['id'] . '" AND `users`.`id` = "' . $user['id'] . '"')) {
mysql_query("UPDATE `users` SET `hp` = `maxhp`, `fullhptime` = " . time() . " WHERE `hp` > `maxhp` AND `id` = '{$id}' LIMIT 1");
if ($id == $user['id']) {
$user[$slot1] = 0;
}
return true;
}
}
// снять предмет
function dropitem($slot)
{
global $user;
2018-12-10 20:16:42 +00:00
$wear_arr = [];
2018-01-28 16:40:49 +00:00
switch ($slot) {
case 1:
$slot1 = 'sergi';
break;
case 2:
$slot1 = 'kulon';
break;
case 3:
$slot1 = 'weap';
break;
case 4:
$slot1 = 'bron';
break;
case 5:
$slot1 = 'r1';
break;
case 6:
$slot1 = 'r2';
break;
case 7:
$slot1 = 'r3';
break;
case 8:
$slot1 = 'helm';
break;
case 9:
$slot1 = 'perchi';
break;
case 10:
$slot1 = 'shit';
break;
case 11:
$slot1 = 'boots';
break;
case 12:
$slot1 = 'm1';
break;
case 13:
$slot1 = 'm2';
break;
case 14:
$slot1 = 'm3';
break;
case 15:
$slot1 = 'm4';
break;
case 16:
$slot1 = 'm5';
break;
case 17:
$slot1 = 'm6';
break;
case 18:
$slot1 = 'm7';
break;
case 19:
$slot1 = 'm8';
break;
case 20:
$slot1 = 'm9';
break;
case 21:
$slot1 = 'm10';
break;
case 22:
$slot1 = 'rybax';
break;
case 23:
$slot1 = 'plaw';
break;
2018-12-10 20:16:42 +00:00
default:
$slot1 = '';
break;
2018-01-28 16:40:49 +00:00
}
{
2018-11-01 16:00:26 +00:00
if (db::c()->query('UPDATE `users` as `u`, `inventory` as `i` SET `u`.?f = 0, `i`.`dressed` = 0,
`u`.`sila` = `u`.`sila` - `i`.`gsila`,
`u`.`lovk` = `u`.`lovk` - `i`.`glovk`,
`u`.`inta` = `u`.`inta` - `i`.`ginta`,
`u`.`intel` = `u`.`intel` - `i`.`gintel`,
`u`.`maxhp` = `u`.`maxhp` - `i`.`ghp`,
`u`.`noj` = `u`.`noj` - `i`.`gnoj`,
`u`.`topor` = `u`.`topor` - `i`.`gtopor`,
`u`.`dubina` = `u`.`dubina` - `i`.`gdubina`,
`u`.`mec` = `u`.`mec` - `i`.`gmech`,
`u`.`mfire` = `u`.`mfire` - `i`.`gfire`,
`u`.`mwater` = `u`.`mwater` - `i`.`gwater`,
`u`.`mair` = `u`.`mair` - `i`.`gair`,
`u`.`mearth` = `u`.`mearth` - `i`.`gearth`,
`u`.`mlight` = `u`.`mlight` - `i`.`glight`,
`u`.`mgray` = `u`.`mgray` - `i`.`ggray`,
`u`.`mdark` = `u`.`mdark` - `i`.`gdark`,
`u`.`ubron1` = `u`.`ubron1` - `i`.`bron1`,
`u`.`ubron2` = `u`.`ubron2` - `i`.`bron2`,
`u`.`ubron3` = `u`.`ubron3` - `i`.`bron3`,
`u`.`ubron4` = `u`.`ubron4` - `i`.`bron4`,
`u`.`fkrit` = `u`.`fkrit` - `i`.`mfkrit`,
`u`.`fakrit` = `u`.`fakrit` - `i`.`mfakrit`,
`u`.`fuvorot` = `u`.`fuvorot` - `i`.`mfuvorot`,
`u`.`fauvorot` = `u`.`fauvorot` - `i`.`mfauvorot`,
`u`.`uminu` = `u`.`uminu` - `i`.`minu`,
`u`.`umaxu` = `u`.`umaxu` - `i`.`maxu`
WHERE `i`.`id` = `u`.?f AND `i`.`dressed` = 1 AND `i`.`owner` = ?i AND u.id = ?i', $slot1, $slot1, $user['id'], $user['id']))
db::c()->query('UPDATE `users` SET `hp` = `maxhp`, `fullhptime` = ?i WHERE `hp` > `maxhp` AND `id` = ?i', time(), $user['id']);
2018-11-01 16:00:26 +00:00
$wear_raw = db::c()->query('SELECT * FROM `inventory` where `owner` = ?i AND `dressed` = 1', $user['id']);
2018-11-01 16:00:26 +00:00
while ($wear_list = $wear_raw->fetch_assoc()) {
2018-01-28 16:40:49 +00:00
$wear_arr[] = $wear_list['prototype'];
};
$item['id'] = $user[$slot1];
$get_pro = db::c()->query('SELECT * FROM `inventory` where `id` = ?i', $item['id'])->fetch_assoc();
2018-01-28 16:40:49 +00:00
/////////////////////
2018-11-01 16:00:26 +00:00
$sets_items = db::c()->query('SELECT * FROM `item_sets`');
2018-01-28 16:40:49 +00:00
//для каждого комплекта
2018-11-01 16:00:26 +00:00
while ($items_in_set = $sets_items->fetch_assoc()) {
2018-01-28 16:40:49 +00:00
$checker = 0;
$temp_is = explode(",", $items_in_set['prot_id']);
$set_id = $items_in_set['set_id'];
//если прото в комплекте и не одет
if (in_array($get_pro['prototype'], $temp_is) && (!in_array($get_pro['prototype'], $wear_arr))) {
$checker = 1;
// echo("<BR>ITEM SETS<BR>");
//foreach($temp_is as $tis) echo($tis."<BR>");
//для каждого одетого предмета
foreach ($temp_is as $check_proto)
if ($check_proto != $get_pro['prototype']) {
if (!in_array($check_proto, $wear_arr)) {
$checker = 0;
};
// echo("Checker=".$checker." at set #".$set_id." item #".$check_proto." Compare=".$get_pro['prototype']."<BR>");
}
//echo("Checker=".$checker." at set #".$set_id);
}
//
if (($checker == 1) && (!in_array($get_pro['prototype'], $wear_arr))) {
2018-11-01 16:00:26 +00:00
db::c()->query('UPDATE `users` as `u`, `item_sets` as `s` SET
`u`.`uminu` = `u`.`uminu` - `s`.`minu`,
`u`.`umaxu` = `u`.`umaxu` - `s`.`maxu`,
`u`.`sila = `u`.`sila - `s`.`gsila`,
`u`.`lovk = `u`.`lovk - `s`.`glovk`,
`u`.`inta = `u`.`inta - `s`.`ginta`,
`u`.`intel = `u`.`intel - `s`.`gintel`,
`u`.`maxhp = `u`.`maxhp - `s`.`ghp`,
`u`.`maxmana = `u`.`maxmana - `s`.`gmana`,
`u`.`fkrit = `u`.`fkrit - `s`.`mfkrit`,
`u`.`fakrit = `u`.`fakrit - `s`.`mfakrit`,
`u`.`fuvorot = `u`.`fuvorot - `s`.`mfuvorot`,
`u`.`fauvorot = `u`.`fauvorot - `s`.`mfauvorot`,
`u`.`noj = `u`.`noj - `s`.`gnoj`,
`u`.`topor = `u`.`topor - `s`.`gtopor`,
`u`.`dubina = `u`.`dubina - `s`.`gdubina`,
`u`.`mec = `u`.`mec - `s`.`gmech`,
`u`.`ubron1 = `u`.`ubron1 - `s`.`bron1`,
`u`.`ubron2 = `u`.`ubron2 - `s`.`bron2`,
`u`.`ubron3 = `u`.`ubron3 - `s`.`bron3`,
`u`.`ubron4 = `u`.`ubron4 - `s`.`bron4`,
`u`.`mfire = `u`.`mfire - `s`.`gfire`,
`u`.`mwater = `u`.`mwater - `s`.`gwater`,
`u`.`mair = `u`.`mair - `s`.`gair`,
`u`.`mearth = `u`.`mearth - `s`.`gearth`,
`u`.`mlight = `u`.`mlight - `s`.`glight`,
`u`.`mgray = `u`.`mgray - `s`.`ggray`
2018-01-28 16:40:49 +00:00
WHERE
`u`.`id` = ?i AND `s`.`set_id`= ?i', $user['id'], $set_id);
2018-11-01 16:00:26 +00:00
}
}
2018-01-28 16:40:49 +00:00
return true;
}
}
function make_seed()
{
list($usec, $sec) = explode(' ', microtime());
return (float)$sec + ((float)$usec * 100000);
}
function ref_drop()
2018-01-28 16:40:49 +00:00
{
# global $user;
//сможет держать
function derj($id)
{
//global $user;
$user = db::c()->query('SELECT `id`, `align` FROM `users` WHERE `id` = ?i', $_SESSION['uid'])->fetch_assoc();
$ts = db::c()->query('SELECT `id`, `nalign` FROM `inventory` WHERE `id` = ?i', $id)->fetch_assoc();
$al = '(1 = 1)';
2018-12-10 20:16:42 +00:00
if ($ts['nalign'] == 1.1) $al = '(1 = 2)';
$dd = db::c()->query('SELECT `i`.`id` FROM `users` AS `u`, `inventory` AS `i`
WHERE
2018-11-01 15:33:21 +00:00
`i`.`needident` = 0 AND
`i`.`id` = ?i AND
`i`.`duration` < `i`.`maxdur` AND
`i`.`owner` = ?i AND
`u`.`sila` >= `i`.`nsila` AND
`u`.`lovk` >= `i`.`nlovk` AND
`u`.`inta` >= `i`.`ninta` AND
`u`.`vinos` >= `i`.`nvinos` AND
`u`.`intel` >= `i`.`nintel` AND
`u`.`mudra` >= `i`.`nmudra` AND
`u`.`level` >= `i`.`nlevel` AND
2018-11-01 15:35:12 +00:00
("?s" OR (?i = `i`.`nalign`) or (`i`.`nalign` = 0)) AND
2018-11-01 15:33:21 +00:00
`u`.`noj` >= `i`.`nnoj` AND
`u`.`topor` >= `i`.`ntopor` AND
`u`.`dubina` >= `i`.`ndubina` AND
`u`.`mec` >= `i`.`nmech` AND
`u`.`mfire` >= `i`.`nfire` AND
`u`.`mwater` >= `i`.`nwater` AND
`u`.`mair` >= `i`.`nair` AND
`u`.`mearth` >= `i`.`nearth` AND
`u`.`mlight` >= `i`.`nlight` AND
`u`.`mgray` >= `i`.`ngray` AND
`u`.`mdark` >= `i`.`ndark` AND
`i`.`setsale` = 0 AND
`u`.`id` = ?i', $id, $user['id'], $al, $user['align'], $user['id']);
2018-12-10 20:16:42 +00:00
if ($dd->getNumRows() > 0) {
return true;
} else {
return false;
}
}
$slot = ['sergi', 'kulon', 'weap', 'bron', 'r1', 'r2', 'r3', 'helm', 'perchi', 'shit', 'boots', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9', 'm10'];
$user = db::c()->query('SELECT `sergi`,`kulon`,`weap`,`bron`,`r1`,`r2`,`r3`,`helm`,`perchi`,`shit`,`boots`,`m1`,`m2`,`m3`,`m4`,`m5`,`m6`,`m7`,`m8`,`m9`,`m10` FROM `users` WHERE id = ?i', $_SESSION['uid'])->fetch_assoc();
2018-01-28 16:40:49 +00:00
for ($i = 0; $i <= 20; $i++) {
if ($user[$slot[$i]] && !derj($user[$slot[$i]])) {
dropitem($i + 1);
$user[$slot[$i]] = null;
}
}
}
// убить предмет
function destructitem($id)
{
global $user;
$slot1 = '';
$dress = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND `id` = ?i', $user['id'], $id)->fetch_assoc();
2018-01-28 16:40:49 +00:00
switch ($dress['type']) {
case 1:
$slot1 = 'sergi';
break;
case 2:
$slot1 = 'kulon';
break;
case 3:
$slot1 = 'weap';
break;
case 4:
$slot1 = 'bron';
break;
case 5:
$slot1 = 'r1';
break;
case 6:
$slot1 = 'r2';
break;
case 7:
$slot1 = 'r3';
break;
case 8:
$slot1 = 'helm';
break;
case 9:
$slot1 = 'perchi';
break;
case 10:
$slot1 = 'shit';
break;
case 11:
$slot1 = 'boots';
break;
case 12:
$slot1 = 'm1';
break;
case 22:
$slot1 = 'rybax';
break;
case 23:
$slot1 = 'plaw';
break;
}
if ($dress['type'] == 5) {
if ($user['r1'] == $dress['id']) {
$slot1 = 'r1';
} elseif ($user['r2'] == $dress['id']) {
$slot1 = 'r2';
} elseif ($user['r3'] == $dress['id']) {
$slot1 = 'r3';
}
} elseif ($dress['type'] == 12) {
if ($user['m1'] == $dress['id']) {
$slot1 = 'm1';
} elseif ($user['m2'] == $dress['id']) {
$slot1 = 'm2';
} elseif ($user['m3'] == $dress['id']) {
$slot1 = 'm3';
} elseif ($user['m4'] == $dress['id']) {
$slot1 = 'm4';
} elseif ($user['m5'] == $dress['id']) {
$slot1 = 'm5';
} elseif ($user['m6'] == $dress['id']) {
$slot1 = 'm6';
} elseif ($user['m7'] == $dress['id']) {
$slot1 = 'm7';
} elseif ($user['m8'] == $dress['id']) {
$slot1 = 'm8';
} elseif ($user['m9'] == $dress['id']) {
$slot1 = 'm9';
} elseif ($user['m10'] == $dress['id']) {
$slot1 = 'm10';
}
}
if (($dress['owner'] == $user['id'])) {
if ($dress['dressed'] == 1) db::c()->query('UPDATE `users` SET ?f = 0 WHERE `id` = ?i', $slot1, $user['id']);
db::c()->query('DELETE FROM `inventory` WHERE `id` = ?i', $id);
2018-01-28 16:40:49 +00:00
}
}
// использовать магию
function usemagic($id)
2018-01-28 16:40:49 +00:00
{
global $user;
2018-01-28 16:40:49 +00:00
$row = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `id` = '" . mysql_real_escape_string($id) . "' LIMIT 1"));
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id` = '{$user['battle']}' LIMIT 1"));
$all_magic = unserialize($bat['magic']);
$charge = 0;
$magic = mysql_fetch_array(mysql_query("SELECT * FROM `magic` WHERE `id` = '" . $row['magic'] . "' LIMIT 1"));
if ($magic['needcharge'] > 0) {
$charge = $magic['needcharge'];
}
$incmagic = mysql_fetch_array(mysql_query("SELECT * FROM `magic` WHERE `id` = '" . $row['includemagic'] . "' LIMIT 1"));
if ($incmagic['needcharge'] > 0) {
$charge = $incmagic['needcharge'];
}
if (($all_magic[$user['id']] < 1) || ($charge == '0'))
if ((($user['sila'] >= $row['nsila']) &&
($user['lovk'] >= $row['nlovk']) &&
($user['inta'] >= $row['ninta']) &&
($user['vinos'] >= $row['nvinos']) &&
($user['intel'] >= $row['nintel']) &&
($user['level'] >= $row['nlevel']) &&
(($user['align'] > 7 && $user['align'] < 8) || ((int)$user['align'] == (int)$row['nalign']) || ($row['nalign'] == 0)) &&
($user['noj'] >= $row['nnoj']) &&
($user['topor'] >= $row['ntopor']) &&
($user['dubina'] >= $row['ndubina']) &&
($user['mec'] >= $row['nmech']) &&
($row['type'] < 13 || $row['type'] == 50) && ($user['mfire'] >= $row['nfire']) &&
($user['mwater'] >= $row['nwater']) &&
($user['mair'] >= $row['nair']) &&
($user['mearth'] >= $row['nearth']) &&
($user['mlight'] >= $row['nlight']) &&
($user['mgray'] >= $row['ngray']) &&
($user['mdark'] >= $row['ndark']) &&
($row['needident'] == 0)
) || $row['magic'] == 48 || $row['magic'] == 50) {
if (!$row['magic']) {
$incmagic['name'] = $row['includemagicname'];
$incmagic['cur'] = $row['includemagicdex'];
$incmagic['max'] = $row['includemagicmax'];
if ($incmagic['cur'] <= 0) {
return false;
}
$magic['targeted'] = $incmagic['targeted'];
echo "<font color=red><b>";
include("magic/" . $incmagic['file']);
echo "</b></font>";
} else {
echo "<font color=red><b>";
include("magic/" . $magic['file']);
echo "</b></font>";
}
2018-12-10 20:16:42 +00:00
if ($bat) {
2018-01-28 16:40:49 +00:00
if ($row['maxdur'] <= ($row['duration'] + 1)) {
//echo "<!--";
destructitem($row['id']);
//echo "-->";
} else {
if (!$row['magic']) {
2018-12-10 20:16:42 +00:00
mysql_query("UPDATE `inventory` SET `includemagicdex` =`includemagicdex`-{$bat} WHERE `id` = {$row['id']} LIMIT 1;");
2018-01-28 16:40:49 +00:00
} else {
2018-12-10 20:16:42 +00:00
mysql_query("UPDATE `inventory` SET `duration` =`duration`+{$bat} WHERE `id` = {$row['id']} LIMIT 1;");
2018-01-28 16:40:49 +00:00
}
}
if (!$charge) $charge = 0;
//ограничение по кол-ву за ход
if ($user['battle'] > 0)
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
if ($bat['magic'] == '')
2018-12-27 14:46:00 +00:00
$all_magic = [];
2018-01-28 16:40:49 +00:00
else
$all_magic = unserialize($bat['magic']);
$all_magic[$user['id']] += $charge;
mysql_query("UPDATE `battle` SET `magic`='" . serialize($all_magic) . "' WHERE `id`='{$user['battle']}';");
}
}
}
function addch($text, $room = 0)
{
global $user;
if ($room == 0) {
$room = $user['room'];
}
if ($fp = @fopen("tmp/chat.txt", "a")) { //открытие
flock($fp, LOCK_EX); //БЛОКИРОВКА ФАЙЛА
fputs($fp, ":[" . time() . "]:[!sys!!]:[" . ($text) . "]:[" . $room . "]\r\n"); //работа с файлом
fflush($fp); //ОЧИЩЕНИЕ ФАЙЛОВОГО БУФЕРА И ЗАПИСЬ В ФАЙЛ
flock($fp, LOCK_UN); //СНЯТИЕ БЛОКИРОВКИ
fclose($fp); //закрытие
}
}
function addchp($text, $who, $room = 0)
{
global $user;
if ($room == 0) {
$room = $user['room'];
}
$fp = fopen("tmp/chat.txt", "a"); //открытие
flock($fp, LOCK_EX); //БЛОКИРОВКА ФАЙЛА
fputs($fp, ":[" . time() . "]:[{$who}]:[" . ($text) . "]:[" . $room . "]\r\n"); //работа с файлом
fflush($fp); //ОЧИЩЕНИЕ ФАЙЛОВОГО БУФЕРА И ЗАПИСЬ В ФАЙЛ
flock($fp, LOCK_UN); //СНЯТИЕ БЛОКИРОВКИ
fclose($fp); //закрытие
}
2018-11-05 20:54:18 +00:00
/**
* @param $msg
2018-12-27 14:46:00 +00:00
*
* @throws \Krugozor\Database\Mysql\Exception
2018-11-05 20:54:18 +00:00
* Отправка системного сообщения в чат.
*/
function AddChatSystem($msg)
2018-01-28 16:40:49 +00:00
{
2018-11-05 21:02:19 +00:00
if ($msg) db::c()->query('INSERT INTO `chat` (`cid`,`msg`,`type`) VALUES (?i,"?s","?s")', 1, $msg, 'sys');
2018-01-28 16:40:49 +00:00
}
function err($t)
{
echo '<span class="redalert">' . $t . '</span>';
2018-03-03 11:50:13 +00:00
return true;
2018-01-28 16:40:49 +00:00
}
// ставим травму
function settravma($id, $type, $time = 86400, $kill = false)
{
$user = mysql_fetch_array(mysql_query("SELECT `align`, `level` FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
if ((($user['align'] == 2 && mt_rand(1, 100) > 20) && !$kill) || ($user['level'] == 0)) {
return false;
} else {
2018-12-27 14:46:00 +00:00
$travmalist = ["разбитый нос", "сотрясение первой степени", "потрепанные уши", "прикушенный язык", "перелом переносицы", "растяжение ноги", "растяжение руки", "подбитый глаз", "синяк под глазом", "кровоточащее рассечение", "отбитая <пятая точка>", "заклинившая челюсть", "выбитый зуб <мудрости>", "косоглазие"];
$travmalist2 = ["отбитые почки", "вывих <вырезано цензурой>", "сотрясение второй степени", "оторванное ухо", "вывих руки", "оторванные уши", "поврежденный позвоночник", "отбитые почки", "поврежденный копчик", "разрыв сухожилия", "перелом ребра", "перелом двух ребер", "вывих ноги", "сломанная челюсть"];
$travmalist3 = ["пробитый череп", "разрыв селезенки", "смещение позвонков", "открытый перелом руки", "открытый перелом <вырезано цензурой>", "излом носоглотки", "непонятные, но множественные травмы", "сильное внутреннее кровотечение", "раздробленная коленная чашечка", "перелом шеи", "смещение позвонков", "открытый перелом ключицы", "перелом позвоночника", "вывих позвоночника", "сотрясение третьей степени"];
2018-01-28 16:40:49 +00:00
$owntravma = mysql_fetch_array(mysql_query("SELECT `type`, `id`, `sila`, `lovk`, `inta`, `hp` FROM `effects` WHERE `owner` = " . $id . " AND (`type` = 11 OR `type` = 12 OR `type` = 13) ORDER BY `type` DESC LIMIT 1"));
if ($type != 0 && $type != 100) {
$owntravma['type'] = $type;
} elseif ($type != 0 && $type == 100 && $owntravma['type'] == 0) {
$type = mt_rand(1, 100);
if ($type < 10) {
$owntravma['type'] = 25;
} elseif ($type < 60) {
$owntravma['type'] = "set";
} elseif ($type < 85) {
$owntravma['type'] = 11;
} else {
$owntravma['type'] = 12;
}
} elseif ($owntravma['type'] == 0) {
$tr = mt_rand(1, 3);
switch ($tr) {
case 1:
$owntravma['type'] = 0;
break;
case 2:
$owntravma['type'] = 11;
break;
case 3:
$owntravma['type'] = 12;
break;
}
}
switch ($owntravma['type']) {
case 20:
2018-12-10 20:16:42 +00:00
$st = mt_rand(0, 2);
2018-01-28 16:40:49 +00:00
$zz = mt_rand(1, 3);
$s = 0;
$l = 0;
$i = 0;
switch ($zz) {
case 1:
$s = ($user['level'] + $st) * 3;
break;
case 2:
$l = ($user['level'] + $st) * 3;
break;
case 3:
$i = ($user['level'] + $st) * 3;
break;
}
$trv = $travmalist3[mt_rand(0, count($travmalist3) - 1)];
mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма &quot;" . $trv . "&quot;', " . (time() + $time) . ", '13', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
return $trv;
break;
case 0:
$st = mt_rand(0, 2);
$zz = mt_rand(1, 3);
$s = 0;
$l = 0;
$i = 0;
switch ($zz) {
case 1:
$s = $user['level'] + $st;
break;
case 2:
$l = $user['level'] + $st;
break;
case 3:
$i = $user['level'] + $st;
break;
}
$trv = $travmalist[mt_rand(0, count($travmalist) - 1)];
$time = 60 * 60 * mt_rand(1, 5);
mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма &quot;" . $trv . "&quot;', " . (time() + $time) . ", '11', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
return $trv;
break;
case "set":
$st = mt_rand(0, 2);
$zz = mt_rand(1, 3);
$s = 0;
$l = 0;
$i = 0;
switch ($zz) {
case 1:
$s = $user['level'] + $st;
break;
case 2:
$l = $user['level'] + $st;
break;
case 3:
$i = $user['level'] + $st;
break;
}
$trv = $travmalist[mt_rand(0, count($travmalist) - 1)];
$time = 60 * 60 * mt_rand(1, 5);
mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма &quot;" . $trv . "&quot;', " . (time() + $time) . ", '11', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
return $trv;
break;
case 11:
$zz = mt_rand(1, 3);
$s = 0;
$l = 0;
$i = 0;
switch ($zz) {
case 1:
$s = ($user['level']) * 2;
break;
case 2:
$l = ($user['level']) * 2;
break;
case 3:
$i = ($user['level']) * 2;
break;
}
$trv = $travmalist2[mt_rand(0, count($travmalist2) - 1)];
$time = 60 * 60 * mt_rand(5, 15);
mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма &quot;" . $trv . "&quot;', " . (time() + $time) . ", '12', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
return $trv;
break;
case 12:
$zz = mt_rand(1, 3);
$s = 0;
$l = 0;
$i = 0;
switch ($zz) {
case 1:
$s = ($user['level']) * 3;
break;
case 2:
$l = ($user['level']) * 3;
break;
case 3:
$i = ($user['level']) * 3;
break;
}
$trv = $travmalist3[mt_rand(0, count($travmalist3) - 1)];
$time = 60 * 60 * mt_rand(15, 24);
mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма &quot;" . $trv . "&quot;', " . (time() + $time) . ", '13', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
return $trv;
break;
case 13:
$zz = mt_rand(1, 3);
$s = 0;
$l = 0;
$i = 0;
switch ($zz) {
case 1:
$s = ($user['level']) * 3;
break;
case 2:
$l = ($user['level']) * 3;
break;
case 3:
$i = ($user['level']) * 3;
break;
}
$trv = $travmalist3[mt_rand(0, count($travmalist3) - 1)];
$time = 60 * 60 * mt_rand(25, 26);
mysql_query("INSERT INTO `effects` (`owner`, `name`, `time`, `type`, `sila`, `lovk`, `inta`, `vinos`) VALUES ('" . $id . "', 'Травма &quot;" . $trv . "&quot;', " . (time() + $time) . ", '14', '" . $s . "', '" . $l . "', '" . $i . "', '0')");
mysql_query("UPDATE `users` SET `sila` = (`sila`-'" . $s . "'), `lovk` = (`lovk`-'" . $l . "'), `inta` = (`inta`-'" . $i . "') WHERE `id` = '" . $id . "' LIMIT 1");
return $trv;
break;
}
}
}
function deltravma($id)
{
$owntravmadb = mysql_query("SELECT `type`, `id`, `sila`, `lovk`, `inta`, `owner` FROM `effects` WHERE `id` = " . $id . " AND (`type` = 11 OR `type` = 12 OR `type` = 13 OR `type` = 14)");
while ($owntravma = mysql_fetch_array($owntravmadb)) {
mysql_query("DELETE FROM `effects` WHERE `id` = '" . $owntravma['id'] . "' LIMIT 1");
mysql_query("UPDATE `users` SET `sila` = (`sila`+'" . $owntravma['sila'] . "'), `lovk` = (`lovk`+'" . $owntravma['lovk'] . "'), `inta` = (`inta`+'" . $owntravma['inta'] . "') WHERE `id` = '" . $owntravma['owner'] . "' LIMIT 1");
}
}
// telegrafick
function telegraph($to, $text)
{ //todo переписать, под логику, когда телеграф ВСЕГДА приходит на почту.
global $user;
$ur = mysql_fetch_array(mysql_query("select `id` from `users` WHERE `login` = '{$to}' LIMIT 1;"));
$us = mysql_fetch_array(mysql_query("select `id` from `online` WHERE `date` >= " . (time() - 60) . " AND `id` = '{$ur['id']}' LIMIT 1;"));
if (!$ur) {
echo "<font color=red><b>Персонаж не найден.</b></font>";
} elseif ($us[0]) {
addchp(' (' . date("Y.m.d H:i") . ') <font color=darkblue>Сообщение телеграфом от </font><span oncontextmenu=OpenMenu()>' . nick::id($user['id'])->short() . '</span>: ' . $text . ' ', '{[]}' . $to . '{[]}');
2018-01-28 16:40:49 +00:00
echo "<font color=red><b>Персонаж получил ваше сообщение</b></font>";
} else {
// если в офе
echo "<font color=red><b>Сообщение будет доставлено, как только персонаж будет on-line.</b></font>";
mysql_query("INSERT INTO `telegraph` (`receiver`,`text`) VALUES ('" . $ur['id'] . "','" . '[' . date("d.m.Y H:i") . '] <font color=darkblue>Сообщение по телеграфу от </font><span oncontextmenu=OpenMenu()>' . nick::id($user['id'])->short() . '</span>: ' . $text . ' ' . "');");
2018-01-28 16:40:49 +00:00
}
}
function get_meshok()
{
global $user;
$d = db::c()->query('SELECT SUM(`gmeshok`) AS `ves` FROM `inventory` WHERE `owner` = ?i AND `setsale` = 0 AND `gmeshok` > 0', $_SESSION['uid'])->fetch_assoc();
2018-03-09 17:04:36 +00:00
return ($user['sila'] * 4 + $d['ves']);
2018-01-28 16:40:49 +00:00
}
/**
* Надеюсь временная заглушка, которая объединяет get_meshok() и другую выдачу одной строкой.
* @return string
*/
function getItemsMassaInfo()
{
2018-12-27 14:46:00 +00:00
$i_row = db::c()->query('SELECT SUM(`massa`) AS `massa`, SUM(`gmeshok`) AS `massa_bonus` FROM `inventory` WHERE `setsale` = 0 AND `owner` = ?i', $_SESSION['uid'])->fetch_assoc();
$u_row = db::c()->query('SELECT `sila` FROM `users` WHERE `id` = ?i', $_SESSION['uid'])->fetch_assoc();
if ($i_row['massa'] > $u_row['sila'] * 4 + $i_row['massa_bonus'])
2018-12-27 14:46:00 +00:00
return "<span style='color:maroon;'>" . $i_row['massa'] . "</span>/" . ($u_row['sila'] * 4 + $i_row['massa_bonus']);
else return $i_row['massa'] . "/" . ($u_row['sila'] * 4 + $i_row['massa_bonus']);
}
2018-01-28 16:40:49 +00:00
function addlog($id, $log)
{
$fp = fopen("backup/logs/battle" . $id . ".txt", "a");
flock($fp, LOCK_EX);
fputs($fp, $log);
fflush($fp);
flock($fp, LOCK_UN);
fclose($fp);
unset($id, $log);
}
function star_sign($month, $day)
{
2018-12-27 14:46:00 +00:00
if (empty($month) or empty($day)) {
2018-12-27 16:13:40 +00:00
$month = (int)sprintf("%02d", mt_rand(1, 12));
$day = (int)sprintf("%02d", mt_rand(1, 29));
2018-12-27 14:46:00 +00:00
}
$signs = ["10", "11", "12", "01", "02", "03", "04", "05", "06", "07", "08", "09"];
$signsstart = [01 => 21, 02 => 20, 03 => 20, 04 => 20, 05 => 20, 06 => 20, 07 => 21, 08 => 22, 09 => 23, 10 => 23, 11 => 23, 12 => 23];
2018-01-28 16:40:49 +00:00
return $day < $signsstart[$month + 1] ? $signs[$month - 1] : $signs[$month % 12];
}
function SolveExp($at_id, $def_id, $damage)
{
2018-02-27 02:48:51 +00:00
$mods = ['bloodb' => 1.2, 'btl_1' => 1, 'btl_2' => 0.5, 'btl_3' => 0.05];
$baseexp = ["0" => "2", "1" => "5", "2" => "10", "3" => "15", "4" => "30", "5" => "60", "6" => "90", "7" => "115", "8" => "300", "9" => "400", "10" => "500", "11" => "600", "12" => "700", "13" => "800", "14" => "900", "15" => "1000", "16" => "1100", "17" => "1200", "18" => "1300", "19" => "1400", "20" => "1500", "21" => "1600"];
2018-12-10 20:16:42 +00:00
$expmf = 0;
$bot_active = false;
$bot_def = false;
2018-01-28 16:40:49 +00:00
if ($at_id > _BOTSEPARATOR_) {
$bots = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `id` = "' . $at_id . '" LIMIT 1'));
$at_id = $bots['prototype'];
$bot_active = true;
}
2018-02-27 02:48:51 +00:00
$at = db::c()->query('SELECT `level` FROM `users` WHERE `id` = ?i', $at_id)->fetch_assoc();
$def = db::c()->query('SELECT `level` FROM `users` WHERE `id` = ?i', $def_id)->fetch_assoc();
2018-01-28 16:40:49 +00:00
$at_cost = mysql_fetch_array(mysql_query("SELECT 1+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0), `align` FROM `users` WHERE `id` = '" . $at_id . "' LIMIT 1"));
2018-02-27 02:48:51 +00:00
$def_cost = mysql_fetch_array(mysql_query("SELECT 1+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0), `align` FROM `users` WHERE `id` = '" . $def_id . "' LIMIT 1"));
2018-01-28 16:40:49 +00:00
if ($at_id > _BOTSEPARATOR_) {
$bat_raw = mysql_fetch_array(mysql_query("SELECT `battle` FROM `bots` WHERE `id` = '$at_id' LIMIT 1"));
} else {
$bat_raw = mysql_fetch_array(mysql_query("SELECT `battle` FROM `users` WHERE `id` = '$at_id' LIMIT 1"));
}
$bat = $bat_raw['battle'];
2018-02-27 02:48:51 +00:00
$bt = db::c()->query('SELECT `blood`,`type`,`t1`,`t2` FROM `battle` WHERE `id` = ?i', $bat)->fetch_assoc();
2018-01-28 16:40:49 +00:00
if ($def_id > _BOTSEPARATOR_) {
$bots = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `id` = "' . $def_id . '" LIMIT 1'));
$def_id = $bots['prototype'];
$bot_def = true;
}
if ($bt['blood']) {
2018-02-27 02:48:51 +00:00
$expmf = $mods['bloodb'];
2018-01-28 16:40:49 +00:00
}
$filebtl = '/tmp/' . $at_id . '.btl';
if ($bt['type'] == 1 && file_exists($filebtl)) {
$btfl = fopen($filebtl, 'r');
$contents = fread($btfl, filesize($filebtl));
fclose($btfl);
$cnt = substr_count($contents, $def_id);
$exmod = 1;
if ($cnt <= 1) {
$exmod = $mods['btl_1'];
} elseif ($cnt == 2) {
$exmod = $mods['btl_2'];
} elseif ($cnt > 2) {
$exmod = $mods['btl_3'];
}
$expmf = $expmf * $exmod;
}
2018-02-27 02:48:51 +00:00
$standart = [
"0" => 1,
"1" => 1,
"2" => 15,
"3" => 111,
"4" => 265,
"5" => 526,
"6" => 882,
"7" => 919,
"8" => 919,
"9" => 919,
"10" => 919,
"11" => 919,
"12" => 919,
"13" => 919, "14" => 919, "15" => 919, "16" => 919, "17" => 919, "18" => 919, "19" => 919, "20" => 919, "21" => 919, "22" => 919, "23" => 919, "24" => 919, "25" => 919];
2018-01-28 16:40:49 +00:00
$mfit = ($at_cost[0] / ($standart[$at['level']] / 3));
if ($mfit < 0.8) {
$mfit = 0.8;
}
if ($mfit > 1.5) {
$mfit = 1.5;
}
$pls = count(explode(";", $bt['t1'])) + count(explode(";", $bt['t2']));
if ($pls > 2) {
$mfbot = $bot_active == true ? 0.3 : 1;
$mfbot2 = $bot_def == true ? 0.7 : 1;
} else {
$mfbot = 1;
$mfbot2 = 1;
}
if ($expmf == 0) {
$expmf = 1;
}
$result = ($baseexp[$def['level']]) * ($def_cost[0] / (($at_cost[0] + $def_cost[0]) / 2)) * ($damage / $def['maxhp']) * $expmf * $mfit * $mfbot * $mfbot2;
$result = $result / 3;
$result = round($result, 0);
return $result;
}
/**
* Функция записи в личное дело.
*
* @param string $message - текст записи.
* @param int $user_id - ID пользователя которому добавляется запись.
* @param int $type - тип записи: (1)обычная, (2)модераторская.
2018-12-27 14:46:00 +00:00
*
* @return bool
*/
function addToDelo($message, $user_id = 0, $type = 1)
{
if (empty($user_id)) $user_id = $_SESSION['uid'];
db::c()->query('INSERT INTO `delo` (pers, text, type, date) VALUES (?i,"?s",?i,?i)', $user_id, $message, $type, time());
return true;
}
/**
* Апаем стат или мастерство на единицу.
2018-12-27 14:46:00 +00:00
*
* @param $name - техническое имя параметра, как в базе.
* @param null $param - выбор что повышать.
2018-12-27 14:46:00 +00:00
*
* @return void
*/
function addOnePoint($name, $param = null)
{
$allowed_stats = ['sila', 'lovk', 'inta', 'vinos', 'intel', 'mudra'];
$allowed_mastery = ['noj', 'mec', 'dubina', 'topor', 'mfire', 'mwater', 'mair', 'mearth', 'mlight', 'mgray', 'mdark'];
$naming = [
'sila' => 'Сила',
'lovk' => 'Ловкость',
'inta' => 'Интуиция',
'vinos' => 'Выносливость',
'intel' => 'Интеллект',
'mudra' => 'Мудрость',
'noj' => 'Владение кинжалами',
'mec' => 'Владение мечами',
'dubina' => 'Владение дубинами',
'topor' => 'Владение топорами',
'mfire' => 'Магия огня',
'mwater' => 'Магия воды',
'mair' => 'Магия воздуха',
'mearth' => 'Магия земли',
'mlight' => 'Магия света',
'mgray' => 'Магия серости',
'mdark' => 'Магия тьмы'
];
if ($param == 'stat' AND in_array($name, $allowed_stats)) {
db::c()->query('UPDATE `users` SET ?f = ?f + 1, `stats` = `stats` - 1 WHERE `id` = ?i', $name, $name, $_SESSION['uid']);
echo "<span style='color:darkgreen'>Параметр {$naming[$name]} увеличен на 1 ед.</span>";
} elseif ($param == 'mastery' AND in_array($name, $allowed_mastery)) {
$mastery_level = db::c()->query('SELECT ?f FROM `users` WHERE `id` = ?i', $name, $_SESSION['uid'])->fetch_assoc();
if ($mastery_level[$name] < 10) {
db::c()->query('UPDATE `users` SET ?f = ?f + 1, `master` = `master` - 1 WHERE `id` = ?i', $name, $name, $_SESSION['uid']);
echo "<span style='color:darkgreen'>Параметр {$naming[$name]} увеличен на 1 ед.</span>";
} else echo "<span style='color: maroon;'>Ошибка: параметр достиг максимального значения!</span>";
} else return null;
}
function checkIntInRange($int, $min = 1, $max = PHP_INT_MAX)
{
return (int)filter_var($int, FILTER_VALIDATE_INT, ['options' => ['min_range' => $min,'max_range' => $max]]);
}