From 427149b90e94bca315f5d969579fd78c5f28e369 Mon Sep 17 00:00:00 2001 From: lopar Date: Sun, 30 Aug 2020 02:21:22 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A7=D0=B8=D1=81=D1=82=D0=BA=D0=B0=20=D0=BE?= =?UTF-8?q?=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=B8=20=D1=83=D0=BD=D0=B8=D1=84=D0=B8=D0=BA=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=BA=D0=BE=D0=B4=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/admin.php | 229 +-- admin/edit_user.php | 45 +- cave.php | 2760 +++++++++++++++++++-------------- clan.php | 188 ++- classes/User.php | 3 + classes/battle_new.class.php | 4 +- classes/input.php | 31 - contacts.php | 62 +- cronjobs/cron_bots_battle.php | 4 +- fbattle.php | 2 +- functions.php | 103 +- labirint.php | 2 +- main.php | 519 +++---- navig.php | 2 +- repair.php | 179 ++- zayavka.php | 5 +- 16 files changed, 2119 insertions(+), 2019 deletions(-) delete mode 100644 classes/input.php diff --git a/admin/admin.php b/admin/admin.php index 39ac10d..2c57a05 100644 --- a/admin/admin.php +++ b/admin/admin.php @@ -202,10 +202,6 @@ $aligns = db::c()->query('SELECT `img`,`align`,`name` FROM `aligns` ORDER BY `al Кланы @@ -291,7 +262,7 @@ $aligns = db::c()->query('SELECT `img`,`align`,`name` FROM `aligns` ORDER BY `al - + - - - - - - - - - - - + + + + + + + + + + + + + - + - чекбокс? + - что это? - - - чекбокс? - - - - - - - - - - - - - - - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -571,7 +469,6 @@ switch ($_POST['use']) { /* Подключаем строго тот свито case "ct3": include("../magic/ct3.php"); break; - case "sleep": include("../magic/sleep.php"); break; @@ -605,7 +502,6 @@ switch ($_POST['use']) { /* Подключаем строго тот свито case "ldadd": include("../magic/ldadd.php"); break; - case "attack": include("../magic/eattack.php"); break; @@ -621,7 +517,6 @@ switch ($_POST['use']) { /* Подключаем строго тот свито case "attackk_open": include("../magic/attackk_open.php"); break; - case "pal_off": include("../magic/pal_off.php"); break; @@ -672,7 +567,6 @@ switch ($_POST['use']) { /* Подключаем строго тот свито echo "
Абилки:Пока что привязаны к общей системе. Работают выборочно.
"; $script_name = $magic_name = ''; foreach ($moj as $k => $v) { - #echo $k; switch ($k) { /* 45 скриптов на 36 умелок? Неплохо… */ case "vip": $script_name = "vipad"; @@ -856,7 +750,9 @@ foreach ($moj as $k => $v) { break; } # Эта строка генерирует свитки с навыком. Но нам нужен просто перечень всего… - if ($script_name) print " "; + if ($script_name) { + print " "; + } } echo "
"; ?> @@ -872,31 +768,6 @@ echo ""; - - Выдать чёртов ВИП - и переписать функцию выдачи как будет время - - - - - - - - Добавить в «дело» игрока заметку о нарушении правил, прокрутке и пр. @@ -995,8 +866,12 @@ if ($_POST['login'] && $_POST['krest']) { $rang = ''; break; } - if ($_POST['krest'] == -1) db::c()->query('UPDATE `users` SET `align`="?s", `status`="?s" WHERE `login` = "?s" LIMIT 1;', '0', '', $_POST['login']); - else db::c()->query('UPDATE `users` SET `align` = "?s", `status` = "?s" WHERE `login` = "?s"', $_POST['krest'], $rang, $_POST['login']); + if ($_POST['krest'] == -1) { + db::c()->query('UPDATE `users` SET `align`="?s", `status`="?s" WHERE `login` = "?s" LIMIT 1;', '0', '', $_POST['login']); + } + else { + db::c()->query('UPDATE `users` SET `align` = "?s", `status` = "?s" WHERE `login` = "?s"', $_POST['krest'], $rang, $_POST['login']); + } } @@ -1206,9 +1081,7 @@ if ($_POST['login'] && $_POST['krest']) { Hint3Name = ''; Hint3Closed = false; } - - - - - - - + .lw3 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/lw3.gif) + } + + .lw4 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/lw4.gif) + } + + .rw0 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/rw0.gif) + } + + .rw1 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/rw1.gif) + } + + .rw2 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/rw2.gif) + } + + .rw3 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/rw3.gif) + } + + .rw4 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/rw4.gif) + } + + .lsw0 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/lsw0.gif) + } + + .lsw1 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/lsw1.gif) + } + + .lsw2 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/lsw2.gif) + } + + .lsw3 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/lsw3.gif) + } + + .lsw4 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/lsw4.gif) + } + + .lsw42 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/lsw42.gif) + } + + .rsw0 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/rsw0.gif) + } + + .rsw1 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/rsw1.gif) + } + + .rsw2 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/rsw2.gif) + } + + .rsw3 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/rsw3.gif) + } + + .rsw4 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/rsw4.gif) + } + + .rsw42 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/rsw42.gif) + } + + .lw42 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/lw42.gif) + } + + .rw42 { + position: absolute; + left: 0; + top: 0; + width: 352px; + height: 240px; + background-image: url(/rw42.gif) + } + + .maptd { + width: 15px; + height: 15px; + } + + + +
- - + +
Требования
Характеристики
"; $i = 7; $centerwall = 8; - while($i > 0) { - if($map[3][$i]) { - $centerwall = $i; - } - $i -= 2; + while ($i > 0) { + if ($map[3][$i]) { + $centerwall = $i; + } + $i -= 2; } $i = 4; - function drawbot($cell, $x, $y) { - global $botnames, $imgdata, $bots, $dialogs, $user, $floor; - $data = explode("/", $cell); - $i = 1; - $bc = (count($data)-1)/2; - while($data[$i]) { + function drawbot($cell, $x, $y) + { + global $botnames, $imgdata, $bots, $dialogs, $user, $floor; + $data = explode("/", $cell); + $i = 1; + $bc = (count($data) - 1) / 2; + while ($data[$i]) { + $bot = $data[$i]; + $botname = $botnames[$bot]; + $cnt = $data[$i + 1]; + if ($i == 1) { + if ($bc == 1) { + $bn = 1; + } else { + $bn = 0; + } + } elseif ($i == 3) { + if ($bc == 2) { + $bn = 2; + } else { + $bn = 1; + } + } else { + $bn = 2; + } + + $aMap = unserialize(mysql_result(mysql_query("SELECT `map` FROM `caves` WHERE `leader` = '$user[caveleader]' AND `floor` = '$floor'"), 0, 0)); + + if (!$GLOBALS['dir']) { + $xx = ($GLOBALS['x'] * 2) - ($y * 2); + $yy = ($GLOBALS['y'] * 2) - ($x - 3); + } elseif ($GLOBALS['dir'] == 1) { + $xx = ($GLOBALS['x'] * 2) + ($x - 3); + $yy = ($GLOBALS['y'] * 2) - ($y * 2); + } elseif ($GLOBALS['dir'] == 2) { + $xx = ($GLOBALS['x'] * 2) + ($y * 2); + $yy = ($GLOBALS['y'] * 2) + ($x - 3); + } else { + $xx = ($GLOBALS['x'] * 2) - ($x - 3); + $yy = ($GLOBALS['y'] * 2) + ($y * 2); + } + + if (strpos($aMap[$yy][$xx], 'o/') !== false || strpos($aMap[$yy][$xx], 'p/') !== false) { + $ret .= drawobject2($aMap[$yy][$xx], $x, $y); + } + + $rrm = $user['room']; + + if (isset($dialogs[$bots[$data[1]]]) && ($bots[$data[1]] == 11147 && $user['room'] == 74)) { + $ret .= " 1 ? " ($cnt)" : "") . "\" " . ($y == 1 && $x == 3 ? "onclick=\"speakattackmenu(event);\"" : "") . " width=\"" . $imgdata[$x][$y]["wd"] . "\" height=\"" . $imgdata[$x][$y]["ht"] . "\" src=\"/i/dungeon/mobs/$rrm/$bot.gif\" style=\"position: absolute; left: " . $imgdata[$x][$y]["x"][$bn] . "px; top: " . $imgdata[$x][$y]["y"] . "px;" . ($x == 3 && $y == 1 ? "cursor: pointer;" : "") . ($x == 3 ? "z-index: " . (99 - ($y * 5)) . ";" : "") . "\" />"; + } else { + $ret .= " 1 ? " ($cnt)" : "") . "\" " . ($y == 1 && $x == 3 ? " onclick=\"document.location.href='cave.php?attack=1';\"" : "") . " width=\"" . $imgdata[$x][$y]["wd"] . "\" height=\"" . $imgdata[$x][$y]["ht"] . "\" src=\"/i/dungeon/mobs/$rrm/$bot.gif\" style=\"position: absolute; left: " . $imgdata[$x][$y]["x"][$bn] . "px; top: " . $imgdata[$x][$y]["y"] . "px;" . ($x == 3 && $y == 1 ? "cursor: pointer;" : "") . ($x == 3 ? "z-index: " . (99 - ($y * 5)) . ";" : "") . "\" />"; + }#onclick=\"attackmenu(event);\" + $i += 2; + } + return $ret; + } + + function drawdialog($cell, $x, $y) + { + global $dialogs, $imgdata; + $data = explode("/", $cell); + $i = 1; + $d = $data[2]; $bot = $data[$i]; $botname = $botnames[$bot]; - $cnt = $data[$i+1]; - if($i == 1) { - if($bc == 1) { - $bn = 1; - } else { - $bn = 0; - } - } elseif($i == 3) { - if($bc == 2) { - $bn = 2; - } else { - $bn = 1; - } + $cnt = $data[$i + 1]; + $ret = ""; + return $ret; + } + + function drawuser($cell, $x, $y) + { + global $botnames, $imgdata, $party; + $data = explode("/", $cell); + $i = 1; + $bc = (count($data) - 1); + while ($data[$i]) { + $u = $data[$i]; + if ($i == 1) { + if ($bc == 1) { + $bn = 1; + } else { + $bn = 0; + } + } elseif ($i == 3) { + if ($bc == 2) { + $bn = 2; + } else { + $bn = 1; + } + } else { + $bn = 2; + } + foreach ($party as $k => $v) { + if ($v['user'] == $u) { + $udata = $v; + break; + } + } + $ret .= ""; + $i++; + } + return $ret; + } + + function drawobject($cell, $x, $y) + { + global $objects, $imgdata, $user, $objdata, $objsizes, $imgmap; + $tmp = explode("/", $cell); + $obj = $tmp[1]; + $ht = round($imgdata[$x][$y]["ht"] / 2); + + if ($objsizes[$obj]) { + $coef = $objdata[$x][$y]["coef"]; + $wd = $objsizes[$obj][0] * $coef; + $ht = $objsizes[$obj][1] * $coef; + $left = round($objdata[$x][$y]["x"] - ($wd / 2)); + $top = $objdata[$x][$y]["y"] - $ht; + } elseif ($obj == 510) { + $wd = round($imgdata[$x][$y]["wd"] * 2.5); + $ht = $imgdata[$x][$y]["ht"]; + $left = $imgdata[$x][$y]["x"][1] - round(($wd - $imgdata[$x][$y]["wd"]) / 2); + $top = $imgdata[$x][$y]["y"]; + } elseif ($obj > 600 && $obj < 700) { + $wd = round($imgdata[$x][$y]["wd"] * 1.26); + $left = $imgdata[$x][$y]["x"][1] - round(($wd - $imgdata[$x][$y]["wd"]) / 2); + $top = $imgdata[$x][$y]["y"] + $ht; + } elseif ($obj >= 700 && $obj < 800) { + $wd = round($imgdata[$x][$y]["wd"] * 1.24); + $ht = $imgdata[$x][$y]["ht"]; + $left = $imgdata[$x][$y]["x"][1] - round(($wd - $imgdata[$x][$y]["wd"]) / 2); + $top = $imgdata[$x][$y]["y"]; } else { - $bn = 2; + $wd = $imgdata[$x][$y]["wd"]; + $left = $imgdata[$x][$y]["x"][1]; + $top = $imgdata[$x][$y]["y"] + $ht; } - - $aMap = unserialize(mysql_result(mysql_query("SELECT `map` FROM `caves` WHERE `leader` = '$user[caveleader]' AND `floor` = '$floor'"), 0, 0)); - - if(!$GLOBALS['dir']) { - $xx = ($GLOBALS['x']*2) - ($y*2); - $yy = ($GLOBALS['y']*2) - ($x - 3); - } elseif($GLOBALS['dir'] == 1) { - $xx = ($GLOBALS['x']*2) + ($x - 3); - $yy = ($GLOBALS['y']*2) - ($y*2); - } elseif($GLOBALS['dir'] == 2) { - $xx = ($GLOBALS['x']*2) + ($y * 2); - $yy = ($GLOBALS['y']*2) + ($x - 3); - } else { - $xx = ($GLOBALS['x']*2) - ($x - 3); - $yy = ($GLOBALS['y']*2) + ($y * 2); - } - - if(strpos($aMap[$yy][$xx], 'o/') !== false || strpos($aMap[$yy][$xx], 'p/') !== false) { - $ret .= drawobject2($aMap[$yy][$xx], $x, $y); - } - $rrm = $user['room']; + if (!isset($imgmap[$obj])) { - if(isset($dialogs[$bots[$data[1]]]) && ($bots[$data[1]] == 11147 && $user['room'] == 74)) { - $ret .= " 1?" ($cnt)":"")."\" ".($y == 1 && $x == 3?"onclick=\"speakattackmenu(event);\"":"")." width=\"".$imgdata[$x][$y]["wd"]."\" height=\"".$imgdata[$x][$y]["ht"]."\" src=\"/i/dungeon/mobs/$rrm/$bot.gif\" style=\"position: absolute; left: ".$imgdata[$x][$y]["x"][$bn]."px; top: ".$imgdata[$x][$y]["y"]."px;".($x == 3 && $y == 1?"cursor: pointer;":"").($x == 3?"z-index: ".(99-($y*5)).";":"")."\" />"; + $ret .= " + " . ($y == 1 && $x == 3 ? "" : "") . " + + " . ($y == 1 && $x == 3 ? "" : ""); } else { - $ret .= " 1?" ($cnt)":"")."\" ".($y == 1 && $x == 3?" onclick=\"document.location.href='cave.php?attack=1';\"":"")." width=\"".$imgdata[$x][$y]["wd"]."\" height=\"".$imgdata[$x][$y]["ht"]."\" src=\"/i/dungeon/mobs/$rrm/$bot.gif\" style=\"position: absolute; left: ".$imgdata[$x][$y]["x"][$bn]."px; top: ".$imgdata[$x][$y]["y"]."px;".($x == 3 && $y == 1?"cursor: pointer;":"").($x == 3?"z-index: ".(99-($y*5)).";":"")."\" />"; - }#onclick=\"attackmenu(event);\" - $i += 2; - } - return $ret; + $ret .= ""; + $ret .= $imgmap[$obj]['code']; + } + return $ret; } - function drawdialog($cell, $x, $y) { - global $dialogs, $imgdata; - $data = explode("/", $cell); - $i = 1; - $d = $data[2]; - $bot = $data[$i]; - $botname = $botnames[$bot]; - $cnt = $data[$i+1]; - $ret = ""; - return $ret; - } - - function drawuser($cell, $x, $y) { - global $botnames, $imgdata, $party; - $data = explode("/", $cell); - $i = 1; - $bc = (count($data)-1); - while($data[$i]) { - $u = $data[$i]; - if($i == 1) { - if($bc == 1) { - $bn = 1; - } else { - $bn = 0; - } - } elseif($i == 3) { - if($bc == 2) { - $bn = 2; - } else { - $bn = 1; - } + function drawobject2($cell, $x, $y) + { + global $objects, $imgdata, $user, $objdata, $objsizes, $imgmap; + $tmp = explode("/", $cell); + $obj = $tmp[1]; + $ht = round($imgdata[$x][$y]["ht"] / 2); + if ($objsizes[$obj]) { + $coef = $objdata[$x][$y]["coef"]; + $wd = $objsizes[$obj][0] * $coef; + $ht = $objsizes[$obj][1] * $coef; + $left = round($objdata[$x][$y]["x"] - ($wd / 2)); + $top = $objdata[$x][$y]["y"] - $ht; + } elseif ($obj == 510) { + $wd = round($imgdata[$x][$y]["wd"] * 2.5); + $ht = $imgdata[$x][$y]["ht"]; + $left = $imgdata[$x][$y]["x"][1] - round(($wd - $imgdata[$x][$y]["wd"]) / 2); + $top = $imgdata[$x][$y]["y"]; + } elseif ($obj > 600 && $obj < 700) { + $wd = round($imgdata[$x][$y]["wd"] * 1.26); + $left = $imgdata[$x][$y]["x"][1] - round(($wd - $imgdata[$x][$y]["wd"]) / 2); + $top = $imgdata[$x][$y]["y"] + $ht; + } elseif ($obj >= 700 && $obj < 800) { + $wd = round($imgdata[$x][$y]["wd"] * 1.24); + $ht = $imgdata[$x][$y]["ht"]; + $left = $imgdata[$x][$y]["x"][1] - round(($wd - $imgdata[$x][$y]["wd"]) / 2); + $top = $imgdata[$x][$y]["y"]; } else { - $bn = 2; + $wd = $imgdata[$x][$y]["wd"]; + $left = $imgdata[$x][$y]["x"][1]; + $top = $imgdata[$x][$y]["y"] + $ht; } - foreach($party as $k => $v) { - if($v['user'] == $u) { - $udata = $v; - break; - } + $rrm = $user['room']; + if (!isset($imgmap[$obj])) { + $ret .= " + " . ($y == 1 && $x == 3 ? "" : "") . " + + " . ($y == 1 && $x == 3 ? "" : ""); + } else { + $ret .= ""; + $ret .= $imgmap[$obj]['code']; } - $ret .= ""; - $i++; - } - return $ret; + return $ret; } - function drawobject($cell, $x, $y) { - global $objects, $imgdata, $user, $objdata, $objsizes, $imgmap; - $tmp = explode("/", $cell); - $obj = $tmp[1]; - $ht = round($imgdata[$x][$y]["ht"]/2); - - if($objsizes[$obj]) { - $coef=$objdata[$x][$y]["coef"]; - $wd=$objsizes[$obj][0]*$coef; - $ht=$objsizes[$obj][1]*$coef; - $left=round($objdata[$x][$y]["x"]-($wd/2)); - $top=$objdata[$x][$y]["y"]-$ht; - } elseif($obj == 510) { - $wd=round($imgdata[$x][$y]["wd"]*2.5); - $ht=$imgdata[$x][$y]["ht"]; - $left=$imgdata[$x][$y]["x"][1]-round(($wd-$imgdata[$x][$y]["wd"])/2); - $top=$imgdata[$x][$y]["y"]; - } elseif ($obj > 600 && $obj < 700) { - $wd=round($imgdata[$x][$y]["wd"]*1.26); - $left=$imgdata[$x][$y]["x"][1]-round(($wd-$imgdata[$x][$y]["wd"])/2); - $top=$imgdata[$x][$y]["y"]+$ht; - } elseif($obj >= 700 && $obj < 800) { - $wd=round($imgdata[$x][$y]["wd"]*1.24); - $ht=$imgdata[$x][$y]["ht"]; - $left=$imgdata[$x][$y]["x"][1]-round(($wd-$imgdata[$x][$y]["wd"])/2); - $top=$imgdata[$x][$y]["y"]; - } else { - $wd=$imgdata[$x][$y]["wd"]; - $left=$imgdata[$x][$y]["x"][1]; - $top=$imgdata[$x][$y]["y"]+$ht; - } - $rrm = $user['room']; - if (!isset($imgmap[$obj])) { - - $ret .= " - ".($y == 1 && $x == 3?"":"")." - - ".($y == 1 && $x == 3?"":""); - } else { - $ret .= ""; - $ret .= $imgmap[$obj]['code']; - } - return $ret; - } - - function drawobject2($cell, $x, $y) { - global $objects, $imgdata, $user, $objdata, $objsizes, $imgmap; - $tmp=explode("/", $cell); - $obj=$tmp[1]; - $ht=round($imgdata[$x][$y]["ht"]/2); - if($objsizes[$obj]) { - $coef=$objdata[$x][$y]["coef"]; - $wd=$objsizes[$obj][0]*$coef; - $ht=$objsizes[$obj][1]*$coef; - $left=round($objdata[$x][$y]["x"]-($wd/2)); - $top=$objdata[$x][$y]["y"]-$ht; - } elseif($obj==510) { - $wd=round($imgdata[$x][$y]["wd"]*2.5); - $ht=$imgdata[$x][$y]["ht"]; - $left=$imgdata[$x][$y]["x"][1]-round(($wd-$imgdata[$x][$y]["wd"])/2); - $top=$imgdata[$x][$y]["y"]; - } elseif($obj>600 && $obj<700) { - $wd=round($imgdata[$x][$y]["wd"]*1.26); - $left=$imgdata[$x][$y]["x"][1]-round(($wd-$imgdata[$x][$y]["wd"])/2); - $top=$imgdata[$x][$y]["y"]+$ht; - } elseif($obj>=700 && $obj<800) { - $wd=round($imgdata[$x][$y]["wd"]*1.24); - $ht=$imgdata[$x][$y]["ht"]; - $left=$imgdata[$x][$y]["x"][1]-round(($wd-$imgdata[$x][$y]["wd"])/2); - $top=$imgdata[$x][$y]["y"]; - } else { - $wd=$imgdata[$x][$y]["wd"]; - $left=$imgdata[$x][$y]["x"][1]; - $top=$imgdata[$x][$y]["y"]+$ht; - } - $rrm = $user['room']; - if(!isset($imgmap[$obj])) { - $ret.=" - ".($y == 1 && $x == 3?"":"")." - - ".($y == 1 && $x == 3?"":""); - } else { - $ret .= ""; - $ret .= $imgmap[$obj]['code']; - } - return $ret; + function drawevent($cell, $x, $y) + { + global $events, $eventdata; + $tmp = explode("/", $cell); + $obj = $tmp[1]; + if ($obj == 1) { + return ""; + } + $wd = round($eventdata[$x][$y]["q"] * $events[$obj]["w"]); + $ht = round($eventdata[$x][$y]["q"] * $events[$obj]["h"]); + $left = round(-$events[$obj]["h"] / 2 + $eventdata[$x][$y]["x"]); + $top = round($eventdata[$x][$y]["y"] - $events[$obj]["h"]); + $ret .= ""; + return $ret; } - function drawevent($cell, $x, $y) { - global $events, $eventdata; - $tmp = explode("/", $cell); - $obj = $tmp[1]; - if($obj == 1) { return ""; } - $wd = round($eventdata[$x][$y]["q"]*$events[$obj]["w"]); - $ht = round($eventdata[$x][$y]["q"]*$events[$obj]["h"]); - $left = round(-$events[$obj]["h"]/2+$eventdata[$x][$y]["x"]); - $top = round($eventdata[$x][$y]["y"]-$events[$obj]["h"]); - $ret .= ""; - return $ret; + while ($i >= 0) { + if ($i == 4) { + if ($map[0][7]) { + $ret .= "
"; + } + if ($map[0][6]) { + $ret .= "
"; + } + if ($map[-1][6]) { + $ret .= ""; + } + } + + $wall = $i * 2 - 1; + $sidewall = $i * 2; + + if ($map[1][$sidewall] && $i > 0) { + $obj = substr($map[1][$sidewall], 0, 1); + if ($obj == "b") { + $ret .= drawbot($map[1][$sidewall], 1, $i); + } elseif ($obj == "u") { + $ret .= drawuser($map[1][$sidewall], 1, $i, $players); + } elseif ($obj == "o" || $obj == "p") { + $ret .= drawobject($map[1][$sidewall], 1, $i); + } elseif ($obj == "e") { + $ret .= drawevent($map[1][$sidewall], 1, $i); + } elseif ($obj == "d") { + $ret .= drawdialog($map[1][$sidewall], 1, $i); + } elseif ($obj != "s") { + $o = $map[1][$sidewall] - 10000; + if ($o == 4) { + if ($i == 1) { + $ret .= ""; + } + if ($i == 2) { + $ret .= ""; + } + if ($i == 3) { + $ret .= ""; + } + } else { + if ($i == 1) { + $ret .= ""; + } + if ($i == 2) { + $ret .= ""; + } + if ($i == 3) { + $ret .= ""; + } + } + } + } + + if ($map[5][$sidewall] && $i > 0) { + $obj = substr($map[5][$sidewall], 0, 1); + if ($obj == "b") { + $ret .= drawbot($map[5][$sidewall], 5, $i); + } elseif ($obj == "u") { + $ret .= drawuser($map[5][$sidewall], 5, $i, $players); + } elseif ($obj == "o" || $obj == "p") { + $ret .= drawobject($map[5][$sidewall], 5, $i); + } elseif ($obj == "e") { + $ret .= drawevent($map[5][$sidewall], 5, $i); + } elseif ($obj == "d") { + $ret .= drawdialog($map[5][$sidewall], 5, $i); + } elseif ($obj != "s") { + $o = $map[5][$sidewall] - 10000; + if ($o == 4) { + if ($i == 1) $ret .= ""; + if ($i == 2) $ret .= ""; + if ($i == 3) $ret .= ""; + } else { + if ($i == 1) $ret .= ""; + if ($i == 2) $ret .= ""; + if ($i == 3) $ret .= ""; + } + } + } + if ($i > 0 && $map[1][$wall]) $ret .= "
"; + + $objInWall = explode('/', $map[4][$sidewall]); + if ($objInWall[1] == 'o') { + if (!passablewall($map[4][$sidewall])) $ret .= "
"; + } else { + if (!passablewall($map[4][$sidewall])) $ret .= "
"; + } + $objInWall = explode('/', $map[2][$sidewall]); + if ($objInWall[1] == 'o') { + if (!passablewall($map[2][$sidewall])) $ret .= "
"; + } else { + if (!passablewall($map[2][$sidewall])) $ret .= "
"; + } + + if ($i > 0 && $map[5][$wall]) $ret .= "
"; + + if ($map[3][$sidewall] && $i > 0 && $sidewall < $centerwall) { + $obj = substr($map[3][$sidewall], 0, 1); + if ($obj == "b") { + $ret .= drawbot($map[3][$sidewall], 3, $i); + } elseif ($obj == "u") { + $ret .= drawuser($map[3][$sidewall], 3, $i, $players); + } elseif ($obj == "o" || $obj == "p") { + $ret .= drawobject($map[3][$sidewall], 3, $i); + } elseif ($obj == "e") { + $ret .= drawevent($map[3][$sidewall], 3, $i); + } elseif ($obj == "d") { + $ret .= drawdialog($map[3][$sidewall], 3, $i); + } elseif ($obj != "s") { + $o = $map[3][$sidewall] - 10000; + if ($o == 4) { + if ($i == 1) $ret .= ""; + if ($i == 2) $ret .= ""; + if ($i == 3) $ret .= ""; + } else { + if ($i == 1) $ret .= ""; + if ($i == 2) $ret .= ""; + if ($i == 3) $ret .= ""; + } + } + } + if ($map[3][$wall]) { + if ($i > 0) $ret .= "
2 ? "style=\"background-image:url('$base/cw$i" . cavewall($map[3][$wall]) . ".gif')\"" : "") . ">
"; + if ($i == 1 && $map[3][$wall] > 2) { + if ($map[3][$wall] > 1000) { + $ret .= ""; + } elseif ($map[3][$wall] > 100) { + $ret .= ""; + } else $ret .= ""; + } + $objInWall = explode('/', $map[3][$wall]); + if ($objInWall[1] == "o") { + if ($user['room'] == 83 && !(!$direction && (($x == 13 && $y == 4) || ($x == 12 && $y == 4)))) { // исключение 2-ух клеток в комнате 82 + $ret .= drawobject('//' . $objInWall[2], 3, $i); + } + } + $nocenter = 1; + } + if ($i == 4) { + if ($map[7][6]) $ret .= ""; + } + $i--; } - while($i >= 0) { - if($i == 4) { - if($map[0][7]) { - $ret .= "
"; - } - if($map[0][6]) { - $ret .= "
"; - } - if($map[-1][6]) { - $ret .= ""; - } - } - - $wall = $i*2-1; - $sidewall = $i*2; - - if($map[1][$sidewall] && $i > 0) { - $obj = substr($map[1][$sidewall], 0, 1); - if($obj == "b") { - $ret .= drawbot($map[1][$sidewall], 1, $i); - } elseif ($obj == "u") { - $ret .= drawuser($map[1][$sidewall], 1, $i, $players); - } elseif ($obj == "o" || $obj=="p") { - $ret .= drawobject($map[1][$sidewall], 1, $i); - } elseif ($obj == "e") { - $ret .= drawevent($map[1][$sidewall], 1, $i); - } elseif ($obj == "d") { - $ret .= drawdialog($map[1][$sidewall], 1, $i); - } elseif ($obj != "s") { - $o = $map[1][$sidewall]-10000; - if($o == 4) { - if($i == 1) { - $ret .= ""; - } - if($i == 2) { - $ret .= ""; - } - if($i == 3) { - $ret .= ""; - } - } else { - if($i== 1) { - $ret .= ""; - } - if($i== 2) { - $ret .= ""; - } - if($i== 3) { - $ret .= ""; - } - } - } - } - - if ($map[5][$sidewall] && $i>0) { - $obj=substr($map[5][$sidewall],0,1); - if ($obj=="b") { - $ret.=drawbot($map[5][$sidewall], 5, $i); - } elseif ($obj=="u") { - $ret.=drawuser($map[5][$sidewall], 5, $i, $players); - } elseif ($obj=="o" || $obj=="p") { - $ret.=drawobject($map[5][$sidewall], 5, $i); - } elseif ($obj=="e") { - $ret.=drawevent($map[5][$sidewall], 5, $i); - } elseif ($obj=="d") { - $ret.=drawdialog($map[5][$sidewall], 5, $i); - } elseif ($obj!="s") { - $o=$map[5][$sidewall]-10000; - if ($o==4) { - if ($i==1) $ret.=""; - if ($i==2) $ret.=""; - if ($i==3) $ret.=""; - } else { - if ($i==1) $ret.=""; - if ($i==2) $ret.=""; - if ($i==3) $ret.=""; - } - } - } - if ($i>0 && $map[1][$wall]) $ret.="
"; - - $objInWall = explode('/', $map[4][$sidewall]); - if ($objInWall[1] == 'o') { - if(!passablewall($map[4][$sidewall])) $ret.="
"; - } else { - if(!passablewall($map[4][$sidewall])) $ret.="
"; - } - $objInWall = explode('/', $map[2][$sidewall]); - if ($objInWall[1] == 'o') { - if(!passablewall($map[2][$sidewall])) $ret.="
"; - } else { - if(!passablewall($map[2][$sidewall])) $ret.="
"; - } - - if ($i>0 && $map[5][$wall]) $ret.="
"; - - if ($map[3][$sidewall] && $i>0 && $sidewall<$centerwall) { - $obj=substr($map[3][$sidewall],0,1); - if ($obj=="b") { - $ret.=drawbot($map[3][$sidewall], 3, $i); - } elseif ($obj=="u") { - $ret.=drawuser($map[3][$sidewall], 3, $i, $players); - } elseif ($obj=="o" || $obj=="p") { - $ret.=drawobject($map[3][$sidewall], 3, $i); - } elseif ($obj=="e") { - $ret.=drawevent($map[3][$sidewall], 3, $i); - } elseif ($obj=="d") { - $ret.=drawdialog($map[3][$sidewall], 3, $i); - } elseif ($obj!="s") { - $o=$map[3][$sidewall]-10000; - if ($o==4) { - if ($i==1) $ret.=""; - if ($i==2) $ret.=""; - if ($i==3) $ret.=""; - } else { - if ($i==1) $ret.=""; - if ($i==2) $ret.=""; - if ($i==3) $ret.=""; - } - } - } - if ($map[3][$wall]) { - if ($i>0) $ret.="
2?"style=\"background-image:url('$base/cw$i".cavewall($map[3][$wall]).".gif')\"":"").">
"; - if ($i==1 && $map[3][$wall]>2) { - if ($map[3][$wall]>1000) { - $ret.=""; - } elseif ($map[3][$wall]>100) { - $ret.=""; - } else $ret.=""; - } - $objInWall = explode('/', $map[3][$wall]); - if ($objInWall[1] == "o") { - if ($user['room'] == 83 && !(!$direction && (($x == 13 && $y == 4) || ($x == 12 && $y == 4)))) { // исключение 2-ух клеток в комнате 82 - $ret.=drawobject('//' . $objInWall[2], 3, $i); - } - } - $nocenter=1; - } - if ($i==4) { - if ($map[7][6]) $ret.=""; - } - $i--; - } - - $ret.="
+ $ret .= "
@@ -1406,89 +1842,89 @@ function drawmap($map1, $players, $x, $y, $direction) {
0
"; - if ($direction==0) { - $forwardlink="?move=x2&".time(); - $backlink="?move=x1&".time(); - $leftlink="?move=y1&".time(); - $rightlink="?move=y2&".time(); + if ($direction == 0) { + $forwardlink = "?move=x2&" . time(); + $backlink = "?move=x1&" . time(); + $leftlink = "?move=y1&" . time(); + $rightlink = "?move=y2&" . time(); } - if ($direction==2) { - $forwardlink="?move=x1&".time(); - $backlink="?move=x2&".time(); - $leftlink="?move=y2&".time(); - $rightlink="?move=y1&".time(); + if ($direction == 2) { + $forwardlink = "?move=x1&" . time(); + $backlink = "?move=x2&" . time(); + $leftlink = "?move=y2&" . time(); + $rightlink = "?move=y1&" . time(); } - if ($direction==1) { - $forwardlink="?move=y2&".time(); - $backlink="?move=y1&".time(); - $leftlink="?move=x2&".time(); - $rightlink="?move=x1&".time(); + if ($direction == 1) { + $forwardlink = "?move=y2&" . time(); + $backlink = "?move=y1&" . time(); + $leftlink = "?move=x2&" . time(); + $rightlink = "?move=x1&" . time(); } - if ($direction==3) { - $forwardlink="?move=y1&".time(); - $backlink="?move=y2&".time(); - $leftlink="?move=x1&".time(); - $rightlink="?move=x2&".time(); + if ($direction == 3) { + $forwardlink = "?move=y1&" . time(); + $backlink = "?move=y2&" . time(); + $leftlink = "?move=x1&" . time(); + $rightlink = "?move=x2&" . time(); } - if (passablewall($map[3][1]) && canmoveto($map[3][2])) $ret.="
"; - if (passablewall($map[3][-1]) && canmoveto($map[3][-2])) $ret.="
"; - if (passablewall($map[2][0]) && canmoveto($map[1][0])) $ret.="
"; - if (passablewall($map[4][0]) && canmoveto($map[5][0])) $ret.="
"; + if (passablewall($map[3][1]) && canmoveto($map[3][2])) $ret .= "
"; + if (passablewall($map[3][-1]) && canmoveto($map[3][-2])) $ret .= "
"; + if (passablewall($map[2][0]) && canmoveto($map[1][0])) $ret .= "
"; + if (passablewall($map[4][0]) && canmoveto($map[5][0])) $ret .= "
"; - $ret.="
"; + $ret .= "
"; - $ret.="
"; + $ret .= "
"; - $ret.="
"; - $ret.="
+ $ret .= "
"; + $ret .= "
"; - foreach ($players as $k=>$v) { - if ($v["x"]-($startx/2)>=0 && $v["x"]-($startx/2)<=8 && $v["y"]-($starty/2)>=0 && $v["y"]-($starty/2)<=8) { - $ret.="\"$v[login]\""; - } - } - $ret.=""; - $i=$starty; - while ($i<$starty+18) { - $ret.=""; - $i2=$startx; - while ($i2<$startx+18) { - $ret.=""; - $i2+=2; - } - $ret.=""; - $i+=2; } - $ret.="
"; - if (strpos($map1[$i][$i2], 'h/') !== false) { - $map1[$i][$i2] = 0; + foreach ($players as $k => $v) { + if ($v["x"] - ($startx / 2) >= 0 && $v["x"] - ($startx / 2) <= 8 && $v["y"] - ($starty / 2) >= 0 && $v["y"] - ($starty / 2) <= 8) { + $ret .= "\"$v[login]\""; } - if ($map1[$i][$i2]) { - $ret.=""; - } - $ret.="
+ $ret .= ""; + $i = $starty; + while ($i < $starty + 18) { + $ret .= ""; + $i2 = $startx; + while ($i2 < $startx + 18) { + $ret .= ""; + $i2 += 2; + } + $ret .= ""; + $i += 2; + } + $ret .= "
"; + if (strpos($map1[$i][$i2], 'h/') !== false) { + $map1[$i][$i2] = 0; + } + if ($map1[$i][$i2]) { + $ret .= ""; + } + $ret .= "
"; - $ret.= "> ';if (i<32) {s+=' '}}document.getElementById('prcont').innerHTML=s; + $ret .= "> ';if (i<32) {s+=' '}}document.getElementById('prcont').innerHTML=s; "; - $ret.=" + $ret .= "
"; - $ret.=""; - $ret.= "> + $ret .= ""; + $ret .= "> var progressEnd = 108; // set to number of progress 's. var progressColor = '#00CC00'; // set to progress bar color var mtime = parseInt('"; -if (time()<$_SESSION["movetime"]) $ret.=$_SESSION["movetime"]-time(); -else $ret.=0; -$ret.="'); + if (time() < $_SESSION["movetime"]) $ret .= $_SESSION["movetime"] - time(); + else $ret .= 0; + $ret .= "'); if (!mtime || mtime <= 0 ) mtime = 0; var progressInterval = Math.round( mtime * 1000 / progressEnd ); var is_accessible = true; @@ -1549,81 +1985,93 @@ progress_update(); "; return $ret; - } +} + ?> - -
-
- - $v) { - if($v["user"] == $user["id"]) { - $usr = $user; - } else { - $usr = mysql_fetch_array(mysql_query("SELECT `level`, `hp`, `maxhp` FROM `users` WHERE `id` = '$v[user]'")); - } - $wd = floor($usr["hp"]/$usr["maxhp"]*120); - echo " + + if ($v["user"] == $user["id"] && $user["id"] == $user["caveleader"]) echo "\"Выгнать \"Новый"; + echo ""; - } -?> -
+
+
+ + $v) { + if ($v["user"] == $user["id"]) { + $usr = $user; + } else { + $usr = mysql_fetch_array(mysql_query("SELECT `level`, `hp`, `maxhp` FROM `users` WHERE `id` = '$v[user]'")); + } + $wd = floor($usr["hp"] / $usr["maxhp"] * 120); + echo " +
$v[login] [$usr[level]]
-
".($v["user"]==$user["id"]?"":"")."$usr[hp]".($v["user"]==$user["id"]?"":"")."/$usr[maxhp]\"Уровень\"Уровень
" . ($v["user"] == $user["id"] ? "" : "") . "$usr[hp]" . ($v["user"] == $user["id"] ? "" : "") . "/$usr[maxhp]\"Уровень\"Уровень
"; -if ($v["user"]==$user["id"] && $user["id"]==$user["caveleader"]) echo "\"Выгнать \"Новый"; -echo "

- -
- +
+
+
+ - 
-
-

-
- 0) echo "В комнате разбросаны вещи:
 
"; - while ($rec = mysql_fetch_assoc($r)) { - echo " "; - } -?>

-=3) echo "
Вас убили 3 раза, и вы покидете подземелье

+ ?> +   +
+

+
+ 0) echo "В комнате разбросаны вещи:
 
"; + while ($rec = mysql_fetch_assoc($r)) { + echo " "; + } + ?>
+
+ = 3) echo "
Вас убили 3 раза, и вы покидете подземелье

Вернуться

"; - if ($loses) echo "
Количество смертей: $loses
"; + if ($loses) echo "
Количество смертей: $loses
"; -?> - - -
-     -     Выйти -
+ ?> + + +
+      +      Выйти +
+ + + + - - x:  y:  diff --git a/clan.php b/clan.php index 506a358..f69d208 100644 --- a/clan.php +++ b/clan.php @@ -1,84 +1,104 @@ clan) { die(err('Вы не состоите в клане!')); } -$klan = db::c()->query('SELECT * FROM `clans` WHERE `id` = ?i', $user['klan'])->fetch_assoc(); -$polno = []; -$polno = unserialize($klan['vozm']); +try { + $clanRow = db::c()->query('SELECT * FROM `clans` WHERE `id` = ?i', $user['klan'])->fetch_assoc(); + $polno = unserialize($clanRow['vozm']) ?? []; +} catch (Exception $e) { + echo "MYSQL_ERROR: Таблицы clans не существует! Вся панель — одна сплошная ошибка!"; +} +define('COST_ADD_MEMBER', 100); +define('COST_REMOVE_MEMBER', 30); +define('CASTLE_REPUTATION_NEEDED', 1000000); +define('CASTLE_COST', 25000); +$status = null; +$action = $_POST['action'] ?? 0; +$login = $_POST['login'] ?? 0; +$zamok = $_POST['zamok'] ?? null; +$kr = $_POST['kr'] ?? null; +$kolv = $_POST['kolv'] ?? null; +$newClanStatus = $_POST['new_status'] ?? null; +$vin = $_POST['vin'] ?? null; +$tus = $_POST['tus'] ?? null; -if (isset($_POST['zamok'])) { +if ($zamok) { db::c()->query('UPDATE `clans` SET `zamok` = 1 WHERE `glava` = ?i', $_SESSION['uid']); $status = "Начат сбор средств на строительство Кланового Замка."; header("Location: clan.php"); } - -if (isset($_POST['kr']) && ($_POST['kolv'] > 0)) { - if ($user['money'] >= $_POST['kolv']) { - db::c()->query('UPDATE `clans` SET `zbor` = `zbor` + ?i WHERE `id` = ?i', $_POST['kolv'], $user['klan']); - db::c()->query('UPDATE `users` SET `money` = `money` - ?i WHERE `id` = ?i', $_POST['kolv'], $user['id']); +if ($kr && $kolv > 0) { + if ($user->money >= $kolv) { + db::c()->query('UPDATE `clans` SET `zbor` = `zbor` + ?i WHERE `id` = ?i', $kolv, $user->clan); + db::c()->query('UPDATE `users` SET `money` = `money` - ?i WHERE `id` = ?i', $kolv, $user->id); header("Location: clan.php"); - } else $status = 'Не хватает денег!'; + } else { + $status = 'Не хватает денег!'; + } } - -if (!empty($login) AND $action == 'add_member' AND $polno[$user['id']][0] == 1) { - $sok = db::c()->query('SELECT `id`,`level`,`klan` FROM `users` WHERE `align` = 0 AND `login` = "?s"', $login)->fetch_assoc(); - $proverka = db::c()->query('SELECT 1 FROM `effects` WHERE `type` = 20 AND `owner` = ?i', $sok['id'])->getNumRows(); - if (!$proverka) echo "Нет проверки!"; - elseif (!empty($sok['klan'])) echo 'Персонаж уже состоит в клане!'; - elseif ($sok['level'] > 0 && $user['money'] >= 100) { - db::c()->query('UPDATE `users` SET `money` = `money` - 100 WHERE `id` = ?i', $_SESSION['uid']); - db::c()->query('UPDATE `users` SET `status` = "?s", `klan` = "?s", `align` = ?i WHERE `id` = ?i', 'Боец', $klan['id'], $klan['align'], $sok['id']); +if ($login && $action == 'add_member' && $polno[$user['id']][0] == 1) { + $sok = db::c()->query('SELECT id, level, clan FROM users WHERE align = 0 AND login = "?s"', $login)->fetch_assoc(); + $proverka = db::c()->query('SELECT 1 FROM users_effects WHERE type = 20 AND owner_id = ?i', $sok['id'])->getNumRows(); + if (!$proverka) { + echo "Нет проверки!"; + } elseif ($sok['clan']) { + echo 'Персонаж уже состоит в клане!'; + } elseif ($sok['level'] > 0 && $user->money >= COST_ADD_MEMBER) { + db::c()->query('UPDATE users SET money = money - ?i WHERE `id` = ?i', COST_ADD_MEMBER, $_SESSION['uid']); + db::c()->query('UPDATE users SET clan = "?s", align = ?i WHERE id = ?i', $clanRow['id'], $clanRow['align'], $sok['id']); $status = 'Персонаж «' . $login . '» успешно принят в клан.'; - } else $status = 'Не хватает денег, или персонажа не существует.'; + } else { + $status = 'Не хватает денег, или персонажа не существует.'; + } } - -if (!empty($login) AND $action == 'remove_member' AND $polno[$user['id']][0] == 1) { - $sok = db::c()->query('SELECT `id` FROM `users` WHERE `klan` = "?s" AND `login` = "?s"', $klan['id'], $login)->fetch_assoc(); - if ($sok['id'] != $klan['glava'] AND $user['money'] >= 30) { - db::c()->query('UPDATE `users` SET `money` = `money` - 30 WHERE `id` = ?i', $_SESSION['uid']); - db::c()->query('UPDATE `users` SET `klan` = null, `align` = 0 WHERE `id` = ?i', $sok['id']); +if ($login && $action == 'remove_member' && $polno[$user['id']][0] == 1) { + $sok = db::c()->query('SELECT id FROM users WHERE clan = "?s" AND login = "?s"', $clanRow['id'], $login)->fetch_assoc(); + if ($sok['id'] != $clanRow['glava'] && $user->money >= COST_REMOVE_MEMBER) { + db::c()->query('UPDATE users SET money = money - ?i WHERE id = ?i', COST_REMOVE_MEMBER, $_SESSION['uid']); + db::c()->query('UPDATE users SET clan = "?s", align = 0 WHERE id = ?i', '', $sok['id']); $status = 'Персонаж «' . $login . '» покинул клан.'; } } - -if (!empty($login) AND $action == 'change_owner' AND $klan['glava'] == $_SESSION['uid']) { - $sok = db::c()->query('SELECT `id` FROM `users` WHERE `klan` = "?s" AND `login` = "?s"', $klan['id'], $login)->fetch_assoc(); - db::c()->query('UPDATE `clans` SET `glava` = ?i WHERE `id` = ?i', $sok['id'], $klan['id']); - db::c()->query('UPDATE `users` SET `status` = null WHERE `id` = ?i', $sok['id']); - db::c()->query('UPDATE `users` SET `status` = "?s" WHERE `id` = ?i', 'Боец', $_SESSION['uid']); - $klan['glava'] = $sok['id']; +if ($login && $action == 'change_owner' && $clanRow['glava'] == $_SESSION['uid']) { + $sok = db::c()->query('SELECT id FROM users WHERE clan = "?s" AND login = "?s"', $clanRow['id'], $login)->fetch_assoc(); + db::c()->query('UPDATE clans SET glava = ?i WHERE id = ?i', $sok['id'], $clanRow['id']); + db::c()->query('UPDATE users SET status = "?s" WHERE id = ?i', '', $sok['id']); + db::c()->query('UPDATE users SET status = "?s" WHERE id = ?i', 'Боец', $_SESSION['uid']); + $clanRow['glava'] = $sok['id']; } - -if (!empty($login) AND $action == 'edit_status') { - $sok = db::c()->query('SELECT `id`, `status` FROM `users` WHERE `klan` = "?s" AND `login` = "?s"', $klan['id'], $login)->fetch_assoc(); - if ($sok['id'] != $klan['glava']) { - if (!empty($_POST['new_status'])) { - $st = strip_tags(str_replace("<", "<", str_replace(">", ">", $_POST['new_status'])), ""); - db::c()->query('UPDATE `users` SET `status` = "?s" WHERE `id` = ?i', $st, $sok['id']); +if ($login && $action == 'edit_status') { + $sok = db::c()->query('SELECT id, status FROM users WHERE clan = "?s" AND login = "?s"', $clanRow['id'], $login)->fetch_assoc(); + if ($sok['id'] != $clanRow['glava']) { + if ($newClanStatus) { + $st = strip_tags(str_replace("<", "<", str_replace(">", ">", $newClanStatus)), ""); + db::c()->query('UPDATE users SET status = "?s" WHERE id = ?i', $st, $sok['id']); $sok['status'] = $st; } - if ($klan['glava'] == $_SESSION['uid']) { - if (!empty($_POST['vin'])) $polno[$sok['id']][0] = 1; - else $polno[$sok['id']][0] = 0; - - if (!empty($_POST['tus'])) $polno[$sok['id']][1] = 1; - else $polno[$sok['id']][1] = 0; - - db::c()->query('UPDATE `clans` SET `vozm` = "?s" WHERE `id` = ?i', serialize($polno), $klan['id']); + if ($clanRow['glava'] == $_SESSION['uid']) { + if ($vin) { + $polno[$sok['id']][0] = 1; + } else { + $polno[$sok['id']][0] = 0; + } + if ($tus) { + $polno[$sok['id']][1] = 1; + } else { + $polno[$sok['id']][1] = 0; + } + db::c()->query('UPDATE clans SET vozm = "?s" WHERE id = ?i', serialize($polno), $clanRow['id']); } - } else $status = 'Главу клана редактировать запрещено!'; + } else { + $status = 'Главу клана редактировать запрещено!'; + } } -$clan_memberlist = db::c()->query('SELECT `id`, `login`, `status`, `level`, `room`, `align`, (select `id` from `online` WHERE `date` >= ?i AND `id` = users.`id`) AS `online` FROM `users` WHERE `klan` = ?i ORDER BY `online` DESC , `login` ASC', (time() - 60), $klan['id']); +$clan_memberlist = db::c()->query('SELECT `id`, `login`, `status`, `level`, `room`, `align`, (select `id` from `online` WHERE `date` >= ?i AND `id` = users.`id`) AS `online` FROM `users` WHERE `klan` = ?i ORDER BY `online` DESC , `login` ASC', (time() - 60), $clanRow['id']); ?> @@ -89,36 +109,38 @@ $clan_memberlist = db::c()->query('SELECT `id`, `login`, `status`, `level`, `roo
-
+ + + @@ -186,11 +208,19 @@ $clan_memberlist = db::c()->query('SELECT `id`, `login`, `status`, `level`, `roo fetch_assoc()): - if ($row['id'] == $klan['glava']) $row['status'] = 'Глава клана'; - if (empty($row['status'])) $row['status'] = 'Боец'; - if (empty($row['online'])) $rrm = 'Персонаж не в игре'; - elseif ($row['room'] > 500 AND $row['room'] < 561) $rrm = 'Башня смерти'; - else $rrm = $rooms[$row['room']]; + if ($row['id'] == $clanRow['glava']) { + $row['status'] = 'Глава клана'; + } + if (empty($row['status'])) { + $row['status'] = 'Боец'; + } + if (empty($row['online'])) { + $rrm = 'Персонаж не в игре'; + } elseif ($row['room'] > 500 && $row['room'] < 561) { + $rrm = 'Башня смерти'; + } else { + $rrm = $rooms[$row['room']]; + } ?> diff --git a/classes/User.php b/classes/User.php index 4c69871..2088b62 100644 --- a/classes/User.php +++ b/classes/User.php @@ -41,6 +41,9 @@ class User // Пока несуществующие, для совместимости. public $married = 'Someone или нет.'; public $experience = 200; + public $battle = 0; + public $in_tower = 0; // Скорее башню похороним чем запустим... + public $zayavka = 0; // Динамически рассчитываемые public $maxHealth = 5; public $maxMana = 5; diff --git a/classes/battle_new.class.php b/classes/battle_new.class.php index 2eb20b2..280fd1a 100644 --- a/classes/battle_new.class.php +++ b/classes/battle_new.class.php @@ -1567,7 +1567,7 @@ class fbattle include "../darkness_quest.php"; $this->exp[$v] = round($this->exp[$v]); - $dop_exp = check_proc($this->user['id']); + $dop_exp = 100; //процент опыта if ($dop_exp > 100) { $add = ($dop_exp - 100); $this->exp[$v] += round(($this->exp[$v] * $add) / 100, 0); @@ -1641,7 +1641,7 @@ class fbattle } $this->exp[$v] = round($this->exp[$v]); - $dop_exp = check_proc($this->user['id']); + $dop_exp = 100; //процент опыта if ($dop_exp > 100) { $add = ($dop_exp - 100); $this->exp[$v] += round(($this->exp[$v] * $add) / 100, 0); diff --git a/classes/input.php b/classes/input.php deleted file mode 100644 index 5f728ae..0000000 --- a/classes/input.php +++ /dev/null @@ -1,31 +0,0 @@ - - * Project name: Battles-Game - */ - -class input -{ - public static function get($name) { - $var = trim(filter_input(INPUT_GET,$name)); - if (isset($var) AND !empty($var)) - return $var; - else return null; - } - - public static function post($name) { - $var = trim(filter_input(INPUT_POST,$name)); - if (isset($var) AND !empty($var)) - return $var; - else return null; - } - - public static function check($name) { - # Срезаем с значения переменной табы, пробелы, другие невидимые символы по краям. - # Проверяем, что у переменной точно есть значение. - if (!empty(trim(filter_input(INPUT_GET,$name)))) return trim(filter_input(INPUT_GET,$name)); - if (!empty(trim(filter_input(INPUT_POST,$name)))) return trim(filter_input(INPUT_POST,$name)); - return null; - } -} \ No newline at end of file diff --git a/contacts.php b/contacts.php index 0234044..db17bcd 100644 --- a/contacts.php +++ b/contacts.php @@ -1,46 +1,49 @@ query('SELECT `id` FROM `users` WHERE `login` = "?s"', input::post('friendadd'))->fetch_assoc(); +$friendadd = $_POST['friendadd'] ?? null; +$friendremove = $_POST['friendremove'] ?? null; +$friendedit = $_POST['friendedit'] ?? null; +$comment = $_POST['comment'] ?? ''; +if ($friendadd) { + $q = db::c()->query('SELECT `id` FROM `users` WHERE `login` = "?s"', $friendadd)->fetch_assoc(); $q2 = db::c()->query('SELECT 1 FROM `friends` WHERE `user` = ?i AND `friend` = ?i', $_SESSION['uid'], $q['id']); - - if (!$q['id']) $status = 'Персонаж не найден.'; - elseif ($q['id'] == $_SESSION['uid']) $status = 'Себя добавить нельзя.'; - elseif ($q2->getNumRows()) $status = 'Персонаж уже есть в списке.'; - else { - db::c()->query('INSERT INTO `friends` (`user`, `friend`, `comment`) VALUES (?i,?i,"?s")', $_SESSION['uid'], $q['id'], input::post('comment')); + if (!$q['id']) { + $status = 'Персонаж не найден.'; + } elseif ($q['id'] == $_SESSION['uid']) { + $status = 'Себя добавить нельзя.'; + } elseif ($q2->getNumRows()) { + $status = 'Персонаж уже есть в списке.'; + } else { + db::c()->query('INSERT INTO `friends` (`user`, `friend`, `comment`) VALUES (?i,?i,"?s")', $_SESSION['uid'], $q['id'], $comment); $status = 'Контакт добавлен.'; } } - -if (input::post('friendremove')) { - $q = db::c()->query('SELECT `id` FROM `users` WHERE `login` = "?s"', input::post('friendremove'))->fetch_assoc(); +if ($friendremove) { + $q = db::c()->query('SELECT `id` FROM `users` WHERE `login` = "?s"', $friendremove)->fetch_assoc(); $q2 = db::c()->query('SELECT 1 FROM `friends` WHERE `user` = ?i AND `friend` = ?i', $_SESSION['uid'], $q['id']); - - if (!$q['id'] OR !$q2->getNumRows()) $status = 'Персонаж не найден.'; - else { + if (!$q['id'] || !$q2->getNumRows()) { + $status = 'Персонаж не найден.'; + } else { db::c()->query('DELETE FROM `friends` WHERE `user` = ?i AND `friend` = ?i', $_SESSION['uid'], $q['id']); $status = 'Контакт удалён.'; } } - -if (input::post('friendedit')) { - $q = db::c()->query('SELECT `id` FROM `users` WHERE `login` = "?s"', input::post('friendedit'))->fetch_assoc(); +if ($friendedit) { + $q = db::c()->query('SELECT `id` FROM `users` WHERE `login` = "?s"', $friendedit)->fetch_assoc(); $q2 = db::c()->query('SELECT 1 FROM `friends` WHERE `user` = ?i AND `friend` = ?i', $_SESSION['uid'], $q['id']); - - if (!$q2['friend']) $status = 'Персонаж не найден.'; - else { - db::c()->query('UPDATE `friends` SET `comment` = "?s" WHERE `user` = ?i AND `friend` = ?i', input::post('comment'), $_SESSION['uid'], $q['id']); + if (!$q2['friend']) { + $status = 'Персонаж не найден.'; + } else { + db::c()->query('UPDATE `friends` SET `comment` = "?s" WHERE `user` = ?i AND `friend` = ?i', $comment, $_SESSION['uid'], $q['id']); $status = 'Контакт изменён.'; } - } - -$admins_list = db::c()->query('SELECT `id` FROM `users` WHERE `admin` = 1 ORDER BY `login` ASC', (time() - 60)); +$admins_list = db::c()->query('SELECT `id` FROM `users` WHERE `admin` = 1 ORDER BY `login`', (time() - 60)); $contacts_list = db::c()->query('SELECT `friend`,`comment` FROM `friends` WHERE `friend` > 0 AND `user` = ?i', $_SESSION['uid']); ?> @@ -84,9 +87,8 @@ $contacts_list = db::c()->query('SELECT `friend`,`comment` FROM `friends` WHERE @@ -149,7 +151,7 @@ $contacts_list = db::c()->query('SELECT `friend`,`comment` FROM `friends` WHERE } function use(option, placeholder) { - document.getElementById(option).innerHTML = ""; + document.getElementById(option).innerHTML = ""; } diff --git a/cronjobs/cron_bots_battle.php b/cronjobs/cron_bots_battle.php index d607899..ecc4e4c 100644 --- a/cronjobs/cron_bots_battle.php +++ b/cronjobs/cron_bots_battle.php @@ -335,7 +335,7 @@ class fbattle } $this->exp[$v] = round($this->exp[$v]); - $dop_exp = check_proc($this->user['id']); + $dop_exp = 100; //процент опыта if ($dop_exp > 100) { $add = ($dop_exp - 100); $this->exp[$v] += round(($this->exp[$v] * $add) / 100, 0); @@ -406,7 +406,7 @@ class fbattle } $this->exp[$v] = round($this->exp[$v]); - $dop_exp = check_proc($this->user['id']); + $dop_exp = 100; //процент опыта if ($dop_exp > 100) { $add = ($dop_exp - 100); $this->exp[$v] += round(($this->exp[$v] * $add) / 100, 0); diff --git a/fbattle.php b/fbattle.php index 5080eb1..f917f96 100644 --- a/fbattle.php +++ b/fbattle.php @@ -356,7 +356,7 @@ $fbattle = new fbattle($user['battle']); $ads = '.'; } - echo '

Бой закончен! Всего вами нанесено урона ' . $damage[$user['id']] . ' HP. Получено опыта ' . (int)$exp[$user['id']] . ' (' . check_proc($user['id']) . '%)' . $ads . '

'; + echo '

Бой закончен! Всего вами нанесено урона ' . $damage[$user['id']] . ' HP. Получено опыта ' . (int)$exp[$user['id']] . ' (100%)' . $ads . '

'; } } else { ?> diff --git a/functions.php b/functions.php index 6f7d811..43ce107 100644 --- a/functions.php +++ b/functions.php @@ -200,38 +200,6 @@ function savecavedata($cavedata, $caveleader, $floor) fclose($f1); } -function topsethp() -{ - global $user; - if ($user['hp'] >= $user['maxhp'] || $user['battle']) { - return "top.setHP($user[hp], $user[maxhp], 0)"; - } - $fulltime = timetoheals($user); - $delay = round(1 / ($user['maxhp'] / $fulltime) * 1000); - return "top.setHP($user[hp], $user[maxhp], $delay);"; -} - -function check_proc($u) -{ - $r = 100; - $usr = db::c()->query('SELECT `id`, `vip`, `vip_time` FROM `users` WHERE `id` = ?i', $u)->fetch_assoc_array(); - if ($usr['vip_time'] > time()) { - if ($usr['vip'] == 1) { - $r += 10; - } elseif ($usr['vip'] == 2) { - $r += 15; - } elseif ($usr['vip'] == 3) { - $r += 20; - } - } - $effes = db::c()->query('SELECT SUM(`proc_exp`) AS `sums` FROM `effects` WHERE proc_exp > 0 AND owner = ?i', $usr['id'])->fetch_assoc_array(); - - if ($effes['sums'] > 0) { - $r += $effes['sums']; - } - return $r; -} - function GiveExp($id, $exp) { db::c()->query('UPDATE users SET exp = exp + ?i WHERE id = ?i', $exp, $id); @@ -242,31 +210,13 @@ function GiveRep($id, $rep) db::c()->query('UPDATE users SET doblest = (doblest + ?i), rep_laba = (rep_laba + ?i) WHERE `id` = ?i', $rep, $rep, $id); } - -// полоска НР -function setHP($hp, $maxhp) -{ - if ($hp < $maxhp * 0.33) { - $polosa = 'i/1red.gif'; - } elseif ($hp < $maxhp * 0.66) { - $polosa = 'i/1yellow.gif'; - } else { - $polosa = 'i/1green.gif'; - } - $polosa_width = (122 * ($hp / $maxhp)); - $silver_polosa_width = (122 - 122 * ($hp / $maxhp)); - return << -Уровень жизни -Уровень жизни -$hp / $maxhp -HTML; -} - - /** - * @param $current - * @param $maximum + * Генератор прогрессбара. + * @param $current - Текущее значение. + * @param $maximum - Максимальное значение. + * @param string $line_color - Цвет полоски прогрессбара. + * @param string $bg_color - Фон прогрессбара. + * @return string */ function showProgressBar($current, $maximum, $line_color = 'limegreen', $bg_color = 'silver') { @@ -471,18 +421,6 @@ function show_eff_inf($u, $type) return $r; } -function timetoheals($user) -{ - $efs = db::c()->query('SELECT SUM(`speed`) AS `speed` FROM `effects` WHERE `owner` = ?i', $user['id'])->fetch_assoc_array(); - $efs['speed'] += 0; - if ($efs['speed'] > 0) { - $fulltime = $efs['speed'] * 2000; - } else { - $fulltime = 2000; - } - return $fulltime; -} - /** * @param $time * @param $vars @@ -499,32 +437,9 @@ function addActions($time, $vars, $vls, $uid) return $ins; } - -function plusorminus($n, $shownum = 1) +function undressall($user_id) { - if (empty($shownum)) { - if ($n >= 2) { - return "++"; - } - if ($n > 0) { - return "+"; - } - if ($n < 0) { - return "-"; - } - } - if ($n >= 0) { - return "+$n"; - } else { - return $n; - } -} - -function undressall($id) -{ - for ($i = 1; $i <= 26; $i++) { - dropitemid($i, $id); - } + db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot BETWEEN 1 AND 12 AND owner_id = ?i', $user_id); } function dropitemid($slot, $id) @@ -941,7 +856,7 @@ function destructitem($id) } // использовать магию -function usemagic($id) +function usemagic($id, $target) { global $user; $row = db::c()->query('SELECT * FROM `inventory` WHERE `owner` = ?i AND id = ?i', $user['id'], $id)->fetch_assoc_array(); diff --git a/labirint.php b/labirint.php index c709ce5..0c74f72 100644 --- a/labirint.php +++ b/labirint.php @@ -56,7 +56,7 @@ if($user['room'] == 1052) { $dies = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `laba_act` WHERE `uid` = "'.$user['id'].'" AND `lib` = "'.$user['laba'].'" AND `vars` = "dielaba" LIMIT 1')); $dies = $dies[0]; $map_d = json_decode($map['data']); - $usersDng = setHP($user['hp'], $user['maxhp'], 0); + $usersDng = showProgressBar($user['hp'], $user['maxhp']); $errors = ''; $effed = ''; $mapsee = ''; diff --git a/main.php b/main.php index 8525af1..6b80b20 100644 --- a/main.php +++ b/main.php @@ -12,228 +12,200 @@ if (!isset($_SESSION['uid'])) { require_once 'functions.php'; -$tmaz = time(); try { - db::c()->query('UPDATE `online` SET `real_time` = ?i WHERE `user_id` = ?i', time(), $user['id']); + db::c()->query('UPDATE `online` SET `real_time` = ?i WHERE `user_id` = ?i', time(), $user->id); } catch (\Krugozor\Database\Mysql\Exception $e) { echo "
Ошибка: " . $e->getMessage() . "
Стек: " . $e->getTraceAsString() . "
"; } - -if (!empty($user['battle'])) { +if ($user->battle) { header('location: fbattle.php'); - die(); + exit(); +} +//БС +if ($user->in_tower == 1) { + header('Location: towerin.php'); + exit(); } -//БС -if (isset($user['in_tower']) && $user['in_tower'] == 1) { - header('Location: towerin.php'); - die(); +// Инициализируем входящие GET\POST переменные. +$goto = $_GET['goto'] ?? null; +$obraz = $_GET['obraz'] ?? null; +$del = $_GET['del'] ?? null; +$effectId = $_GET['efid'] ?? null; +$brons = $_GET['modif_bron'] ?? null; +$stats = $_GET['modif_stat'] ?? null; +$mfs = $_GET['modif_mf'] ?? null; +$ids = $_GET['ids'] ?? null; +$setShadow = $_POST['setshadow'] ?? null; +$edit = $_GET['edit'] ?? null; +// Подготавливаем отображение инфы и предметов. +$showUser = new User($_SESSION['uid']); +$getItemsBonuses = new DressedItems($_SESSION['uid']); +$data_query = 'SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot = 0 AND on_sale = 0'; +$data = db::c()->query($data_query, $_SESSION['uid']); +$iteminfo = []; +while ($row = $data->fetch_assoc()) { + $iteminfo[] = new InventoryItem($row); } /* === проверяем соответствие комнаты и скрипта === */ -if (in_array($user['room'], [20, 21, 26, 48, 51, 52, 651, 2655, 2601, 2701, 2702, 2111], 1)) { +if (in_array($user->room, [20, 21, 26, 48, 51, 52, 651, 2655, 2601, 2701, 2702, 2111], 1)) { header('Location: city.php'); - die(); + exit(); } - -if ($user['room'] == 22) { +if ($user->room == 22) { header('Location: shop.php'); - die(); + exit(); } -if ($user['room'] == 23) { +if ($user->room == 23) { header('Location: repair.php'); - die(); + exit(); } -if ($user['room'] == 25) { +if ($user->room == 25) { header('Location: comission.php'); - die(); + exit(); } -if ($user['room'] == 27) { +if ($user->room == 27) { header('Location: post.php'); - die(); + exit(); } -if ($user['room'] == 29) { +if ($user->room == 29) { header('Location: bank.php'); - die(); + exit(); } -if ($user['room'] == 31) { +if ($user->room == 31) { header('Location: tower.php'); - die(); + exit(); } -if ($user['room'] == 30) { +if ($user->room == 30) { header('Location: clan_create.php'); - die(); + exit(); } -if ($user['room'] == 34) { +if ($user->room == 34) { header('Location: fshop.php'); - die(); + exit(); } -if ($user['room'] == 42) { +if ($user->room == 42) { header('Location: lotery.php'); - die(); + exit(); } -if ($user['room'] == 43) { +if ($user->room == 43) { header('Location: znahar.php'); - die(); + exit(); } -if ($user['room'] == 44) { +if ($user->room == 44) { header('Location: new_year.php'); - die(); + exit(); } -if ($user['room'] == 45) { +if ($user->room == 45) { header('Location: clan_castle.php'); - die(); + exit(); } -if ($user['room'] == 47) { +if ($user->room == 47) { header('Location: wall_build.php'); - die(); + exit(); } -if ($user['room'] == 49) { +if ($user->room == 49) { header('Location: dig.php'); - die(); + exit(); } -if ($user['room'] == 50) { +if ($user->room == 50) { header('Location: ashop.php'); - die(); + exit(); } -if ($user['room'] == 53) { +if ($user->room == 53) { header('Location: library.php'); - die(); + exit(); } -if ($user['room'] == 61) { +if ($user->room == 61) { header('Location: akadem.php'); - die(); + exit(); } -if ($user['room'] == 650) { +if ($user->room == 650) { header('Location: ul_clans.php'); - die(); + exit(); } - //Храм древнх -if ($user['room'] == 203) { +if ($user->room == 203) { header('Location: church.php'); - die(); + exit(); } //ЦХ -if ($user['room'] == 600) { +if ($user->room == 600) { header('Location: c_haos.php'); - die(); + exit(); } -if ($user['room'] == 601) { +if ($user->room == 601) { header('Location: c_haos_in.php'); - die(); + exit(); } -if ($user['room'] == 602) { +if ($user->room == 602) { header('Location: c_park.php'); - die(); + exit(); } -if ($user['room'] == 603) { +if ($user->room == 603) { header('Location: aren_of_angels.php'); - die(); + exit(); } -if ($user['room'] == 620) { +if ($user->room == 620) { header('Location: enter_cave.php'); - die(); + exit(); } -if ($user['room'] == 621) { +if ($user->room == 621) { header('Location: cave.php'); - die(); + exit(); } -if ($user['room'] == 660) { +if ($user->room == 660) { header('Location: hostel.php'); - die(); + exit(); } -if ($user['room'] == 661) { +if ($user->room == 661) { header('Location: hostel_room.php'); - die(); + exit(); } -if ($user['room'] == 662) { +if ($user->room == 662) { header('Location: quest_room.php'); - die(); + exit(); } -if ($user['room'] == 760) { +if ($user->room == 760) { header('Location: c_forest.php'); - die(); + exit(); } -if ($user['room'] == 1000) { +if ($user->room == 1000) { header('Location: solib/enterbezdna.php'); - die(); + exit(); } -if ($user['room'] == 1001) { +if ($user->room == 1001) { header('Location: solib/dungeon.php'); - die(); + exit(); } -if ($user['room'] == 1051) { +if ($user->room == 1051) { header('Location: lab_enter.php'); - die(); + exit(); } -if ($user['room'] == 1052) { +if ($user->room == 1052) { header('Location: labirint.php'); - die(); + exit(); } -if ($user['room'] == 402) { +if ($user->room == 402) { header('Location: vxod.php'); - die(); + exit(); } -if ($user['room'] == 403) { +if ($user->room == 403) { header('Location: canalizaciya.php'); - die(); + exit(); } -if ($user['room'] == 1054) { +if ($user->room == 1054) { header('Location: fontan_luck.php'); - die(); + exit(); } -if ($user['room'] == 1055) { +if ($user->room == 1055) { header('Location: group_arena.php'); - die(); + exit(); } -if ($user['room'] == 666) { +if ($user->room == 666) { header('Location: jail.php'); - die(); -} - -function stack($it_id) -{ - global $user; - $it_id = (int)$it_id; - $stack = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i AND `owner` = ?i', $it_id, $user['id']); - if (db::c()->getAffectedRows() === 1) { - $stack = $stack->fetch_assoc(); - $similar = mysql_fetch_array(mysql_query("SELECT SUM(`koll`) FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` != '" . $stack['id'] . "' AND `name` = '" . $stack['name'] . "' AND `present` = '" . $stack['present'] . "' AND `duration` = '" . $stack['duration'] . "' AND `maxdur` = '" . $stack['maxdur'] . "' AND `laba` = '" . $stack['laba'] . "' AND `gmeshok` = '" . $stack['gmeshok'] . "' AND `dressed` = 0 AND `goden` = 0 AND `setsale` = 0 AND `koll` >= 1 AND `isrep` = '" . $stack['isrep'] . "' AND FORMAT(`cost`/`koll`, 2) = FORMAT(" . ($stack['cost'] / $stack['koll']) . ", 2) AND FORMAT(`point`/`koll`, 2) = FORMAT(" . ($stack['point'] / $stack['koll']) . ", 2) AND FORMAT(`bcost`/`koll`, 2) = FORMAT(" . ($stack['bcost'] / $stack['koll']) . ", 2)")); - if ($similar[0] >= 1) { - mysql_query("UPDATE `inventory` SET `cost` = (`cost`+`cost`/`koll`*" . $similar[0] . "), `point` = (`point`+`point`/`koll`*" . $similar[0] . "), `bcost` = (`bcost`+`bcost`/`koll`*" . $similar[0] . "), `massa` = (`massa`+`massa`/`koll`*" . $similar[0] . "), `koll` = (`koll`+" . $similar[0] . "), `gmeshok` = (`gmeshok`+`gmeshok`*" . $similar[0] . ") WHERE `id` = '" . $stack['id'] . "' LIMIT 1"); - mysql_query("DELETE FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` != '" . $stack['id'] . "' AND `name` = '" . $stack['name'] . "' AND `present` = '" . $stack['present'] . "' AND `duration` = '" . $stack['duration'] . "' AND `maxdur` = '" . $stack['maxdur'] . "' AND `dressed` = 0 AND `goden` = 0 AND `koll` >= 1 AND `setsale` = 0 AND `gmeshok` = '" . $stack['gmeshok'] . "' AND `laba` = '" . $stack['laba'] . "' AND `isrep` = '" . $stack['isrep'] . "' AND FORMAT(`cost`/`koll`, 2)=FORMAT(" . $stack['cost'] / $stack['koll'] . ", 2) AND FORMAT(`point`/`koll`, 2) = FORMAT(" . ($stack['point'] / $stack['koll']) . ", 2) AND FORMAT(`bcost`/`koll`, 2) = FORMAT(" . ($stack['bcost'] / $stack['koll']) . ", 2) "); - } - } -} - -function unstack($it_id, $it_count) -{ - global $user; - $it_id = (int)$it_id; - $it_count = (int)$it_count; - $it_count = abs($it_count); - - try { - $dress = db::c()->query('SELECT * FROM inventory WHERE owner = ?i AND id = ?i', $user['id'], $it_id)->fetch_assoc_array(); - } catch (\Krugozor\Database\Mysql\Exception $e) { - echo "
Ошибка: " . $e->getMessage() . "
В файле: " . $e->getFile() . " (" . $e->getLine() . ")
"; - } - if (isset($dress['id'])) { - if ($it_count <= $dress['koll'] && $it_count > 0) { - if ($dress['koll'] == $it_count) { - db::c()->query('DELETE FROM inventory WHERE owner = ?i AND id = ?i', $user['id'], $dress['id']); - } else { - mysql_query("UPDATE `inventory` SET `cost` = (`cost`-`cost`/`koll`*" . $it_count . "), `point` = (`point`-`point`/`koll`*" . $it_count . "), `bcost` = (`bcost`-`bcost`/`koll`*" . $it_count . "), `massa` = (`massa`-`massa`/`koll`*" . $it_count . "), `koll` = (`koll`-" . $it_count . ") WHERE `id` = '$dress[id]' AND `owner` = '$user[id]' LIMIT 1"); - } - mysql_query("INSERT INTO `inventory` (`name`, `upgrade`, `modif`, `podgon`, `duration`, `maxdur`, `cost`, `bcost`, `point`, `nlevel`, `nsila`, `nlovk`, `ninta`, `nvinos`, `nintel`, `nmudra`, `nnoj`, `ntopor`, `ndubina`, `nmech`, `nalign`, `minu`, `maxu`, `gsila`, `glovk`, `ginta`, `gintel`, `ghp`, `mfkrit`, `mfakrit`, `mfuvorot`, `mfauvorot`, `gnoj`, `gtopor`, `gdubina`, `gmech`, `img`, `text`, `owner`, `dressed`, `bron1`, `bron2`, `bron3`, `bron4`, `dategoden`, `magic`, `type`, `present`, `sharped`, `massa`, `goden`, `needident`, `nfire`, `nwater`, `nair`, `nearth`, `nlight`, `ngray`, `ndark`, `gfire`, `gwater`, `gair`, `gearth`, `glight`, `ggray`, `gdark`, `free_bron`, `free_stat`, `free_mf`, `letter`, `isrep`, `update`, `setsale`, `prototype`, `otdel`, `bs`, `gmp`, `includemagic`, `includemagicdex`, `includemagicmax`, `includemagicname`, `includemagicuses`, `includemagiccost`, `gmeshok`, `tradesale`, `podzem`, `x_mis`, `artefact`, `destinyinv`, `encicl`, `foronetrip`, `koll`) VALUES ('" . $dress['name'] . "', '" . $dress['upgrade'] . "', '" . $dress['modif'] . "', '" . $dress['podgon'] . "', '" . $dress['duration'] . "', '" . $dress['maxdur'] . "', '" . ($dress['cost'] / $dress['koll'] * $it_count) . "', '" . ($dress['bcost'] / $dress['koll'] * $it_count) . "', '" . ($dress['point'] / $dress['koll'] * $it_count) . "', '" . $dress['nlevel'] . "', '" . $dress['nsila'] . "', '" . $dress['nlovk'] . "', '" . $dress['ninta'] . "', '" . $dress['nvinos'] . "', '" . $dress['nintel'] . "', '" . $dress['nmudra'] . "', '" . $dress['nnoj'] . "', '" . $dress['ntopor'] . "', '" . $dress['ndubina'] . "', '" . $dress['nmech'] . "', '" . $dress['nalign'] . "', '" . $dress['minu'] . "', '" . $dress['maxu'] . "', '" . $dress['gsila'] . "', '" . $dress['glovk'] . "', '" . $dress['ginta'] . "', '" . $dress['gintel'] . "', '" . $dress['ghp'] . "', '" . $dress['mfkrit'] . "', '" . $dress['mfakrit'] . "', '" . $dress['mfuvorot'] . "', '" . $dress['mfauvorot'] . "', '" . $dress['gnoj'] . "', '" . $dress['gtopor'] . "', '" . $dress['gdubina'] . "', '" . $dress['gmech'] . "', '" . $dress['img'] . "', '" . $dress['text'] . "', '" . $dress['owner'] . "', '" . $dress['dressed'] . "', '" . $dress['bron1'] . "', '" . $dress['bron2'] . "', '" . $dress['bron3'] . "', '" . $dress['bron4'] . "', '" . $dress['dategoden'] . "', '" . $dress['magic'] . "', '" . $dress['type'] . "', '" . $dress['present'] . "', '" . $dress['sharped'] . "', '" . ($dress['massa'] / $dress['koll'] * $it_count) . "', '" . $dress['goden'] . "', '" . $dress['needident'] . "', '" . $dress['nfire'] . "', '" . $dress['nwater'] . "', '" . $dress['nair'] . "', '" . $dress['nearth'] . "', '" . $dress['nlight'] . "', '" . $dress['ngray'] . "', '" . $dress['ndark'] . "', '" . $dress['gfire'] . "', '" . $dress['gwater'] . "', '" . $dress['gair'] . "', '" . $dress['gearth'] . "', '" . $dress['glight'] . "', '" . $dress['ggray'] . "', '" . $dress['gdark'] . "', '" . $dress['free_bron'] . "', '" . $dress['free_bron'] . "', '" . $dress['free_mf'] . "', '" . $dress['letter'] . "', '" . $dress['isrep'] . "', '" . $dress['update'] . "', '" . $dress['setsale'] . "', '" . $dress['prototype'] . "', '" . $dress['otdel'] . "', '" . $dress['bs'] . "', '" . $dress['gmp'] . "', '" . $dress['includemagic'] . "', '" . $dress['includemagicdex'] . "', '" . $dress['includemagicmax'] . "', '" . $dress['includemagicname'] . "', '" . $dress['ggrincludemagicusesay'] . "', '" . $dress['includemagiccost'] . "', '" . ($dress['gmeshok'] / $dress['koll'] * $it_count) . "', '" . $dress['tradesale'] . "', '" . $dress['podzem'] . "', '" . $dress['x_mis'] . "', '" . $dress['artefact'] . "', '" . $dress['destinyinv'] . "', '" . $dress['encicl'] . "', '" . $dress['foronetrip'] . "', '" . $it_count . "')"); - return mysql_insert_id(); - } else { - return false; - } - } else { - return false; - } + exit(); } function del_efs($id, $type) @@ -249,7 +221,6 @@ function del_efs($id, $type) } } - // одеть предмет function dressitem($id) { @@ -328,37 +299,32 @@ function dressitem($id) } } -function undressallself() -{ - db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot BETWEEN 1 AND 12 AND owner_id = ?i', $_SESSION['uid']); -} - // Входим и выходим если можем. -if (isset($_GET['goto'])) { +if ($goto) { $imove = true; - $d = db::c()->query('SELECT SUM(`weight`) AS `sum_weight` FROM `inventory` WHERE `owner` = ?i AND `on_sale` = 0', $user['id'])->fetch_assoc(); - $eff = db::c()->query('SELECT 1 FROM `users_effects` WHERE `owner_id` = ?i AND (`type` = 14 OR `type` = 13)', $user['id']); + $d = db::c()->query('SELECT SUM(weight) AS sum_weight FROM inventory WHERE owner_id = ?i AND on_sale = 0', $user->id)->fetch_assoc(); + $eff = db::c()->query('SELECT 1 FROM `users_effects` WHERE `owner_id` = ?i AND (`type` = 14 OR `type` = 13)', $user->id); //(масса: getItemsWeight() . '/' . $showUser->strength * 4 - if ($d['sum_weight'] > $user['strength'] * 4 && $_GET['got']) { + if ($d['sum_weight'] > $user->strength * 4 && $goto) { err('У вас переполнен рюкзак, вы не можете передвигаться...'); $imove = false; } - if ($eff->getNumRows() && $_GET['got']) { + if ($eff->getNumRows() && $goto) { err('У вас тяжелая травма, вы не можете передвигатся...'); $imove = false; } - if ($_GET['goto'] == 'plo' && empty($user['zayavka']) && $imove === true) { - db::c()->query('UPDATE `users`,`online` SET `users`.`room` = 20,`online`.`room` = 20 WHERE `online`.`id` = `users`.`id` AND `online`.`id` = ?i', $_SESSION['uid']); + if ($goto == 'plo' && !$user->zayavka && $imove === true) { + db::c()->query('UPDATE users, online SET users.room = 20, online.room = 20 WHERE online.user_id = users.id AND online.users_id = ?i', $_SESSION['uid']); header('Location: city.php'); - die("Топ-топ-топ..."); + exit("Топ-топ-топ..."); } else { err('Подали заявку на бой и убегаете из клуба? Нехорошо...'); } - if ($_GET['goto'] == 'arena' && $user['room'] === 20 && $imove === true) { - db::c()->query('UPDATE `users`, `online` SET `users`.`room` = 1, `online`.`room` = 1 WHERE `online`.`id` = `users`.`id` AND `online`.`id` = ?i', $_SESSION['uid']); + if ($goto == 'arena' && $user->room === 20 && $imove === true) { + db::c()->query('UPDATE users, online SET users.room = 1, online.room = 1 WHERE online.user_id = users.id AND online.user_id = ?i', $_SESSION['uid']); header('Location: main.php'); - die("Топ-топ-топ..."); + exit("Топ-топ-топ..."); } } @@ -366,21 +332,6 @@ if (isset($_GET['use'])) { usemagic($_GET['use'], $_POST['target']); } -unset($_SESSION['stackall']); - -if (isset($_GET["stack"])) { - $_GET["stack"] = (int)$_GET["stack"]; - $rec = db::c()->query('SELECT `id` FROM `inventory` WHERE `id` = ?i AND `owner` = ?i AND `setsale` = 0', $_GET['stack'], $user['id'])->fetch_assoc(); - if (isset($rec['id'])) { - stack($rec['id']); - unset($rec); - } -} - -if (isset($_GET['unstack'])) { - unstack((int)$_GET['unstack'], (int)$_POST["qty"]); -} - function setShadow($image) { global $user; @@ -397,67 +348,57 @@ function setShadow($image) } } -$obraz = filter_input(INPUT_GET, 'obraz'); -if ($obraz && ($user['shadow'] == 'g0.gif' || $user['shadow'] == 'man0.gif')) { +if ($obraz && ($user->shadow == 'g0.gif' || $user->shadow == 'man0.gif')) { setShadow($obraz); } -if (isset($_GET['del']) && $_GET['del'] == 1 && $_GET['efid'] > 0) { - $pl = db::c()->query('SELECT `id`, `type` FROM `users_effects` WHERE `owner_id` = ?i AND `id` = ?i', $user['id'], (int)$_GET['efid'])->fetch_assoc(); - if (isset($pl['id'])) { - echo del_efs($pl['id'], $pl['type']); +if ($del == 1 && $effectId > 0) { + $pl = db::c()->query('SELECT type FROM users_effects WHERE owner_id = ?i AND effect_id = ?i', $user['id'], $effectId)->fetch_assoc(); + if (isset($pl['type'])) { + echo del_efs($effectId, $pl['type']); } else { echo "Эффект не найден!"; } } - -if (isset($_GET['modif_bron'])) { - $brons = $_GET['modif_bron']; - $ids = $_GET['ids']; +if ($brons && $ids) { try { $cur = db::c()->query('SELECT free_bron, bron1, bron2, bron3, bron4 FROM inventory WHERE owner = ?i AND id = ?i', $user['id'], $ids)->fetch_assoc(); } catch (\Krugozor\Database\Mysql\Exception $e) { echo "
Ошибка: " . $e->getMessage() . "
В файле: " . $e->getFile() . " (" . $e->getLine() . ")
"; } if ($cur['free_bron'] > 0 && $cur[$brons] > 0) { - mysql_query("UPDATE `inventory` SET `free_bron` = (`free_bron`-1), `" . $brons . "` = (`" . $brons . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"); + db::c()->query('UPDATE inventory SET free_bron = free_bron - 1, ?f = ?f +1 WHERE owner_id = ?i AND item_id = ?i', $brons, $brons, $user->id, $ids); echo "Параметр брони увеличен!"; } } - -if (isset($_GET['modif_stat'])) { - $stats = $_GET['modif_stat']; - $ids = $_GET['ids']; - $cur = mysql_fetch_assoc(mysql_query("SELECT `id`, `free_stat`, `gsila`, `glovk`, `ginta`, `gintel` FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1")); - if (isset($cur['id']) && $cur['free_stat'] > 0 && $cur[$stats] > 0) { - mysql_query("UPDATE `inventory` SET `free_stat` = (`free_stat`-1), `" . $stats . "` = (`" . $stats . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"); +if ($stats && $ids) { + $cur = db::c()->query('SELECT free_stat, gsila, glovk, ginta, gintel FROM inventory WHERE owner_id = ?i AND item_id = ?i', $user->id, $ids); + if ($cur['free_stat'] > 0 && $cur[$stats] > 0) { + db::c()->query('UPDATE inventory SET free_stat = free_stat - 1, ?f = ?f +1 WHERE owner_id = ?i AND item_id = ?i', $stats, $stats, $user->id, $ids); echo "Параметр увеличен!"; } } - -if (isset($_GET['modif_mf'])) { - $mfs = $_GET['modif_mf']; - $ids = $_GET['ids']; - $cur = mysql_fetch_assoc(mysql_query("SELECT `id`, `free_mf`, `mfkrit`, `mfakrit`, `mfuvorot`, `mfauvorot` FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1")); +if ($mfs && $ids) { + $cur = db::c()->query('SELECT free_mf, mfkrit, mfuvorot, mfakrit, mfauvorot FROM inventory WHERE owner_id = ?i AND item_id = ?i', $user->id, $ids); if (isset($cur['id']) && $cur['free_mf'] > 0 && $cur[$mfs] > 0) { - mysql_query("UPDATE `inventory` SET `free_mf` = (`free_mf`-1), `" . $mfs . "` = (`" . $mfs . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"); + db::c()->query('UPDATE inventory SET free_mf = free_mf - 1, ?f = ?f +1 WHERE owner_id = ?i AND item_id = ?i', $mfs, $mfs, $user->id, $ids); echo "Параметр увеличен!"; } } - -if (input::post('setshadow')) { +if ($setShadow) { ?> +
- +

-

+

Количество рейтинговых очков клана:
+ style="color: #428f21; font-size: larger;">
- (стоимость услуги: 100 кр.) + (стоимость услуги: кр.)
- (стоимость услуги: 30 кр.) + (стоимость услуги: кр.)
- - + + - +
Может принимать/выгонять членов клана @@ -142,37 +164,37 @@ $clan_memberlist = db::c()->query('SELECT `id`, `login`, `status`, `level`, `roo - +
(сложить с себя полномочия, назначив Главой Клана другого персонажа)
- - - Недостаточно рейтинга для постройки замка. + + + Недостаточно рейтинга для постройки замка. - (собрать силами всего клана 25000 кр.)
+ (собрать силами всего клана кр.)
- +

- + Сбор средств на постройку кланового замка: - +

Средства на постройку кланового замка собраны! - +
full() ?> - - + +
@@ -487,31 +428,35 @@ if (input::post('setshadow')) { undressItem($_GET['drop']); + $items->undressItem($drop); } - //Пока что одеваем предмет отсюда. - if (isset($_GET['dress'])) { - echo dressitem($_GET['dress']); + if ($dress) { + echo dressitem($dress); } - - if (input::get('destruct')) { - $q = db::c()->query('SELECT `id`, `dressed`, `name`, `duration`, `maxdur` FROM `inventory` WHERE `owner` = ?i AND `id` = ?i', $_SESSION['uid'], input::get('destruct')); + if ($destruct) { + $q = db::c()->query('SELECT `id`, `dressed`, `name`, `duration`, `maxdur` FROM `inventory` WHERE `owner` = ?i AND `id` = ?i', $_SESSION['uid'], $destruct); if ($q->getNumRows()) { $q = $q->fetch_assoc(); if (empty($q['dressed'])) { @@ -525,27 +470,13 @@ if (isset($_GET['edit'])) { err('Ошибка: предмет не найден!'); } } - - if (input::get('use')) { - $q = db::c()->query('SELECT `id`, `koll` FROM `inventory` WHERE `id` = ?i AND `owner` = ?i', input::get('use'), $_SESSION['uid']); - if ($q->getNumRows()) { - $q = $q->fetch_assoc(); - if ($q['koll'] > 1) { - $id = unstack($q['id'], 1); - usemagic($id, $_POST['target']); - } else { - usemagic($_GET['use'], $_POST['target']); - } - } else { - err('Ошибка: предмет не найден!'); - } + if ($use) { + usemagic($use, $useTarget); } - - if (input::get('undress')) { - undressallself(); + if ($undress) { + undressall($_SESSION['uid']); } } - ?> @@ -566,29 +497,13 @@ if (isset($_GET['edit'])) { $(".tooltip").tipTip({maxWidth: "auto", edgeOffset: 0, fadeIn: 300, fadeOut: 500}); }); - function gotohref(filename) { - location.href = filename; - } - - function saveComplect() { - new miDialog({title: 'Сохранить комплект'}, {edit: 1}, function () { - document.location = '/main.php?' + $.param(this.data); - }, - $('
Название комплекта :
может содеражать только буквы (англ / русс) и цифры.
').append(miDialog._oneInput({name: 'savecomplect'})), {width: 250}); - } - let Hint3Name = ''; - function okno(title, script, name, coma, errk) { + function okno(title, script, name, errk) { let errkom = ''; let com = ''; if (errk === 1) { errkom = 'Нельзя использовать символы: /\:*?"<>|+%
'; - com = coma - } - if (errk === 2) { - errkom = 'Такой комплект уже существует
'; - com = coma } document.getElementById("hint3").innerHTML = '
Внимание! Образ персонажа выбирается только один раз.
' + title + 'x
' + '
' + @@ -599,71 +514,17 @@ if (isset($_GET['edit'])) { document.getElementById(name).focus(); Hint3Name = name; } - - const delay = 30; - let TimerOn = -1, tkHP, maxHP, speed = 750; - const stLen = 185, redHP = 0.33, yellowHP = 0.66; - - function setHPlocal() { - tkHP > maxHP && (tkHP = maxHP); - let a = Math.round(tkHP) + "/" + maxHP; - a = stLen - (a.length + 2) * 7; - const b = Math.round((a - 1) / maxHP * tkHP); - a -= b; - const HP = document.getElementById("hp_value"); - const HP1 = document.getElementById("HP1"); - const HP2 = document.getElementById("HP2"); - if (HP) { - HP1.width = b, HP2.width = a, HP1.src = tkHP / maxHP < redHP ? "i/1red.gif" : tkHP / maxHP < yellowHP ? "i/1yellow.gif" : "i/1green.gif", HP.innerHTML = Math.round(tkHP) + "/" + maxHP; - } - tkHP += maxHP / 53 / 230 * (speed / 100); - TimerOn = tkHP < maxHP ? setTimeout("setHPlocal()", delay * 100) : -1 - } - - $(document).ready(function () { - $('a').live('click', function () { - if ($(this).attr('ajax') !== undefined) { - const ajaxModule = $(this).attr('ajax'); - - switch (ajaxModule) { - case'mZeInventory': - $('#mZeInventory').html('
Загрузка...
'); - $.ajax({ - url: $(this).attr('href') + '&mZeAjax=' + ajaxModule, - cache: false, - dataType: 'html', - success: function (html) { - $('#mZeInventory').html(html); - } - }); - break; - } - return false; - } - }); - }); Окно игры -query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time() - 60)); -} catch (Exception $e) { - echo '
В таблице online нет ячейки real_time так как неясно что она делает. Ошибка обращения в базу.
'; -} -?>
- showUserDoll(0, 1); - ?> + showUserDoll(0, 1); ?>
Снять все
@@ -676,16 +537,15 @@ try {

Уровень: level ?>
Опыт: experience ?> -
Побед: -
Поражений: -
Ничьих: +
Побед: ?? +
Поражений: ?? +
Ничьих: ??
Деньги: money ?> кр.
- Сила: free_stat_points ? $showUser->getStrength(1) . '(' . strval($showUser->strength + $getItemsBonuses->getStrengthBonus()) . ')' : $showUser->strength + $getItemsBonuses->getStrengthBonus()) ?>
Ловкость: free_stat_points ? $showUser->getDexterity(1) . '(' . strval($showUser->dexterity + $getItemsBonuses->getDexterityBonus()) . ')' : $showUser->dexterity + $getItemsBonuses->getDexterityBonus()) ?> @@ -711,18 +571,15 @@ try { Урон: minDamage + $getItemsBonuses->getMinPhysDamage() ?> - maxDamage + $getItemsBonuses->getMaxPhysDamage() ?>

-
- Защита от огня: ??
- Защита от воды: ??
- Защита от вохдуха: ??
- Защита от земли: ??
- Защита от яда: ??
-
+ Защита от огня: ??
+ Защита от воды: ??
+ Защита от вохдуха: ??
+ Защита от земли: ??
+ Защита от яда: ??
Броня головы: headArmor ?>
Броня корпуса: chestArmor ?>
Броня ног: legArmor ?>
-
@@ -733,37 +590,28 @@ try { title="Образы">
- - - - - + + room === 20): ?> + - - +
-
+
query($data_query, $_SESSION['uid']); - - $groupNum = []; - $viewInventory = []; - $getItems = []; - $row = []; - $iteminfo = []; - while ($row = $data->fetch_assoc()) { - $iteminfo[] = new InventoryItem($row); - } - foreach ($iteminfo as $ii) { echo "
Рюкзак (масса: strength * 4 ?>)
"; $ii->printImage(); @@ -771,17 +619,6 @@ try { echo ""; $ii->printInfo(); } - - if ($viewInventory && $getItems) { - foreach ($viewInventory as $viewCategiryes) { - echo $viewCategiryes['header']; - foreach ($viewCategiryes['ids'] as $viewItem) { - echo $getItems[$viewItem]; - } - echo $viewCategiryes['fooder']; - } - } - if ($data->getNumRows() == 0) { echo "
Пусто"; } diff --git a/navig.php b/navig.php index 292b868..07c7d96 100644 --- a/navig.php +++ b/navig.php @@ -201,7 +201,7 @@ print""; if($ber['id'] == $glav_id){ print"> - - - - + > + + + + - > - - - - + > + + + + +} +?>
".$ber['login']."[".$ber["level"]."]\"Инфо\" "; -echo setHP($ber['hp'],$ber['maxhp']); +echo showProgressBar($ber['hp'],$ber['maxhp']); print"\"Лидер"; diff --git a/repair.php b/repair.php index 53343eb..df049fd 100644 --- a/repair.php +++ b/repair.php @@ -1,56 +1,75 @@ query('SELECT SUM(`massa`) FROM `inventory` WHERE `dressed` = 0 AND `owner` = ?i', $_SESSION['uid'])->fetch_assoc(); -if ($user['room'] != 23) { +if ($user->room != 23) { header("Location: main.php"); - die(); + exit(); } -if ($user['battle'] != 0) { +if ($user->battle) { header('location: fbattle.php'); - die(); + exit(); } +define('GRAV_LIMIT', 32); +define('GRAV_COST', 30); +define('REPAIR_STATUS', [ + 'OK_GRAV_ADDED' => 'Гравировка добавлена!', + 'OK_GRAV_REMOVED' => 'Гравировка удалена!', + 'OK_REPAIRED' => 'Предмет отремонтирован!', + 'ERROR_SIZE_LIMIT' => 'Превышен лимит в ' . GRAV_LIMIT . ' символа!', + 'ERROR_NO_MONEY' => 'Недостаточно денег!', +]); +$gravirovkaText = $_POST['gravirovka_text'] ?? null; +$itemId = $_POST['itemId'] ?? null; +$gravirovkaRemove = $_POST['gravirovka_remove'] ?? null; +$action = $_POST['action'] ?? null; +$goto = $_POST['goto'] ?? null; // Гравировка 30 кред. Максимум 32 символа. -if (input::post('gravirovka_text') AND input::post('itemId')) { - if (30 <= $user['money']) { - if (33 > iconv_strlen(input::post('gravirovka_text'))) { - db::c()->query('UPDATE `inventory` SET `text` = "?s" WHERE `dressed` = 0 AND `setsale` = 0 AND `owner` = ?i AND `id` = ?i', input::post('gravirovka_text'), $_SESSION['uid'], input::post('itemId')); - db::c()->query('UPDATE `users` SET `money` = `money` - 30 WHERE `id` = ?i', $_SESSION['uid']); - $status = 'Гравировка добавлена!'; - } else {$status = 'Превышен лимит в 32 символа!';} - } else {$status = 'Недостаточно денег!';} +if ($gravirovkaText && $itemId) { + if ($user->money >= GRAV_COST) { + if (iconv_strlen($gravirovkaText) <= GRAV_LIMIT) { + db::c()->query('UPDATE `inventory` SET `text` = "?s" WHERE `dressed` = 0 AND `setsale` = 0 AND `owner` = ?i AND `id` = ?i', $gravirovkaText, $_SESSION['uid'], $itemId); + db::c()->query('UPDATE `users` SET `money` = `money` - ?i WHERE `id` = ?i', GRAV_COST, $_SESSION['uid']); + $status = REPAIR_STATUS['OK_GRAV_ADDED']; + } else { + $status = REPAIR_STATUS['ERROR_SIZE_LIMIT']; + } + } else { + $status = REPAIR_STATUS['ERROR_NO_MONEY']; + } } - // Снять гравировку. -if (input::post('gravirovka_remove')) { - if (30 <= $user['money']) { - db::c()->query('UPDATE `inventory` SET `text` = ?n WHERE `dressed` = 0 AND `setsale` = 0 AND `id` = ?i AND `owner` = ?i', null, input::post('gravirovka_remove'), $_SESSION['uid']); - db::c()->query('UPDATE `users` SET `money` = `money` - 30 WHERE `id` = ?i', $_SESSION['uid']); - $status = 'Гравировка удалена!'; - } else {$status = 'Недостаточно денег!';} +if ($gravirovkaRemove) { + if ($user->money >= GRAV_COST) { + db::c()->query('UPDATE `inventory` SET `text` = ?n WHERE `dressed` = 0 AND `setsale` = 0 AND `id` = ?i AND `owner` = ?i', null, $gravirovkaRemove, $_SESSION['uid']); + db::c()->query('UPDATE `users` SET `money` = `money` - ?i WHERE `id` = ?i', GRAV_COST, $_SESSION['uid']); + $status = REPAIR_STATUS['OK_GRAV_REMOVED']; + } else { + $status = REPAIR_STATUS['ERROR_NO_MONEY']; + } } - // Ремонт 0,5 кред за единицу. -if (input::post('action') == 'repair' AND input::post('itemId')) { - $q = db::c()->query('SELECT `name`, `duration` FROM `inventory` WHERE id = ?i', input::post('itemId'))->fetch_assoc(); - if (ceil($q['duration'] / 2) < $user['money']) { - db::c()->query('UPDATE `inventory` SET `maxdur` = `maxdur` - 1, `duration` = 0 WHERE `dressed` = 0 AND `setsale` = 0 AND `id` = ?i AND `owner` = ?i', input::post('itemId'), $_SESSION['uid']); +if ($action == 'repair' && $itemId) { + $q = db::c()->query('SELECT `name`, `duration` FROM `inventory` WHERE id = ?i', $itemId)->fetch_assoc(); + if ($user->money > ceil($q['duration'] / 2)) { + db::c()->query('UPDATE `inventory` SET `maxdur` = `maxdur` - 1, `duration` = 0 WHERE `dressed` = 0 AND `setsale` = 0 AND `id` = ?i AND `owner` = ?i', $itemId, $_SESSION['uid']); db::c()->query('UPDATE `users` SET `money` = `money` - ?i WHERE `id` = ?i', ceil($q['duration'] / 2), $_SESSION['uid']); - addToDelo('Отремонтирован предмет «' . $q['name'] . '» id:(' . input::post('itemId') . ') за ' . ceil($q['duration'] / 2) . ' кр.'); - $status = 'Предмет отремонтирован!'; - } else {$status = 'Недостаточно денег!';} + addToDelo('Отремонтирован предмет «' . $q['name'] . '» id:(' . $itemId . ') за ' . ceil($q['duration'] / 2) . ' кр.'); + $status = REPAIR_STATUS['OK_REPAIRED']; + } else { + $status = REPAIR_STATUS['ERROR_NO_MONEY']; + } } - -if (input::post('goto') == 'remont') { +if ($goto == 'remont') { $remont_query = db::c()->query('SELECT `id`,`name`,`img`,`duration`,`maxdur` FROM `inventory` WHERE `type` < 12 AND `dressed` = 0 AND `isrep` = 1 AND `setsale` = 0 AND `duration` > 0 AND `owner` = ?i ORDER BY `update` DESC', $_SESSION['uid']); } - -if (input::post('goto') == 'gravirovka') { +if ($goto == 'gravirovka') { $gravirovka_query = db::c()->query('SELECT `id`,`name`,`img`,`text` FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 3 AND `name` NOT LIKE "?S" AND `setsale` = 0 OR `text` <> "?s" AND `owner` = ?i AND `dressed` = 0 AND `setsale` = 0 ORDER by `update` DESC', $_SESSION['uid'], '%Букет%', '', $_SESSION['uid']); } - ?> @@ -82,7 +101,7 @@ if (input::post('goto') == 'gravirovka') { Зал гравировки - + Нанесение надписей на оружие и удаление надписей из любого обмундирования. Максимум 32 символа! @@ -92,7 +111,7 @@ if (input::post('goto') == 'gravirovka') { -fetch_assoc()): ?>
@@ -109,7 +128,7 @@ if (input::post('goto') == 'gravirovka') {
-fetch_assoc()): ?>
@@ -135,53 +154,53 @@ if (input::post('goto') == 'gravirovka') { -
"; -
- - Модифицировать - за кр.
-
-
"; +
+ + Модифицировать + за кр.
+
+
"; -
- - 0) { - $babki = round(($row['point'] / 2), 0); - $cost_t = 'Реп'; - } else { - $babki = round(($row['cost'] / 2), 0); - $cost_t = 'Кр'; - } - ?> - Подогнать - за .
-
-
"; +
+ + 0) { + $babki = round(($row['point'] / 2), 0); + $cost_t = 'Реп'; + } else { + $babki = round(($row['cost'] / 2), 0); + $cost_t = 'Кр'; + } + ?> + Подогнать + за .
+
+
\ No newline at end of file diff --git a/zayavka.php b/zayavka.php index f638f58..9149200 100644 --- a/zayavka.php +++ b/zayavka.php @@ -11,10 +11,9 @@ if ($user['battle'] != 0) { } db::c()->query('LOCK TABLES `bots` WRITE, `battle` WRITE, `logs` WRITE, `users` WRITE, `inventory` WRITE, `zayavka` WRITE, `effects` WRITE, `online` WRITE, `clans` WRITE'); - -if ((input::check('do') == "clear") AND $user['admin'] == 1) { +$do = $_GET['do'] ?? null; +if ($do == "clear" && $user->admin == 1) { db::c()->query('UPDATE `zayavka` SET `coment` = "?s" WHERE `id` = ?i', 'Вырезано цензурой!', $_GET['zid']); - } if (!empty($_GET['del']) && $user['admin'] == 1) { //удаление заявки на бой.