2022-12-19 18:26:14 +00:00
|
|
|
|
<?php
|
2023-01-12 20:38:13 +00:00
|
|
|
|
|
|
|
|
|
use DarksLight2\Training\Steps\FirstStep;
|
|
|
|
|
use DarksLight2\Training\TrainingException;
|
|
|
|
|
use DarksLight2\Training\TrainingManager;
|
|
|
|
|
|
2022-12-19 18:26:14 +00:00
|
|
|
|
const GAME = true; // Для совместимости с этой "защитой".
|
|
|
|
|
const GAME_VERSION = 'alpha-7.4';
|
|
|
|
|
// Новая автозагрузка.
|
|
|
|
|
// ВНИМАНИЕ! Не введено в эксплуатацию!
|
|
|
|
|
|
|
|
|
|
require_once 'mysql_override.php';
|
2022-12-19 20:16:24 +00:00
|
|
|
|
require_once 'class/Insallah/Config.php';
|
2022-12-19 18:26:14 +00:00
|
|
|
|
|
|
|
|
|
spl_autoload_register(function (string $className) {
|
|
|
|
|
# 1 with namespaces
|
|
|
|
|
# 2 without
|
|
|
|
|
$fileName = [
|
|
|
|
|
__DIR__ . '/class/' . str_replace('\\', DIRECTORY_SEPARATOR, $className . '.php'),
|
|
|
|
|
__DIR__ . '/class/' . $className . '.php'
|
|
|
|
|
];
|
|
|
|
|
foreach ($fileName as $file) {
|
|
|
|
|
if (file_exists($file)) {
|
|
|
|
|
require_once $file;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
spl_autoload_register(function (string $classname) {
|
|
|
|
|
$classMap = [
|
|
|
|
|
'NewCombats' => __DIR__ . '/class/',
|
|
|
|
|
'Insallah' => __DIR__ . '/class/Insallah/',
|
2023-01-10 22:39:11 +00:00
|
|
|
|
'DarksLight2' => __DIR__ . '/class/DarksLight2/',
|
2022-12-19 18:26:14 +00:00
|
|
|
|
];
|
|
|
|
|
$parts = explode('\\', $classname);
|
|
|
|
|
$namespace = array_shift($parts);
|
|
|
|
|
$classFile = array_pop($parts) . '.php';
|
|
|
|
|
|
|
|
|
|
if (!array_key_exists($namespace, $classMap)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$path = implode(DIRECTORY_SEPARATOR, $parts);
|
|
|
|
|
$file = $classMap[$namespace] . $path . DIRECTORY_SEPARATOR . $classFile;
|
|
|
|
|
|
|
|
|
|
if (!file_exists($file) && !class_exists($classname)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
require_once $file;
|
|
|
|
|
});
|
2023-01-12 20:38:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Нужно перенести в другое местечко, но пока так
|
|
|
|
|
*/
|
|
|
|
|
try {
|
|
|
|
|
$training_manager = TrainingManager::getInstance(User::start()->info['id']);
|
|
|
|
|
$training_manager->createDatabaseRecord();
|
|
|
|
|
$training_manager->register([
|
|
|
|
|
new FirstStep(),
|
|
|
|
|
]);
|
|
|
|
|
} catch (TrainingException $e) {
|
|
|
|
|
}
|