mirror of
https://github.com/simon987/Much-Assembly-Required-Frontend.git
synced 2025-04-10 06:16:45 +00:00
Added leaderboard page. Updated debug commands
This commit is contained in:
parent
b8c9beaead
commit
d9ba7759e5
@ -25,6 +25,7 @@ $user = SessionManager::get();
|
|||||||
<ul>
|
<ul>
|
||||||
<li><a href="index.php">Home</a></li>
|
<li><a href="index.php">Home</a></li>
|
||||||
<li><a href="game.php">Game</a></li>
|
<li><a href="game.php">Game</a></li>
|
||||||
|
<li><a href="leaderboard.php">Leaderboard</a></li>
|
||||||
<li class="current">
|
<li class="current">
|
||||||
<a href="#">Account</a>
|
<a href="#">Account</a>
|
||||||
<ul>
|
<ul>
|
||||||
|
14
database.sql
14
database.sql
@ -9,8 +9,8 @@ flush privileges;
|
|||||||
use mar;
|
use mar;
|
||||||
|
|
||||||
-- create tables
|
-- create tables
|
||||||
create table mar_user
|
create table mar_user (
|
||||||
(
|
|
||||||
username varchar(20) not null
|
username varchar(20) not null
|
||||||
primary key,
|
primary key,
|
||||||
password tinytext not null,
|
password tinytext not null,
|
||||||
@ -18,3 +18,13 @@ create table mar_user
|
|||||||
tokenTime datetime null,
|
tokenTime datetime null,
|
||||||
floppyData mediumblob null
|
floppyData mediumblob null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table mar_vault_clear (
|
||||||
|
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
username VARCHAR(20) NOT NULL,
|
||||||
|
clear_time INTEGER NOT NULL,
|
||||||
|
vault_id VARCHAR(20),
|
||||||
|
|
||||||
|
FOREIGN KEY (username) REFERENCES mar_user(username),
|
||||||
|
CONSTRAINT mar_vault_clear_uc_1 UNIQUE (username, vault_id)
|
||||||
|
)
|
||||||
|
1
game.php
1
game.php
@ -50,6 +50,7 @@ if (isset($user)) {
|
|||||||
<ul>
|
<ul>
|
||||||
<li><a href="index.php">Home</a></li>
|
<li><a href="index.php">Home</a></li>
|
||||||
<li class="current"><a href="servers.php">Play</a></li>
|
<li class="current"><a href="servers.php">Play</a></li>
|
||||||
|
<li><a href="leaderboard.php">Leaderboard</a></li>
|
||||||
<li>
|
<li>
|
||||||
<a href="#">Account</a>
|
<a href="#">Account</a>
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -39,6 +39,7 @@ $user = SessionManager::get();
|
|||||||
<ul>
|
<ul>
|
||||||
<li class="current"><a href="index.php">Home</a></li>
|
<li class="current"><a href="index.php">Home</a></li>
|
||||||
<li><a href="servers.php">Play</a></li>
|
<li><a href="servers.php">Play</a></li>
|
||||||
|
<li><a href="leaderboard.php">Leaderboard</a></li>
|
||||||
<li>
|
<li>
|
||||||
<a href="#">Account</a>
|
<a href="#">Account</a>
|
||||||
<ul>
|
<ul>
|
||||||
|
151
leaderboard.php
Normal file
151
leaderboard.php
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
<?php
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
include_once "include/SessionManager.php";
|
||||||
|
include_once "include/SqlConnection.php";
|
||||||
|
|
||||||
|
$user = SessionManager::get();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Server List - Much Assembly Required</title>
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<meta name="description"
|
||||||
|
content="Much Assembly Required is a game where you can program your robot's microprocessor in x86-like assembly language in a procedurally generated universe">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||||
|
<!--[if lte IE 8]>
|
||||||
|
<script src="assets/js/ie/html5shiv.js"></script><![endif]-->
|
||||||
|
<link rel="stylesheet" href="assets/css/main.min.css"/>
|
||||||
|
<!--[if lte IE 8]>
|
||||||
|
<link rel="stylesheet" href="assets/css/ie8.min.css"/><![endif]-->
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: 'fixedsys';
|
||||||
|
src: url("assets/fonts/FSEX301-L2.ttf");
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
margin: 0 0 2.25em 0;
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
border-spacing: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
table tbody tr {
|
||||||
|
border: solid 2px #f4f4f4;
|
||||||
|
border-left: 0;
|
||||||
|
border-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
table tbody tr:nth-child(2n + 1) {
|
||||||
|
background-color: #fafafa;
|
||||||
|
}
|
||||||
|
|
||||||
|
table td {
|
||||||
|
padding: 0.75em 0.75em;
|
||||||
|
}
|
||||||
|
|
||||||
|
table th {
|
||||||
|
color: #777;
|
||||||
|
font-size: 0.9em;
|
||||||
|
font-weight: 700;
|
||||||
|
padding: 0 0.75em 0.75em 0.75em;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
table thead {
|
||||||
|
border-bottom: solid 4px #e4e4e4;
|
||||||
|
}
|
||||||
|
|
||||||
|
table tfoot {
|
||||||
|
border-top: solid 4px #e4e4e4;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="homepage">
|
||||||
|
|
||||||
|
<!-- Nav -->
|
||||||
|
<nav id="nav">
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.php">Home</a></li>
|
||||||
|
<li><a href="servers.php">Play</a></li>
|
||||||
|
<li class="current"><a href="#">Leaderboard</a></li>
|
||||||
|
<li>
|
||||||
|
<a href="#">Account</a>
|
||||||
|
<ul>
|
||||||
|
<?php if ($user) { ?>
|
||||||
|
<li><a href="account.php"><?php echo $user["username"] ?></a></li>
|
||||||
|
<li><a href="logout.re.php">Logout</a></li>
|
||||||
|
<?php } else { ?>
|
||||||
|
<li><a href="login.php">login</a></li>
|
||||||
|
<?php } ?>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div id="page-wrapper">
|
||||||
|
|
||||||
|
<?php // include "header.inc.html" ?>
|
||||||
|
|
||||||
|
<!-- Main -->
|
||||||
|
<div id="main-wrapper">
|
||||||
|
<div id="main" class="container">
|
||||||
|
<div class="12u">
|
||||||
|
|
||||||
|
<h2>Leaderboard</h2>
|
||||||
|
|
||||||
|
<table id="serverList">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Player</th>
|
||||||
|
<th>Completed vaults</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$conn = new SqlConnection();
|
||||||
|
$stmt = $conn->prepare("SELECT username, count(username) as clears FROM mar_vault_clear GROUP BY username ORDER BY clears DESC ");
|
||||||
|
$stmt->execute();
|
||||||
|
$users = $stmt->fetchAll();
|
||||||
|
|
||||||
|
foreach ($users as $user) {
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td>$user[0]</td>";
|
||||||
|
echo "<td>$user[1]</td>";
|
||||||
|
|
||||||
|
echo "</tr>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php //include "footer.inc.html" ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Scripts -->
|
||||||
|
<script src="assets/js/jquery.min.js"></script>
|
||||||
|
<script src="assets/js/jquery.dropotron.min.js"></script>
|
||||||
|
<script src="assets/js/skel.min.js"></script>
|
||||||
|
<script src="assets/js/util.min.js"></script>
|
||||||
|
<!--[if lte IE 8]>
|
||||||
|
<script src="assets/js/ie/respond.min.js"></script><![endif]-->
|
||||||
|
<script src="assets/js/main.min.js"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -34,6 +34,7 @@ $user = SessionManager::get();
|
|||||||
<ul>
|
<ul>
|
||||||
<li><a href="index.php">Home</a></li>
|
<li><a href="index.php">Home</a></li>
|
||||||
<li><a href="servers.php">Play</a></li>
|
<li><a href="servers.php">Play</a></li>
|
||||||
|
<li><a href="leaderboard.php">Leaderboard</a></li>
|
||||||
<li class="current">
|
<li class="current">
|
||||||
<a href="#">Account</a>
|
<a href="#">Account</a>
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -368,12 +368,12 @@ var Debug = /** @class */ (function () {
|
|||||||
}
|
}
|
||||||
Debug.setTileAt = function (x, y, newTile) {
|
Debug.setTileAt = function (x, y, newTile) {
|
||||||
mar.client.sendDebugCommand({ t: "debug", command: "setTileAt", x: x, y: y, newTile: newTile,
|
mar.client.sendDebugCommand({ t: "debug", command: "setTileAt", x: x, y: y, newTile: newTile,
|
||||||
worldX: mar.client.worldX, worldY: mar.client.worldY });
|
worldX: mar.client.worldX, worldY: mar.client.worldY, dimension: mar.client.dimension });
|
||||||
mar.client.requestTerrain(); //Reload terrain
|
mar.client.requestTerrain(); //Reload terrain
|
||||||
};
|
};
|
||||||
Debug.createWorld = function (x, y, dimension) {
|
Debug.createWorld = function (x, y, dimension) {
|
||||||
mar.client.sendDebugCommand({ t: "debug", command: "createWorld", worldX: x, worldY: y, dimension: dimension });
|
mar.client.sendDebugCommand({ t: "debug", command: "createWorld", worldX: x, worldY: y, dimension: dimension });
|
||||||
mar.client.requestTerrain(); //Reload terrain
|
window.setTimeout(mar.client.requestTerrain, 250);
|
||||||
};
|
};
|
||||||
Debug.createWorldHex = function (x, y, dimension) {
|
Debug.createWorldHex = function (x, y, dimension) {
|
||||||
mar.client.sendDebugCommand({ t: "debug", command: "createWorld",
|
mar.client.sendDebugCommand({ t: "debug", command: "createWorld",
|
||||||
@ -420,6 +420,9 @@ var Debug = /** @class */ (function () {
|
|||||||
mar.client.sendDebugCommand({ t: "debug", command: "spawnObj", data: data,
|
mar.client.sendDebugCommand({ t: "debug", command: "spawnObj", data: data,
|
||||||
worldX: mar.client.worldX, worldY: mar.client.worldY, dimension: mar.client.dimension });
|
worldX: mar.client.worldX, worldY: mar.client.worldY, dimension: mar.client.dimension });
|
||||||
};
|
};
|
||||||
|
Debug.comPortMsg = function (objectId, message) {
|
||||||
|
mar.client.sendDebugCommand({ t: "debug", command: "comPortMsg", objectId: objectId, message: message });
|
||||||
|
};
|
||||||
return Debug;
|
return Debug;
|
||||||
}());
|
}());
|
||||||
DEBUG = false; // todo remove
|
DEBUG = false; // todo remove
|
||||||
|
@ -115,14 +115,14 @@ class Debug {
|
|||||||
|
|
||||||
public static setTileAt(x, y, newTile) {
|
public static setTileAt(x, y, newTile) {
|
||||||
mar.client.sendDebugCommand({t:"debug", command: "setTileAt", x: x, y: y, newTile: newTile,
|
mar.client.sendDebugCommand({t:"debug", command: "setTileAt", x: x, y: y, newTile: newTile,
|
||||||
worldX: mar.client.worldX, worldY: mar.client.worldY});
|
worldX: mar.client.worldX, worldY: mar.client.worldY, dimension: mar.client.dimension});
|
||||||
|
|
||||||
mar.client.requestTerrain(); //Reload terrain
|
mar.client.requestTerrain(); //Reload terrain
|
||||||
}
|
}
|
||||||
|
|
||||||
public static createWorld(x, y, dimension) {
|
public static createWorld(x, y, dimension) {
|
||||||
mar.client.sendDebugCommand({t:"debug", command: "createWorld", worldX: x, worldY: y, dimension:dimension});
|
mar.client.sendDebugCommand({t:"debug", command: "createWorld", worldX: x, worldY: y, dimension:dimension});
|
||||||
mar.client.requestTerrain(); //Reload terrain
|
window.setTimeout(mar.client.requestTerrain, 250)
|
||||||
}
|
}
|
||||||
|
|
||||||
public static createWorldHex(x, y, dimension) {
|
public static createWorldHex(x, y, dimension) {
|
||||||
@ -180,6 +180,10 @@ class Debug {
|
|||||||
worldX: mar.client.worldX, worldY: mar.client.worldY, dimension: mar.client.dimension});
|
worldX: mar.client.worldX, worldY: mar.client.worldY, dimension: mar.client.dimension});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static comPortMsg(objectId, message) {
|
||||||
|
mar.client.sendDebugCommand({t:"debug", command: "comPortMsg", objectId: objectId, message: message});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG = false; // todo remove
|
DEBUG = false; // todo remove
|
||||||
|
91
servers.php
91
servers.php
@ -29,6 +29,43 @@ $user = SessionManager::get();
|
|||||||
src: url("assets/fonts/FSEX301-L2.ttf");
|
src: url("assets/fonts/FSEX301-L2.ttf");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
margin: 0 0 2.25em 0;
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
border-spacing: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
table tbody tr {
|
||||||
|
border: solid 2px #f4f4f4;
|
||||||
|
border-left: 0;
|
||||||
|
border-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
table tbody tr:nth-child(2n + 1) {
|
||||||
|
background-color: #fafafa;
|
||||||
|
}
|
||||||
|
|
||||||
|
table td {
|
||||||
|
padding: 0.75em 0.75em;
|
||||||
|
}
|
||||||
|
|
||||||
|
table th {
|
||||||
|
color: #777;
|
||||||
|
font-size: 0.9em;
|
||||||
|
font-weight: 700;
|
||||||
|
padding: 0 0.75em 0.75em 0.75em;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
table thead {
|
||||||
|
border-bottom: solid 4px #e4e4e4;
|
||||||
|
}
|
||||||
|
|
||||||
|
table tfoot {
|
||||||
|
border-top: solid 4px #e4e4e4;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
@ -38,7 +75,8 @@ $user = SessionManager::get();
|
|||||||
<nav id="nav">
|
<nav id="nav">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="index.php">Home</a></li>
|
<li><a href="index.php">Home</a></li>
|
||||||
<li class="current"><a href="servers.php">Play</a></li>
|
<li class="current"><a href="#">Play</a></li>
|
||||||
|
<li><a href="leaderboard.php">Leaderboard</a></li>
|
||||||
<li>
|
<li>
|
||||||
<a href="#">Account</a>
|
<a href="#">Account</a>
|
||||||
<ul>
|
<ul>
|
||||||
@ -62,57 +100,16 @@ $user = SessionManager::get();
|
|||||||
<div id="main" class="container">
|
<div id="main" class="container">
|
||||||
<div class="12u">
|
<div class="12u">
|
||||||
|
|
||||||
|
<h2>Server List</h2>
|
||||||
<style>
|
|
||||||
|
|
||||||
table {
|
|
||||||
margin: 0 0 2.25em 0;
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: collapse;
|
|
||||||
border-spacing: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
table tbody tr {
|
|
||||||
border: solid 2px #f4f4f4;
|
|
||||||
border-left: 0;
|
|
||||||
border-right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
table tbody tr:nth-child(2n + 1) {
|
|
||||||
background-color: #fafafa;
|
|
||||||
}
|
|
||||||
|
|
||||||
table td {
|
|
||||||
padding: 0.75em 0.75em;
|
|
||||||
}
|
|
||||||
|
|
||||||
table th {
|
|
||||||
color: #777;
|
|
||||||
font-size: 0.9em;
|
|
||||||
font-weight: 700;
|
|
||||||
padding: 0 0.75em 0.75em 0.75em;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
table thead {
|
|
||||||
border-bottom: solid 4px #e4e4e4;
|
|
||||||
}
|
|
||||||
|
|
||||||
table tfoot {
|
|
||||||
border-top: solid 4px #e4e4e4;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<h2>Server list</h2>
|
|
||||||
|
|
||||||
<table id="serverList">
|
<table id="serverList">
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
foreach (SERVER_LIST as $server) {
|
foreach (SERVER_LIST as $server) {
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
@ -123,6 +120,8 @@ $user = SessionManager::get();
|
|||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user