battles/module_quest.php

57 lines
2.0 KiB
PHP
Raw Permalink Normal View History

2020-08-30 01:09:52 +00:00
<?php
use Battles\Template;
use Battles\User;
2020-08-30 01:09:52 +00:00
require_once 'functions.php';
require_once 'classes/quests_class.php';
2018-01-28 16:40:49 +00:00
2020-08-30 01:09:52 +00:00
$qEndNow = $_GET['end_qst_now'] ?? null;
$qEnd = $_GET['end_qst'] ?? null;
2018-01-28 16:40:49 +00:00
2020-08-30 01:09:52 +00:00
if ($qEndNow) {
$q->endq((int)$_GET['end_qst_now'], 'end', $user);
}
2020-08-30 01:09:52 +00:00
if ($qEnd) {
$q->winqst((int)$_GET['end_qst'], $user);
}
2018-01-28 16:40:49 +00:00
$qsee = '';
$qx = 0;
$error = '';
2018-01-28 16:40:49 +00:00
Template::header('module_quest');
2018-01-28 16:40:49 +00:00
?>
<link rel="stylesheet" href="css/hostel.css"/>
2018-01-28 16:40:49 +00:00
<?php
$sp = db::c()->query('SELECT `vars` FROM `actions` WHERE `vars` LIKE "?S" AND `vals` = "?s" AND `uid` = ?i LIMIT 100', "%start_quest%", "go", User::getInstance()->getId());
while ($pl = $sp->fetch_assoc()) {
$questId = str_replace('start_quest', '', $pl['vars']);
$pq = db::c()->query('SELECT `id`,`name`,`info` FROM `quests` WHERE `id` = ?i', $questId)->fetch_assoc();
$qsee .= sprintf('<a href="?end_qst_now=%s"><img src="/i/clear.gif" title="Отказаться от задания"></a> <b>%s</b><span style="float: right;"><a href="?end_qst=%s">Выполнить</a></span><div style="padding-left: 15px; padding-bottom: 5px; border-bottom: 1px solid grey;"><small>%s<br>$s</small></div><br>', $pq['id'], $pq['name'], $pq['id'], $pq['info'], $q->info($pq, User::getInstance()->getId()));
$qx++;
2018-01-28 16:40:49 +00:00
}
2020-08-30 01:09:52 +00:00
if (!$qsee) {
$qsee = 'У вас нет заданий.';
}
if ($q->error) {
$error = $q->error;
}
2018-01-28 16:40:49 +00:00
?>
<div class="contentContainer">
<div style="text-align: center; padding-top: 3px;"><span
class="hs">Состояние персонажа, <?= $user['login']; ?></span></div>
<div class="buttonContainer">
<input type="button" class="btns button-route" value="Вернуться" onclick="location.href='main.php';"/>
<input type="button" class="btns button-route" value="Обновить" onclick="location.href='module_quest.php';"/>
</div>
<?php if ($error) {
err($error);
} ?>
<div class="quest_target_container" style="padding-top: 15px;">
2020-08-30 01:09:52 +00:00
<?= $qsee ?>
</div>
</div>