Чистка оптимизация и унификация кода.
This commit is contained in:
@@ -12,228 +12,200 @@ if (!isset($_SESSION['uid'])) {
|
||||
|
||||
require_once 'functions.php';
|
||||
|
||||
$tmaz = time();
|
||||
try {
|
||||
db::c()->query('UPDATE `online` SET `real_time` = ?i WHERE `user_id` = ?i', time(), $user['id']);
|
||||
db::c()->query('UPDATE `online` SET `real_time` = ?i WHERE `user_id` = ?i', time(), $user->id);
|
||||
} catch (\Krugozor\Database\Mysql\Exception $e) {
|
||||
echo "<div class='debug' '>Ошибка: " . $e->getMessage() . "<br> Стек: " . $e->getTraceAsString() . "</div>";
|
||||
}
|
||||
|
||||
if (!empty($user['battle'])) {
|
||||
if ($user->battle) {
|
||||
header('location: fbattle.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
//БС
|
||||
if ($user->in_tower == 1) {
|
||||
header('Location: towerin.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
//БС
|
||||
if (isset($user['in_tower']) && $user['in_tower'] == 1) {
|
||||
header('Location: towerin.php');
|
||||
die();
|
||||
// Инициализируем входящие GET\POST переменные.
|
||||
$goto = $_GET['goto'] ?? null;
|
||||
$obraz = $_GET['obraz'] ?? null;
|
||||
$del = $_GET['del'] ?? null;
|
||||
$effectId = $_GET['efid'] ?? null;
|
||||
$brons = $_GET['modif_bron'] ?? null;
|
||||
$stats = $_GET['modif_stat'] ?? null;
|
||||
$mfs = $_GET['modif_mf'] ?? null;
|
||||
$ids = $_GET['ids'] ?? null;
|
||||
$setShadow = $_POST['setshadow'] ?? null;
|
||||
$edit = $_GET['edit'] ?? null;
|
||||
// Подготавливаем отображение инфы и предметов.
|
||||
$showUser = new User($_SESSION['uid']);
|
||||
$getItemsBonuses = new DressedItems($_SESSION['uid']);
|
||||
$data_query = 'SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot = 0 AND on_sale = 0';
|
||||
$data = db::c()->query($data_query, $_SESSION['uid']);
|
||||
$iteminfo = [];
|
||||
while ($row = $data->fetch_assoc()) {
|
||||
$iteminfo[] = new InventoryItem($row);
|
||||
}
|
||||
|
||||
/* === проверяем соответствие комнаты и скрипта === */
|
||||
if (in_array($user['room'], [20, 21, 26, 48, 51, 52, 651, 2655, 2601, 2701, 2702, 2111], 1)) {
|
||||
if (in_array($user->room, [20, 21, 26, 48, 51, 52, 651, 2655, 2601, 2701, 2702, 2111], 1)) {
|
||||
header('Location: city.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($user['room'] == 22) {
|
||||
if ($user->room == 22) {
|
||||
header('Location: shop.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 23) {
|
||||
if ($user->room == 23) {
|
||||
header('Location: repair.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 25) {
|
||||
if ($user->room == 25) {
|
||||
header('Location: comission.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 27) {
|
||||
if ($user->room == 27) {
|
||||
header('Location: post.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 29) {
|
||||
if ($user->room == 29) {
|
||||
header('Location: bank.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 31) {
|
||||
if ($user->room == 31) {
|
||||
header('Location: tower.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 30) {
|
||||
if ($user->room == 30) {
|
||||
header('Location: clan_create.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 34) {
|
||||
if ($user->room == 34) {
|
||||
header('Location: fshop.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 42) {
|
||||
if ($user->room == 42) {
|
||||
header('Location: lotery.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 43) {
|
||||
if ($user->room == 43) {
|
||||
header('Location: znahar.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 44) {
|
||||
if ($user->room == 44) {
|
||||
header('Location: new_year.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 45) {
|
||||
if ($user->room == 45) {
|
||||
header('Location: clan_castle.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 47) {
|
||||
if ($user->room == 47) {
|
||||
header('Location: wall_build.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 49) {
|
||||
if ($user->room == 49) {
|
||||
header('Location: dig.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 50) {
|
||||
if ($user->room == 50) {
|
||||
header('Location: ashop.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 53) {
|
||||
if ($user->room == 53) {
|
||||
header('Location: library.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 61) {
|
||||
if ($user->room == 61) {
|
||||
header('Location: akadem.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 650) {
|
||||
if ($user->room == 650) {
|
||||
header('Location: ul_clans.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
|
||||
//Храм древнх
|
||||
if ($user['room'] == 203) {
|
||||
if ($user->room == 203) {
|
||||
header('Location: church.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
//ЦХ
|
||||
if ($user['room'] == 600) {
|
||||
if ($user->room == 600) {
|
||||
header('Location: c_haos.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 601) {
|
||||
if ($user->room == 601) {
|
||||
header('Location: c_haos_in.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 602) {
|
||||
if ($user->room == 602) {
|
||||
header('Location: c_park.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 603) {
|
||||
if ($user->room == 603) {
|
||||
header('Location: aren_of_angels.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 620) {
|
||||
if ($user->room == 620) {
|
||||
header('Location: enter_cave.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 621) {
|
||||
if ($user->room == 621) {
|
||||
header('Location: cave.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 660) {
|
||||
if ($user->room == 660) {
|
||||
header('Location: hostel.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 661) {
|
||||
if ($user->room == 661) {
|
||||
header('Location: hostel_room.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 662) {
|
||||
if ($user->room == 662) {
|
||||
header('Location: quest_room.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 760) {
|
||||
if ($user->room == 760) {
|
||||
header('Location: c_forest.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 1000) {
|
||||
if ($user->room == 1000) {
|
||||
header('Location: solib/enterbezdna.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 1001) {
|
||||
if ($user->room == 1001) {
|
||||
header('Location: solib/dungeon.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 1051) {
|
||||
if ($user->room == 1051) {
|
||||
header('Location: lab_enter.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 1052) {
|
||||
if ($user->room == 1052) {
|
||||
header('Location: labirint.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 402) {
|
||||
if ($user->room == 402) {
|
||||
header('Location: vxod.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 403) {
|
||||
if ($user->room == 403) {
|
||||
header('Location: canalizaciya.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 1054) {
|
||||
if ($user->room == 1054) {
|
||||
header('Location: fontan_luck.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 1055) {
|
||||
if ($user->room == 1055) {
|
||||
header('Location: group_arena.php');
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
if ($user['room'] == 666) {
|
||||
if ($user->room == 666) {
|
||||
header('Location: jail.php');
|
||||
die();
|
||||
}
|
||||
|
||||
function stack($it_id)
|
||||
{
|
||||
global $user;
|
||||
$it_id = (int)$it_id;
|
||||
$stack = db::c()->query('SELECT * FROM `inventory` WHERE `id` = ?i AND `owner` = ?i', $it_id, $user['id']);
|
||||
if (db::c()->getAffectedRows() === 1) {
|
||||
$stack = $stack->fetch_assoc();
|
||||
$similar = mysql_fetch_array(mysql_query("SELECT SUM(`koll`) FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` != '" . $stack['id'] . "' AND `name` = '" . $stack['name'] . "' AND `present` = '" . $stack['present'] . "' AND `duration` = '" . $stack['duration'] . "' AND `maxdur` = '" . $stack['maxdur'] . "' AND `laba` = '" . $stack['laba'] . "' AND `gmeshok` = '" . $stack['gmeshok'] . "' AND `dressed` = 0 AND `goden` = 0 AND `setsale` = 0 AND `koll` >= 1 AND `isrep` = '" . $stack['isrep'] . "' AND FORMAT(`cost`/`koll`, 2) = FORMAT(" . ($stack['cost'] / $stack['koll']) . ", 2) AND FORMAT(`point`/`koll`, 2) = FORMAT(" . ($stack['point'] / $stack['koll']) . ", 2) AND FORMAT(`bcost`/`koll`, 2) = FORMAT(" . ($stack['bcost'] / $stack['koll']) . ", 2)"));
|
||||
if ($similar[0] >= 1) {
|
||||
mysql_query("UPDATE `inventory` SET `cost` = (`cost`+`cost`/`koll`*" . $similar[0] . "), `point` = (`point`+`point`/`koll`*" . $similar[0] . "), `bcost` = (`bcost`+`bcost`/`koll`*" . $similar[0] . "), `massa` = (`massa`+`massa`/`koll`*" . $similar[0] . "), `koll` = (`koll`+" . $similar[0] . "), `gmeshok` = (`gmeshok`+`gmeshok`*" . $similar[0] . ") WHERE `id` = '" . $stack['id'] . "' LIMIT 1");
|
||||
mysql_query("DELETE FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` != '" . $stack['id'] . "' AND `name` = '" . $stack['name'] . "' AND `present` = '" . $stack['present'] . "' AND `duration` = '" . $stack['duration'] . "' AND `maxdur` = '" . $stack['maxdur'] . "' AND `dressed` = 0 AND `goden` = 0 AND `koll` >= 1 AND `setsale` = 0 AND `gmeshok` = '" . $stack['gmeshok'] . "' AND `laba` = '" . $stack['laba'] . "' AND `isrep` = '" . $stack['isrep'] . "' AND FORMAT(`cost`/`koll`, 2)=FORMAT(" . $stack['cost'] / $stack['koll'] . ", 2) AND FORMAT(`point`/`koll`, 2) = FORMAT(" . ($stack['point'] / $stack['koll']) . ", 2) AND FORMAT(`bcost`/`koll`, 2) = FORMAT(" . ($stack['bcost'] / $stack['koll']) . ", 2) ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function unstack($it_id, $it_count)
|
||||
{
|
||||
global $user;
|
||||
$it_id = (int)$it_id;
|
||||
$it_count = (int)$it_count;
|
||||
$it_count = abs($it_count);
|
||||
|
||||
try {
|
||||
$dress = db::c()->query('SELECT * FROM inventory WHERE owner = ?i AND id = ?i', $user['id'], $it_id)->fetch_assoc_array();
|
||||
} catch (\Krugozor\Database\Mysql\Exception $e) {
|
||||
echo "<div style='background-color: #ffaaaa;'>Ошибка: " . $e->getMessage() . "<br> В файле: " . $e->getFile() . " (" . $e->getLine() . ")</div>";
|
||||
}
|
||||
if (isset($dress['id'])) {
|
||||
if ($it_count <= $dress['koll'] && $it_count > 0) {
|
||||
if ($dress['koll'] == $it_count) {
|
||||
db::c()->query('DELETE FROM inventory WHERE owner = ?i AND id = ?i', $user['id'], $dress['id']);
|
||||
} else {
|
||||
mysql_query("UPDATE `inventory` SET `cost` = (`cost`-`cost`/`koll`*" . $it_count . "), `point` = (`point`-`point`/`koll`*" . $it_count . "), `bcost` = (`bcost`-`bcost`/`koll`*" . $it_count . "), `massa` = (`massa`-`massa`/`koll`*" . $it_count . "), `koll` = (`koll`-" . $it_count . ") WHERE `id` = '$dress[id]' AND `owner` = '$user[id]' LIMIT 1");
|
||||
}
|
||||
mysql_query("INSERT INTO `inventory` (`name`, `upgrade`, `modif`, `podgon`, `duration`, `maxdur`, `cost`, `bcost`, `point`, `nlevel`, `nsila`, `nlovk`, `ninta`, `nvinos`, `nintel`, `nmudra`, `nnoj`, `ntopor`, `ndubina`, `nmech`, `nalign`, `minu`, `maxu`, `gsila`, `glovk`, `ginta`, `gintel`, `ghp`, `mfkrit`, `mfakrit`, `mfuvorot`, `mfauvorot`, `gnoj`, `gtopor`, `gdubina`, `gmech`, `img`, `text`, `owner`, `dressed`, `bron1`, `bron2`, `bron3`, `bron4`, `dategoden`, `magic`, `type`, `present`, `sharped`, `massa`, `goden`, `needident`, `nfire`, `nwater`, `nair`, `nearth`, `nlight`, `ngray`, `ndark`, `gfire`, `gwater`, `gair`, `gearth`, `glight`, `ggray`, `gdark`, `free_bron`, `free_stat`, `free_mf`, `letter`, `isrep`, `update`, `setsale`, `prototype`, `otdel`, `bs`, `gmp`, `includemagic`, `includemagicdex`, `includemagicmax`, `includemagicname`, `includemagicuses`, `includemagiccost`, `gmeshok`, `tradesale`, `podzem`, `x_mis`, `artefact`, `destinyinv`, `encicl`, `foronetrip`, `koll`) VALUES ('" . $dress['name'] . "', '" . $dress['upgrade'] . "', '" . $dress['modif'] . "', '" . $dress['podgon'] . "', '" . $dress['duration'] . "', '" . $dress['maxdur'] . "', '" . ($dress['cost'] / $dress['koll'] * $it_count) . "', '" . ($dress['bcost'] / $dress['koll'] * $it_count) . "', '" . ($dress['point'] / $dress['koll'] * $it_count) . "', '" . $dress['nlevel'] . "', '" . $dress['nsila'] . "', '" . $dress['nlovk'] . "', '" . $dress['ninta'] . "', '" . $dress['nvinos'] . "', '" . $dress['nintel'] . "', '" . $dress['nmudra'] . "', '" . $dress['nnoj'] . "', '" . $dress['ntopor'] . "', '" . $dress['ndubina'] . "', '" . $dress['nmech'] . "', '" . $dress['nalign'] . "', '" . $dress['minu'] . "', '" . $dress['maxu'] . "', '" . $dress['gsila'] . "', '" . $dress['glovk'] . "', '" . $dress['ginta'] . "', '" . $dress['gintel'] . "', '" . $dress['ghp'] . "', '" . $dress['mfkrit'] . "', '" . $dress['mfakrit'] . "', '" . $dress['mfuvorot'] . "', '" . $dress['mfauvorot'] . "', '" . $dress['gnoj'] . "', '" . $dress['gtopor'] . "', '" . $dress['gdubina'] . "', '" . $dress['gmech'] . "', '" . $dress['img'] . "', '" . $dress['text'] . "', '" . $dress['owner'] . "', '" . $dress['dressed'] . "', '" . $dress['bron1'] . "', '" . $dress['bron2'] . "', '" . $dress['bron3'] . "', '" . $dress['bron4'] . "', '" . $dress['dategoden'] . "', '" . $dress['magic'] . "', '" . $dress['type'] . "', '" . $dress['present'] . "', '" . $dress['sharped'] . "', '" . ($dress['massa'] / $dress['koll'] * $it_count) . "', '" . $dress['goden'] . "', '" . $dress['needident'] . "', '" . $dress['nfire'] . "', '" . $dress['nwater'] . "', '" . $dress['nair'] . "', '" . $dress['nearth'] . "', '" . $dress['nlight'] . "', '" . $dress['ngray'] . "', '" . $dress['ndark'] . "', '" . $dress['gfire'] . "', '" . $dress['gwater'] . "', '" . $dress['gair'] . "', '" . $dress['gearth'] . "', '" . $dress['glight'] . "', '" . $dress['ggray'] . "', '" . $dress['gdark'] . "', '" . $dress['free_bron'] . "', '" . $dress['free_bron'] . "', '" . $dress['free_mf'] . "', '" . $dress['letter'] . "', '" . $dress['isrep'] . "', '" . $dress['update'] . "', '" . $dress['setsale'] . "', '" . $dress['prototype'] . "', '" . $dress['otdel'] . "', '" . $dress['bs'] . "', '" . $dress['gmp'] . "', '" . $dress['includemagic'] . "', '" . $dress['includemagicdex'] . "', '" . $dress['includemagicmax'] . "', '" . $dress['includemagicname'] . "', '" . $dress['ggrincludemagicusesay'] . "', '" . $dress['includemagiccost'] . "', '" . ($dress['gmeshok'] / $dress['koll'] * $it_count) . "', '" . $dress['tradesale'] . "', '" . $dress['podzem'] . "', '" . $dress['x_mis'] . "', '" . $dress['artefact'] . "', '" . $dress['destinyinv'] . "', '" . $dress['encicl'] . "', '" . $dress['foronetrip'] . "', '" . $it_count . "')");
|
||||
return mysql_insert_id();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
exit();
|
||||
}
|
||||
|
||||
function del_efs($id, $type)
|
||||
@@ -249,7 +221,6 @@ function del_efs($id, $type)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// одеть предмет
|
||||
function dressitem($id)
|
||||
{
|
||||
@@ -328,37 +299,32 @@ function dressitem($id)
|
||||
}
|
||||
}
|
||||
|
||||
function undressallself()
|
||||
{
|
||||
db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot BETWEEN 1 AND 12 AND owner_id = ?i', $_SESSION['uid']);
|
||||
}
|
||||
|
||||
// Входим и выходим если можем.
|
||||
if (isset($_GET['goto'])) {
|
||||
if ($goto) {
|
||||
$imove = true;
|
||||
$d = db::c()->query('SELECT SUM(`weight`) AS `sum_weight` FROM `inventory` WHERE `owner` = ?i AND `on_sale` = 0', $user['id'])->fetch_assoc();
|
||||
$eff = db::c()->query('SELECT 1 FROM `users_effects` WHERE `owner_id` = ?i AND (`type` = 14 OR `type` = 13)', $user['id']);
|
||||
$d = db::c()->query('SELECT SUM(weight) AS sum_weight FROM inventory WHERE owner_id = ?i AND on_sale = 0', $user->id)->fetch_assoc();
|
||||
$eff = db::c()->query('SELECT 1 FROM `users_effects` WHERE `owner_id` = ?i AND (`type` = 14 OR `type` = 13)', $user->id);
|
||||
//(масса: <?= $getItemsBonuses->getItemsWeight() . '/' . $showUser->strength * 4
|
||||
|
||||
if ($d['sum_weight'] > $user['strength'] * 4 && $_GET['got']) {
|
||||
if ($d['sum_weight'] > $user->strength * 4 && $goto) {
|
||||
err('У вас переполнен рюкзак, вы не можете передвигаться...');
|
||||
$imove = false;
|
||||
}
|
||||
if ($eff->getNumRows() && $_GET['got']) {
|
||||
if ($eff->getNumRows() && $goto) {
|
||||
err('У вас тяжелая травма, вы не можете передвигатся...');
|
||||
$imove = false;
|
||||
}
|
||||
if ($_GET['goto'] == 'plo' && empty($user['zayavka']) && $imove === true) {
|
||||
db::c()->query('UPDATE `users`,`online` SET `users`.`room` = 20,`online`.`room` = 20 WHERE `online`.`id` = `users`.`id` AND `online`.`id` = ?i', $_SESSION['uid']);
|
||||
if ($goto == 'plo' && !$user->zayavka && $imove === true) {
|
||||
db::c()->query('UPDATE users, online SET users.room = 20, online.room = 20 WHERE online.user_id = users.id AND online.users_id = ?i', $_SESSION['uid']);
|
||||
header('Location: city.php');
|
||||
die("<i>Топ-топ-топ...</i>");
|
||||
exit("<i>Топ-топ-топ...</i>");
|
||||
} else {
|
||||
err('Подали заявку на бой и убегаете из клуба? Нехорошо...');
|
||||
}
|
||||
if ($_GET['goto'] == 'arena' && $user['room'] === 20 && $imove === true) {
|
||||
db::c()->query('UPDATE `users`, `online` SET `users`.`room` = 1, `online`.`room` = 1 WHERE `online`.`id` = `users`.`id` AND `online`.`id` = ?i', $_SESSION['uid']);
|
||||
if ($goto == 'arena' && $user->room === 20 && $imove === true) {
|
||||
db::c()->query('UPDATE users, online SET users.room = 1, online.room = 1 WHERE online.user_id = users.id AND online.user_id = ?i', $_SESSION['uid']);
|
||||
header('Location: main.php');
|
||||
die("<i>Топ-топ-топ...</i>");
|
||||
exit("<i>Топ-топ-топ...</i>");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,21 +332,6 @@ if (isset($_GET['use'])) {
|
||||
usemagic($_GET['use'], $_POST['target']);
|
||||
}
|
||||
|
||||
unset($_SESSION['stackall']);
|
||||
|
||||
if (isset($_GET["stack"])) {
|
||||
$_GET["stack"] = (int)$_GET["stack"];
|
||||
$rec = db::c()->query('SELECT `id` FROM `inventory` WHERE `id` = ?i AND `owner` = ?i AND `setsale` = 0', $_GET['stack'], $user['id'])->fetch_assoc();
|
||||
if (isset($rec['id'])) {
|
||||
stack($rec['id']);
|
||||
unset($rec);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['unstack'])) {
|
||||
unstack((int)$_GET['unstack'], (int)$_POST["qty"]);
|
||||
}
|
||||
|
||||
function setShadow($image)
|
||||
{
|
||||
global $user;
|
||||
@@ -397,67 +348,57 @@ function setShadow($image)
|
||||
}
|
||||
}
|
||||
|
||||
$obraz = filter_input(INPUT_GET, 'obraz');
|
||||
if ($obraz && ($user['shadow'] == 'g0.gif' || $user['shadow'] == 'man0.gif')) {
|
||||
if ($obraz && ($user->shadow == 'g0.gif' || $user->shadow == 'man0.gif')) {
|
||||
setShadow($obraz);
|
||||
}
|
||||
|
||||
if (isset($_GET['del']) && $_GET['del'] == 1 && $_GET['efid'] > 0) {
|
||||
$pl = db::c()->query('SELECT `id`, `type` FROM `users_effects` WHERE `owner_id` = ?i AND `id` = ?i', $user['id'], (int)$_GET['efid'])->fetch_assoc();
|
||||
if (isset($pl['id'])) {
|
||||
echo del_efs($pl['id'], $pl['type']);
|
||||
if ($del == 1 && $effectId > 0) {
|
||||
$pl = db::c()->query('SELECT type FROM users_effects WHERE owner_id = ?i AND effect_id = ?i', $user['id'], $effectId)->fetch_assoc();
|
||||
if (isset($pl['type'])) {
|
||||
echo del_efs($effectId, $pl['type']);
|
||||
} else {
|
||||
echo "<span class='error'>Эффект не найден!</span>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($_GET['modif_bron'])) {
|
||||
$brons = $_GET['modif_bron'];
|
||||
$ids = $_GET['ids'];
|
||||
if ($brons && $ids) {
|
||||
try {
|
||||
$cur = db::c()->query('SELECT free_bron, bron1, bron2, bron3, bron4 FROM inventory WHERE owner = ?i AND id = ?i', $user['id'], $ids)->fetch_assoc();
|
||||
} catch (\Krugozor\Database\Mysql\Exception $e) {
|
||||
echo "<div style='background-color: #ffaaaa;'>Ошибка: " . $e->getMessage() . "<br> В файле: " . $e->getFile() . " (" . $e->getLine() . ")</div>";
|
||||
}
|
||||
if ($cur['free_bron'] > 0 && $cur[$brons] > 0) {
|
||||
mysql_query("UPDATE `inventory` SET `free_bron` = (`free_bron`-1), `" . $brons . "` = (`" . $brons . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1");
|
||||
db::c()->query('UPDATE inventory SET free_bron = free_bron - 1, ?f = ?f +1 WHERE owner_id = ?i AND item_id = ?i', $brons, $brons, $user->id, $ids);
|
||||
echo "<span class='success'>Параметр брони увеличен!</span>";
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['modif_stat'])) {
|
||||
$stats = $_GET['modif_stat'];
|
||||
$ids = $_GET['ids'];
|
||||
$cur = mysql_fetch_assoc(mysql_query("SELECT `id`, `free_stat`, `gsila`, `glovk`, `ginta`, `gintel` FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"));
|
||||
if (isset($cur['id']) && $cur['free_stat'] > 0 && $cur[$stats] > 0) {
|
||||
mysql_query("UPDATE `inventory` SET `free_stat` = (`free_stat`-1), `" . $stats . "` = (`" . $stats . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1");
|
||||
if ($stats && $ids) {
|
||||
$cur = db::c()->query('SELECT free_stat, gsila, glovk, ginta, gintel FROM inventory WHERE owner_id = ?i AND item_id = ?i', $user->id, $ids);
|
||||
if ($cur['free_stat'] > 0 && $cur[$stats] > 0) {
|
||||
db::c()->query('UPDATE inventory SET free_stat = free_stat - 1, ?f = ?f +1 WHERE owner_id = ?i AND item_id = ?i', $stats, $stats, $user->id, $ids);
|
||||
echo "<span class='success'>Параметр увеличен!</span>";
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['modif_mf'])) {
|
||||
$mfs = $_GET['modif_mf'];
|
||||
$ids = $_GET['ids'];
|
||||
$cur = mysql_fetch_assoc(mysql_query("SELECT `id`, `free_mf`, `mfkrit`, `mfakrit`, `mfuvorot`, `mfauvorot` FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1"));
|
||||
if ($mfs && $ids) {
|
||||
$cur = db::c()->query('SELECT free_mf, mfkrit, mfuvorot, mfakrit, mfauvorot FROM inventory WHERE owner_id = ?i AND item_id = ?i', $user->id, $ids);
|
||||
if (isset($cur['id']) && $cur['free_mf'] > 0 && $cur[$mfs] > 0) {
|
||||
mysql_query("UPDATE `inventory` SET `free_mf` = (`free_mf`-1), `" . $mfs . "` = (`" . $mfs . "`+1) WHERE `owner` = '" . $user['id'] . "' AND `id` = '" . mysql_real_escape_string($ids) . "' LIMIT 1");
|
||||
db::c()->query('UPDATE inventory SET free_mf = free_mf - 1, ?f = ?f +1 WHERE owner_id = ?i AND item_id = ?i', $mfs, $mfs, $user->id, $ids);
|
||||
echo "<span class='success'>Параметр увеличен!</span>";
|
||||
}
|
||||
}
|
||||
|
||||
if (input::post('setshadow')) {
|
||||
if ($setShadow) {
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<link rel=stylesheet href="css/main.css">
|
||||
<link rel=stylesheet href="css/btn.css">
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="text-align: right;">
|
||||
<input type=button value="Вернуться" onClick="location.href='main.php?edit=<?= mt_rand() ?>';">
|
||||
<input type=button value="Вернуться" onClick="location.href='main.php?edit=<?= mt_rand() ?>';" class="button">
|
||||
</div>
|
||||
<table style="padding:5px; margin:auto;">
|
||||
<caption><b style="color: red;">Внимание! Образ персонажа выбирается только один раз.</b></caption>
|
||||
@@ -487,31 +428,35 @@ if (input::post('setshadow')) {
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
die();
|
||||
exit();
|
||||
}
|
||||
|
||||
if (isset($_GET['edit'])) {
|
||||
if ($edit) {
|
||||
$ups = $_GET['ups'] ?? null;
|
||||
$upm = $_GET['upm'] ?? null;
|
||||
$use = $_GET['use'] ?? null;
|
||||
$useTarget = $_POST['target'] ?? null;
|
||||
$drop = $_GET['drop'] ?? null;
|
||||
$dress = $_GET['dress'] ?? null;
|
||||
$undress = $_GET['undress'] ?? null;
|
||||
$destruct = $_GET['destruct'] ?? null;
|
||||
|
||||
if (input::get('ups')) {
|
||||
addOnePoint(input::get('ups'), 'stat');
|
||||
if ($ups) {
|
||||
addOnePoint($ups, 'stat');
|
||||
}
|
||||
|
||||
if (input::get('upm')) {
|
||||
addOnePoint(input::get('upm'), 'mastery');
|
||||
if ($upm) {
|
||||
addOnePoint($upm, 'mastery');
|
||||
}
|
||||
|
||||
if (isset($_GET['drop'])) {
|
||||
if ($drop) {
|
||||
$items = new DressedItems($_SESSION['uid']);
|
||||
$items->undressItem($_GET['drop']);
|
||||
$items->undressItem($drop);
|
||||
}
|
||||
|
||||
//Пока что одеваем предмет отсюда.
|
||||
if (isset($_GET['dress'])) {
|
||||
echo dressitem($_GET['dress']);
|
||||
if ($dress) {
|
||||
echo dressitem($dress);
|
||||
}
|
||||
|
||||
if (input::get('destruct')) {
|
||||
$q = db::c()->query('SELECT `id`, `dressed`, `name`, `duration`, `maxdur` FROM `inventory` WHERE `owner` = ?i AND `id` = ?i', $_SESSION['uid'], input::get('destruct'));
|
||||
if ($destruct) {
|
||||
$q = db::c()->query('SELECT `id`, `dressed`, `name`, `duration`, `maxdur` FROM `inventory` WHERE `owner` = ?i AND `id` = ?i', $_SESSION['uid'], $destruct);
|
||||
if ($q->getNumRows()) {
|
||||
$q = $q->fetch_assoc();
|
||||
if (empty($q['dressed'])) {
|
||||
@@ -525,27 +470,13 @@ if (isset($_GET['edit'])) {
|
||||
err('Ошибка: предмет не найден!');
|
||||
}
|
||||
}
|
||||
|
||||
if (input::get('use')) {
|
||||
$q = db::c()->query('SELECT `id`, `koll` FROM `inventory` WHERE `id` = ?i AND `owner` = ?i', input::get('use'), $_SESSION['uid']);
|
||||
if ($q->getNumRows()) {
|
||||
$q = $q->fetch_assoc();
|
||||
if ($q['koll'] > 1) {
|
||||
$id = unstack($q['id'], 1);
|
||||
usemagic($id, $_POST['target']);
|
||||
} else {
|
||||
usemagic($_GET['use'], $_POST['target']);
|
||||
}
|
||||
} else {
|
||||
err('Ошибка: предмет не найден!');
|
||||
}
|
||||
if ($use) {
|
||||
usemagic($use, $useTarget);
|
||||
}
|
||||
|
||||
if (input::get('undress')) {
|
||||
undressallself();
|
||||
if ($undress) {
|
||||
undressall($_SESSION['uid']);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!doctype html>
|
||||
@@ -566,29 +497,13 @@ if (isset($_GET['edit'])) {
|
||||
$(".tooltip").tipTip({maxWidth: "auto", edgeOffset: 0, fadeIn: 300, fadeOut: 500});
|
||||
});
|
||||
|
||||
function gotohref(filename) {
|
||||
location.href = filename;
|
||||
}
|
||||
|
||||
function saveComplect() {
|
||||
new miDialog({title: 'Сохранить комплект'}, {edit: 1}, function () {
|
||||
document.location = '/main.php?' + $.param(this.data);
|
||||
},
|
||||
$('<div>Название комплекта :<br /><div style="font-size: smaller;"><b>может содеражать только буквы (англ / русс) и цифры.</b></div></div>').append(miDialog._oneInput({name: 'savecomplect'})), {width: 250});
|
||||
}
|
||||
|
||||
let Hint3Name = '';
|
||||
|
||||
function okno(title, script, name, coma, errk) {
|
||||
function okno(title, script, name, errk) {
|
||||
let errkom = '';
|
||||
let com = '';
|
||||
if (errk === 1) {
|
||||
errkom = 'Нельзя использовать символы: /\:*?"<>|+%<br>';
|
||||
com = coma
|
||||
}
|
||||
if (errk === 2) {
|
||||
errkom = 'Такой комплект уже существует<br>';
|
||||
com = coma
|
||||
}
|
||||
document.getElementById("hint3").innerHTML = '<table width=100% cellspacing=1 cellpadding=0 bgcolor=CCC3AA><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: pointer" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' +
|
||||
'<form action="' + script + '" method=POST><table width=100% cellspacing=0 cellpadding=2 bgcolor=FFF6DD><tr><INPUT TYPE=hidden name=sd4 value="6"><td colspan=2><span class="error">' +
|
||||
@@ -599,71 +514,17 @@ if (isset($_GET['edit'])) {
|
||||
document.getElementById(name).focus();
|
||||
Hint3Name = name;
|
||||
}
|
||||
|
||||
const delay = 30;
|
||||
let TimerOn = -1, tkHP, maxHP, speed = 750;
|
||||
const stLen = 185, redHP = 0.33, yellowHP = 0.66;
|
||||
|
||||
function setHPlocal() {
|
||||
tkHP > maxHP && (tkHP = maxHP);
|
||||
let a = Math.round(tkHP) + "/" + maxHP;
|
||||
a = stLen - (a.length + 2) * 7;
|
||||
const b = Math.round((a - 1) / maxHP * tkHP);
|
||||
a -= b;
|
||||
const HP = document.getElementById("hp_value");
|
||||
const HP1 = document.getElementById("HP1");
|
||||
const HP2 = document.getElementById("HP2");
|
||||
if (HP) {
|
||||
HP1.width = b, HP2.width = a, HP1.src = tkHP / maxHP < redHP ? "i/1red.gif" : tkHP / maxHP < yellowHP ? "i/1yellow.gif" : "i/1green.gif", HP.innerHTML = Math.round(tkHP) + "/" + maxHP;
|
||||
}
|
||||
tkHP += maxHP / 53 / 230 * (speed / 100);
|
||||
TimerOn = tkHP < maxHP ? setTimeout("setHPlocal()", delay * 100) : -1
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$('a').live('click', function () {
|
||||
if ($(this).attr('ajax') !== undefined) {
|
||||
const ajaxModule = $(this).attr('ajax');
|
||||
|
||||
switch (ajaxModule) {
|
||||
case'mZeInventory':
|
||||
$('#mZeInventory').html('<div align="center" style="padding:10px;background-color:#d4d2d2;color:grey;"><b>Загрузка...</b></div>');
|
||||
$.ajax({
|
||||
url: $(this).attr('href') + '&mZeAjax=' + ajaxModule,
|
||||
cache: false,
|
||||
dataType: 'html',
|
||||
success: function (html) {
|
||||
$('#mZeInventory').html(html);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<title>Окно игры</title>
|
||||
</HEAD>
|
||||
<body>
|
||||
<?php
|
||||
try {
|
||||
$online = db::c()->query('SELECT 1 FROM `online` WHERE `real_time` >= ?i', (time() - 60));
|
||||
} catch (Exception $e) {
|
||||
echo '<div class="debug">В таблице online нет ячейки real_time так как неясно что она делает. Ошибка обращения в базу.</div>';
|
||||
}
|
||||
?>
|
||||
<div id=hint3 class=ahint></div>
|
||||
<div id="hint4" style="position: absolute;"></div>
|
||||
<div id="chpassbank" style="display:none; position:absolute; top:50px; left:250px;"></div>
|
||||
<table width=100%>
|
||||
<TR>
|
||||
<td style="vertical-align: top; width: 350px">
|
||||
<?php
|
||||
$showUser = new User($_SESSION['uid']);
|
||||
$getItemsBonuses = new DressedItems($_SESSION['uid']);
|
||||
$showUser->showUserDoll(0, 1);
|
||||
?> <!-- Первый столбец -->
|
||||
<?php $showUser->showUserDoll(0, 1); ?> <!-- Первый столбец -->
|
||||
<div align="center">
|
||||
<a href='main.php?edit=1&undress=all'>Снять все</a><BR>
|
||||
<div class="effectList" style="padding-top: 15px; max-height: 150px; width: 220px;">
|
||||
@@ -676,16 +537,15 @@ try {
|
||||
<div>
|
||||
<br>Уровень: <strong><?= $showUser->level ?></strong>
|
||||
<br>Опыт: <strong><?= $showUser->experience ?></strong>
|
||||
<br>Побед: <strong><?= 'нет поля' ?></strong>
|
||||
<br>Поражений: <strong><?= 'нет поля' ?></strong>
|
||||
<br>Ничьих: <strong><?= 'нет поля' ?></strong>
|
||||
<br>Побед: <strong>??</strong>
|
||||
<br>Поражений: <strong>??</strong>
|
||||
<br>Ничьих: <strong>??</strong>
|
||||
<br>Деньги: <strong><?= $showUser->money ?></strong> кр.
|
||||
<HR>
|
||||
</div>
|
||||
<!--Параметры-->
|
||||
<div>
|
||||
<div class="container">
|
||||
|
||||
Сила: <?= ($showUser->free_stat_points ? $showUser->getStrength(1) . '(' . strval($showUser->strength + $getItemsBonuses->getStrengthBonus()) . ')' : $showUser->strength + $getItemsBonuses->getStrengthBonus()) ?>
|
||||
<br>
|
||||
Ловкость: <?= ($showUser->free_stat_points ? $showUser->getDexterity(1) . '(' . strval($showUser->dexterity + $getItemsBonuses->getDexterityBonus()) . ')' : $showUser->dexterity + $getItemsBonuses->getDexterityBonus()) ?>
|
||||
@@ -711,18 +571,15 @@ try {
|
||||
Урон: <?= $showUser->minDamage + $getItemsBonuses->getMinPhysDamage() ?>
|
||||
- <?= $showUser->maxDamage + $getItemsBonuses->getMaxPhysDamage() ?> <br>
|
||||
<br>
|
||||
<div style="color: gray;">
|
||||
Защита от огня: ?? <br>
|
||||
Защита от воды: ?? <br>
|
||||
Защита от вохдуха: ?? <br>
|
||||
Защита от земли: ?? <br>
|
||||
Защита от яда: ?? <br>
|
||||
</div>
|
||||
Защита от огня: ?? <br>
|
||||
Защита от воды: ?? <br>
|
||||
Защита от вохдуха: ?? <br>
|
||||
Защита от земли: ?? <br>
|
||||
Защита от яда: ?? <br>
|
||||
Броня головы: <?= $showUser->headArmor ?> <br>
|
||||
Броня корпуса: <?= $showUser->chestArmor ?> <br>
|
||||
Броня ног: <?= $showUser->legArmor ?> <br>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td valign=top>
|
||||
@@ -733,37 +590,28 @@ try {
|
||||
title="Образы">
|
||||
<?php endif; ?>
|
||||
<div class="button-group">
|
||||
<button class="button primary" onclick="gotohref('zayavka.php')">Поединки</button>
|
||||
<button class="button" onclick="gotohref('module_quest.php')">Активные задания</button>
|
||||
<button class="button" onclick="gotohref('main.php?edit=1')">Инвентарь</button>
|
||||
<?php if ($user['room'] === 20): ?>
|
||||
<button class="button icon move" onclick="gotohref('main.php?goto=arena')">Войти внутрь
|
||||
<button class="button primary" onclick="window.location.href='zayavka.php';">Поединки</button>
|
||||
<button class="button" onclick="window.location.href='module_quest.php';">Активные задания
|
||||
</button>
|
||||
<?php if ($user->room === 20): ?>
|
||||
<button class="button icon move" onclick="window.location.href='main.php?goto=arena';">Войти
|
||||
внутрь
|
||||
</button>
|
||||
<?php else: ?>
|
||||
<button class="button icon move" onclick="gotohref('main.php?goto=plo')">Выйти на улицу
|
||||
<button class="button icon move" onclick="window.location.href='main.php?goto=plo';">Выйти
|
||||
на улицу
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
<button class="button icon loop" onclick="gotohref('main.php')">Обновить страницу</button>
|
||||
<button class="button icon loop" onclick="window.location.href='main.php';">Обновить страницу
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="mZeInventory"> <!--рюкзак-->
|
||||
<div> <!--рюкзак-->
|
||||
<table BORDER=0 WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#A5A5A5">
|
||||
<caption>Рюкзак
|
||||
(масса: <?= '?? /' . $showUser->strength * 4 ?>)
|
||||
</caption>
|
||||
<?php
|
||||
$data_query = 'SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot = 0 AND on_sale = 0';
|
||||
$data = db::c()->query($data_query, $_SESSION['uid']);
|
||||
|
||||
$groupNum = [];
|
||||
$viewInventory = [];
|
||||
$getItems = [];
|
||||
$row = [];
|
||||
$iteminfo = [];
|
||||
while ($row = $data->fetch_assoc()) {
|
||||
$iteminfo[] = new InventoryItem($row);
|
||||
}
|
||||
|
||||
foreach ($iteminfo as $ii) {
|
||||
echo "<tr><td width='100' align='center' bgcolor='#d3d3d3'>";
|
||||
$ii->printImage();
|
||||
@@ -771,17 +619,6 @@ try {
|
||||
echo "<td valign='top' bgcolor='#d3d3d3'>";
|
||||
$ii->printInfo();
|
||||
}
|
||||
|
||||
if ($viewInventory && $getItems) {
|
||||
foreach ($viewInventory as $viewCategiryes) {
|
||||
echo $viewCategiryes['header'];
|
||||
foreach ($viewCategiryes['ids'] as $viewItem) {
|
||||
echo $getItems[$viewItem];
|
||||
}
|
||||
echo $viewCategiryes['fooder'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($data->getNumRows() == 0) {
|
||||
echo "<tr><th colspan='3' align=center bgcolor=#C7C7C7>Пусто";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user