battles/functions.php
2018-03-03 19:45:09 +02:00

5689 lines
311 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

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

<?php
/**
* Copyright (c) 2018.
* Author: Igor Barkov <lopar.4ever@gmail.com>
* Project name: Battles-Game
*/
require_once 'config.php';
require_once 'classes/u.php';
$u = new u($_SESSION['uid']);
/** Бля, если это сработает... */
$user = $u->i();
define("HPADDICTIONEFFECT", 33);
$ip = filter_input(INPUT_SERVER,'REMOTE_ADDR', FILTER_VALIDATE_IP);
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']);
$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'];
db::c()->query('INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`) VALUES ("?s", "?s", "?s", "?s")', $botname, $bot, $battle, $rec['maxhp']);
$nid = db::c()->getLastInsertId();
return array("id" => $nid, "login" => $botname);
} else {
return false;
}
}
#####Для нападалок. Сперва комнаты в которых нельзя напасть, потом персонаж на которого нельзя напасть.
$unkilable = array(
'rooms' => array(620, 621, 1051, 1052),
'users' => array(10962, 10964, 10965)
);
$runes_exp = array('1' => 10500, '2' => 23500, '3' => 38500, '4' => 57000, '5' => 77000, '6' => 103000, '7' => 136500, '8' => 171500, '9' => 212500, '10' => 257500);
$canalenters = array(620);
$caverooms = array(621);
$userslots = array('sergi', 'kulon', 'perchi', 'weap', 'bron', 'r1', 'r2', 'r3', 'helm', 'shit', 'boots', 'rybax', 'plaw', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9', 'm10');
function getuserdata($id = 0)
{
if (!$id) $id = isset($_SESSION['uid'])?$_SESSION['uid']:NULL; // Хорошее решение проверок, кстати.
if (!$id) return array();
$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)) {
regenhp($rec, 0);
if ($rec['hp'] == $rec['maxhp']) {
$rec['hp']--;
}
}
return $rec;
}
if (!isset($user)) {
$user = getuserdata();
}
if (empty($user['battle']) && ($user['hp'] < @$user['maxhp'])) {
regenhp($user);
}
$inder = filter_input(INPUT_COOKIE, 'inder');
if (!isset($banks['id'])) {
$banks = db::c()->query('SELECT `id`, `cr`, `ekr` FROM `bank` WHERE `id` = "?s" AND `owner` = "?s" LIMIT 1', $inder, $u->i()['id'])->fetch_assoc();
}
function auth_bank($id, $pass, $us)
{
global $banks;
$bn = db::c()->query('SELECT `id`, `pass` FROM `bank` WHERE `id` = ?i AND `owner` = "?s"', $id, $us)->fetch_assoc();
if (isset($bn['id'])) {
if ($bn['pass'] == md5($pass)) {
setcookie('inder', $bn['id'], time() + 60 * 60 * 24 * 7, '/', GAMEDOMAIN, 0, true);
$banks['id'] = $bn['id'];
$msg = 'Успешная авторизация ...';
} else {
$msg = 'Неверный пароль ...';
}
} else {
$msg = 'Счёт не найден ...';
}
return $msg;
}
function exit_bank($link)
{
global $banks;
$r = 'Работа со счётом завершена ...';
setcookie('inder', '', time() + 60 * 60 * 24 * 7, '', GAMEDOMAIN);
$banks['id'] = null;
header('Location: ' . $link);
return $r;
}
function getNum($v)
{
$plid = $v;
$pi = iconv_strlen($plid);
if ($pi < 5) {
$i = 0;
while ($i <= 5 - $pi) {
$plid = '0' . $plid;
$i++;
}
}
return $plid;
}
function banks()
{
global $user, $banks;
$bank = db::c()->query('SELECT `id`, `cr`, `ekr` FROM `bank` WHERE `id` = "?s" AND `owner` = "?s" LIMIT 1', $banks['id'], $user['id'])->fetch_assoc();
if (isset($bank['id'])) {
echo '<fieldset style=\'width: 400px;\'><legend>Счёт</legend>Банковский счёт №' . $bank['id'] . '. <a href=\'?destruct=bank&id=' . $user['id'] . '\' title=\'Закончить работу со счётом\'>x</a><br />На счету <b>' . $bank['ekr'] . '</b> еврокредитов.</fieldset>';
} else {
$sp = db::c()->query('SELECT `id` FROM `bank` WHERE `owner` = "?s" ORDER BY `id` ASC', $user['id']);
if ($sp->getNumRows() > 0) {
$nums .= '<select name=\'bnid\'>';
$pl = $sp->fetch_assoc();
while ($pl) {
$nums .= '<option value=\'' . $pl['id'] . '\'>Счёт #' . $pl['id'] . '</option>';
}
$nums .= '</select> <input type=\'password\' name=\'passwords\' /> <input type=\'submit\' name=\'oauth\' value=\'Вход\' />';
} else {
$nums = 'У вас нет счетов';
}
$auth = $nums;
echo '<fieldset style=\'width: 400px;\'><legend>Авторизация</legend><form method=\'POST\'>' . $auth . '</form></fieldset>';
}
}
if (isset($user['id']) && $user['block'] == 1) {
die();
}
$var_map = array(
'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' => 'Полесье'
);
function close_dangling_tags($html)
{
preg_match_all("#<([a-z]+)( .*)?(?!/)>#iU", $html, $result);
$openedtags = $result[1];
preg_match_all("#</([a-z]+)>#iU", $html, $result);
$closedtags = $result[1];
$len_opened = count($openedtags);
if (count($closedtags) == $len_opened) {
return $html;
}
$openedtags = array_reverse($openedtags);
for ($i = 0; $i < $len_opened; $i++) {
if (!in_array($openedtags[$i], $closedtags)) {
$html .= '</' . $openedtags[$i] . '>';
} else {
unset($closedtags[array_search($openedtags[$i], $closedtags)]);
}
}
return $html;
}
function gotoroom($r, $redir = 1)
{
mysql_query("UPDATE `users`, `online` SET `users`.`room` = '$r', `online`.`room` = '$r' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '{$_SESSION['uid']}'");
if ($redir) {
redirectbyroom($r);
}
}
function redirectbyroom($r)
{
global $canalenters;
if (in_array($r, $canalenters)) {
header("location: enter_cave.php");
die();
}
if ($r == 1) {
header("location: main.php");
die();
}
}
function battlewithbot($b, $name = '', $time = 3, $blood = 1, $group = 1, $battleid = 0, $otherbots = array(), $noredir = 0, $userid = 0, $type = 1)
{
global $user;
if (!$userid) {
$user1 = $user;
} elseif (is_array($userid)) {
$user1 = $userid;
} else {
$user1 = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '$userid' LIMIT 1"));
}
$bot = mysql_fetch_array(mysql_query("SELECT `login`, `maxhp` FROM `users` WHERE `id` = '$b' LIMIT 1"));
if (!$name) {
$name = $bot['login'];
}
if ($battleid) {
$botid = mysql_fetch_assoc(mysql_query("SELECT `id` FROM `bots` WHERE `prototype` = '$b' AND `battle` = '$battleid' LIMIT 1"));
} elseif ($group) {
$arha = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `prototype` = '$b' ORDER BY `id` DESC LIMIT 1"));
$battleid = $arha['battle'];
$botid = $arha['id'];
}
if (@$battleid > 0) {
$bd = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id` = '$battleid' LIMIT 1"));
$battle = unserialize($bd['teams']);
$t1 = explode(";", $bd['t1']);
$t2 = explode(";", $bd['t2']);
$ak = array_keys($battle[$t2[0]]);
$battle[$user1['id']] = $battle[$ak[0]];
foreach ($battle[$user1['id']] as $k => $v) {
$battle[$user1['id']][$k] = array(0, 0, time());
$battle[$k][$user1['id']] = array(0, 0, time());
}
if (in_array($botid, $t1)) {
$ttt = 2;
} else {
$ttt = 1;
}
if ($user1['invis'] == 1) {
addlog($battleid, '<span class=date>' . date("H:i") . '</span> <b>невидимка</b> вмешался в поединок!<BR>');
} else {
addlog($battleid, '<span class=date>' . date("H:i") . '</span> ' . nick5($user1['id'], "B" . $ttt) . ' вмешался в поединок!<BR>');
}
mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t' . $ttt . '` = CONCAT(`t' . $ttt . '`,\';' . $user1['id'] . '\') WHERE `id` = ' . $battleid . ' LIMIT 1');
mysql_query("UPDATE `users` SET `battle` = " . $battleid . ", `zayavka` = 0 WHERE `id`= " . $user1['id'] . " LIMIT 1");
if (!$noredir) {
header("Location: fbattle.php");
}
} else {
mysql_query("INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`) VALUES ('$name', '$b', '', '" . $bot['maxhp'] . "')");
$botnames = array();
$botnames[$name] = 1;
$hps[$b] = $bot['maxhp'];
$botid1 = mysql_insert_id();
$cond = " `id` = '$botid1' ";
$teams = array();
$teams[$user1['id']][$botid1] = array(0, 0, time());
$teams[$botid1][$user1['id']] = array(0, 0, time());
$t2 = "$botid1";
$others = "";
$hps = array();
foreach ($otherbots as $k => $v) {
if (@$botnames[$v['name']]) {
$i = 1;
while (@$botnames["$v[name] ($i)"]) $i++;
$botname = "$v[name] ($i)";
} else {
$botname = $v['name'];
}
$botnames[$botname] = 1;
if (!@$hps[$v['id']]) {
$hps[$v['id']] = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users` WHERE `id` = '$v[id]' LIMIT 1"));
}
mysql_query("INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`) VALUES ('$botname', '$v[id]', '', '" . $hps[$v['id']]['maxhp'] . "')");
$botid = mysql_insert_id();
$cond .= " OR `id` = '$botid' ";
$teams[$user1['id']][$botid] = array(0, 0, time());
$teams[$botid][$user1['id']] = array(0, 0, time());
$others .= "<span class=date>" . date("H:i") . "</span> <span class=B2>$botname</span> вмешался в поединок.<BR>";
$t2 .= ";$botid";
}
mysql_query("INSERT INTO `battle` (`id`, `coment`, `teams`, `timeout`, `type`, `status`, `t1`, `t2`, `to1`, `to2`, `blood`, `date`) VALUES (NULL, '', '" . serialize($teams) . "', '" . $time . "', '$type', '0', '" . $user1['id'] . "', '" . $t2 . "', '" . time() . "', '" . time() . "', '$blood', '" . date("Y-m-d H:i") . "')");
$battleid = mysql_insert_id();
mysql_query("UPDATE `bots` SET `battle` = {$battleid} WHERE $cond");
mysql_query("UPDATE `users` SET `battle` = {$battleid} WHERE `id` = {$user1['id']} LIMIT 1");
if ($user1['invis'] == 1) {
$rr = "<b>невидимка</b> и <b>" . nick3($botid1) . "</b>";
} else {
$rr = "<b>" . nick3($user1['id']) . "</b> и <b>" . nick3($botid1) . "</b>";
}
addlog($battleid, "Часы показывали <span class=date>" . date("Y.m.d H.i") . "</span>, когда " . $rr . " бросили вызов друг другу. <BR>" . ($others ? "$others<BR>" : ""));
if (!$noredir) {
header("Location: fbattle.php");
}
}
return $battleid;
}
function backpacksize($u = 0)
{
$l = 0;
if ($u) {
$l = $u['level'];
}
if ($l == 0) {
return 75;
}
if ($l == 1) {
return 100;
}
if ($l == 2) {
return 125;
}
if ($l == 3) {
return 175;
}
if ($l == 4) {
return 225;
}
if ($l == 5) {
return 325;
}
if ($l == 6) {
return 425;
}
if ($l == 7) {
return 525;
}
if ($l == 8) {
return 625;
}
if ($l == 9) {
return 725;
}
if ($l == 10) {
return 825;
}
if ($l == 11) {
return 925;
}
if ($l >= 12) {
return 1025;
}
}
function placeinbackpack($qty, $userid = 0)
{
global $user;
if (!$userid) {
$userid = $user['id'];
}
if ($userid == $user['id']) {
$user1 = $user;
} else {
$user1 = mysql_fetch_array(mysql_query("SELECT `id`, `level` FROM `users` WHERE `id` = '$user1[id]' LIMIT 1"));
}
$cnt = mysql_fetch_assoc(mysql_query("SELECT COUNT(`id`) AS `cnt` FROM `inventory` WHERE `owner` = '$user1[id]' AND `dressed` = 0 AND `setsale` = 0"));
return $cnt['cnt'] + $qty <= backpacksize($user1['id']);
}
function cancarry($m, $u)
{
global $user;
if (!$u) {
$u = $user['id'];
}
$bp = mysql_fetch_array(mysql_query("SELECT SUM(`massa`) AS `massa`, SUM(`gmeshok`) AS `gmeshok` FROM `inventory` WHERE `owner` = '$u[id]' AND `dressed` = 1 AND `setsale` = 0"));
$mw = 40 * $user['level'] + $user['vinos'] + $bp['gmeshok'];
if ($bp['massa'] + $m > $mw) {
return false;
}
return true;
}
function secs2hrs($s, $short = 0)
{
if ($s < 60) return "$s сек.";
$retstr = '';
if ($s < 3600) {
$min = floor($s / 60);
if ($min || !$short) $retstr .= "$min мин. ";
$sec = $s % 60;
if ($sec || !$short) $retstr .= "$sec сек.";
return $retstr;
}
$ret = floor($s / 3600);
$s = $s % 3600;
$d = floor($ret / 24);
$h = $ret % 24;
if ($d && ($d > 1 || $h || $s)) {
$retstr .= "$d д. ";
if ($h || !$short) $retstr .= "$h ч. ";
$min = floor($s / 60);
if ($min || !$short) $retstr .= "$min мин.";
return $retstr;
} elseif ($d) $h += $d * 24;
if ($h) {
$retstr = "$h ч. ";
$min = floor($s / 60);
if ($min || !$short) $retstr .= "$min мин.";
return $retstr;
}
return floor($s / 60) . " мин. " . ($s % 60) . " сек.";
}
function show_itm_hostel($uid, $otdel, $type = 1)
{
$r = '';
if ($type != 1) {
$sql = $uid;
$txt = 'В сундук';
} else {
$sql = '-101' . $uid . '';
$txt = 'В инвентарь';
}
$data = mysql_query("SELECT * FROM `inventory` WHERE `otdel` = '{$otdel}' AND `owner` = " . $sql . " AND `dressed`='0' ORDER BY `id` ASC");
while ($pl = mysql_fetch_array($data)) {
$r .= show_item($pl, 10, $txt, $type);
}
if ($r == '') {
$r = '<tr><td width="100%" align="center" class="even"><center><b>Пусто. <br />Попробуйте другой вариант фильтрации.</center></b></td></tr>';
}
return $r;
}
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_) . '"');
while ($efs = mysql_fetch_array($row)) {
efs_go_storage($efs, $pers);
}
###
}
function enter_bs($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'] + _BOTSEPARATOR_) . '" WHERE `owner` = "' . $pers['id'] . '"');
###
###
$efs = mysql_query('SELECT * FROM `effects` WHERE `owner` = "' . $pers['id'] . '"');
while ($row = mysql_fetch_array($efs)) {
efs_add_storage($row, $pers);
}
###
###
makeuserdata($pers);
###
}
function makeuserdata($pl)
{
$udata = mysql_fetch_array(mysql_query('SELECT * FROM `deztow_realchars` WHERE `owner` = "' . $pl['id'] . '" LIMIT 1'));
if (isset($udata['id'])) {
$udata['sila'] = $pl['sila'];
$udata['lovk'] = $pl['lovk'];
$udata['inta'] = $pl['inta'];
$udata['vinos'] = $pl['vinos'];
$udata['maxhp'] = $pl['maxhp'];
$udata['money'] = $pl['money'];
$udata['level'] = $pl['level'];
$udata['exp'] = $pl['exp'];
$udata['nextup'] = $pl['nextup'];
$udata['align'] = $pl['align'];
$udata['stats'] = $pl['stats'];
$udata['master'] = $pl['master'];
$udata['intel'] = $pl['intel'];
$udata['noj'] = $pl['noj'];
$udata['mec'] = $pl['mec'];
$udata['topor'] = $pl['topor'];
$udata['dubina'] = $pl['dubina'];
$udata['mlight'] = $pl['mlight'];
$udata['mgray'] = $pl['mgray'];
$udata['mdark'] = $pl['mdark'];
mysql_query('UPDATE `deztow_realchars` SET `sila` = "' . $udata['sila'] . '", `lovk` = "' . $udata['lovk'] . '", `inta` = "' . $udata['inta'] . '", `vinos` = "' . $udata['vinos'] . '", `maxhp` = "' . $udata['maxhp'] . '", `money` = "' . $udata['money'] . '", `intel` = "' . $udata['intel'] . '", `level` = "' . $udata['level'] . '", `exp` = "' . $udata['exp'] . '", `nextup` = "' . $udata['nextup'] . '", `align` = "' . $udata['align'] . '", `stats` = "' . $udata['stats'] . '", `master` = "' . $udata['master'] . '", `noj` = "' . $udata['noj'] . '", `mec` = "' . $udata['mec'] . '", `topor` = "' . $udata['topor'] . '", `dubina` = "' . $udata['dubina'] . '", `mlight` = "' . $udata['mlight'] . '", `mgray` = "' . $udata['mgray'] . '", `mdark` = "' . $udata['mdark'] . '" WHERE `owner` = "' . $udata['id'] . '" LIMIT 1');
} else {
mysql_query('INSERT INTO `deztow_realchars` (`owner`, `sila`, `lovk`, `inta`, `vinos`, `maxhp`, `intel`, `level`, `money`, `exp`, `nextup`, `align`, `stats`, `master`, `noj`, `mec`, `topor`, `dubina`, `mlight`, `mgray`, `mdark`) VALUES ("' . $pl['id'] . '", "' . $pl['sila'] . '", "' . $pl['lovk'] . '", "' . $pl['inta'] . '", "' . $pl['vinos'] . '", "' . $pl['maxhp'] . '", "' . $pl['intel'] . '", "' . $pl['level'] . '", "' . $pl['money'] . '", "' . $pl['exp'] . '", "' . $pl['nextup'] . '", "' . $pl['align'] . '", "' . $pl['stats'] . '", "' . $pl['master'] . '", "' . $pl['noj'] . '", "' . $pl['mec'] . '", "' . $pl['topor'] . '", "' . $pl['dubina'] . '", "' . $pl['mlight'] . '", "' . $pl['mgray'] . '", "' . $pl['mdark'] . '")');
}
}
function efs_add_storage($pl, $us)
{
$travm = array(11, 12, 13, 14);
if (in_array($pl['type'], $travm)) {
$us['sila'] += $pl['sila'];
$us['lovk'] += $pl['lovk'];
$us['inta'] += $pl['inta'];
$us['vinos'] += $pl['vinos'];
} else {
$us['sila'] -= $pl['sila'];
$us['lovk'] -= $pl['lovk'];
$us['inta'] -= $pl['inta'];
$us['vinos'] -= $pl['vinos'];
$us['maxhp'] -= $pl['hp'];
}
$pl['owner'] = ($user['id'] + _BOTSEPARATOR_);
mysql_query('UPDATE `effects` SET `owner` = "' . $pl['owner'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
mysql_query('UPDATE `users` SET `sila` = "' . $us['sila'] . '", `lovk` = "' . $us['lovk'] . '", `inta` = "' . $us['inta'] . '", `vinos` = "' . $us['vinos'] . '", `maxhp` = "' . $us['maxhp'] . '" WHERE `id` = "' . $us['id'] . '" LIMIT 1');
}
function efs_go_storage($pl, $us)
{
$travm = array(11, 12, 13, 14);
if (in_array($pl['type'], $travm)) {
$us['sila'] -= $pl['sila'];
$us['lovk'] -= $pl['lovk'];
$us['inta'] -= $pl['inta'];
$us['vinos'] -= $pl['vinos'];
} else {
$us['sila'] += $pl['sila'];
$us['lovk'] += $pl['lovk'];
$us['inta'] += $pl['inta'];
$us['vinos'] += $pl['vinos'];
$us['maxhp'] += $pl['hp'];
}
$pl['owner'] = $user['id'];
mysql_query('UPDATE `effects` SET `owner` = "' . $pl['owner'] . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
mysql_query('UPDATE `users` SET `sila` = "' . $us['sila'] . '", `lovk` = "' . $us['lovk'] . '", `inta` = "' . $us['inta'] . '", `vinos` = "' . $us['vinos'] . '", `maxhp` = "' . $us['maxhp'] . '" WHERE `id` = "' . $us['id'] . '" LIMIT 1');
}
function takeshopitem($item, $table = "shop", $present = '', $onlyonetrip = '', $fields = 0, $uid = 0, $koll = 1, $podzem = 0)
{
global $user;
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");
if (mysql_affected_rows() > 0) return array("img" => $rec1['img'], "name" => $rec1['name']);
$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) {
return array("error" => "У вас слишком много таких вещей.");
}
}
if ($present) {
$rec1['present'] = $present;
$rec1['cost'] = 0;
$rec1['ecost'] = 0;
}
// if ($fields) {
// foreach ($fields as $k => $v) {
// $rec1[$k] = $v;
// }
// }
$sql = "";
while ($rec = mysql_fetch_assoc($r)) {
if (!@$flds[$rec['Field']]) continue;
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"];
}
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");
return array("img" => $rec1['img'], "name" => $rec1['name'], "id" => mysql_insert_id());
}
function select_arenda($u, $type, $redirect = false)
{
$hostel = mysql_fetch_array(mysql_query('SELECT `id` FROM `hostel` WHERE `uid` = "' . $u['id'] . '" LIMIT 1'));
$price = array(1 => 8, 2 => 15, 3 => 25, 4 => 40);
if (!isset($u['id'])) {
$r = 'Персонаж не найден ...';
} else {
if ($type > 0 && $type <= 4) {
if (isset($hostel['id'])) {
$r = 'Не более 1 арендованного места ...';
} else {
if ($u['money'] >= $price[$type]) {
$u['money'] -= $price[$type];
mysql_query('UPDATE `users` SET `money` = "' . $u['money'] . '" WHERE `id` = "' . $u['id'] . '" LIMIT 1');
mysql_query('INSERT INTO `hostel` (`uid`, `type`, `time`) VALUES ("' . $u['id'] . '", "' . $type . '", "' . (time() + 60 * 60 * 24 * 7) . '")');
$r = 'Поздравляем с успешной арендой ...';
} else {
$r = 'Недостаточно денег ...';
}
}
} else {
$r = 'Неверный тип аренды ...';
}
}
if ($redirect == true) {
header('Location: main.php');
}
return $r;
}
function remove_hostel_items($u)
{
$itms = mysql_query('SELECT `id`, `owner` FROM `inventory` WHERE `owner` = "-101' . $u . '"');
while ($pl = mysql_fetch_array($itms)) {
mysql_query('UPDATE `inventory` SET `owner` = "' . $u . '" WHERE `id` = "' . $pl['id'] . '" AND `owner` = "-101' . $u . '"');
}
}
$abils_array = array('attack', 'sleep', 'sleepf');
$ab_user = array('sleep15', 'sleep30', 'closebattle', 'heal20', 'heal35', 'heal50', 'travmoff', 'attack', 'bloodattack', 'death', 'comment', 'openbattle', 'reamdeath', 'clone', 'unclone');
function vip_relicts()
{
global $user;
$r = '';
if ($user['vip'] > 0 && $user['vip_time'] > time()) {
$abils = mysql_fetch_array(mysql_query('SELECT `id`, `uid`, `sokr`, `zash`, `invisible`, `attack`, `bloodattack`, `sleep30`, `travmoff`, `dontattack`, `unsleep`, `pers_attack` FROM `abils_vip` WHERE `uid` = "' . $user['id'] . '" LIMIT 1'));
if ($abils['sokr'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?use=2", "target")\'><img src=\'i/sh/devastate.gif\' title=\'Сокрушение\' /></a><div class="amount">' . $abils['sokr'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/devastate.gif\' style=\'opacity: 0.3;\' title=\'Сокрушение\' /></a><div class="amount">0</div></div>';
}
if ($abils['zash'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?use=3", "target")\'><img src=\'i/sh/defence.gif\' title=\'Защита от оружия\' /></a><div class="amount">' . $abils['zash'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/defence.gif\' style=\'opacity: 0.3;\' title=\'Защита от оружия\' /></a><div class="amount">0</div></div>';
}
if ($abils['invisible'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?use=1", "target")\'><img src=\'i/sh/hidden.gif\' title=\'Невидимость\' /></a><div class="amount">' . $abils['invisible'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/hidden.gif\' style=\'opacity: 0.3;\' title=\'Невидимость\' /></a><div class="amount">0</div></div>';
}
if ($abils['attack'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?use=4", "target")\'><img src=\'i/sh/attack.gif\' title=\'Нападение\' /></a><div class="amount">' . $abils['attack'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/attack.gif\' style=\'opacity: 0.3;\' title=\'Нападение\' /></a><div class="amount">0</div></div>';
}
if ($abils['bloodattack'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?use=5", "target")\'><img src=\'i/sh/attackb.gif\' title=\'Кровавое нападение\' /></a><div class="amount">' . $abils['bloodattack'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/attackb.gif\' style=\'opacity: 0.3;\' title=\'Кровавое нападение\' /></a><div class="amount">0</div></div>';
}
if ($abils['sleep30'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?use=6", "target")\'><img src=\'i/sh/silence30.gif\' title=\'Заклятие молчания 30 минут\' /></a><div class="amount">' . $abils['sleep30'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/silence30.gif\' style=\'opacity: 0.3;\' title=\'Заклятие молчания 30 минут\' /></a><div class="amount">0</div></div>';
}
if ($abils['travmoff'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?use=7", "target")\'><img src=\'i/sh/cure3.gif\' title=\'Лечение травм\' /></a><div class="amount">' . $abils['travmoff'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/cure3.gif\' style=\'opacity: 0.3;\' title=\'Лечение травм\' /></a><div class="amount">0</div></div>';
}
if ($abils['dontattack'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?use=8", "target")\'><img src=\'i/magic/attack_defence.gif\' title=\'Защита от нападений\' /></a><div class="amount">' . $abils['dontattack'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/magic/attack_defence.gif\' style=\'opacity: 0.3;\' title=\'Защита от нападений\' /></a><div class="amount">0</div></div>';
}
if ($abils['unsleep'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?use=9", "target")\'><img src=\'i/magic/sleep_off.gif\' title=\'Снять заклятие молчания\'/></a><div class="amount">' . $abils['unsleep'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/sleep_off.gif\' style=\'opacity: 0.3;\' title=\'Снять заклятие молчания\' /></a><div class="amount">0</div></div>';
}
if ($abils['pers_attack'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?use=10", "target")\'><img src=\'i/sh/attackb.gif\' title=\'Личное Кровавое нападение\' /></a><div class="amount">' . $abils['pers_attack'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/attackb.gif\' style=\'opacity: 0.3;\' title=\'Личное Кровавое нападение\' /></a><div class="amount">0</div></div>';
}
} elseif ($user['vip'] == 0) {
$r = 'Вы не вип пользователь ...';
} elseif ($user['vip_time'] <= time()) {
$r = 'Вы не вип пользователь ...';
} else {
$r = 'Ошибка ...';
}
return $r;
}
function klan_relicts()
{
global $user;
$r = '';
if ($user['klan'] > 0) {
$abils = mysql_fetch_array(mysql_query('SELECT `id`, `klan`, `sleep15`, `sleep30`, `closebattle`, `heal20`, `heal35`, `heal50`, `travmoff`, `attack`, `bloodattack`, `death`, `comment`, `openbattle`, `reamdeath`, `clone`, `unclone` FROM `abils_klan` WHERE `klan` = "' . $user['klan'] . '" LIMIT 1'));
if ($abils['sleep15'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?useds=1", "target")\'><img src=\'i/sh/silence15.gif\' title=\'Заклятие молчания 15 минут\' /></a><div class="amount">' . $abils['sleep15'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/silence15.gif\' style=\'opacity: 0.3;\' title=\'Заклятие молчания 15 минут\' /></a><div class="amount">0</div></div>';
}
if ($abils['sleep30'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?useds=2", "target")\'><img src=\'i/sh/silence30.gif\' title=\'Заклятие молчания 30 минут\' /></a><div class="amount">' . $abils['sleep30'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/silence30.gif\' style=\'opacity: 0.3;\' title=\'Заклятие молчания 30 минут\' /></a><div class="amount">0</div></div>';
}
if ($abils['closebattle'] > 0) {
$r .= '<div class="item"><a href=\'?useds=3\'><img src=\'i/sh/closebattle.gif\' title=\'Закрыть бой\' /></a><div class="amount">' . $abils['closebattle'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/closebattle.gif\' style=\'opacity: 0.3;\' title=\'Закрыть бой\' /></a><div class="amount">0</div></div>';
}
if ($abils['heal20'] > 0) {
$r .= '<div class="item"><a href=\'?useds=4\'><img src=\'i/sh/cureHP15.gif\' title=\'Исцеление +20%\' /></a><div class="amount">' . $abils['heal20'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/cureHP15.gif\' style=\'opacity: 0.3;\' title=\'Исцеление +20%\' /></a><div class="amount">0</div></div>';
}
if ($abils['heal35'] > 0) {
$r .= '<div class="item"><a href=\'?useds=5\'><img src=\'i/sh/cureHP45.gif\' title=\'Исцеление +35%\' /></a><div class="amount">' . $abils['heal35'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/cureHP45.gif\' style=\'opacity: 0.3;\' title=\'Исцеление +35%\' /></a><div class="amount">0</div></div>';
}
if ($abils['heal50'] > 0) {
$r .= '<div class="item"><a href=\'?useds=6\'><img src=\'i/sh/cureHP60.gif\' title=\'Исцеление +50%\' /></a><div class="amount">' . $abils['heal50'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/cureHP60.gif\' style=\'opacity: 0.3;\' title=\'Исцеление +50%\' /></a><div class="amount">0</div></div>';
}
if ($abils['travmoff'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?useds=7", "target")\'><img src=\'i/sh/cure3.gif\' title=\'Лечение тяжелой травмы\' /></a><div class="amount">' . $abils['travmoff'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/cure3.gif\' style=\'opacity: 0.3;\' title=\'Лечение тяжелой травмы\' /></a><div class="amount">0</div></div>';
}
if ($abils['attack'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?useds=8", "target")\'><img src=\'i/sh/attack.gif\' title=\'Нападение\' /></a><div class="amount">' . $abils['attack'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/attack.gif\' style=\'opacity: 0.3;\' title=\'Нападение\' /></a><div class="amount">0</div></div>';
}
if ($abils['bloodattack'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?useds=10", "target")\'><img src=\'i/sh/attackb.gif\' title=\'Кровавое нападение\' /></a><div class="amount">' . $abils['bloodattack'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/attackb.gif\' style=\'opacity: 0.3;\' title=\'Кровавое нападение\' /></a><div class="amount">0</div></div>';
}
if ($abils['death'] > 0) {
$r .= '<div class="item" style=\'display: none;\'><a href=\'javascript: void(0);\'><img src=\'i/sh/poison_e.gif\' title=\'Объятия смерти\' /></a><div class="amount">' . $abils['death'] . '</div></div>';
} else {
$r .= '<div class="item" style=\'display: none;\'><a href=\'javascript: void(0);\'><img src=\'i/sh/poison_e.gif\' style=\'opacity: 0.3;\' title=\'Объятия смерти\' /></a><div class="amount">0</div></div>';
}
if ($abils['comment'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'note("Запрос", "?useds=11", "target");\'><img src=\'i/sh/note.gif\' title=\'Записки Комментатора\' /></a><div class="amount">' . $abils['comment'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/note.gif\' style=\'opacity: 0.3;\' title=\'Записки Комментатора\' /></a><div class="amount">0</div></div>';
}
if ($abils['openbattle'] > 0) {
$r .= '<div class="item"><a href=\'?useds=12\'><img src=\'i/sh/unlockbattle.gif\' title=\'Открыть бой\' /></a><div class="amount">' . $abils['openbattle'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/unlockbattle.gif\' style=\'opacity: 0.3;\' title=\'Открыть бой\' /></a><div class="amount">0</div></div>';
}
if ($abils['reamdeath'] > 0) {
$r .= '<div class="item" style=\'display: none;\'><a href=\'javascript: void(0);\'><img src=\'i/sh/reanimationD.gif\' title=\'Поднять мертвого\' /></a><div class="amount">' . $abils['reamdeath'] . '</div></div>';
} else {
$r .= '<div class="item" style=\'display: none;\'><a href=\'javascript: void(0);\'><img src=\'i/sh/reanimationD.gif\' style=\'opacity: 0.3;\' title=\'Поднять мертвого\' /></a><div class="amount">0</div></div>';
}
if ($abils['clone'] > 0) {
$r .= '<div class="item"><a href=\'?useds=14\'><img src=\'i/sh/mirror.gif\' title=\'Клонирование\' /></a><div class="amount">' . $abils['clone'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/mirror.gif\' style=\'opacity: 0.3;\' title=\'Клонирование\' /></a><div class="amount">0</div></div>';
}
if ($abils['unclone'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?useds=15", "target")\'><img src=\'i/sh/antimirror.gif\' title=\'Эфирное воздействие\' /></a><div class="amount">' . $abils['unclone'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/antimirror.gif\' style=\'opacity: 0.3;\' title=\'Эфирное воздействие\' /></a><div class="amount">0</div></div>';
}
} else {
$r = 'Вы не состоите в клане ...';
}
return $r;
}
function user_relicts()
{
global $user;
$r = '';
$abils = mysql_fetch_array(mysql_query('SELECT `id`, `uid`, `sleep15`, `sleep30`, `closebattle`, `heal20`, `heal35`, `heal50`, `travmoff`, `attack`, `bloodattack`, `death`, `comment`, `openbattle`, `reamdeath`, `clone`, `unclone` FROM `abils_user` WHERE `uid` = "' . $user['id'] . '" LIMIT 1'));
if ($abils['sleep15'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?used=1", "target")\'><img src=\'i/sh/silence15.gif\' title=\'Заклятие молчания 15 минут\' /></a><div class="amount">' . $abils['sleep15'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/silence15.gif\' style=\'opacity: 0.3;\' title=\'Заклятие молчания 15 минут\' /></a><div class="amount">0</div></div>';
}
if ($abils['sleep30'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?used=2", "target")\'><img src=\'i/sh/silence30.gif\' title=\'Заклятие молчания 30 минут\' /></a><div class="amount">' . $abils['sleep30'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/silence30.gif\' style=\'opacity: 0.3;\' title=\'Заклятие молчания 30 минут\' /></a><div class="amount">0</div></div>';
}
if ($abils['closebattle'] > 0) {
$r .= '<div class="item"><a href=\'?used=3\'><img src=\'i/sh/closebattle.gif\' title=\'Закрыть бой\' /></a><div class="amount">' . $abils['closebattle'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/closebattle.gif\' style=\'opacity: 0.3;\' title=\'Закрыть бой\' /></a><div class="amount">0</div></div>';
}
if ($abils['heal20'] > 0) {
$r .= '<div class="item"><a href=\'?used=4\'><img src=\'i/sh/cureHP15.gif\' title=\'Исцеление +20%\' /></a><div class="amount">' . $abils['heal20'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/cureHP15.gif\' style=\'opacity: 0.3;\' title=\'Исцеление +20%\' /></a><div class="amount">0</div></div>';
}
if ($abils['heal35'] > 0) {
$r .= '<div class="item"><a href=\'?used=5\'><img src=\'i/sh/cureHP45.gif\' title=\'Исцеление +35%\' /></a><div class="amount">' . $abils['heal35'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/cureHP45.gif\' style=\'opacity: 0.3;\' title=\'Исцеление +35%\' /></a><div class="amount">0</div></div>';
}
if ($abils['heal50'] > 0) {
$r .= '<div class="item"><a href=\'?used=6\'><img src=\'i/sh/cureHP60.gif\' title=\'Исцеление +50%\' /></a><div class="amount">' . $abils['heal50'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/cureHP60.gif\' style=\'opacity: 0.3;\' title=\'Исцеление +50%\' /></a><div class="amount">0</div></div>';
}
if ($abils['travmoff'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?used=7", "target")\'><img src=\'i/sh/cure3.gif\' title=\'Лечение тяжелой травмы\' /></a><div class="amount">' . $abils['travmoff'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/cure3.gif\' style=\'opacity: 0.3;\' title=\'Лечение тяжелой травмы\' /></a><div class="amount">0</div></div>';
}
if ($abils['attack'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?used=8", "target")\'><img src=\'i/sh/attack.gif\' title=\'Нападение\' /></a><div class="amount">' . $abils['attack'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/attack.gif\' style=\'opacity: 0.3;\' title=\'Нападение\' /></a><div class="amount">0</div></div>';
}
if ($abils['bloodattack'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?used=9", "target")\'><img src=\'i/sh/attackb.gif\' title=\'Кровавое нападение\' /></a><div class="amount">' . $abils['bloodattack'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/attackb.gif\' style=\'opacity: 0.3;\' title=\'Кровавое нападение\' /></a><div class="amount">0</div></div>';
}
if ($abils['death'] > 0) {
$r .= '<div class="item" style=\'display: none;\'><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?used=10", "target")\'><img src=\'i/sh/poison_e.gif\' title=\'Объятия смерти\' /></a><div class="amount">' . $abils['death'] . '</div></div>';
} else {
$r .= '<div class="item" style=\'display: none;\'><a href=\'javascript: void(0);\'><img src=\'i/sh/poison_e.gif\' style=\'opacity: 0.3;\' title=\'Объятия смерти\' /></a><div class="amount">0</div></div>';
}
if ($abils['comment'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'note("Запрос", "?used=11", "target");\'><img src=\'i/sh/note.gif\' title=\'Записки Комментатора\' /></a><div class="amount">' . $abils['comment'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/note.gif\' style=\'opacity: 0.3;\' title=\'Записки Комментатора\' /></a><div class="amount">0</div></div>';
}
if ($abils['openbattle'] > 0) {
$r .= '<div class="item"><a href=\'?used=12\'><img src=\'i/sh/unlockbattle.gif\' title=\'Открыть бой\' /></a><div class="amount">' . $abils['openbattle'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/unlockbattle.gif\' style=\'opacity: 0.3;\' title=\'Открыть бой\' /></a><div class="amount">0</div></div>';
}
if ($abils['reamdeath'] > 0) {
$r .= '<div class="item" style=\'display: none;\'><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?used=13", "target")\'><img src=\'i/sh/reanimationD.gif\' title=\'Поднять мертвого\' /></a><div class="amount">' . $abils['reamdeath'] . '</div></div>';
} else {
$r .= '<div class="item" style=\'display: none;\'><a href=\'javascript: void(0);\'><img src=\'i/sh/reanimationD.gif\' style=\'opacity: 0.3;\' title=\'Поднять мертвого\' /></a><div class="amount">0</div></div>';
}
if ($abils['clone'] > 0) {
$r .= '<div class="item"><a href=\'?used=14\'><img src=\'i/sh/mirror.gif\' title=\'Клонирование\' /></a><div class="amount">' . $abils['clone'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/mirror.gif\' style=\'opacity: 0.3;\' title=\'Клонирование\' /></a><div class="amount">0</div></div>';
}
if ($abils['unclone'] > 0) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "?used=15", "target")\'><img src=\'i/sh/antimirror.gif\' title=\'Эфирное воздействие\' /></a><div class="amount">' . $abils['unclone'] . '</div></div>';
} else {
$r .= '<div class="item"><a href=\'javascript: void(0);\'><img src=\'i/sh/antimirror.gif\' style=\'opacity: 0.3;\' title=\'Эфирное воздействие\' /></a><div class="amount">0</div></div>';
}
if ($user['id'] == 10022 || $user['id'] == 9081) {
$r .= '<div class="item"><a href=\'javascript: void(0);\' onclick=\'runmagic1("Введите имя персонажа", "main.php?edit=1&use=3651943", "target")\'><img src=\'i/sh/spell_luck.gif\' title=\'Благословление Мусорщика\' /></a><div class="amount">~</div></div>';
}
return $r;
}
function lookStats($m)
{
$ist = array();
$di = explode('|', $m);
$i = 0;
while ($i < count($di)) {
$de = explode('=', $di[$i]);
if (isset($de[0], $de[1])) {
if (!isset($ist[$de[0]])) {
$ist[$de[0]] = 0;
}
$ist[$de[0]] = $de[1];
}
$i++;
}
return $ist;
}
function impStats($m)
{
$i = 0;
$k = array_keys($m);
$d = '';
while ($i <= count($k)) {
if ($k[$i] != '') {
$d .= $k[$i] . '=' . $m[$k[$i]] . '|';
}
$i++;
}
$d = rtrim($d, '|');
return $d;
}
function add_user_abil($ab, $cost)
{
global $user, $banks;
if (isset($ab)) {
if ($banks['ekr'] >= $cost) {
$isset = mysql_fetch_array(mysql_query('SELECT `id`, `' . $ab . '` FROM `abils_user` WHERE `uid` = "' . $user['id'] . '" LIMIT 1'));
$isset[$ab] += 1;
mysql_query('UPDATE `abils_user` SET `' . $ab . '` = "' . $isset[$ab] . '" WHERE `uid` = "' . $user['id'] . '" LIMIT 1');
$banks['ekr'] -= $cost;
mysql_query('UPDATE `bank` SET `ekr` = "' . $banks['ekr'] . '" WHERE `owner` = "' . $user['id'] . '" LIMIT 1');
return true;
}
}
return false;
}
function add_klan_abil($ab, $cost)
{
global $user, $banks;
$clan = mysql_fetch_array(mysql_query('SELECT `id`, `glava` FROM `clans` WHERE `id` = "' . $user['klan'] . '" LIMIT 1'));
if (isset($ab)) {
if ($banks['ekr'] >= $cost && $clan['glava'] == $user['id']) {
$isset = mysql_fetch_array(mysql_query('SELECT `id`, `' . $ab . '` FROM `abils_klan` WHERE `klan` = "' . $user['klan'] . '" LIMIT 1'));
$isset[$ab] += 1;
mysql_query('UPDATE `abils_klan` SET `' . $ab . '` = "' . $isset[$ab] . '" WHERE `klan` = "' . $user['klan'] . '" LIMIT 1');
$banks['ekr'] -= $cost;
mysql_query('UPDATE `bank` SET `ekr` = "' . $banks['ekr'] . '" WHERE `owner` = "' . $user['id'] . '" LIMIT 1');
return true;
}
}
return false;
}
function remove_vip($uid)
{
mysql_query('UPDATE `users` SET `vip` = "0", `vip_time` = "0" WHERE `id` = "' . $uid . '" LIMIT 1');
$abil = mysql_fetch_array(mysql_query('SELECT `id`, `uid`, `sokr`, `zash`, `invisible`, `attack`, `bloodattack`, `sleep30`, `travmoff`, `daontattack`, `unsleep`, `pers_attack` FROM `abils_vip` WHERE `uid` = "' . $uid . '" LIMIT 1'));
if (isset($abil['id'])) {
mysql_query('UPDATE `abils_vip` SET `sokr` = 0, `zash` = 0, `invisible` = 0, `attack` = 0, `bloodattack` = 0, `sleep30` = 0, `travmoff` = 0, `daontattack` = 0, `unsleep` = 0, `pers_attack` = 0 WHERE `id` = "' . $abil['id'] . '" LIMIT 1');
}
return true;
}
function upd_vip($u, $type)
{
$abli = mysql_fetch_array(mysql_query('SELECT `id`, `uid`, `sokr`, `zash`, `invisible`, `attack`, `bloodattack`, `sleep30`, `travmoff`, `dontattack`, `unsleep`, `pers_attack` FROM `abils_vip` WHERE `uid` = "' . $u . '" LIMIT 1'));
if ($type == 1) {
$abli['attack'] += 1;
$abli['bloodattack'] += 1;
if ($abli['attack'] > 10) {
$abli['attack'] = 10;
}
if ($abli['bloodattack'] > 10) {
$abli['bloodattack'] = 10;
}
mysql_query('UPDATE `abils_vip` SET `sokr` = 1, `zash` = 1, `attack` = "' . $abli['attack'] . '", `bloodattack` = "' . $abli['bloodattack'] . '" WHERE `id` = "' . $abli['id'] . '" LIMIT 1');
echo mysql_error();
} elseif ($type == 2) {
$abli['attack'] += 1;
$abli['bloodattack'] += 1;
$abli['travmoff'] += 1;
if ($abli['attack'] > 10) {
$abli['attack'] = 10;
}
if ($abli['bloodattack'] > 10) {
$abli['bloodattack'] = 10;
}
if ($abli['travmoff'] > 10) {
$abli['travmoff'] = 10;
}
mysql_query('UPDATE `abils_vip` SET `sokr` = 1, `zash` = 1, `attack` = "' . $abli['attack'] . ', `bloodattack` = "' . $abli['bloodattack'] . '", `travmoff` = "' . $abli['travmoff'] . '" WHERE `id` = "' . $abli['id'] . '" LIMIT 1');
} elseif ($type == 3) {
$abli['attack'] += 1;
$abli['bloodattack'] += 1;
$abli['travmoff'] += 1;
if ($abli['attack'] > 10) {
$abli['attack'] = 10;
}
if ($abli['bloodattack'] > 10) {
$abli['bloodattack'] = 10;
}
if ($abli['travmoff'] > 10) {
$abli['travmoff'] = 10;
}
mysql_query('UPDATE `abils_vip` SET `sokr` = 1, `zash` = 1, `attack` = "' . $abli['attack'] . ', `bloodattack` = "' . $abli['bloodattack'] . '", `travmoff` = "' . $abli['travmoff'] . '" WHERE `id` = "' . $abli['id'] . '" LIMIT 1');
}
}
define('_BOTSEPARATOR_', 10000000);
$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], # Это тринадцатый уровень
];
$rooms = [
"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"
];
//эффективность магии
$elem_align = array(
"a" => array("a" => "1", "e" => "0", "f" => "0.5", "w" => "0.5"),
"e" => array("a" => "0", "e" => "1", "f" => "0.5", "w" => "0.5"),
"f" => array("a" => "0.5", "e" => "0.5", "f" => "1", "w" => "0"),
"w" => array("a" => "0.5", "e" => "0.5", "f" => "0", "w" => "1"),
);
$elem_bonus = array(
"a" => array("a" => "1", "e" => "0.75", "f" => "1.25", "w" => "1"),
"e" => array("a" => "1.25", "e" => "1", "f" => "1", "w" => "0.75"),
"f" => array("a" => "0.75", "e" => "1", "f" => "1", "w" => "1.25"),
"w" => array("a" => "1", "e" => "1.25", "f" => "0.75", "w" => "1"),
);
header("Cache-Control: no-cache");
function level_up($uid)
{
global $exptable;
$us = db::c()->query('SELECT `id`, `login`, `level`, `money`, `sex`, `exp`, `vinos`, `nextup`, `stats`, `master`, `maxhp`, `refer`, `ip`, `in_tower` FROM `users` WHERE `id` =?i', $uid)->fetch_assoc();
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) . " уровень.");
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']);
}
}
}
######## FIXME ВЕЧНЫЕ 12-ТКИ!!!!!!!!!!!!
$in_user = db::c()->query('SELECT `id`, `exp`, `nextup`, `level` FROM `users` WHERE `id` = ?i', $_SESSION['uid'])->fetch_assoc();
if (isset($in_user['id']) && ($in_user['exp'] >= $in_user['nextup']) && $in_user['level'] < 13) {
level_up($in_user['id']);
}
########
function getcavedata($caveleader, $floor)
{
return unserialize(implode("", file("cavedata/$caveleader-$floor.dat")));
}
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 timetoheal()
{
$fulltime = 600;
return $fulltime;
}
function getslot($i, $user1 = 0)
{
global $userslots, $user;
if (!$user1) {
$user1 = $user;
}
foreach ($userslots as $k => $v) {
if ($user1[$v] == $i) {
return $v;
}
}
}
/**
* @param $playerId
* @param int $showInvisibility
*/
function nickname($playerId, $showInvisibility = 0){
$user = db::c()->query('SELECT `login`, `level`, `align`, (SELECT `short` FROM `clans` WHERE `clans`.`id` = `klan`) AS `klan`, `hp`, `maxhp` FROM `users` WHERE `id` = ?i', $playerId)->fetch_assoc();
$n ='';
if ($showInvisibility) {
$user['login'] = '<i>невидимка</i>';
$user['level'] = '??';
} else {
if ($user['align']) {
$n .= sprintf('<img src="i/align_%s.gif">', $user['align']);
}
if ($user['klan']) {
$n .= sprintf('<img src="i/klan/%s.gif">', $user['klan']);
}
}
$n .= sprintf('<b>%s</b> [%s] <a href="inf.php?%s" target="_blank"><img src="i/inf.gif" style="width:12px;height:11px"></a>', $user['login'], $user['level'], $user['login']);
echo $n;
}
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;
}
function nick3($id)
{
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
if (isset($user['id'])) {
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$id}' AND `type` = '1022' LIMIT 1"));
if ($effect && $id < _BOTSEPARATOR_) {
$user['login'] = '</a><b><i>невидимка</i></b>';
$user['level'] = '??';
$user['id'] = '??';
$user['align'] = '0';
$user['klan'] = '0';
}
if ($user['align'] > 0) {
$mm .= "<img src=\"i/align_" . ($user['align'] > 0 ? $user['align'] : "0") . ".gif\" />";
}
if ($user['klan'] > 0) {
$mm .= '<img title="' . ClanImage($user['klan']) . '" src="i/klan/' . ClanImage($user['klan']) . '.gif" />';
}
$mm .= "<b>{$user['login']}</b> [{$user['level']}]<a href=inf.php?{$user['login']} target=_blank><img src=i/inf.gif width=12 height=11 /></a>";
}
return $mm;
}
function nick4($id, $st)
{
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
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 nick5($id, $st)
{
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
if ($user[0]) {
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$id}' AND `type` = '1022' LIMIT 1"));
if ($effect) {
$user['login'] = '<b><i>невидимка</i></b>';
}
return "<span class={$st}>" . $user['login'] . "</span>";
}
}
function nick7($id)
{
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
if ($user[0]) {
if ($user['invis']) {
$user['login'] = '<b><i>невидимка</i></b>';
}
return $user['login'];
}
}
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 join_arena($u, $btl, $team, $at)
{
$bd = mysql_fetch_array(mysql_query('SELECT * FROM `battle` WHERE `id` = "' . $btl . '" LIMIT 1'));
$battle = unserialize($bd['teams']);
$ak = array_keys($battle[$at]);
$battle[$u] = $battle[$ak[0]];
foreach ($battle[$u] as $k => $v) {
$battle[$u][$k] = array(0, 0, time());
$battle[$k][$u] = array(0, 0, time());
}
if ($team == 1) {
$adtxt = 'За сторону <b>Тьмы</b>.';
} else {
$adtxt = 'За сторону <b>Света</b>.';
}
addlog($btl, '<span class=date>' . date("H:i") . '</span> ' . nick5($u, "B" . $team) . ' вмешался в поединок! ' . $adtxt . '<br />');
mysql_query('UPDATE `battle` SET `teams` = \'' . serialize($battle) . '\', `t' . $team . '` = CONCAT(`t' . $team . '`,\';' . $u . '\') WHERE `id` = "' . $btl . '" LIMIT 1');
mysql_query("UPDATE users SET `battle` = '" . $btl . "', `zayavka` = 0 WHERE `id` = '" . $u . "' LIMIT 1");
header("Location: fbattle.php");
}
function aligntype($a)
{
$lightaligns = array("1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9");
$darkaligns = array("2.2", "3", "8.21");
$neutralaligns = array("2", "8.31");
if (in_array($a, $lightaligns)) {
return 1;
}
if (in_array($a, $darkaligns)) {
return 2;
}
if (in_array($a, $neutralaligns)) {
return 3;
}
return 0;
}
function ClanImage($clan_id)
{
$clanimg = db::c()->query('SELECT `short` FROM `clans` WHERE `id` = ?i ', $clan_id)->fetch_assoc();
if ($clanimg['short']) {
$clanimg = $clanimg['short'];
} else {
$clanimg = "1x1";
}
return $clanimg;
}
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 GiveKr($id, $kr, $text = "Вы получили ")
{
mysql_query("UPDATE `users` SET `money` = (`money`+{$kr}) WHERE `id` = {$id} LIMIT 1");
if ($text != null) {
addchp($text . $kr . ' кр. ', '{[]}' . nick7($id) . '{[]}');
}
mysql_query("INSERT INTO `delo` (`author`, `pers`, `text`, `type`, `date`) VALUES ('0', '{$id}', '\"" . $user['login'] . "\"" . $text . " " . $kr . " кр. ', '1', '" . time() . "')");
}
function GiveDoblest($id, $dobl, $text = "Вы получили ")
{
mysql_query("UPDATE `users` SET `doblest` = (`doblest`+{$dobl}), `rep_laba` = (`rep_laba`+$dobl) WHERE `id` = {$id} LIMIT 1");
if ($text != null) {
addchp($text . $dobl . ' доблести. ', '{[]}' . nick7($id) . '{[]}');
}
mysql_query("INSERT INTO `delo` (`author`, `pers`, `text`, `type`, `date`) VALUES ('0', '{$id}', '\"" . $user['login'] . "\"" . $text . " " . $dobl . " доблести. ', '1', '" . time() . "')");
}
// полоска НР
function setHP($hp, $maxhp)
{
$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;
}
function echoscroll($slot)
{
global $user;
if ($user['battle']) {
$script = 'fbattle';
} else {
$script = 'main';
}
if ($user['battle'] > 0) $bat = mysql_fetch_array(mysql_query("SELECT `id`, `magic` FROM `battle` WHERE `id` = '{$user['battle']}' LIMIT 1"));
$all_magic = unserialize($bat['magic']);
$dress = mysql_fetch_array(mysql_query("SELECT `id`, `magic`, `name`, `img`, `duration`, `maxdur` FROM `inventory` WHERE `id` = '{$user[$slot]}' LIMIT 1"));
$need_charge = mysql_fetch_array(mysql_query("SELECT `needcharge` FROM `magic` WHERE `id` = '{$dress['magic']}' LIMIT 1"));
if (($user[$slot] > 0) && ($all_magic[$user['id']] < 1 || $need_charge['needcharge'] == 0)) {
$row['id'] = $user[$slot];
if ($dress['magic']) {
$magic = magicinf($dress['magic']);
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)
{
global $user;
$r = '';
if ($user['battle']) {
$script = 'fbattle';
} else {
$script = 'main';
}
$magic = magicinf($dress['includemagic']);
$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 class=\"tooltip\" src='mg2.php?p=" . ($dress['includemagicdex'] / $dress['includemagicmax'] * 100) . "&i={$dress['img']}' style=\"filter:shadow(color=red, direction=90, strength=3);\" title=\"<b>" . $dress['name'] . "</b><br />Прочность " . $dress['duration'] . "/" . $dress['maxdur'] . "" . (($dress['ghp'] > 0) ? "<br />Уровень жизни +{$dress['ghp']}" : "") . (($dress['minu'] > 0) ? "<br />Урон {$dress['minu']}-{$dress['maxu']}" : "") . (($dress['text'] != null) ? "<br />На оружии выгравировано '{$dress['text']}'" : "") . "<br />Встроена магия: <b>" . $magic['name'] . "</b>\" /><br />";
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;
}
$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"
];
function show_eff_inf($u, $type)
{
global $img;
$r = '';
$and = '';
if ($type == 1) {
$and = " AND `type` != 1022";
}
$effs = db::c()->query('SELECT * FROM `effects` WHERE `owner` = ?i'.$and, $u)->fetch_assoc();
if ($type == 1) {
while ($effs) {
if ($effs['type'] == 11 || $effs['type'] == 12 || $effs['type'] == 13 || $effs['type'] == 14) {
if ($effs['type'] == 11) {
$adds = 'Легкая ';
} elseif ($effs['type'] == 12) {
$adds = 'Средняя ';
} elseif ($effs['type'] == 13) {
$adds = 'Тяжелая ';
} elseif ($effs['type'] == 14) {
$adds = 'Неизлечимая ';
} else {
$adds = '';
}
} else {
$adds = '';
}
$r .= '<div>';
$r .= '<img class="image" src="/i/' . $img[$effs['type']] . '" />';
$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) {
if ($effs['type'] == 11 || $effs['type'] == 12 || $effs['type'] == 13 || $effs['type'] == 14) {
if ($effs['type'] == 11) {
$adds = 'Легкая ';
} elseif ($effs['type'] == 12) {
$adds = 'Средняя ';
} elseif ($effs['type'] == 13) {
$adds = 'Тяжелая ';
} elseif ($effs['type'] == 14) {
$adds = 'Неизлечимая ';
} else {
$adds = '';
}
} else {
$adds = '';
}
$r .= '<div>';
$r .= '<img class="image" src="/i/' . $img[$effs['type']] . '" /> <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>';
$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 nick5_1($id, $st)
//{
// if ($id > _BOTSEPARATOR_) {
// $bots = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `id` = ' . $id . ' LIMIT 1;'));
// $id = $bots['prototype'];
// $user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1;"));
// $user['login'] = $bots['name'];
// $user['hp'] = $bots['hp'];
// $user['id'] = $bots['id'];
// } else {
// $user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1;"));
// }
//
// 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'] = '??';
// $user['mana'] = '??';
// $user['maxmana'] = '??';
// }
// $align = ($user['align'] > 0 ? $user['align'] : "0");
// if ($user['klan'] != '') {
// $klan = '<img title="' . ClanImage($user['klan']) . '" src="i/klan/' . ClanImage($user['klan']) . '.gif" />';
// }
// $userb = "<img src=\"i/align_" . $align . ".gif\">" . $klan . $user['login'] . " [" . $user['level'] . "]<a href=/inf.php?" . $user['id'] . " target=_blank><IMG SRC=\"i/inf.gif\" WIDTH=12 HEIGHT=11 ALT=\"Инф. о " . $user['login'] . "\"></a>";
// return "<span class={$st}>" . $userb . "</span>";
// }
//}
function del_efs($uid, $id, $type)
{
global $user;
$arr = [2, 3, 4, 5, 8, 10, 11, 12, 13, 14, 20];
if ($uid == $user['id']) {
if ($id != null) {
if (!in_array($type, $arr)) {
db::c()->query('DELETE FROM `effects` WHERE `owner` = ?i AND `id` = ?i', $uid, $id);
if ($type == 1022) {
db::c()->query('UPDATE `users` SET `invis` = ?i WHERE `id` = ?i', 0, $uid);
$user['invis'] = 0;
}
err('Эффект удалён.');
} else {
err('Данный эффект нельзя удалить.');
}
}
}
}
function haseffect($data, $type)
{
foreach ($data['effects'] as $k => $v) {
if ($v['type'] == $type) {
return $k;
}
}
return false;
}
function addictval($a)
{
$l = 0;
$step = 300;
$curr = 0;
while (true) {
if ($a < $curr + $step) return $l;
$l++;
$curr += $step;
$step += 40;
if ($l == 25) return $l;
}
}
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;
}
function regenhp($us, $update = 1)
{
global $user;
if ($us['hp'] < $us['maxhp'] && time() > $us['fullhptime']) {
$fulltime = timetoheals($us);
$delta = ceil((time() - $us['fullhptime']) / $fulltime * $us['maxhp']);
if ($delta > 0) {
$us['hp'] = min($us['hp'] + $delta, $us['maxhp']);
if ($update) {
mysql_query("UPDATE `users` SET `hp` = if(`hp`+$delta > `maxhp`, `maxhp`, `hp`+$delta), `fullhptime` = '" . time() . "' WHERE `id` = '$us[id]' LIMIT 1");
}
if ($us['id'] == $user['id']) {
$user['hp'] = $us['hp'];
}
}
}
return $us['hp'];
}
function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXME 37 запросов! ТРИДЦАТЬ СЕМЬ! Чтобы отобразить предметы на персонаже.
{
global $rooms;
$r = '';
if ($id > _BOTSEPARATOR_) { //FIXME Оно как бы и работает, но два тяжёлющих запроса в самые крупные базы, чтобы подменить два значения...
// $bots = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `id` = "' . (int)$id . '" LIMIT 1'));
// $id = $bots['prototype'];
// $user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
// $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'];
die('Неустранимая ошибка в showinf_pers(), обратитесь к разработчику.');
} else {
// $user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
$user = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i', $id)->fetch_assoc();
$invis = $user['invis'];
}
if ($battle && $invis && $user['id'] != $_SESSION['uid']) {
$user['level'] = '??';
$user['login'] = '</a><b><i>невидимка</i></b>';
$user['align'] = '0';
$user['klan'] = '';
$user['id'] = '';
$user['hp'] = '??';
$user['maxhp'] = '??';
$user['sila'] = '??';
$user['lovk'] = '??';
$user['inta'] = '??';
$user['vinos'] = '??';
$user['intel'] = '??';
$user['deal'] = 0;
$user['sergi'] = 0;
$user['kulon'] = 0;
$user['r1'] = 0;
$user['r2'] = 0;
$user['r3'] = 0;
$user['weap'] = 0;
$user['bron'] = 0;
$user['helm'] = 0;
$user['perchi'] = 0;
$user['shit'] = 0;
$user['boots'] = 0;
$user['shadow'] = 'invis.gif';
}
$r .= '<center>';
if ($user['deal'] > 0) {
$deal = '💰 ';
}
$r .= "<a href=\"javascript: top.AddToPrivate('$user[login]', top.CtrlPress)\" target=\"refreshed\"><img src=\"/i/lock.gif\" width=\"20\" height=\"15\" /></a>$deal" . ($user['align'] > 0 ? "<img src=\"/i/align_" . $user['align'] . ".gif\" />" : "") . ($user['klan'] != '' ? '<img title="' . ClanImage($user['klan']) . '" src="i/klan/' . ClanImage($user['klan']) . '.gif" />' : "") . "<b>$user[login]</b> [";
$r .= $user['level'];
$r .= "]<a href=\"inf.php?$user[id]\" target=\"_blank\"><img src=\"/i/inf.gif\" width=\"12\" height=\"11\" /></a>";
if ($user['block']) {
$r .= "<br /><font class=\"private\">Персонаж заблокирован</font>";
}
$r .= "<table cellspacing=0 cellpadding=0><tr><td colspan=3 width=100%>";
$r .= setHP($user['hp'], $user['maxhp'], $battle);
$r .= '</td></tr>';
if (($user['level'] > 3) && !$pas && !$battle) {
$r .= '<tr><td colspan=3>';
$r .= echoscroll('m1');
$r .= echoscroll('m2');
$r .= echoscroll('m3');
$r .= echoscroll('m4');
$r .= echoscroll('m5');
$r .= '<br /></td></tr>';
$r .= '<tr><td colspan=3>';
$r .= echoscroll('m6') . '' . echoscroll('m7') . '' . echoscroll('m8') . '' . echoscroll('m9') . '' . echoscroll('m10');
$r .= '</td></tr>';
}
$r .= '<tr><td width=62 valign=top><table width=100% cellspacing=0 cellpadding=0><tr><td>';
if ($user['sergi'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['sergi'])->fetch_assoc();
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
$r .= showhrefmagic($dress);
} else {
$r .= '<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 {
$r .= '<img src="i/w1.gif" width="60" height="20" class="tooltip" title="Пустой слот Серьги" />';
}
$r .= '</td></tr><tr><td>';
if ($user['kulon'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['kulon'])->fetch_assoc();
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
$r .= showhrefmagic($dress);
} else {
$r .= '<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 {
$r .= '<img src="i/w2.gif" width=60 height=20 class="tooltip" title="Пустой слот Ожерелье" />';
}
$r .= '</td></tr><tr><td>';
if ($user['weap'] > 0) {
$dress = db::c()->query('SELECT `minu`, `maxu`, `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['weap'])->fetch_assoc();
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
$r .= showhrefmagic($dress);
} else {
$r .= '<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 {
$r .= '<img class=\'tooltip\' src="i/w3.gif" width=60 height=60 title="Пустой слот Оружие" />';
}
$r .= '</td></tr><tr><td>';
if ($user['bron'] > 0 || $user['rybax'] > 0 || $user['plaw'] > 0) {
$title = '';
if ($user['plaw']) {
$d = $user['plaw'];
if ($user['bron']) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['bron'])->fetch_assoc();
$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 `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['rybax'])->fetch_assoc();
$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 `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['rybax'])->fetch_assoc();
$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'];
}
if ($main == true) {
$title = '';
}
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $d)->fetch_assoc();
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
$r .= showhrefmagic($dress);
} else {
$r .= '<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 {
$r .= '<img class=\'tooltip\' src="i/w4.gif" width=60 height=80 title="Пустой слот Броня" />';
}
$r .= '</td></tr><tr><td><table cellspacing=0 cellpadding=0><tr><td>';
if ($user['r1'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['r1'])->fetch_assoc();
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
$r .= showhrefmagic($dress);
} else {
$r .= '<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 {
$r .= '<img class=\'tooltip\' src="i/w6.gif" width=20 height=20 title="Пустой слот Кольцо" />';
}
$r .= '</td><td>';
if ($user['r2'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['r2'])->fetch_assoc();
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
$r .= showhrefmagic($dress);
} else {
$r .= '<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 {
$r .= '<img class=\'tooltip\' src="i/w6.gif" width=20 height=20 title="Пустой слот Кольцо" />';
}
$r .= '</td><td>';
if ($user['r3'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['r3'])->fetch_assoc();
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
$r .= showhrefmagic($dress);
} else {
$r .= '<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 {
$r .= '<img class=\'tooltip\' src="i/w6.gif" width=20 height=20 title="Пустой слот Кольцо" />';
}
$r .= '</td></tr></table></td></tr></table></td>';
$r .= '<td valign=top><img src="i/shadow/' . $user['shadow'] . '" width="76" height="209" /></td><td width="62" valign=top><table width=100% cellspacing=0 cellpadding=0><tr><td>';
if ($user['helm'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['helm'])->fetch_assoc();
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
$r .= showhrefmagic($dress);
} else {
$r .= '<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 {
$r .= '<img class=\'tooltip\' src="i/w9.gif" width=60 height=60 title="Пустой слот Шлем" />';
}
$r .= '</td></tr><tr><td>';
if ($user['perchi'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['perchi'])->fetch_assoc();
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
$r .= showhrefmagic($dress);
} else {
$r .= '<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 {
$r .= '<img class=\'tooltip\' src="i/w11.gif" width=60 height=40 alt="Пустой слот Перчатки" />';
}
$r .= '</td></tr><tr><td>';
if ($user['shit'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['shit'])->fetch_assoc();
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
$r .= showhrefmagic($dress);
} else {
$r .= '<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 {
$r .= '<img class=\'tooltip\' src="i/w10.gif" width=60 height=60 title="Пустой слот Щит" />';
}
$r .= '</td></tr><tr><td>';
if ($user['boots'] > 0) {
$dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['boots'])->fetch_assoc();
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
$r .= showhrefmagic($dress);
} else {
$r .= '<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 {
$r .= '<img class=\'tooltip\' src="i/w12.gif" width=60 height=40 title="Пустой слот Oбувь" />';
}
if ($invis) {
$data['id'] = null;
} else {
$data = db::c()->query('SELECT * FROM `online` WHERE `date` >= ?i AND `id` = ?i', time()-60, $user['id'])->fetch_assoc();
}
$r .= '</td></tr></table></td></tr></table>';
$ru_1 = show_rune(1, $user['id']);
$ru_2 = show_rune(2, $user['id']);
$ru_3 = show_rune(3, $user['id']);
$r .= '<table cellspacing="0" cellpadding="0" border="0" style="background: url(i/runes_slots.jpg) no-repeat center bottom;"><tbody><tr><td width="59" height="48" align="right">' . $ru_1 . '</td><td width="74" height="48" align="center">' . $ru_2 . '</td><td width="57" height="48" align="left">' . $ru_3 . '</td></tr></tbody></table></center>';
$r .= '<center><table cellPadding=0 cellSpacing=0 width="100%"><tbody>';
if (!$battle) {
if ($pas) {
$r .= '<tr><td align=middle colSpan=2><b><small>'.GAMEDOMAIN.'</small></b></td></tr><tr><td colSpan=2><small>';
$online = db::c()->query('SELECT `u`.*, `o`.`date`, `u`.*, `o`.`real_time` FROM `users` AS `u`, `online` AS `o` WHERE `u`.`id` = `o`.`id` AND `u`.`id` = ?i ', $user['id'])->fetch_assoc();
if ($invis) {
$invis = db::c()->query('SELECT `time` FROM `effects` WHERE `owner` = ?i AND `type` = 1022', $user['id'])->fetch_assoc();//FIXME Тип содержит число, невозможное в базе.
}
if ($invis > time()) {
$data['id'] = null;
$online['date'] -= 60 * 120 - ($invis - time());
}
if ($data['id'] != null && $user['id'] != 326) {
if ($data['room'] > 500 && $data['room'] < 561) {
$rrm = 'Башня смерти, участвует в турнире';
} else {
$rrm = $rooms[$data['room']];
}
$r .= '<center>Персонаж сейчас находится в игре.<b>"' . $rrm . '"</b></center>';
} else {
$r .= "<center>Персонаж не в игре.</center>";
}
if ($user['battle'] > 0 && $user['invis'] == 0) {
$r .= '<br />Персонаж сейчас в <a target="_blank" href="logs.php?log=' . $user['battle'] . '">поединке</a>';
}
$r .= '</center></small>';
$r .= '<div class="effectList" style="padding-top: 15px;">';
$r .= show_eff_inf($user['id'], 1);
$r .= '</div></td></tr>';
}
$r .= '</tbody></table></center></td>';
$r .= '<td valign=top ' . (!$pas ? "style='width: 450px;'" : "") . '>';
$r .= 'Сила: ' . $user['sila'] . '<br />';
$r .= 'Ловкость: ' . $user['lovk'] . '<br />';
$r .= 'Интуиция: ' . $user['inta'] . '<br />';
$r .= 'Выносливость: ' . $user['vinos'] . '<br />';
if ($user['level'] > 3) {
$r .= 'Интеллект: ' . $user['intel'] . '<br />';
}
if (!$pas && (($user['stats'] > 0) || ($user['master'] > 0))) {
$r .= '<a href="main.php?edit=1">+ Способности</a><br />';
}
$r .= '<hr style=\'width: 50%; float: left;\' /><br />';
if (!$pas) {
$r .= 'Опыт: <b>' . $user['exp'] . '</b> <a href=\'exptable.html\' target=\'_blank\'>(' . $user['nextup'] . ')</a><br /></small>';
}
$r .= 'Уровень: ' . $user['level'] . '<br /></small>';
$r .= 'Побед:&nbsp;<span>' . $user['win'] . '</span></small><br />';
$r .= 'Поражений:&nbsp;<span>' . $user['lose'] . '</span></small><br />';
$r .= 'Ничьих:&nbsp;<span>' . $user['nich'] . '</span></small><br />';
if ($user['klan'] && !$pas) {
$r .= "Клан: " . ClanImage($user['klan']) . "<br /></small>";
} elseif ($user['klan']) {
// $clann = mysql_fetch_array(mysql_query("SELECT `name`,`short` FROM `clans` WHERE `id` = '{$user['klan']}' LIMIT 1"));
$clann = db::c()->query('SELECT `name`,`short` FROM `clans` WHERE `id` = ?i', $user['klan'])->fetch_assoc();
$r .= "<a href='/encicl/index.php?section=99&page=clans1&clan=" . close_dangling_tags($clann['short']) . "' target='_blank'>" . close_dangling_tags($clann['name']) . "</a> " . close_dangling_tags($user['status']) . "</small><br />";
} elseif ($user['align'] > 0) {
if ((int)$user['align'] == 1) {
$r .= "<b>Орден Паладинов</b> {$user['status']}<br /></small>";
}
if ($user['align'] == 3) {
$r .= "<b>Темное братство</b><br /></small>";
}
if ($user['align'] == 2) {
$r .= "<b>Нейтральное братство</b><br /></small>";
}
if ($user['align'] == 6) {
$r .= "<b>Светлое братство</b><br /></small>";
}
}
if ($pas) {
$date1 = explode(" ", $user['borntime']);
$date2 = explode("-", $date1[0]);
$date3 = "" . $date2[2] . "-" . $date2[1] . "-" . $date2[0] . "";
$r .= 'Место рождения: <b>' . $user['borncity'] . '</b><br />';
$r .= 'День рождения персонажа: ' . $date3 . '<br /></small>';
$r .= '<hr />';
if ($user['palcom'] && $pas) {
$r .= "Сообщение от Паладинов о причине отправки в хаос/блокировке: <br /><font class=private>{$user['palcom']}</font>";
}
$ischaos = db::c()->query('SELECT `time` FROM `effects` WHERE `owner` = ?i AND `type` = 4 ', $user['id'])->fetch_assoc();
if ($ischaos['time']) {
$r .= "<br />Хаос еще <i>" . timeOut($ischaos['time'] - time()) . "</i>";
}
}
} 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 />';
if ($user['level'] > 3) {
$r .= 'Интеллект: ' . $user['intel'] . '<br />';
}
$r .= '</td></tr></table>';
}
return $r;
}
function showpersout($id, $pas = 0, $battle = 0, $me = 0)
{
global $rooms;
if ($id > _BOTSEPARATOR_) {
$bots = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `id` = ' . (int)$id . ' LIMIT 1'));
$id = $bots['prototype'];
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
$user['login'] = $bots['name'];
$user['hp'] = $bots['hp'];
} else {
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1"));
$invis = $user["invis"];
}
if ($battle && $invis && $user['id'] != $_SESSION['uid']) {
$user['level'] = '??';
$user['login'] = '</a><b><i>невидимка</i></b>';
$user['align'] = '0';
$user['klan'] = '';
$user['id'] = '';
$user['hp'] = '??';
$user['maxhp'] = '??';
$user['sila'] = '??';
$user['lovk'] = '??';
$user['inta'] = '??';
$user['vinos'] = '??';
$user['intel'] = '??';
$user['deal'] = 0;
$user['sergi'] = 0;
$user['kulon'] = 0;
$user['r1'] = 0;
$user['r2'] = 0;
$user['r3'] = 0;
$user['weap'] = 0;
$user['bron'] = 0;
$user['helm'] = 0;
$user['perchi'] = 0;
$user['shit'] = 0;
$user['boots'] = 0;
$user['shadow'] = 'invis.gif';
}
echo '<CENTER>';
if ($user['deal'] > 0) {
$deal = '<img src=\'i/deal.gif\' /> ';
} else {
$deal = '';
}
echo "<A HREF=\"javascript:top.AddToPrivate('$user[login]', top.CtrlPress)\" target=refreshed><img src=\"/i/lock.gif\" width=20 height=15></A>$deal" . ($user['align'] > 0 ? "<img src=\"/i/align_" . $user['align'] . ".gif\">" : "") . ($user['klan'] <> '' ? '<img title="' . ClanImage($user['klan']) . '" src="i/klan/' . ClanImage($user['klan']) . '.gif">' : "") . "<B>$user[login]</B> [";
echo $user['level'];
echo "]<a href=inf.php?$user[id] target=_blank><IMG SRC=/i/inf.gif WIDTH=12 HEIGHT=11 ALT=\"Инф. о $user[login]\"></a>";
if ($user['block']) {
echo "<BR><FONT class=private>Персонаж заблокирован!</font>";
}
?>
<TABLE cellspacing=0 cellpadding=0>
<tr>
<TD colspan=3 width=100%>
<?
echo setHP($user['hp'], $user['maxhp'], $battle);
?>
</td>
</tr>
<?
if (($user['level'] > 3) && !$pas && !$battle) { ?>
<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>
<?
} ?>
<TR>
<TD width=62 valign=top>
<TABLE width=100% cellspacing=0 cellpadding=0>
<TR>
<TD><?php
if ($user['sergi'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['sergi']}' LIMIT 1;"));
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
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/w1.gif" width=62 height=20 class="tooltip" title="Пустой слот Серьги" />';
}
?></TD>
</TR>
<TR>
<TD><?php
if ($user['kulon'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['kulon']}' LIMIT 1;"));
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
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 = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['weap']}' LIMIT 1;"));
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
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 = '';
if ($user['plaw']) {
$d = $user['plaw'];
if ($user['bron']) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '$user[bron]' LIMIT 1"));
$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 = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '$user[rybax]' LIMIT 1"));
$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 = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '$user[rybax]' LIMIT 1"));
$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 = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$d}' LIMIT 1"));
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
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 = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['r1']}' LIMIT 1;"));
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
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 = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['r2']}' LIMIT 1;"));
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
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 = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['r3']}' LIMIT 1;"));
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
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 = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['helm']}' LIMIT 1;"));
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
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 = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['perchi']}' LIMIT 1;"));
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
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 = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['shit']}' LIMIT 1;"));
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
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 = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['boots']}' LIMIT 1;"));
if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) {
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бувь" />';
}
if ($invis) $data["id"] = null; else
$data = mysql_fetch_array(mysql_query("SELECT * FROM `online` WHERE `date` >= " . (time() - 60) . " AND `id` = " . $user['id'] . ";"));
$dd = mysql_query("SELECT * FROM `effects` WHERE `owner` = " . $user['id'] . ";");
?></A></TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
<table cellspacing="0" cellpadding="0" border="0"
style="background: url('i/runes_slots.jpg') no-repeat center bottom;">
<tbody>
<tr>
<td width="59" height="48" align="right"><? echo show_rune(1, $user['id']); ?></td>
<td width="74" height="48" align="center"><? echo show_rune(2, $user['id']); ?></td>
<td width="57" height="48" align="left"><? echo show_rune(3, $user['id']); ?></td>
</tr>
</tbody>
</table>
</CENTER>
<CENTER>
<TABLE cellPadding=0 cellSpacing=0 width="100%">
<TBODY>
<?
if (!$battle) {
?>
<? if ($pas) { ?>
<TR>
<TD align=middle colSpan=2><B>
<small><?=GAMEDOMAIN?></small>
</B></TD>
</TR>
<TR>
<TD colSpan=2>
<SMALL><?php
$online = mysql_fetch_array(mysql_query('SELECT u.* ,o.date,u.* ,o.real_time FROM `users` AS u, `online` AS o WHERE u.`id` = o.`id` AND u.`id` = \'' . $user['id'] . '\' LIMIT 1;'));
if ($invis) $invis = mysql_fetch_row(mysql_query("select `time` from effects where owner='$user1[id]' and type='1022'"));
if ($invis > time()) {
$data['id'] = null;
$online['date'] -= 60 * 120 - ($invis - time());
}
if ($data['id'] != null && $user['id'] != 326) {
if ($data['room'] > 500 && $data['room'] < 561) {
$rrm = 'Башня смерти, участвует в турнире';
} else {
$rrm = $rooms[$data['room']];
}
echo '<center>Персонаж сейчас находится в игре.<B>"' . $rrm . '"</B></center>';
} else {
echo "<center>Персонаж не в игре.</center>";
}
?><?
if ($user['battle'] > 0 && $user['invis'] == 0) {
echo '<BR>Персонаж сейчас в <a target=_blank href="logs.php?log=', $user['battle'], '">поединке</a>';
}
?></CENTER></SMALL>
<div class="effectList" style="padding-top: 15px;">
<? echo show_eff_inf($user['id'], 1); ?>
</div>
</TD></TR><? }
if ($trt) {
echo "<TR><TD><IMG height=25 src=\"i/travma.gif\" width=40></TD><TD><SMALL>У персонажа $trt травма.</SMALL></TD></TR>";
}
while ($row = mysql_fetch_array($dd)) {
if ($row['time'] < time()) {
$row['time'] = time();
}
if ($row['type'] == 21) {
$param_bonus = array();
$param_bonus['sila'] = $row['sila'];
$param_bonus['lovk'] = $row['lovk'];
$param_bonus['inta'] = $row['inta'];
$param_bonus['vinos'] = $row['vinos'];
}
}
?>
</TBODY></TABLE></CENTER>
</TD>
<TD valign=top <?= (!$pas ? "style='width:450px;'" : "") ?>
?>
Сила:
<?php
echo $user['sila'];
if ($param_bonus['sila']) echo " <b><font color=green>(+" . $param_bonus['sila'] . ")</font></b>";
?><BR>
Ловкость: <?php
echo $user['lovk'];
if ($param_bonus['lovk']) echo " <b><font color=green>(+" . $param_bonus['lovk'] . ")</font></b>";
?><BR>
Интуиция: <?php
echo $user['inta'];
if ($param_bonus['inta']) echo " <b><font color=green>(+" . $param_bonus['inta'] . ")</font></b>";
?><BR>
Выносливость: <?php
echo $user['vinos'];
if ($param_bonus['vinos']) echo " <b><font color=green>(+" . $param_bonus['vinos'] . ")</font></b>";
?><BR>
<?php
if ($user['level'] > 3) {
?>
Интеллект: <?= $user['intel'] ?><BR></small>
<?php
}
if (!$pas && (($user['stats'] > 0) || ($user['master'] > 0))) {
?>
<a href="main.php?edit=1">+ Способности</a>
<?
}
?>
<HR>
<?php
if (!$pas) {
?>
Опыт: <b><?= $user['exp'] ?></b> <a href='exptable.html' target=_blank>(<?= $user['nextup'] ?>)</a>
<BR></small>
<?
} ?>
Уровень: <?= $user['level'] ?><BR></small>
<? if ($user['id'] != 233 && $user['id'] != 234 && $user['id'] != 235) { ?>
Побед:&nbsp;<span title='Побед: <?= $user['win'] ?>'><?= $user['win'] ?></span><br>
Поражений:&nbsp;<span title='Поражений: <?= $user['lose'] ?>'><?= $user['lose'] ?></span><br>
Ничьих:&nbsp;<span title='Ничьих: <?= $user['nich'] ?>'><?= $user['nich'] ?></span><br>
<? } ?>
<?php
$my_inf = mysql_fetch_assoc(mysql_query("SELECT `align`,`deal` FROM `users` WHERE `id`='" . $_SESSION['uid'] . "'"));
if (!$pas || ($my_inf['align'] == '2.99' || $my_inf['deal'] == 1)) {
$ekr_bank = mysql_fetch_assoc(mysql_query("SELECT SUM(`ekr`) AS `bank_ekr`,SUM(`cr`) AS `bank_cr` FROM `bank` WHERE `owner`='" . $user['id'] . "'"));
?>
Деньги: <b><?= $user['money'] ?></b> кр.<br/>
В банке: <b><?= $ekr_bank['bank_cr'] ?></b> кр. / <b><?= $ekr_bank['bank_ekr'] ?></b> eкр.</small><br>
<?
}
if ($user['klan'] && !$pas) {
echo "Клан: " . ClanImage($user['klan']) . "<BR></small>";
} elseif ($user['klan']) {
$clann = mysql_fetch_array(mysql_query("SELECT `name`,`short` FROM `clans` WHERE `id`='{$user['klan']}' LIMIT 1;"));
$clanname = $clann['name'];
$clannamesh = $clann['short'];
echo "<a href='encicl/index.php?section=99&page=clans1&clan=" . close_dangling_tags($clannamesh) . "' target=_blank>" . close_dangling_tags($clanname) . "</a> - " . close_dangling_tags($user['status']) . "</small><BR />";
} elseif ($user['align'] > 0) {
if (($user['align'] > 1) && ($user['align'] < 2)) echo "<b>Орден Паладинов</B> {$user['status']}<BR></small>";
if (($user['align'] == 3)) echo "<b>Темное братство</B><BR></small>";
if (($user['align'] == 2)) echo "<b>Нейтральное братство</B><BR></small>";
if (($user['align'] == 6)) echo "<b>Светлое братство</B><BR></small>";
}
if ($pas) {
$date1 = explode(" ", $user['borntime']);
$date2 = explode("-", $date1[0]);
$date3 = "" . $date2[2] . "-" . $date2[1] . "-" . $date2[0] . "";
if ($user['id'] >= 233 && $user['id'] <= 235) {
$date3 = '<b>До начала времён ...</b>';
}
?>
Место рождения: <b><?= $user['borncity'] ?></b><BR>
День рождения персонажа: <?= $date3 ?><br/></small>
<?
echo("<hr>");
if ($user['palcom'] && $pas) {
echo "Сообщение от Паладинов о причине отправки в хаос/блокировке: <br /><font class=private>";
echo "{$user['palcom']}</font>";
}
$effect = db::c()->query('SELECT `time` FROM `effects` WHERE `owner` = ?i AND `type` = ?i', $user['id'], 4)->fetch_assoc();
if ($effect['time']) {
echo "<br />Хаос еще <i>" . timeOut($effect['time'] - time()) . "</i>";
}
}
} else {
?>
<TR>
<TD colSpan=2 style="padding-left:25px;">
Сила: <?= $user['sila'] ?><BR>
Ловкость: <?= $user['lovk'] ?><BR>
Интуиция: <?= $user['inta'] ?><BR>
Выносливость: <?= $user['vinos'] ?><BR>
<?php if ($user['level'] > 3): ?>
Интеллект: <?= $user['intel'] ?><BR>
<?php endif ?>
<?php if ($user['level'] > 6): ?>
Мудрость: <?= $user['mudra'] ?><BR>
<?php endif ?>
</td>
</tr></table>
<?
}
}
function stack($it_id)
{
global $user;
$it_id = (int)$it_id;
$stack = mysql_query("SELECT * FROM `inventory` WHERE `id` = '" . $it_id . "' AND `owner` = " . $user['id'] . " LIMIT 1");
if (mysql_num_rows($stack) == 1) {
$stack = mysql_fetch_array($stack);
$similar = mysql_fetch_array(mysql_query("SELECT SUM(`koll`) FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` != '" . $stack['id'] . "' AND `name` = '" . $stack['name'] . "' AND `present` = '" . $stack['present'] . "' AND `duration` = '" . $stack['duration'] . "' AND `maxdur` = '" . $stack['maxdur'] . "' AND `laba` = '" . $stack['laba'] . "' AND `gmeshok` = '" . $stack['gmeshok'] . "' AND `dressed` = 0 AND `goden` = 0 AND `setsale` = 0 AND `koll` >= 1 AND `isrep` = '" . $stack['isrep'] . "' AND FORMAT(`cost`/`koll`, 2) = FORMAT(" . ($stack['cost'] / $stack['koll']) . ", 2) AND FORMAT(`point`/`koll`, 2) = FORMAT(" . ($stack['point'] / $stack['koll']) . ", 2) AND FORMAT(`bcost`/`koll`, 2) = FORMAT(" . ($stack['bcost'] / $stack['koll']) . ", 2)"));
if ($similar[0] >= 1) {
mysql_query("UPDATE `inventory` SET `cost` = (`cost`+`cost`/`koll`*" . $similar[0] . "), `point` = (`point`+`point`/`koll`*" . $similar[0] . "), `bcost` = (`bcost`+`bcost`/`koll`*" . $similar[0] . "), `massa` = (`massa`+`massa`/`koll`*" . $similar[0] . "), `koll` = (`koll`+" . $similar[0] . "), `gmeshok` = (`gmeshok`+`gmeshok`*" . $similar[0] . ") WHERE `id` = '" . $stack['id'] . "' LIMIT 1");
mysql_query("DELETE FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` != '" . $stack['id'] . "' AND `name` = '" . $stack['name'] . "' AND `present` = '" . $stack['present'] . "' AND `duration` = '" . $stack['duration'] . "' AND `maxdur` = '" . $stack['maxdur'] . "' AND `dressed` = 0 AND `goden` = 0 AND `koll` >= 1 AND `setsale` = 0 AND `gmeshok` = '" . $stack['gmeshok'] . "' AND `laba` = '" . $stack['laba'] . "' AND `isrep` = '" . $stack['isrep'] . "' AND FORMAT(`cost`/`koll`, 2)=FORMAT(" . $stack['cost'] / $stack['koll'] . ", 2) AND FORMAT(`point`/`koll`, 2) = FORMAT(" . ($stack['point'] / $stack['koll']) . ", 2) AND FORMAT(`bcost`/`koll`, 2) = FORMAT(" . ($stack['bcost'] / $stack['koll']) . ", 2) ");
}
}
}
/**
* @param $time
* @param $vars
* @param $vls
* @param $uid
* @return bool
*/
function addActions($time, $vars, $vls, $uid)
{
db::c()->query('LOCK TABLES `actions` WRITE');
$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, $_SERVER['HTTP_X_REAL_IP'], $vls);
db::c()->query('UNLOCK TABLES');
if ($ins) {
return true;
} else {
return false;
}
}
function unstack($it_id, $it_count)
{
global $user;
$it_id = (int)$it_id;
$it_count = (int)$it_count;
$it_count = abs($it_count);
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `owner` = " . $user['id'] . " AND `id` = '" . mysql_real_escape_string($it_id) . "' LIMIT 1"));
$prototype = mysql_fetch_array(mysql_query('SELECT `id`, `gmeshok` FROM `shop` WHERE `id` = "' . $dress['prototype'] . '" LIMIT 1'));
if (isset($dress['id'])) {
if ($it_count <= $dress['koll'] && $it_count > 0) {
if ($dress['koll'] == $it_count) {
mysql_query('DELETE FROM `inventory` WHERE `id` = "' . $dress['id'] . '" AND `owner` = "' . $user['id'] . '" LIMIT 1');
} else {
if ($dress['gmeshok'] > 0) {
$sqla = ", `gmeshok` = `gmeshok`-" . $prototype['gmeshok'];
} else {
$sqla = "";
}
mysql_query("UPDATE `inventory` SET `cost` = (`cost`-`cost`/`koll`*" . $it_count . "), `point` = (`point`-`point`/`koll`*" . $it_count . "), `bcost` = (`bcost`-`bcost`/`koll`*" . $it_count . "), `massa` = (`massa`-`massa`/`koll`*" . $it_count . "), `koll` = (`koll`-" . $it_count . ")$sqla WHERE `id` = '$dress[id]' AND `owner` = '$user[id]' LIMIT 1");
}
mysql_query("INSERT INTO `inventory` (`name`, `upgrade`, `modif`, `podgon`, `duration`, `maxdur`, `cost`, `bcost`, `point`, `nlevel`, `nsila`, `nlovk`, `ninta`, `nvinos`, `nintel`, `nmudra`, `nnoj`, `ntopor`, `ndubina`, `nmech`, `nalign`, `minu`, `maxu`, `gsila`, `glovk`, `ginta`, `gintel`, `ghp`, `mfkrit`, `mfakrit`, `mfuvorot`, `mfauvorot`, `gnoj`, `gtopor`, `gdubina`, `gmech`, `img`, `text`, `owner`, `dressed`, `bron1`, `bron2`, `bron3`, `bron4`, `dategoden`, `magic`, `type`, `present`, `sharped`, `massa`, `goden`, `needident`, `nfire`, `nwater`, `nair`, `nearth`, `nlight`, `ngray`, `ndark`, `gfire`, `gwater`, `gair`, `gearth`, `glight`, `ggray`, `gdark`, `free_bron`, `free_stat`, `free_mf`, `letter`, `isrep`, `update`, `setsale`, `prototype`, `otdel`, `bs`, `gmp`, `includemagic`, `includemagicdex`, `includemagicmax`, `includemagicname`, `includemagicuses`, `includemagiccost`, `gmeshok`, `tradesale`, `podzem`, `x_mis`, `artefact`, `destinyinv`, `encicl`, `foronetrip`, `koll`) VALUES ('" . $dress['name'] . "', '" . $dress['upgrade'] . "', '" . $dress['modif'] . "', '" . $dress['podgon'] . "', '" . $dress['duration'] . "', '" . $dress['maxdur'] . "', '" . ($dress['cost'] / $dress['koll'] * $it_count) . "', '" . ($dress['bcost'] / $dress['koll'] * $it_count) . "', '" . ($dress['point'] / $dress['koll'] * $it_count) . "', '" . $dress['nlevel'] . "', '" . $dress['nsila'] . "', '" . $dress['nlovk'] . "', '" . $dress['ninta'] . "', '" . $dress['nvinos'] . "', '" . $dress['nintel'] . "', '" . $dress['nmudra'] . "', '" . $dress['nnoj'] . "', '" . $dress['ntopor'] . "', '" . $dress['ndubina'] . "', '" . $dress['nmech'] . "', '" . $dress['nalign'] . "', '" . $dress['minu'] . "', '" . $dress['maxu'] . "', '" . $dress['gsila'] . "', '" . $dress['glovk'] . "', '" . $dress['ginta'] . "', '" . $dress['gintel'] . "', '" . $dress['ghp'] . "', '" . $dress['mfkrit'] . "', '" . $dress['mfakrit'] . "', '" . $dress['mfuvorot'] . "', '" . $dress['mfauvorot'] . "', '" . $dress['gnoj'] . "', '" . $dress['gtopor'] . "', '" . $dress['gdubina'] . "', '" . $dress['gmech'] . "', '" . $dress['img'] . "', '" . $dress['text'] . "', '" . $dress['owner'] . "', '" . $dress['dressed'] . "', '" . $dress['bron1'] . "', '" . $dress['bron2'] . "', '" . $dress['bron3'] . "', '" . $dress['bron4'] . "', '" . $dress['dategoden'] . "', '" . $dress['magic'] . "', '" . $dress['type'] . "', '" . $dress['present'] . "', '" . $dress['sharped'] . "', '" . ($dress['massa'] / $dress['koll'] * $it_count) . "', '" . $dress['goden'] . "', '" . $dress['needident'] . "', '" . $dress['nfire'] . "', '" . $dress['nwater'] . "', '" . $dress['nair'] . "', '" . $dress['nearth'] . "', '" . $dress['nlight'] . "', '" . $dress['ngray'] . "', '" . $dress['ndark'] . "', '" . $dress['gfire'] . "', '" . $dress['gwater'] . "', '" . $dress['gair'] . "', '" . $dress['gearth'] . "', '" . $dress['glight'] . "', '" . $dress['ggray'] . "', '" . $dress['gdark'] . "', '" . $dress['free_bron'] . "', '" . $dress['free_bron'] . "', '" . $dress['free_mf'] . "', '" . $dress['letter'] . "', '" . $dress['isrep'] . "', '" . $dress['update'] . "', '" . $dress['setsale'] . "', '" . $dress['prototype'] . "', '" . $dress['otdel'] . "', '" . $dress['bs'] . "', '" . $dress['gmp'] . "', '" . $dress['includemagic'] . "', '" . $dress['includemagicdex'] . "', '" . $dress['includemagicmax'] . "', '" . $dress['includemagicname'] . "', '" . $dress['ggrincludemagicusesay'] . "', '" . $dress['includemagiccost'] . "', '" . ($dress['gmeshok'] / $dress['koll'] * $it_count) . "', '" . $dress['tradesale'] . "', '" . $dress['podzem'] . "', '" . $dress['x_mis'] . "', '" . $dress['artefact'] . "', '" . $dress['destinyinv'] . "', '" . $dress['encicl'] . "', '" . $dress['foronetrip'] . "', '" . $it_count . "')");
return mysql_insert_id();
}
}
}
function plusorminus($n, $shownum = 1)
{
if (!$shownum) {
if ($n >= 2) return "++";
if ($n > 0) return "+";
if ($n < 0) return "-";
}
if ($n >= 0) {
return "+$n";
} else {
return $n;
}
}
/**
* Показать предмет в магазине
*
* @param $it
* @param string $from
* @return string
*/
function show_shop_items($it, $from = 'shop')
{
global $user;
$r = '';
$item = mysql_fetch_array(mysql_query("SELECT * FROM `{$from}` WHERE `id` = '{$it}' LIMIT 1"));
if (isset($item['id'])) {
$magic = magicinf($item['magic']);
$incmagic = mysql_fetch_array(mysql_query('SELECT * FROM `magic` WHERE `id` = "' . $item['includemagic'] . '" LIMIT 1'));
$incmagic['name'] = $item['includemagicname'];
$incmagic['cur'] = $item['includemagicdex'];
$incmagic['max'] = $item['includemagicmax'];
if (!$magic) {
$magic['chanse'] = $incmagic['chanse'];
$magic['time'] = $incmagic['time'];
$magic['targeted'] = $incmagic['targeted'];
}
if ($item['destiny'] > 0) {
$r .= "<a href=\"javascript: void(0);\">{$item['name']}</a><img src=\"i/align_{$item['nalign']}.gif\" />&nbsp;(Масса:&nbsp;{$item['massa']})<img src=\"i/destiny{$item['destiny']}.gif\" /><img src=\"i/artefact{$item['artefact']}.gif\" /><br />";
} else {
$r .= "<a href=\"javascript: void(0);\">{$item['name']}</a><img src=\"i/align_{$item['nalign']}.gif\" />&nbsp;(Масса:&nbsp;{$item['massa']})<img src=\"i/destiny{$item['destiny']}.gif\" /><img src=\"i/artefact{$item['artefact']}.gif\" /><br />";
}
if ($item['ecost'] > 0) {
$r .= "<b>Цена: {$item['ecost']} екр.</b> &nbsp; &nbsp;";
} elseif ($item['point'] > 0) {
$r .= "<b>Цена: {$item['point']} реп.</b> &nbsp; &nbsp;";
} else {
$r .= "<b>Цена: {$item['cost']} кр.</b> &nbsp; &nbsp;";
}
if ($item['zeton'] > 0) {
$r .= "<br /><b>Жетон: {$item['zeton']}</b>&nbsp<br />";
}
if (@$item['count']) {
$r .= "<small>(количество: {$item['count']})</small>";
}
if ($item['for_me'] > 0) {
$r .= '<br /><small style=\'color: Red;\'>После покупки вещь будет привязана к персонажу.</small>';
}
$r .= "<br />Долговечность: {$item['duration']}/{$item['maxdur']}";
$r .= "<br />";
if (!$item['needident']) {
if ($magic['chanse'] >= 98) {
$magic['chanse'] = 99;
}
$r .= (($magic['chanse']) ? "Вероятность срабатывания: " . $magic['chanse'] . "%<br />" : "") . "
" . (($magic['time']) ? "Продолжительность действия магии: " . $magic['time'] . " мин.<br />" : "") . "
" . (($item['goden']) ? "Срок годности: {$item['goden']} дн. " . ((!$item['count']) ? "(до " . date("Y.m.d H:i", $item['dategoden']) . ")" : "") . "<br />" : "") . "
" . (($item['nsila'] || $item['nlovk'] || $item['ninta'] || $item['nvinos'] || $item['nlevel'] || $item['nintel'] || $item['nmudra'] || $item['nnoj'] || $item['ntopor'] || $item['ndubina'] || $item['nmech'] || $item['nfire'] || $item['nwater'] || $item['nair'] || $item['nearth'] || $item['nearth'] || $item['nlight'] || $item['ngray'] || $item['ndark']) ? "<b>Требуется минимальное:</b><br />" : "") . "
" . (($item['nsila'] > 0) ? "• " . (($item['nsila'] > $user['sila']) ? "<font color=red>" : "") . "Сила: {$item['nsila']}</font><br />" : "") . "
" . (($item['nlovk'] > 0) ? "• " . (($item['nlovk'] > $user['lovk']) ? "<font color=red>" : "") . "Ловкость: {$item['nlovk']}</font><br />" : "") . "
" . (($item['ninta'] > 0) ? "• " . (($item['ninta'] > $user['inta']) ? "<font color=red>" : "") . "Интуиция: {$item['ninta']}</font><br />" : "") . "
" . (($item['nvinos'] > 0) ? "• " . (($item['nvinos'] > $user['vinos']) ? "<font color=red>" : "") . "Выносливость: {$item['nvinos']}</font><br />" : "") . "
" . (($item['nlevel'] > 0) ? "• " . (($item['nlevel'] > $user['level']) ? "<font color=red>" : "") . "Уровень: {$item['nlevel']}</font><br />" : "") . "
" . (($item['nintel'] > 0) ? "• " . (($item['nintel'] > $user['intel']) ? "<font color=red>" : "") . "Интеллект: {$item['nintel']}</font><br />" : "") . "
" . (($item['nnoj'] > 0) ? "• " . (($item['nnoj'] > $user['noj']) ? "<font color=red>" : "") . "Мастерство владения ножами и кастетами: {$item['nnoj']}</font><br />" : "") . "
" . (($item['ntopor'] > 0) ? "• " . (($item['ntopor'] > $user['topor']) ? "<font color=red>" : "") . "Мастерство владения топорами и секирами: {$item['ntopor']}</font><br />" : "") . "
" . (($item['ndubina'] > 0) ? "• " . (($item['ndubina'] > $user['dubina']) ? "<font color=red>" : "") . "Мастерство владения дубинами и булавами: {$item['ndubina']}</font><br />" : "") . "
" . (($item['nmech'] > 0) ? "• " . (($item['nmech'] > $user['mec']) ? "<font color=red>" : "") . "Мастерство владения мечами: {$item['nmech']}</font><br />" : "") . "
" . (($item['nfire'] > 0) ? "• " . (($item['nfire'] > $user['mfire']) ? "<font color=red>" : "") . "Мастерство владения стихией Огня: {$item['nfire']}</font><br />" : "") . "
" . (($item['nwater'] > 0) ? "• " . (($item['nwater'] > $user['mwater']) ? "<font color=red>" : "") . "Мастерство владения стихией Воды: {$item['nwater']}</font><br />" : "") . "
" . (($item['nair'] > 0) ? "• " . (($item['nair'] > $user['mair']) ? "<font color=red>" : "") . "Мастерство владения стихией Воздуха: {$item['nair']}</font><br />" : "") . "
" . (($item['nearth'] > 0) ? "• " . (($item['nearth'] > $user['mearth']) ? "<font color=red>" : "") . "Мастерство владения стихией Земли: {$item['nearth']}</font><br />" : "") . "
" . (($item['nlight'] > 0) ? "• " . (($item['nlight'] > $user['mlight']) ? "<font color=red>" : "") . "Мастерство владения магией Света: {$item['nlight']}</font><br />" : "") . "
" . (($item['ngray'] > 0) ? "• " . (($item['ngray'] > $user['mgray']) ? "<font color=red>" : "") . "Мастерство владения серой магией: {$item['ngray']}</font><br />" : "") . "
" . (($item['ndark'] > 0) ? "• " . (($item['ndark'] > $user['mdark']) ? "<font color=red>" : "") . "Мастерство владения магией Тьмы: {$item['ndark']}</font><br />" : "") . "
" . (($item['gmeshok'] || $item['gsila'] || $item['mfkrit'] || $item['mfakrit'] || $item['mfuvorot'] || $item['mfauvorot'] || $item['glovk'] || $item['ghp'] || $item['ginta'] || $item['gintel'] || $item['gnoj'] || $item['gtopor'] || $item['gdubina'] || $item['gmech'] || $item['gfire'] || $item['gwater'] || $item['gair'] || $item['gearth'] || $item['gearth'] || $item['glight'] || $item['ggray'] || $item['gdark'] || $item['minu'] || $item['maxu'] || $item['bron1'] || $item['bron2'] || $item['bron3'] || $item['bron4']) ? "<b>Действует на:</b><br />" : "") . "
" . (($item['minu']) ? "• Минимальное наносимое повреждение: +{$item['minu']}<br />" : "") . "
" . (($item['maxu']) ? "• Максимальное наносимое повреждение: +{$item['maxu']}<br />" : "");
if ($item['gsila']) {
$r .= "• Сила: +" . $item['gsila'];
$r .= "<br />";
}
if ($item['glovk']) {
$r .= "• Ловкость: " . plusorminus($item['glovk']);
$r .= "<br />";
}
if ($item['ginta']) {
$r .= "• Интуиция: " . plusorminus($item['ginta']);
$r .= "<br />";
}
if ($item['gintel']) {
$r .= "• Интеллект: " . plusorminus($item['gintel']);
$r .= "<br />";
}
$r .= (($item['ghp']) ? "• Уровень жизни: " . plusorminus($item['ghp']) . "<br />" : "");
if ($item['mfkrit'] > 0) {
$r .= "• Мф. критических ударов: " . plusorminus($item['mfkrit']) . "%";
$r .= "<br />";
}
if ($item['mfakrit'] > 0) {
$r .= "• Мф. против крит. ударов: " . plusorminus($item['mfakrit']) . "%";
$r .= "<br />";
}
if ($item['mfuvorot'] > 0) {
$r .= "• Мф. увертливости: " . plusorminus($item['mfuvorot']) . "%";
$r .= "<br />";
}
if ($item['mfauvorot'] > 0) {
$r .= "• Мф. против увертлив.: " . plusorminus($item['mfauvorot']) . "%";
$r .= "<br />";
}
$r .= (($item['gnoj']) ? "• Мастерство владения ножами и кастетами: +{$item['gnoj']}<br />" : "") . "
" . (($item['gtopor']) ? "• Мастерство владения топорами и секирами: +{$item['gtopor']}<br />" : "") . "
" . (($item['gdubina']) ? "• Мастерство владения дубинами и булавами: +{$item['gdubina']}<br />" : "") . "
" . (($item['gmech']) ? "• Мастерство владения мечами: +{$item['gmech']}<br />" : "") . "
" . (($item['gfire']) ? "• Мастерство владения стихией Огня: +{$item['gfire']}<br />" : "") . "
" . (($item['gwater']) ? "• Мастерство владения стихией Воды: +{$item['gwater']}<br />" : "") . "
" . (($item['gair']) ? "• Мастерство владения стихией Воздуха: +{$item['gair']}<br />" : "") . "
" . (($item['gearth']) ? "• Мастерство владения стихией Земли: +{$item['gearth']}<br />" : "") . "
" . (($item['glight']) ? "• Мастерство владения магией Света: +{$item['glight']}<br />" : "") . "
" . (($item['ggray']) ? "• Мастерство владения серой магией: +{$item['ggray']}<br />" : "") . "
" . (($item['gdark']) ? "• Мастерство владения магией Тьмы: +{$item['gdark']}<br />" : "");
if ($item['bron1'] > 0) {
$r .= "• Броня головы: " . $item['bron1'];
$r .= "<br />";
}
if ($item['bron2'] > 0) {
$r .= "• Броня корпуса: " . $item['bron2'];
$r .= "<br />";
}
if ($item['bron3'] > 0) {
$r .= "• Броня пояса: " . $item['bron3'];
$r .= "<br />";
}
if ($item['bron4'] > 0) {
$r .= "• Броня ног: " . $item['bron4'];
$r .= "<br />";
}
$r .= (($item['gmeshok']) ? "• Увеличивает рюкзак: +{$item['gmeshok']}<br />" : "") . "
" . (($item['letter']) ? "Количество символов: " . strlen($item['letter']) . "</div>" : "") . "
" . (($item['letter']) ? "На бумаге записан текст:<div style='background-color:#FAF0E6;'> " . nl2br($item['letter']) . "</div>" : "") . "
" . (($item['opisan']) ? "&bull; " . nl2br($item['opisan']) . "<br />" : "") . "
" . (($magic['name'] && $item['type'] != 50) ? "<font color=maroon>Наложены заклятия:</font> " . $magic['name'] . "<br />" : "") . "
" . (($item['text']) ? "На ручке выгравирована надпись:<center>" . $item['text'] . "</center><br />" : "") . "
" . (($incmagic['max']) ? " Встроено заклятие <img src=\"i/magic/" . $incmagic['img'] . "\" /> " . $incmagic['cur'] . " шт. <br />" : "") . "
" . (($item['podzem']) ? "<font style='font-size:11px; color:#990000'>Предмет из подземелья</font><br />" : "") . "
" . (($item['laba'] == 1) ? "<font style='font-size: 11px; color:#990000'>Пропадёт если не найти выход</font><br />" : "") . "
" . (($item['laba'] == 2) ? "<font style='font-size: 11px; color:#990000'>Предмет пропадёт после выхода</font><br />" : "") . "
" . ((!$item['isrep']) ? "<small><font color=maroon>Предмет не подлежит ремонту</font></small><br />" : "");
if ($item['free_bron'] > 0) {
$r .= "<font color=blue>Свободных улучшений брони: " . $item['free_bron'] . "</font><br />";
}
if ($item['free_stat'] > 0) {
$r .= "<font color=blue>Свободных улучшений параметров: " . $item['free_stat'] . "</font><br />";
}
if ($item['free_mf'] > 0) {
$r .= "<font color=blue>Свободных улучшений модификаторов: " . $item['free_mf'] . "%</font><br />";
}
if ($item['add_proc_mf'] > 0 || $item['add_proc_uron'] > 0 || $item['add_proc_bron'] > 0) {
$r .= 'Усиление:<br />';
if ($item['add_proc_mf'] > 0) {
$r .= '&bull; Максимального мф.:' . plusorminus($item['add_proc_mf']) . '%<br />';
}
if ($item['add_proc_uron'] > 0) {
$r .= '&bull; Урона:' . plusorminus($item['add_proc_uron']) . '%<br />';
}
if ($item['add_proc_bron'] > 0) {
$r .= '&bull; Брони:' . plusorminus($item['add_proc_bron']) . '%<br />';
}
}
} else {
$r .= "<font color=maroon><b>Свойства предмета не идентифицированы</b></font><br />";
}
$osob = array(22, 23);
if (in_array($item['type'], $osob)) {
$r .= 'Особенности:<br />';
if ($item['type'] == 22) {
$r .= '&bull; может одеваться под броню<br />';
} elseif ($item['type'] == 23) {
$r .= '&bull; может одеваться на броню<br />';
}
}
$r .= "<small>Сделано в CapitalCity</small><br /></td></TR>";
} else {
$r = 'Предмет не найден : {' . $it . '}';
}
return $r;
}
/**
* По ходу, главная функция отображения предметов.
*
* @param $row
* @param $type
* @param bool $returned
* @return string
*/
function showitem($row, $type, $returned = false)
{
global $user, $runes_exp;
$returnHTML = '';
if ((($row['maxdur'] <= ($row['duration'])) || ($row['dategoden'] && $row['dategoden'] <= time()))) {
destructitem($row['id']);
}
$magic = magicinf($row['magic']);
$incmagic = mysql_fetch_array(mysql_query('SELECT * FROM `magic` WHERE `id` = \'' . $row['includemagic'] . '\' LIMIT 1;'));
$incmagic['name'] = $row['includemagicname'];
$incmagic['cur'] = $row['includemagicdex'];
$incmagic['max'] = $row['includemagicmax'];
if (!$magic) {
$magic['chanse'] = $incmagic['chanse'];
$magic['time'] = $incmagic['time'];
$magic['targeted'] = $incmagic['targeted'];
}
if (@!$row['count'] || $type == 10) {
$up = ($row['upgrade'] > 0 ? " <font color=blue><b>[" . $row['upgrade'] . "]</b></font>" : "");
$returnHTML .= '<TR bgcolor="#C7C7C7" ><TD align="center" width="100">';
if ($incmagic['max']) {
$returnHTML .= "<img class=\"tooltip\" src='mg2.php?p=" . ($incmagic['cur'] / $incmagic['max'] * 100) . "&i={$row['img']}' style=\"filter:shadow(color=red, direction=90, strength=3);\"><BR>";//<img ".((($row['maxdur']-2)<=$row['duration'] && $dress['duration'] > 2)?" style='background-image:url(i/blink.gif);' ":"")." src='i/sh/{$row['img']}' style=\"margin:0px,0px,-100000%,0px;\"><BR>
} else {
$returnHTML .= "<img " . ((($row['maxdur'] - 2) <= $row['duration'] && $dress['duration'] > 2) ? " style='background-image:url(i/blink.gif);' " : "") . " src='i/sh/{$row['img']}'><BR>";
}
if (($user['sila'] >= $row['nsila']) &&
($user['lovk'] >= $row['nlovk']) &&
($user['inta'] >= $row['ninta']) &&
($user['vinos'] >= $row['nvinos']) &&
($user['intel'] >= $row['nintel']) &&
($user['mudra'] >= $row['nmudra']) &&
($user['level'] >= $row['nlevel']) &&
(((int)$user['align'] == $row['nalign']) || ($row['nalign'] == 0) || ($row['nalign'] == 1.1 && ($user['align'] > 1 && $user['align'] < 2) || $user['align'] == 6)) &&
($user['noj'] >= $row['nnoj']) &&
($user['topor'] >= $row['ntopor']) &&
($user['dubina'] >= $row['ndubina']) &&
($user['mec'] >= $row['nmech']) &&
($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['type'] < 13 || ($row['type'] == 50 || $row['type'] == 22 || $row['type'] == 23 || $row['type'] == 24)) &&
($row['needident'] == 0)
) {
if (($row['type'] == 12) || ($row['magic']) || ($incmagic['cur'])) {
$returnHTML .= "<a onclick=\"";
if ($magic['id'] == 43) {
$returnHTML .= "okno('Название встраиваемого свитка', 'main.php?edit=1&use={$row['id']}', 'target')";
} elseif ($magic['targeted'] == 1) {
$returnHTML .= "okno('Введите название предмета', 'main.php?edit=1&use={$row['id']}', 'target')";
} elseif ($magic['targeted'] == 2) {
$returnHTML .= "findlogin('Введите имя персонажа', 'main.php?edit=1&use={$row['id']}', 'target')";
} else {
$returnHTML .= "window.location='main.php?edit=1&use=" . $row['id'] . "';";
}
$returnHTML .= "\"href='#'>исп-ть</a><BR> ";
}
if ($row['type'] != 50) {
$returnHTML .= "<a href='?edit=1&dress={$row['id']}'>надеть</a> ";
}
} elseif (($row['type'] == 50) OR ($row['type'] == 12) OR ($row['magic']) OR ($incmagic['cur'])) {
$returnHTML .= "<a onclick=\"";
if ($magic['id'] == 43) {
$returnHTML .= "okno('Название встраиваемого свитка', 'main.php?edit=1&use={$row['id']}', 'target')";
} elseif ($magic['targeted'] == 1) {
$returnHTML .= "okno('Введите название предмета', 'main.php?edit=1&use={$row['id']}', 'target')";
} elseif ($magic['targeted'] == 2) {
$returnHTML .= "findlogin('Введите имя персонажа', 'main.php?edit=1&use={$row['id']}', 'target')";
} else {
$returnHTML .= "window.location='main.php?edit=1&use=" . $row['id'] . "';";
}
$returnHTML .= "\"href='#'>исп-ть</a><BR> ";
}
if ($type != 10) {
$returnHTML .= '<br />ID: ' . $row['id'] . '<br />';
// if ($row["koll"]) $returnHTML .= "<div style=\"font-size:3px\">&nbsp;</div><a title=\"Собрать\" href=\"/main.php?$link&stack=$row[id]\"><img border=\"0\" src=\"i/stack.gif\"></a> ";
if ($row["koll"] > 1) $returnHTML .= "<a title=\"Разделить\" onclick=\"splitstack('$row[name]','main.php?edit=1&unstack=$row[id]', '$row[img]', 1);return false;\" href=\"javascript:void(0)\"><img border=\"0\" src=\"i/unstack.gif\"></a>&nbsp;";
#onclick=\"delItmsNo('Выкинуть предмет?','deleteItems',0,'','".$row['img']."','".$row['name']."','main.php?edit=1&destruct=".$row['id']."');\"
$returnHTML .= "<img src=i/clear.gif style=\"cursor:hand;\" onclick=\"delItmsNo('Выкинуть предмет?','deleteItems',0,'','" . $row['img'] . "','" . $row['name'] . "','main.php?edit=1&destruct=" . $row['id'] . "');\"></TD><td>";
#$returnHTML .= "<img src=i/clear.gif style=\"cursor:hand;\" onclick=\"if (confirm('Предмет {$row['name']} будет утерян, вы уверены?')) window.location='main.php?edit=1&destruct=".$row['id']."'\"></TD><td>";
} else {
$returnHTML .= "<a href=upgrade_items.php?up=" . $row['id'] . ">Улучшить</a></td><td>";
}
}
if ($row['destinyinv'] > 0) {
$returnHTML .= "{$row['name']}{$up}<img src=i/align_{$row['nalign']}.gif>&nbsp;(Масса:&nbsp;{$row['massa']})<img src=i/destiny{$row['destinyinv']}.gif alt=\"Этот предмет связан с Вами общей судьбой. Вы не можете передать его кому-либо еще.\"><img src=i/artefact{$row['artefact']}.gif>" . (($row['present']) ? '&nbsp;<IMG SRC="i/podarok.gif" TITLE="Этот предмет вам подарил ' . $row['present'] . '. Вы не сможете передать этот предмет кому-либо еще." ALT="Этот предмет вам подарил ' . $row['present'] . '. Вы не сможете передать этот предмет кому-либо еще.">' : "") . "<BR>";
} elseif ($row['destiny'] > 0) {
$returnHTML .= "{$row['name']}{$up}<img src=i/align_{$row['nalign']}.gif>&nbsp;(Масса:&nbsp;{$row['massa']})<img src=i/destiny{$row['destiny']}.gif alt=\"Этот предмет будет связан с Вами общей судьбой. Вы не сможете передать его кому-либо еще.\"><img src=i/artefact{$row['artefact']}.gif>" . (($row['present']) ? '&nbsp;<IMG SRC="i/podarok.gif" WIDTH="16" HEIGHT="18" BORDER=0 TITLE="Этот предмет вам подарил ' . $row['present'] . '. Вы не сможете передать этот предмет кому-либо еще." ALT="Этот предмет вам подарил ' . $row['present'] . '. Вы не сможете передать этот предмет кому-либо еще.">' : "") . "<BR>";
} else {
$returnHTML .= "{$row['name']}{$up}<img src=i/align_{$row['nalign']}.gif>&nbsp;(Масса:&nbsp;{$row['massa']})<img src=i/destiny{$row['destiny']}.gif><img src=i/artefact{$row['artefact']}.gif>" . (($row['present']) ? ' <IMG SRC="i/podarok.gif" WIDTH="16" HEIGHT="18" BORDER=0 TITLE="Этот предмет вам подарил ' . $row['present'] . '. Вы не сможете передать этот предмет кому-либо еще." ALT="Этот предмет вам подарил ' . $row['present'] . '. Вы не сможете передать этот предмет кому-либо еще.">' : "") . "<BR>";
}
if ($row['type'] == 24 && $type != 11) {
$returnHTML .= 'Уровень руны: <b>' . $row['rune_level'] . '</b> (<b title=\'Опыт\'>' . $row['rune_exp'] . '/' . $runes_exp[$row['rune_level'] + 1] . '</b>)<br />';
}
if ($row['ecost'] > 0) {
$returnHTML .= "<b>Цена: {$row['ecost']} екр.</b> &nbsp; &nbsp;";
} elseif ($row['point'] > 0) {
$returnHTML .= "<b>Цена: {$row['point']} реп.</b> &nbsp; &nbsp;";
} else {
$returnHTML .= "<b>Цена: {$row['cost']} кр.</b> &nbsp; &nbsp;";
}
if ($row['zeton'] > 0) {
$returnHTML .= "<br><b>Жетон: {$row['zeton']}</b>&nbsp<br>";
}
if (@$row['count']) {
$returnHTML .= "<small>(количество: {$row['count']})</small>";
}
if ($row['for_me'] > 0) {
$returnHTML .= '<br /><small style=\'color: Red;\'>После покупки вещь будет привязана к персонажу.</small>';
}
$returnHTML .= "<BR>Долговечность: {$row['duration']}/{$row['maxdur']}";
if ($row['podgon'] > 0) {
$returnHTML .= " <small>[Подогнано: <b>" . $row['podgon'] . "</b> раз]</small>";
}
$returnHTML .= "<BR>";
if (!$row['needident']) {
if ($magic['chanse'] >= 98) $magic['chanse'] = 99;
$returnHTML .= (($magic['chanse']) ? "Вероятность срабатывания: " . $magic['chanse'] . "%<BR>" : "") . "
" . (($magic['time']) ? "Продолжительность действия магии: " . $magic['time'] . " мин.<BR>" : "") . "
" . (($row['goden']) ? "Срок годности: {$row['goden']} дн. " . ((!$row['count']) ? "(до " . date("Y.m.d H:i", $row['dategoden']) . ")" : "") . "<BR>" : "") . "
" . (($row['nsila'] || $row['nlovk'] || $row['ninta'] || $row['nvinos'] OR $row['nlevel'] OR $row['nintel'] OR $row['nmudra'] OR $row['nnoj'] OR $row['ntopor'] OR $row['ndubina'] OR $row['nmech'] OR $row['nfire'] OR $row['nwater'] OR $row['nair'] OR $row['nearth'] OR $row['nearth'] OR $row['nlight'] OR $row['ngray'] OR $row['ndark']) ? "<b>Требуется минимальное:</b><BR>" : "") . "
" . (($row['nsila'] > 0) ? "• " . (($row['nsila'] > $user['sila']) ? "<font color=red>" : "") . "Сила: {$row['nsila']}</font><BR>" : "") . "
" . (($row['nlovk'] > 0) ? "• " . (($row['nlovk'] > $user['lovk']) ? "<font color=red>" : "") . "Ловкость: {$row['nlovk']}</font><BR>" : "") . "
" . (($row['ninta'] > 0) ? "• " . (($row['ninta'] > $user['inta']) ? "<font color=red>" : "") . "Интуиция: {$row['ninta']}</font><BR>" : "") . "
" . (($row['nvinos'] > 0) ? "• " . (($row['nvinos'] > $user['vinos']) ? "<font color=red>" : "") . "Выносливость: {$row['nvinos']}</font><BR>" : "") . "
" . (($row['nlevel'] > 0) ? "• " . (($row['nlevel'] > $user['level']) ? "<font color=red>" : "") . "Уровень: {$row['nlevel']}</font><BR>" : "") . "
" . (($row['nintel'] > 0) ? "• " . (($row['nintel'] > $user['intel']) ? "<font color=red>" : "") . "Интеллект: {$row['nintel']}</font><BR>" : "") . "
" . (($row['nnoj'] > 0) ? "• " . (($row['nnoj'] > $user['noj']) ? "<font color=red>" : "") . "Мастерство владения ножами и кастетами: {$row['nnoj']}</font><BR>" : "") . "
" . (($row['ntopor'] > 0) ? "• " . (($row['ntopor'] > $user['topor']) ? "<font color=red>" : "") . "Мастерство владения топорами и секирами: {$row['ntopor']}</font><BR>" : "") . "
" . (($row['ndubina'] > 0) ? "• " . (($row['ndubina'] > $user['dubina']) ? "<font color=red>" : "") . "Мастерство владения дубинами и булавами: {$row['ndubina']}</font><BR>" : "") . "
" . (($row['nmech'] > 0) ? "• " . (($row['nmech'] > $user['mec']) ? "<font color=red>" : "") . "Мастерство владения мечами: {$row['nmech']}</font><BR>" : "") . "
" . (($row['nfire'] > 0) ? "• " . (($row['nfire'] > $user['mfire']) ? "<font color=red>" : "") . "Мастерство владения стихией Огня: {$row['nfire']}</font><BR>" : "") . "
" . (($row['nwater'] > 0) ? "• " . (($row['nwater'] > $user['mwater']) ? "<font color=red>" : "") . "Мастерство владения стихией Воды: {$row['nwater']}</font><BR>" : "") . "
" . (($row['nair'] > 0) ? "• " . (($row['nair'] > $user['mair']) ? "<font color=red>" : "") . "Мастерство владения стихией Воздуха: {$row['nair']}</font><BR>" : "") . "
" . (($row['nearth'] > 0) ? "• " . (($row['nearth'] > $user['mearth']) ? "<font color=red>" : "") . "Мастерство владения стихией Земли: {$row['nearth']}</font><BR>" : "") . "
" . (($row['nlight'] > 0) ? "• " . (($row['nlight'] > $user['mlight']) ? "<font color=red>" : "") . "Мастерство владения магией Света: {$row['nlight']}</font><BR>" : "") . "
" . (($row['ngray'] > 0) ? "• " . (($row['ngray'] > $user['mgray']) ? "<font color=red>" : "") . "Мастерство владения серой магией: {$row['ngray']}</font><BR>" : "") . "
" . (($row['ndark'] > 0) ? "• " . (($row['ndark'] > $user['mdark']) ? "<font color=red>" : "") . "Мастерство владения магией Тьмы: {$row['ndark']}</font><BR>" : "") . "
" . (($row['gmeshok'] OR $row['gsila'] OR $row['mfkrit'] OR $row['mfakrit'] OR $row['mfuvorot'] OR $row['mfauvorot'] OR $row['glovk'] OR $row['ghp'] OR $row['ginta'] OR $row['gintel'] OR $row['gnoj'] OR $row['gtopor'] OR $row['gdubina'] OR $row['gmech'] OR $row['gfire'] OR $row['gwater'] OR $row['gair'] OR $row['gearth'] OR $row['gearth'] OR $row['glight'] OR $row['ggray'] OR $row['gdark'] OR $row['minu'] OR $row['maxu'] OR $row['bron1'] OR $row['bron2'] OR $row['bron3'] OR $row['bron4']) ? "<b>Действует на:</b><BR>" : "") . "
" . (($row['minu']) ? "• Минимальное наносимое повреждение: +{$row['minu']}<BR>" : "") . "
" . (($row['maxu']) ? "• Максимальное наносимое повреждение: +{$row['maxu']}<BR>" : "");
if ($row['gsila']) {
$returnHTML .= "• Сила: +" . $row['gsila'];
if ($row['free_stat'] > 0) {
$returnHTML .= " <a href=?modif_stat=gsila&ids=" . $row['id'] . "&edit=1><img src=i/up.gif></a>";
}
$returnHTML .= "<br>";
}
if ($row['glovk']) {
$returnHTML .= "• Ловкость: " . plusorminus($row['glovk']);
if ($row['free_stat'] > 0) {
$returnHTML .= " <a href=?modif_stat=glovk&ids=" . $row['id'] . "&edit=1><img src=i/up.gif></a>";
}
$returnHTML .= "<br>";
}
if ($row['ginta']) {
$returnHTML .= "• Интуиция: " . plusorminus($row['ginta']);
if ($row['free_stat'] > 0) {
$returnHTML .= " <a href=?modif_stat=ginta&ids=" . $row['id'] . "&edit=1><img src=i/up.gif></a>";
}
$returnHTML .= "<br>";
}
if ($row['gintel']) {
$returnHTML .= "• Интеллект: " . plusorminus($row['gintel']);
if ($row['free_stat'] > 0) {
$returnHTML .= " <a href=?modif_stat=gintel&ids=" . $row['id'] . "&edit=1><img src=i/up.gif></a>";
}
$returnHTML .= "<br>";
}
$returnHTML .= (($row['ghp']) ? "• Уровень жизни: " . plusorminus($row['ghp']) . "<BR>" : "");
if ($row['mfkrit'] > 0) {
$returnHTML .= "• Мф. критических ударов: " . plusorminus($row['mfkrit']) . "%";
if ($row['free_mf'] > 0) {
$returnHTML .= " <a href=?modif_mf=mfkrit&ids=" . $row['id'] . "&edit=1><img src=i/up.gif></a>";
}
$returnHTML .= "<br>";
}
if ($row['mfakrit'] > 0) {
$returnHTML .= "• Мф. против крит. ударов: " . plusorminus($row['mfakrit']) . "%";
if ($row['free_mf'] > 0) {
$returnHTML .= " <a href=?modif_mf=mfakrit&ids=" . $row['id'] . "&edit=1><img src=i/up.gif></a>";
}
$returnHTML .= "<br>";
}
if ($row['mfuvorot'] > 0) {
$returnHTML .= "• Мф. увертливости: " . plusorminus($row['mfuvorot']) . "%";
if ($row['free_mf'] > 0) {
$returnHTML .= " <a href=?modif_mf=mfuvorot&ids=" . $row['id'] . "&edit=1><img src=i/up.gif></a>";
}
$returnHTML .= "<br>";
}
if ($row['mfauvorot'] > 0) {
$returnHTML .= "• Мф. против увертлив.: " . plusorminus($row['mfauvorot']) . "%";
if ($row['free_mf'] > 0) {
$returnHTML .= " <a href=?modif_mf=mfauvorot&ids=" . $row['id'] . "&edit=1><img src=i/up.gif></a>";
}
$returnHTML .= "<br>";
}
$returnHTML .= (($row['gnoj']) ? "• Мастерство владения ножами и кастетами: +{$row['gnoj']}<BR>" : "") . "
" . (($row['gtopor']) ? "• Мастерство владения топорами и секирами: +{$row['gtopor']}<BR>" : "") . "
" . (($row['gdubina']) ? "• Мастерство владения дубинами и булавами: +{$row['gdubina']}<BR>" : "") . "
" . (($row['gmech']) ? "• Мастерство владения мечами: +{$row['gmech']}<BR>" : "") . "
" . (($row['gfire']) ? "• Мастерство владения стихией Огня: +{$row['gfire']}<BR>" : "") . "
" . (($row['gwater']) ? "• Мастерство владения стихией Воды: +{$row['gwater']}<BR>" : "") . "
" . (($row['gair']) ? "• Мастерство владения стихией Воздуха: +{$row['gair']}<BR>" : "") . "
" . (($row['gearth']) ? "• Мастерство владения стихией Земли: +{$row['gearth']}<BR>" : "") . "
" . (($row['glight']) ? "• Мастерство владения магией Света: +{$row['glight']}<BR>" : "") . "
" . (($row['ggray']) ? "• Мастерство владения серой магией: +{$row['ggray']}<BR>" : "") . "
" . (($row['gdark']) ? "• Мастерство владения магией Тьмы: +{$row['gdark']}<BR>" : "");
if ($row['bron1'] > 0) {
$returnHTML .= "• Броня головы: " . $row['bron1'];
if ($row['free_bron'] > 0) {
$returnHTML .= " <a href=?modif_bron=bron1&ids=" . $row['id'] . "&edit=1><img src=i/up.gif></a>";
}
$returnHTML .= "<br>";
}
if ($row['bron2'] > 0) {
$returnHTML .= "• Броня корпуса: " . $row['bron2'];
if ($row['free_bron'] > 0) {
$returnHTML .= " <a href=?modif_bron=bron2&ids=" . $row['id'] . "&edit=1><img src=i/up.gif></a>";
}
$returnHTML .= "<br>";
}
if ($row['bron3'] > 0) {
$returnHTML .= "• Броня пояса: " . $row['bron3'];
if ($row['free_bron'] > 0) {
$returnHTML .= " <a href=?modif_bron=bron3&ids=" . $row['id'] . "&edit=1><img src=i/up.gif></a>";
}
$returnHTML .= "<br>";
}
if ($row['bron4'] > 0) {
$returnHTML .= "• Броня ног: " . $row['bron4'];
if ($row['free_bron'] > 0) {
$returnHTML .= " <a href=?modif_bron=bron4&ids=" . $row['id'] . "&edit=1><img src=i/up.gif></a>";
}
$returnHTML .= "<br>";
}
$returnHTML .= (($row['gmeshok']) ? "• Увеличивает рюкзак: +{$row['gmeshok']}<BR>" : "") . "
" . (($row['letter']) ? "Количество символов: " . strlen($row['letter']) . "</div>" : "") . "
" . (($row['letter']) ? "На бумаге записан текст:<div style='background-color:#FAF0E6;'> " . nl2br($row['letter']) . "</div>" : "") . "
" . (($row['opisan']) ? "&bull; " . nl2br($row['opisan']) . "<br />" : "") . "
" . (($magic['name'] && $row['type'] != 50) ? "<font color=maroon>Наложены заклятия:</font> " . $magic['name'] . "<BR>" : "") . "
" . (($row['text']) ? "На ручке выгравирована надпись:<center>" . $row['text'] . "</center><BR>" : "") . "
" . (($incmagic['max']) ? " Встроено заклятие <img src=\"i/magic/" . $incmagic['img'] . "\" /> " . $incmagic['cur'] . " шт. <BR>" : "") . "
" . (($row['podzem']) ? "<font style='font-size:11px; color:#990000'>Предмет из подземелья</font><BR>" : "") . "
" . (($row['laba'] == 1) ? "<font style='font-size: 11px; color:#990000'>Пропадёт если не найти выход</font><BR>" : "") . "
" . (($row['laba'] == 2) ? "<font style='font-size: 11px; color:#990000'>Предмет пропадёт после выхода</font><BR>" : "") . "
" . ((!$row['isrep']) ? "<small><font color=maroon>Предмет не подлежит ремонту</font></small><BR>" : "");
if ($row['free_bron'] > 0) {
$returnHTML .= "<font color=blue>Свободных улучшений брони: " . $row['free_bron'] . "</font><br>";
}
if ($row['free_stat'] > 0) {
$returnHTML .= "<font color=blue>Свободных улучшений параметров: " . $row['free_stat'] . "</font><br>";
}
if ($row['free_mf'] > 0) {
$returnHTML .= "<font color=blue>Свободных улучшений модификаторов: " . $row['free_mf'] . "%</font><br>";
}
if ($row['add_proc_mf'] > 0 || $row['add_proc_uron'] > 0 || $row['add_proc_bron'] > 0) {
$returnHTML .= 'Усиление:<br />';
if ($row['add_proc_mf'] > 0) {
$returnHTML .= '&bull; Максимального мф.:' . plusorminus($row['add_proc_mf']) . '%<br />';
}
if ($row['add_proc_uron'] > 0) {
$returnHTML .= '&bull; Урона:' . plusorminus($row['add_proc_uron']) . '%<br />';
}
if ($row['add_proc_bron'] > 0) {
$returnHTML .= '&bull; Брони:' . plusorminus($row['add_proc_bron']) . '%<br />';
}
}
} else {
$returnHTML .= "<font color=maroon><B>Свойства предмета не идентифицированы</B></font><BR>";
}
$osob = array(22, 23);
if (in_array($row['type'], $osob)) {
$returnHTML .= 'Особенности:<br />';
if ($row['type'] == 22) {
$returnHTML .= '&bull; может одеваться под броню<br />';
} elseif ($row['type'] == 23) {
$returnHTML .= '&bull; может одеваться на броню<br />';
}
}
$returnHTML .= "<small>Сделано в CapitalCity</small><br /></td></TR>";
if ($returned) {
return $returnHTML;
}
echo $returnHTML;
}
function show_item($row, $txt, $place)
{
if (($row['maxdur'] <= $row['duration']) || ($row['dategoden'] && $row['dategoden'] <= time())) destructitem($row['id']);
$r = '';
$ntxt = "В инвентаре";
if ($txt == "В сундук") $ntxt = "В сундуке";
$magic = magicinf($row['magic']);
$incmagic = mysql_fetch_array(mysql_query('SELECT * FROM `magic` WHERE `id` = \'' . $row['includemagic'] . '\' LIMIT 1'));
$incmagic['name'] = $row['includemagicname'];
$incmagic['cur'] = $row['includemagicdex'];
$incmagic['max'] = $row['includemagicmax'];
if (!$magic) {
$magic['chanse'] = $incmagic['chanse'];
$magic['time'] = $incmagic['time'];
$magic['targeted'] = $incmagic['targeted'];
}
#href="?search=1&otdel='.$row['otdel'].'&place='.$place.'&itm='.$row['id'].'&set=1"
if (isset($row['id'])) {
$r .= '<div id="inv_' . $row['id'] . '"><table><tbody>';
$r .= '<tr valign="top" style="border: 2px groove threedface;">';
$r .= '<td class="even links original"><img src="/i/sh/' . $row['img'] . '">
<span class="pk-new">
<a href="javascript: void(0);" style="display: none;">' . $ntxt . '</a><a href="?search=1&otdel=' . $row['otdel'] . '&place=' . $place . '&itm=' . $row['id'] . '&set=1" name="imt" id="itm_' . $row['id'] . '">' . $txt . '</a>
</span></td>';
$r .= '<input type="hidden" name="itid" value="' . $row['id'] . '" />';
$r .= '<td class="even item">';
$r .= '<div class="thinginfo"><a href="javascript: void(0);">' . $row['name'] . '</a> <img src="/i/align_' . $row['nalign'] . '.gif" /> (масса: ' . $row['massa'] . ') ' . (($row['present']) ? ' <img src="i/podarok.gif" width="16" height="18" title="Этот предмет вам подарил ' . $row['present'] . '. Вы не сможете передать этот предмет кому-либо еще." />' : "") . '<br />';
if ($row['ecost'] > 0) {
$r .= '<b>Цена: ' . $row['ecost'] . ' екр.</b> &nbsp; &nbsp;<br />';
} elseif ($row['point'] > 0) {
$r .= '<b>Цена: <font color=blue>' . $row['point'] . ' реп.</font></b> &nbsp; &nbsp;<br />';
} else {
$r .= '<b>Цена: ' . $row['cost'] . ' кр.</b> &nbsp; &nbsp;<br />';
}
if ($row['zeton'] > 0) {
$r .= '<b>Жетон: ' . $row['zeton'] . '</b>&nbsp<br />';
}
$r .= 'Долговечность: ' . $row['duration'] . '/' . $row['maxdur'] . '<br />';
if (!$row['needident']) {
if ($magic['chanse']) {
if ($magic['chanse'] >= 95) $magic['chanse'] = 95;
$r .= 'Вероятность срабатывания: ' . $magic['chanse'] . '%<br />';
}
if ($magic['time']) {
$r .= 'Продолжительность действия магии: ' . $magic['time'] . ' мин.<br />';
}
if ($row['goden']) {
$r .= 'Срок годности: ' . $row['goden'] . ' дн. (до ' . date("Y.m.d H:i", $row['dategoden']) . ')<br />';
}
$r .= '<div class="need">';
$user = array();
if ($row['nsila']) {
$r .= '&bull; ';
if ($row['nsila'] > $user['sila']) {
$r .= '<span class="red">';
}
$r .= 'Требуется Сила: ' . $row['nsila'] . '</span><br />';
}
if ($row['nlovk']) {
$r .= '&bull; ';
if ($row['nlovk'] > $user['lovk']) {
$r .= '<span class="red">';
}
$r .= 'Требуется Ловкость: ' . $row['nlovk'] . '</span><br />';
}
if ($row['ninta']) {
$r .= '&bull; ';
if ($row['ninta'] > $user['inta']) {
$r .= '<span class="red">';
}
$r .= 'Требуется Интуиция: ' . $row['ninta'] . '</span><br />';
}
if ($row['nvinos']) {
$r .= '&bull; ';
if ($row['nvinos'] > $user['vinos']) {
$r .= '<span class="red">';
}
$r .= 'Требуется Выносливость: ' . $row['nvinos'] . '</span><br />';
}
if ($row['nlevel']) {
$r .= '&bull; ';
if ($row['nlevel'] > $user['level']) {
$r .= '<span class="red">';
}
$r .= 'Требуется Уровень: ' . $row['nlevel'] . '</span><br />';
}
if ($row['nintel']) {
$r .= '&bull; ';
if ($row['nintel'] > $user['intel']) {
$r .= '<span class="red">';
}
$r .= 'Требуется Интеллект: ' . $row['nintel'] . '</span><br />';
}
if ($row['nnoj']) {
$r .= '&bull; ';
if ($row['nnoj'] > $user['noj']) {
$r .= '<span class="red">';
}
$r .= 'Требуется Мастерство владения ножами и кастетами: ' . $row['nnoj'] . '</span><br />';
}
if ($row['ntopor']) {
$r .= '&bull; ';
if ($row['ntopor'] > $user['topor']) {
$r .= '<span class="red">';
}
$r .= 'Требуется Мастерство владения топорами и секирами: ' . $row['ntopor'] . '</span><br />';
}
if ($row['ndubina']) {
$r .= '&bull; ';
if ($row['ndubina'] > $user['dubina']) {
$r .= '<span class="red">';
}
$r .= 'Требуется Мастерство владения дубинами и булавами: ' . $row['ndubina'] . '</span><br />';
}
if ($row['nmech']) {
$r .= '&bull; ';
if ($row['nmech'] > $user['mech']) {
$r .= '<span class="red">';
}
$r .= 'Требуется Мастерство владения мечами: ' . $row['nmech'] . '</span><br />';
}
if ($row['nfire']) {
$r .= '&bull; ';
if ($row['nfire'] > $user['mfire']) {
$r .= '<span class="red">';
}
$r .= 'Требуется Магия Огня: ' . $row['nfire'] . '</span><br />';
}
if ($row['nwater']) {
$r .= '&bull; ';
if ($row['nwater'] > $user['mwater']) {
$r .= '<span class="red">';
}
$r .= 'Требуется Магия Воды: ' . $row['nwater'] . '</span><br />';
}
if ($row['nair']) {
$r .= '&bull; ';
if ($row['nair'] > $user['mair']) {
$r .= '<span class="red">';
}
$r .= 'Требуется Магия Воздуха:: ' . $row['nair'] . '</span><br />';
}
if ($row['nearth']) {
$r .= '&bull; ';
if ($row['nearth'] > $user['mearth']) {
$r .= '<span class="red">';
}
$r .= 'Требуется Магия Земли: ' . $row['nearth'] . '</span><br />';
}
if ($row['nlight']) {
$r .= '&bull; ';
if ($row['nlight'] > $user['mlight']) {
$r .= '<span class="red">';
}
$r .= 'Требуется Магия Света: ' . $row['nlight'] . '</span><br />';
}
if ($row['ngray']) {
$r .= '&bull; ';
if ($row['ngray'] > $user['mgray']) {
$r .= '<span class="red">';
}
$r .= 'Требуется Магия Равновесия: ' . $row['ngray'] . '</span><br />';
}
if ($row['ndark']) {
$r .= '&bull; ';
if ($row['ndark'] > $user['mdark']) {
$r .= '<span class="red">';
}
$r .= 'Требуется Магия Тьмы: ' . $row['ndark'] . '</span><br />';
}
$r .= '</div><br />';
$r .= '<div class="bonus">';
if ($row['minu']) $r .= '+' . $row['minu'] . ' Минимальное наносимое повреждение <br />';
if ($row['maxu']) $r .= '+' . $row['maxu'] . ' Максимальное наносимое повреждение <br />';
if ($row['gsila']) $r .= '+' . $row['gsila'] . ' Сила <br />';
if ($row['glovk']) $r .= '+' . $row['glovk'] . ' Ловкость <br />';
if ($row['ginta']) $r .= '+' . $row['ginta'] . ' Интуиция <br />';
if ($row['gintel']) $r .= '+' . $row['gintel'] . ' Интеллект <br />';
if ($row['ghp']) $r .= '+' . $row['ghp'] . ' Уровень жизни <br />';
if ($row['mfkrit']) $r .= '+' . $row['mfkrit'] . '% Мф. критических ударов <br />';
if ($row['mfakrit']) $r .= '+' . $row['mfakrit'] . '% Мф. против крит. ударов <br />';
if ($row['mfuvorot']) $r .= '+' . $row['mfuvorot'] . '% Мф. увертливости <br />';
if ($row['mfauvorot']) $r .= '+' . $row['mfauvorot'] . '% Мф. против увертливости <br />';
if ($row['gnoj']) $r .= '+' . $row['gnoj'] . ' Мастерство владения ножами и кастетами <br />';
if ($row['gtopor']) $r .= '+' . $row['gtopor'] . ' Мастерство владения топорами и секирами <br />';
if ($row['gdubina']) $r .= '+' . $row['gdubina'] . ' Мастерство владения дубинами и булавами <br />';
if ($row['gmech']) $r .= '+' . $row['gmech'] . ' Мастерство владения мечами <br />';
if ($row['gfire']) $r .= '+' . $row['gfire'] . ' Мастерство владения стихией Огня <br />';
if ($row['gwater']) $r .= '+' . $row['gwater'] . ' Мастерство владения стихией Воды <br />';
if ($row['gair']) $r .= '+' . $row['gair'] . ' Мастерство владения стихией Воздуха <br />';
if ($row['gearth']) $r .= '+' . $row['gearth'] . ' Мастерство владения стихией Земли <br />';
if ($row['glight']) $r .= '+' . $row['glight'] . ' Мастерство владения магией Светa <br />';
if ($row['ggray']) $r .= '+' . $row['ggray'] . ' Мастерство владения Cерой магией <br />';
if ($row['gdark']) $r .= '+' . $row['gdark'] . ' Мастерство владения магией Тьмы <br />';
if ($row['bron1']) $r .= '+' . $row['bron1'] . ' Броня головы <br />';
if ($row['bron2']) $r .= '+' . $row['bron2'] . ' Броня корпуса <br />';
if ($row['bron3']) $r .= '+' . $row['bron3'] . ' Броня пояса <br />';
if ($row['bron4']) $r .= '+' . $row['bron4'] . ' Броня ног <br />';
if ($row['gmeshok']) $r .= '+' . $row['gmeshok'] . ' Увеличивает рюкзак: <br />';
$r .= '</div">';
if ($row['letter']) $r .= 'На бумаге записан текст: <div style="background-color:#FAF0E6;"> ' . nl2br($row['letter']) . '</div><br />';
if ($magic['name'] && $row['type'] != 50) $r .= '<span style="color: maroon;">Наложены заклятия:</span> ' . $magic['name'] . '<br />';
if ($row['text']) $r .= 'На ручке выгравирована надпись: <center>' . $row['text'] . '</center><br />';
if ($incmagic['max']) $r .= 'Встроено заклятие <img src="i/magic/' . $incmagic['img'] . '" /> ' . $incmagic['cur'] . ' шт.<br />';
if ($row['podzem']) $r .= '<span style="font-size: 11px; color: #990000">Предмет из подземелья</span><br />';
if ($row['laba'] == 1) $r .= '<span style="font-size: 11px; color: #990000">Пропадёт если не найти выход</span><br />';
if ($row['laba'] == 2) $r .= '<span style="font-size: 11px; color: #990000">Предмет пропадёт после выхода</span><br />';
if ($row['isrep']) $r .= '<small><span style="color: maroon;">Предмет не подлежит ремонту</span></small><br />';
if ($row['free_bron']) $r .= '+' . $row['free_bron'] . ' Улучшений брони <br />';
if ($row['free_stat']) $r .= '+' . $row['free_stat'] . ' Улучшений параметров <br />';
if ($row['free_mf']) $r .= '+' . $row['free_mf'] . ' Улучшений модификаторов <br />';
$r .= '</div>';
} else {
$r .= '<span style="color: maroon;"><b>Свойства предмета не идентифицированы</b></span><br />';
}
$osob = array(22, 23);
if (in_array($row['type'], $osob)) {
$r .= 'Особенности:<br />';
if ($row['type'] == 22) {
$r .= '&bull; может одеваться под броню';
} elseif ($row['type'] == 23) {
$r .= '&bull; может одеваться на броню';
}
}
$r .= '</td>';
$r .= '</tr>';
$r .= '</tbody></table></div>';
}
return $r;
}
/**
* @param $id
* @return array
*/
function magicinf($id)
{
return db::c()->query('SELECT * FROM `magic` WHERE `id` = ?i', $id)->fetch_assoc();
}
/**
* @param $id
*/
function showpersinfo($id) {
$items = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i', $id)->fetch_assoc();
}
/**
* Отображение персонажа в main.php
* @param $id
*/
function showpersinv($id)
{
$user = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i', $id)->fetch_assoc();
$dressed = [];
$r = mysql_query("SELECT * FROM `inventory` WHERE
`id` = '$user[helm]' OR `id` = '$user[weap]' OR `id` = '$user[plaw]' OR `id` = '$user[bron]' OR
`id` = '$user[rybax]' OR `id` = '$user[belt]' OR `id` = '$user[sergi]' OR `id` = '$user[kulon]' OR
`id` = '$user[r1]' OR `id` = '$user[r2]' OR `id` = '$user[r3]' OR `id` = '$user[perchi]' OR
`id` = '$user[shit]' OR `id` = '$user[leg]' OR `id` = '$user[boots]' OR `id` = '$user[m1]' OR
`id` = '$user[m2]' OR `id` = '$user[m3]' OR `id` = '$user[m4]' OR `id` = '$user[m5]' OR
`id` = '$user[m6]' OR `id` = '$user[m7]' OR `id` = '$user[m8]' OR `id` = '$user[m9]' OR
`id` = '$user[m10]' OR `id` = '$user[m11]' OR `id` = '$user[m12]'");
while ($rec = mysql_fetch_assoc($r)) {
$dressed[$rec['id']] = $rec;
}
?>
<CENTER>
<img src="i/align_<?
echo($user['align'] > 0 ? $user['align'] : "0"); ?>.gif">
<img src="i/klan/<? ClanImage($user['klan']); ?>.gif">;
<B><?= $user['login'] ?></B> [<?= $user['level'] ?>]
<a href=inf.php?<?= $user['login'] ?> target=_blank><IMG SRC=i/inf.gif WIDTH=12 HEIGHT=11
ALT="Инф. о <?= $user['login'] ?>"></a>
<TABLE cellspacing=0 cellpadding=0>
<tr>
<TD colspan=3 width=100%>
<?= setHP($user['hp'], $user['maxhp'], 1); ?>
</td>
</tr>
<?
if ($user['level'] > 3) { ?>
<TR>
<TD colspan=3>
<? // TODO Сделать один запрос из десяти!
if ($user['m1'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['m1']}' LIMIT 1;"));
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=12"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m2'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['m2']}' LIMIT 1;"));
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=13"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m3'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['m3']}' LIMIT 1;"));
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=14"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m4'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['m4']}' LIMIT 1;"));
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=15"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m5'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['m5']}' LIMIT 1;"));
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=16"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
?>
</TD>
</TR>
<TR>
<TD colspan=3>
<?
if ($user['m6'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['m6']}' LIMIT 1;"));
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=17"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m7'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['m7']}' LIMIT 1;"));
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=18"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m8'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['m8']}' LIMIT 1;"));
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=19"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m9'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['m9']}' LIMIT 1;"));
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=20"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
if ($user['m10'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['m10']}' LIMIT 1;"));
$mess = 'Снять <b>' . $dress['name'] . '</b><br />Прочность ' . $dress['duration'] . '/' . $dress['maxdur'];
echo '<a href="?edit=1&drop=21"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=40 height=25></a>';
} else {
$mess = '<b>Пустой слот магия</b>';
echo '<img class=\'tooltip\' title=\'' . $mess . '\' src=i/w13.gif width=40 height=25>';
}
?>
</TD>
</TR>
<?
} ?>
<TR>
<TD width=62 valign=top>
<TABLE width=100% cellspacing=0 cellpadding=0>
<TR>
<TD><?php
if ($user['sergi'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['sergi']}' LIMIT 1;"));
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=1"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=20></a>';
} else {
echo '<img src="i/w1.gif" width=60 height=20 class=\'tooltip\' title=\'<b>Пустой слот Серьги</b>\' />';
}
?></TD>
</TR>
<TR>
<TD><?php
if ($user['kulon'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['kulon']}' LIMIT 1;"));
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=2"><img src="i/sh/' . $dress['img'] . '" width=60 height=20 class=\'tooltip\' title=\'' . $mess . '\'></a>';
} else {
echo '<img src="i/w2.gif" width=60 height=20 class=\'tooltip\' title=\'<b>Пустой слот Ожерелье</b>\' />';
}
?></TD>
</TR>
<TR>
<TD><?php
if ($user['weap'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['weap']}' LIMIT 1;"));
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=3"><img src="i/sh/' . $dress['img'] . '" width=60 height=60 class=\'tooltip\' title=\'' . $mess . '\'></a>';
} else {
echo '<img class=\'tooltip\' src="i/w3.gif" width=60 height=60 title=\'<b>Пустой слот Оружие</b>\' />';
}
?></TD>
</TR>
<TR>
<TD><?php
if ($user['bron'] > 0 || $user['rybax'] > 0 || $user['plaw'] > 0) {
if ($user['plaw']) {
$d = $user['plaw'];
$n = 23;
} elseif ($user['bron']) {
$d = $user['bron'];
$n = 4;
} elseif ($user['rybax']) {
$d = $user['rybax'];
$n = 22;
}
$dress = $dressed[$d];
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=' . $n . '"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=80></a>';
} else {
echo '<img class=\'tooltip\' src="i/w4.gif" width=60 height=80 title=\'<b>Пустой слот Броня</b>\' />';
}
?></TD>
</TR>
<TR>
<TD>
<TABLE cellspacing=0 cellpadding=0>
<tr>
<td><?php
if ($user['r1'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['r1']}' LIMIT 1;"));
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=5"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=20 height=20></a>';
} else {
echo '<img class=\'tooltip\' src="i/w6.gif" width=20 height=20 title=\'<b>Пустой слот Кольцо</b>\' />';
}
?></td>
<td><?php
if ($user['r2'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['r2']}' LIMIT 1;"));
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a class=\'tooltip\' title=\'' . $mess . '\' href="?edit=1&drop=6"><img src="i/sh/' . $dress['img'] . '" width=20 height=20></a>';
} else {
echo '<img src="i/w6.gif" width=20 height=20 class=\'tooltip\' title=\'<b>Пустой слот Кольцо</b>\' />';
}
?></td>
<td><?php
if ($user['r3'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['r3']}' LIMIT 1;"));
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=7"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=20 height=20></a>';
} else {
echo '<img class=\'tooltip\' src="i/w6.gif" width=20 height=20 title=\'<b>Пустой слот Кольцо</b>\' />';
}
?></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 = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['helm']}' LIMIT 1;"));
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=8"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=60></a>';
} else {
echo '<img class=\'tooltip\' src="i/w9.gif" width=60 height=60 title=\'<b>Пустой слот Шлем</b>\' />';
}
?></TD>
</TR>
<TR>
<TD><?php
if ($user['perchi'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['perchi']}' LIMIT 1;"));
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=9"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=40></a>';
} else {
echo '<img class=\'tooltip\' src="i/w11.gif" width=60 height=40 title=\'<b>Пустой слот Перчатки</b>\' />';
}
?></TD>
</TR>
<TR>
<TD><?php
if ($user['shit'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['shit']}' LIMIT 1;"));
$mess = 'Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '';
echo '<a href="?edit=1&drop=10"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=60></a>';
} else {
echo '<img class=\'tooltip\' src="i/w10.gif" width=60 height=60 title=\'<b>Пустой слот Щит</b>\' />';
}
?></TD>
</TR>
<TR>
<TD><?php
if
($user['boots'] > 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['boots']}' LIMIT 1;"));
$mess = '<span style="min-width: 350px;">Снять <b>' . $dress['name'] . '</b><br>Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '</span>';
echo '<a href="?edit=1&drop=11"><img class=\'tooltip\' title=\'' . $mess . '\' src="i/sh/' . $dress['img'] . '" width=60 height=40></a>';
} else {
echo '<img class=\'tooltip\' src="i/w12.gif" width=60 height=40 title=\'<b>Пустой слот Обувь</b>\' />';
}
?></TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
<table cellspacing="0" cellpadding="0" border="0"
style="background: url('http://i.oldbk.com/i/runes_slots.jpg') no-repeat center bottom;">
<tbody>
<tr>
<td width="59" height="48" align="right"><? echo show_rune(1, $user['id'], 1); ?></td>
<td width="74" height="48" align="center"><? echo show_rune(2, $user['id'], 1); ?></td>
<td width="57" height="48" align="left"><? echo show_rune(3, $user['id'], 1); ?></td>
</tr>
</tbody>
</table>
</CENTER> <?php
}
function show_rune($slot, $uid, $type = 0)
{
global $user, $runes_exp;
$us = db::c()->query('SELECT `id`, `rune_1`, `rune_2`, `rune_3` FROM `users` WHERE `id` = ?i', $uid)->fetch_assoc();
if (isset($us['id'])) {
if ($us['rune_' . $slot] > 0) {
$ruid = $us['rune_' . $slot];
$rtype = (23 + $slot);
$dress = db::c()->query('SELECT `id`, `img`, `name`, `duration`, `maxdur`, `rune_level`, `rune_exp` FROM `inventory` WHERE `id` = ?i AND `owner` = ?i', $ruid, $us['id'])->fetch_assoc();
if (isset($dress['id'])) {
if ($us['id'] == $user['id'] && $type == 1) {
$r = '<a href=\'main.php?edit=1&drop=' . $rtype . '\'><img class=\'tooltip\' src="i/sh/' . $dress['img'] . '" width="30" height="30" title="Снять <b>' . $dress['name'] . '</b><br />Уровень: ' . $dress['rune_level'] . '<br />Опыт: ' . $dress['rune_exp'] . '/' . $runes_exp[$dress['rune_level'] + 1] . '<br />Прочность: ' . $dress['duration'] . '/' . $dress['maxdur'] . '" /></a>';
} else {
$r = '<img class=\'tooltip\' src="i/sh/' . $dress['img'] . '" width="30" height="30" title="<b>' . $dress['name'] . '</b><br />Уровень: ' . $dress['rune_level'] . '<br />Прочность : ' . $dress['duration'] . '/' . $dress['maxdur'] . '" />';
}
} else {
$r = '<img class=\'tooltip\' src="i/none.gif" width="30" height="30" title="<b>Пустой слот Руна</b>" />';
}
} else {
$r = '<img class=\'tooltip\' src="i/none.gif" width="30" height="30" title="<b>Пустой слот Руна</b>" />';
}
} else {
$r = '<img class=\'tooltip\' src="i/none.gif" width="30" height="30" title="<b>Пустой слот Руна</b>" />';
}
return $r;
}
function undressall($id)
{
for ($i = 1; $i <= 26; $i++) {
dropitemid($i, $id);
}
}
function dropitemid_cave($slot, $id)
{
global $user;
switch ($slot) {
case 'sergi':
$slot = 1;
break;
case 'kulon':
$slot = 2;
break;
case 'weap':
$slot = 3;
break;
case 'bron':
$slot = 4;
break;
case 'r1':
$slot = 5;
break;
case 'r2':
$slot = 6;
break;
case 'r3':
$slot = 7;
break;
case 'helm':
$slot = 8;
break;
case 'perchi':
$slot = 9;
break;
case 'shit':
$slot = 10;
break;
case 'boots':
$slot = 11;
break;
case 'm1':
$slot = 12;
break;
case 'm2':
$slot = 13;
break;
case 'm3':
$slot = 14;
break;
case 'm4':
$slot = 15;
break;
case 'm5':
$slot = 16;
break;
case 'm6':
$slot = 17;
break;
case 'm7':
$slot = 18;
break;
case 'm8':
$slot = 19;
break;
case 'm9':
$slot = 20;
break;
case 'm10':
$slot = 21;
break;
case 'rybax':
$slot = 22;
break;
case 'plaw':
$slot = 23;
break;
}
if (mysql_query('UPDATE `users`, `inventory` SET `users`.' . $slot . ' = 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`.' . $slot . ' 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[$slot] = 0;
}
return true;
} else {
echo mysql_error();
}
}
function del_effs($uid, $eff, $txt)
{
$pers = mysql_fetch_array(mysql_query('SELECT `id`, `login`, `sila`, `lovk`, `inta`, `vinos`, `intel`, `hp`, `maxhp` FROM `users` WHERE `id` = "' . mysql_real_escape_string($uid) . '" LIMIT 1'));
if (isset($pers['id'])) {
$effect = mysql_fetch_array(mysql_query('SELECT `id`, `type`, `name`, `time`, `sila`, `lovk`, `inta`, `vinos`, `hp`, `proc_exp`, `owner`, `sleep`, `lastup`, `can` FROM `effects` WHERE `id` = "' . mysql_real_escape_string($eff) . '" AND `owner` = "' . $pers['id'] . '" LIMIT 1'));
if (isset($effect['id'])) {
if ($effect['type'] == 11 || $effect['type'] == 12 || $effect['type'] == 13 || $effect['type'] == 14) {
$pers['sila'] += $effect['sila'];
$pers['lovk'] += $effect['lovk'];
$pers['inta'] += $effect['inta'];
$pers['vinos'] += $effect['vinos'];
$pers['maxhp'] += $effect['hp'];
} else {
$pers['sila'] -= $effect['sila'];
$pers['lovk'] -= $effect['lovk'];
$pers['inta'] -= $effect['inta'];
$pers['vinos'] -= $effect['vinos'];
$pers['maxhp'] -= $effect['hp'];
}
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');
mysql_query('DELETE FROM `effects` WHERE `owner` = "' . $pers['id'] . '" AND `id` = "' . $effect['id'] . '" LIMIT 1');
$text = 'Закончилось действие эффекта <b>' . $effect['name'] . '</b>.';
if ($txt == 1) {
addchp('<font color=red>Внимание!</font> ' . $text, '{[]}' . nick7($pers['id']) . '{[]}');
}
unset($pers, $effect, $uid, $eff, $text);
}
}
}
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;
case 24:
$slot1 = 'rune_1';
break;
case 25:
$slot1 = 'rune_2';
break;
case 26:
$slot1 = 'rune_3';
break;
}
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;
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;
case 24:
$slot1 = 'rune_1';
break;
case 25:
$slot1 = 'rune_2';
break;
case 26:
$slot1 = 'rune_3';
break;
}
{
if (mysql_query("UPDATE `users` as u, `inventory` as i SET u.{$slot1} = 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.{$slot1} AND i.dressed = 1 AND i.owner = {$user['id']} AND u.id = {$user['id']};"))
mysql_query("UPDATE `users` SET `hp` = `maxhp`, `fullhptime` = " . time() . " WHERE `hp` > `maxhp` AND `id` = '{$user['id']}' LIMIT 1;");
$wear_raw = mysql_query("SELECT * FROM inventory where owner={$user['id']} AND dressed='1';");
while ($wear_list = mysql_fetch_array($wear_raw)) {
$wear_arr[] = $wear_list['prototype'];
};
$item['id'] = $user[$slot1];
//foreach($wear_arr as $wt) echo($wt."<BR>");
$get_pro_raw = mysql_query("SELECT * FROM inventory where id={$item['id']} limit 1;");
$get_pro = mysql_fetch_array($get_pro_raw);
/////////////////////
$sets_items = mysql_query("SELECT * FROM item_sets");
//для каждого комплекта
while ($items_in_set = mysql_fetch_array($sets_items)) {
$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))) {
mysql_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
WHERE
u.id = {$user['id']} AND
s.set_id={$set_id};");
//echo ("Сняли ".$set_id);
};
};
return true;
}
}
//сможет держать
function derj($id)
{
global $user;
$ts = mysql_fetch_array(mysql_query('SELECT `id`, `nalign` FROM `inventory` WHERE `id` = "' . $id . '" LIMIT 1'));
$al = '(1 = 1)';
if ($ts['nalign'] > 0) {
if ($ts['nalign'] == 1.1) {
if (($user['align'] == 6 || ($user['align'] > 1 && $user['align'] < 2))) {
$al = '(1 = 1)';
} else {
$al = '(1 = 2)';
}
}
}
if ($dd = mysql_query("SELECT i.`id` FROM`users` AS `u`, `inventory` AS `i`
WHERE
i.needident = 0 AND
i.id = {$id} AND
i.duration < i.maxdur AND
i.owner = {$user['id']} 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
($al OR (" . (int)$user['align'] . " = i.nalign) or (i.nalign = 0)) AND
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 = {$user['id']};")) {
$dd = mysql_fetch_array($dd);
if ($dd[0] > 0) {
return true;
} else {
return false;
}
}
}
function make_seed()
{
list($usec, $sec) = explode(' ', microtime());
return (float)$sec + ((float)$usec * 100000);
}
function ref_drop()
{
global $user;
$slot = array('sergi', 'kulon', 'weap', 'bron', 'r1', 'r2', 'r3', 'helm', 'perchi', 'shit', 'boots', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9', 'm10');
for ($i = 0; $i <= 20; $i++) {
if ($user[$slot[$i]] && !derj($user[$slot[$i]])) {
dropitem($i + 1);
$user[$slot[$i]] = null;
}
}
}
function GetWeaponType($idwep)
{
if ($idwep == 0 || $idwep == null || $idwep == '') {
return "kulak";
}
$wep = mysql_fetch_array(mysql_query('SELECT `otdel`, `minu` FROM `inventory` WHERE `id` = "' . $idwep . '" LIMIT 1'));
if ($wep[0] == '1') {
return "noj";
} elseif ($wep[0] == '12') {
return "dubina";
} elseif ($wep[0] == '11') {
return "topor";
} elseif ($wep[0] == '13') {
return "mech";
} elseif ($wep[1] > 0) {
return "buket";
} else {
return "kulak";
}
}
function stripslashes_deep($text)
{
while (strstr($text, "\\")) {
$text = stripslashes($text);
}
return $text;
}
function countmf()
{ //TODO пересчитать модификаторы
global $user;
$zo = mysql_fetch_row(mysql_query("SELECT `id` FROM `effects` WHERE `type` = 201 AND `owner` = {$user['id']} LIMIT 1"));
$sokr = mysql_fetch_row(mysql_query("SELECT `id` FROM `effects` WHERE `type` = 202 AND `owner` = {$user['id']} LIMIT 1"));
if (isset($sokr[0])) {
$bmfud += 5;
} else {
$bmfud = 0;
}
if (isset($zo[0]) > 0) {
$bmfbron += 25;
} else {
$bmfbron = 0;
}
$mf = array();
$ud_raw = mysql_query('SELECT SUM(`minu`), SUM(`maxu`), SUM(`mfkrit`), SUM(`mfakrit`), SUM(`mfuvorot`), SUM(`mfauvorot`), SUM(`bron1`), SUM(`bron2`), SUM(`bron3`), SUM(`bron4`) FROM `inventory` WHERE `dressed` = 1 AND `owner` = \'' . $user['id'] . '\' LIMIT 1');
$user_dress = mysql_fetch_array($ud_raw);
$user_dress[6] = $bmfbron;
$user_dress[7] = $bmfbron;
$user_dress[8] = $bmfbron;
$user_dress[9] = $bmfbron;
$user_dress[6] += $user['ubron1'];
$user_dress[7] += $user['ubron2'];
$user_dress[8] += $user['ubron3'];
$user_dress[9] += $user['ubron4'];
$mykrit = $user_dress[2] + ($user['inta'] * 2.95);
$myakrit = $user_dress[3] + ($user['inta'] * 2.75);
$myuvorot = $user_dress[4] + ($user['lovk'] * 5);
$myauvorot = $user_dress[5] + ($user['lovk'] * 4);
$mf['me'] = array('udar' => (floor($user['sila'] / 3) + 1 + $user_dress[0]), 'maxudar' => (floor($user['sila'] / 3) + 4 + $user_dress[1]));
if ($mf['me']['udar'] < 0) {
$mf['me']['udar'] = 0;
}
$weap_b = 0;
switch (GetWeaponType($user['weap'])) {
case "noj":
$weap_b += $user['noj'];
break;
case "dubina":
$weap_b += $user['dubina'];
break;
case "topor":
$weap_b += $user['topor'];
break;
case "mech":
$weap_b += $user['mec'];
break;
}
return array('minu' => $mf['me']['udar'] + $bmfud + $weap_b, 'maxu' => $mf['me']['maxudar'] + $bmfud + $weap_b, 'fkrit' => round($mykrit, 0), 'fakrit' => round($myakrit, 0), 'fuvorot' => round($myuvorot, 0), 'fauvorot' => round($myauvorot, 0), 'bron1' => $user_dress[6], 'bron2' => $user_dress[7], 'bron3' => $user_dress[8], 'bron4' => $user_dress[9]);
}
// одеть предмет
function dressitem($id)
{
global $user;
$item = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` AS `i` WHERE `duration` < `maxdur` AND `id` = '{$id}' AND `owner` = '{$user['id']}' AND `dressed` = 0 LIMIT 1"));
switch ($item['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;
case 24:
$slot1 = 'rune_1';
break;
case 25:
$slot1 = 'rune_2';
break;
case 26:
$slot1 = 'rune_3';
break;
}
if ($item['type'] == 5) {
if (!$user['r1']) {
$slot1 = 'r1';
} elseif (!$user['r2']) {
$slot1 = 'r2';
} elseif (!$user['r3']) {
$slot1 = 'r3';
} else {
$slot1 = 'r1';
dropitem(5);
}
} elseif ($item['type'] == 24) {
if (!$user['rune_1']) {
$slot1 = 'rune_1';
} elseif (!$user['rune_2']) {
$slot1 = 'rune_2';
} elseif (!$user['rune_3']) {
$slot1 = 'rune_3';
} else {
$slot1 = 'rune_1';
dropitem(24);
}
} elseif ($item['type'] == 12) {
if (!$user['m1']) {
$slot1 = 'm1';
} elseif (!$user['m2']) {
$slot1 = 'm2';
} elseif (!$user['m3']) {
$slot1 = 'm3';
} elseif (!$user['m4']) {
$slot1 = 'm4';
} elseif (!$user['m5']) {
$slot1 = 'm5';
} elseif (!$user['m6']) {
$slot1 = 'm6';
} elseif (!$user['m7']) {
$slot1 = 'm7';
} elseif (!$user['m8']) {
$slot1 = 'm8';
} elseif (!$user['m9']) {
$slot1 = 'm9';
} elseif (!$user['m10']) {
$slot1 = 'm10';
} else {
$slot1 = 'm1';
dropitem(12);
}
} else {
dropitem($item['type']);
}
$al = '(1 = 1)';
if ($item['nalign'] > 0) {
if ($item['nalign'] == 1.1) {
if (($user['align'] == 6 || ($user['align'] > 1 && $user['align'] < 2))) {
$al = '(1 = 1)';
} else {
$al = '(1 = 2)';
}
}
}
if (!($item['type'] == 12 && $user['level'] < 4)) {
if (mysql_query("UPDATE `users` AS `u`, `inventory` AS `i` SET `u`.`{$slot1}` = {$id}, `i`.`dressed` = 1, `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`.`needident` = 0 AND `i`.`id` = {$id} AND `i`.`dressed` = 0 AND `i`.owner = {$user['id']} AND (20 + `u`.`sila`) >= `i`.`nsila` AND (20 + `u`.`lovk`) >= `i`.`nlovk` AND (20 + `u`.`inta`) >= `i`.`ninta` AND `u`.`vinos` >= `i`.`nvinos` AND (20 + `u`.`intel`) >= `i`.`nintel` AND `u`.`mudra` >= `i`.`nmudra` AND `u`.`level` >= `i`.`nlevel` AND (($al OR (" . (int)$user['align'] . " = `i`.`nalign`)) OR (`i`.`nalign` = 0)) AND `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` = {$user['id']}"))
$user[$slot1] = $item['id'];
return true;
}
}
function dressitemkomplekt($id, $idd)
{
global $user;
$item = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `owner` = " . $user['id'] . " AND `dressed` = 0 AND `duration` < `maxdur` AND `id` = '" . $idd . "' LIMIT 1"));
if (!isset($item['id'])) {
$item = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `owner` = " . $user['id'] . " AND `dressed` = 0 AND `duration` < `maxdur` AND `name` = '" . $id . "' ORDER BY `duration` DESC LIMIT 1"));
}
switch ($item['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;
case 24:
$slot1 = 'rune_1';
break;
case 25:
$slot1 = 'rune_2';
break;
case 26:
$slot1 = 'rune_3';
break;
}
if ($item['type'] == 5) {
if ($user['r1'] == 0) {
$slot1 = 'r1';
} elseif ($user['r2'] == 0) {
$slot1 = 'r2';
} elseif ($user['r3'] == 0) {
$slot1 = 'r3';
} else {
$slot1 = 'r1';
dropitem(5);
}
} elseif ($item['type'] == 24) {
if ($user['rune_1'] == 0) {
$slot1 = 'rune_1';
} elseif ($user['rune_2'] == 0) {
$slot1 = 'rune_2';
} elseif ($user['rune_3'] == 0) {
$slot1 = 'rune_3';
} else {
$slot1 = 'rune_1';
dropitem(24);
}
} elseif ($item['type'] == 12) {
if ($user['m1'] == 0) {
$slot1 = 'm1';
} elseif ($user['m2'] == 0) {
$slot1 = 'm2';
} elseif ($user['m3'] == 0) {
$slot1 = 'm3';
} elseif ($user['m4'] == 0) {
$slot1 = 'm4';
} elseif ($user['m5'] == 0) {
$slot1 = 'm5';
} elseif ($user['m6'] == 0) {
$slot1 = 'm6';
} elseif ($user['m7'] == 0) {
$slot1 = 'm7';
} elseif ($user['m8'] == 0) {
$slot1 = 'm8';
} elseif ($user['m9'] == 0) {
$slot1 = 'm9';
} elseif ($user['m10'] == 0) {
$slot1 = 'm10';
} else {
$slot1 = 'm1';
dropitem(12);
}
} else {
dropitem($item['type']);
}
if (!($item['type'] == 12 && $user['level'] < 4)) {
if (mysql_query("UPDATE `users` AS `u`, `inventory` AS `i` SET `u`.`{$slot1}` = `{$item['id']}`, `i`.`dressed` = 1,
`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`.`fkrit` = `u`.fkrit + i.mfkrit,
`u`.`fakrit` = `u`.fakrit + i.mfakrit,
`u`.`fuvorot` = `u`.fuvorot + i.mfuvorot,
`u`.`fauvorot` = `u`.fauvorot + i.mfauvorot,
`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`.`uminu` = `u`.uminu + i.minu,
`u`.`umaxu` = `u`.umaxu + i.maxu
WHERE `i`.`needident` = 0 AND `i`.`id` = {$item['id']} AND `i`.`dressed` = 0 AND `i`.`owner` = {$user['id']} AND ((('" . $user['align'] . "' > 7) AND ('" . $user['align'] . "' < 8)) OR ('" . (int)$user['align'] . "' = `i`.`nalign`) OR (`i`.`nalign` = 0)) AND `i`.`setsale` = 0 AND `u`.`id` = {$user['id']}")) {
$user[$slot1] = $item['id'];
return true;
}
}
}
// убить предмет
function destructitem($id)
{
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"));
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `owner` = '{$user['id']}' AND `id` = '{$id}' LIMIT 1;"));
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;
case 24:
$slot1 = 'rune_1';
break;
case 25:
$slot1 = 'rune_2';
break;
case 26:
$slot1 = 'rune_3';
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'] == 24) {
if ($user['rune_1'] == $dress['id']) {
$slot1 = 'rune_1';
} elseif ($user['rune_2'] == $dress['id']) {
$slot1 = 'rune_2';
} elseif ($user['rune_3'] == $dress['id']) {
$slot1 = 'rune_3';
}
} 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'])) {
mysql_query("DELETE FROM `inventory` WHERE `id` = '{$id}' LIMIT 1;");
//mysql_query("INSERT INTO `delo`(`id` , `author` ,`pers`, `text`, `type`, `date`) VALUES ('','0','{$user['id']}','Выброшен предмент {$dress['name']}. Цена:{$dress['cost']} кр.',1,'".time()."');");
//echo "<font color=red><b>Предмет \"{$dress['name']}\" утерян.</b></font>";
if ($dress['dressed'] == 1) {
mysql_query("UPDATE `users` SET `" . $slot1 . "` = 0 WHERE `id` = '{$user['id']}';");
}
}
}
// использовать магию
function usemagic($id)
{
global $user;
$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>";
}
if ($bet) {
if ($row['maxdur'] <= ($row['duration'] + 1)) {
//echo "<!--";
destructitem($row['id']);
//echo "-->";
} else {
if (!$row['magic']) {
mysql_query("UPDATE `inventory` SET `includemagicdex` =`includemagicdex`-{$bet} WHERE `id` = {$row['id']} LIMIT 1;");
} else {
mysql_query("UPDATE `inventory` SET `duration` =`duration`+{$bet} WHERE `id` = {$row['id']} LIMIT 1;");
}
}
if (!$charge) $charge = 0;
//ограничение по кол-ву за ход
if ($user['battle'] > 0)
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
if ($bat['magic'] == '')
$all_magic = array();
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 cavesys($text)
{
global $user;
if ($fp = @fopen("tmp/chat.txt", "a")) {
flock($fp, LOCK_EX);
fputs($fp, ":[" . time() . "]:[!cavesys!!]:[$text]:[$user[caveleader]]\r\n");
fflush($fp);
flock($fp, LOCK_UN);
fclose($fp);
}
}
function getchance($p)
{
if (mt_rand(1, 100) <= $p) {
return 1;
} else {
return 0;
}
}
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); //закрытие
}
function AddChatSystem($text)
{
$fp = fopen("tmp/chat.txt", "a");
flock($fp, LOCK_EX);
fputs($fp, ":[" . time() . "]:[!sys2all!!]:[" . ($text) . "]:[1]\r\n");
fflush($fp);
flock($fp, LOCK_UN);
fclose($fp);
}
function err($t)
{
echo '<span class="redalert">' . $t . '</span>';
return true;
}
// ставим травму
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 {
$travmalist = array("разбитый нос", "сотрясение первой степени", "потрепанные уши", "прикушенный язык", "перелом переносицы", "растяжение ноги", "растяжение руки", "подбитый глаз", "синяк под глазом", "кровоточащее рассечение", "отбитая <пятая точка>", "заклинившая челюсть", "выбитый зуб <мудрости>", "косоглазие");
$travmalist2 = array("отбитые почки", "вывих <вырезано цензурой>", "сотрясение второй степени", "оторванное ухо", "вывих руки", "оторванные уши", "поврежденный позвоночник", "отбитые почки", "поврежденный копчик", "разрыв сухожилия", "перелом ребра", "перелом двух ребер", "вывих ноги", "сломанная челюсть");
$travmalist3 = array("пробитый череп", "разрыв селезенки", "смещение позвонков", "открытый перелом руки", "открытый перелом <вырезано цензурой>", "излом носоглотки", "непонятные, но множественные травмы", "сильное внутреннее кровотечение", "раздробленная коленная чашечка", "перелом шеи", "смещение позвонков", "открытый перелом ключицы", "перелом позвоночника", "вывих позвоночника", "сотрясение третьей степени");
$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:
$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()>' . nick7($user['id']) . '</span>: ' . $text . ' ', '{[]}' . $to . '{[]}');
echo "<font color=red><b>Персонаж получил ваше сообщение</b></font>";
} else {
// если в офе
echo "<font color=red><b>Сообщение будет доставлено, как только персонаж будет on-line.</b></font>";
mysql_query("INSERT INTO `telegraph` (`owner`,`date`,`text`) VALUES ('" . $ur['id'] . "','','" . '[' . date("d.m.Y H:i") . '] <font color=darkblue>Сообщение по телеграфу от </font><span oncontextmenu=OpenMenu()>' . nick7($user['id']) . '</span>: ' . $text . ' ' . "');");
}
}
// telegrafick
function tele_check($to, $text)
{ //todo проверить где используется и убрать, как дублирующую telegraph().
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()>' . nick7($user['id']) . '</span>: ' . $text . ' ', '{[]}' . $to . '{[]}');
} else {
// если в офе
mysql_query("INSERT INTO `telegraph` (`owner`,`date`,`text`) VALUES ('" . $ur['id'] . "','','" . '[' . date("d.m.Y H:i") . '] <font color=darkblue>Сообщение по телеграфу от </font><span oncontextmenu=OpenMenu()>' . nick7($user['id']) . '</span>: ' . $text . ' ' . "');");
}
}
function get_meshok()
{
global $user;
$d = mysql_fetch_array(mysql_query("SELECT SUM(`gmeshok`) FROM `inventory` WHERE `owner` = '{$user['id']}' AND `setsale` = 0 AND `gmeshok` > 0"));
return ($user['sila'] * 4 + $d[0]);
}
function get_meshok_to($to)
{
$d = mysql_fetch_array(mysql_query("SELECT SUM(`gmeshok`) FROM `inventory` WHERE `owner` = '{$to}' AND `setsale` = 0 AND `gmeshok` > 0"));
$s = mysql_fetch_array(mysql_query("SELECT `sila` FROM `users` WHERE `id` = '{$to}' LIMIT 1"));
return ($s['sila'] * 4 + $d[0]);
}
function getweight($id)
{
return mysql_fetch_array(mysql_query("SELECT SUM(`massa`) AS `weight`, COUNT(`id`) AS `cnt` FROM `inventory` WHERE `owner` = $id AND `dressed` = 0 AND `setsale` = 0"));
}
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 max_mf()
{
$r = '';
$mfs = countmf();
if (($mfs['fkrit'] > $mfs['fakrit']) && ($mfs['fkrit'] > $mfs['fuvorot']) && ($mfs['fkrit'] > $mfs['fauvorot'])) {
$r = 'fkrit';
} elseif (($mfs['fakrit'] > $mfs['fkrit']) && ($mfs['fakrit'] > $mfs['fuvorot']) && ($mfs['fakrit'] > $mfs['fauvorot'])) {
$r = 'fakrit';
} elseif (($mfs['fuvorot'] > $mfs['fkrit']) && ($mfs['fuvorot'] > $mfs['fakrit']) && ($mfs['fuvorot'] > $mfs['fauvorot'])) {
$r = 'fuvorot';
} elseif (($mfs['fauvorot'] > $mfs['fkrit']) && ($mfs['fauvorot'] > $mfs['fakrit']) && ($mfs['fauvorot'] > $mfs['fuvorot'])) {
$r = 'fauvorot';
}
return $r;
}
/// fixme заводить переменную равную нулю и целую функцию, чтобы прибавить к нулю значение? исправить!
function sum_mf($u)
{
$t = 0;
$r = mysql_fetch_array(mysql_query('SELECT SUM(`add_proc_mf`) AS `mf` FROM `inventory` WHERE `owner` = "' . $u . '" AND `dressed` = "1" AND `add_proc_mf` > 0'));
$r = $t + $r['mf'];
return $r;
}
function sum_dmg($u)
{
$t = 0;
$r = mysql_fetch_array(mysql_query('SELECT SUM(`add_proc_uron`) AS `mf` FROM `inventory` WHERE `owner` = "' . $u . '" AND `dressed` = "1" AND `add_proc_uron` > 0'));
$r = $t + $r['mf'];
return $r;
}
function sum_bron($u)
{
$t = 0;
$r = mysql_fetch_array(mysql_query('SELECT SUM(`add_proc_bron`) AS `mf` FROM `inventory` WHERE `owner` = "' . $u . '" AND `dressed` = "1" AND `add_proc_bron` > 0'));
$r = $t + $r['mf'];
return $r;
}
function bron_ads($a1, $a2, $a3, $a4, $col)
{
return array('a1' => round(($a1 / 100) * $col), 'a2' => round(($a2 / 100) * $col), 'a3' => round(($a3 / 100) * $col), 'a4' => round(($a4 / 100) * $col));
}
function dressitem2($id)
{
global $user;
$item = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `duration` < `maxdur` AND `id` = '{$id}' AND `dressed` = 0; "));
switch ($item['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 ($item['type'] == 5) {
if (!$user['r1']) {
$slot1 = 'r1';
} elseif (!$user['r2']) {
$slot1 = 'r2';
} elseif (!$user['r3']) {
$slot1 = 'r3';
} else {
$slot1 = 'r1';
dropitem(5);
}
} elseif ($item['type'] == 12) {
if (!$user['m1']) {
$slot1 = 'm1';
} elseif (!$user['m2']) {
$slot1 = 'm2';
} elseif (!$user['m3']) {
$slot1 = 'm3';
} elseif (!$user['m4']) {
$slot1 = 'm4';
} elseif (!$user['m5']) {
$slot1 = 'm5';
} elseif (!$user['m6']) {
$slot1 = 'm6';
} elseif (!$user['m7']) {
$slot1 = 'm7';
} elseif (!$user['m8']) {
$slot1 = 'm8';
} elseif (!$user['m9']) {
$slot1 = 'm9';
} elseif (!$user['m10']) {
$slot1 = 'm10';
} else {
$slot1 = 'm1';
dropitem(12);
}
} else {
dropitem($item['type']);
}
//echo $slot1,$id,$user['id'],$user['align'],$item['id'];
if (!($item['type'] == 12 && $user['level'] < 4)) {
if (mysql_query("UPDATE `users` as u, `inventory` as i SET u.{$slot1} = {$id}, i.dressed = 1,
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
WHERE
i.needident = 0 AND
i.id = {$id} AND
i.dressed = 0 AND
i.owner = {$user['id']} 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
(((" . $user['align'] . " > 7) AND (" . $user['align'] . " < 8)) OR (" . (int)$user['align'] . " = i.nalign) or (i.nalign = 0)) AND
u.id = {$user['id']};")) {
$user[$slot1] = $item['id'];
return true;
}
}
}
function star_sign($month, $day)
{
$signs = ["10", "11", "12", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
$signsstart = [1 => 21, 2 => 20, 3 => 20, 4 => 20, 5 => 20, 6 => 20, 7 => 21, 8 => 22, 9 => 23, 10 => 23, 11 => 23, 12 => 23];
return $day < $signsstart[$month + 1] ? $signs[$month - 1] : $signs[$month % 12];
}
function SolveExp($at_id, $def_id, $damage)
{
$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"];
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;
}
$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();
$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"));
$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"));
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'];
$bt = db::c()->query('SELECT `blood`,`type`,`t1`,`t2` FROM `battle` WHERE `id` = ?i', $bat)->fetch_assoc();
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']) {
$expmf = $mods['bloodb'];
}
$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;
}
$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];
$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;
}
function vCode($LocID, $Stamp)
{
return md5(sha1($LocID . $Stamp));
}
?>