Browse Source

Будь проклят тот день, когда я решил ввести неймспейсы...

pull/17/head
lopar 2 years ago
parent
commit
d38d62c5b5
  1. 10
      admin/admin.php
  2. 2
      admin/edit_user.php
  3. 2
      akadem.php
  4. 2
      aren_of_angels.php
  5. 44
      bank.php
  6. 4
      buttons.php
  7. 2
      c_forest.php
  8. 2
      c_haos.php
  9. 2
      c_haos_in.php
  10. 2
      c_park.php
  11. 2
      canalizaciya.php
  12. 2
      cave.php
  13. 2
      ch.php
  14. 2
      chat.php
  15. 92
      city.php
  16. 2
      clan.php
  17. 2
      clan_castle.php
  18. 6
      clan_create.php
  19. 2
      clans.php
  20. 73
      classes/Battles/Bank.php
  21. 1
      classes/Battles/City.php
  22. 2
      classes/Battles/DressedItems.php
  23. 2
      classes/Battles/InventoryItem.php
  24. 2
      classes/Battles/Item.php
  25. 11
      classes/Battles/Magic/CureInjury.php
  26. 2
      classes/Battles/Magic/Magic.php
  27. 2
      classes/Battles/Magic/attack.php
  28. 6
      classes/Battles/Models/EffectsModel.php
  29. 10
      classes/Battles/Models/PresentsModel.php
  30. 4
      classes/Battles/Models/UserLogModel.php
  31. 2
      classes/Battles/Nick.php
  32. 1
      classes/Battles/Rooms.php
  33. 2
      classes/Battles/ShopItem.php
  34. 2
      classes/Battles/Template.php
  35. 8
      classes/Battles/Travel.php
  36. 16
      classes/Battles/User.php
  37. 2
      classes/Battles/UserEffects.php
  38. 10
      classes/Battles/UserInfo.php
  39. 0
      classes/Cave/CaveBots.php
  40. 0
      classes/Cave/CaveItems.php
  41. 0
      classes/Cave/lose.php
  42. 0
      classes/Cave/win.php
  43. 0
      classes/Database/Exception.php
  44. 0
      classes/Database/Mysql.php
  45. 0
      classes/Database/Statement.php
  46. 0
      classes/Database/battles.sql
  47. 0
      classes/Database/db.php
  48. 4
      comission.php
  49. 27
      config.php
  50. 2
      enter.php
  51. 2
      enter_cave.php
  52. 6
      fbattle.php
  53. 4
      fight.php
  54. 2
      forest.php
  55. 4
      forum.php
  56. 4
      functions.php
  57. 2
      game.php
  58. 2
      game2.php
  59. 2
      gotzamok.php
  60. 2
      group_arena.php
  61. 2
      hell.php
  62. 4
      hostel.php
  63. 2
      hostel_room.php
  64. 4
      index.php
  65. 6
      inf.php
  66. 2
      lab.php
  67. 2
      lab2.php
  68. 2
      lab_enter.php
  69. 2
      labirint.php
  70. 2
      library.php
  71. 2
      logs.php
  72. 4
      magic/Healing.php
  73. 2
      magic/elem_ally_air.php
  74. 2
      magic/elem_ally_earth.php
  75. 2
      magic/elem_ally_fire.php
  76. 2
      magic/elem_ally_water.php
  77. 2
      magic/elem_foe_air.php
  78. 2
      magic/elem_foe_fire.php
  79. 2
      magic/elem_foe_water.php
  80. 2
      magic/elikbroni.php
  81. 2
      magic/elikurona.php
  82. 2
      magic/ident.php
  83. 4
      magic/incmagic.php
  84. 2
      magic/luck.php
  85. 2
      magic/sleep15.php
  86. 2
      magic/sleep30.php
  87. 2
      magic/stop.php
  88. 2
      magic/stop_200.php
  89. 2
      magic/wis_air_def1.php
  90. 2
      magic/wis_air_def2.php
  91. 2
      magic/wis_air_def3.php
  92. 2
      magic/wis_air_h1.php
  93. 2
      magic/wis_air_m1.php
  94. 2
      magic/wis_air_m2.php
  95. 2
      magic/wis_air_m3.php
  96. 2
      magic/wis_air_o1.php
  97. 2
      magic/wis_air_o2.php
  98. 2
      magic/wis_air_o3.php
  99. 2
      magic/wis_air_t1.php
  100. 2
      magic/wis_air_t2.php
  101. Some files were not shown because too many files have changed in this diff Show More

10
admin/admin.php

@ -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']; ?>">' +

2
admin/edit_user.php

@ -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'>

2
akadem.php

@ -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;">

2
aren_of_angels.php

@ -126,7 +126,7 @@ if (isset($_GET['append'])) {
}
}
}
Template::header('Арена Ангелов');
\Battles\Template::header('Арена Ангелов');
?>
<link href="css/fight.css" rel="stylesheet"/>
<style>

44
bank.php

@ -18,34 +18,42 @@ if ($user->battle != 0) {
}
const SUCCESS = "Успешная операция!";
$bank = new Bank($user->id);
$bank = new \Battles\Bank($user->id);
$status = '';
$toid = (int)$_POST['to_id'] ?? 0;
$summa = (int)$_POST['summa'] ?? 0;
$toid = $_POST['to_id'] ?? 0;
$summa = $_POST['summa'] ?? 0;
$submit = $_POST['action'] ?? '';
try {
// Зачисление кредитов на счёт.
if ($submit === 'depositMoney' && $summa) {
$bank->depositMoney($summa);
$status = SUCCESS;
}
if ($submit === 'depositMoney' && $summa) {
$operation = $bank->depositMoney($summa);
$user->money = $operation['walletMoney'];
$bank->setMoney($operation['bankMoney']);
$status = SUCCESS;
}
// Снятие кредитов со счёта.
if ($submit === 'withdrawMoney' && $summa) {
$bank->withdrawMoney($summa);
$status = SUCCESS;
}
if ($submit === '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);
$status = SUCCESS;
if ($submit === 'sendMoney' && $summa && $toid) {
$user->money = $bank->sendMoney($toid, $summa);
$status = SUCCESS;
}
} catch (\Exceptions\GameException $e) {
echo 'Банковская ошибка!';
} finally {
unset($submit, $summa, $toid);
}
unset($submit, $summa, $toid);
Template::header('Банк');
\Battles\Template::header('Банк');
?>
<link href="css/secondary.css" rel="stylesheet"/>
<script src="js/main.js"></script>
<?php Template::buildingTop(Rooms::$roomNames[29], 'strah') ?>
<?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>

4
buttons.php

@ -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">

2
c_forest.php

@ -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>

2
c_haos.php

@ -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>

2
c_haos_in.php

@ -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() {

2
c_park.php

@ -121,7 +121,7 @@ if ($_POST['attack']) {
//старт боя - конец
Template::header('Городской Парк');
\Battles\Template::header('Городской Парк');
?>
<script>
function refreshPeriodic() {

2
canalizaciya.php

@ -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

@ -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

@ -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

@ -50,7 +50,7 @@ function show_messages()
show_messages();
Template::header('chat');
\Battles\Template::header('chat');
?>
<style>
form {

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

@ -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>

2
clan_castle.php

@ -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() {

6
clan_create.php

@ -14,7 +14,7 @@ $userClan = db::c()->query('SELECT short_name, full_name, info FROM clans where
$clanFullName = $_POST['clan_full_name'] ?? '';
$clanShortName = $_POST['clan_short_name'] ?? '';
$clanInfo = $_POST['clan_info'] ?? '';
$userBank = new Bank($user->id);
$userBank = new \Battles\Bank($user->id);
if ($clanFullName && $clanShortName && $clanInfo && !$userClan) {
$eff = db::c()->query('SELECT 1 FROM users_effects WHERE type = 20 AND owner_id = ?i', $user->id);
@ -59,8 +59,8 @@ if ($clanFullName && $clanShortName && $clanInfo && !$userClan) {
}
}
}
Template::header(Rooms::$roomNames[30]);
Template::buildingTop(Rooms::$roomNames[30], 'strah');
\Battles\Template::header(Rooms::$roomNames[30]);
\Battles\Template::buildingTop(Rooms::$roomNames[30], 'strah');
if ($userClan): ?>
<div>
<fieldset style="display: inline;">

2
clans.php

@ -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'));

73
classes/Bank.php → classes/Battles/Bank.php

@ -4,6 +4,7 @@
* Date: 03.07.2020
* Time: 07:24
*/
namespace Battles;
class Bank
{
@ -25,8 +26,8 @@ class Bank
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();
$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];
@ -34,7 +35,7 @@ class Bank
}
// Если ВДРУГ у человека нет счёта в банке - создаём.
if (empty($this->user_id)) {
db::c()->query('INSERT INTO bank (user_id) VALUES (?i)', $row);
\db::c()->query('INSERT INTO bank (user_id) VALUES (?i)', $row);
$this->user_id = $row;
}
}
@ -48,7 +49,7 @@ class Bank
*/
private function bankCommission(int $amount): int
{
$bankCommission = round($amount * Config::$bank_commission);
$bankCommission = round($amount * \Config::$bank_commission);
if ($bankCommission < 1) {
return 1;
} else {
@ -82,7 +83,7 @@ class Bank
$text .= " Комиссия: " . $this->bankCommission($amount);
}
db::c()->query('INSERT INTO `bank_logs` (sender_id, receiver_id, amount_result, type, text)
\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);
}
@ -92,21 +93,21 @@ class Bank
* @param int $receiver ID получателя.
* @param int $amount сумма.
*
* @return void
* @return int
* @throws \Krugozor\Database\Mysql\Exception
*/
public function sendMoney(int $receiver, int $amount): void
public function sendMoney(int $receiver, int $amount): int
{
$receiverWallet = db::c()->query('SELECT money FROM bank WHERE user_id = ?i', $receiver)->fetch_object();
$receiverWallet = \db::c()->query('SELECT money FROM bank WHERE user_id = ?i', $receiver)->fetch_object();
if ($amount <= 0) {
throw new Exception(self::ERROR_WRONG_AMOUNT);
throw new \Exceptions\GameException(self::ERROR_WRONG_AMOUNT);
}
if (!$receiverWallet) {
throw new Exception(self::ERROR_NO_BANK_ACCOUNT);
throw new \Exceptions\GameException(self::ERROR_NO_BANK_ACCOUNT);
}
$amountWithComission = $amount + $this->bankCommission($amount);
if ($amountWithComission > $this->money) {
throw new Exception(self::ERROR_NO_MONEY_IN_BANK_ACCOUNT);
throw new \Exceptions\GameException(self::ERROR_NO_MONEY_IN_BANK_ACCOUNT);
}
// Снимаем сумму с комиссией у отправителя
$this->money -= $amountWithComission;
@ -116,6 +117,8 @@ class Bank
$receiverWallet->money += $amount;
self::setBankMoney($receiverWallet->money, $receiver);
$this->bankLogs($receiver, $receiverWallet->money, "receiveMoney");
// Возвращаем изменившиеся значения
return $this->money;
}
/**
@ -123,26 +126,30 @@ class Bank
*
* @param int $amount сумма.
*
* @return void
* @return array
* @throws \Krugozor\Database\Mysql\Exception
*/
public function depositMoney(int $amount): void
public function depositMoney(int $amount): array
{
if ($amount <= 0) {
throw new Exception(self::ERROR_WRONG_AMOUNT);
throw new \Exceptions\GameException(self::ERROR_WRONG_AMOUNT);
}
$wallet = db::c()->query('SELECT money FROM users WHERE id = ?i', $this->user_id)->fetch_object();
$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);
throw new \Exceptions\GameException(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, $this->money, "depositMoney");
// Возвращаем изменившиеся значения
return [
'walletMoney' => $this->user->money,
'bankMoney' => $this->money
];
}
/**
@ -150,26 +157,30 @@ class Bank
*
* @param int $amount сумма.
*
* @return void
* @return array
* @throws \Krugozor\Database\Mysql\Exception
*/
public function withdrawMoney(int $amount): void
public function withdrawMoney(int $amount):array
{
if ($amount <= 0) {
throw new Exception(self::ERROR_WRONG_AMOUNT);
throw new \Exceptions\GameException(self::ERROR_WRONG_AMOUNT);
}
$amountWithComission = $amount + $this->bankCommission($amount);
if ($this->money < $amountWithComission) {
throw new Exception(self::ERROR_NO_MONEY_IN_BANK_ACCOUNT);
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");
// Отдаём сумму в кошелёк получателя
//todo check it!
$this->user->money += $amount;
self::setWalletMoney($this->user->money, $this->user_id);
// Возвращаем изменившиеся значения
return [
'walletMoney' => $this->user->money,
'bankMoney' => $this->money
];
}
/**
@ -184,10 +195,15 @@ class Bank
*/
public static function setBankMoney(int $amount, int $user_id, string $operationType = ''): void
{
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);
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()})";
}
}
/**
@ -201,7 +217,12 @@ class Bank
*/
public static function setWalletMoney(int $amount, int $user_id): void
{
db::c()->query('UPDATE users SET money = ?i WHERE `id` = ?i', $amount, $user_id);
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()

1
classes/City.php → classes/Battles/City.php

@ -1,5 +1,6 @@
<?php
# Date: 26.10.2020 (17:56)
namespace Battles;
// todo: #10
class City
{

2
classes/DressedItems.php → classes/Battles/DressedItems.php

@ -4,7 +4,7 @@
* Date: 06.07.2020
* Time: 22:41
*/
namespace Battles;
class DressedItems
{
private $DB;

2
classes/InventoryItem.php → classes/Battles/InventoryItem.php

@ -1,5 +1,5 @@
<?php
namespace Battles;
class InventoryItem extends Item
{
private $present;

2
classes/Item.php → classes/Battles/Item.php

@ -1,5 +1,5 @@
<?php
namespace Battles;
abstract class Item
{
protected $item_id;

11
magic/CureInjury.php → classes/Battles/Magic/CureInjury.php

@ -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;

2
classes/Magic.php → classes/Battles/Magic/Magic.php

@ -1,6 +1,6 @@
<?php
# Date: 16.09.2020 (08:45)
namespace Battles\Magic;
class Magic
{
protected $status;

2
classes/magic/attack.php → classes/Battles/Magic/attack.php

@ -1,6 +1,6 @@
<?php
namespace magic\attack;
namespace Battles\Magic;
use db;

6
models/EffectsModel.php → classes/Battles/Models/EffectsModel.php

@ -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)

10
models/PresentsModel.php → classes/Battles/Models/PresentsModel.php

@ -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
models/UserLogModel.php → classes/Battles/Models/UserLogModel.php

@ -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);
}

2
classes/Nick.php → classes/Battles/Nick.php

@ -1,5 +1,5 @@
<?php
namespace Battles;
/**
* Разные способы отображения строки с логином персонажа.
*/

1
classes/Rooms.php → classes/Battles/Rooms.php

@ -1,4 +1,5 @@
<?php
namespace Battles;
/*
* Список наименований игровых комнат.
*/

2
classes/ShopItem.php → classes/Battles/ShopItem.php

@ -1,5 +1,5 @@
<?php
namespace Battles;
class ShopItem extends Item
{
public function printInfo()

2
classes/Template.php → classes/Battles/Template.php

@ -1,6 +1,6 @@
<?php
# Date: 30.09.2020 (09:42)
namespace Battles;
class Template
{
/**

8
classes/Travel.php → classes/Battles/Travel.php

@ -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;
}

16
classes/User.php → classes/Battles/User.php

@ -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);
}
}

2
classes/UserEffects.php → classes/Battles/UserEffects.php

@ -1,7 +1,7 @@
<?php
# Date: 16.09.2020 (08:28)
# Названия эффектов, налагаемых на персонажа.
namespace Battles;
trait UserEffects
{
public static $effectName = [

10
classes/UserInfo.php → classes/Battles/UserInfo.php

@ -1,5 +1,5 @@
<?php
namespace Battles;
class UserInfo extends User
{
use Rooms;
@ -141,7 +141,7 @@ class UserInfo extends User
$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->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();
}

0
classes/cave/CaveBots.php → classes/Cave/CaveBots.php

0
classes/cave/CaveItems.php → classes/Cave/CaveItems.php

0
classes/cave/lose.php → classes/Cave/lose.php

0
classes/cave/win.php → classes/Cave/win.php

0
Database/Exception.php → classes/Database/Exception.php

0
Database/Mysql.php → classes/Database/Mysql.php

0
Database/Statement.php → classes/Database/Statement.php

0
Database/battles.sql → classes/Database/battles.sql

0
Database/db.php → classes/Database/db.php

4
comission.php

@ -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>

27
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
@ -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' => 'Проклятого Рудника']];
}

2
enter.php

@ -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);

2
enter_cave.php

@ -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);
}

6
fbattle.php

@ -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
fight.php

@ -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) {

2
forest.php

@ -118,7 +118,7 @@ if ($_GET['res']) {
echo "&nbsp;<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>

4
forum.php

@ -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>

4
functions.php

@ -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

<
@ -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);