battles/module_quest.php
2020-08-30 04:09:52 +03:00

120 lines
3.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
session_start();
if (empty($_SESSION['uid'])) {
header('Location: /index.php');
exit();
}
require_once 'functions.php';
include('classes/quests_class.php');
$qEndNow = $_GET['end_qst_now'] ?? null;
$qEnd = $_GET['end_qst'] ?? null;
if ($qEndNow) {
$q->endq((int)$_GET['end_qst_now'], 'end', $user);
}
if ($qEnd) {
$q->winqst((int)$_GET['end_qst'], $user);
}
$qsee = '';
$qx = 0;
$error = '';
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<title></title>
<meta charset="utf-8">
<link rel="stylesheet" href="css/hostel.css"/>
<style>
div.ctContainerA, div.ctContainerB {
position: relative;
margin-bottom: 5px;
padding: 5px;
box-shadow: 3px 3px 5px 0 #323232;
}
div.ctContainerA {
border: 2px groove threedface;
}
div.ctTitle {
margin-bottom: 3px;
border-bottom: 2px groove threedface;
font-weight: bold;
color: #bf0000;
}
div.ctContent {
overflow: hidden;
position: relative;
width: 100%;
}
div.quest_target_item div.ctTitle a.action-start {
float: right;
}
div.quest_target_item[forever='1'] div.ctContent .available {
color: #800;
}
div.quest_target_item[forever='0'][available='0'] div.ctContent .available {
color: blue;
}
div.quest_target_item div.ctContent .available {
font-size: small;
}
div.quest_target_item div.ctContent img.icon {
width: 60px;
height: 60px;
float: left;
margin: 2px;
}
div.qriContainer {
position: relative;
display: inline;
font-size: 80%;
}
</style>
</head>
<body>
<?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->id);
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->id));
$qx++;
}
if (!$qsee) {
$qsee = 'У вас нет заданий.';
}
if ($q->error) {
$error = $q->error;
}
?>
<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;">
<?= $qsee ?>
</div>
</div>
</body>
</html>