Перенос функций, вызываемых один раз в файлы, из которых они вызываются. Раскрытие функций-однострочников.

This commit is contained in:
Igor Barkov [iwork] 2018-07-02 18:35:25 +03:00
parent 54e64ff1ec
commit 44d106696f
15 changed files with 2108 additions and 2099 deletions

View File

@ -12,6 +12,44 @@ $eff = db::c()->query('SELECT `id` FROM `effects` WHERE `owner` = ?i AND (`type`
$w = db::c()->query('SELECT `value` FROM `variables` WHERE `var` = "arena_win"')->fetch_assoc(); $w = db::c()->query('SELECT `value` FROM `variables` WHERE `var` = "arena_win"')->fetch_assoc();
$al = aligntype($user['align']); $al = aligntype($user['align']);
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;
}
if ($w['value'] == 1) { if ($w['value'] == 1) {
$winers = 'Прошлая победа за Силами Тьмы'; $winers = 'Прошлая победа за Силами Тьмы';
} elseif ($w['value'] == 2) { } elseif ($w['value'] == 2) {

18
buy.php
View File

@ -3,9 +3,25 @@
session_start(); session_start();
if (!isset($_SESSION['uid'])) die(); if (!isset($_SESSION['uid'])) die();
include('config.php'); include('config.php');
include('functions.php'); #include('functions.php');
$is_now = db::c()->query('SELECT `id`, `uid` FROM `abils_user` WHERE `uid` = ?i', $user['id'])->fetch_assoc(); $is_now = db::c()->query('SELECT `id`, `uid` FROM `abils_user` WHERE `uid` = ?i', $user['id'])->fetch_assoc();
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 `id` = "' . $user['id'] . '" LIMIT 1');
return true;
}
}
return false;
}
$cost = array(1, 2, 10, 0.50, 0.80, 1, 1, 0.10, 0.20, 4, 0.02, 20, 10, 1, 1); $cost = array(1, 2, 10, 0.50, 0.80, 1, 1, 0.10, 0.20, 4, 0.02, 20, 10, 1, 1);
$mag = array('sleep15', 'sleep30', 'closebattle', 'heal20', 'heal35', 'heal50', 'travmoff', 'attack', 'bloodattack', 'death', 'comment', 'openbattle', 'reamdeath', 'clone', 'unclone'); $mag = array('sleep15', 'sleep30', 'closebattle', 'heal20', 'heal35', 'heal50', 'travmoff', 'attack', 'bloodattack', 'death', 'comment', 'openbattle', 'reamdeath', 'clone', 'unclone');

View File

@ -14,6 +14,23 @@ $clan = db::c()->query('SELECT `glava` FROM `clans` WHERE `id` = ?i', $user['kla
$cost = array(1, 2, 10, 0.50, 0.80, 1, 1, 0.10, 0.20, 4, 0.02, 20, 10, 1, 1); $cost = array(1, 2, 10, 0.50, 0.80, 1, 1, 0.10, 0.20, 4, 0.02, 20, 10, 1, 1);
$mag = array('sleep15', 'sleep30', 'closebattle', 'heal20', 'heal35', 'heal50', 'travmoff', 'attack', 'bloodattack', 'death', 'comment', 'openbattle', 'reamdeath', 'clone', 'unclone'); $mag = array('sleep15', 'sleep30', 'closebattle', 'heal20', 'heal35', 'heal50', 'travmoff', 'attack', 'bloodattack', 'death', 'comment', 'openbattle', 'reamdeath', 'clone', 'unclone');
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 `id` = "' . $user['id'] . '" LIMIT 1');
return true;
}
}
return false;
}
if (isset($_POST['type'], $_POST['user'])) { if (isset($_POST['type'], $_POST['user'])) {
if (isset($user['id'])) { if (isset($user['id'])) {
$price = $cost[$_POST['type'] - 21]; $price = $cost[$_POST['type'] - 21];

230
cave.php
View File

@ -9,6 +9,218 @@ $user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$_S
include("functions.php"); include("functions.php");
include('cave/cave_bots.php'); include('cave/cave_bots.php');
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 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 backpacksize($u = 0)
{ // $l * 10 +5
$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 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>" . nick::id($botid1)->full(1) . "</b>";
} else {
$rr = "<b>" . nick::id($user1['id'])->full(1) . "</b> и <b>" . nick::id($botid1)->full(1) . "</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 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();
}
}
$roomnames = array(621 => "Рудник"); $roomnames = array(621 => "Рудник");
if($user["login"] == "Rallo Tabs") { if($user["login"] == "Rallo Tabs") {
@ -194,6 +406,24 @@ function loadmap() {
$map = unserialize($map['map']); $map = unserialize($map['map']);
} }
function getslot($i, $user1 = 0)
{
global $userslots, $user;
if (!$user1) {
$user1 = $user;
}
foreach ($userslots as $k => $v) {
if ($user1[$v] == $i) {
return $v;
}
}
}
function getcavedata($caveleader, $floor)
{
return unserialize(implode("", file("cavedata/$caveleader-$floor.dat")));
}
if(!in_array($user['room'], $caverooms)) { if(!in_array($user['room'], $caverooms)) {
header("Location: main.php"); header("Location: main.php");
die('Not in this life ...'); die('Not in this life ...');

View File

@ -1,4 +1,25 @@
<? <?
function getchance($p)
{
if (mt_rand(1, 100) <= $p) {
return 1;
} else {
return 0;
}
}
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);
}
}
if(in_array($user['room'], $caverooms)) { if(in_array($user['room'], $caverooms)) {
include("caveitems.php"); include("caveitems.php");

7
ch.php
View File

@ -250,6 +250,13 @@ if (isset($_GET['online']) && $_GET['online'] != null) {
} }
if ($row['invis'] == 0 || $row['id'] == $_SESSION['uid']) { if ($row['invis'] == 0 || $row['id'] == $_SESSION['uid']) {
if (!empty($row['action'])) { if (!empty($row['action'])) {
function stripslashes_deep($text)
{
while (strstr($text, "\\")) {
$text = stripslashes($text);
}
return $text;
}
$rrr = $row['action']; $rrr = $row['action'];
$act = explode("<>:<>", $rrr); $act = explode("<>:<>", $rrr);
$aa = htmlspecialchars(stripslashes_deep($act[1])); $aa = htmlspecialchars(stripslashes_deep($act[1]));

View File

@ -7,6 +7,11 @@ ini_set('error_reporting', E_ALL);
include "config.php"; include "config.php";
include "functions.php"; include "functions.php";
function vCode($LocID, $Stamp)
{
return md5(sha1($LocID . $Stamp));
}
$timeStamp = time(); $timeStamp = time();
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;")); $user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"));

View File

@ -1,4 +1,26 @@
<? <?
function getchance($p)
{
if (mt_rand(1, 100) <= $p) {
return 1;
} else {
return 0;
}
}
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);
}
}
if(in_array($user['room'], $caverooms)) { if(in_array($user['room'], $caverooms)) {
include("caveitems.php"); include("caveitems.php");
mysql_query('LOCK TABLES `cavebots` WRITE, `caveitems` WRITE, `shop` WRITE, `caveparties` WRITE'); mysql_query('LOCK TABLES `cavebots` WRITE, `caveitems` WRITE, `shop` WRITE, `caveparties` WRITE');

View File

@ -21,7 +21,8 @@ while($zayavka) {
} }
} }
function delzayavka($id, $zay, $r, $f = 1) { function delzayavka($id, $zay, $r, $f = 1)
{
$z = getlist($r, null, $zay); $z = getlist($r, null, $zay);
if ($f != 1) { if ($f != 1) {
if ($z[$zay]['level'] > 3) { if ($z[$zay]['level'] > 3) {
@ -44,13 +45,15 @@ function delzayavka($id, $zay, $r, $f = 1) {
} }
} }
function fteam($team) { function fteam($team)
{
$team = explode(";", $team); $team = explode(";", $team);
unset($team[count($team) - 1]); unset($team[count($team) - 1]);
return $team; return $team;
} }
function getlist($razdel = 1, $level = null, $id = null ) { function getlist($razdel = 1, $level = null, $id = null)
{
$fict = mysql_query("SELECT * FROM `zayavka` WHERE " . (($level != null) ? " ((`t1min` <= '{$level}' OR `t1min` = '99') AND (`t1max` >= '{$level}' OR `t1max` = '99') " . (($razdel == 4) ? "AND (`t2min` <= '{$level}' OR `t2min` = '99') AND (`t2max` >= '{$level}' OR `t2max` = '99')" : "") . ") AND " : "") . " `level` = {$razdel} " . (($id != null) ? " AND `id` = {$id} " : "") . " ORDER BY `podan` DESC"); $fict = mysql_query("SELECT * FROM `zayavka` WHERE " . (($level != null) ? " ((`t1min` <= '{$level}' OR `t1min` = '99') AND (`t1max` >= '{$level}' OR `t1max` = '99') " . (($razdel == 4) ? "AND (`t2min` <= '{$level}' OR `t2min` = '99') AND (`t2max` >= '{$level}' OR `t2max` = '99')" : "") . ") AND " : "") . " `level` = {$razdel} " . (($id != null) ? " AND `id` = {$id} " : "") . " ORDER BY `podan` DESC");
while ($row = mysql_fetch_array($fict)) { while ($row = mysql_fetch_array($fict)) {
if (($row['start'] + 300) < time()) { if (($row['start'] + 300) < time()) {
@ -70,9 +73,12 @@ function getlist($razdel = 1, $level = null, $id = null ) {
return $zayavka; return $zayavka;
} }
function startbattle($id, $zay, $r) { function startbattle($id, $zay, $r)
{
$z = getlist($r, null, $zay); $z = getlist($r, null, $zay);
if($id == 'CHAOS') { $id = $z[$zay]['team1'][0]; } if ($id == 'CHAOS') {
$id = $z[$zay]['team1'][0];
}
delzayavka($id, $zay, $r); delzayavka($id, $zay, $r);
$z = $z[$zay]; $z = $z[$zay];
$count_users = count($z['team1']); $count_users = count($z['team1']);
@ -90,6 +96,61 @@ function startbattle($id, $zay, $r) {
} }
} }
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');
}
}
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;
}
if ($z['type'] == 4 || $z['type'] == 5) { if ($z['type'] == 4 || $z['type'] == 5) {
foreach ($z['team1'] as $k => $v) { foreach ($z['team1'] as $k => $v) {
undressall($v); undressall($v);
@ -100,6 +161,63 @@ function startbattle($id, $zay, $r) {
} }
} }
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'] . '"');
$travm = array(11, 12, 13, 14);
while ($row = mysql_fetch_array($efs)) {
if (in_array($row['type'], $travm)) {
$pers['sila'] += $row['sila'];
$pers['lovk'] += $row['lovk'];
$pers['inta'] += $row['inta'];
$pers['vinos'] += $row['vinos'];
} else {
$pers['sila'] -= $row['sila'];
$pers['lovk'] -= $row['lovk'];
$pers['inta'] -= $row['inta'];
$pers['vinos'] -= $row['vinos'];
$pers['maxhp'] -= $row['hp'];
}
$row['owner'] = ($user['id'] + _BOTSEPARATOR_);
mysql_query('UPDATE `effects` SET `owner` = "' . $row['owner'] . '" WHERE `id` = "' . $row['id'] . '" LIMIT 1');
mysql_query('UPDATE `users` SET `sila` = "' . $pers['sila'] . '", `lovk` = "' . $pers['lovk'] . '", `inta` = "' . $pers['inta'] . '", `vinos` = "' . $pers['vinos'] . '", `maxhp` = "' . $pers['maxhp'] . '" WHERE `id` = "' . $pers['id'] . '" LIMIT 1');
}
$udata = mysql_fetch_array(mysql_query('SELECT * FROM `deztow_realchars` WHERE `owner` = "' . $pers['id'] . '" LIMIT 1'));
if (isset($udata['id'])) {
$udata['sila'] = $pers['sila'];
$udata['lovk'] = $pers['lovk'];
$udata['inta'] = $pers['inta'];
$udata['vinos'] = $pers['vinos'];
$udata['maxhp'] = $pers['maxhp'];
$udata['money'] = $pers['money'];
$udata['level'] = $pers['level'];
$udata['exp'] = $pers['exp'];
$udata['nextup'] = $pers['nextup'];
$udata['align'] = $pers['align'];
$udata['stats'] = $pers['stats'];
$udata['master'] = $pers['master'];
$udata['intel'] = $pers['intel'];
$udata['noj'] = $pers['noj'];
$udata['mec'] = $pers['mec'];
$udata['topor'] = $pers['topor'];
$udata['dubina'] = $pers['dubina'];
$udata['mlight'] = $pers['mlight'];
$udata['mgray'] = $pers['mgray'];
$udata['mdark'] = $pers['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 ("' . $pers['id'] . '", "' . $pers['sila'] . '", "' . $pers['lovk'] . '", "' . $pers['inta'] . '", "' . $pers['vinos'] . '", "' . $pers['maxhp'] . '", "' . $pers['intel'] . '", "' . $pers['level'] . '", "' . $pers['money'] . '", "' . $pers['exp'] . '", "' . $pers['nextup'] . '", "' . $pers['align'] . '", "' . $pers['stats'] . '", "' . $pers['master'] . '", "' . $pers['noj'] . '", "' . $pers['mec'] . '", "' . $pers['topor'] . '", "' . $pers['dubina'] . '", "' . $pers['mlight'] . '", "' . $pers['mgray'] . '", "' . $pers['mdark'] . '")');
}
}
if ($z['type'] == 3 || $z['type'] == 5) { if ($z['type'] == 3 || $z['type'] == 5) {
if ($count_users < 4) { if ($count_users < 4) {
mysql_query("UPDATE `users` SET `zayavka` = '0' WHERE `zayavka` = '" . $zay . "'"); mysql_query("UPDATE `users` SET `zayavka` = '0' WHERE `zayavka` = '" . $zay . "'");
@ -113,7 +231,8 @@ function startbattle($id, $zay, $r) {
} }
$all = count($z['team1']) - 1; $all = count($z['team1']) - 1;
$power1 = 0; $power2 = 0; $power1 = 0;
$power2 = 0;
for ($i = 0; $i <= $all; $i++) { for ($i = 0; $i <= $all; $i++) {
if ($z['team1'][$i] < _BOTSEPARATOR_) { if ($z['team1'][$i] < _BOTSEPARATOR_) {
@ -187,9 +306,11 @@ function startbattle($id, $zay, $r) {
} }
if ($z['type'] == 1 || $z['type'] == 4) { if ($z['type'] == 1 || $z['type'] == 4) {
$rs = ', `fiz`'; $rss = ', 1'; $rs = ', `fiz`';
$rss = ', 1';
} else { } else {
$rs = ''; $rss = ''; $rs = '';
$rss = '';
} }
mysql_query("INSERT INTO `battle` (`coment`, `teams`, `timeout`, `type`, `status`, `t1`, `t2`, `to1`, `to2`, `blood`$rs, `bots`) VALUES ('{$z['coment']}', '" . serialize($teams) . "', '{$z['timeout']}', '{$z['type']}', '0', '" . implode(";", $z['team1']) . "', '" . implode(";", $z['team2']) . "', '" . time() . "', '" . time() . "', '" . $z['blood'] . "'$rss, '" . $z['bots'] . "')"); mysql_query("INSERT INTO `battle` (`coment`, `teams`, `timeout`, `type`, `status`, `t1`, `t2`, `to1`, `to2`, `blood`$rs, `bots`) VALUES ('{$z['coment']}', '" . serialize($teams) . "', '{$z['timeout']}', '{$z['type']}', '0', '" . implode(";", $z['team1']) . "', '" . implode(";", $z['team2']) . "', '" . time() . "', '" . time() . "', '" . $z['blood'] . "'$rss, '" . $z['bots'] . "')");
@ -197,7 +318,9 @@ function startbattle($id, $zay, $r) {
$rr = "<b>"; $rr = "<b>";
foreach ($z['team1'] as $k => $v) { foreach ($z['team1'] as $k => $v) {
if($k != 0) { $rr .= ", "; } if ($k != 0) {
$rr .= ", ";
}
$rr .= nick::id($v)->full(1); $rr .= nick::id($v)->full(1);
file_get_contents(GAMEDOMAIN . '/chats.php?id=7&user=' . $v); file_get_contents(GAMEDOMAIN . '/chats.php?id=7&user=' . $v);
} }
@ -205,7 +328,9 @@ function startbattle($id, $zay, $r) {
$rr .= "</b> и <b>"; $rr .= "</b> и <b>";
foreach ($z['team2'] as $k => $v) { foreach ($z['team2'] as $k => $v) {
if($k != 0) { $rr .= ", "; } if ($k != 0) {
$rr .= ", ";
}
$rr .= nick::id($v)->full(1); $rr .= nick::id($v)->full(1);
file_get_contents(GAMEDOMAIN . '/chats.php?id=7&user=' . $v); file_get_contents(GAMEDOMAIN . '/chats.php?id=7&user=' . $v);
} }
@ -229,6 +354,7 @@ function startbattle($id, $zay, $r) {
} }
} }
} }
########## ##########
########Start Заявки для ботов в хаоты######## ########Start Заявки для ботов в хаоты########
@ -437,7 +563,9 @@ if(date("z-H-i") == date("z-H-i", $turnirstart['value']))
$rum = rand($minroom, $maxroom); $rum = rand($minroom, $maxroom);
$urs[$row['owner']] = $rum; $urs[$row['owner']] = $rum;
$i++; $i++;
if($i > 1) { $lors .= ", "; } if ($i > 1) {
$lors .= ", ";
}
$lors .= nick::id($row['owner'])->full(1); $lors .= nick::id($row['owner'])->full(1);
} }

View File

@ -6,6 +6,38 @@ include("config.php");
include("functions.php"); include("functions.php");
if($user['battle'] != 0) { header('location: fbattle.php'); die(); } if($user['battle'] != 0) { header('location: fbattle.php'); die(); }
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) . " сек.";
}
if($_GET['ext'] == 1) { if($_GET['ext'] == 1) {
$yas = mysql_fetch_array(mysql_query("SELECT `id` FROM `vxodd` WHERE `login` = '$user[login]' LIMIT 1")); $yas = mysql_fetch_array(mysql_query("SELECT `id` FROM `vxodd` WHERE `login` = '$user[login]' LIMIT 1"));
$yad = mysql_fetch_array(mysql_query("SELECT `id` FROM `vxod` WHERE `login` = '$user[login]' LIMIT 1")); $yad = mysql_fetch_array(mysql_query("SELECT `id` FROM `vxod` WHERE `login` = '$user[login]' LIMIT 1"));

File diff suppressed because it is too large Load Diff

View File

@ -4,12 +4,51 @@ if(!isset($_SESSION['uid'])) { header('Location: index.php'); die(); }
include('config.php'); include('config.php');
$user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$_SESSION['uid'].'" LIMIT 1')); $user = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "'.$_SESSION['uid'].'" LIMIT 1'));
$hostel = mysql_fetch_array(mysql_query('SELECT `id`, `uid`, `type`, `time` FROM `hostel` WHERE `uid` = "'.$user['id'].'" LIMIT 1')); $hostel = mysql_fetch_array(mysql_query('SELECT `id`, `uid`, `type`, `time` FROM `hostel` WHERE `uid` = "'.$user['id'].'" LIMIT 1'));
include('functions.php'); #include('functions.php');
$error = ''; $rs = ''; $error = ''; $rs = '';
$base = array(1 => array('type' => 'Сумка'), 2 => array('type' => 'Сундук'), 3 => array('type' => 'Комната'), 4 => array('type' => 'Амбар')); $base = array(1 => array('type' => 'Сумка'), 2 => array('type' => 'Сундук'), 3 => array('type' => 'Комната'), 4 => array('type' => 'Амбар'));
$times = array(1 => 7, 2 => 14, 3 => 21, 4 => 28); $times = array(1 => 7, 2 => 14, 3 => 21, 4 => 28);
$cost = array(1 => array(8, 16, 24, 32), 2 => array(15, 30, 45, 60), 3 => array(25, 50, 75, 100), 4 => array(40, 80, 120, 160)); $cost = array(1 => array(8, 16, 24, 32), 2 => array(15, 30, 45, 60), 3 => array(25, 50, 75, 100), 4 => array(40, 80, 120, 160));
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 . '"');
}
}
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;
}
if($_GET['exit'] == 1) { if($_GET['exit'] == 1) {
if($user['sleep'] == 0) { if($user['sleep'] == 0) {
mysql_query('UPDATE `users`,`online` SET `users`.`room` = 26, `online`.`room` = 26 WHERE `users`.`id` = "'.$user['id'].'" AND `online`.`id` = "'.$user['id'].'"'); mysql_query('UPDATE `users`,`online` SET `users`.`room` = 26, `online`.`room` = 26 WHERE `users`.`id` = "'.$user['id'].'" AND `online`.`id` = "'.$user['id'].'"');

View File

@ -11,6 +11,273 @@ $hostel = mysql_fetch_array(mysql_query('SELECT * FROM `hostel` WHERE `uid` = "'
$base = array(1 => 15, 2 => 30, 3 => 50, 4 => 100); $base = array(1 => 15, 2 => 30, 3 => 50, 4 => 100);
$vips = array(1 => 0.15, 2 => 0.30, 3 => 0.45); $vips = array(1 => 0.15, 2 => 0.30, 3 => 0.45);
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 = db::c()->query('SELECT * FROM `magic` WHERE `id` = ?i', $$row['magic'])->fetch_assoc();
$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;
}
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;
}
if($user['vip'] > 0 && $user['vip_time'] > time()) { if($user['vip'] > 0 && $user['vip_time'] > time()) {
$count = $base[$hostel['type']]; $count = $base[$hostel['type']];
$count += floor($base[$hostel['type']]*$vips[$user['vip']]); $count += floor($base[$hostel['type']]*$vips[$user['vip']]);

617
main.php
View File

@ -14,6 +14,621 @@ if ($user['battle'] != 0) {
die(); die();
} }
/// 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 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;
}
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) ");
}
}
}
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 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 countmf()
{ //TODO пересчитать модификаторы
global $user;
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";
}
}
$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;
}
}
/**
* Отображение персонажа в 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 updstats() function updstats()
{ {
global $user; global $user;
@ -2032,7 +2647,7 @@ if (isset($_GET['edit'])) {
if ($d[0] < 0) { if ($d[0] < 0) {
$d[0] = 0; $d[0] = 0;
} }
$d = getweight($user['id']); $d = mysql_fetch_array(mysql_query("SELECT SUM(`massa`) AS `weight`, COUNT(`id`) AS `cnt` FROM `inventory` WHERE `owner` = {$user['id']} AND `dressed` = 0 AND `setsale` = 0"));
echo $d['weight'] + 0; echo $d['weight'] + 0;
?>/<?= get_meshok() ?>)</B> ?>/<?= get_meshok() ?>)</B>
</td> </td>

207
shop.php
View File

@ -19,6 +19,213 @@ if ($user['battle'] != 0) {
$sellItemId = filter_input(INPUT_GET,'sellitem'); $sellItemId = filter_input(INPUT_GET,'sellitem');
$saleItems = false; $saleItems = false;
/**
* Показать предмет в магазине
*
* @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 = db::c()->query('SELECT * FROM `magic` WHERE `id` = ?i', $item['magic'])->fetch_assoc();
$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;
}
if ($sellItemId && is_numeric($sellItemId)) { if ($sellItemId && is_numeric($sellItemId)) {
$dress = db::c()->query('SELECT `id`, `name`, `cost`, `type`, `duration`, `maxdur`, `goden`, `dategoden`, `koll` FROM `inventory` WHERE `dressed` = 0 AND `id` = ?i AND `owner` = ?i', $sellItemId, $user['id'])->fetch_assoc(); $dress = db::c()->query('SELECT `id`, `name`, `cost`, `type`, `duration`, `maxdur`, `goden`, `dategoden`, `koll` FROM `inventory` WHERE `dressed` = 0 AND `id` = ?i AND `owner` = ?i', $sellItemId, $user['id'])->fetch_assoc();
$price = $dress['cost'] * 1; $price = $dress['cost'] * 1;