Compare commits

..

7 Commits

13 changed files with 315 additions and 433 deletions

View File

@ -240,7 +240,6 @@ Template::header('ᐰdminка');
<option value="0" selected disabled>Тип магазина</option>
<option value="1">Обычный</option>
<option value="2">Цветной</option>
<option value="3">Артефактный</option>
</select></td>
</tr>
@ -409,11 +408,6 @@ if ($_POST['name']) {
// 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

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

@ -59,8 +59,7 @@ switch ($location[0]) {
default:
break;
case 'level1':
header('location: main.php?goto=arena');
exit;
Travel::toRoom(1,$user->room);
break;
case 'level7':
Travel::toRoom(21,$user->room);
@ -123,9 +122,6 @@ switch ($location[0]) {
case 'level1':
Travel::toRoom(21,$user->room);
break;
case 'level2':
header('location: city.php?haos');
break;
case 'level203':
Travel::toRoom(1055,$user->room);
break;
@ -133,7 +129,8 @@ switch ($location[0]) {
Travel::toRoom(620,$user->room);
break;
case 'room666':
Travel::toRoom(666,$user->room);
//Нет на карте
//Travel::toRoom(666,$user->room);
break;
}
} elseif ($user->room == 2601) {

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

View File

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

View File

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

View File

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

View File

@ -8,6 +8,7 @@ class Travel
* @var string[]
*/
private static $roomFileName = [
1 => 'main.php',
20 => 'city.php',
21 => 'city.php',
22 => 'shop.php',
@ -20,7 +21,6 @@ class Travel
31 => 'tower.php',
34 => 'fshop.php',
37 => 'gotzamok.php',
50 => 'ashop.php',
51 => 'city.php',
61 => 'akadem.php',
401 => 'hell.php',
@ -37,6 +37,7 @@ class Travel
2111 => 'city.php',
2601 => 'city.php',
2655 => 'city.php',
2702 => 'city.php'
];
/**
@ -64,7 +65,6 @@ class Travel
echo sprintf('<span class="error">%s</span>', $error);
}
} elseif (in_array($roomId, self::allowedRoomMoves($roomIdCurrent))) {
echo 111;
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: ' . self::$roomFileName[$roomId]);
exit;
@ -87,10 +87,10 @@ class Travel
* 7 Room 21 [STREET]
* 8 Room 26 [STREET]
* 13 location: quest_room.php
* 17 Room 50 ashop.php
* 222 Room 2702 [STREET]
*/
$room[20] = [21, 22, 23, 25, 26, 27, 50, 2702];
$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]
* 4 Room 20 [STREET]
@ -101,9 +101,13 @@ class Travel
* 650 Room 650 ul_clans.php
*/
$room[21] = [20, 29, 30, 31, 34, 650, 2111];
$room[29] = $room[30] = $room[31] = $room[34] = [21];
$room[26] = [20, 401, 660, 777, 2601];
$room[401] = $room[660] = $room[777] = [26];
$room[2601] = [26, 37, 404, 1051, 2655];
$room[2655] = [603, 2601];
/*

File diff suppressed because one or more lines are too long

View File

@ -23,14 +23,11 @@ $errkom = '';
$varsitm = [[270, 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;
if ($type == 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'));
}
$dress = mysql_fetch_array(mysql_query('SELECT * FROM `shop` WHERE `id` = "' . (int)$id . '" LIMIT 1'));
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]}')");
}
@ -175,7 +172,7 @@ if ($user->room == 1052) {
$bots = [
0 => [10025, 10026, 10027, 10028, 10031, 10032, 10033, 10034],
1 => [10111, 10112, 10113, 10114, 10115, 10116],
2 => [10111, 10112, 10113]
2 => [10111, 10112, 10113],
];
$bot_pix2 = $bots[$lab['type']];
@ -334,7 +331,7 @@ if ($user->room == 1052) {
money_add($kr);
unset($kr);
} else {
labaItemAdd($var['itm']['id'], 1);
labaItemAdd($var['itm']['id']);
}
} else {
$var['itm']['name'] = 'Предмет рассыпался на глазах...';
@ -346,14 +343,7 @@ if ($user->room == 1052) {
if ($user['sex'] == 0) {
$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;';
$var['obj']['use'] = $user['id'];
} elseif ($var['obj']['type'] == 3) {

View File

@ -113,10 +113,6 @@ if ($edit === null) {
header('Location: clan_castle.php');
exit();
}
if ($user->room == 50) {
header('Location: ashop.php');
exit();
}
if ($user->room == 53) {
header('Location: library.php');
exit();

View File

@ -15,22 +15,18 @@ if ($user->battle) {
header('location: fbattle.php');
exit;
}
$changeReceiver = $_GET['change'] ?? 0;
if ($changeReceiver) {
if ($_GET['change'] ?? 0) {
unset($_SESSION['receiverName']);
}
$razdelId = $_GET['razdel'] ?? 0;
$_SESSION['receiverName'] = $_POST['receiverName'] ?? '';
$receiverId = null;
$queryItems = null;
$statusMessage = null;
if ($_SESSION['receiverName']) {
$receiver = db::c()->query('SELECT `id`, `level`, `login` FROM `users` WHERE `login` = "?s"', $_SESSION['receiverName'])->fetch_assoc();
if (!$receiver['id']) {
err('Персонажа не существует!');
unset($_SESSION['receiverName']);
} elseif ($receiver['level'] < 4) {
err('Персонажей ниже 4-го уровня не обслуживаем!');
$statusMessage = 'Персонажа не существует!';
unset($_SESSION['receiverName']);
} else {
$receiverId = $receiver['id'];
@ -51,27 +47,20 @@ if ($_SESSION['receiverName']) {
}
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();
if (!$res['id']) {
$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) {
$statusMessage = "Предмет не найден в рюкзаке.";
} else {
$user->money -= 1;
Bank::setWalletMoney($user->money, $user->id);
db::c()->query('UPDATE `inventory` SET `owner` = ?i WHERE `id`= ?i AND `owner`= ?i', $receiverId, $sendItemId, $_SESSION['uid']);
//TODO: Добавить логи и статистику.
db::c()->query('UPDATE `inventory` SET owner_id = ?i WHERE item_id= ?i AND owner_id = ?i', $receiverId, $sendItemId, $_SESSION['uid']);
//TODO: #9
$statusMessage = 'Предмет "' . $res['name'] . '" передан персонажу ' . $receiverId;
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`,
`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 = [];
$queryItems = db::c()->query('SELECT * FROM inventory WHERE dressed_slot = 0 AND on_sale = 0 AND owner_id = ?i', $user->id);
while ($row = $queryItems->fetch_assoc()) {
$iteminfo[] = new InventoryItem($row);
}
@ -79,14 +68,13 @@ if ($_SESSION['receiverName']) {
}
Template::header('Почта');
?>
<script src="js/main.js"></script>
<div style="float: right">
<button onclick="hrefToFrame('city.php?cp')">Вернуться</button>
<button onclick="top.frames['gameframe'].location = 'city.php?cp'">Вернуться</button>
</div>
<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>
<?php if ($_SESSION['receiverName']): ?>
<?php if ($_SESSION['receiverName'] ?? ''): ?>
Получатель: <?= Nick::id($receiverId)->full() ?>
<a href="?change">Сменить</a>
<table width=100%>
@ -136,4 +124,4 @@ Template::header('Почта');
<form method="post">
<input name='receiverName' placeholder="Логин получателя"> <input type=submit value='Применить'>
</form>
<?php endif ?>
<?php endif ?>

View File

@ -79,25 +79,21 @@ $rhar = [
"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"));
$kol_pl = mysql_num_rows(mysql_query("SELECT `id` FROM `users` WHERE `bot` = 0 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"));
$tur_data = mysql_fetch_array(mysql_query("SELECT * FROM `deztow_turnir` WHERE `active` = TRUE"));
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 ($_SESSION['timei'] - time() <= 0) {
$_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"));
} else {
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `ashop` WHERE `id` = '" . $obj['iteam_id'] . "' LIMIT 1"));
}
$dress = mysql_fetch_array(mysql_query("SELECT * FROM `shop` WHERE `id` = '" . $obj['iteam_id'] . "' LIMIT 1"));
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("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 {
echo '<font color=red>Предмет не найден. Сообщите Администрации данный код #' . $obj['iteam_id'] . '#</font>';
}