Доработка

This commit is contained in:
Maksym 2023-01-18 18:24:00 +01:00
parent dcc6a1337c
commit 46c1e38ea8
5 changed files with 15 additions and 21 deletions

View File

@ -14,8 +14,6 @@ use DarksLight2\Training\Steps\MyUserThirdQuest;
use DarksLight2\Training\Steps\MyUserThirdStep;
use DarksLight2\Traits\Singleton;
use PassGen;
use PDO;
use stdClass;
use User;
class TrainingManager
@ -147,10 +145,8 @@ class TrainingManager
private function generateToken($length = 16)
{
$token = PassGen::new($length);
Db::run('UPDATE user_training SET api_token = ? WHERE user_id = ?', [
$token,
PassGen::new($length),
$this->user_id
]);
}

View File

@ -63,7 +63,7 @@ if(!empty($user->info)) {
case 'go_back':
$training->previousStep();
$training->store();
die(json_encode(['status' => 'ok', 'message' => 'Вы указал не верный ответ!']));
die(json_encode(['status' => 'ok', 'message' => 'Вы указали не верный ответ!']));
}
}

View File

@ -36,7 +36,6 @@ if (!defined('GAME_VERSION')) {
}
use Core\{Config, Database, Db};
use DarksLight2\Training\TrainingException;
use DarksLight2\Training\TrainingManager;
$training_manager = TrainingManager::getInstance(User::start()->info['id']);
@ -60,6 +59,8 @@ $u = User::start();
$filter = new Filter();
$q = new Quests;
$training_manager = TrainingManager::getInstance($u->info['id']);
/** Восстанавливаем всем ботам, которые не в бою здоровье до максимума. */
Db::exec(
'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>
</html>';
try {
$training_manager->render();
} catch (TrainingException $e) {
echo $e->getMessage();
}
$training_manager->render();
?>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.2/modernizr.js"></script>-->
<script>

View File

@ -444,10 +444,15 @@ $tma = '';
WHERE
`id` = '" . (int)$u->info['id'] . "';"
)) {
if((int)$u->info['ability'] === 0 && (int)$u->info['skills'] === 0) {
TrainingManager::getInstance()
->addPoint('my_user_third_quest', function (TrainingManager $manager) {
->addPoint(
'my_user_third_quest',
function (TrainingManager $manager) {
$manager->store();
});
}
);
}
//if($_GET['energy']>0) {echo '&nbsp; &nbsp;<font color=red>Увеличение способности "<B>Энергия</B>" произведено удачно</font><br>';}
if ($_GET['str'] > 0) {

View File

@ -1,8 +1,5 @@
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
/**
* @var string $short_name
* @var $answer
@ -16,7 +13,7 @@ use DarksLight2\Training\TrainingManager;
$manager = TrainingManager::getInstance();
$step = $manager->getRegistered()[$short_name];
$button_text = 'Продолжить';
$time = time();
$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 {
content: `<?=$step->getMessage()?>`,
title: `<?=$step->getTitle()?>`,
button_text: `<?=$button_text?>`,
time: <?=$time?>,
token: '<?=$token?>',
short_name: '<?=$short_name?>',