Compare commits

...

14 Commits

Author SHA1 Message Date
5a60b25b04 Merge pull request 'new-travel' (#11) from new-travel into master
Reviewed-on: https://src.lopar.us/lopar/battles/pulls/11
2020-10-27 19:08:18 +00:00
e0a7e4b836 Merge branch 'master' into new-travel 2020-10-27 19:08:02 +00:00
lopar
0f7d245791 Имена локаций из переменных. 2020-10-27 20:34:16 +02:00
lopar
650c504a18 Вход\выход в сам клуб заработал. 2020-10-27 20:14:07 +02:00
lopar
1e58e8a99c Похоронил валютный магазин, который стоит заводить в самую последнюю очередь. 2020-10-27 19:16:20 +02:00
lopar
f668e9c122 Поправил кнопку выхода и, внезапно, полфайла. 2020-10-27 18:53:35 +02:00
lopar
f8234dd407 Какие-то спонтанные фиксы. 2020-10-27 18:53:00 +02:00
lopar
9a7c947ef7 Успешный выход из большего количества зданий. 2020-10-27 18:51:55 +02:00
lopar
8afc50f6fc Отображение всех дефолтных картинок на улицах. 2020-10-27 02:36:29 +02:00
lopar
c937f7a0ba Больше нельзя телепортироваться в поединки. 2020-10-27 01:43:54 +02:00
lopar
5ec1219b04 Теперь и по ЦП можно гулять. 2020-10-27 01:18:02 +02:00
lopar
f4fb3b11a8 Заработали кнопки в окне персонажа. Строгая типизация всё ломает. О_о 2020-10-27 01:07:27 +02:00
lopar
4b569ab765 Теперь нельзя телепортироваться на улицы откуда угодно. 2020-10-27 00:21:00 +02:00
lopar
e619669ba3 Снова можем гулять по городу. Проверки разрешения на перемещение и отображение города разбросаны по классам. 2020-10-27 00:13:07 +02:00
15 changed files with 573 additions and 636 deletions

View File

@ -240,7 +240,6 @@ Template::header('ᐰdminка');
<option value="0" selected disabled>Тип магазина</option> <option value="0" selected disabled>Тип магазина</option>
<option value="1">Обычный</option> <option value="1">Обычный</option>
<option value="2">Цветной</option> <option value="2">Цветной</option>
<option value="3">Артефактный</option>
</select></td> </select></td>
</tr> </tr>
@ -409,11 +408,6 @@ if ($_POST['name']) {
// echo "Предмет не был добавлен!" . mysql_error(); // echo "Предмет не был добавлен!" . mysql_error();
// }; // };
// //
// if ($_POST['shop'] == 3) if (mysql_query("INSERT INTO ashop(name,duration,maxdur,cost,ecost,nlevel,nsila,nlovk,ninta,nvinos,nintel,nmudra,nnoj,ntopor,ndubina,nmech,nalign,minu,maxu,goden,gsila,glovk,ginta,gintel,ghp,mfkrit,mfakrit,mfuvorot,mfauvorot,gnoj,gtopor,gdubina,gmech,img,count,bron1,bron2,bron3,bron4,magic,type,massa,needident,nfire,nwater,nair,nearth,nlight,ngray,ndark,gfire,gwater,gair,gearth,glight,ggray,gdark,encicl,artefact,letter,isrep,razdel) VALUES ('" . $_POST['name'] . "','" . $_POST['duration'] . "','" . $_POST['maxdur'] . "','" . $_POST['cost'] . "','" . $_POST['ecost'] . "','" . $_POST['nlevel'] . "','" . $_POST['nsila'] . "','" . $_POST['nlovk'] . "','" . $_POST['ninta'] . "','" . $_POST['nvinos'] . "','" . $_POST['nintel'] . "','" . $_POST['nmudra'] . "','" . $_POST['nnoj'] . "','" . $_POST['ntopor'] . "','" . $_POST['ndubina'] . "','" . $_POST['nmech'] . "','" . $_POST['nalign'] . "','" . $_POST['minu'] . "','" . $_POST['maxu'] . "','" . $goden_tmp . "','" . $_POST['gsila'] . "','" . $_POST['glovk'] . "','" . $_POST['ginta'] . "','" . $_POST['gintel'] . "','" . $_POST['ghp'] . "','" . $_POST['mfkrit'] . "','" . $_POST['mfakrit'] . "','" . $_POST['mfuvorot'] . "','" . $_POST['mfauvorot'] . "','" . $_POST['gnoj'] . "','" . $_POST['gtopor'] . "','" . $_POST['gdubina'] . "','" . $_POST['gmech'] . "','" . $_POST['img'] . "','" . $_POST['count'] . "','" . $_POST['bron1'] . "','" . $_POST['bron2'] . "','" . $_POST['bron3'] . "','" . $_POST['bron4'] . "','" . $_POST['magic'] . "','" . $_POST['type'] . "','" . $_POST['massa'] . "','" . $_POST['needident'] . "','" . $_POST['nfire'] . "','" . $_POST['nwater'] . "','" . $_POST['nair'] . "','" . $_POST['nearth'] . "','" . $_POST['nlight'] . "','" . $_POST['ngray'] . "','" . $_POST['ndark'] . "','" . $_POST['gfire'] . "','" . $_POST['gwater'] . "','" . $_POST['gair'] . "','" . $_POST['gearth'] . "','" . $_POST['glight'] . "','" . $_POST['ggray'] . "','" . $_POST['gdark'] . "','" . $_POST['encicl'] . "','1','" . $_POST['letter'] . "','" . $_POST['isrep'] . "','" . $_POST['razdel'] . "');")) {
// echo "Предмет успешно добавлен";
// } else {
// echo "Предмет не был добавлен!" . mysql_error();
// };
} }
//End item adder //End item adder

200
ashop.php
View File

@ -1,200 +0,0 @@
<?php
session_start();
if (empty($_SESSION['uid'])) {
header("Location: index.php");
exit;
}
require_once 'functions.php';
if ($user->room != 50) {
header("Location: main.php");
exit;
}
if ($user->battle) {
header('location: fbattle.php');
exit;
}
$bank = db::c()->query('SELECT `ekr` FROM `bank` WHERE `id`=?i', $_SESSION['uid'])->fetch_assoc();
$shopItems = db::c()->query('SELECT `ashop`.*,
`magic`.`name` AS `magic_name`,
`magic`.`chanse` AS `magic_chanse`,
`magic`.`time` AS `magic_time`,
`magic`.`file` AS `magic_file`,
`magic`.`targeted` AS `magic_targeted`,
`magic`.`needcharge` AS `magic_needcharge`,
`magic`.`img` AS `magic_img`
FROM `ashop` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `count` > 0 AND `ecost` > 0 AND `razdel` = ?i ORDER by `nlevel` ASC, `id` ASC', $_GET['otdel']);
$iteminfo = [];
while ($row = $shopItems->fetch_assoc()) {
$iteminfo[] = new ShopItem($row);
}
if (!empty($_GET['buy'])) {
$dress = db::c()->query('SELECT * FROM `ashop` WHERE `id`=?i', $_GET['buy'])->fetch_assoc();
$itemWeight = db::c()->query('SELECT sum(`massa`) AS `m` FROM `inventory` WHERE `owner` = ?i AND `setsale` = 0', $user['id'])->fetch_assoc();
if (($dress['massa'] + $itemWeight['m']) > (get_meshok())) {
$status = 'Недостаточно места в рюкзаке.';
} elseif ($bank['ekr'] >= $dress['ecost'] && ($dress['count'] > 0 || $dress['count'] == -1)) {
$goden = '';
if (isset($dress['goden'])) {
$goden = $dress['goden'] * 24 * 60 * 60 + time(); // Ну вот нахуя?}
db::c()->query('
INSERT INTO `inventory`
(
`prototype`,`owner`,`name`,`type`,`massa`,`cost`,`img`,`maxdur`,`isrep`,`gsila`,`glovk`,`ginta`,`gintel`,
`ghp`,`gnoj`,`gtopor`,`gdubina`,`gmech`,`gfire`,`gwater`,`gair`,`gearth`,`glight`,`ggray`,`gdark`,
`needident`,`nsila`,`nlovk`,`ninta`,`nintel`,`nmudra`,`nvinos`,`nnoj`,`ntopor`,`ndubina`,`nmech`,
`nfire`,`nwater`,`nair`,`nearth`,`nlight`,`ngray`,`ndark`,`mfkrit`,`mfakrit`,`mfuvorot`,`mfauvorot`,
`bron1`,`bron2`,`bron3`,`bron4`,`maxu`,`minu`,`magic`,`nlevel`,`nalign`,`dategoden`,`goden`,`otdel`,
`artefact`, `koll`
)
VALUES (?i,?i,"?s",?i,?i,"?s","?s",?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i,?i)
', $dress['id'], $_SESSION['uid'], $dress['name'], $dress['type'], $dress['massa'], $dress['cost'], $dress['img'], $dress['maxdur'], $dress['isrep'],
$dress['gsila'], $dress['glovk'], $dress['ginta'], $dress['gintel'], $dress['ghp'], $dress['gnoj'], $dress['gtopor'], $dress['gdubina'], $dress['gmech'],
$dress['gfire'], $dress['gwater'], $dress['gair'], $dress['gearth'], $dress['glight'], $dress['ggray'], $dress['gdark'], $dress['needident'],
$dress['nsila'], $dress['nlovk'], $dress['ninta'], $dress['nintel'], $dress['nmudra'], $dress['nvinos'], $dress['nnoj'], $dress['ntopor'], $dress['ndubina'], $dress['nmech'],
$dress['nfire'], $dress['nwater'], $dress['nair'], $dress['nearth'], $dress['nlight'], $dress['ngray'], $dress['ndark'], $dress['mfkrit'], $dress['mfakrit'],
$dress['mfuvorot'], $dress['mfauvorot'], $dress['bron1'], $dress['bron3'], $dress['bron2'], $dress['bron4'], $dress['maxu'], $dress['minu'], $dress['magic'],
$dress['nlevel'], $dress['nalign'], $goden, $dress['goden'], $dress['razdel'], $dress['artefact'], $dress['koll']);
$inventoryItemId = db::c()->getLastInsertId();
if ($dress['count'] != -1) {
db::c()->query('UPDATE `ashop` SET `count` = `count`- 1 WHERE `id` = ?i', $_GET['buy']);
}
$deloText = "{$user['login']} купил товар «{$dress['name']}» id:({$inventoryItemId}) в магазине «Берёзка» за {$dress['ecost']} екр.";
addToDelo($deloText);
$status = "Вы купили «{$dress['name']}» за {$dress['ecost']} екр.";
db::c()->query('UPDATE `bank` SET `ekr` = `ekr` - ?i WHERE `id` = ?i', $dress['ecost'], $_SESSION['uid']);
// Для обновления данных о деньгах на странице
$bank['ekr'] -= $dress['ecost'];
} else {
$status = "Недостаточно денег или нет вещей в наличии.";
}
}
$shopCategory = '';
$shopCategoryTypeNumber = empty($_GET['otdel']) ?: $_GET['otdel'];
switch ($shopCategoryTypeNumber) {
default:
$shopCategory = "Прихожая";
break;
case 1:
$shopCategory = "Кастеты и ножи";
break;
case 11:
$shopCategory = "Топоры";
break;
case 12:
$shopCategory = "Дубины и булавы";
break;
case 13:
$shopCategory = "Мечи";
break;
case 14:
$shopCategory = "Луки и арбалеты";
break;
case 2:
$shopCategory = "Сапоги";
break;
case 21:
$shopCategory = "Перчатки";
break;
case 22:
$shopCategory = "Легкая броня";
break;
case 23:
$shopCategory = "Тяжелая броня";
break;
case 24:
$shopCategory = "Шлемы";
break;
case 3:
$shopCategory = "Щиты";
break;
case 4:
$shopCategory = "Серьги";
break;
case 41:
$shopCategory = "Ожерелья";
break;
case 42:
$shopCategory = "Кольца";
break;
case 5:
$shopCategory = "Заклинания: нейтральные";
break;
case 51:
$shopCategory = "Заклинания: боевые и защитные";
break;
case 6:
$shopCategory = "Амуниция";
break;
case 7:
$shopCategory = "Букеты";
break;
}
Template::header('Берёзка');
?>
<script src="js/main.js"></script>
<h1>Магазин Берёзка</h1>
<a href=# onclick=hrefToFrame('city.php?cp')> ← выйти на Центральную площадь</a>
<div><?= $status ?></div>
<table border=0 width=100% cellspacing="0" cellpadding="4">
<tr>
<td valign=top align=left>
<h3><?= $shopCategory ?></h3>
<!--Магазин-->
<table class="zebra" width=100% cellspacing="1" cellpadding="2">
<?php foreach ($iteminfo as $ii): ?>
<tr>
<td style='width: 150px; text-align: center;'>
<?php $ii->printImage();
$ii->printControls('ashop'); ?>
</td>
<td style='vertical-align: top;'>
<?php $ii->printInfo(); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
</td>
<td valign=top width=280>
<b>Масса всех ваших вещей: <?= getItemsMassaInfo() ?>
<br>У вас в наличии: <span style="color: #339900;"><?= $bank['ekr'] ?></span> екр.</b>
<hr>
<div style="text-align: center; font-weight: bold;">Отделы магазина</div>
<dl>
<dt><b>Оружие:</b></dt>
<dd><a href="?otdel=1&rnd=<?= mt_rand() ?>">кинжалы</a></dd>
<dd><a href="?otdel=11&rnd=<?= mt_rand() ?>">топоры</a></dd>
<dd><a href="?otdel=12&rnd=<?= mt_rand() ?>">дубины</a></dd>
<dd><a href="?otdel=13&rnd=<?= mt_rand() ?>">мечи</a></dd>
<dt><b>Одежда:</b></dt>
<dd><a href="?otdel=24&rnd=<?= mt_rand() ?>">шлемы</a></dd>
<dd><a href="?otdel=23&rnd=<?= mt_rand() ?>">тяжелая броня</a></dd>
<dd><a href="?otdel=22&rnd=<?= mt_rand() ?>">легкая броня</a></dd>
<dd><a href="?otdel=3&rnd=<?= mt_rand() ?>">щиты</a></dd>
<dd><a href="?otdel=21&rnd=<?= mt_rand() ?>">перчатки</a></dd>
<dd><a href="?otdel=2&rnd=<?= mt_rand() ?>">сапоги</a></dd>
<dt><b>Ювелирные товары:</b></dt>
<dd><a href="?otdel=4&rnd=<?= mt_rand() ?>">серьги</a></dd>
<dd><a href="?otdel=41&rnd=<?= mt_rand() ?>">ожерелья</a></dd>
<dd><a href="?otdel=42&rnd=<?= mt_rand() ?>">кольца</a></dd>
<dt><b>Магия:</b></dt>
<dd><a href="?otdel=51&rnd=<?= mt_rand() ?>">боевые</a></dd>
<dd><a href="?otdel=5&rnd=<?= mt_rand() ?>">разные</a></dd>
<dt><b>Разное:</b></dt>
<dd><a href="?otdel=6&rnd=<?= mt_rand() ?>">амуниция</a></dd>
<dd><a href="?otdel=7&rnd=<?= mt_rand() ?>">букеты</a></dd>
</dl>
</td>
</tr>
</table>
<?php } ?>

View File

@ -30,28 +30,28 @@ switch ($location[0]) {
default: default:
break; break;
case 'cp': case 'cp':
Travel::toRoom(20); Travel::toRoom(20,$user->room);
break; break;
case 'strah': case 'strah':
Travel::toRoom(21); Travel::toRoom(21,$user->room);
break; break;
case 'bps': case 'bps':
Travel::toRoom(26); Travel::toRoom(26,$user->room);
break; break;
case 'ps': case 'ps':
Travel::toRoom(51); Travel::toRoom(51,$user->room);
break; break;
case 'zaliv': case 'zaliv':
Travel::toRoom(2111); Travel::toRoom(2111,$user->room);
break; break;
case 'zamk': case 'zamk':
Travel::toRoom(2601); Travel::toRoom(2601,$user->room);
break; break;
case 'abog': case 'abog':
Travel::toRoom(2655); Travel::toRoom(2655,$user->room);
break; break;
case 'torg': case 'torg':
Travel::toRoom(2702); Travel::toRoom(2702,$user->room);
break; break;
case 'got': case 'got':
if ($user->room == 20) { if ($user->room == 20) {
@ -59,35 +59,34 @@ switch ($location[0]) {
default: default:
break; break;
case 'level1': case 'level1':
header('location: main.php?goto=arena'); Travel::toRoom(1,$user->room);
exit;
break; break;
case 'level7': case 'level7':
Travel::toRoom(21); Travel::toRoom(21,$user->room);
break; break;
case 'level8': case 'level8':
Travel::toRoom(26); Travel::toRoom(26,$user->room);
break; break;
case 'level13': case 'level13':
header('location: quest_room.php'); header('location: quest_room.php');
break; break;
case 'level222': case 'level222':
Travel::toRoom(2702); Travel::toRoom(2702,$user->room);
break; break;
case 'level17': case 'level17':
Travel::toRoom(50, 'ashop.php'); Travel::toRoom(50,$user->room);
break; break;
case 'level2': case 'level2':
Travel::toRoom(22, 'shop.php'); Travel::toRoom(22,$user->room);
break; break;
case 'level4': case 'level4':
Travel::toRoom(23, 'repair.php'); Travel::toRoom(23,$user->room);
break; break;
case 'level6': case 'level6':
Travel::toRoom(27, 'post.php'); Travel::toRoom(27,$user->room);
break; break;
case 'level3': case 'level3':
Travel::toRoom(25, 'comission.php'); Travel::toRoom(25,$user->room);
break; break;
} }
} elseif ($user->room == 21) { } elseif ($user->room == 21) {
@ -95,25 +94,25 @@ switch ($location[0]) {
default: default:
break; break;
case 'level4': case 'level4':
Travel::toRoom(20); Travel::toRoom(20,$user->room);
break; break;
case 'level3': case 'level3':
Travel::toRoom(2111); Travel::toRoom(2111,$user->room);
break; break;
case 'level13': case 'level13':
Travel::toRoom(34, 'fshop.php'); Travel::toRoom(34,$user->room);
break; break;
case 'level5': case 'level5':
Travel::toRoom(29, 'bank.php'); Travel::toRoom(29,$user->room);
break; break;
case 'level16': case 'level16':
Travel::toRoom(31, 'tower.php'); Travel::toRoom(31,$user->room);
break; break;
case 'level14': case 'level14':
Travel::toRoom(30, 'clan_create.php'); Travel::toRoom(30,$user->room);
break; break;
case 'level650': case 'level650':
Travel::toRoom(650, 'ul_clans.php'); Travel::toRoom(650,$user->room);
break; break;
} }
} elseif ($user->room == 2111) { } elseif ($user->room == 2111) {
@ -121,19 +120,17 @@ switch ($location[0]) {
default: default:
break; break;
case 'level1': case 'level1':
Travel::toRoom(21); Travel::toRoom(21,$user->room);
break;
case 'level2':
header('location: city.php?haos');
break; break;
case 'level203': case 'level203':
Travel::toRoom(1055, 'group_arena.php'); Travel::toRoom(1055,$user->room);
break; break;
case 'level1000': case 'level1000':
Travel::toRoom(620, 'enter_cave.php'); Travel::toRoom(620,$user->room);
break; break;
case 'room666': case 'room666':
Travel::toRoom(666, 'jail.php'); //Нет на карте
//Travel::toRoom(666,$user->room);
break; break;
} }
} elseif ($user->room == 2601) { } elseif ($user->room == 2601) {
@ -141,19 +138,19 @@ switch ($location[0]) {
default: default:
break; break;
case 'level4': case 'level4':
Travel::toRoom(26); Travel::toRoom(26,$user->room);
break; break;
case 'level55': case 'level55':
Travel::toRoom(2655); Travel::toRoom(2655,$user->room);
break; break;
case 'level1': case 'level1':
Travel::toRoom(37, 'gotzamok.php'); Travel::toRoom(37,$user->room);
break; break;
case 'level1051': case 'level1051':
Travel::toRoom(1051, 'lab_enter.php'); Travel::toRoom(1051,$user->room);
break; break;
case 'level5': case 'level5':
Travel::toRoom(404, 'vxod.php'); Travel::toRoom(404,$user->room);
break; break;
} }
} elseif ($user->room == 2701) { } elseif ($user->room == 2701) {
@ -161,10 +158,10 @@ switch ($location[0]) {
default: default:
break; break;
case 'level1': case 'level1':
Travel::toRoom(2111); Travel::toRoom(2111,$user->room);
break; break;
case 'level2': case 'level2':
Travel::toRoom(402, 'lab_chaos_enter.php'); Travel::toRoom(402,$user->room);
break; break;
} }
} elseif ($user->room == 2702) { } elseif ($user->room == 2702) {
@ -172,10 +169,10 @@ switch ($location[0]) {
default: default:
break; break;
case 'level10': case 'level10':
Travel::toRoom(20); Travel::toRoom(20,$user->room);
break; break;
case 'level6': case 'level6':
Travel::toRoom(61, 'akadem.php'); Travel::toRoom(61,$user->room);
break; break;
} }
} elseif ($user->room == 2655) { } elseif ($user->room == 2655) {
@ -183,10 +180,10 @@ switch ($location[0]) {
default: default:
break; break;
case 'level10': case 'level10':
Travel::toRoom(2601); Travel::toRoom(2601,$user->room);
break; break;
case 'level2055': case 'level2055':
Travel::toRoom(603, 'aren_of_angels.php'); Travel::toRoom(603,$user->room);
break; break;
} }
} elseif ($user->room == 26) { } elseif ($user->room == 26) {
@ -194,19 +191,19 @@ switch ($location[0]) {
default: default:
break; break;
case 'level4': case 'level4':
Travel::toRoom(20); Travel::toRoom(20,$user->room);
break; break;
case 'level3': case 'level3':
Travel::toRoom(2601); Travel::toRoom(2601,$user->room);
break; break;
case 'level660': case 'level660':
Travel::toRoom(660, 'hostel.php'); Travel::toRoom(660,$user->room);
break; break;
case 'level7': case 'level7':
Travel::toRoom(777, 'obshaga.php'); Travel::toRoom(777,$user->room);
break; break;
case 'level56': case 'level56':
Travel::toRoom(401, 'hell.php'); Travel::toRoom(401,$user->room);
break; break;
} }
} }

View File

@ -18,22 +18,22 @@ if ($klanName && $klanAbbr && $klanDescr) {
$eff = db::c()->query('SELECT 1 FROM `effects` WHERE `owner` = ?i AND `type` = 20', $user->id); $eff = db::c()->query('SELECT 1 FROM `effects` WHERE `owner` = ?i AND `type` = 20', $user->id);
$name_check = db::c()->query('SELECT 1 FROM `clans` WHERE `name` = "?s" OR `short` = "?s"', 111, 333); $name_check = db::c()->query('SELECT 1 FROM `clans` WHERE `name` = "?s" OR `short` = "?s"', 111, 333);
$errorMessage = ''; $errorMessage = [];
if ($user->align) { if ($user->align) {
$errorMessage .= 'Вы уже имеете направленность!. <BR>'; $errorMessage[0] = 'Вы уже имеете направленность!. <BR>';
} }
if ($user->clan) { if ($user->clan) {
$errorMessage .= 'Вы уже состоите в клане!. <BR>'; $errorMessage[1] = 'Вы уже состоите в клане!. <BR>';
} }
if (Config::$clan_register_cost >= $user->money) { if (Config::$clan_register_cost >= $user->money) {
$errorMessage .= 'Не хватает денег на регистрацию клана. <BR>'; $errorMessage[2] = 'Не хватает денег на регистрацию клана. <BR>';
} }
if (!$eff) { if (!$eff) {
$errorMessage .= 'Нет проверки. <BR>'; $errorMessage[3] = 'Нет проверки. <BR>';
} }
if (!$name_check) { if (!$name_check) {
$errorMessage .= 'Клан с такими данными уже существует.<br>'; $errorMessage[4] = 'Клан с такими данными уже существует.<br>';
} }
if (!$errorMessage && !Config::$clan_register_lock) { if (!$errorMessage && !Config::$clan_register_lock) {
@ -44,7 +44,9 @@ if ($klanName && $klanAbbr && $klanDescr) {
echo 'Заявка на регистрацию клана подана.'; echo 'Заявка на регистрацию клана подана.';
err('Проверки пройдены, но клан регистрировать пока нельзя!'); err('Проверки пройдены, но клан регистрировать пока нельзя!');
} else { } else {
err($errorMessage); foreach ($errorMessage as $error) {
echo sprintf('<span class="error">%s</span>', $error);
}
} }
} }
Template::header('Регистратура кланов'); Template::header('Регистратура кланов');
@ -58,9 +60,16 @@ Template::header('Регистратура кланов');
<a href=# onclick=leave()> ← выйти из регистратуры</a> <a href=# onclick=leave()> ← выйти из регистратуры</a>
<?php <?php
if ($user->admin) { if ($user->admin) {
$clanreg = db::c()->query('SELECT `date`,`name`,`abbr`,`owner`,`descr` FROM `reg_klan`'); $clanreg = [];
$clanPremoderationList = []
//$clanPremoderationList = db::c()->query('SELECT * FROM clans WHERE approved = 0');
foreach ($clanPremoderationList->fetch_object() as $clan) {
echo sprintf('<div>%s %s <br> %s</div>', $clan->date, $clan->name, $clan->owner);
}
//$clanreg = db::c()->query('SELECT `date`,`name`,`abbr`,`owner`,`descr` FROM `reg_klan`')->fetch_assoc();
echo '<table>'; echo '<table>';
while ($clanreg_row = $clanreg->fetch_assoc()) { while ($clanreg_row = $clanreg) {
echo "<TR> echo "<TR>
<TD>", $clanreg_row['date'], "</TD> <TD>", $clanreg_row['date'], "</TD>
<TD>", $clanreg_row['name'], "</TD> <TD>", $clanreg_row['name'], "</TD>

View File

@ -1,65 +1,62 @@
<?php <?php
# Date: 26.10.2020 (17:56) # Date: 26.10.2020 (17:56)
// todo: #10
class City class City
{ {
use Rooms;
public static function showStreet(int $id) public static function showStreet(int $id)
{ {
if ($id === 20) { if ($id === 20) {
echo '<div style="position:relative; display: inline-block;" id="ione"><img alt="background" src="/i/city/spring_cap_cp_day.jpg">' . echo '<div style="position:relative; display: inline-block;" id="ione"><img alt="background" src="/i/city/spring_cap_cp_day.jpg">' .
self::showBuilding(1, "spring_cap_club", 30, 235, "Бойцовский Клуб") . self::showBuilding(1, "spring_cap_club", 30, 235, self::$roomNames[1]) .
self::showBuilding(2, "spring_cap_shop", 202, 171, "Магазин") . self::showBuilding(2, "spring_cap_shop", 202, 171, self::$roomNames[22]) .
self::showBuilding(3, "spring_cap_kom", 205, 105, "Комиссионный магазин") . self::showBuilding(3, "spring_cap_kom", 205, 105, self::$roomNames[25]) .
self::showBuilding(4, "spring_cap_rem", 202, 290, "Ремонтная мастерская") . self::showBuilding(4, "spring_cap_rem", 202, 290, self::$roomNames[23]) .
self::showBuilding(6, "spring_cap_po4ta", 180, 540, "Почта") . self::showBuilding(6, "spring_cap_po4ta", 180, 540, self::$roomNames[27]) .
self::showBuilding(7, "spring_cap_arr_right", 260, 710, "Страшилкина Улица") . self::showBuilding(7, "cap_arr_right", 260, 710, self::$roomNames[21]) .
self::showBuilding(8, "spring_cap_arr_left", 258, 21, "Большая парковая улица") . self::showBuilding(8, "cap_arr_left", 258, 21, self::$roomNames[26]) .
self::showBuilding(9, "spring_cap_tree2", 260, 530, "Новогодняя елка") . self::showBuilding(9, "winter_cap_tree2", 215, 500, self::$roomNames[44]) .
self::showBuilding(13, "spring_cap_statue", 222, 365, "Памятник Мэру Города") . self::showBuilding(13, "spring_cap_statue", 222, 365, self::$roomNames[24]) .
self::showBuilding(14, "spring_cap_sneg_3", 210, 390, "Снеговик") . self::showBuilding(14, "winter_cap_statue", 210, 390, "Снеговик") .
self::showBuilding(17, "spring_cap_berezka", 205, 435, "Березка") . self::showBuilding(222, "cap_arr_top", 180, 650, "Торговая улица") .
self::showBuilding(222, "spring_cap_arr_top", 180, 650, "Торговая улица") .
'</div>'; '</div>';
} elseif ($id === 21) { } elseif ($id === 21) {
echo '<div style="position:relative; display: inline-block;" id="ione"><img alt="background" src="/i/city/spring_cap_strash_day.jpg">' . echo '<div style="position:relative; display: inline-block;" id="ione"><img alt="background" src="/i/city/spring_cap_strash_day.jpg">' .
self::showBuilding(3, "cap_arr_right", 255, 708, "Ристалище") . self::showBuilding(3, "cap_arr_right", 255, 708, "Ристалище") .
self::showBuilding(4, "cap_arr_left", 258, 21, "Центральная площадь") . self::showBuilding(4, "cap_arr_left", 258, 21, self::$roomNames[20]) .
self::showBuilding(5, "cap_bank", 180, 485, "Банк") . self::showBuilding(5, "spring_cap_bank", 180, 485, self::$roomNames[29]) .
self::showBuilding(13, "cap_flowershop", 220, 613, "Цветочный магазин") . self::showBuilding(13, "spring_cap_flowershop", 220, 613, self::$roomNames[34]) .
self::showBuilding(14, "cap_registratura", 170, 113, "Регистратура кланов") . self::showBuilding(14, "spring_cap_registratura", 170, 113, self::$roomNames[28]) .
self::showBuilding(16, "cap_tower", 5, 315, "Башня смерти") . self::showBuilding(16, "spring_cap_tower", 5, 315, self::$roomNames[31]) .
self::showBuilding(16555, "cap_tree", 165, 20, "Дерево") .
'</div>'; '</div>';
} elseif ($id === 26) { } elseif ($id === 26) {
echo '<div style="position:relative; display: inline-block;" id="ione"><img alt="background" src="/i/city/spring_cap_park_day.jpg">' . echo '<div style="position:relative; display: inline-block;" id="ione"><img alt="background" src="/i/city/spring_cap_park_day.jpg">' .
self::showBuilding(3, "cap_arr_left", 259, 27, "Замковая площадь") . self::showBuilding(3, "cap_arr_left", 259, 27, self::$roomNames[2601]) .
self::showBuilding(4, "cap_arr_right", 259, 715, "Центральная площадь") . self::showBuilding(4, "cap_arr_right", 259, 715, self::$roomNames[20]) .
self::showBuilding(6, "cap_gate", 170, 340, "Городские ворота") . self::showBuilding(6, "cap_gate", 170, 340, "Городские ворота") .
self::showBuilding(660, "cap_vokzal", 163, 43, "Общежитие") . self::showBuilding(660, "spring_cap_vokzal", 163, 43, self::$roomNames[661]) .
'</div>'; '</div>';
} elseif ($id === 2601) { } elseif ($id === 2601) {
echo '<div style="position:relative; display: inline-block;" id="ione"><img alt="background" src="/i/city/sub/cap_zamk_day.jpg">' . echo '<div style="position:relative; display: inline-block;" id="ione"><img alt="background" src="/i/city/sub/cap_zamk_day.jpg">' .
self::showBuilding(1, "cap_ruins", 166, 48, "Руины Старого замка") . self::showBuilding(1, "spring_cap_ruins", 166, 48, "Руины Старого замка") .
self::showBuilding(4, "cap_arr_right", 260, 710, "Большая парковая улица") . self::showBuilding(4, "cap_arr_right", 260, 710, self::$roomNames[26]) .
self::showBuilding(10, "ava_post", 240, 300, "Сувенирный магазинчик") . self::showBuilding(10, "ava_post", 240, 300, self::$roomNames[35]) .
self::showBuilding(55, "cap_arr_left", 258, 21, "Арена Богов") . self::showBuilding(55, "cap_arr_left", 258, 21, self::$roomNames[2655]) .
self::showBuilding(1051, "cap_lab", 130, 327, "Вход в Лабиринт Хаоса") . self::showBuilding(1051, "spring_cap_lab", 130, 327, self::$roomNames[33]) .
self::showBuilding(1052, "cap_lavka", 240, 425, "Храмовая лавка") . self::showBuilding(1052, "spring_cap_lavka", 240, 425, self::$roomNames[1053]) .
'</div>'; '</div>';
} elseif ($id === 2655) { } elseif ($id === 2655) {
echo '<div style="position:relative; display: inline-block;" id="ione"><img alt="background" src="/i/city/ar_e_d.jpg">' . echo '<div style="position:relative; display: inline-block;" id="ione"><img alt="background" src="/i/city/ar_e_d.jpg">' .
self::showBuilding(10, "arr_right_png", 260, 710, "Замковая площадь") . self::showBuilding(10, "arr_right_png2", 260, 710, self::$roomNames[2601]) .
self::showBuilding(2055, "cap_altr_g", 230, 340, "Арена Ангелов") . self::showBuilding(2055, "altr_g", 230, 340, self::$roomNames[603]) .
'</div>'; '</div>';
} elseif ($id === 2111) { } elseif ($id === 2111) {
echo '<div style="position:relative; display: inline-block;" id="ione"><img alt="background" src="/i/city/av_rist_day.jpg.jpg">' . echo '<div style="position:relative; display: inline-block;" id="ione"><img alt="background" src="/i/city/av_rist_day.jpg">' .
self::showBuilding(1, "cap_arr_uleft", 240, 30, "Страшилкина Улица") . self::showBuilding(1, "cap_arr_left", 240, 30, self::$roomNames[21]) .
self::showBuilding(2, "cap_arr_right", 245, 708, "Секретный Лабиринт") . self::showBuilding(14, "spring_cap_rist_solo", 210, 160, "Вход в Одиночные сражения") .
self::showBuilding(14, "cap_rist_solo", 210, 160, "Вход в Одиночные сражения") . self::showBuilding(14, "spring_cap_rist_group", 243, 340, "Вход в Сражение отрядов") .
self::showBuilding(14, "cap_rist_group", 243, 340, "Вход в Сражение отрядов") . self::showBuilding(203, "spring_cap_rist_monstr", 145, 570, "Вход в Груповые сражения") .
self::showBuilding(21, "angelscastle", 131, 628, "Замок Мэра Города") . self::showBuilding(1000, "av_zamk_rud", 80, 310, self::$roomNames[1001]) .
self::showBuilding(203, "cap_rist_monstr", 145, 570, "Вход в Груповые сражения") .
self::showBuilding(1000, "av_zamk_rud", 80, 310, "Рудник") .
'</div>'; '</div>';
} elseif ($id === 2701) { } elseif ($id === 2701) {
echo '<div style="position:relative; display: inline-block;" id="ione"><img alt="background" src="/i/city/av_arena_bg1_day2.jpg">' . echo '<div style="position:relative; display: inline-block;" id="ione"><img alt="background" src="/i/city/av_arena_bg1_day2.jpg">' .
@ -68,11 +65,11 @@ class City
'</div>'; '</div>';
} elseif ($id === 2702) { } elseif ($id === 2702) {
echo '<div style="position:relative; display: inline-block;" id="ione"><img alt="background" src="/i/city/spring_cap_torg_day.jpg">' . echo '<div style="position:relative; display: inline-block;" id="ione"><img alt="background" src="/i/city/spring_cap_torg_day.jpg">' .
self::showBuilding(6, "cap_arenda", 175, 70, "Академия") . self::showBuilding(6, "spring_cap_build1", 175, 70, "Академия") .
self::showBuilding(10, "cap_arr_uleft", 259, 25, "Центральная площадь") . self::showBuilding(10, "cap_rist_arr_left", 259, 25, self::$roomNames[20]) .
self::showBuilding(16, "cap_t_build42", 120, 300, "Аукцион") . self::showBuilding(16, "auk", 120, 300, "Аукцион") .
self::showBuilding(21, "cap_lombard", 150, 565, "Ломбард") . self::showBuilding(21, "spring_cap_build2", 150, 565, "Ломбард") .
self::showBuilding(16555, "cap_prokat", 155, 480, "Прокатная лавка") . self::showBuilding(16555, "spring_cap_build3", 155, 480, "Прокатная лавка") .
'</div>'; '</div>';
} }
} }

View File

@ -35,7 +35,6 @@ trait Rooms
47 => "Замок (строительство)", 47 => "Замок (строительство)",
48 => "Обитель Хаоса", 48 => "Обитель Хаоса",
49 => "Проход к Цитадели Хаоса", 49 => "Проход к Цитадели Хаоса",
50 => "Магазин Берёзка",
51 => "Парковая улица", 51 => "Парковая улица",
52 => "Квартал Законников", 52 => "Квартал Законников",
53 => "Библиотека", 53 => "Библиотека",
@ -186,5 +185,5 @@ trait Rooms
2655 => "Арена Богов", 2655 => "Арена Богов",
2601 => "Замковая Площадь", 2601 => "Замковая Площадь",
2702 => "Центральная площадь (мираж)", 2702 => "Центральная площадь (мираж)",
]; ] ?? "Небытие";
} }

View File

@ -47,10 +47,6 @@ BTN;
$btnValue = "Купить за " . intval($this->cost) . " кр."; $btnValue = "Купить за " . intval($this->cost) . " кр.";
$btnLink = "/shop.php?buy={$this->id}&rnd=" . mt_rand(); $btnLink = "/shop.php?buy={$this->id}&rnd=" . mt_rand();
break; break;
case 'ashop':
$btnValue = "Купить за " . intval($this->ecost) . "р.";
$btnLink = "/ashop.php?buy={$this->id}&rnd=" . mt_rand();
break;
case 'sell': case 'sell':
$btnValue = "Продать"; $btnValue = "Продать";
$btnLink = "/shop.php?sell={$this->id}&rnd=" . mt_rand(); $btnLink = "/shop.php?sell={$this->id}&rnd=" . mt_rand();

View File

@ -3,9 +3,52 @@
class Travel class Travel
{ {
public static function toRoom(int $roomId, string $redirectToFile = 'city.php'): void /**
* Соответствие ID комнаты игровому файлу.
* @var string[]
*/
private static $roomFileName = [
1 => 'main.php',
20 => 'city.php',
21 => 'city.php',
22 => 'shop.php',
23 => 'repair.php',
25 => 'comission.php',
26 => 'city.php',
27 => 'post.php',
29 => 'bank.php',
30 => 'clan_create.php',
31 => 'tower.php',
34 => 'fshop.php',
37 => 'gotzamok.php',
51 => 'city.php',
61 => 'akadem.php',
401 => 'hell.php',
402 => 'lab_chaos_enter.php',
404 => 'vxod.php',
603 => 'aren_of_angels.php',
620 => 'enter_cave.php',
650 => 'ul_clans.php',
660 => 'hostel.php',
666 => 'jail.php',
777 => 'obshaga.php',
1051 => 'lab_enter.php',
1055 => 'group_arena.php',
2111 => 'city.php',
2601 => 'city.php',
2655 => 'city.php',
2702 => 'city.php'
];
/**
* Перемещение по комнатам.
* @param int $roomId ID куда идём.
* @param int $roomIdCurrent ID откуда идём.
* @throws \Krugozor\Database\Mysql\Exception
*/
public static function toRoom(int $roomId, int $roomIdCurrent): void
{ {
$itemsWeight = db::c()->query('SELECT SUM(weight) AS all_weight FROM `inventory` WHERE owner_id = ?i AND `setsale` = 0', $_SESSION['uid'])->fetch_assoc(); $itemsWeight = db::c()->query('SELECT SUM(weight) AS all_weight FROM `inventory` WHERE owner_id = ?i AND on_sale = 0', $_SESSION['uid'])->fetch_assoc();
$eff = db::c()->query('SELECT type FROM users_effects WHERE owner_id = ?i AND (`type` = 10 OR `type` = 13 OR `type` = 14)', $_SESSION['uid'])->fetch_assoc(); $eff = db::c()->query('SELECT type FROM users_effects WHERE owner_id = ?i AND (`type` = 10 OR `type` = 13 OR `type` = 14)', $_SESSION['uid'])->fetch_assoc();
$errors = []; $errors = [];
if ($itemsWeight['all_weight'] > get_meshok()) { if ($itemsWeight['all_weight'] > get_meshok()) {
@ -21,9 +64,9 @@ class Travel
foreach ($errors as $error) { foreach ($errors as $error) {
echo sprintf('<span class="error">%s</span>', $error); echo sprintf('<span class="error">%s</span>', $error);
} }
} elseif (in_array($roomId, self::allowedRoomMoves($roomId))) { } elseif (in_array($roomId, self::allowedRoomMoves($roomIdCurrent))) {
db::c()->query('UPDATE users, online SET users.room = ?i, online.room = ?i WHERE `online`.`user_id` = `users`.`id` AND `online`.`id` = ?i', $roomId, $roomId, $_SESSION['uid']); db::c()->query('UPDATE users, online SET users.room = ?i, online.room = ?i WHERE `online`.`user_id` = `users`.`id` AND `online`.`user_id` = ?i', $roomId, $roomId, $_SESSION['uid']);
header('location: ' . $redirectToFile); header('location: ' . self::$roomFileName[$roomId]);
exit; exit;
} }
} }
@ -44,10 +87,10 @@ class Travel
* 7 Room 21 [STREET] * 7 Room 21 [STREET]
* 8 Room 26 [STREET] * 8 Room 26 [STREET]
* 13 location: quest_room.php * 13 location: quest_room.php
* 17 Room 50 ashop.php
* 222 Room 2702 [STREET] * 222 Room 2702 [STREET]
*/ */
$room[20] = [1, 2, 3, 4, 6, 7, 8, 9, 13, 14, 17, 222]; // level+n $room[20] = [1, 21, 22, 23, 25, 26, 27, 2702];
$room[1] = $room[22] = $room[23] = $room[25] = $room[27] = [20];
/* /*
* 3 Room 2111 [STREET] * 3 Room 2111 [STREET]
* 4 Room 20 [STREET] * 4 Room 20 [STREET]
@ -57,11 +100,15 @@ class Travel
* 16 Room 31 tower.php * 16 Room 31 tower.php
* 650 Room 650 ul_clans.php * 650 Room 650 ul_clans.php
*/ */
$room[21] = [3, 4, 5, 13, 14, 16, 16555]; $room[21] = [20, 29, 30, 31, 34, 650, 2111];
$room[29] = $room[30] = $room[31] = $room[34] = [21];
$room[26] = [3, 4, 6, 660]; $room[26] = [20, 401, 660, 777, 2601];
$room[2601] = [1, 4, 10, 55, 1051, 1052]; $room[401] = $room[660] = $room[777] = [26];
$room[2655] = [10, 2055];
$room[2601] = [26, 37, 404, 1051, 2655];
$room[2655] = [603, 2601];
/* /*
* 1 Room 21 [STREET] * 1 Room 21 [STREET]
@ -72,10 +119,10 @@ class Travel
* [!not on map]666 Room 666 jail.php * [!not on map]666 Room 666 jail.php
* 1000 * 1000
*/ */
$room[2111] = [1, 2, 14, 21, 203, 1000]; $room[2111] = [21, 620, 666, 1055];
$room[2701] = [1, 2]; $room[2701] = [402, 2111];
$room[2702] = [6, 10, 16, 21, 16555]; $room[2702] = [20, 61];
if (empty($room[$roomId])) { if ($room[$roomId] === null) {
return []; return [];
} }
return $room[$roomId]; return $room[$roomId];

File diff suppressed because one or more lines are too long

View File

@ -1083,8 +1083,8 @@ function telegraph($userId, $text)
function get_meshok() function get_meshok()
{ {
global $user; global $user;
$d = db::c()->query('SELECT SUM(`gmeshok`) AS `ves` FROM `inventory` WHERE `owner` = ?i AND `setsale` = 0 AND `gmeshok` > 0', $_SESSION['uid'])->fetch_assoc(); $itemsWeight = db::c()->query('SELECT SUM(weight) AS all_weight FROM `inventory` WHERE owner_id = ?i AND on_sale = 0', $_SESSION['uid'])->fetch_assoc();
return ($user->strength * 4 + $d['ves']); return ($user->strength * 4 + $itemsWeight['all_weight']);
} }
/** /**

View File

@ -23,14 +23,11 @@ $errkom = '';
$varsitm = [[270, 1]]; $varsitm = [[270, 1]];
$varsitm2 = [[87, 1], [88, 1], [48, 1], [49, 1], [29, 1], [66, 1], [97, 1], [67, 1], [98, 1], [115, 1]]; $varsitm2 = [[87, 1], [88, 1], [48, 1], [49, 1], [29, 1], [66, 1], [97, 1], [67, 1], [98, 1], [115, 1]];
function labaItemAdd($id, $type) function labaItemAdd($id)
{ {
global $user; global $user;
if ($type == 1) {
$dress = mysql_fetch_array(mysql_query('SELECT * FROM `shop` WHERE `id` = "' . (int)$id . '" LIMIT 1')); $dress = mysql_fetch_array(mysql_query('SELECT * FROM `shop` WHERE `id` = "' . (int)$id . '" LIMIT 1'));
} else {
$dress = mysql_fetch_array(mysql_query('SELECT * FROM `ashop` WHERE `id` = "' . (int)$id . '" LIMIT 1'));
}
if (isset($dress['id'])) { if (isset($dress['id'])) {
mysql_query("INSERT INTO `inventory` (`laba`, `prototype`,`owner`,`name`,`type`,`massa`,`cost`, `img`,`maxdur`,`isrep`,`gsila`,`glovk`,`ginta`,`gintel`,`ghp`,`gnoj`,`gtopor`,`gdubina`,`gmech`,`gfire`,`gwater`,`gair`,`gearth`,`glight`,`ggray`,`gdark`,`needident`,`nsila`,`nlovk`,`ninta`,`nintel`,`nmudra`,`nvinos`,`nnoj`,`ntopor`,`ndubina`,`nmech`,`nfire`,`nwater`,`nair`,`nearth`,`nlight`,`ngray`,`ndark`,`mfkrit`,`mfakrit`,`mfuvorot`,`mfauvorot`,`bron1`,`bron2`,`bron3`,`bron4`,`maxu`,`minu`,`magic`,`nlevel`,`nalign`,`dategoden`,`goden`,`otdel`,`gmp`,`gmeshok`,`encicl`,`artefact`,`koll`) VALUES ('$type', '{$dress['id']}','{$user['id']}','{$dress['name']}','{$dress['type']}',{$dress['massa']},{$dress['cost']},'{$dress['img']}',{$dress['maxdur']},{$dress['isrep']},'{$dress['gsila']}','{$dress['glovk']}','{$dress['ginta']}','{$dress['gintel']}','{$dress['ghp']}','{$dress['gnoj']}','{$dress['gtopor']}','{$dress['gdubina']}','{$dress['gmech']}','{$dress['gfire']}','{$dress['gwater']}','{$dress['gair']}','{$dress['gearth']}','{$dress['glight']}','{$dress['ggray']}','{$dress['gdark']}','{$dress['needident']}','{$dress['nsila']}','{$dress['nlovk']}','{$dress['ninta']}','{$dress['nintel']}','{$dress['nmudra']}','{$dress['nvinos']}','{$dress['nnoj']}','{$dress['ntopor']}','{$dress['ndubina']}','{$dress['nmech']}','{$dress['nfire']}','{$dress['nwater']}','{$dress['nair']}','{$dress['nearth']}','{$dress['nlight']}','{$dress['ngray']}','{$dress['ndark']}','{$dress['mfkrit']}','{$dress['mfakrit']}','{$dress['mfuvorot']}','{$dress['mfauvorot']}','{$dress['bron1']}','{$dress['bron2']}','{$dress['bron3']}','{$dress['bron4']}','{$dress['maxu']}','{$dress['minu']}','{$dress['magic']}','{$dress['nlevel']}','{$dress['nalign']}','" . (($dress['goden']) ? ($dress['goden'] * 24 * 60 * 60 + time()) : "") . "','{$dress['goden']}','{$dress['razdel']}','{$dress['gmp']}','{$dress['gmeshok']}','{$dress['encicl']}','{$dress['artefact']}','{$dress[koll]}')"); mysql_query("INSERT INTO `inventory` (`laba`, `prototype`,`owner`,`name`,`type`,`massa`,`cost`, `img`,`maxdur`,`isrep`,`gsila`,`glovk`,`ginta`,`gintel`,`ghp`,`gnoj`,`gtopor`,`gdubina`,`gmech`,`gfire`,`gwater`,`gair`,`gearth`,`glight`,`ggray`,`gdark`,`needident`,`nsila`,`nlovk`,`ninta`,`nintel`,`nmudra`,`nvinos`,`nnoj`,`ntopor`,`ndubina`,`nmech`,`nfire`,`nwater`,`nair`,`nearth`,`nlight`,`ngray`,`ndark`,`mfkrit`,`mfakrit`,`mfuvorot`,`mfauvorot`,`bron1`,`bron2`,`bron3`,`bron4`,`maxu`,`minu`,`magic`,`nlevel`,`nalign`,`dategoden`,`goden`,`otdel`,`gmp`,`gmeshok`,`encicl`,`artefact`,`koll`) VALUES ('$type', '{$dress['id']}','{$user['id']}','{$dress['name']}','{$dress['type']}',{$dress['massa']},{$dress['cost']},'{$dress['img']}',{$dress['maxdur']},{$dress['isrep']},'{$dress['gsila']}','{$dress['glovk']}','{$dress['ginta']}','{$dress['gintel']}','{$dress['ghp']}','{$dress['gnoj']}','{$dress['gtopor']}','{$dress['gdubina']}','{$dress['gmech']}','{$dress['gfire']}','{$dress['gwater']}','{$dress['gair']}','{$dress['gearth']}','{$dress['glight']}','{$dress['ggray']}','{$dress['gdark']}','{$dress['needident']}','{$dress['nsila']}','{$dress['nlovk']}','{$dress['ninta']}','{$dress['nintel']}','{$dress['nmudra']}','{$dress['nvinos']}','{$dress['nnoj']}','{$dress['ntopor']}','{$dress['ndubina']}','{$dress['nmech']}','{$dress['nfire']}','{$dress['nwater']}','{$dress['nair']}','{$dress['nearth']}','{$dress['nlight']}','{$dress['ngray']}','{$dress['ndark']}','{$dress['mfkrit']}','{$dress['mfakrit']}','{$dress['mfuvorot']}','{$dress['mfauvorot']}','{$dress['bron1']}','{$dress['bron2']}','{$dress['bron3']}','{$dress['bron4']}','{$dress['maxu']}','{$dress['minu']}','{$dress['magic']}','{$dress['nlevel']}','{$dress['nalign']}','" . (($dress['goden']) ? ($dress['goden'] * 24 * 60 * 60 + time()) : "") . "','{$dress['goden']}','{$dress['razdel']}','{$dress['gmp']}','{$dress['gmeshok']}','{$dress['encicl']}','{$dress['artefact']}','{$dress[koll]}')");
} }
@ -175,7 +172,7 @@ if ($user->room == 1052) {
$bots = [ $bots = [
0 => [10025, 10026, 10027, 10028, 10031, 10032, 10033, 10034], 0 => [10025, 10026, 10027, 10028, 10031, 10032, 10033, 10034],
1 => [10111, 10112, 10113, 10114, 10115, 10116], 1 => [10111, 10112, 10113, 10114, 10115, 10116],
2 => [10111, 10112, 10113] 2 => [10111, 10112, 10113],
]; ];
$bot_pix2 = $bots[$lab['type']]; $bot_pix2 = $bots[$lab['type']];
@ -334,7 +331,7 @@ if ($user->room == 1052) {
money_add($kr); money_add($kr);
unset($kr); unset($kr);
} else { } else {
labaItemAdd($var['itm']['id'], 1); labaItemAdd($var['itm']['id']);
} }
} else { } else {
$var['itm']['name'] = 'Предмет рассыпался на глазах...'; $var['itm']['name'] = 'Предмет рассыпался на глазах...';
@ -346,14 +343,7 @@ if ($user->room == 1052) {
if ($user['sex'] == 0) { if ($user['sex'] == 0) {
$var['sex'] = 'а'; $var['sex'] = 'а';
} }
$var['itm'] = $varsitm2[rand(0, count($varsitm2) - 1)];
$var['itm'] = $var['itm'][0];
$var['itm'] = mysql_fetch_array(mysql_query('SELECT `id`, `name` FROM `ashop` WHERE `id` = "' . $var['itm'] . '" LIMIT 1'));
if (isset($var['itm']['id'])) {
labaItemAdd($var['itm']['id'], 2);
} else {
$var['itm']['name'] = 'Предмет рассыпался на глазах...';
}
$errors .= '<img width="40" height="25" src="/i/sh/event_pandbox.gif" /> ' . $user['login'] . ' открыл' . $var['sex'] . ' Ящик Пандоры...и забрал &quot;' . $var['itm']['name'] . '&quot;'; $errors .= '<img width="40" height="25" src="/i/sh/event_pandbox.gif" /> ' . $user['login'] . ' открыл' . $var['sex'] . ' Ящик Пандоры...и забрал &quot;' . $var['itm']['name'] . '&quot;';
$var['obj']['use'] = $user['id']; $var['obj']['use'] = $user['id'];
} elseif ($var['obj']['type'] == 3) { } elseif ($var['obj']['type'] == 3) {

182
main.php
View File

@ -2,7 +2,7 @@
ob_start("ob_gzhandler"); ob_start("ob_gzhandler");
session_start(); session_start();
$get = filter_input(INPUT_SERVER, 'QUERY_STRING'); $get = filter_input(INPUT_SERVER, 'QUERY_STRING');
if ($get === 'exit') { if ($get == 'exit') {
session_destroy(); session_destroy();
header("Location: fight.php"); header("Location: fight.php");
} }
@ -50,142 +50,155 @@ while ($row = $data->fetch_assoc()) {
} }
//Обработчики нажатий на кнопки. //Обработчики нажатий на кнопки.
if (isset($_POST['battlefield'])) { if ($_POST['battlefield'] ?? 0 && $user->room == 1) {
header('Location: zayavka.php'); header('Location: zayavka.php');
exit(); exit();
} }
if ($_POST['module_quest'] ?? 0) {
header('Location: module_quest.php');
exit();
}
if ($_POST['move_inside'] ?? 0 && $user->room == 20) {
header('Location: main.php?goto=arena');
exit();
}
if ($_POST['move_outside'] ?? 0 && $user->room == 1) {
header('Location: main.php?goto=plo');
exit();
}
if ($_POST['main_page'] ?? 0) {
header('Location: main.php');
exit();
}
/* === проверяем соответствие комнаты и скрипта === */ if ($edit === null) {
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])) {
header('Location: city.php'); header('Location: city.php');
exit(); exit();
} }
if ($user->room == 22) { if ($user->room == 22) {
header('Location: shop.php'); header('Location: shop.php');
exit(); exit();
} }
if ($user->room == 23) { if ($user->room == 23) {
header('Location: repair.php'); header('Location: repair.php');
exit(); exit();
} }
if ($user->room == 25) { if ($user->room == 25) {
header('Location: comission.php'); header('Location: comission.php');
exit(); exit();
} }
if ($user->room == 27) { if ($user->room == 27) {
header('Location: post.php'); header('Location: post.php');
exit(); exit();
} }
if ($user->room == 29) { if ($user->room == 29) {
header('Location: bank.php'); header('Location: bank.php');
exit(); exit();
} }
if ($user->room == 31) { if ($user->room == 31) {
header('Location: tower.php'); header('Location: tower.php');
exit(); exit();
} }
if ($user->room == 30) { if ($user->room == 30) {
header('Location: clan_create.php'); header('Location: clan_create.php');
exit(); exit();
} }
if ($user->room == 34) { if ($user->room == 34) {
header('Location: fshop.php'); header('Location: fshop.php');
exit(); exit();
} }
if ($user->room == 45) { if ($user->room == 45) {
header('Location: clan_castle.php'); header('Location: clan_castle.php');
exit(); exit();
} }
if ($user->room == 50) { if ($user->room == 53) {
header('Location: ashop.php');
exit();
}
if ($user->room == 53) {
header('Location: library.php'); header('Location: library.php');
exit(); exit();
} }
if ($user->room == 61) { if ($user->room == 61) {
header('Location: akadem.php'); header('Location: akadem.php');
exit(); exit();
} }
if ($user->room == 650) { if ($user->room == 650) {
header('Location: ul_clans.php'); header('Location: ul_clans.php');
exit(); exit();
} }
//ЦХ //ЦХ
if ($user->room == 600) { if ($user->room == 600) {
header('Location: c_haos.php'); header('Location: c_haos.php');
exit(); exit();
} }
if ($user->room == 601) { if ($user->room == 601) {
header('Location: c_haos_in.php'); header('Location: c_haos_in.php');
exit(); exit();
} }
if ($user->room == 602) { if ($user->room == 602) {
header('Location: c_park.php'); header('Location: c_park.php');
exit(); exit();
} }
if ($user->room == 603) { if ($user->room == 603) {
header('Location: aren_of_angels.php'); header('Location: aren_of_angels.php');
exit(); exit();
} }
if ($user->room == 620) { if ($user->room == 620) {
header('Location: enter_cave.php'); header('Location: enter_cave.php');
exit(); exit();
} }
if ($user->room == 621) { if ($user->room == 621) {
header('Location: cave.php'); header('Location: cave.php');
exit(); exit();
} }
if ($user->room == 660) { if ($user->room == 660) {
header('Location: hostel.php'); header('Location: hostel.php');
exit(); exit();
} }
if ($user->room == 661) { if ($user->room == 661) {
header('Location: hostel_room.php'); header('Location: hostel_room.php');
exit(); exit();
} }
if ($user->room == 662) { if ($user->room == 662) {
header('Location: quest_room.php'); header('Location: quest_room.php');
exit(); exit();
} }
if ($user->room == 760) { if ($user->room == 760) {
header('Location: c_forest.php'); header('Location: c_forest.php');
exit(); exit();
} }
if ($user->room == 1000) { if ($user->room == 1000) {
header('Location: solib/enterbezdna.php'); header('Location: solib/enterbezdna.php');
exit(); exit();
} }
if ($user->room == 1001) { if ($user->room == 1001) {
header('Location: solib/dungeon.php'); header('Location: solib/dungeon.php');
exit(); exit();
} }
if ($user->room == 1051) { if ($user->room == 1051) {
header('Location: lab_enter.php'); header('Location: lab_enter.php');
exit(); exit();
} }
if ($user->room == 1052) { if ($user->room == 1052) {
header('Location: labirint.php'); header('Location: labirint.php');
exit(); exit();
} }
if ($user->room == 402) { if ($user->room == 402) {
header('Location: vxod.php'); header('Location: vxod.php');
exit(); exit();
} }
if ($user->room == 403) { if ($user->room == 403) {
header('Location: canalizaciya.php'); header('Location: canalizaciya.php');
exit(); exit();
} }
if ($user->room == 1055) { if ($user->room == 1055) {
header('Location: group_arena.php'); header('Location: group_arena.php');
exit(); exit();
} }
if ($user->room == 666) { if ($user->room == 666) {
header('Location: jail.php'); header('Location: jail.php');
exit(); exit();
}
} }
function del_efs($id, $type) function del_efs($id, $type)
{ {
if ($id && !in_array($type, [2, 3, 4, 5, 8, 10, 11, 12, 13, 14, 20])) { if ($id && !in_array($type, [2, 3, 4, 5, 8, 10, 11, 12, 13, 14, 20])) {
@ -202,7 +215,7 @@ function del_efs($id, $type)
// одеть предмет // одеть предмет
function dressitem($id) function dressitem($id)
{ {
//FIXME Предметы не должны одеваться, если не соответствуют требованиям! //FIXME bug #7
define('HELMET', 1); define('HELMET', 1);
define('ARMOR', 2); define('ARMOR', 2);
define('LEGS', 3); define('LEGS', 3);
@ -234,7 +247,7 @@ function dressitem($id)
if (!$itemInSlotQuantity) { if (!$itemInSlotQuantity) {
// просто одеваем предмет // просто одеваем предмет
db::c()->query('UPDATE inventory SET dressed_slot = item_type WHERE item_id = ?i', $id); db::c()->query('UPDATE inventory SET dressed_slot = item_type WHERE item_id = ?i', $id);
} elseif ($itemInSlotQuantity === 1) { } elseif ($itemInSlotQuantity == 1) {
// снимаем предмет и одеваем вместо // снимаем предмет и одеваем вместо
db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = ?i', $itemInSlot[0]); db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = ?i', $itemInSlot[0]);
db::c()->query('UPDATE inventory SET dressed_slot = item_type WHERE item_id = ?i', $id); db::c()->query('UPDATE inventory SET dressed_slot = item_type WHERE item_id = ?i', $id);
@ -252,7 +265,7 @@ function dressitem($id)
sort($emptyRingSlots); sort($emptyRingSlots);
// Одеваем предмет в первый свободный слот. // Одеваем предмет в первый свободный слот.
db::c()->query('UPDATE inventory SET dressed_slot = ?i WHERE item_id = ?i', $emptyRingSlots[0], $id); db::c()->query('UPDATE inventory SET dressed_slot = ?i WHERE item_id = ?i', $emptyRingSlots[0], $id);
} elseif ($itemInSlotQuantity === 3) { } elseif ($itemInSlotQuantity == 3) {
db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = 11'); db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = 11');
db::c()->query('UPDATE inventory SET dressed_slot = 11 WHERE item_id = ?i', $id); db::c()->query('UPDATE inventory SET dressed_slot = 11 WHERE item_id = ?i', $id);
// снимаем предмет из слота 11 и одеваем вместо // снимаем предмет из слота 11 и одеваем вместо
@ -292,14 +305,14 @@ if ($goto) {
err('У вас тяжелая травма, вы не можете передвигатся...'); err('У вас тяжелая травма, вы не можете передвигатся...');
$imove = false; $imove = false;
} }
if ($goto == 'plo' && !$user->zayavka && $imove === true) { if ($goto == 'plo' && !$user->zayavka && $imove && $user->room != 20) {
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']); db::c()->query('UPDATE users, online SET users.room = 20, online.room = 20 WHERE online.user_id = users.id AND online.user_id = ?i', $_SESSION['uid']);
header('Location: city.php'); header('Location: city.php');
exit("<i>Топ-топ-топ...</i>"); exit("<i>Топ-топ-топ...</i>");
} else { } else {
err('Подали заявку на бой и убегаете из клуба? Нехорошо...'); err('Подали заявку на бой и убегаете из клуба? Нехорошо...');
} }
if ($goto == 'arena' && $user->room === 20 && $imove === true) { if ($goto == 'arena' && $user->room == 20 && $imove) {
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']); 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'); header('Location: main.php');
exit("<i>Топ-топ-топ...</i>"); exit("<i>Топ-топ-топ...</i>");
@ -543,21 +556,14 @@ Template::header('Игра');
title="Образы"> title="Образы">
<?php endif; ?> <?php endif; ?>
<div class="button-group"> <div class="button-group">
<?php if ($user->room == 20): ?>
<input class="button icon move" type="submit" name="move_inside" value="Войти внутрь">
<?php elseif ($user->room == 1): ?>
<input class="button primary" type="submit" name="battlefield" value="Поединки"> <input class="button primary" type="submit" name="battlefield" value="Поединки">
<button class="button" onclick="window.location.href='module_quest.php';">Активные задания <input class="button icon move" type="submit" name="move_outside" value="Выйти на улицу">
</button>
<?php if ($user->room === 20): ?>
<button class="button icon move"
onclick="parent.frames[´main´].location.href='main.php?goto=arena';">Войти
внутрь
</button>
<?php else: ?>
<button class="button icon move" onclick="window.location.href='main.php?goto=plo';">Выйти
на улицу
</button>
<?php endif; ?> <?php endif; ?>
<button class="button icon loop" onclick="window.location.href='main.php';">Обновить страницу <input class="button" type="submit" name="module_quest" value="Активные задания">
</button> <input class="button" type="submit" name="main_page" value="На главную">
</div> </div>
</div> </div>
<div> <!--рюкзак--> <div> <!--рюкзак-->

View File

@ -15,22 +15,18 @@ if ($user->battle) {
header('location: fbattle.php'); header('location: fbattle.php');
exit; exit;
} }
$changeReceiver = $_GET['change'] ?? 0; if ($_GET['change'] ?? 0) {
if ($changeReceiver) {
unset($_SESSION['receiverName']); unset($_SESSION['receiverName']);
} }
$razdelId = $_GET['razdel'] ?? 0;
$_SESSION['receiverName'] = $_POST['receiverName'] ?? ''; $_SESSION['receiverName'] = $_POST['receiverName'] ?? '';
$receiverId = null; $receiverId = null;
$queryItems = null; $queryItems = null;
$statusMessage = null;
if ($_SESSION['receiverName']) { if ($_SESSION['receiverName']) {
$receiver = db::c()->query('SELECT `id`, `level`, `login` FROM `users` WHERE `login` = "?s"', $_SESSION['receiverName'])->fetch_assoc(); $receiver = db::c()->query('SELECT `id`, `level`, `login` FROM `users` WHERE `login` = "?s"', $_SESSION['receiverName'])->fetch_assoc();
if (!$receiver['id']) { if (!$receiver['id']) {
err('Персонажа не существует!'); $statusMessage = 'Персонажа не существует!';
unset($_SESSION['receiverName']);
} elseif ($receiver['level'] < 4) {
err('Персонажей ниже 4-го уровня не обслуживаем!');
unset($_SESSION['receiverName']); unset($_SESSION['receiverName']);
} else { } else {
$receiverId = $receiver['id']; $receiverId = $receiver['id'];
@ -51,27 +47,20 @@ if ($_SESSION['receiverName']) {
} }
if ($submit == 'sendItem' && $sendItemId && $user->money) { if ($submit == 'sendItem' && $sendItemId && $user->money) {
$res = db::c()->query('SELECT `id`,`name` FROM `inventory` WHERE `owner` = ?i AND `id` = ?i AND `dressed` = 0 AND `setsale` = 0 AND `present` = "?s" AND `artefact` = 0', $_SESSION['uid'], $sendItemId, null)->fetch_assoc(); $res = db::c()->query('SELECT name FROM inventory WHERE owner_id = ?i AND item_id = ?i AND dressed_slot = 0 AND on_sale = 0', $user->id, $sendItemId)->fetch_assoc();
if (!$res['id']) { if (!$res) {
$statusMessage = "Предмет не найден в рюкзаке."; $statusMessage = "Предмет не найден в рюкзаке.";
} else { } else {
$user->money -= 1; $user->money -= 1;
Bank::setWalletMoney($user->money, $user->id); Bank::setWalletMoney($user->money, $user->id);
db::c()->query('UPDATE `inventory` SET `owner` = ?i WHERE `id`= ?i AND `owner`= ?i', $receiverId, $sendItemId, $_SESSION['uid']); db::c()->query('UPDATE `inventory` SET owner_id = ?i WHERE item_id= ?i AND owner_id = ?i', $receiverId, $sendItemId, $_SESSION['uid']);
//TODO: Добавить логи и статистику. //TODO: #9
$statusMessage = 'Предмет "' . $res['name'] . '" передан персонажу ' . $receiverId; $statusMessage = 'Предмет "' . $res['name'] . '" передан персонажу ' . $receiverId;
db::c()->query('INSERT INTO `telegraph` (`receiver`,`text`) VALUES (?i,"?s")', $receiverId, 'Почтовый перевод: ' . $res['name'] . ' от персонажа ' . $user['login'] . '.'); db::c()->query('INSERT INTO `telegraph` (`receiver`,`text`) VALUES (?i,"?s")', $receiverId, 'Почтовый перевод: ' . $res['name'] . ' от персонажа ' . $user['login'] . '.');
} }
} }
$queryItems = db::c()->query('SELECT `inventory`.*,
`magic`.`name` AS `magic_name`, $queryItems = db::c()->query('SELECT * FROM inventory WHERE dressed_slot = 0 AND on_sale = 0 AND owner_id = ?i', $user->id);
`magic`.`chanse` AS `magic_chanse`,
`magic`.`time` AS `magic_time`,
`magic`.`file` AS `magic_file`,
`magic`.`targeted` AS `magic_targeted`,
`magic`.`needcharge` AS `magic_needcharge`,
`magic`.`img` AS `magic_img` FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `owner` = ?i AND `dressed` = 0 AND `setsale` = 0 AND `present` = "?s" AND `artefact` = 0 ORDER BY `update` DESC', $_SESSION['uid'], null);
$iteminfo = [];
while ($row = $queryItems->fetch_assoc()) { while ($row = $queryItems->fetch_assoc()) {
$iteminfo[] = new InventoryItem($row); $iteminfo[] = new InventoryItem($row);
} }
@ -79,14 +68,13 @@ if ($_SESSION['receiverName']) {
} }
Template::header('Почта'); Template::header('Почта');
?> ?>
<script src="js/main.js"></script>
<div style="float: right"> <div style="float: right">
<button onclick="hrefToFrame('city.php?cp')">Вернуться</button> <button onclick="top.frames['gameframe'].location = 'city.php?cp'">Вернуться</button>
</div> </div>
<h1>Почта</h1> <h1>Почта</h1>
<div style="text-align: center;"><?php if (isset($statusMessage)) err($statusMessage); ?></div> <div style="text-align: center;"><span class="error"><?= $statusMessage ?></span></div>
<legend>Услуги почты платные: 1 кредит.</legend> <legend>Услуги почты платные: 1 кредит.</legend>
<?php if ($_SESSION['receiverName']): ?> <?php if ($_SESSION['receiverName'] ?? ''): ?>
Получатель: <?= Nick::id($receiverId)->full() ?> Получатель: <?= Nick::id($receiverId)->full() ?>
<a href="?change">Сменить</a> <a href="?change">Сменить</a>
<table width=100%> <table width=100%>

View File

@ -1,4 +1,6 @@
<?= Template::header('top_menu', 1) ?> <?php
require_once 'classes/Template.php';
Template::header('top_menu') ?>
<style> <style>
* { * {
margin: 0; margin: 0;

View File

@ -79,25 +79,21 @@ $rhar = [
"560" => [20, 0, 0, 0, 559], "560" => [20, 0, 0, 0, 559],
]; ];
mysql_query("LOCK TABLES `bots` WRITE, `deztow_stavka` WRITE, `users` WRITE, `deztow_items` WRITE, `inventory` WRITE, `battle` WRITE, `logs` WRITE, `deztow_turnir` WRITE, `effects` WRITE,`shop` WRITE, `online` WRITE, `deztow_gamers_inv` WRITE, `deztow_realchars` WRITE, `deztow_eff` WRITE, `variables` WRITE, `ashop` WRITE"); mysql_query("LOCK TABLES `bots` WRITE, `deztow_stavka` WRITE, `users` WRITE, `deztow_items` WRITE, `inventory` WRITE, `battle` WRITE, `logs` WRITE, `deztow_turnir` WRITE, `effects` WRITE,`shop` WRITE, `online` WRITE, `deztow_gamers_inv` WRITE, `deztow_realchars` WRITE, `deztow_eff` WRITE, `variables` WRITE");
$ls = mysql_num_rows(mysql_query("SELECT `id` FROM `users` WHERE `bot` = 1 AND `in_tower` = 1")); $ls = mysql_num_rows(mysql_query("SELECT `id` FROM `users` WHERE `bot` = 1 and `in_tower` = 1"));
$kol_pl = mysql_num_rows(mysql_query("SELECT `id` FROM `users` WHERE `bot` = 0 AND `in_tower` = 1")); $kol_pl = mysql_num_rows(mysql_query("SELECT `id` FROM `users` WHERE `bot` = 0 and `in_tower` = 1"));
$tur_data = mysql_fetch_array(mysql_query("SELECT * FROM `deztow_turnir` WHERE `active` = TRUE")); $tur_data = mysql_fetch_array(mysql_query("SELECT * FROM `deztow_turnir` WHERE `active` = TRUE"));
if ($_GET['give']) { if ($_GET['give']) {
$obj = mysql_fetch_array(mysql_query("SELECT * FROM `deztow_items` WHERE `id` = '" . mysql_real_escape_string($_GET['give']) . "' AND `room` = '" . $user->room . "' LIMIT 1")); $obj = mysql_fetch_array(mysql_query("SELECT * FROM `deztow_items` WHERE `id` = '" . mysql_real_escape_string($_GET['give']) . "' and `room` = '" . $user->room . "' LIMIT 1"));
if ($obj) { if ($obj) {
if ($_SESSION['timei'] - time() <= 0) { if ($_SESSION['timei'] - time() <= 0) {
$_SESSION['timei'] = (time() + 3); $_SESSION['timei'] = (time() + 3);
if ($tur_data['art'] == 0) {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `shop` WHERE `id` = '" . $obj['iteam_id'] . "' LIMIT 1")); $dress = mysql_fetch_array(mysql_query("SELECT * FROM `shop` WHERE `id` = '" . $obj['iteam_id'] . "' LIMIT 1"));
} else {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `ashop` WHERE `id` = '" . $obj['iteam_id'] . "' LIMIT 1"));
}
if (isset($dress['id'])) { if (isset($dress['id'])) {
mysql_query("INSERT INTO `inventory` (`bs`, `prototype`, `owner`, `name`, `type`, `massa`, `cost`, `img`, `maxdur`, `isrep`, `gsila`, `glovk`, `ginta`, `gintel`, `ghp`, `gnoj`, `gtopor`, `gdubina`, `gmech`, `gfire`, `gwater`, `gair`, `gearth`, `glight`, `ggray`, `gdark`, `needident`, `nsila`, `nlovk`, `ninta`, `nintel`, `nmudra`, `nvinos`, `nnoj`, `ntopor`, `ndubina`, `nmech`, `nfire`, `nwater`, `nair`, `nearth`, `nlight`, `ngray`, `ndark`, `mfkrit`, `mfakrit`, `mfuvorot`, `mfauvorot`, `bron1`, `bron2`, `bron3`, `bron4`, `maxu`, `minu`, `magic`, `nlevel`, `nalign`, `dategoden`, `goden`, `otdel`, `koll`) VALUES ('1', '{$dress['id']}', '{$user['id']}', '{$dress['name']}', '{$dress['type']}', '{$dress['massa']}', '{$dress['cost']}', '{$dress['img']}', '{$dress['maxdur']}', '{$dress['isrep']}', '{$dress['gsila']}', '{$dress['glovk']}', '{$dress['ginta']}', '{$dress['gintel']}', '{$dress['ghp']}', '{$dress['gnoj']}', '{$dress['gtopor']}', '{$dress['gdubina']}', '{$dress['gmech']}', '{$dress['gfire']}', '{$dress['gwater']}', '{$dress['gair']}', '{$dress['gearth']}', '{$dress['glight']}', '{$dress['ggray']}', '{$dress['gdark']}', '{$dress['needident']}', '{$dress['nsila']}', '{$dress['nlovk']}', '{$dress['ninta']}', '{$dress['nintel']}', '{$dress['nmudra']}', '{$dress['nvinos']}', '{$dress['nnoj']}', '{$dress['ntopor']}', '{$dress['ndubina']}', '{$dress['nmech']}', '{$dress['nfire']}', '{$dress['nwater']}', '{$dress['nair']}', '{$dress['nearth']}', '{$dress['nlight']}', '{$dress['ngray']}', '{$dress['ndark']}', '{$dress['mfkrit']}', '{$dress['mfakrit']}', '{$dress['mfuvorot']}', '{$dress['mfauvorot']}', '{$dress['bron1']}', '{$dress['bron3']}', '{$dress['bron2']}', '{$dress['bron4']}', '{$dress['maxu']}', '{$dress['minu']}', '{$dress['magic']}', '{$dress['nlevel']}', '{$dress['nalign']}', '" . (($dress['goden']) ? ($dress['goden'] * 24 * 60 * 60 + time()) : "") . "', '{$dress['goden']}', '{$dress['razdel']}', '{$dress['koll']}')"); mysql_query("INSERT INTO `inventory` (`bs`, `prototype`, `owner`, `name`, `type`, `massa`, `cost`, `img`, `maxdur`, `isrep`, `gsila`, `glovk`, `ginta`, `gintel`, `ghp`, `gnoj`, `gtopor`, `gdubina`, `gmech`, `gfire`, `gwater`, `gair`, `gearth`, `glight`, `ggray`, `gdark`, `needident`, `nsila`, `nlovk`, `ninta`, `nintel`, `nmudra`, `nvinos`, `nnoj`, `ntopor`, `ndubina`, `nmech`, `nfire`, `nwater`, `nair`, `nearth`, `nlight`, `ngray`, `ndark`, `mfkrit`, `mfakrit`, `mfuvorot`, `mfauvorot`, `bron1`, `bron2`, `bron3`, `bron4`, `maxu`, `minu`, `magic`, `nlevel`, `nalign`, `dategoden`, `goden`, `otdel`, `koll`) VALUES ('1', '{$dress['id']}', '{$user['id']}', '{$dress['name']}', '{$dress['type']}', '{$dress['massa']}', '{$dress['cost']}', '{$dress['img']}', '{$dress['maxdur']}', '{$dress['isrep']}', '{$dress['gsila']}', '{$dress['glovk']}', '{$dress['ginta']}', '{$dress['gintel']}', '{$dress['ghp']}', '{$dress['gnoj']}', '{$dress['gtopor']}', '{$dress['gdubina']}', '{$dress['gmech']}', '{$dress['gfire']}', '{$dress['gwater']}', '{$dress['gair']}', '{$dress['gearth']}', '{$dress['glight']}', '{$dress['ggray']}', '{$dress['gdark']}', '{$dress['needident']}', '{$dress['nsila']}', '{$dress['nlovk']}', '{$dress['ninta']}', '{$dress['nintel']}', '{$dress['nmudra']}', '{$dress['nvinos']}', '{$dress['nnoj']}', '{$dress['ntopor']}', '{$dress['ndubina']}', '{$dress['nmech']}', '{$dress['nfire']}', '{$dress['nwater']}', '{$dress['nair']}', '{$dress['nearth']}', '{$dress['nlight']}', '{$dress['ngray']}', '{$dress['ndark']}', '{$dress['mfkrit']}', '{$dress['mfakrit']}', '{$dress['mfuvorot']}', '{$dress['mfauvorot']}', '{$dress['bron1']}', '{$dress['bron3']}', '{$dress['bron2']}', '{$dress['bron4']}', '{$dress['maxu']}', '{$dress['minu']}', '{$dress['magic']}', '{$dress['nlevel']}', '{$dress['nalign']}', '" . (($dress['goden']) ? ($dress['goden'] * 24 * 60 * 60 + time()) : "") . "', '{$dress['goden']}', '{$dress['razdel']}', '{$dress['koll']}')");
mysql_query("DELETE FROM `deztow_items` WHERE `id` = '" . mysql_real_escape_string($_GET['give']) . "' AND `room` = '" . $user->room . "' LIMIT 1"); mysql_query("DELETE FROM `deztow_items` WHERE `id` = '" . mysql_real_escape_string($_GET['give']) . "' and `room` = '" . $user->room . "' LIMIT 1");
} else { } else {
echo '<font color=red>Предмет не найден. Сообщите Администрации данный код #' . $obj['iteam_id'] . '#</font>'; echo '<font color=red>Предмет не найден. Сообщите Администрации данный код #' . $obj['iteam_id'] . '#</font>';
} }