diff --git a/bank.php b/bank.php
index ce0eda0..b68583a 100644
--- a/bank.php
+++ b/bank.php
@@ -1,11 +1,18 @@
id);
+$bank = new Bank($user->getId());
$status = '';
$toid = $_POST['to_id'] ?? 0;
@@ -15,37 +22,37 @@ try {
// Зачисление кредитов на счёт.
if ($submit === 'depositMoney' && $summa) {
$operation = $bank->depositMoney($summa);
- $user->money = $operation['walletMoney'];
+ $user->setMoney($operation['walletMoney']);
$bank->setMoney($operation['bankMoney']);
$status = SUCCESS;
}
// Снятие кредитов со счёта.
if ($submit === 'withdrawMoney' && $summa) {
$operation = $bank->withdrawMoney($summa);
- $user->money = $operation['walletMoney'];
+ $user->setMoney($operation['walletMoney']);
$bank->setMoney($operation['bankMoney']);
$status = SUCCESS;
}
// Перевод кредитов на другой счёт.
if ($submit === 'sendMoney' && $summa && $toid) {
- $user->money = $bank->sendMoney($toid, $summa);
+ $user->setMoney($bank->sendMoney($toid, $summa));
$status = SUCCESS;
}
-} catch (\Exceptions\GameException $e) {
+} catch (GameException $e) {
echo 'Банковская ошибка!';
} finally {
unset($submit, $summa, $toid);
}
-\Battles\Template::header('Банк');
+Template::header('Банк');
?>
Работа со счётом
diff --git a/buy_klan.php b/buy_klan.php
index b33c4e0..5e57cd8 100644
--- a/buy_klan.php
+++ b/buy_klan.php
@@ -5,7 +5,7 @@ if (empty($_SESSION['uid'])) {
}
require_once "functions.php";
-if (empty($user->clan)) {
+if (empty($user->getClan())) {
exit;
}
$is_now = db::c()->query('SELECT `id` FROM `abils_klan` WHERE `klan` = ?i', $user['klan'])->fetch_assoc();
diff --git a/canalizaciya.php b/canalizaciya.php
index 923c3f9..e27d828 100644
--- a/canalizaciya.php
+++ b/canalizaciya.php
@@ -1,7 +1,11 @@
room == 403) {
include "startpodzemel.php";
if ($_GET['act'] == "cexit") {
@@ -37,7 +41,7 @@ if ($user->room == 403) {
'Ключик №9',
'Ключик №10'
];
- db::c()->query('DELETE FROM inventory WHERE name IN ("?s") AND owner_id = ?i', implode(",", $items_to_delete), $user->id);
+ db::c()->query('DELETE FROM inventory WHERE name IN ("?s") AND owner_id = ?i', implode(",", $items_to_delete), $user->getId());
}
}
$e = mysql_query("DELETE FROM labirint WHERE user_id='" . $user['id'] . "'");
@@ -50,11 +54,11 @@ if ($user->room == 403) {
{
$frt = mysql_query("select user_id from `labirint` where glava='" . $glava . "'");
while ($rbb = mysql_fetch_array($frt)) {
- addchp('
' . $user->login . ' поднял предмет "' . $mis . '". ', '{[]}' . Nick::id($rbb["user_id"])->short() . '{[]}');
+ addchp('
' . $user->getLogin() . ' поднял предмет "' . $mis . '". ', '{[]}' . Nick::id($rbb["user_id"])->short() . '{[]}');
}
}
}
-\Battles\Template::header('canalizaciya');
+Template::header('canalizaciya');
$ros = mysql_query("SELECT * FROM `labirint` WHERE `user_id`='{$_SESSION['uid']}'");
$mir = mysql_fetch_array($ros);
diff --git a/ch.php b/ch.php
index 7727bd9..8868786 100644
--- a/ch.php
+++ b/ch.php
@@ -414,7 +414,7 @@ if (isset($_GET['online']) && $_GET['online'] != null) {
$_GET['text'] = preg_replace('/private \[klan-([a-zA-Z]*)\]/', '', $_GET['text']);
- if (empty($user->clan)) {
+ if (empty($user->getClan())) {
$_GET['text'] = str_replace('private [klan]', '', $_GET['text']);
$_GET['text'] = str_replace('private [klan]', 'private [klan-' . $user['klan'] . ']', $_GET['text']);
} else {
diff --git a/clan.php b/clan.php
index 3d53393..d466c2c 100644
--- a/clan.php
+++ b/clan.php
@@ -13,11 +13,11 @@ require_once 'functions.php';
$user = $user ?? new User($_SESSION['uid']);
$db = new DBPDO();
$clanRow = [];
-if (!$user->clan) {
+if (!$user->getClan()) {
exit(err('Вы не состоите в клане!'));
}
try {
- $clanRow = $db->fetch('SELECT * FROM `clans` WHERE short_name = ?', $user->clan);
+ $clanRow = $db->fetch('SELECT * FROM `clans` WHERE short_name = ?', $user->getClan());
} catch (Exception $e) {
echo "
MYSQL_ERROR: Таблица clans сломана!
";
}
@@ -37,14 +37,14 @@ $tus = $_POST['tus'] ?? null;
$lock = true; // блокировка функций
if ($zamok && !$lock) {
- $db->execute('UPDATE `clans` SET `zamok` = 1 WHERE `glava` = ?', $user->id);
+ $db->execute('UPDATE `clans` SET `zamok` = 1 WHERE `glava` = ?', $user->getId());
$status = "Начат сбор средств на строительство Кланового Замка.";
header("Location: clan.php");
}
if ($kr && $kolv > 0 && !$lock) {
- if ($user->money >= $kolv) {
- $db->execute('UPDATE clans SET zbor = zbor + ? WHERE id = ?', [$kolv, $user->clan]);
- Bank::setWalletMoney($user->money -= $kolv, $user->id);
+ if ($user->getMoney() >= $kolv) {
+ $db->execute('UPDATE clans SET zbor = zbor + ? WHERE id = ?', [$kolv, $user->getClan()]);
+ Bank::setWalletMoney($user->setMoney($user->getMoney() - $kolv), $user->getId());
header("Location: clan.php");
} else {
$status = 'Не хватает денег!';
@@ -57,8 +57,8 @@ if ($login && $action == 'add_member') {
echo "Нет проверки!";
} elseif ($sok['clan']) {
echo 'Персонаж уже состоит в клане!';
- } elseif ($sok['level'] > 0 && $user->money >= COST_ADD_MEMBER) {
- Bank::setWalletMoney($user->money - COST_ADD_MEMBER, $user->id);
+ } elseif ($sok['level'] > 0 && $user->getMoney() >= COST_ADD_MEMBER) {
+ Bank::setWalletMoney($user->setMoney($user->getMoney() - COST_ADD_MEMBER), $user->getId());
$db->execute('UPDATE users SET clan = ?, align = ? WHERE id = ?', [$clanRow['id'], $clanRow['align'], $sok['id']]);
$status = "Персонаж «{$login}» успешно принят в клан.";
} else {
@@ -68,12 +68,12 @@ if ($login && $action == 'add_member') {
if ($login) {
$sok = $db->fetch('SELECT id FROM users WHERE clan = ? AND login = ?', [$clanRow['id'], $login]);
- if ($action == 'remove_member' && $sok['id'] != $clanRow['owner_id'] && $user->money >= COST_REMOVE_MEMBER) {
- Bank::setWalletMoney($user->money - COST_REMOVE_MEMBER, $user->id);
+ if ($action == 'remove_member' && $sok['id'] != $clanRow['owner_id'] && $user->getMoney() >= COST_REMOVE_MEMBER) {
+ Bank::setWalletMoney($user->setMoney($user->getMoney() - COST_REMOVE_MEMBER), $user->getId());
$db->execute('UPDATE users SET clan = null, align = 0 WHERE id = ?', $sok['id']);
$status = "Персонаж «{$login}» покинул клан.";
}
- if ($action == 'change_owner' && $clanRow['owner_id'] == $user->id) {
+ if ($action == 'change_owner' && $clanRow['owner_id'] == $user->getId()) {
$db->execute('UPDATE clans SET owner_id = ? WHERE id = ?', [$sok['id'], $clanRow['id']]);
$clanRow['owner_id'] = $sok['id'];
}
@@ -108,7 +108,7 @@ $clanRow['zbor'] = null; // И копилки.
= $clanRow['full_name'] ?>
- id): ?>
+ getId()): ?>
@@ -123,18 +123,18 @@ $clanRow['zbor'] = null; // И копилки.
- id): ?>
+ getId()): ?>