Доработка
This commit is contained in:
parent
dcc6a1337c
commit
46c1e38ea8
@ -14,8 +14,6 @@ use DarksLight2\Training\Steps\MyUserThirdQuest;
|
|||||||
use DarksLight2\Training\Steps\MyUserThirdStep;
|
use DarksLight2\Training\Steps\MyUserThirdStep;
|
||||||
use DarksLight2\Traits\Singleton;
|
use DarksLight2\Traits\Singleton;
|
||||||
use PassGen;
|
use PassGen;
|
||||||
use PDO;
|
|
||||||
use stdClass;
|
|
||||||
use User;
|
use User;
|
||||||
|
|
||||||
class TrainingManager
|
class TrainingManager
|
||||||
@ -147,10 +145,8 @@ class TrainingManager
|
|||||||
private function generateToken($length = 16)
|
private function generateToken($length = 16)
|
||||||
{
|
{
|
||||||
|
|
||||||
$token = PassGen::new($length);
|
|
||||||
|
|
||||||
Db::run('UPDATE user_training SET api_token = ? WHERE user_id = ?', [
|
Db::run('UPDATE user_training SET api_token = ? WHERE user_id = ?', [
|
||||||
$token,
|
PassGen::new($length),
|
||||||
$this->user_id
|
$this->user_id
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ if(!empty($user->info)) {
|
|||||||
case 'go_back':
|
case 'go_back':
|
||||||
$training->previousStep();
|
$training->previousStep();
|
||||||
$training->store();
|
$training->store();
|
||||||
die(json_encode(['status' => 'ok', 'message' => 'Вы указал не верный ответ!']));
|
die(json_encode(['status' => 'ok', 'message' => 'Вы указали не верный ответ!']));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
9
main.php
9
main.php
@ -36,7 +36,6 @@ if (!defined('GAME_VERSION')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
use Core\{Config, Database, Db};
|
use Core\{Config, Database, Db};
|
||||||
use DarksLight2\Training\TrainingException;
|
|
||||||
use DarksLight2\Training\TrainingManager;
|
use DarksLight2\Training\TrainingManager;
|
||||||
|
|
||||||
$training_manager = TrainingManager::getInstance(User::start()->info['id']);
|
$training_manager = TrainingManager::getInstance(User::start()->info['id']);
|
||||||
@ -60,6 +59,8 @@ $u = User::start();
|
|||||||
$filter = new Filter();
|
$filter = new Filter();
|
||||||
$q = new Quests;
|
$q = new Quests;
|
||||||
|
|
||||||
|
$training_manager = TrainingManager::getInstance($u->info['id']);
|
||||||
|
|
||||||
/** Восстанавливаем всем ботам, которые не в бою здоровье до максимума. */
|
/** Восстанавливаем всем ботам, которые не в бою здоровье до максимума. */
|
||||||
Db::exec(
|
Db::exec(
|
||||||
'update stats set hpNow = hpAll, mpNow = mpAll
|
'update stats set hpNow = hpAll, mpNow = mpAll
|
||||||
@ -562,11 +563,7 @@ $spl = $spl['exp'];
|
|||||||
echo '<script>top.myexpLineTop27(' . $u->info['exp'] . ',' . $spl . ');' . $tjs . 'top.ctest("' . $u->info['city'] . '");top.sd4key="' . $u->info['nextAct'] . '"; var battle = ' . (0 + $u->info['battle']) . '; top.hic();</script></body>
|
echo '<script>top.myexpLineTop27(' . $u->info['exp'] . ',' . $spl . ');' . $tjs . 'top.ctest("' . $u->info['city'] . '");top.sd4key="' . $u->info['nextAct'] . '"; var battle = ' . (0 + $u->info['battle']) . '; top.hic();</script></body>
|
||||||
</html>';
|
</html>';
|
||||||
|
|
||||||
try {
|
$training_manager->render();
|
||||||
$training_manager->render();
|
|
||||||
} catch (TrainingException $e) {
|
|
||||||
echo $e->getMessage();
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.2/modernizr.js"></script>-->
|
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.2/modernizr.js"></script>-->
|
||||||
<script>
|
<script>
|
||||||
|
@ -444,10 +444,15 @@ $tma = '';
|
|||||||
WHERE
|
WHERE
|
||||||
`id` = '" . (int)$u->info['id'] . "';"
|
`id` = '" . (int)$u->info['id'] . "';"
|
||||||
)) {
|
)) {
|
||||||
TrainingManager::getInstance()
|
if((int)$u->info['ability'] === 0 && (int)$u->info['skills'] === 0) {
|
||||||
->addPoint('my_user_third_quest', function (TrainingManager $manager) {
|
TrainingManager::getInstance()
|
||||||
$manager->store();
|
->addPoint(
|
||||||
});
|
'my_user_third_quest',
|
||||||
|
function (TrainingManager $manager) {
|
||||||
|
$manager->store();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//if($_GET['energy']>0) {echo ' <font color=red>Увеличение способности "<B>Энергия</B>" произведено удачно</font><br>';}
|
//if($_GET['energy']>0) {echo ' <font color=red>Увеличение способности "<B>Энергия</B>" произведено удачно</font><br>';}
|
||||||
if ($_GET['str'] > 0) {
|
if ($_GET['str'] > 0) {
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
ini_set('display_errors', 1);
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string $short_name
|
* @var string $short_name
|
||||||
* @var $answer
|
* @var $answer
|
||||||
@ -16,7 +13,7 @@ use DarksLight2\Training\TrainingManager;
|
|||||||
|
|
||||||
$manager = TrainingManager::getInstance();
|
$manager = TrainingManager::getInstance();
|
||||||
$step = $manager->getRegistered()[$short_name];
|
$step = $manager->getRegistered()[$short_name];
|
||||||
$button_text = 'Продолжить';
|
|
||||||
$time = time();
|
$time = time();
|
||||||
|
|
||||||
$token = password_hash($manager->getDatabaseData()['api_token'] . $time . $user->info['id'], PASSWORD_DEFAULT);
|
$token = password_hash($manager->getDatabaseData()['api_token'] . $time . $user->info['id'], PASSWORD_DEFAULT);
|
||||||
@ -27,7 +24,6 @@ $token = password_hash($manager->getDatabaseData()['api_token'] . $time . $user-
|
|||||||
return {
|
return {
|
||||||
content: `<?=$step->getMessage()?>`,
|
content: `<?=$step->getMessage()?>`,
|
||||||
title: `<?=$step->getTitle()?>`,
|
title: `<?=$step->getTitle()?>`,
|
||||||
button_text: `<?=$button_text?>`,
|
|
||||||
time: <?=$time?>,
|
time: <?=$time?>,
|
||||||
token: '<?=$token?>',
|
token: '<?=$token?>',
|
||||||
short_name: '<?=$short_name?>',
|
short_name: '<?=$short_name?>',
|
||||||
|
Loading…
Reference in New Issue
Block a user