-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnether.php
195 lines (153 loc) · 6.43 KB
/
nether.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?php
include "PHP/config.php";
if ($CONFIG["nether"]["disabled"]) Header("Location: map.php");
$config = array();
$width = (int)abs($CONFIG["world"]["maxX"] - $CONFIG["world"]["minX"]);
$height = (int)abs($CONFIG["world"]["maxZ"] - $CONFIG["world"]["minZ"]);
$world = array(
"x" => (int)$CONFIG["world"]["minX"],
"z" => (int)$CONFIG["world"]["minZ"],
"width" => $width,
"height" => $height
);
$config["world"] = $world;
echo "<script>const Config = JSON.parse('" . json_encode($config) . "');</script>";
?>
<!DOCTYPE html>
<html>
<head>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0' name='viewport'/>
<link rel="stylesheet" type="text/css" href="css/main.css?x=2">
<link rel="stylesheet" type="text/css" href="css/nether.css">
<title><?php echo $CONFIG["server"]["name"] . " | Nether Map"; ?></title>
</head>
<body style="overflow: hidden;" class="noselect">
<div id="topBar">
<img src="images/homeIcon.svg" class="button" onclick="window.location.replace('../')">
<img src="images/menuIcon.png" class="button infoMenuIcon" style="display: none" onclick="InfoMenu.open()">
<div class="shadowBackground"></div>
</div>
<div id="mapHolder">
<?php
echo '<canvas id="mapCanvas" width="' . $width . '" height="' . $height . '"></canvas>';
?>
</div>
<div class="coordinatesHolder" id="coordinatesHolder">
<span id="current_x">0</span>
<span id="current_z">0</span>
</div>
<div class="buttonHolder" id="dimensionButtonHolder">
<div class="text netherPortalButton" onclick="window.location.replace('map.php')">
OVERWORLD
</div>
</div>
<div id="infoMenu" class="h ide">
<div class="infoMenuPage">
<div class="headerText preventTextOverflow">PORTALS</div>
<img class="icon" src="images/exitIcon.png" onclick="InfoMenu.close()">
<img class="icon searchIcon" src="images/searchIcon.png" onclick="InfoMenu.search.open()">
<div id="projectListHolder"></div>
</div>
<div class="infoMenuPage hide">
<div class="headerText preventTextOverflow" id="projectPage_titleHolder">PROJECTS</div>
<img class="icon" src="images/exitIcon.png" onclick="InfoMenu.openPageByIndex(0)">
<div class="text" id="projectPage_coordHolder"></div>
<div class="text subHeader"><br>BUILDERS</div>
<div class="text" id="projectPage_builderNames"></div>
<div class="text subHeader"><br>DESCRIPTION</div>
<div class="text" id="projectPage_description"></div>
<br>
<div class="text netherPortalButton">TO THE NETHER</div>
<br>
<div class="text subHeader"><br>MINIMAP</div>
<div class="miniMapHolder">
<img class="miniMapImg">
</div>
<div class="text subHeader"><br>IMAGES</div>
<div id="projectPage_imageHolder"></div>
</div>
<div class="infoMenuPage hide">
<input class="headerText preventTextOverflow searchInput" placeholder="Search">
<img class="icon exitIcon" src="images/exitIcon.png" onclick="InfoMenu.openPageByIndex(0)">
<div id="projectSearchListHolder"></div>
</div>
</div>
<script type="text/javascript" src="https://florisweb.tk/JS/jQuery.js"></script>
<script type="text/javascript" src="https://florisweb.tk/JS/request2.js"></script>
<script>
// temporarily so things don't get cached
let antiCache = Math.random() * 100000000;
$.getScript("js/handyFunctions.js?antiCache=" + antiCache, function() {});
$.getScript("js/chat.js?antiCache=" + antiCache, function() {});
$.getScript("js/map.js?antiCache=" + antiCache, function() {});
$.getScript("js/server.js?antiCache=" + antiCache, function() {});
$.getScript("js/infomenu.js?antiCache=" + antiCache, function() {
setup();
});
document.body.onload = function() {
// setup();
}
function executeUrlCommands() {
<?php
$project = $_GET["project"];
$project = explode('"', $project);
$project = implode("", $project);
if (!empty($project))
{
echo "InfoMenu.openProjectPageByTitle(\"" . (string)$project . "\");";
echo "Map.panToItem(Server.getItemByTitle(\"" . (string)$project . "\"));";
}
?>
executeUrlCommands = null;
}
var Server;
var Map;
var InfoMenu;
function setup() {
Server = new _server();
Map = new _map();
InfoMenu = new _InfoMenu_mapJsExtender();
Map.init(8);
Map.onItemClick = function(_item) {InfoMenu.openProjectPageByTitle(_item.title)}
InfoMenu.onItemClick = function(_item) {Map.panToItem(_item)}
InfoMenu.goThroughPortal = function(_title) {
window.location.replace("map.php?project=" + _title);
}
renderMap();
}
function renderMap() {
Map.clear();
Server.getData("uploads/nether.txt").then(function (_data) {
InfoMenu.createItemsByList(_data);
Map.drawPoints(_data);
drawLines(_data);
if (executeUrlCommands) executeUrlCommands();
});
}
function drawLines(data) {
for (let i = 0; i < data.length; i++) {
if (data[i].updated)
continue;
data[i].updated = false;
for (let j = 0; j < data[i].neighbours.length; j++) {
let neighbour = Server.getItemByTitle(data[i].neighbours[j]["name"]);
if (neighbour.updated || !neighbour)
continue;
let colour = "#777"
switch(data[i].neighbours[j]["type"].toLowerCase()) {
case "iceway":
colour = "#748ebe";
break;
default:
colour = "#777";
break;
}
Map.drawLine(data[i].coords.x, data[i].coords.z, neighbour.coords.x, neighbour.coords.z, colour);
console.log(data[i].coords.x + " " + data[i].coords.z + " " + neighbour.coords.x + " " + neighbour.coords.z)
}
data[i].updated = true;
}
}
</script>
</body>
</html>