1
0
This commit is contained in:
Lukas Pioch 2014-11-05 21:58:21 +01:00
commit 2915ef5bdb
17 changed files with 1028 additions and 372 deletions

View File

@ -0,0 +1,2 @@
Hello! Welcome to the MCServer WebAdmin.<br>
This is a default message, edit <b>files/guest.html</b> to add your own custom message.

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 995 B

View File

@ -0,0 +1,219 @@
/* Copyright Justin S and MCServer Team, licensed under CC-BY-SA 3.0 */
* {
margin: 0;
}
body {
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
-webkit-font-smoothing: antialiased;
background: #fff url(header.png) repeat-x top left;
width: 100%;
min-width: 100%;
overflow: hidden;
}
a:link {
color: #555;
text-decoration: none;
}
a:visited {
color: #444;
text-decoration: none;
}
a:hover, a:active {
color: #000;
text-decoration: underline;
}
img {
border: none;
}
h1 {
color: #069;
}
.row1 {
border-bottom: 1px solid #000;
height: 100px;
max-height: 100px;
}
.row2 {
margin: 0 auto;
text-align: center;
vertical-align: middle;
}
.contention {
color: #000;
text-align: left;
line-height: 1.4;
margin: 0;
font-family: Tahoma,Verdana,Arial,Sans-Serif;
font-size: 13px;
}
button {
background: #fff;
color: #000;
border: 1px solid #ccc;
padding: 3px;
font-family: Tahoma,Verdana,Arial,Sans-Serif;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
margin: -3px 0;
}
button:hover {
border-top-color: #28597a;
background: #28597a;
color: #ccc;
}
button:active {
border-top-color: #1b435e;
background: #1b435e;
}
.push10 {
padding-bottom: 75px;
}
#panel .upper {
background: #dcdbdc url(tcat.png) repeat-x;
border-top: 1px solid #fff;
border-bottom: 1px solid #bbb;
padding: 7px;
}
#footer {
z-index: 99999;
}
#footer ul.menu {
margin: 0;
padding: 0;
list-style: none;
}
#footer ul.menu li {
margin: 0 5px;
display: inline;
}
#footer .upper {
background: #dcdbdc url(tcat.png) repeat-x;
border-top: 1px solid #bbb;
padding: 6px;
overflow: hidden;
font-size: 12px;
}
#footer .upper ul.bottom_links {
float: left;
margin: 3px 0 0 -5px;
}
#footer .lower {
background: #a1a2a2 url(thead.png) top left repeat-x;
color: #fff;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ddd;
overflow: hidden;
padding: 8px;
font-size: 11px;
}
#footer .lower a:link, #footer .lower a:visited {
color: #fff;
font-weight: 700;
}
#footer .lower a:hover, #footer .lower a:active {
color: #fff;
font-weight: 700;
}
#footer .lower #current_time {
float: right;
padding-right: 6px;
}
.wrapper {
width: 85%;
min-width: 970px;
max-width: 1500px;
margin: auto;
}
#footer {
position: fixed;
left: 0;
bottom: 0;
height: 60px;
width: 100%;
background: #999;
border-top: 1px #000 solid;
}
* html #footer {
position: absolute;
top: expression((0-(footer.offsetHeight)+(document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight)+(ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop))+'px');
}
tr td.trow2:first-child {
border-left: 0;
}
tr td.trow2:last-child {
border-right: 0;
}
.tborder {
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;
}
.thead, .rounded_top {
-moz-border-radius-topleft: 6px;
-moz-border-radius-topright: 6px;
-webkit-border-top-left-radius: 6px;
-webkit-border-top-right-radius: 6px;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
}
table {
color: #000;
font-size: 13px;
}
.tborder {
background: #fff;
width: 100%;
margin: auto;
border: 1px solid #ccc;
padding: 1px;
}
.thead {
background: #a1a2a2 url(thead.png) top left repeat-x;
color: #fff;
border-bottom: 1px solid #8e8f8f;
padding: 8px;
}
.trow2 {
background: #efefef;
border: 1px solid;
border-color: #fff #ddd #ddd #fff;
}
.padtopp {
padding-top: 25px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 995 B

View File

@ -1,353 +1,427 @@
body, html
{
font-family: "Open Sans", Tahoma, sans-serif;
padding: 0;
margin: 0;
font-weight: 400;
background-color: #fbe9e7;
color: rgba(0, 0, 0, 0.87);
/* Copyright Justin S and MCServer Team, licensed under CC-BY-SA 3.0 */
* {
margin: 0;
}
.light { font-weight: 300; }
.bold { font-weight: 600; }
#wrapper
{
background-color: #ff5722;
margin: 40px auto;
width: 99%;
max-width: 1200px;
box-sizing: border-box;
-moz-box-sizing: border-box;
box-shadow: 0px 4px 5px rgba(0, 0, 0, 0.15);
color: rgba(0, 0, 0, 0.87);
body {
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
-webkit-font-smoothing: antialiased;
background: #fff;
width: 100%;
min-width: 100%;
height:100%;
min-height:100%;
overflow-y: scroll;
overflow-x: hidden;
}
.title
{
font-size: 30pt;
padding: 10px 40px;
text-decoration: none;
color: white;
text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3);
display: block;
a:link {
color: #555;
text-decoration: none;
}
#sidebar
{
float: left;
width: 20%;
a:visited {
color: #444;
text-decoration: none;
}
.sideNav
{
list-style: none;
background-color: #fafafa;
margin: 20px 0;
padding: 5px 0;
width: 100%;
box-shadow: 1px 0px 10px rgba(0, 0, 0, 0.2);
a:hover, a:active {
color: #000;
text-decoration: underline;
}
.sideNav li
{
padding: 10px;
color: rgba(0, 0, 0, 0.54);
img {
border: none;
}
.sideNav li.link
{
padding-left: 30px;
h1 {
color: #069;
text-shadow: 2px 2px #000;
}
.sideNav li.link a
{
text-decoration: none;
color: rgba(0, 0, 0, 0.87);
.row1 {
border-bottom: 1px #000 solid;
height: 100px;
max-height: 100px;
background: #fff url(header.png) repeat-x top left;
}
#container
{
margin: 0;
padding: 0;
overflow: hidden;
background-color: #f5f5f5;
.row2 {
margin: 0 auto;
text-align: center;
vertical-align: middle;
margin-top: 25px;
margin-bottom: 25px;
}
#main
{
float: right;
width: 80%;
padding: 0 15px 20px 15px;
box-sizing: border-box;
-moz-box-sizing: border-box;
.contention {
color: #000;
text-align: left;
line-height: 1.4;
margin: 0;
font-family: Tahoma,Verdana,Arial,Sans-Serif;
font-size: 13px;
margin-bottom:75px;
}
.clear
{
clear: both;
.push25 {
}
table
{
width: 100%;
border-collapse: collapse;
#panel ul.menu {
margin: 0;
padding: 0;
list-style: none;
}
table td
{
padding: 5px;
#panel ul.menu li {
margin: 0 5px;
display: inline;
}
table th
{
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
padding: 5px;
text-align: center;
#panel ul.menu li a {
padding-left: 20px;
background-repeat: no-repeat;
background-position: left center;
}
table tr:nth-child(odd)
{
background-color: rgba(0, 0, 0, 0.015);
#panel .upper ul.top_links {
float: right;
font-weight: 700;
}
p
{
margin: 8px 0;
padding: 8px 3px;
#panel .upper {
background: #dcdbdc url(tcat.png) repeat-x;
border-top: 1px solid #fff;
border-bottom: 1px solid #bbb;
padding: 7px;
}
a
{
text-decoration: none;
color: #0277bd;
-webkit-transition: color 0.1s linear;
-moz-transition: color 0.1s linear;
transition: color 0.1s linear;
#footer ul.menu {
margin: 0;
padding: 0;
list-style: none;
}
a:hover
{
color: #01579b;
#footer ul.menu li {
margin: 0 5px;
display: inline;
}
.welcome-msg
{
color: rgba(0, 0, 0, 0.54);
#footer .upper {
background: #dcdbdc url(tcat.png) repeat-x;
border-top: 1px solid #bbb;
padding: 6px;
overflow: hidden;
font-size: 12px;
}
.username
{
text-transform: capitalize;
color: rgba(0, 0, 0, 0.87);
#footer .upper ul.bottom_links {
float: left;
margin: 3px 0 0 -5px;
}
a:hover
{
color: black;
#footer .lower {
background: #a1a2a2 url(thead.png) top left repeat-x;
color: #fff;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ddd;
overflow: hidden;
padding: 8px;
font-size: 11px;
}
input, select
{
padding: 8px;
#footer .lower a:link,#footer .lower a:visited {
color: #fff;
font-weight: 700;
}
form
{
padding: 4px;
#footer .lower a:hover,#footer .lower a:active {
color: #fff;
font-weight: 700;
}
.info input[type="submit"], .info button, .info input[type="button"],
.warn input[type="submit"], .warn button, .warn input[type="button"],
.err input[type="submit"], .err button, .err input[type="button"]
{
float: right;
#footer .lower #current_time {
float: right;
padding-right: 6px;
}
.err
{
color: white;
display: block;
background-color: #e51c23 !important;
padding: 15px;
line-height: 30px;
min-height: 30px;
.wrapper {
width: 85%;
min-width: 970px;
max-width: 1500px;
margin: auto;
}
.err:before
{
content: "ERROR: ";
#footer {
position: fixed;
left:0;
bottom:0;
height: 61px;
width: 100%;
background: #999;
border-top: 1px #000 solid;
border-bottom: 1px #000 solid;
}
.warn
{
color: white;
display: block;
background-color: #ff5722 !important;
padding: 15px;
line-height: 30px;
min-height: 30px;
* html #footer {
position: absolute;
top: expression((0-(footer.offsetHeight)+(document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight)+(ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop))+'px');
}
.warn:before
{
content: "WARNING: ";
tr td.trow1:first-child, tr td.trow2:first-child {
border-left: 0;
}
.info
{
color: white;
display: block;
background-color: #5677fc !important;
padding: 15px;
line-height: 30px;
min-height: 30px;
tr td.trow1:last-child, tr td.trow2:last-child {
border-right: 0;
}
.info:before
{
content: "INFORMATION: ";
.tborder {
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;
}
#footer .fleft
{
float: left;
.thead {
-moz-border-radius-topleft: 6px;
-moz-border-radius-topright: 6px;
-webkit-border-top-left-radius: 6px;
-webkit-border-top-right-radius: 6px;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
}
#footer .fright
{
float: right;
text-align: right;
table {
color: #000;
font-size: 13px;
}
#footer
{
margin: 0;
padding: 10px;
font-size: 9pt;
color: rgba(255, 255, 255, 0.8);
box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.2) inset;
.tborder {
background: #fff;
width: 100%;
margin: auto;
border: 1px solid #ccc;
padding: 1px;
}
#footer a
{
text-transform: none;
color: white;
.thead {
background: #a1a2a2 url(thead.png) top left repeat-x;
color: #fff;
border-bottom: 1px solid #8e8f8f;
padding: 8px;
}
input[type="submit"], button, input[type="button"]
{
background-color: #ffc107;
padding: 8px 15px 8px 15px;
margin: 0 2px;
display: inline-block;
text-align: center;
color: black;
box-shadow: 0px 2px 3px rgba(0,0,0,0.2);
border: none;
outline: none;
cursor: pointer;
.tcat {
background: #dcdbdc url(tcat.png) repeat-x;
color: #fff;
border-bottom: 1px solid #bbb;
padding: 6px;
font-size: 12px;
}
input[type="submit"]:hover, button:hover, input[type="button"]:hover
{
background-color: #ffca28;
.trow1 {
background: #f5f5f5;
border: 1px solid;
border-color: #fff #ddd #ddd #fff;
}
input[type="submit"]:active, button:active, input[type="button"]:active
{
background-color: #ffd54f;
-webkit-transform: translateY(1px);
-moz-transform: translateY(1px);
transform: translateY(1px);
.trow2 {
background: #efefef;
border: 1px solid;
border-color: #fff #ddd #ddd #fff;
padding: 15px;
box-sizing: border-box;
-moz-box-sizing: border-box;
}
hr
{
border: none;
height: 1px;
background-color: rgba(0, 0, 0, 0.12);
table {
color: #000;
font-size: 13px;
text-align: left;
}
h4
{
padding-bottom: 10px;
margin-bottom: 12px;
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
.tborder {
background: #fff;
width: 100%;
margin: auto;
border: 1px solid #ccc;
padding: 1px;
}
/**** PAGE SPECIFIC CSS ****/
/* remove the * for disabling: */
.page-core-server-settings table td
{
text-align: center;
width: 25%;
.thead {
background: #a1a2a2 url(thead.png) top left repeat-x;
color: #fff;
border-bottom: 1px solid #8e8f8f;
padding: 8px;
}
.page-core-server-settings.no-param table td:nth-child(1) a,
.page-core-server-settings.param-tab-general table td:nth-child(1) a
{
font-weight: 600;
color: rgba(0, 0, 0, 0.87);
.tcat {
background: #dcdbdc url(tcat.png) repeat-x;
color: #fff;
border-bottom: 1px solid #bbb;
padding: 6px;
font-size: 12px;
}
.page-core-server-settings.param-tab-monsters table td:nth-child(2) a
{
font-weight: 600;
color: rgba(0, 0, 0, 0.87);
.trow1 {
background: #f5f5f5;
border: 1px solid;
border-color: #fff #ddd #ddd #fff;
}
.page-core-server-settings.param-tab-worlds table td:nth-child(3) a
{
font-weight: 600;
color: rgba(0, 0, 0, 0.87);
.trow2 {
background: #efefef;
border: 1px solid;
border-color: #fff #ddd #ddd #fff;
}
.page-core-server-settings.param-tab-world table td:nth-child(4) a
{
font-weight: 600;
color: rgba(0, 0, 0, 0.87);
.smalltext {
font-size: 11px;
}
.page-core-permissions form table tr,
.page-core-permissions form table td,
.page-core-permissions form table th
{
border: none;
background-color: transparent;
textarea {
background: #fff;
color: #000;
border: 1px solid #ccc;
padding: 2px;
line-height: 1.4;
font-family: Tahoma,Verdana,Arial,Sans-Serif;
font-size: 13px;
}
.page-core-permissions form table tr:nth-child(1) th
{
width: 35%;
select {
background: #fff;
padding: 3px;
border: 1px solid #ccc;
font-family: Tahoma,Verdana,Arial,Sans-Serif;
}
.page-core-permissions form table tr:nth-child(1) td
{
width: 65%;
.usercp_nav_item {
display: block;
padding: 1px 0 1px 23px;
}
.page-core-permissions form table td input
{
width: 100%;
box-sizing: border-box;
-moz-box-sizing: border-box;
margin: 0;
.usercp_nav_pmfolder {
background: url(pmfolder.gif) no-repeat left center;
}
#ChatDiv
{
margin-bottom: 10px;
.usercp_nav_sub_pmfolder {
padding-left: 40px;
background: url(sub_pmfolder.gif) no-repeat left center;
}
#ChatMessage
{
width: 100%;
box-sizing: border-box;
-moz-box-sizing: border-box;
.usercp_nav_home {
background: url(home.gif) no-repeat left center;
}
/**/
.pagehead {
top: 0;
left: 0;
width: 100%;
}
table {
width: 100%;
}
table th {
border-bottom: 1px solid rgba(0,0,0,0.12);
padding: 5px;
text-align: left;
}
table tr:nth-child(odd) {
background-color: rgba(0,0,0,0.015);
}
p {
margin: 4px 0;
padding: 4px 3px;
}
a {
text-decoration: none;
color: #000;
-webkit-transition: color .1s linear;
-moz-transition: color .1s linear;
transition: color .1s linear;
}
a:hover {
color: #888;
}
input[type="text"] {
background: #fff;
color: #000;
border: 1px solid #ccc;
padding: 2px;
line-height: 1.4;
font-family: Tahoma,Verdana,Arial,Sans-Serif;
font-size: 13px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
input[type="text"]:hover {
background-color: #E5E4E2;
}
input[type="text"]:focus {
background-color: #E5E4E2;
}
hr {
border: none;
height: 1px;
background-color: rgba(0,0,0,0.12);
}
h4 {
padding-bottom: 10px;
margin-bottom: 12px;
border-bottom: 1px solid rgba(0,0,0,0.12);
}
#ChatDiv {
margin-bottom: 10px;
}
#ChatMessage {
width: 92%;
margin-right: 5px;
box-sizing: border-box;
-moz-box-sizing: border-box;
}
input[type="submit"] {
padding: 3px;
padding-left: 5px;
padding-right: 5px;
cursor: pointer;
font-family: Tahoma,Verdana,Arial,Sans-Serif;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
background: #f5f5f5;
border: 1px solid #ccc;
}
input[type="submit"]:hover {
background-color: #E5E4E2;
}
button:disabled,input:disabled {
padding: 3px;
padding-left: 5px;
padding-right: 5px;
cursor: pointer;
font-family: Tahoma,Verdana,Arial,Sans-Serif;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
border: none!important;
color: #fff!important;
background-color: #ccc!important;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

View File

@ -1,25 +1,69 @@
<!-- Copyright Justin S and MCServer Team, licensed under CC-BY-SA 3.0 */ -->
<html>
<head>
<title>MCServer WebAdmin - Login</title>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="login.css" rel="stylesheet" type="text/css">
<link rel="icon" href="favicon.ico">
<style type="text/css">
header {
margin: 0 auto;
text-align: center;
vertical-align: middle;
}
</style>
</head>
<body>
<header>
<img src="mc-logo.png" alt="MCServer Logo" class="logo">
<h1>MCServer - WebAdmin</h1>
<form method="get" action="webadmin/">
<input type="submit" value="Log in">
</form>
</header>
<div class="contention">
<div class="row1">
<div class="wrapper">
<img src="logo_login.png" alt="MCServer Logo" class="logo">
</div>
</div>
<div id="panel">
<div class="upper">
<div class="wrapper">
<div>
<form method="get" action="webadmin/" />
<button type="submit" value="Log in" style="width:150px;height:25px;font-family:'Source Sans Pro',sans-serif;background:transparent;border:none!important;vertical-align:middle">
<strong><img src="login.gif" style="vertical-align:bottom" /> WebAdmin Log in</strong>
</button>
</form>
</div>
</div>
</div>
</div>
<div class="row2 push10">
<div class="wrapper padtopp">
<table border="0" cellspacing="0" cellpadding="5" class="tborder" style="margin-bottom:5px">
<tbody>
<tr>
<td class="thead rounded_top">
<div style="float:left!important"><strong>MCServer WebAdmin</strong></div>
</td>
</tr>
<tr>
<td class="trow2 post_content">
<div class="post_body">
<iframe width="100%" height="100%" style="border:none;min-height:350px;max-height:450px" src="/guest.html"></iframe>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div id="footer">
<div class="upper">
<div class="wrapper">
<ul class="menu bottom_links">
<li><a href="http://www.mc-server.org" target="_blank">MCServer</a></li>
<li><a href="http://forum.mc-server.org" target="_blank">Forums</a></li>
<li><a href="http://builds.cuberite.org" target="_blank">Buildserver</a></li>
<li><a href="http://mc-server.xoft.cz/LuaAPI" target="_blank">API Documentation</a></li>
<li><a href="http://book.mc-server.org/" target="_blank">User's Manual</a></li>
</ul>
</div>
</div>
<div class="lower">
<div class="wrapper">
<span id="copyright">Copyright © <a href="http://www.mc-server.org" target="_blank">MCServer Team</a> 2014.</span>
</div>
</div>
</div>
</body>
</html>

View File

@ -81,22 +81,56 @@ function ShowPage(WebAdmin, TemplateRequest)
end
Output([[
<!DOCTYPE html>
<!-- Copyright Justin S and MCServer Team, licensed under CC-BY-SA 3.0 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="icon" href="/favicon.ico">
<title>]] .. Title .. [[</title>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,600,300' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="/style.css">
<title>]] .. Title .. [[</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="/style.css">
<link rel="icon" href="/favicon.ico">
</head>
<body>
<div id="wrapper">
<div id="containerHolder">
<a href="./" class="title light">MCServer</a>
<div id="container">
<div id="sidebar">
<ul class="sideNav">
<li class='link'><a href=']] .. BaseURL .. [['>Home</a></li>
<div class="contention push25">
<div class="pagehead">
<div class="row1">
<div class="wrapper">
<img src="/logo_login.png" alt="MCServer Logo" class="logo">
</div>
</div>
<div id="panel">
<div class="upper">
<div class="wrapper">
<ul class="menu top_links">
<li><a>Server Name: <strong>]] .. cRoot:Get():GetServer():GetServerID() .. [[</strong></a></li>
<li><a>Memory: <strong>]] .. MemoryUsageKiB / 1024 .. [[MB</strong></a></li>
<li><a>Chunks: <strong>]] .. NumChunks .. [[</strong></a></li>
</ul>
<div class="welcome"><strong>Welcome back, ]] .. TemplateRequest.Request.Username .. [[</strong>&nbsp;&nbsp;&nbsp;<a href=".././"><img src="/log_out.png" style="vertical-align:bottom;"> Log Out</a></div>
</div>
</div>
</div>
</div>
<div class="row2">
<div class="wrapper">
<table width="100%" border="0" align="center">
<tbody>
<tr>
<td width="180" valign="top">
<table border="0" cellspacing="0" cellpadding="5" class="tborder">
<tbody>
<tr>
<td class="thead"><strong>Menu</strong></td>
</tr>
<tr>
<td class="trow1 smalltext"><a href=']] .. BaseURL .. [[' class='usercp_nav_item usercp_nav_home'>Home</a></td>
</tr>
<tr>
<td class="tcat"><div><span class="smalltext"><strong><font color="#000">Server Management</font></strong></span></div></td>
</tr>
</tbody>
<tbody style="" id="usercppms_e">
<tr>
<td class="trow1 smalltext">
]])
@ -105,30 +139,58 @@ function ShowPage(WebAdmin, TemplateRequest)
local PluginWebTitle = value:GetWebTitle()
local TabNames = value:GetTabNames()
if (GetTableSize(TabNames) > 0) then
Output("<li>"..PluginWebTitle.."</li>\n");
Output("<div><a class='usercp_nav_item usercp_nav_pmfolder' style='text-decoration:none;'><b>"..PluginWebTitle.."</b></a></div>\n");
for webname,prettyname in pairs(TabNames) do
Output("<li class='link'><a href='" .. BaseURL .. PluginWebTitle .. "/" .. webname .. "'>" .. prettyname .. "</a></li>\n")
Output("<div><a href='" .. BaseURL .. PluginWebTitle .. "/" .. webname .. "' class='usercp_nav_item usercp_nav_sub_pmfolder'>" .. prettyname .. "</a></div>\n")
end
Output("<br>\n");
end
end
Output([[
</ul>
</div>
<div id="main" class="page-]] .. string.lower(PluginPage.PluginName .. "-" .. string.gsub(PluginPage.TabName, "[^a-zA-Z0-9]+", "-")) .. reqParamsClass .. [[">
<h2 class="welcome-msg">Welcome <span class="username">]] .. TemplateRequest.Request.Username .. [[</span></h2>
<hr/>
<h3>]] .. SubTitle .. [[</h3>
]] .. PageContent .. [[</div>
<div class="clear"></div>
</td>
</tr>
</tbody>
</table>
</td>
<td valign="top" style='padding-left:25px;'>
<table border="0" cellspacing="0" cellpadding="5" class="tborder">
<tbody>
<tr>
<td class="thead" colspan="2"><strong>]] .. SubTitle .. [[</strong></td>
</tr>
<tr>
<td class="trow2">]] .. PageContent .. [[</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="footer"><div class="fleft">running MCServer using <span class="bold">]] .. MemoryUsageKiB / 1024 .. [[MB</span> of memory; <span class="bold">]] .. NumChunks .. [[</span> chunks</div><div class="fright">design by <a href="//www.github.com/WebFreak001">WebFreak001</a></div><div class="clear"></div></div>
<div id="footer">
<div class="upper">
<div class="wrapper">
<ul class="menu bottom_links">
<li><a href="http://www.mc-server.org" target="_blank">MCServer</a></li>
<li><a href="http://forum.mc-server.org" target="_blank">Forums</a></li>
<li><a href="http://builds.cuberite.org" target="_blank">Buildserver</a></li>
<li><a href="http://mc-server.xoft.cz/LuaAPI" target="_blank">API Documentation</a></li>
<li><a href="http://book.mc-server.org/" target="_blank">User's Manual</a></li>
</ul>
</div>
</div>
<div class="lower">
<div class="wrapper">
<span id="copyright">Copyright © <a href="http://www.mc-server.org" target="_blank">MCServer Team</a> 2014.</span>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -5,6 +5,8 @@
#include "Globals.h"
#include "BioGen.h"
#include <chrono>
#include <iostream>
#include "IntGen.h"
#include "ProtIntGen.h"
#include "../IniFile.h"
@ -1199,3 +1201,51 @@ cBiomeGenPtr cBiomeGen::CreateBiomeGen(cIniFile & a_IniFile, int a_Seed, bool &
////////////////////////////////////////////////////////////////////////////////
// Performance tests:
// Change to 1 to enable the perf test:
#if 0
class cBioGenPerfTest
{
public:
cBioGenPerfTest()
{
std::cout << "BioGen performance tests commencing, please wait..." << std::endl;
TestGen("MultiStepMap", std::make_unique<cBioGenMultiStepMap>(1).get());
TestGen("Grown", std::make_unique<cBioGenGrown>(1).get());
TestGen("GrownProt", std::make_unique<cBioGenProtGrown>(1).get());
std::cout << "BioGen performance tests complete." << std::endl;
}
protected:
void TestGen(const AString && a_GenName, cBiomeGen * a_BioGen)
{
// Initialize the default settings for the generator:
cIniFile iniFile;
a_BioGen->InitializeBiomeGen(iniFile);
// Generate the biomes:
auto start = std::chrono::system_clock::now();
for (int z = 0; z < 100; z++)
{
for (int x = 0; x < 100; x++)
{
cChunkDef::BiomeMap biomes;
a_BioGen->GenBiomes(x, z, biomes);
} // for x
} // for z
auto dur = std::chrono::system_clock::now() - start;
double milliseconds = static_cast<double>((std::chrono::duration_cast<std::chrono::milliseconds>(dur)).count());
std::cout << a_GenName << ": " << 1000.0 * 100.0 * 100.0 / milliseconds << " chunks per second" << std::endl;
}
} g_BioGenPerfTest;
#endif

View File

@ -16,81 +16,6 @@
////////////////////////////////////////////////////////////////////////////////
// cTerrainHeightGen:
cTerrainHeightGenPtr cTerrainHeightGen::CreateHeightGen(cIniFile & a_IniFile, cBiomeGenPtr a_BiomeGen, int a_Seed, bool & a_CacheOffByDefault)
{
AString HeightGenName = a_IniFile.GetValueSet("Generator", "HeightGen", "");
if (HeightGenName.empty())
{
LOGWARN("[Generator] HeightGen value not set in world.ini, using \"Biomal\".");
HeightGenName = "Biomal";
}
a_CacheOffByDefault = false;
cTerrainHeightGen * res = nullptr;
if (NoCaseCompare(HeightGenName, "flat") == 0)
{
res = new cHeiGenFlat;
a_CacheOffByDefault = true; // We're generating faster than a cache would retrieve data
}
else if (NoCaseCompare(HeightGenName, "classic") == 0)
{
res = new cHeiGenClassic(a_Seed);
}
else if (NoCaseCompare(HeightGenName, "DistortedHeightmap") == 0)
{
res = new cDistortedHeightmap(a_Seed, a_BiomeGen);
}
else if (NoCaseCompare(HeightGenName, "End") == 0)
{
res = new cEndGen(a_Seed);
}
else if (NoCaseCompare(HeightGenName, "Mountains") == 0)
{
res = new cHeiGenMountains(a_Seed);
}
else if (NoCaseCompare(HeightGenName, "Noise3D") == 0)
{
res = new cNoise3DComposable(a_Seed);
}
else if (NoCaseCompare(HeightGenName, "biomal") == 0)
{
res = new cHeiGenBiomal(a_Seed, a_BiomeGen);
/*
// Performance-testing:
LOGINFO("Measuring performance of cHeiGenBiomal...");
clock_t BeginTick = clock();
for (int x = 0; x < 500; x++)
{
cChunkDef::HeightMap Heights;
res->GenHeightMap(x * 5, x * 5, Heights);
}
clock_t Duration = clock() - BeginTick;
LOGINFO("HeightGen for 500 chunks took %d ticks (%.02f sec)", Duration, (double)Duration / CLOCKS_PER_SEC);
//*/
}
else
{
// No match found, force-set the default and retry
LOGWARN("Unknown HeightGen \"%s\", using \"Biomal\" instead.", HeightGenName.c_str());
a_IniFile.DeleteValue("Generator", "HeightGen");
a_IniFile.SetValue("Generator", "HeightGen", "Biomal");
return CreateHeightGen(a_IniFile, a_BiomeGen, a_Seed, a_CacheOffByDefault);
}
// Read the settings:
res->InitializeHeightGen(a_IniFile);
return cTerrainHeightGenPtr(res);
}
////////////////////////////////////////////////////////////////////////////////
// cHeiGenFlat:
@ -611,3 +536,283 @@ NOISE_DATATYPE cHeiGenBiomal::GetHeightAt(int a_RelX, int a_RelZ, int a_ChunkX,
////////////////////////////////////////////////////////////////////////////////
// cHeiGenMinMax:
class cHeiGenMinMax:
public cTerrainHeightGen
{
typedef cTerrainHeightGen super;
/** Size of the averaging process, in columns (for each direction). Must be less than 16. */
static const int AVERAGING_SIZE = 4;
public:
cHeiGenMinMax(int a_Seed, cBiomeGenPtr a_BiomeGen):
m_Noise(a_Seed),
m_BiomeGen(a_BiomeGen),
m_TotalWeight(0)
{
// Initialize the weights:
for (int z = 0; z <= AVERAGING_SIZE * 2; z++)
{
for (int x = 0; x <= AVERAGING_SIZE * 2; x++)
{
m_Weights[z][x] = 1 + 2 * AVERAGING_SIZE - std::abs(x - AVERAGING_SIZE) - std::abs(z - AVERAGING_SIZE);
m_TotalWeight += m_Weights[z][x];
}
}
// Initialize the Perlin generator:
m_Perlin.AddOctave(0.04f, 0.2f);
m_Perlin.AddOctave(0.02f, 0.1f);
m_Perlin.AddOctave(0.01f, 0.05f);
}
virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap)
{
// Generate the biomes for the 3*3 neighbors:
cChunkDef::BiomeMap neighborBiomes[3][3];
for (int z = 0; z < 3; z++) for (int x = 0; x < 3; x++)
{
m_BiomeGen->GenBiomes(a_ChunkX + x - 1, a_ChunkZ + z - 1, neighborBiomes[z][x]);
}
// Get the min and max heights based on the biomes:
double minHeight[cChunkDef::Width * cChunkDef::Width];
double maxHeight[cChunkDef::Width * cChunkDef::Width];
for (int z = 0; z < cChunkDef::Width; z++)
{
for (int x = 0; x < cChunkDef::Width; x++)
{
// For each column, sum the min and max values of the neighborhood around it:
double min = 0, max = 0;
for (int relz = 0; relz <= AVERAGING_SIZE * 2; relz++)
{
int bz = z + 16 + relz - AVERAGING_SIZE; // Biome Z coord relative to the neighborBiomes start
int cz = bz / 16; // Chunk Z coord relative to the neighborBiomes start
bz = bz % 16; // Biome Z coord relative to cz in neighborBiomes
for (int relx = 0; relx <= AVERAGING_SIZE * 2; relx++)
{
int bx = x + 16 + relx - AVERAGING_SIZE; // Biome X coord relative to the neighborBiomes start
int cx = bx / 16; // Chunk X coord relative to the neighborBiomes start
bx = bx % 16; // Biome X coord relative to cz in neighborBiomes
// Get the biome's min and max heights:
double bmin, bmax;
getBiomeMinMax(cChunkDef::GetBiome(neighborBiomes[cz][cx], bx, bz), bmin, bmax);
// Add them to the total, with the weight depending on their relative position to the column:
min += bmin * m_Weights[relz][relx];
max += bmax * m_Weights[relz][relx];
} // for relx
} // for relz
minHeight[x + z * cChunkDef::Width] = min / m_TotalWeight;
maxHeight[x + z * cChunkDef::Width] = max / m_TotalWeight;
} // for x
} // for z
// Generate the base noise:
NOISE_DATATYPE noise[cChunkDef::Width * cChunkDef::Width];
NOISE_DATATYPE workspace[cChunkDef::Width * cChunkDef::Width];
NOISE_DATATYPE startX = static_cast<float>(a_ChunkX * cChunkDef::Width);
NOISE_DATATYPE endX = startX + cChunkDef::Width - 1;
NOISE_DATATYPE startZ = static_cast<float>(a_ChunkZ * cChunkDef::Width);
NOISE_DATATYPE endZ = startZ + cChunkDef::Width - 1;
m_Perlin.Generate2D(noise, 16, 16, startX, endX, startZ, endZ, workspace);
// Make the height by ranging the noise between min and max:
for (int z = 0; z < cChunkDef::Width; z++)
{
for (int x = 0; x < cChunkDef::Width; x++)
{
double min = minHeight[x + z * cChunkDef::Width];
double max = maxHeight[x + z * cChunkDef::Width];
double h = (max + min) / 2 + noise[x + z * cChunkDef::Width] * (max - min);
cChunkDef::SetHeight(a_HeightMap, x, z, static_cast<HEIGHTTYPE>(h));
}
}
}
virtual void InitializeHeightGen(cIniFile & a_IniFile)
{
// No settings available
}
protected:
cNoise m_Noise;
cPerlinNoise m_Perlin;
/** The biome generator to query for the underlying biomes. */
cBiomeGenPtr m_BiomeGen;
/** Weights applied to each of the min / max values in the neighborhood of the currently evaluated column. */
double m_Weights[AVERAGING_SIZE * 2 + 1][AVERAGING_SIZE * 2 + 1];
/** Sum of all the m_Weights items. */
double m_TotalWeight;
/** Returns the minimum and maximum heights for the given biome. */
void getBiomeMinMax(EMCSBiome a_Biome, double & a_Min, double & a_Max)
{
switch (a_Biome)
{
case biBeach: a_Min = 61; a_Max = 64; break;
case biBirchForest: a_Min = 63; a_Max = 75; break;
case biBirchForestHills: a_Min = 63; a_Max = 90; break;
case biBirchForestHillsM: a_Min = 63; a_Max = 90; break;
case biBirchForestM: a_Min = 63; a_Max = 75; break;
case biColdBeach: a_Min = 61; a_Max = 64; break;
case biColdTaiga: a_Min = 63; a_Max = 75; break;
case biColdTaigaHills: a_Min = 63; a_Max = 90; break;
case biColdTaigaM: a_Min = 63; a_Max = 75; break;
case biDeepOcean: a_Min = 30; a_Max = 60; break;
case biDesert: a_Min = 63; a_Max = 70; break;
case biDesertHills: a_Min = 63; a_Max = 85; break;
case biDesertM: a_Min = 63; a_Max = 70; break;
case biEnd: a_Min = 10; a_Max = 100; break;
case biExtremeHills: a_Min = 60; a_Max = 120; break;
case biExtremeHillsEdge: a_Min = 63; a_Max = 100; break;
case biExtremeHillsM: a_Min = 60; a_Max = 120; break;
case biExtremeHillsPlus: a_Min = 60; a_Max = 140; break;
case biExtremeHillsPlusM: a_Min = 60; a_Max = 140; break;
case biFlowerForest: a_Min = 63; a_Max = 75; break;
case biForest: a_Min = 63; a_Max = 75; break;
case biForestHills: a_Min = 63; a_Max = 90; break;
case biFrozenOcean: a_Min = 45; a_Max = 64; break;
case biFrozenRiver: a_Min = 60; a_Max = 62; break;
case biIceMountains: a_Min = 63; a_Max = 90; break;
case biIcePlains: a_Min = 63; a_Max = 70; break;
case biIcePlainsSpikes: a_Min = 60; a_Max = 70; break;
case biJungle: a_Min = 60; a_Max = 80; break;
case biJungleEdge: a_Min = 62; a_Max = 75; break;
case biJungleEdgeM: a_Min = 62; a_Max = 75; break;
case biJungleHills: a_Min = 60; a_Max = 90; break;
case biJungleM: a_Min = 60; a_Max = 75; break;
case biMegaSpruceTaiga: a_Min = 63; a_Max = 75; break;
case biMegaSpruceTaigaHills: a_Min = 63; a_Max = 90; break;
case biMegaTaiga: a_Min = 63; a_Max = 75; break;
case biMegaTaigaHills: a_Min = 63; a_Max = 90; break;
case biMesa: a_Min = 63; a_Max = 90; break;
case biMesaBryce: a_Min = 60; a_Max = 67; break;
case biMesaPlateau: a_Min = 75; a_Max = 85; break;
case biMesaPlateauF: a_Min = 80; a_Max = 90; break;
case biMesaPlateauFM: a_Min = 80; a_Max = 90; break;
case biMesaPlateauM: a_Min = 75; a_Max = 85; break;
case biMushroomIsland: a_Min = 63; a_Max = 90; break;
case biMushroomShore: a_Min = 60; a_Max = 75; break;
case biNether: a_Min = 10; a_Max = 100; break;
case biOcean: a_Min = 45; a_Max = 64; break;
case biPlains: a_Min = 63; a_Max = 70; break;
case biRiver: a_Min = 60; a_Max = 62; break;
case biRoofedForest: a_Min = 63; a_Max = 75; break;
case biRoofedForestM: a_Min = 63; a_Max = 75; break;
case biSavanna: a_Min = 63; a_Max = 75; break;
case biSavannaM: a_Min = 63; a_Max = 80; break;
case biSavannaPlateau: a_Min = 75; a_Max = 100; break;
case biSavannaPlateauM: a_Min = 80; a_Max = 160; break;
case biStoneBeach: a_Min = 60; a_Max = 64; break;
case biSunflowerPlains: a_Min = 63; a_Max = 70; break;
case biSwampland: a_Min = 60; a_Max = 67; break;
case biSwamplandM: a_Min = 61; a_Max = 67; break;
case biTaiga: a_Min = 63; a_Max = 75; break;
case biTaigaHills: a_Min = 63; a_Max = 90; break;
case biTaigaM: a_Min = 63; a_Max = 80; break;
default:
{
ASSERT(!"Unknown biome");
a_Min = 10;
a_Max = 10;
break;
}
}
}
};
////////////////////////////////////////////////////////////////////////////////
// cTerrainHeightGen:
cTerrainHeightGenPtr cTerrainHeightGen::CreateHeightGen(cIniFile & a_IniFile, cBiomeGenPtr a_BiomeGen, int a_Seed, bool & a_CacheOffByDefault)
{
AString HeightGenName = a_IniFile.GetValueSet("Generator", "HeightGen", "");
if (HeightGenName.empty())
{
LOGWARN("[Generator] HeightGen value not set in world.ini, using \"Biomal\".");
HeightGenName = "Biomal";
}
a_CacheOffByDefault = false;
cTerrainHeightGen * res = nullptr;
if (NoCaseCompare(HeightGenName, "flat") == 0)
{
res = new cHeiGenFlat;
a_CacheOffByDefault = true; // We're generating faster than a cache would retrieve data
}
else if (NoCaseCompare(HeightGenName, "classic") == 0)
{
res = new cHeiGenClassic(a_Seed);
}
else if (NoCaseCompare(HeightGenName, "DistortedHeightmap") == 0)
{
res = new cDistortedHeightmap(a_Seed, a_BiomeGen);
}
else if (NoCaseCompare(HeightGenName, "End") == 0)
{
res = new cEndGen(a_Seed);
}
else if (NoCaseCompare(HeightGenName, "MinMax") == 0)
{
res = new cHeiGenMinMax(a_Seed, a_BiomeGen);
}
else if (NoCaseCompare(HeightGenName, "Mountains") == 0)
{
res = new cHeiGenMountains(a_Seed);
}
else if (NoCaseCompare(HeightGenName, "Noise3D") == 0)
{
res = new cNoise3DComposable(a_Seed);
}
else if (NoCaseCompare(HeightGenName, "biomal") == 0)
{
res = new cHeiGenBiomal(a_Seed, a_BiomeGen);
/*
// Performance-testing:
LOGINFO("Measuring performance of cHeiGenBiomal...");
clock_t BeginTick = clock();
for (int x = 0; x < 500; x++)
{
cChunkDef::HeightMap Heights;
res->GenHeightMap(x * 5, x * 5, Heights);
}
clock_t Duration = clock() - BeginTick;
LOGINFO("HeightGen for 500 chunks took %d ticks (%.02f sec)", Duration, (double)Duration / CLOCKS_PER_SEC);
//*/
}
else
{
// No match found, force-set the default and retry
LOGWARN("Unknown HeightGen \"%s\", using \"Biomal\" instead.", HeightGenName.c_str());
a_IniFile.DeleteValue("Generator", "HeightGen");
a_IniFile.SetValue("Generator", "HeightGen", "Biomal");
return CreateHeightGen(a_IniFile, a_BiomeGen, a_Seed, a_CacheOffByDefault);
}
// Read the settings:
res->InitializeHeightGen(a_IniFile);
return cTerrainHeightGenPtr(res);
}