2018-01-28 16:40:49 +00:00
|
|
|
|
<?php
|
2018-01-29 22:05:41 +00:00
|
|
|
|
/**
|
2021-03-10 21:03:59 +00:00
|
|
|
|
* Конфиг системных настроек.
|
2018-01-29 22:05:41 +00:00
|
|
|
|
* Copyright (c) 2018.
|
|
|
|
|
* Author: Igor Barkov <lopar.4ever@gmail.com>
|
|
|
|
|
* Project name: Battles-Game
|
|
|
|
|
*/
|
2021-01-29 15:21:14 +00:00
|
|
|
|
|
2018-01-28 16:40:49 +00:00
|
|
|
|
ini_set('display_errors', 'On');
|
|
|
|
|
error_reporting(E_ALL);
|
2021-08-20 17:40:06 +00:00
|
|
|
|
const GAMEDOMAIN = "battles.lan";
|
2021-08-25 15:24:12 +00:00
|
|
|
|
|
|
|
|
|
if (session_status() !== PHP_SESSION_ACTIVE) {
|
|
|
|
|
session_start();
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-14 20:58:18 +00:00
|
|
|
|
/*
|
2020-06-23 11:31:57 +00:00
|
|
|
|
* Запрещаем кэшировать
|
2019-01-14 20:58:18 +00:00
|
|
|
|
*/
|
|
|
|
|
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
|
|
|
|
|
header("Cache-Control: post-check=0, pre-check=0", false);
|
|
|
|
|
|
2018-03-03 20:51:37 +00:00
|
|
|
|
/**
|
|
|
|
|
* Классы для работы с базой данных.
|
|
|
|
|
*/
|
2020-10-28 20:21:08 +00:00
|
|
|
|
|
|
|
|
|
require_once 'classes/Database/Mysql.php';
|
|
|
|
|
require_once 'classes/Database/Exception.php';
|
|
|
|
|
require_once 'classes/Database/Statement.php';
|
|
|
|
|
require_once 'classes/Database/db.php';
|
2021-01-28 15:57:55 +00:00
|
|
|
|
require_once 'classes/Battles/Database/DBPDO.php';
|
2018-03-03 20:51:37 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2020-10-28 20:21:08 +00:00
|
|
|
|
* Автозагрузка классов с учётом неймспейсов.
|
2018-03-03 20:51:37 +00:00
|
|
|
|
*/
|
2020-07-05 21:27:36 +00:00
|
|
|
|
|
2020-10-29 23:30:05 +00:00
|
|
|
|
spl_autoload_register(function ($className) {
|
2020-10-28 20:21:08 +00:00
|
|
|
|
$fileName = __DIR__ . '/classes/' . str_replace('\\', '/', $className . '.php');
|
|
|
|
|
if (file_exists($fileName)) {
|
|
|
|
|
require_once $fileName;
|
|
|
|
|
}
|
2018-03-03 20:51:37 +00:00
|
|
|
|
});
|
2020-02-17 15:37:32 +00:00
|
|
|
|
|
2021-08-25 15:24:12 +00:00
|
|
|
|
/**
|
|
|
|
|
* Глобальные переменные. Промежуточное решение для совместимости.
|
|
|
|
|
*/
|
|
|
|
|
if (empty(\Battles\Database\DBPDO::$db)) {
|
|
|
|
|
\Battles\Database\DBPDO::$db = new \Battles\Database\DBPDO();
|
|
|
|
|
}
|
|
|
|
|
if (empty(\Battles\User::$current) && $_SESSION['uid']) {
|
|
|
|
|
\Battles\User::$current = new \Battles\User($_SESSION['uid']);
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-10 21:03:59 +00:00
|
|
|
|
// Для нападалок. Сперва комнаты в которых нельзя напасть, потом персонажи на которых нельзя напасть.
|
|
|
|
|
const UNKILABLE = [
|
|
|
|
|
'rooms' => [620, 621, 1051, 1052],
|
|
|
|
|
'users' => [10962, 10964, 10965],
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// Кажется, для пещер.
|
|
|
|
|
const CANAL_ENTERS = [620];
|
|
|
|
|
const CAVE_ROOMS = [621];
|
|
|
|
|
const CAVE_DATA = [
|
|
|
|
|
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' => 'Проклятого Рудника'
|
|
|
|
|
],
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const EXPTABLE = [
|
|
|
|
|
0 => [0, 0, 0, 0, 0, 20],
|
|
|
|
|
20 => [1, 0, 0, 0, 0, 45],
|
|
|
|
|
45 => [1, 0, 0, 2, 0, 75],
|
|
|
|
|
75 => [1, 0, 0, 4, 0, 110],
|
|
|
|
|
110 => [3, 1, 1, 8, 1, 160], # Это первый уровень
|
|
|
|
|
|
|
|
|
|
160 => [1, 0, 0, 2, 0, 215],
|
|
|
|
|
215 => [1, 0, 0, 2, 0, 280],
|
|
|
|
|
280 => [1, 0, 0, 4, 0, 350],
|
|
|
|
|
350 => [1, 0, 0, 8, 0, 410],
|
|
|
|
|
410 => [3, 1, 1, 16, 1, 530], # Это второй уровень
|
|
|
|
|
|
|
|
|
|
530 => [1, 0, 0, 8, 0, 670],
|
|
|
|
|
670 => [1, 0, 0, 12, 0, 830],
|
|
|
|
|
830 => [1, 0, 0, 16, 0, 950],
|
|
|
|
|
950 => [1, 0, 0, 24, 0, 1100],
|
|
|
|
|
1100 => [1, 0, 0, 32, 0, 1300],
|
|
|
|
|
1300 => [3, 1, 1, 40, 1, 1450], # Это третий уровень
|
|
|
|
|
|
|
|
|
|
1450 => [1, 0, 0, 10, 0, 1650],
|
|
|
|
|
1650 => [1, 0, 0, 20, 0, 1850],
|
|
|
|
|
1850 => [1, 0, 0, 30, 0, 2050],
|
|
|
|
|
2050 => [1, 0, 0, 40, 0, 2200],
|
|
|
|
|
2200 => [1, 0, 0, 50, 0, 2500],
|
|
|
|
|
2500 => [5, 1, 1, 70, 1, 2900], # Это четвёртый уровень
|
|
|
|
|
|
|
|
|
|
2900 => [1, 0, 0, 10, 0, 3350],
|
|
|
|
|
3350 => [1, 0, 0, 20, 0, 3800],
|
|
|
|
|
3800 => [1, 0, 0, 30, 0, 4200],
|
|
|
|
|
4200 => [1, 0, 0, 40, 0, 4600],
|
|
|
|
|
4600 => [1, 0, 0, 50, 0, 5000],
|
|
|
|
|
5000 => [3, 1, 1, 80, 1, 6000], # Это пятый уровень
|
|
|
|
|
];
|