Compare commits
13 Commits
04d1f57a94
...
796c004a22
Author | SHA1 | Date | |
---|---|---|---|
796c004a22 | |||
|
dc145f089c | ||
|
d38d62c5b5 | ||
|
f1b9ce6a45 | ||
|
6d9f314e1b | ||
|
687e65f251 | ||
|
ff1afa7a7a | ||
|
c666e3e8a2 | ||
|
0e73bcb1ae | ||
|
c05c3298f1 | ||
|
8a9bb64b53 | ||
|
4251027063 | ||
|
5dce7c644f |
@ -7,7 +7,7 @@
|
||||
|
||||
session_start();
|
||||
//require_once '../functions.php';
|
||||
$user = new User($_SESSION['uid']);
|
||||
$user = new \Battles\User($_SESSION['uid']);
|
||||
if (!$user->admin) {
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
exit;
|
||||
@ -65,7 +65,7 @@ if ($_POST['ali']) { //Что делает эта штука?
|
||||
}
|
||||
|
||||
$aligns = db::c()->query('SELECT `img`,`align`,`name` FROM `aligns` ORDER BY `align`');
|
||||
Template::header('ᐰdminка');
|
||||
\Battles\Template::header('ᐰdminка');
|
||||
?>
|
||||
<link rel=stylesheet href="/css/admin.css">
|
||||
<form method='post'>
|
||||
@ -554,7 +554,7 @@ foreach ($moj as $k => $v) {
|
||||
$magic_name = "Лечение";
|
||||
break;
|
||||
case "al_neut_power":
|
||||
$script_name = "RunMagicSelf";
|
||||
$script_name = "RunmagicSelf";
|
||||
$magic_name = "Сила нейтралитета";
|
||||
break;
|
||||
case "ct1":
|
||||
@ -733,7 +733,7 @@ echo "</div>";
|
||||
<button onclick="runmagic3('Test','0','0','0')">runmagic3</button>
|
||||
<button onclick="runmagic4('Test','0','0','0')">runmagic4</button>
|
||||
<button onclick="runmagicf('Test','0','0','0')">runmagicf</button>
|
||||
<button onclick="RunMagicSelf('Test','0','0','0')">RunMagicSelf</button>
|
||||
<button onclick="RunmagicSelf('Test','0','0','0')">RunmagicSelf</button>
|
||||
<button onclick="vipad('Test','0','0','0')">vipad</button>
|
||||
<button onclick="runmagicgold('Test','0','0','0')">new window test</button>
|
||||
|
||||
@ -960,7 +960,7 @@ if ($_POST['login'] && $_POST['krest']) {
|
||||
Hint3Closed = false;
|
||||
}
|
||||
|
||||
function RunMagicSelf(title, magic, name) {
|
||||
function RunmagicSelf(title, magic, name) {
|
||||
document.all("hint3").innerHTML = '<table width=100% cellspacing=1 cellpadding=0 bgcolor=CCC3AA><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</b></BIG></td></tr><tr><td colspan=2>' +
|
||||
'<form action="admin.php" method=POST><table width=100% cellspacing=0 cellpadding=2 bgcolor=FFF6DD><tr><td colspan=2><INPUT TYPE=hidden name=sd4 value="<?php echo @$user['id']; ?>"> <INPUT TYPE=hidden NAME="use" value="' + magic + '">' +
|
||||
'Использовать возможность "Сила Нейтралитета?"</TD></TR><TR><TD align=left><INPUT TYPE=hidden NAME="' + name + '" VALUE="<?php echo @$user['login']; ?>">' +
|
||||
|
@ -45,7 +45,7 @@ if ($del) {
|
||||
}
|
||||
db::c()->query('DELETE FROM `inventory` WHERE `id` = ?i', $del);
|
||||
}
|
||||
Template::header('ᐰdminка инвентаря');
|
||||
\Battles\Template::header('ᐰdminка инвентаря');
|
||||
?>
|
||||
<h1>Администрирование инвентаря <?php if (isset($_SESSION['player_name'])) echo $_SESSION['player_name']; ?></h1>
|
||||
<table class='adm'>
|
||||
|
@ -79,7 +79,7 @@ if ($get == 'exit') {
|
||||
db::c()->query('UPDATE `users`,`online` SET `users`.`room` = 2702, `online`.`room` = 2702 WHERE `users`.`id` = ?i AND `online`.`id` = ?i', $user->id, $user->id);
|
||||
header('Location: city.php');
|
||||
}
|
||||
Template::header('Академия');
|
||||
\Battles\Template::header('Академия');
|
||||
?>
|
||||
<link href="css/secondary.css" rel="stylesheet"/>
|
||||
<div style="float: right;">
|
||||
|
@ -126,7 +126,7 @@ if (isset($_GET['append'])) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Template::header('Арена Ангелов');
|
||||
\Battles\Template::header('Арена Ангелов');
|
||||
?>
|
||||
<link href="css/fight.css" rel="stylesheet"/>
|
||||
<style>
|
||||
|
111
bank.php
111
bank.php
@ -16,77 +16,70 @@ if ($user->battle != 0) {
|
||||
header('location: fbattle.php');
|
||||
exit;
|
||||
}
|
||||
const BANK_SESSION_NAME = "bankid";
|
||||
const SUCCESS = "Успешная операция!";
|
||||
$get = urldecode(filter_input(INPUT_SERVER, 'QUERY_STRING'));
|
||||
if ($get == 'exit') {
|
||||
$_SESSION[BANK_SESSION_NAME] = null;
|
||||
}
|
||||
$bank = new Bank($user->id);
|
||||
|
||||
$bank = new \Battles\Bank($user->id);
|
||||
$status = '';
|
||||
|
||||
if (isset($_POST['userlogin'])) {
|
||||
$_SESSION[BANK_SESSION_NAME] = $bank->user_id;
|
||||
}
|
||||
if ($_SESSION[BANK_SESSION_NAME]) {
|
||||
$toid = (int)$_POST['to_id'] ?? 0;
|
||||
$summa = (int)$_POST['summa'] ?? 0;
|
||||
$submit = $_POST['action'] ?? '';
|
||||
// Зачисление кредитов на счёт.
|
||||
$toid = $_POST['to_id'] ?? 0;
|
||||
$summa = $_POST['summa'] ?? 0;
|
||||
$submit = $_POST['action'] ?? '';
|
||||
try {
|
||||
// Зачисление кредитов на счёт.
|
||||
if ($submit === 'depositMoney' && $summa) {
|
||||
$bank->depositMoney($summa);
|
||||
$operation = $bank->depositMoney($summa);
|
||||
$user->money = $operation['walletMoney'];
|
||||
$bank->setMoney($operation['bankMoney']);
|
||||
$status = SUCCESS;
|
||||
}
|
||||
// Снятие кредитов со счёта.
|
||||
// Снятие кредитов со счёта.
|
||||
if ($submit === 'withdrawMoney' && $summa) {
|
||||
$bank->withdrawMoney($summa);
|
||||
$operation = $bank->withdrawMoney($summa);
|
||||
$user->money = $operation['walletMoney'];
|
||||
$bank->setMoney($operation['bankMoney']);
|
||||
$status = SUCCESS;
|
||||
}
|
||||
// Перевод кредитов на другой счёт.
|
||||
// Перевод кредитов на другой счёт.
|
||||
if ($submit === 'sendMoney' && $summa && $toid) {
|
||||
$bank->sendMoney($toid, $summa);
|
||||
$user->money = $bank->sendMoney($toid, $summa);
|
||||
$status = SUCCESS;
|
||||
}
|
||||
} catch (\Exceptions\GameException $e) {
|
||||
echo 'Банковская ошибка!';
|
||||
} finally {
|
||||
unset($submit, $summa, $toid);
|
||||
}
|
||||
Template::header('Банк');
|
||||
\Battles\Template::header('Банк');
|
||||
?>
|
||||
<link href="css/secondary.css" rel="stylesheet"/>
|
||||
<script src="js/main.js"></script>
|
||||
<h1>Банк</h1>
|
||||
<?php if (!$_SESSION[BANK_SESSION_NAME]): ?>
|
||||
<a href=# onclick=hrefToFrame('city.php?strah')> ← выйти из банка</a>
|
||||
<form method="post"><input type="submit" name="userlogin" value="Управление счётом"></form>
|
||||
<?php else: ?>
|
||||
<p><a href="?exit"> ← выйти из счёта</a></p>
|
||||
<div><?= $status ?></div>
|
||||
<div class="appblock appblock-main">
|
||||
<span class="legend">Cчет №<?= $bank->user_id ?></span>
|
||||
<span class="wrap">На счету: <span class="num"><?= $bank->money ?></span></span>
|
||||
<hr>
|
||||
<span class="wrap">На руках: <span class="num"><?= $user['money'] ?></span></span>
|
||||
</div>
|
||||
<div class="appblock">
|
||||
<span class="legend">Работа со счётом</span>
|
||||
<form method="post">
|
||||
<input size="10" name="summa" placeholder="Сумма">
|
||||
<input type="hidden" name="action" value="depositMoney">
|
||||
<input type="submit" value="Положить деньги">
|
||||
</form>
|
||||
<form method="post">
|
||||
<input size="10" name="summa" placeholder="Сумма">
|
||||
<input type="hidden" name="action" value="withdrawMoney">
|
||||
<input type="submit" value="Снять деньги">
|
||||
</form>
|
||||
</div>
|
||||
<div class="appblock">
|
||||
<span class="legend">Перевод кредитов</span>
|
||||
<form method="post">
|
||||
<input size="10" name="summa" placeholder="Сумма">
|
||||
<input size="10" name="to-id" placeholder="Cчёт"><br>
|
||||
<input type="hidden" name="action" value="sendMoney">
|
||||
<input type="submit" value="Перевести кредиты">
|
||||
</form>
|
||||
<span class="wrap">Комиссия: <?= Config::$bank_comission * 100 ?>% от переводимой суммы, но не менее 1 кр.</span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<link href="css/secondary.css" rel="stylesheet"/>
|
||||
<script src="js/main.js"></script>
|
||||
<?php \Battles\Template::buildingTop(\Battles\Rooms::$roomNames[29], 'strah') ?>
|
||||
<div><?= $status ?></div>
|
||||
<div class="appblock appblock-main">
|
||||
<span class="wrap">На счету: <span class="num"><?= $bank->getMoney() ?></span></span>
|
||||
<hr>
|
||||
<span class="wrap">На руках: <span class="num"><?= $user->money ?></span></span>
|
||||
</div>
|
||||
<div class="appblock">
|
||||
<span class="legend">Работа со счётом</span>
|
||||
<form method="post">
|
||||
<input size="10" name="summa" placeholder="Сумма">
|
||||
<input type="hidden" name="action" value="depositMoney">
|
||||
<input type="submit" value="Положить деньги">
|
||||
</form>
|
||||
<form method="post">
|
||||
<input size="10" name="summa" placeholder="Сумма">
|
||||
<input type="hidden" name="action" value="withdrawMoney">
|
||||
<input type="submit" value="Снять деньги">
|
||||
</form>
|
||||
</div>
|
||||
<div class="appblock">
|
||||
<span class="legend">Перевод кредитов</span>
|
||||
<form method="post">
|
||||
<input size="10" name="summa" placeholder="Сумма">
|
||||
<input size="10" name="to-id" placeholder="Cчёт"><br>
|
||||
<input type="hidden" name="action" value="sendMoney">
|
||||
<input type="submit" value="Перевести кредиты">
|
||||
</form>
|
||||
<span class="wrap">Комиссия: <?= Config::$bank_commission * 100 ?>% от переводимой суммы, но не менее 1 кр.</span>
|
||||
</div>
|
||||
|
@ -11,7 +11,7 @@ $ch = $_GET['ch'] ?? null;
|
||||
if ($header) {
|
||||
exit;
|
||||
} elseif ($ch != null) {
|
||||
Template::header('buttons');
|
||||
\Battles\Template::header('buttons');
|
||||
?>
|
||||
<script language="JavaScript" src="js/ch.js"></script>
|
||||
<script language="JavaScript" src="js/sl2.js"></script>
|
||||
@ -235,7 +235,7 @@ if ($header) {
|
||||
<div id="oMenu" style="position: absolute; border:1px solid #666; background-color:#CCC; display:none; "></div>
|
||||
<div id="ClearMenu" style="position: absolute; border:1px solid #666; background-color: #e2e0e0; display: none;"></div>
|
||||
|
||||
<? } else { Template::header(buttons); ?>
|
||||
<? } else { \Battles\Template::header('buttons'); ?>
|
||||
<script language="JavaScript" src="js/chat.js"></script>
|
||||
<script language="JavaScript">
|
||||
|
||||
|
@ -104,7 +104,7 @@ if ($map_user['Up'] == 1) {
|
||||
onclick="location.href='?move=true&Dir=Up';" alt="Вверх">
|
||||
MAP;
|
||||
}
|
||||
Template::header('forest');
|
||||
\Battles\Template::header('forest');
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="css/hostel.css"/>
|
||||
<style>
|
||||
|
@ -103,7 +103,7 @@ if ($in_haos['status'] == 2) {
|
||||
}
|
||||
}
|
||||
$in_haos = mysql_fetch_array(mysql_query("SELECT * FROM `cit_haos_status` WHERE `id` = '{$user['id']}' LIMIT 1;"));
|
||||
Template::header('Цитадель Хаоса');
|
||||
\Battles\Template::header('Цитадель Хаоса');
|
||||
?>
|
||||
<!-- JS -->
|
||||
<script>
|
||||
|
@ -130,7 +130,7 @@ if (!$ch_rooms[$in_haos['room']]) {
|
||||
mysql_query("UPDATE `cit_haos_var` SET bots='',players='' WHERE group='" . $in_haos['group'] . "'; ");
|
||||
header('location: c_haos.php');
|
||||
}
|
||||
Template::header('c_haos_in');
|
||||
\Battles\Template::header('c_haos_in');
|
||||
?>
|
||||
<script>
|
||||
function refreshPeriodic() {
|
||||
|
@ -121,7 +121,7 @@ if ($_POST['attack']) {
|
||||
|
||||
|
||||
//старт боя - конец
|
||||
Template::header('Городской Парк');
|
||||
\Battles\Template::header('Городской Парк');
|
||||
?>
|
||||
<script>
|
||||
function refreshPeriodic() {
|
||||
|
@ -63,7 +63,7 @@ if ($user->room == 403) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Template::header('canalizaciya');
|
||||
\Battles\Template::header('canalizaciya');
|
||||
|
||||
$ros = mysql_query("SELECT * FROM `labirint` WHERE `user_id`='{$_SESSION['uid']}'");
|
||||
$mir = mysql_fetch_array($ros);
|
||||
|
2
cave.php
2
cave.php
@ -915,7 +915,7 @@ $standingon = $map[$y * 2][$x * 2];
|
||||
foreach ($party as $k => $v) {
|
||||
$map[$v['y'] * 2][$v['x'] * 2] = "u/" . $v['user'];
|
||||
}
|
||||
Template::header('cave');
|
||||
\Battles\Template::header('cave');
|
||||
?>
|
||||
<style>
|
||||
body {
|
||||
|
2
ch.php
2
ch.php
@ -112,7 +112,7 @@ if (isset($_GET['online']) && $_GET['online'] != null) {
|
||||
$ch4 = '_passive';
|
||||
$ch5 = '_passive';
|
||||
}
|
||||
Template::header(sprintf('%s (%s)', $rooms[$user->room], mysql_num_rows($data)));
|
||||
\Battles\Template::header(sprintf('%s (%s)', $rooms[$user->room], mysql_num_rows($data)));
|
||||
?>
|
||||
<script>
|
||||
function fastshow(content) {
|
||||
|
2
chat.php
2
chat.php
@ -50,7 +50,7 @@ function show_messages()
|
||||
|
||||
|
||||
show_messages();
|
||||
Template::header('chat');
|
||||
\Battles\Template::header('chat');
|
||||
?>
|
||||
<style>
|
||||
form {
|
||||
|
92
city.php
92
city.php
@ -30,28 +30,28 @@ switch ($location[0]) {
|
||||
default:
|
||||
break;
|
||||
case 'cp':
|
||||
Travel::toRoom(20,$user->room);
|
||||
Battles\Travel::toRoom(20,$user->room);
|
||||
break;
|
||||
case 'strah':
|
||||
Travel::toRoom(21,$user->room);
|
||||
Battles\Travel::toRoom(21,$user->room);
|
||||
break;
|
||||
case 'bps':
|
||||
Travel::toRoom(26,$user->room);
|
||||
Battles\Travel::toRoom(26,$user->room);
|
||||
break;
|
||||
case 'ps':
|
||||
Travel::toRoom(51,$user->room);
|
||||
Battles\Travel::toRoom(51,$user->room);
|
||||
break;
|
||||
case 'zaliv':
|
||||
Travel::toRoom(2111,$user->room);
|
||||
Battles\Travel::toRoom(2111,$user->room);
|
||||
break;
|
||||
case 'zamk':
|
||||
Travel::toRoom(2601,$user->room);
|
||||
Battles\Travel::toRoom(2601,$user->room);
|
||||
break;
|
||||
case 'abog':
|
||||
Travel::toRoom(2655,$user->room);
|
||||
Battles\Travel::toRoom(2655,$user->room);
|
||||
break;
|
||||
case 'torg':
|
||||
Travel::toRoom(2702,$user->room);
|
||||
Battles\Travel::toRoom(2702,$user->room);
|
||||
break;
|
||||
case 'got':
|
||||
if ($user->room == 20) {
|
||||
@ -59,34 +59,34 @@ switch ($location[0]) {
|
||||
default:
|
||||
break;
|
||||
case 'level1':
|
||||
Travel::toRoom(1,$user->room);
|
||||
Battles\Travel::toRoom(1,$user->room);
|
||||
break;
|
||||
case 'level7':
|
||||
Travel::toRoom(21,$user->room);
|
||||
Battles\Travel::toRoom(21,$user->room);
|
||||
break;
|
||||
case 'level8':
|
||||
Travel::toRoom(26,$user->room);
|
||||
Battles\Travel::toRoom(26,$user->room);
|
||||
break;
|
||||
case 'level13':
|
||||
header('location: quest_room.php');
|
||||
break;
|
||||
case 'level222':
|
||||
Travel::toRoom(2702,$user->room);
|
||||
Battles\Travel::toRoom(2702,$user->room);
|
||||
break;
|
||||
case 'level17':
|
||||
Travel::toRoom(50,$user->room);
|
||||
Battles\Travel::toRoom(50,$user->room);
|
||||
break;
|
||||
case 'level2':
|
||||
Travel::toRoom(22,$user->room);
|
||||
Battles\Travel::toRoom(22,$user->room);
|
||||
break;
|
||||
case 'level4':
|
||||
Travel::toRoom(23,$user->room);
|
||||
Battles\Travel::toRoom(23,$user->room);
|
||||
break;
|
||||
case 'level6':
|
||||
Travel::toRoom(27,$user->room);
|
||||
Battles\Travel::toRoom(27,$user->room);
|
||||
break;
|
||||
case 'level3':
|
||||
Travel::toRoom(25,$user->room);
|
||||
Battles\Travel::toRoom(25,$user->room);
|
||||
break;
|
||||
}
|
||||
} elseif ($user->room == 21) {
|
||||
@ -94,25 +94,25 @@ switch ($location[0]) {
|
||||
default:
|
||||
break;
|
||||
case 'level4':
|
||||
Travel::toRoom(20,$user->room);
|
||||
Battles\Travel::toRoom(20,$user->room);
|
||||
break;
|
||||
case 'level3':
|
||||
Travel::toRoom(2111,$user->room);
|
||||
Battles\Travel::toRoom(2111,$user->room);
|
||||
break;
|
||||
case 'level13':
|
||||
Travel::toRoom(34,$user->room);
|
||||
Battles\Travel::toRoom(34,$user->room);
|
||||
break;
|
||||
case 'level5':
|
||||
Travel::toRoom(29,$user->room);
|
||||
Battles\Travel::toRoom(29,$user->room);
|
||||
break;
|
||||
case 'level16':
|
||||
Travel::toRoom(31,$user->room);
|
||||
Battles\Travel::toRoom(31,$user->room);
|
||||
break;
|
||||
case 'level14':
|
||||
Travel::toRoom(30,$user->room);
|
||||
Battles\Travel::toRoom(30,$user->room);
|
||||
break;
|
||||
case 'level650':
|
||||
Travel::toRoom(650,$user->room);
|
||||
Battles\Travel::toRoom(650,$user->room);
|
||||
break;
|
||||
}
|
||||
} elseif ($user->room == 2111) {
|
||||
@ -120,17 +120,17 @@ switch ($location[0]) {
|
||||
default:
|
||||
break;
|
||||
case 'level1':
|
||||
Travel::toRoom(21,$user->room);
|
||||
Battles\Travel::toRoom(21,$user->room);
|
||||
break;
|
||||
case 'level203':
|
||||
Travel::toRoom(1055,$user->room);
|
||||
Battles\Travel::toRoom(1055,$user->room);
|
||||
break;
|
||||
case 'level1000':
|
||||
Travel::toRoom(620,$user->room);
|
||||
Battles\Travel::toRoom(620,$user->room);
|
||||
break;
|
||||
case 'room666':
|
||||
//Нет на карте
|
||||
//Travel::toRoom(666,$user->room);
|
||||
//Battles\Travel::toRoom(666,$user->room);
|
||||
break;
|
||||
}
|
||||
} elseif ($user->room == 2601) {
|
||||
@ -138,19 +138,19 @@ switch ($location[0]) {
|
||||
default:
|
||||
break;
|
||||
case 'level4':
|
||||
Travel::toRoom(26,$user->room);
|
||||
Battles\Travel::toRoom(26,$user->room);
|
||||
break;
|
||||
case 'level55':
|
||||
Travel::toRoom(2655,$user->room);
|
||||
Battles\Travel::toRoom(2655,$user->room);
|
||||
break;
|
||||
case 'level1':
|
||||
Travel::toRoom(37,$user->room);
|
||||
Battles\Travel::toRoom(37,$user->room);
|
||||
break;
|
||||
case 'level1051':
|
||||
Travel::toRoom(1051,$user->room);
|
||||
Battles\Travel::toRoom(1051,$user->room);
|
||||
break;
|
||||
case 'level5':
|
||||
Travel::toRoom(404,$user->room);
|
||||
Battles\Travel::toRoom(404,$user->room);
|
||||
break;
|
||||
}
|
||||
} elseif ($user->room == 2701) {
|
||||
@ -158,10 +158,10 @@ switch ($location[0]) {
|
||||
default:
|
||||
break;
|
||||
case 'level1':
|
||||
Travel::toRoom(2111,$user->room);
|
||||
Battles\Travel::toRoom(2111,$user->room);
|
||||
break;
|
||||
case 'level2':
|
||||
Travel::toRoom(402,$user->room);
|
||||
Battles\Travel::toRoom(402,$user->room);
|
||||
break;
|
||||
}
|
||||
} elseif ($user->room == 2702) {
|
||||
@ -169,10 +169,10 @@ switch ($location[0]) {
|
||||
default:
|
||||
break;
|
||||
case 'level10':
|
||||
Travel::toRoom(20,$user->room);
|
||||
Battles\Travel::toRoom(20,$user->room);
|
||||
break;
|
||||
case 'level6':
|
||||
Travel::toRoom(61,$user->room);
|
||||
Battles\Travel::toRoom(61,$user->room);
|
||||
break;
|
||||
}
|
||||
} elseif ($user->room == 2655) {
|
||||
@ -180,10 +180,10 @@ switch ($location[0]) {
|
||||
default:
|
||||
break;
|
||||
case 'level10':
|
||||
Travel::toRoom(2601,$user->room);
|
||||
Battles\Travel::toRoom(2601,$user->room);
|
||||
break;
|
||||
case 'level2055':
|
||||
Travel::toRoom(603,$user->room);
|
||||
Battles\Travel::toRoom(603,$user->room);
|
||||
break;
|
||||
}
|
||||
} elseif ($user->room == 26) {
|
||||
@ -191,25 +191,25 @@ switch ($location[0]) {
|
||||
default:
|
||||
break;
|
||||
case 'level4':
|
||||
Travel::toRoom(20,$user->room);
|
||||
Battles\Travel::toRoom(20,$user->room);
|
||||
break;
|
||||
case 'level3':
|
||||
Travel::toRoom(2601,$user->room);
|
||||
Battles\Travel::toRoom(2601,$user->room);
|
||||
break;
|
||||
case 'level660':
|
||||
Travel::toRoom(660,$user->room);
|
||||
Battles\Travel::toRoom(660,$user->room);
|
||||
break;
|
||||
case 'level7':
|
||||
Travel::toRoom(777,$user->room);
|
||||
Battles\Travel::toRoom(777,$user->room);
|
||||
break;
|
||||
case 'level56':
|
||||
Travel::toRoom(401,$user->room);
|
||||
Battles\Travel::toRoom(401,$user->room);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Template::header('city');
|
||||
\Battles\Template::header('city');
|
||||
echo sprintf('<div style="text-align: right;">Сейчас в игре: %s игроков.></div>', $online->getNumRows());
|
||||
if (in_array($user->room, [20, 21, 26, 2601, 2655, 2111, 2701, 2702])) {
|
||||
/* Улицы:
|
||||
@ -222,5 +222,5 @@ if (in_array($user->room, [20, 21, 26, 2601, 2655, 2111, 2701, 2702])) {
|
||||
* 2701 С ещё одним ристалищем?
|
||||
* 2702 Торговая
|
||||
*/
|
||||
City::showStreet($user->room);
|
||||
Battles\City::showStreet($user->room);
|
||||
}
|
2
clan.php
2
clan.php
@ -100,7 +100,7 @@ if ($login && $action == 'edit_status') {
|
||||
}
|
||||
|
||||
$clan_memberlist = db::c()->query('SELECT `id`, `login`, `status`, `level`, `room`, `align`, (select `id` from `online` WHERE `date` >= ?i AND `id` = users.`id`) AS `online` FROM `users` WHERE `klan` = ?i ORDER BY `online` DESC , `login` ASC', (time() - 60), $clanRow['id']);
|
||||
Template::header('clan');
|
||||
\Battles\Template::header('clan');
|
||||
?>
|
||||
<div>
|
||||
<button onclick="location.href='main.php'">Вернуться</button>
|
||||
|
@ -37,7 +37,7 @@ if ($_POST['add_zay']) {
|
||||
mysql_query("INSERT INTO `clan_castle` VALUES ('{$user['id']}','{$user['klan']}');");
|
||||
exit("<script>location.href='clan_castle.php';</script>");
|
||||
}
|
||||
Template::header('Замок Мэра');
|
||||
\Battles\Template::header('Замок Мэра');
|
||||
?>
|
||||
<script>
|
||||
function refreshPeriodic() {
|
||||
|
132
clan_create.php
132
clan_create.php
@ -10,23 +10,26 @@ if ($user->room != 30) {
|
||||
header("Location: main.php");
|
||||
exit;
|
||||
}
|
||||
$klanName = $_POST['klanname'] ?? '';
|
||||
$klanAbbr = $_POST['klanabbr'] ?? '';
|
||||
$klanDescr = $_POST['klandescr'] ?? '';
|
||||
$userClan = db::c()->query('SELECT short_name, full_name, info FROM clans where owner_id = ?i', $user->id)->fetch_object();
|
||||
$clanFullName = $_POST['clan_full_name'] ?? '';
|
||||
$clanShortName = $_POST['clan_short_name'] ?? '';
|
||||
$clanInfo = $_POST['clan_info'] ?? '';
|
||||
$userBank = new \Battles\Bank($user->id);
|
||||
if ($clanFullName && $clanShortName && $clanInfo && !$userClan) {
|
||||
|
||||
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);
|
||||
$eff = db::c()->query('SELECT 1 FROM users_effects WHERE type = 20 AND owner_id = ?i', $user->id);
|
||||
$name_check = db::c()->query('SELECT owner_id FROM clans WHERE full_name = "?s" OR short_name = "?s"', $clanFullName, $clanShortName);
|
||||
$errorMessage = [];
|
||||
|
||||
if (Config::$clan_register_lock) {
|
||||
$errorMessage[10] = 'Регистрация кланов закрыта! <BR>';
|
||||
}
|
||||
if ($user->align) {
|
||||
$errorMessage[0] = 'Вы уже имеете направленность!. <BR>';
|
||||
}
|
||||
if ($user->clan) {
|
||||
$errorMessage[1] = 'Вы уже состоите в клане!. <BR>';
|
||||
}
|
||||
if (Config::$clan_register_cost >= $user->money) {
|
||||
if (Config::$clan_register_cost >= $userBank->getMoney()) {
|
||||
$errorMessage[2] = 'Не хватает денег на регистрацию клана. <BR>';
|
||||
}
|
||||
if (!$eff) {
|
||||
@ -35,67 +38,62 @@ if ($klanName && $klanAbbr && $klanDescr) {
|
||||
if (!$name_check) {
|
||||
$errorMessage[4] = 'Клан с такими данными уже существует.<br>';
|
||||
}
|
||||
|
||||
if (!$errorMessage && !Config::$clan_register_lock) {
|
||||
// db::c()->query('INSERT INTO `reg_klan` (owner, name, abr, descr) VALUES (?i,"?s","?s","?s")',
|
||||
// $user->id, $klanName, $klanAbbr, $klanDescr);
|
||||
$user->money -= Config::$clan_register_cost;
|
||||
Bank::setBankMoney($user->money, $user->id);
|
||||
echo 'Заявка на регистрацию клана подана.';
|
||||
err('Проверки пройдены, но клан регистрировать пока нельзя!');
|
||||
if (!$errorMessage || $user->admin) {
|
||||
try {
|
||||
db::c()->query('INSERT INTO clans (owner_id, full_name, short_name, info) VALUES (?i,"?s","?s","?s")', $user->id, $clanFullName, $clanShortName, $clanInfo);
|
||||
$userBank->setMoney($userBank->getMoney() - Config::$clan_register_cost);
|
||||
Bank::setBankMoney($userBank->getMoney(), $user->id, 'clanRegister');
|
||||
// Заглушка для отображения данных по только что зарегистрированному клану, когда запрос в базу в начале файла ещё не проходит.
|
||||
$userClan = new stdClass();
|
||||
$userClan->full_name = $clanFullName;
|
||||
$userClan->short_name = $clanShortName;
|
||||
$userClan->info = $clanInfo;
|
||||
unset($clanShortName, $clanFullName, $clanInfo);
|
||||
echo 'Заявка на регистрацию клана подана.';
|
||||
} catch (Throwable $exception) {
|
||||
echo '<div style="background-color: #fae0e0;"><span class="error">Ошибка записи в базу!</span><br>' . $exception . '</div>';
|
||||
}
|
||||
} else {
|
||||
foreach ($errorMessage as $error) {
|
||||
echo sprintf('<span class="error">%s</span>', $error);
|
||||
}
|
||||
}
|
||||
}
|
||||
Template::header('Регистратура кланов');
|
||||
?>
|
||||
<script>
|
||||
function leave() {
|
||||
top.frames['main'].location = 'city.php?strah'
|
||||
}
|
||||
</script>
|
||||
<h1>Регистратура кланов</h1>
|
||||
<a href=# onclick=leave()> ← выйти из регистратуры</a>
|
||||
<?php
|
||||
if ($user->admin) {
|
||||
$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) {
|
||||
echo "<TR>
|
||||
<TD>", $clanreg_row['date'], "</TD>
|
||||
<TD>", $clanreg_row['name'], "</TD>
|
||||
<TD>", $clanreg_row['abbr'], "</TD>
|
||||
<TD>", Nick::id($clanreg_row['owner'])->full(), "</TD>
|
||||
<TD>", nl2br($clanreg_row['descr']), "</TD>
|
||||
</TR>";
|
||||
}
|
||||
echo '</table>';
|
||||
}
|
||||
?>
|
||||
Для регистрации клана необходимо иметь:
|
||||
<ol>
|
||||
<li>Проверку на чистоту.
|
||||
<li>10000 кредитов на банковском счёте.
|
||||
</ol>
|
||||
Поле информации не обазательное. Но его содержимое может серьёзно повысить шансы на регистрацию клана.<BR>
|
||||
Заявку на регистрацию подает глава клана.
|
||||
<form method="post">
|
||||
<fieldset style="display: inline;">
|
||||
<legend>Заявка на регистрацию</legend>
|
||||
<input size=30 name="klanname" placeholder="Название клана" value="<?= $klanName ?>">
|
||||
<input size=30 name="klanabbr" placeholder="Английская аббревиатура" value="<?= $klanAbbr ?>"><BR>
|
||||
<BR>
|
||||
<textarea cols=80 rows=10 name="klandescr"
|
||||
placeholder="Информация о клане для энциклопедии"><?= nl2br($klanDescr) ?></textarea><BR>
|
||||
<input type="submit" value="Подать заявку">
|
||||
</fieldset>
|
||||
</form>
|
||||
\Battles\Template::header(Rooms::$roomNames[30]);
|
||||
\Battles\Template::buildingTop(Rooms::$roomNames[30], 'strah');
|
||||
if ($userClan): ?>
|
||||
<div>
|
||||
<fieldset style="display: inline;">
|
||||
<legend>Заявка на регистрацию</legend>
|
||||
<input size=30 disabled value="<?= $userClan->full_name ?>">
|
||||
<input size=30 disabled value="<?= $userClan->short_name ?>"><BR>
|
||||
<BR>
|
||||
<textarea cols=80 rows=10 disabled><?= nl2br($userClan->info) ?></textarea><BR>
|
||||
<button disabled>Заявка подана и рассматривается</button>
|
||||
</fieldset>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div>
|
||||
<form method="post">
|
||||
<fieldset style="display: inline;">
|
||||
<legend>Заявка на регистрацию</legend>
|
||||
<input size=30 name="clan_full_name" placeholder="Название клана" value="<?= $clanFullName ?>">
|
||||
<input size=30 name="clan_short_name" maxlength="5" placeholder="Английская аббревиатура"
|
||||
value="<?= $clanShortName ?>"><BR>
|
||||
<BR>
|
||||
<textarea cols=80 rows=10 name="clan_info"
|
||||
placeholder="Информация о клане для энциклопедии"><?= nl2br($clanInfo) ?></textarea><BR>
|
||||
<input type="submit" value="Подать заявку">
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
Для регистрации клана необходимо иметь:
|
||||
<ol>
|
||||
<li>Проверку на чистоту. У вас её нет.
|
||||
<li>10000 кредитов на банковском счёте. У вас на счету <?= $userBank->getMoney() ?>.
|
||||
</ol>
|
||||
Поле информации не обазательное. Но его содержимое может серьёзно повысить шансы на регистрацию клана.<BR>
|
||||
Заявку на регистрацию подает глава клана.
|
||||
</div>
|
||||
<?php endif; ?>
|
@ -4,7 +4,7 @@
|
||||
* Author: Igor Barkov <lopar.4ever@gmail.com>
|
||||
* Project name: Battles-Game
|
||||
*/
|
||||
Template::header('Список кланов');
|
||||
\Battles\Template::header('Список кланов');
|
||||
include_once "config.php";
|
||||
$claninf = urldecode(filter_input(INPUT_SERVER,'QUERY_STRING'));
|
||||
|
||||
|
191
classes/Bank.php
191
classes/Bank.php
@ -1,191 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Author: lopiu
|
||||
* Date: 03.07.2020
|
||||
* Time: 07:24
|
||||
*/
|
||||
|
||||
class Bank
|
||||
{
|
||||
public $user_id;
|
||||
public $money;
|
||||
private $user;
|
||||
|
||||
const ERROR_NO_MONEY_IN_WALLET = "Ошибка! Нет денег в кошельке!";
|
||||
const ERROR_NO_BANK_ACCOUNT = "Ошибка! Счёта не существует!";
|
||||
const ERROR_NO_MONEY_IN_BANK_ACCOUNT = "Ошибка! Нет денег на счету!";
|
||||
const ERROR_WRONG_AMOUNT = "Ошибка! Сумма должна быть положительной!";
|
||||
const LOG_SEND = "Банк: Перевод средств на другой счёт.";
|
||||
const LOG_RECEIVE = "Банк: Получение средств.";
|
||||
const LOG_DEPOSIT = "Пополнение счёта.";
|
||||
const LOG_WITHDRAW = "Снятие денег со счёта.";
|
||||
|
||||
public function __construct($row)
|
||||
{
|
||||
$bank_row = db::c()->query('SELECT user_id, money FROM bank WHERE user_id = ?i', $row)->fetch_assoc();
|
||||
$this->user = db::c()->query('SELECT money FROM users WHERE id = ?i', $row)->fetch_object();
|
||||
foreach ($this as $key => $value) {
|
||||
if (isset($bank_row[$key])) {
|
||||
$this->$key = $bank_row[$key];
|
||||
}
|
||||
}
|
||||
// Если ВДРУГ у человека нет счёта в банке - создаём.
|
||||
if (empty($this->user_id)) {
|
||||
db::c()->query('INSERT INTO bank (user_id) VALUES (?i)', $row);
|
||||
$this->user_id = $row;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Комиссия: self::BANK_COMISSION от переводимой суммы, но не менее 1 кр.
|
||||
*
|
||||
* @param $amount
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function bankComission($amount)
|
||||
{
|
||||
$bankComission = round($amount * Config::$bank_comission);
|
||||
if ($bankComission < 1) {
|
||||
return 1;
|
||||
} else {
|
||||
return (int)$bankComission;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Пишем банковское событие в лог в БД
|
||||
*
|
||||
* @param $receiverId - user_id получателя
|
||||
* @param $amount
|
||||
* @param $operationType
|
||||
*
|
||||
* @throws \Krugozor\Database\Mysql\Exception
|
||||
*/
|
||||
private function bankLogs($receiverId, $amount, $operationType)
|
||||
{
|
||||
$text = '';
|
||||
if ($operationType === "sendMoney") {
|
||||
$text = self::LOG_SEND . " Комиссия: " . $this->bankComission($amount);
|
||||
} elseif ($operationType === "depositMoney") {
|
||||
$receiverId = $this->user_id;
|
||||
$text = self::LOG_DEPOSIT;
|
||||
} elseif ($operationType === "withdrawMoney") {
|
||||
$receiverId = $this->user_id;
|
||||
$text = self::LOG_WITHDRAW . " Комиссия: " . $this->bankComission($amount);
|
||||
}
|
||||
|
||||
db::c()->query('INSERT INTO `bank_logs` (sender_id, receiver_id, amount, type, text)
|
||||
VALUES (?i, ?i, ?i, "?s", "?s")', $this->user_id, $receiverId, $amount, $operationType, $text);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Перевод денег между бансковскими счетами игроков с банковской комиссией.
|
||||
*
|
||||
* @param int $receiver
|
||||
* @param int $amount
|
||||
*
|
||||
* @return void
|
||||
* @throws \Krugozor\Database\Mysql\Exception
|
||||
*/
|
||||
public function sendMoney(int $receiver, int $amount): void
|
||||
{
|
||||
if ($amount <= 0) {
|
||||
throw new Exception(self::ERROR_WRONG_AMOUNT);
|
||||
}
|
||||
if (!db::c()->query('SELECT 1 FROM bank WHERE user_id = ?i', $receiver)) {
|
||||
throw new Exception(self::ERROR_NO_BANK_ACCOUNT);
|
||||
}
|
||||
$amountWithComission = $amount + $this->bankComission($amount);
|
||||
if ($amountWithComission > $this->money) {
|
||||
throw new Exception(self::ERROR_NO_MONEY_IN_BANK_ACCOUNT);
|
||||
}
|
||||
$this->money -= $amountWithComission;
|
||||
// Снимаем сумму с комиссией у отправителя
|
||||
self::setBankMoney($this->money, $this->user_id);
|
||||
// Отдаём сумму на счёт получателю
|
||||
self::setBankMoney($amount, $receiver);
|
||||
$this->bankLogs($receiver, $amount, "sendMoney");
|
||||
}
|
||||
|
||||
/**
|
||||
* Пополнение банковского счёта игрока
|
||||
*
|
||||
* @param int $amount - сумма
|
||||
*
|
||||
* @return void
|
||||
* @throws \Krugozor\Database\Mysql\Exception
|
||||
*/
|
||||
public function depositMoney(int $amount): void
|
||||
{
|
||||
if ($amount <= 0) {
|
||||
throw new Exception(self::ERROR_WRONG_AMOUNT);
|
||||
}
|
||||
$wallet = db::c()->query('SELECT money FROM users WHERE id = ?i', $this->user_id)->fetch_object();
|
||||
if ($wallet->money < $amount) {
|
||||
throw new Exception(self::ERROR_NO_MONEY_IN_WALLET);
|
||||
}
|
||||
// Забираем деньги из кошелька получателя
|
||||
//todo check it!
|
||||
$this->user->money -= $amount;
|
||||
self::setWalletMoney($this->user->money, $this->user_id);
|
||||
// Отдаём сумму на счёт получателю
|
||||
$this->money += $amount;
|
||||
self::setBankMoney($this->money, $this->user_id);
|
||||
$this->bankLogs(0, $amount, "depositMoney");
|
||||
}
|
||||
|
||||
/**
|
||||
* Снятие денег с банковского счёта игрока с банковской комиссией.
|
||||
*
|
||||
* @param int $amount - сумма
|
||||
*
|
||||
* @return void
|
||||
* @throws \Krugozor\Database\Mysql\Exception
|
||||
*/
|
||||
public function withdrawMoney(int $amount): void
|
||||
{
|
||||
if ($amount <= 0) {
|
||||
throw new Exception(self::ERROR_WRONG_AMOUNT);
|
||||
}
|
||||
$amountWithComission = $amount + $this->bankComission($amount);
|
||||
if ($this->money < $amountWithComission) {
|
||||
throw new Exception(self::ERROR_NO_MONEY_IN_BANK_ACCOUNT);
|
||||
}
|
||||
// Снимаем сумму с комиссией у отправителя
|
||||
$this->money -= $amountWithComission;
|
||||
self::setBankMoney($this->money, $this->user_id);
|
||||
// Отдаём сумму в кошелёк получателя
|
||||
//todo check it!
|
||||
$this->user->money += $amount;
|
||||
self::setWalletMoney($this->user->money, $this->user_id);
|
||||
$this->bankLogs(0, $amount, "withdrawMoney");
|
||||
}
|
||||
|
||||
/**
|
||||
* Установить количество денег на банковском счету.
|
||||
*
|
||||
* @param int $amount - сумма.
|
||||
* @param int $user_id - ID пользователя.
|
||||
*
|
||||
* @throws \Krugozor\Database\Mysql\Exception
|
||||
*/
|
||||
public static function setBankMoney(int $amount, int $user_id): void
|
||||
{
|
||||
db::c()->query('UPDATE bank SET money = ?i WHERE `id` = ?i', $amount, $user_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Установить количество денег на руках.
|
||||
*
|
||||
* @param int $amount - сумма.
|
||||
* @param int $user_id - ID пользователя.
|
||||
*
|
||||
* @throws \Krugozor\Database\Mysql\Exception
|
||||
*/
|
||||
public static function setWalletMoney(int $amount, int $user_id): void
|
||||
{
|
||||
db::c()->query('UPDATE users SET money = ?i WHERE `id` = ?i', $amount, $user_id);
|
||||
}
|
||||
}
|
237
classes/Battles/Bank.php
Normal file
237
classes/Battles/Bank.php
Normal file
@ -0,0 +1,237 @@
|
||||
<?php
|
||||
/**
|
||||
* Author: lopiu
|
||||
* Date: 03.07.2020
|
||||
* Time: 07:24
|
||||
*/
|
||||
namespace Battles;
|
||||
|
||||
class Bank
|
||||
{
|
||||
public $user_id;
|
||||
private $money;
|
||||
private $user;
|
||||
|
||||
const ERROR_NO_MONEY_IN_WALLET = "Ошибка! Нет денег в кошельке!";
|
||||
const ERROR_NO_BANK_ACCOUNT = "Ошибка! Счёта не существует!";
|
||||
const ERROR_NO_MONEY_IN_BANK_ACCOUNT = "Ошибка! Нет денег на счету!";
|
||||
const ERROR_WRONG_AMOUNT = "Ошибка! Сумма должна быть положительной!";
|
||||
const LOG = [
|
||||
'sendMoney' => 'Банк: Перевод средств на другой счёт.',
|
||||
'receiveMoney' => 'Банк: Получение средств.',
|
||||
'depositMoney' => 'Пополнение счёта.',
|
||||
'withdrawMoney' => 'Снятие денег со счёта.',
|
||||
'clanRegister' => 'Оплата стоимости регистрации клана.',
|
||||
];
|
||||
|
||||
public function __construct($row)
|
||||
{
|
||||
$bank_row = \db::c()->query('SELECT user_id, money FROM bank WHERE user_id = ?i', $row)->fetch_assoc();
|
||||
$this->user = \db::c()->query('SELECT money FROM users WHERE id = ?i', $row)->fetch_object();
|
||||
foreach ($this as $key => $value) {
|
||||
if (isset($bank_row[$key])) {
|
||||
$this->$key = $bank_row[$key];
|
||||
}
|
||||
}
|
||||
// Если ВДРУГ у человека нет счёта в банке - создаём.
|
||||
if (empty($this->user_id)) {
|
||||
\db::c()->query('INSERT INTO bank (user_id) VALUES (?i)', $row);
|
||||
$this->user_id = $row;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Комиссия: процент от переводимой суммы, но не менее 1 кр. Задаётся в config.php.
|
||||
*
|
||||
* @param int $amount сумма.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function bankCommission(int $amount): int
|
||||
{
|
||||
$bankCommission = round($amount * \Config::$bank_commission);
|
||||
if ($bankCommission < 1) {
|
||||
return 1;
|
||||
} else {
|
||||
return (int)$bankCommission;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Пишем банковское событие в лог в БД
|
||||
*
|
||||
* @param int $receiverId ID получателя.
|
||||
* @param int $amount сумма.
|
||||
* @param string $operationType тип банковской операции.
|
||||
* @param int $senderId ID отправителя (ID игрока, если не указано иное).
|
||||
*
|
||||
* @return void
|
||||
* @throws \Krugozor\Database\Mysql\Exception
|
||||
*/
|
||||
private function bankLogs(int $receiverId, int $amount, string $operationType, int $senderId = 0): void
|
||||
{
|
||||
if (!$senderId) {
|
||||
$senderId = $this->user_id;
|
||||
}
|
||||
$text = self::LOG[$operationType];
|
||||
if ($operationType == "sendMoney") {
|
||||
$text .= " Комиссия: " . $this->bankCommission($amount);
|
||||
} elseif ($operationType == "depositMoney") {
|
||||
$receiverId = $this->user_id;
|
||||
} elseif ($operationType == "withdrawMoney") {
|
||||
$receiverId = $this->user_id;
|
||||
$text .= " Комиссия: " . $this->bankCommission($amount);
|
||||
}
|
||||
|
||||
\db::c()->query('INSERT INTO `bank_logs` (sender_id, receiver_id, amount_result, type, text)
|
||||
VALUES (?i, ?i, ?i, "?s", "?s")', $senderId, $receiverId, $amount, $operationType, $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Перевод денег между банковскими счетами игроков с банковской комиссией.
|
||||
*
|
||||
* @param int $receiver ID получателя.
|
||||
* @param int $amount сумма.
|
||||
*
|
||||
* @return int
|
||||
* @throws \Krugozor\Database\Mysql\Exception
|
||||
*/
|
||||
public function sendMoney(int $receiver, int $amount): int
|
||||
{
|
||||
$receiverWallet = \db::c()->query('SELECT money FROM bank WHERE user_id = ?i', $receiver)->fetch_object();
|
||||
if ($amount <= 0) {
|
||||
throw new \Exceptions\GameException(self::ERROR_WRONG_AMOUNT);
|
||||
}
|
||||
if (!$receiverWallet) {
|
||||
throw new \Exceptions\GameException(self::ERROR_NO_BANK_ACCOUNT);
|
||||
}
|
||||
$amountWithComission = $amount + $this->bankCommission($amount);
|
||||
if ($amountWithComission > $this->money) {
|
||||
throw new \Exceptions\GameException(self::ERROR_NO_MONEY_IN_BANK_ACCOUNT);
|
||||
}
|
||||
// Снимаем сумму с комиссией у отправителя
|
||||
$this->money -= $amountWithComission;
|
||||
self::setBankMoney($this->money, $this->user_id);
|
||||
$this->bankLogs($receiver, $this->money, "sendMoney");
|
||||
// Отдаём сумму на счёт получателю
|
||||
$receiverWallet->money += $amount;
|
||||
self::setBankMoney($receiverWallet->money, $receiver);
|
||||
$this->bankLogs($receiver, $receiverWallet->money, "receiveMoney");
|
||||
// Возвращаем изменившиеся значения
|
||||
return $this->money;
|
||||
}
|
||||
|
||||
/**
|
||||
* Пополнение банковского счёта игрока
|
||||
*
|
||||
* @param int $amount сумма.
|
||||
*
|
||||
* @return array
|
||||
* @throws \Krugozor\Database\Mysql\Exception
|
||||
*/
|
||||
public function depositMoney(int $amount): array
|
||||
{
|
||||
if ($amount <= 0) {
|
||||
throw new \Exceptions\GameException(self::ERROR_WRONG_AMOUNT);
|
||||
}
|
||||
$wallet = \db::c()->query('SELECT money FROM users WHERE id = ?i', $this->user_id)->fetch_object();
|
||||
if ($wallet->money < $amount) {
|
||||
throw new \Exceptions\GameException(self::ERROR_NO_MONEY_IN_WALLET);
|
||||
}
|
||||
// Забираем деньги из кошелька получателя
|
||||
$this->user->money -= $amount;
|
||||
self::setWalletMoney($this->user->money, $this->user_id);
|
||||
// Отдаём сумму на счёт получателю
|
||||
$this->money += $amount;
|
||||
self::setBankMoney($this->money, $this->user_id);
|
||||
$this->bankLogs(0, $this->money, "depositMoney");
|
||||
// Возвращаем изменившиеся значения
|
||||
return [
|
||||
'walletMoney' => $this->user->money,
|
||||
'bankMoney' => $this->money
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Снятие денег с банковского счёта игрока с банковской комиссией.
|
||||
*
|
||||
* @param int $amount сумма.
|
||||
*
|
||||
* @return array
|
||||
* @throws \Krugozor\Database\Mysql\Exception
|
||||
*/
|
||||
public function withdrawMoney(int $amount):array
|
||||
{
|
||||
if ($amount <= 0) {
|
||||
throw new \Exceptions\GameException(self::ERROR_WRONG_AMOUNT);
|
||||
}
|
||||
$amountWithComission = $amount + $this->bankCommission($amount);
|
||||
if ($this->money < $amountWithComission) {
|
||||
throw new \Exceptions\GameException(self::ERROR_NO_MONEY_IN_BANK_ACCOUNT);
|
||||
}
|
||||
// Снимаем сумму с комиссией у отправителя
|
||||
$this->money -= $amountWithComission;
|
||||
self::setBankMoney($this->money, $this->user_id);
|
||||
$this->bankLogs(0, $this->money, "withdrawMoney");
|
||||
// Отдаём сумму в кошелёк получателя
|
||||
$this->user->money += $amount;
|
||||
self::setWalletMoney($this->user->money, $this->user_id);
|
||||
// Возвращаем изменившиеся значения
|
||||
return [
|
||||
'walletMoney' => $this->user->money,
|
||||
'bankMoney' => $this->money
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Установить количество денег на банковском счету.
|
||||
*
|
||||
* @param int $amount сумма.
|
||||
* @param int $user_id ID пользователя.
|
||||
* @param string $operationType Тип операции. По умолчанию пусто. Если ввести, система запишет событие в банковский лог.
|
||||
*
|
||||
* @return void
|
||||
* @throws \Krugozor\Database\Mysql\Exception
|
||||
*/
|
||||
public static function setBankMoney(int $amount, int $user_id, string $operationType = ''): void
|
||||
{
|
||||
try {
|
||||
\db::c()->query('UPDATE bank SET money = ?i WHERE user_id = ?i', $amount, $user_id);
|
||||
if ($operationType) {
|
||||
(new Bank($user_id))->bankLogs(0, $amount, $operationType);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
echo "Не отработал запрос в БД в файле {$e->getFile()}({$e->getLine()})";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Установить количество денег на руках.
|
||||
*
|
||||
* @param int $amount сумма.
|
||||
* @param int $user_id ID пользователя.
|
||||
*
|
||||
* @return void
|
||||
* @throws \Krugozor\Database\Mysql\Exception
|
||||
*/
|
||||
public static function setWalletMoney(int $amount, int $user_id): void
|
||||
{
|
||||
try {
|
||||
\db::c()->query('UPDATE users SET money = ?i WHERE `id` = ?i', $amount, $user_id);
|
||||
} catch (\Throwable $e) {
|
||||
echo "Не отработал запрос в БД в файле {$e->getFile()}({$e->getLine()})";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getMoney()
|
||||
{
|
||||
return $this->money;
|
||||
}
|
||||
|
||||
public function setMoney($amount)
|
||||
{
|
||||
$this->money = $amount;
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
# Date: 26.10.2020 (17:56)
|
||||
namespace Battles;
|
||||
// todo: #10
|
||||
class City
|
||||
{
|
||||
@ -26,7 +27,7 @@ class City
|
||||
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(14, "spring_cap_registratura", 170, 113, self::$roomNames[30]) .
|
||||
self::showBuilding(16, "spring_cap_tower", 5, 315, self::$roomNames[31]) .
|
||||
'</div>';
|
||||
} elseif ($id === 26) {
|
@ -4,7 +4,7 @@
|
||||
* Date: 06.07.2020
|
||||
* Time: 22:41
|
||||
*/
|
||||
|
||||
namespace Battles;
|
||||
class DressedItems
|
||||
{
|
||||
private $DB;
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Battles;
|
||||
class InventoryItem extends Item
|
||||
{
|
||||
private $present;
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Battles;
|
||||
abstract class Item
|
||||
{
|
||||
protected $item_id;
|
@ -1,8 +1,11 @@
|
||||
<?php
|
||||
# Date: 16.09.2020 (08:23)
|
||||
// Магия лечения травм
|
||||
namespace Battles\Magic;
|
||||
use Battles\UserEffects;
|
||||
use Battles\User;
|
||||
|
||||
class CureInjury extends Magic
|
||||
class CureInjury extends magic
|
||||
{
|
||||
private $target;
|
||||
use UserEffects;
|
||||
@ -17,10 +20,10 @@ class CureInjury extends Magic
|
||||
{
|
||||
$this->target = $target;
|
||||
if ($target && $this->isUsable()) {
|
||||
$injury = db::c()->query('SELECT effect_id, type, name FROM users_effects WHERE type IN (11,12,13,14) AND owner_id = ?i ORDER BY type DESC LIMIT 1', $target)->fetch_object();
|
||||
$injury = \db::c()->query('SELECT effect_id, type, name FROM users_effects WHERE type IN (11,12,13,14) AND owner_id = ?i ORDER BY type DESC LIMIT 1', $target)->fetch_object();
|
||||
$targetName = $this->target->login;
|
||||
if (in_array($injury->effect_id, [11, 12, 13, 14]) && $injuryType >= $injury->type) {
|
||||
db::c()->query('DELETE FROM users_effects WHERE effect_id = ?i', $injury->effect_id);
|
||||
\db::c()->query('DELETE FROM users_effects WHERE effect_id = ?i', $injury->effect_id);
|
||||
if (empty($injury->name) || $injury->name == 'Неизвестный эффект') {
|
||||
$injuryName = self::$effectName[$injury->type];
|
||||
} else {
|
||||
@ -28,7 +31,7 @@ class CureInjury extends Magic
|
||||
}
|
||||
return "Вы вылечили повреждение ${injuryName} персонажу ${targetName}.";
|
||||
} elseif ($injury->effect_id && $injuryType == 15) {
|
||||
db::c()->query('DELETE FROM users_effects WHERE type IN (11,12,13,14) AND owner_id = ?i', $target);
|
||||
\db::c()->query('DELETE FROM users_effects WHERE type IN (11,12,13,14) AND owner_id = ?i', $target);
|
||||
return "Вы вылечили все повреждения персонажу ${targetName}.";
|
||||
} else {
|
||||
return false;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
# Date: 16.09.2020 (08:45)
|
||||
|
||||
namespace Battles\Magic;
|
||||
class Magic
|
||||
{
|
||||
protected $status;
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace magic\attack;
|
||||
namespace Battles\Magic;
|
||||
|
||||
use db;
|
||||
|
@ -4,15 +4,15 @@
|
||||
* Date: 05.07.2020
|
||||
* Time: 23:32
|
||||
*/
|
||||
|
||||
namespace Battles\Models;
|
||||
class EffectsModel
|
||||
{
|
||||
protected $DB;
|
||||
const EFFECT_HIDEUSERINFO = 5; // Обезлик
|
||||
public function __construct(int $user_id) {
|
||||
try {
|
||||
$this->DB = db::c()->query('SELECT * FROM users_effects WHERE owner_id = ?i', $user_id);
|
||||
} catch (Exception $e) {echo '<div class="debug">class EffectsModel: Не могу подключиться к таблице effects!</div>';}
|
||||
$this->DB = \db::c()->query('SELECT * FROM users_effects WHERE owner_id = ?i', $user_id);
|
||||
} catch (\Throwable $e) {echo '<div class="debug">class EffectsModel: Не могу подключиться к таблице effects!</div>';}
|
||||
}
|
||||
|
||||
private function getEffects($user_id)
|
@ -4,6 +4,8 @@
|
||||
* Date: 04.07.2020
|
||||
* Time: 13:17
|
||||
*/
|
||||
namespace Battles\Models;
|
||||
use Exceptions\GameException;
|
||||
|
||||
class PresentsModel
|
||||
{
|
||||
@ -12,12 +14,10 @@ class PresentsModel
|
||||
public function __construct(int $user_id)
|
||||
{
|
||||
if (!$this->DB) {
|
||||
try {
|
||||
$this->DB = db::c()->query('SELECT sender_id, image FROM `users_presents` WHERE owner_id = ?i', $user_id);
|
||||
} catch (Exception $e) {
|
||||
echo "<div class='debug'>class PresentsModel: Не прогрузилась база!</div>";
|
||||
$this->DB = \db::c()->query('SELECT sender_id, image FROM `users_presents` WHERE owner_id = ?i', $user_id);
|
||||
if ($this->DB->getNumRows() == 0) {
|
||||
throw new GameException("<div class='debug'>class PresentsModel: Не прогрузилась база!</div>");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -4,14 +4,14 @@
|
||||
* Date: 05.07.2020
|
||||
* Time: 22:38
|
||||
*/
|
||||
|
||||
namespace Battles\Models;
|
||||
class UserLogModel
|
||||
{
|
||||
protected $DB;
|
||||
|
||||
public function __construct(int $user_id)
|
||||
{
|
||||
$this->DB = db::c()->query('SELECT * FROM users_logs WHERE user_id = ?i ORDER BY `id` ASC', $user_id);
|
||||
$this->DB = \db::c()->query('SELECT * FROM users_logs WHERE user_id = ?i ORDER BY `id` ASC', $user_id);
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Battles;
|
||||
/**
|
||||
* Разные способы отображения строки с логином персонажа.
|
||||
*/
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
namespace Battles;
|
||||
/*
|
||||
* Список наименований игровых комнат.
|
||||
*/
|
||||
@ -15,9 +16,8 @@ trait Rooms
|
||||
25 => "Комиссионный магазин",
|
||||
26 => "Большая парковая улица",
|
||||
27 => "Почта",
|
||||
28 => "Регистратура кланов",
|
||||
29 => "Банк",
|
||||
30 => "Регистратура кланов (мираж)",
|
||||
30 => "Регистратура кланов",
|
||||
31 => "Башня смерти",
|
||||
32 => "Готический замок",
|
||||
33 => "Лабиринт хаоса",
|
||||
@ -38,6 +38,7 @@ trait Rooms
|
||||
51 => "Парковая улица",
|
||||
52 => "Квартал Законников",
|
||||
53 => "Библиотека",
|
||||
61 => "Академия",
|
||||
200 => "Турнир",
|
||||
401 => "Врата Ада",
|
||||
// БС
|
||||
@ -185,5 +186,5 @@ trait Rooms
|
||||
2655 => "Арена Богов",
|
||||
2601 => "Замковая Площадь",
|
||||
2702 => "Центральная площадь (мираж)",
|
||||
] ?? "Небытие";
|
||||
];
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Battles;
|
||||
class ShopItem extends Item
|
||||
{
|
||||
public function printInfo()
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
# Date: 30.09.2020 (09:42)
|
||||
|
||||
namespace Battles;
|
||||
class Template
|
||||
{
|
||||
/**
|
||||
@ -32,4 +32,19 @@ HTML_HEADER;
|
||||
}
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $buildingName название здания
|
||||
* @param string $streetName служебное название улицы на которой стоит здание для кнопки возврата.
|
||||
* @return string
|
||||
*/
|
||||
public static function buildingTop(string $buildingName, string $streetName): void
|
||||
{
|
||||
echo <<<HTML
|
||||
<div style="float: right">
|
||||
<button onclick="top.frames['gameframe'].location = 'city.php?$streetName'">Выйти из здания</button>
|
||||
</div>
|
||||
<h1>$buildingName</h1>
|
||||
HTML;
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
# Date: 26.10.2020 (16:08)
|
||||
|
||||
namespace Battles;
|
||||
class Travel
|
||||
{
|
||||
/**
|
||||
@ -48,8 +48,8 @@ class Travel
|
||||
*/
|
||||
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 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();
|
||||
$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();
|
||||
$errors = [];
|
||||
if ($itemsWeight['all_weight'] > get_meshok()) {
|
||||
$errors[0] = 'У вас переполнен рюкзак, вы не можете передвигаться...';
|
||||
@ -65,7 +65,7 @@ class Travel
|
||||
echo sprintf('<span class="error">%s</span>', $error);
|
||||
}
|
||||
} 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`.`user_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: ' . self::$roomFileName[$roomId]);
|
||||
exit;
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
namespace Battles;
|
||||
use Exceptions\GameException;
|
||||
|
||||
class User
|
||||
{
|
||||
@ -51,7 +53,7 @@ class User
|
||||
|
||||
public function __construct($user)
|
||||
{
|
||||
$user_query = db::c()->query('SELECT * FROM users WHERE id = "?s" OR login = "?s"', $user, $user)->fetch_assoc();
|
||||
$user_query = \db::c()->query('SELECT * FROM users WHERE id = "?s" OR login = "?s"', $user, $user)->fetch_assoc();
|
||||
foreach ($this as $key => $value) {
|
||||
if (isset($user_query[$key])) {
|
||||
$this->$key = $user_query[$key];
|
||||
@ -66,7 +68,7 @@ class User
|
||||
* @param $stat_name - имя стата. Может принимать значения 'strength', 'dexterity', 'intuition', 'endurance', 'intelligence', 'wisdom'.
|
||||
* @param int $isMainWindow - переключатель "главного окна". Если включить, дополнительно будет показывать ссылку на повышение стата на 1, при условии наличия свободных очков статов.
|
||||
* @return string
|
||||
* @throws Exception
|
||||
* @throws GameException
|
||||
*/
|
||||
public function getStat($stat_name, $isMainWindow = 0)
|
||||
{
|
||||
@ -78,14 +80,14 @@ class User
|
||||
return $this->$stat_name;
|
||||
}
|
||||
} else {
|
||||
throw new Exception(self::ERROR_STAT_UNKNOWN);
|
||||
throw new \Exceptions\GameException(self::ERROR_STAT_UNKNOWN);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Повышает один из выбранных статов на 1, но не выше self::STAT_MAXIMUM_AMOUNT при условии наличия свободных очков статов.
|
||||
* @param $stat_name - имя стата. Может принимать значения 'strength', 'dexterity', 'intuition', 'endurance', 'intelligence', 'wisdom'.
|
||||
* @throws \Krugozor\Database\Mysql\Exception
|
||||
* @throws GameException
|
||||
*/
|
||||
public function addOnePointToStat($stat_name)
|
||||
{
|
||||
@ -93,12 +95,12 @@ class User
|
||||
if (in_array($stat_name, $allowed)) {
|
||||
if ($this->free_stat_points > 0 && $this->$stat_name <= self::STAT_MAXIMUM_AMOUNT) {
|
||||
$query = 'UPDATE users SET ?f = ?f + 1, free_stat_points = free_stat_points - 1 WHERE id = ?i';
|
||||
db::c()->query($query, $stat_name, $stat_name, $this->id);
|
||||
\db::c()->query($query, $stat_name, $stat_name, $this->id);
|
||||
} else {
|
||||
throw new Exception(self::ERROR_STAT_IS_MAXIMUM);
|
||||
throw new \Exceptions\GameException(self::ERROR_STAT_IS_MAXIMUM);
|
||||
}
|
||||
} else {
|
||||
throw new Exception(self::ERROR_STAT_UNKNOWN);
|
||||
throw new \Exceptions\GameException(self::ERROR_STAT_UNKNOWN);
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# Date: 16.09.2020 (08:28)
|
||||
# Названия эффектов, налагаемых на персонажа.
|
||||
|
||||
namespace Battles;
|
||||
trait UserEffects
|
||||
{
|
||||
public static $effectName = [
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Battles;
|
||||
class UserInfo extends User
|
||||
{
|
||||
use Rooms;
|
||||
@ -77,7 +77,7 @@ class UserInfo extends User
|
||||
$this->experience . '<br>' .
|
||||
$this->free_stat_points . '<br>' .
|
||||
$this->money . '<br>' .
|
||||
$this->Bank->money;
|
||||
$this->Bank->getMoney();
|
||||
}
|
||||
$nameString = '';
|
||||
if ($this->align) {
|
||||
@ -139,9 +139,9 @@ class UserInfo extends User
|
||||
if ($this->watcherIsAdmin) {
|
||||
$this->Bank = new Bank($this->id);
|
||||
$infoString = '<br><span>ИД Игрока: %s<br> ИД Комнаты: %s<br> Деньги: %s<br> Деньги в банке: %s<br> Опыт: %s<br> Нераспределённые очки: %s<br> Текущая сессия: %s</span>';
|
||||
echo sprintf($infoString, $this->id, $this->room, $this->money, $this->Bank->money, $this->experience, $this->free_stat_points, $this->session_id);
|
||||
echo sprintf($infoString, $this->id, $this->room, $this->money, $this->Bank->getMoney(), $this->experience, $this->free_stat_points, $this->session_id);
|
||||
}
|
||||
$this->UserLogs = new UserLogModel($this->id);
|
||||
$this->UserLogs = new \Battles\Models\UserLogModel($this->id);
|
||||
echo '<div class="secret-info-user-log"><b>Личное дело</b><br>';
|
||||
while ($userLogRow = $this->UserLogs->getUserLog()->fetch_object()) {
|
||||
echo sprintf('<code>%s</code><br>', date("d.m.Y H:i ", strtotime($userLogRow->date)) . $userLogRow->text);
|
||||
@ -153,18 +153,18 @@ class UserInfo extends User
|
||||
|
||||
public function showUserInfo()
|
||||
{
|
||||
$this->effects = new EffectsModel($this->id);
|
||||
$this->effects = new \Battles\Models\EffectsModel($this->id);
|
||||
$this->WatcherStatus();
|
||||
|
||||
if ($this->block && (!$this->watcherIsAdmin || !$this->watcherIsModerator)) {
|
||||
throw new Exception('<span class="error">Персонаж ' . $this->login . ' заблокирован!</span>');
|
||||
throw new \Exceptions\GameException('<span class="error">Персонаж ' . $this->login . ' заблокирован!</span>');
|
||||
} elseif ($this->effects->getHideUserInfoStatus() && (!$this->watcherIsAdmin || !$this->watcherIsModerator)) {
|
||||
if ($this->effects->getHideUserInfoStatus() == -1) {
|
||||
$date = 'навсегда';
|
||||
} else {
|
||||
$date = 'до' . date('d.m.Y', strtotime($this->effects->getHideUserInfoStatus()));
|
||||
}
|
||||
throw new Exception('<span class="error">Персонаж ' . $this->login . ' обезличен ' . $date . '.</span>');
|
||||
throw new \Exceptions\GameException('<span class="error">Персонаж ' . $this->login . ' обезличен ' . $date . '.</span>');
|
||||
} else {
|
||||
$this->Info();
|
||||
}
|
10
classes/Exceptions/GameException.php
Normal file
10
classes/Exceptions/GameException.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
# Date: 28.10.2020 (17:41)
|
||||
|
||||
namespace Exceptions;
|
||||
|
||||
|
||||
class GameException extends \Exception
|
||||
{
|
||||
|
||||
}
|
@ -141,10 +141,10 @@ FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `dressed` = 0
|
||||
|
||||
$iteminfo = [];
|
||||
while ($row = $data->fetch_assoc()) {
|
||||
$iteminfo[] = new ShopItem($row);
|
||||
$iteminfo[] = new \Battles\ShopItem($row);
|
||||
}
|
||||
|
||||
Template::header('Рынок');
|
||||
\Battles\Template::header('Рынок');
|
||||
?>
|
||||
<script src="js/main.js"></script>
|
||||
<h1>Рынок</h1>
|
||||
|
29
config.php
29
config.php
@ -18,24 +18,21 @@ header("Pragma: no-cache");
|
||||
/**
|
||||
* Классы для работы с базой данных.
|
||||
*/
|
||||
require_once('Database/Mysql.php');
|
||||
require_once('Database/Exception.php');
|
||||
require_once('Database/Statement.php');
|
||||
require_once('Database/db.php');
|
||||
|
||||
require_once 'classes/Database/Mysql.php';
|
||||
require_once 'classes/Database/Exception.php';
|
||||
require_once 'classes/Database/Statement.php';
|
||||
require_once 'classes/Database/db.php';
|
||||
|
||||
/**
|
||||
* Автозагрузка классов.
|
||||
* Автозагрузка классов с учётом неймспейсов.
|
||||
*/
|
||||
spl_autoload_register(function ($class_name) {
|
||||
$class_name .= '.php';
|
||||
if (file_exists('classes/' . $class_name)) {
|
||||
require_once 'classes/' . $class_name;
|
||||
} elseif (file_exists('models/' . $class_name)) {
|
||||
require_once 'models/' . $class_name;
|
||||
} else {
|
||||
throw new Exception(sprintf('Невозможно загрузить класс %s', $class_name));
|
||||
}
|
||||
|
||||
spl_autoload_register(function ($className){
|
||||
$fileName = __DIR__ . '/classes/' . str_replace('\\', '/', $className . '.php');
|
||||
if (file_exists($fileName)) {
|
||||
require_once $fileName;
|
||||
}
|
||||
});
|
||||
|
||||
trait Config
|
||||
@ -66,7 +63,7 @@ trait Config
|
||||
public static $clan_register_cost = 10000; //стоимость
|
||||
public static $clan_register_lock = 1; //запрет на регистрацию
|
||||
//Банк
|
||||
public static $bank_comission = 0.05; //5%
|
||||
public static $bank_commission = 0.05; //5%
|
||||
// Старая таблица опыта
|
||||
public static $exptable = [
|
||||
0 => [0, 0, 0, 0, 0, 20],
|
||||
@ -206,5 +203,5 @@ trait Config
|
||||
1250000000 => [1, 0, 0, 450, 0, 1500000000],
|
||||
1500000000 => [10, 1, 5, 8000, 1, 9999999999], # Это тринадцатый уровень
|
||||
];
|
||||
public static $cavedata = [621 => ['x1' => 6, 'y1' => 11, 'dir1' => 1, 'x2' => 10, 'y2' => 8, 'dir2' => 1, 'x3' => 20, 'y3' => 4, 'dir3' => 1, 'x4' => 10, 'y4' => 10, 'dir4' => 1, 'delay' => 360, 'name1' => 'Проклятый Рудник', 'name2' => 'Проклятого Рудника']];
|
||||
public static $cavedata = [621 => ['x1' => 6, 'y1' => 11, 'dir1' => 1, 'x2' => 10, 'y2' => 8, 'dir2' => 1, 'x3' => 20, 'y3' => 4, 'dir3' => 1, 'x4' => 10, 'y4' => 10, 'dir4' => 1, 'delay' => 360, 'name1' => 'Проклятый Рудник', 'name2' => 'Проклятого Рудника']];
|
||||
}
|
@ -52,7 +52,7 @@ if ($username && $password) {
|
||||
$error = ERROR_EMPTY_CREDENTIALS;
|
||||
}
|
||||
|
||||
Template::header('Входим...');
|
||||
\Battles\Template::header('Входим...');
|
||||
|
||||
if ($error) {
|
||||
echo sprintf('<a href="/"> ← на главную</a><h1>%s</h1>', $error);
|
||||
|
@ -75,7 +75,7 @@ if (in_array($user->room, Config::$canalenters)) {
|
||||
$cavedata = [620 => ['x1' => 3, 'y1' => 2, 'dir1' => 2]];
|
||||
$podzemdata = [621 => ['name1' => 'Проклятый Рудник', 'name2' => 'Проклятого Рудника']];
|
||||
$warning = $_GET["warning"] ?? '';
|
||||
Template::header('enter_cave');
|
||||
\Battles\Template::header('enter_cave');
|
||||
if ($warning) {
|
||||
echo sprintf('<b style="color: #f80000">%s</b>', $warning);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ if (isset($user['id'])) {
|
||||
include('./classes/battle_new.class.php');
|
||||
|
||||
$fbattle = new fbattle($user['battle']);
|
||||
Template::header('fbattle');
|
||||
\Battles\Template::header('fbattle');
|
||||
?>
|
||||
<script type="text/javascript" src="js/sl2.js"></script>
|
||||
<script type="text/javascript" src="js/ch.js"></script>
|
||||
@ -139,7 +139,7 @@ Template::header('fbattle');
|
||||
<tr>
|
||||
<td valign=top width=250 nowrap>
|
||||
<?php
|
||||
$myinfo = new User($_SESSION['uid']);
|
||||
$myinfo = new \Battles\User($_SESSION['uid']);
|
||||
$myinfo->showUserDoll(1);
|
||||
?>
|
||||
</td>
|
||||
@ -476,7 +476,7 @@ Template::header('fbattle');
|
||||
<?php
|
||||
|
||||
if ($fbattle->return == 1) {
|
||||
$enemyInfo = new User($fbattle->enemy);
|
||||
$enemyInfo = new \Battles\User($fbattle->enemy);
|
||||
$enemyInfo->showUserDoll(1);
|
||||
} else {
|
||||
if ($fbattle->battle_data['type'] == 4 || $fbattle->battle_data['type'] == 5) {
|
||||
|
@ -4,6 +4,7 @@ if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once 'config.php';
|
||||
$userLoginStatus = db::c()->query('SELECT enter_game FROM users WHERE id = ?i', $_SESSION['uid'])->getNumRows() ?? 0;
|
||||
if (empty($userLoginStatus)) {
|
||||
@ -11,7 +12,8 @@ if (empty($userLoginStatus)) {
|
||||
} else {
|
||||
db::c()->query('UPDATE `users` SET `enter_game` = 0 WHERE `enter_game` = 1 AND `id` = ?i', $_SESSION['uid']);
|
||||
}
|
||||
Template::header('Окно игры');
|
||||
|
||||
\Battles\Template::header('Окно игры');
|
||||
?>
|
||||
<script>
|
||||
if (!navigator.cookieEnabled) {
|
||||
|
@ -118,7 +118,7 @@ if ($_GET['res']) {
|
||||
echo " <font style='font-size:12px; color:cc0000;'>Кто-то оказался быстрее!</font>";
|
||||
}
|
||||
}
|
||||
Template::header('Лес');
|
||||
\Battles\Template::header('Лес');
|
||||
?>
|
||||
<script src="i/forest/char1.32.js"></script>
|
||||
<script src="i/forest/funcs1.6.js"></script>
|
||||
|
@ -5,7 +5,7 @@ if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
$user = new User($_SESSION['uid']);
|
||||
$user = new \Battles\User($_SESSION['uid']);
|
||||
$sleep = db::c()->query('SELECT `id` FROM `effects` WHERE `owner` = ?i AND `time` > ?i AND `type` = 3', $user['id'], time())->fetch_assoc();
|
||||
$ps = $_GET['page'] ?? 0;
|
||||
$isModerator = false;
|
||||
@ -206,7 +206,7 @@ if (isset($_GET['do']) && $isModerator == true) {
|
||||
exit();
|
||||
}
|
||||
}
|
||||
Template::header('Форум');
|
||||
\Battles\Template::header('Форум');
|
||||
?>
|
||||
<link rel="stylesheet" href="css/wysibb/theme/default/wbbtheme.css"/>
|
||||
<script type="text/javascript" language="JavaScript" src='js/forum.js'></script>
|
||||
|
@ -7,9 +7,9 @@
|
||||
*/
|
||||
require_once 'config.php';
|
||||
if (empty($_SESSION['uid'])) {
|
||||
throw new Exception('Не могу проинициализировать игрока!');
|
||||
throw new \Exceptions\GameException('Не могу проинициализировать игрока!');
|
||||
}
|
||||
$user = new User($_SESSION['uid']);
|
||||
$user = new \Battles\User($_SESSION['uid']);
|
||||
if ($user->id && $user->block) {
|
||||
exit('user blocked!');
|
||||
}
|
||||
|
2
game.php
2
game.php
@ -12,7 +12,7 @@ if (empty($_SESSION['uid'])) header("Location: index.php");
|
||||
//$msg = filter_input(INPUT_POST,'msg');
|
||||
//$uid = $_SESSION['uid'];
|
||||
//if ($msg) db::c()->query('INSERT INTO `chat` (`cid`, `uid`, `msg`) VALUES (?i, ?i, "?s")', 1, $uid, $msg);
|
||||
Template::header('Окно игры');
|
||||
\Battles\Template::header('Окно игры');
|
||||
?>
|
||||
<style>
|
||||
form {
|
||||
|
@ -12,7 +12,7 @@ if (empty($_SESSION['uid'])) header("Location: index.php");
|
||||
//$msg = filter_input(INPUT_POST,'msg');
|
||||
//$uid = $_SESSION['uid'];
|
||||
//if ($msg) db::c()->query('INSERT INTO `chat` (`cid`, `uid`, `msg`) VALUES (?i, ?i, "?s")', 1, $uid, $msg);
|
||||
Template::header('Окно игры');
|
||||
\Battles\Template::header('Окно игры');
|
||||
?>
|
||||
<style>
|
||||
form {
|
||||
|
@ -96,7 +96,7 @@ if ($user->room == 40) {
|
||||
} else $status = 'Не хватает денег!';
|
||||
}
|
||||
}
|
||||
Template::header('Клановый замок');
|
||||
\Battles\Template::header('Клановый замок');
|
||||
?>
|
||||
<script src="js/main.js"></script>
|
||||
<style>
|
||||
|
@ -204,7 +204,7 @@ if ($_GET['exit'] == 1) {
|
||||
header('Location: city.php');
|
||||
}
|
||||
|
||||
Template::header('group_arena');
|
||||
\Battles\Template::header('group_arena');
|
||||
?>
|
||||
<script>
|
||||
function growl(title, color, message, stycky) {
|
||||
|
2
hell.php
2
hell.php
@ -42,7 +42,7 @@ $hr = new hellround;
|
||||
|
||||
$mytrip = $hr->is_in_trip($user['id']);
|
||||
$tr = $hr->get_par($mytrip);
|
||||
Template::header('hell');
|
||||
\Battles\Template::header('hell');
|
||||
if ($mytrip > 0) {
|
||||
|
||||
?>
|
||||
|
@ -5,7 +5,7 @@ if (empty($_SESSION['uid'])) {
|
||||
exit;
|
||||
}
|
||||
include('config.php');
|
||||
$user = new User($_SESSION['uid']);
|
||||
$user = new \Battles\User($_SESSION['uid']);
|
||||
$hostel = mysql_fetch_array(mysql_query('SELECT `id`, `uid`, `type`, `time` FROM `hostel` WHERE `uid` = "' . $user['id'] . '" LIMIT 1'));
|
||||
#include('functions.php');
|
||||
$error = '';
|
||||
@ -154,7 +154,7 @@ if ($_GET['unsleep'] && $user['sleep'] > 0) {
|
||||
}
|
||||
header('Location: hostel.php');
|
||||
}
|
||||
Template::header('Хостел');
|
||||
\Battles\Template::header('Хостел');
|
||||
?>
|
||||
<script src="js/ajaxLoad.js"></script>
|
||||
<? if (isset($hostel['id'])) { ?>
|
||||
|
@ -334,7 +334,7 @@ if ($_GET['go_back'] == 1) {
|
||||
header('Location: hostel.php');
|
||||
}
|
||||
|
||||
Template::header('hostel_room');
|
||||
\Battles\Template::header('hostel_room');
|
||||
?>
|
||||
<script src="js/ajaxLoad.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="css/hostel.css"/>
|
||||
|
@ -4,8 +4,8 @@ if ($_SESSION['uid']) {
|
||||
header('Location: fight.php');
|
||||
exit;
|
||||
}
|
||||
require_once './classes/Template.php';
|
||||
Template::header('Вход');
|
||||
require_once './classes/Battles/Template.php';
|
||||
\Battles\Template::header('Вход');
|
||||
?>
|
||||
<h1>Демонстрационная версия</h1>
|
||||
<div>
|
||||
|
6
inf.php
6
inf.php
@ -2,11 +2,11 @@
|
||||
session_start();
|
||||
include_once 'config.php';
|
||||
$login = urldecode($_SERVER['QUERY_STRING']) ?? '';
|
||||
$userInfo = new UserInfo($login);
|
||||
$presentsModel = new PresentsModel($userInfo->id);
|
||||
$userInfo = new \Battles\UserInfo($login);
|
||||
$presentsModel = new \Battles\Models\PresentsModel($userInfo->id);
|
||||
$presentsList = $presentsModel->getAllPresents();
|
||||
$userInfo->watcher_id = $_SESSION['uid'] ?? null;
|
||||
Template::header('Информация о ' . $userInfo->login);
|
||||
\Battles\Template::header('Информация о ' . $userInfo->login);
|
||||
if (!$userInfo->id) {
|
||||
echo sprintf('Ошибка: персонаж <em>%s</em> не найден...<p><a style="color: #99f;" href="javascript:window.history.go(-1);">←назад</a></p>', $login);
|
||||
exit;
|
||||
|
2
lab.php
2
lab.php
@ -371,7 +371,7 @@ if ((time() - $_SESSION['time']) > 3) {
|
||||
} else {
|
||||
$tt = (time() - $_SESSION['time']);
|
||||
}
|
||||
Template::header('lab');
|
||||
\Battles\Template::header('lab');
|
||||
|
||||
echo Nick::id($user)->battle();
|
||||
echo " <a href=\"#\" onclick=\"javascript:if (confirm('Желаете выбраться из квестового лабиринта? Теряете все, что здесь нашли.')){ location.href='lab.php?eexit=1';}\">Выйти?</a>";
|
||||
|
2
lab2.php
2
lab2.php
@ -369,7 +369,7 @@ if ((time() - $_SESSION['time']) > 3) {
|
||||
} else {
|
||||
$tt = (time() - $_SESSION['time']);
|
||||
}
|
||||
Template::header('lab2');
|
||||
\Battles\Template::header('lab2');
|
||||
|
||||
echo Nick::id($user)->battle();
|
||||
echo " <a href=\"#\" onclick=\"javascript:if (confirm('Желаете выбраться из лабиринта? Теряете все что здесь нашли.')){ location.href='lab.php?eexit=1';}\">Выйти?</a>";
|
||||
|
@ -299,7 +299,7 @@ if ($user->room == 1051) {
|
||||
header('Location: labirint.php');
|
||||
}
|
||||
}
|
||||
Template::header('Вход в Лабиринты');
|
||||
\Battles\Template::header('Вход в Лабиринты');
|
||||
?>
|
||||
<div style="float: right;">
|
||||
<input type="button" onclick="location.href='lab_enter.php';" value="Обновить">
|
||||
|
@ -469,7 +469,7 @@ if ($user->room == 1052) {
|
||||
$effed .= '<div><img width="40" height="25" src="/i/sh/event_timer_trap.gif" /> - Время перехода +3 секунды (Осталось : ' . timeOut($varos['trap1']['time'] - time()) . ')</div>';
|
||||
}
|
||||
unset($varos);
|
||||
Template::header('labirint');
|
||||
\Battles\Template::header('labirint');
|
||||
?>
|
||||
<script type="text/javascript" src="js/jquery.js"></script>
|
||||
<script>
|
||||
|
@ -14,7 +14,7 @@ if ($user->battle) {
|
||||
header('location: fbattle.php');
|
||||
exit;
|
||||
}
|
||||
Template::header('Библиотека Просвещения');
|
||||
\Battles\Template::header('Библиотека Просвещения');
|
||||
?>
|
||||
<TABLE border=0 width=600 cellspacing="0" cellpadding="0" align=left>
|
||||
|
||||
|
2
logs.php
2
logs.php
@ -4,7 +4,7 @@ $_REQUEST['log'] = $_REQUEST['log'] ?? 0;
|
||||
require_once "functions.php";
|
||||
$data = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id` = '" . $_REQUEST['log'] . "'"));
|
||||
$log = file("backup/logs/battle" . $_REQUEST['log'] . ".txt");
|
||||
Template::header('Лог поединка');
|
||||
\Battles\Template::header('Лог поединка');
|
||||
?>
|
||||
<H3>Лог поединка</H3>
|
||||
<FORM>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
// Магия восстагновления здоровья
|
||||
|
||||
class Healing extends Magic
|
||||
use Battles\User;
|
||||
class Healing extends magic
|
||||
{
|
||||
private $target;
|
||||
private $magicPower;
|
||||
|
12
main.php
12
main.php
@ -40,13 +40,13 @@ $ids = $_GET['ids'] ?? null;
|
||||
$setShadow = $_POST['setshadow'] ?? null;
|
||||
$edit = $_GET['edit'] ?? null;
|
||||
// Подготавливаем отображение инфы и предметов.
|
||||
$userInfo = new UserInfo($user->id);
|
||||
$getItemsBonuses = new DressedItems($_SESSION['uid']);
|
||||
$userInfo = new \Battles\UserInfo($user->id);
|
||||
$getItemsBonuses = new \Battles\DressedItems($_SESSION['uid']);
|
||||
$data_query = 'SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot = 0 AND on_sale = 0';
|
||||
$data = db::c()->query($data_query, $_SESSION['uid']);
|
||||
$iteminfo = [];
|
||||
while ($row = $data->fetch_assoc()) {
|
||||
$iteminfo[] = new InventoryItem($row);
|
||||
$iteminfo[] = new \Battles\InventoryItem($row);
|
||||
}
|
||||
|
||||
//Обработчики нажатий на кнопки.
|
||||
@ -378,7 +378,7 @@ if ($mfs && $ids) {
|
||||
}
|
||||
}
|
||||
if ($setShadow) {
|
||||
Template::header('Образ персонажа');
|
||||
\Battles\Template::header('Образ персонажа');
|
||||
?>
|
||||
<div style="text-align: right;">
|
||||
<input type=button value="Вернуться" onClick="location.href='main.php?edit=<?= mt_rand() ?>';" class="button">
|
||||
@ -429,7 +429,7 @@ if ($edit) {
|
||||
addOnePoint($upm, 'mastery');
|
||||
}
|
||||
if ($drop) {
|
||||
$items = new DressedItems($_SESSION['uid']);
|
||||
$items = new \Battles\DressedItems($_SESSION['uid']);
|
||||
$items->undressItem($drop);
|
||||
}
|
||||
//Пока что одеваем предмет отсюда.
|
||||
@ -458,7 +458,7 @@ if ($edit) {
|
||||
undressall($_SESSION['uid']);
|
||||
}
|
||||
}
|
||||
Template::header('Игра');
|
||||
\Battles\Template::header('Игра');
|
||||
?>
|
||||
<script src="js/funcs.js"></script>
|
||||
<script>
|
||||
|
@ -23,7 +23,7 @@ $qsee = '';
|
||||
$qx = 0;
|
||||
$error = '';
|
||||
|
||||
Template::header('module_quest');
|
||||
\Battles\Template::header('module_quest');
|
||||
?>
|
||||
<link rel="stylesheet" href="css/hostel.css"/>
|
||||
<?php
|
||||
|
@ -16,7 +16,7 @@ $fd = mysql_fetch_array($df);
|
||||
$cd = mysql_query("select `n18` from `podzem3` where `glava`='" . $fd['glava'] . "' and `name`='Канализация 1 этаж'");
|
||||
$vb = mysql_fetch_array($cd);
|
||||
if ($fd['location'] == '28' and $fd['name'] == 'Канализация 1 этаж' and $vb['n18'] == '8') {
|
||||
Template::header('Подземелье Луки');
|
||||
\Battles\Template::header('Подземелье Луки');
|
||||
?>
|
||||
<div id=hint3 class=ahint></div>
|
||||
<TABLE width=100% cellspacing=0 cellpadding=0 border=0>
|
||||
@ -24,7 +24,7 @@ if ($fd['location'] == '28' and $fd['name'] == 'Канализация 1 эта
|
||||
<TD valign=top>
|
||||
<div style="width: 250px; text-align: center;">
|
||||
<?php
|
||||
$userInfo = new User($_SESSION['uid']);
|
||||
$userInfo = new \Battles\User($_SESSION['uid']);
|
||||
$userInfo->showUserDoll();
|
||||
?>
|
||||
</div>
|
||||
@ -791,7 +791,7 @@ if ($fd['location'] == '28' and $fd['name'] == 'Канализация 1 эта
|
||||
$bot = "Лука";
|
||||
$buser = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `login` = '$bot' LIMIT 1;"));
|
||||
//FIXME Этот класс не умеет работать с ботами! Этот вызов - заглушка!
|
||||
$botInfo = new User('Лука');
|
||||
$botInfo = new \Battles\User('Лука');
|
||||
$botInfo->showUserDoll();
|
||||
?>
|
||||
</TD>
|
||||
|
4
post.php
4
post.php
@ -62,11 +62,11 @@ if ($_SESSION['receiverName']) {
|
||||
|
||||
$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);
|
||||
$iteminfo[] = new \Battles\InventoryItem($row);
|
||||
}
|
||||
}
|
||||
}
|
||||
Template::header('Почта');
|
||||
\Battles\Template::header('Почта');
|
||||
?>
|
||||
<div style="float: right">
|
||||
<button onclick="top.frames['gameframe'].location = 'city.php?cp'">Вернуться</button>
|
||||
|
@ -17,7 +17,7 @@ session_start();
|
||||
if ($_SESSION['uid'] != 2) header("Location: index.php");
|
||||
require_once 'config.php';
|
||||
|
||||
$user = new User($_SESSION['uid']);
|
||||
$user = new \Battles\User($_SESSION['uid']);
|
||||
$status = '';
|
||||
$dirname = "i/presents/";
|
||||
$images = glob($dirname . "*.png");
|
||||
@ -62,7 +62,7 @@ if (!empty($_POST['sendAction'])) {
|
||||
db::c()->query('INSERT INTO `telegraph` (receiver, text) VALUES (?i,"?s")', $receiver['id'], $telegraphText);
|
||||
$status = "Подарок удачно доставлен к {$_POST['receiver']}! Вы потратили <b>{$cost}</b> кр.";
|
||||
}
|
||||
Template::header('Дарильня');
|
||||
\Battles\Template::header('Дарильня');
|
||||
?>
|
||||
<script src="js/main.js"></script>
|
||||
<style>
|
||||
|
@ -54,7 +54,7 @@ function info_quest($id)
|
||||
if (!empty($q->error)) {
|
||||
$status = $q->error;
|
||||
}
|
||||
Template::header('Памятник');
|
||||
\Battles\Template::header('Памятник');
|
||||
?>
|
||||
<div style="float: right;">
|
||||
<?php if (($user->level < 5 || $user->admin) && $user->health < $user->maxHealth): ?>
|
||||
|
@ -33,7 +33,7 @@ if ($_COOKIE[GAMEDOMAIN] ?? null) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Template::header('Регистрация персонажа');
|
||||
\Battles\Template::header('Регистрация персонажа');
|
||||
?>
|
||||
<a href="/"> ← на главную</a>
|
||||
<?php if ($error ?? null): ?>
|
||||
|
@ -72,7 +72,7 @@ if ($newPassword && $hashCheck) {
|
||||
$statusMessage = ERROR_WRONG_HASH;
|
||||
}
|
||||
}
|
||||
Template::header('Восстановление пароля');
|
||||
\Battles\Template::header('Восстановление пароля');
|
||||
?>
|
||||
<a href="/"> ← на главную</a>
|
||||
<?php if (!empty($statusMessage)): ?>
|
||||
|
@ -74,7 +74,7 @@ if ($goto == 'remont') {
|
||||
if ($goto == 'gravirovka') {
|
||||
$gravirovka_query = db::c()->query('SELECT `id`,`name`,`img`,`text` FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 3 AND `name` NOT LIKE "?S" AND `setsale` = 0 OR `text` <> "?s" AND `owner` = ?i AND `dressed` = 0 AND `setsale` = 0 ORDER by `update` DESC', $_SESSION['uid'], '%Букет%', '', $_SESSION['uid']);
|
||||
}
|
||||
Template::header('Кузня');
|
||||
\Battles\Template::header('Кузня');
|
||||
?>
|
||||
<link href="css/secondary.css" rel="stylesheet"/>
|
||||
<script src="js/main.js"></script>
|
||||
|
6
shop.php
6
shop.php
@ -105,7 +105,7 @@ FROM `shop` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `count` > 0 AND `c
|
||||
|
||||
$iteminfo = [];
|
||||
while ($row = $shopItems->fetch_assoc()) {
|
||||
$iteminfo[] = new ShopItem($row);
|
||||
$iteminfo[] = new \Battles\ShopItem($row);
|
||||
}
|
||||
} else {
|
||||
$inventoryItems = db::c()->query('SELECT `inventory`.*,
|
||||
@ -125,7 +125,7 @@ ORDER BY `update` DESC', null, $_SESSION['uid']);
|
||||
|
||||
$iteminfo = [];
|
||||
while ($row = $inventoryItems->fetch_assoc()) {
|
||||
$iteminfo[] = new ShopItem($row);
|
||||
$iteminfo[] = new \Battles\ShopItem($row);
|
||||
}
|
||||
|
||||
}
|
||||
@ -248,7 +248,7 @@ if (!empty($_GET['buy'])) {
|
||||
$status = "Недостаточно денег или нет вещей в наличии.";
|
||||
}
|
||||
}
|
||||
Template::header('Магазин');
|
||||
\Battles\Template::header('Магазин');
|
||||
?>
|
||||
<script src="js/main.js"></script>
|
||||
<h1>Государственный магазин</h1>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
require_once 'classes/Template.php';
|
||||
Template::header('top_menu') ?>
|
||||
require_once 'classes/Battles/Template.php';
|
||||
\Battles\Template::header('top_menu') ?>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
|
@ -12,7 +12,7 @@ if ($user->battle) {
|
||||
exit;
|
||||
}
|
||||
$Tournament = new Tournament();
|
||||
Template::header('Турниры');
|
||||
\Battles\Template::header('Турниры');
|
||||
?>
|
||||
<META HTTP-EQUIV="REFRESH" CONTENT="10">
|
||||
<div style='color:#8F0000; font-weight:bold; font-size:16px; text-align:center; float:left;'>Турнирная</div>
|
||||
|
@ -98,7 +98,7 @@ if ($_GET['st'] == 'startmegaturnirnow') {
|
||||
}
|
||||
$tr = $bania->get_turnir();
|
||||
$bania->get_fond();
|
||||
Template::header('Башня смерти')
|
||||
\Battles\Template::header('Башня смерти')
|
||||
?>
|
||||
<table border=0 width=100% cellspacing="0" cellpadding="0">
|
||||
<td align=right>
|
||||
|
@ -275,7 +275,7 @@ if ($user['hp'] <= 0) {
|
||||
header('Location: tower.php');
|
||||
exit;
|
||||
}
|
||||
Template::header('towerin');
|
||||
\Battles\Template::header('towerin');
|
||||
?>
|
||||
<script>
|
||||
let Hint3Name = '';
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
require_once "config.php";
|
||||
$tr = mysql_fetch_array(mysql_query("SELECT `id`, `coin`, `log` FROM `deztow_turnir` WHERE `id` = '" . mysql_real_escape_string($_GET['id']) . "' LIMIT 1"));
|
||||
Template::header('Башня смерти. Отчет о турнире #'. $tr['id']);
|
||||
\Battles\Template::header('Башня смерти. Отчет о турнире #'. $tr['id']);
|
||||
echo sprintf('<h3>Башня смерти. Отчет о турнире.</h3><b>%s</b> кр.<br>%s', $tr['coin'], $tr['log']);
|
@ -41,7 +41,7 @@ if($_GET['setdef']){
|
||||
echo "<font color=red><b>Сохранено.</b></font>".mysql_error();
|
||||
}
|
||||
|
||||
Template::header('towerstamp');
|
||||
\Battles\Template::header('towerstamp');
|
||||
?>
|
||||
<h3>Профили характеристик</h3>
|
||||
Статы не позволяют сходить в БС? Раскиньте ваши статы так, как вы хотите, и участвуйте в турнире! Выбранный по умолчанию профиль, загрузится сам. Вы можете создавать неограниченное число профилей, и менять их за секунды до турнира!
|
||||
|
@ -6,7 +6,7 @@ if (empty($_SESSION['uid'])) {
|
||||
}
|
||||
|
||||
require_once "config.php";
|
||||
$user = new User($_SESSION['uid']);
|
||||
$user = new \Battles\User($_SESSION['uid']);
|
||||
|
||||
if ($user->room != 650) {
|
||||
header("Location: main.php");
|
||||
@ -26,7 +26,7 @@ if ($_GET['id'] && $user->admin) {
|
||||
header("location: city.php");
|
||||
exit;
|
||||
}
|
||||
Template::header('Клановый перекрёсток');
|
||||
\Battles\Template::header('Клановый перекрёсток');
|
||||
?>
|
||||
<a href="/city.php?strah=1">← назад</a>
|
||||
<h1>Переход к клановым улицам</h1>
|
||||
|
@ -543,7 +543,7 @@ if (empty($user->clan)) {
|
||||
$bank = db::c()->query('SELECT `ekr` FROM `bank` WHERE `id` = ?i ', $_SESSION['uid'])->fetch_assoc();
|
||||
|
||||
|
||||
Template::header('user_abilities');
|
||||
\Battles\Template::header('user_abilities');
|
||||
?>
|
||||
<div style="float: right;">
|
||||
<?php if ($user->admin == 1): ?>
|
||||
@ -570,7 +570,7 @@ Template::header('user_abilities');
|
||||
$magic_name = "Лечение";
|
||||
break;
|
||||
case "al_neut_power":
|
||||
$script_name = "RunMagicSelf";
|
||||
$script_name = "RunmagicSelf";
|
||||
$magic_name = "Сила нейтралитета";
|
||||
break;
|
||||
case "ct1":
|
||||
|
@ -48,7 +48,7 @@ if ($oldpsw && $newpsw) {
|
||||
err('Неверный текущий пароль!');
|
||||
}
|
||||
}
|
||||
Template::header('Анкета');
|
||||
\Battles\Template::header('Анкета');
|
||||
?>
|
||||
<a href="main.php">← на главную</a>
|
||||
<h1>Анкета персонажа <?= $user->login ?></h1>
|
||||
|
2
vxod.php
2
vxod.php
@ -24,7 +24,7 @@ if ($user->room != 402) {
|
||||
exit;
|
||||
}
|
||||
|
||||
Template::header('Вход в водосток');
|
||||
\Battles\Template::header('Вход в водосток');
|
||||
?>
|
||||
<style>
|
||||
legend {
|
||||
|
@ -601,7 +601,7 @@ if (!empty($_POST['open'])) {
|
||||
fputs($f, time());
|
||||
fclose($f);
|
||||
}
|
||||
Template::header('zayavka');
|
||||
\Battles\Template::header('zayavka');
|
||||
?>
|
||||
<style>
|
||||
.m {
|
||||
|
Loading…
Reference in New Issue
Block a user