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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
|
<?php
include_once ('./includes/maps.php');
include_once ('./includes/mapclass.php');
include_once ('./includes/mapoftheday.php');
include_once ('./includes/sqlEmbedded.php');
include_once ('./includes/datas.php');
include_once ('./includes/constants.php');
htmlHeader(
array('stats'), 'Pathery',
'Path lengthening competition inspired by Tower Defense mazing concepts',
array('scores', 'dateformat')
);
$noteScript = '';
if ($accepted) {
//$note = getNotified($userID);
$note = false;
if ($note !== false) {
//$note = str_replace("'", "\'", $note);
//Double your slashes double your fun (Required)
$note = addslashes($note);
$note = addslashes($note);
$noteScript = "
<script type='text/javascript'>
setTimeout(\"showNotification('".$note."');\", 1000);
if (getCookie('pref_mute') != 'true') {
setTimeout(\"soundManager.setVolume('achieve', 40);\", 1340);
setTimeout(\"soundManager.play('achieve');\", 1350);
}
</script>
";
}
}
?>
<body>
<?
//<script src="sounds/script/soundmanager.js"></script>
//<script type="text/javascript">soundManagerInit();</script>
//<script src="sounds/script/soundmanager2.js"></script>
?>
<?
//echo soundManager1();
echo soundManager2();
?>
<script type="text/javascript">
playerWallColor = '<?PHP echo isset($wallColor) ? $wallColor : ''; ?>';
playerWallEmblem = '<?PHP echo isset($wallEmblem) ? $wallEmblem : ''; ?>';
scoresShowNavSideBtns = true;
</script>
<!-- Advertisement -->
<script type="text/javascript">
// use PHP VAR
var showAd;
if (getCookie("pref_showAd") != "yes") {
showAd = "no";
} else {
showAd = "yes";
}
function adToggle() {
var adContainer = document.getElementById("adContainer");
var adBtn = document.getElementById("adBtn");
if (showAd == "yes") {
adContainer.setAttribute("class", "adHidden");
adBtn.innerHTML = "<a href='javascript:adToggle()'>Show</a>";
showAd = "no";
} else {
adContainer.setAttribute("class", "adContainer");
adBtn.innerHTML = "<a href='javascript:adToggle()'>Hide</a>";
showAd = "yes";
}
savePref("showAd", showAd);
}
</script>
<?php
topbar($Links);
$showAd = ($_COOKIE['pref_showAd'] == "yes");
$adClass = 'adHidden';
$adShow = 'Hide';
if ($showAd) {
$adClass = 'adContainer';
$adShow = 'Show';
}
$adContent = "
<div class='adOuter'>
<div class='adBar'>
<div class='float' style='width:89%; '>Ad:</div>
<div class='float' id='adBtn' style='width:10%; text-align:right;'>
<a href='javascript:adToggle()'>$adShow</a>
</div>
</div><div class='$adClass' id='adContainer'>
<script type='text/javascript' language='javascript' src='http://www.dpbolvw.net/placeholder-6466820?target=_blank&mouseover=N'></script>
</div>
</div>
<div style='clear: both'></div>";
?>
<div class="wrapper">
<center>
Tutorial, FAQ, and Challenge maps are broken. ^_^.
<br />Still working on <a href='scores'>The Scores Page</a>.
<br />Leave feedback in <a href='chat'>The Chat</a> as per usual.
</center>
<br />
<?
if ($accepted) {
if (!hasCompletedTutorial($userID)) {
echo "<center><a href='tutorial'>Complete the tutorial</a> to unlock a blue wall color:";
echo "<table><tr><td style='background-color:#4444ff;' class='grid_td_rocks'></td></tr></table></center><br />";
}
}
// 3 Main maps
$motd = MapOfTheDay(MapType::Simple);
$jmid[MapType::Simple] = $motd['id'];
$mapContent = displayMaze($motd, MapType::Simple);
$mapNames[MapType::Simple] = 'Simple';
$motd = MapOfTheDay(MapType::Normal);
$jmid[MapType::Normal] = $motd['id'];
$mapContent .= displayMaze($motd, MapType::Normal);
$mapNames[MapType::Normal] = 'Normal';
// Complex Map
$motd = MapOfTheDay(MapType::Complex);
$jmid[MapType::Complex] = $motd['id'];
$mapContent .= displayMaze($motd, MapType::Complex);
$mapNames[MapType::Complex] = $motd['map'][0][6];
if ($mapNames[MapType::Complex] == '') {
$mapNames[MapType::Complex] = 'Complex';
}
// Additional or special maps:
$motd = MapOfTheDay(MapType::Special);
$jmid[MapType::Special] = $motd['id'];
$mapContent .= displayMaze($motd, MapType::Special);
$mapNames[MapType::Special] = $motd['map'][0][6];
if ($mapNames[MapType::Special] == '') {
$mapNames[MapType::Special] = 'Special';
}
$motd = MapOfTheDay(MapType::Weekly);
$jmid[MapType::Weekly] = $motd['id'];
$mapContent .= displayMaze($motd, MapType::Weekly);
$mapNames[MapType::Weekly] = $motd['map'][0][6];
if ($mapNames[MapType::Weekly] == '') {
$mapNames[MapType::Weekly] = 'Ultra Complex';
}
echo ' <div id="difficulties">';
foreach ($mapNames as $key => $value) {
echo " <a href='javascript:showStats($key)' id='dl-$key'>$value</a>\n";
}
echo '
</div>
<div style="clear: both"></div>';
?>
<noscript>Sorry, this game requires scripts to run. Please enable javascript and <a href='home'>Reload this site</a>
<br />This game is best viewed in <a href='http://www.google.com/chrome'>Google Chrome</a>
</noscript>
<? echo $mapContent; ?>
<?
function displayMaze($motd, $mapType) {
global $accepted, $userID;
//Gather data for map;
$mapID = $motd['id'];
$map = $motd['map'];
$topscorediv = "
<div class='scoreContainer2' style='position:relative;' id='$mapID,dspScore'>
</div>
<script>scoresShowPage(1, $mapID);</script>
";
$mysolution = '';
$mymoves = 0;
if ($accepted) {
$sol = getSolution($userID, $mapID);
$mysolution = $sol['solution'];
//TODO: implement mymoves
$mymoves = $sol['moves'];
}
if (isset($_SESSION[$mapID.'sol']) && $_SESSION[$mapID.'moves'] > $mymoves) {
$mysolution = $_SESSION[$mapID.'sol'];
$mymoves = $_SESSION[$mapID.'moves'];
}
$r = "<div id=\"yms-$mapType\" class='hidden-maps'>";
$r .= " <div class='wrapper'>";
$r .= " <div style='text-align: center;'>";
$r .= " <div style='display:inline-block;margin: 0 auto;text-align: left;'>";
$r .= " <a href='javascript:requestSol(\"$mapID\");'><strong>Load your best solution</strong></a><br />";
$r .= "<div id='innerMapDsp_$mapID'>\n";
$r .= "</div>\n";
$r .= "<script>";
$r .= "displayMap($mapID, 'innerMapDsp_$mapID', false, '$mysolution', '$mymoves');";
$r .= "</script>";
//$r .= DisplayMap($map, $mapID);
$r .= " </div></div>";
$r .= " <div style='padding-top: 20px;'>";
$r .= $topscorediv;
$r .= ' </div>';
$r .= ' </div>';
$r .= '</div>';
//Clear our floatingness
$r .= '<div style="clear: both"></div>';
return $r;
}
$timeUntilNewDailyMap = strtotime("tomorrow") - strtotime("now");
$timeUntilNewWeeklyMap = strtotime(getNextWeeklyMapDateTime()) - strtotime("now");
?>
<div>
<span id="countdown" title="This time is relative to your computer's clock">Loading...</span>
</div>
<script type="text/javascript">
var countdownInt = self.setInterval(countdown, 1000);
//We're counting down to "tomorrow"
var tomorrow = new Date();
tomorrow.setTime(tomorrow.getTime() + <? echo $timeUntilNewDailyMap; ?> * 1000);
var formatedTomorrow = tomorrow.format("ddd h:MM TT");
var nextWeeklyMap = new Date();
nextWeeklyMap.setTime(nextWeeklyMap.getTime() + <? echo $timeUntilNewWeeklyMap; ?> * 1000);
var formattedNextWeeklyMap = nextWeeklyMap.format("ddd h:MM TT");
var userConfirm = true;
function millisecondsToTimeString(time)
{
//Ugh, this is a mess.
time = time / 1000;
if (time < 1)
window.clearInterval(countdownInt);
var hours = time/3600;
var days = (hours >= 24 ? hours/24 : 0);
var hoursStr = addZero(hours%24);
var daysStr = addZero(days);
time = time%3600;
var minutesStr = addZero(time/60);
time = time%60;
var secondsStr = addZero(time);
var timeStr = "";
if(days > 0)
timeStr += daysStr + ":";
timeStr += hoursStr + ":" + minutesStr + ":" + secondsStr;
return timeStr;
}
function countdown()
{
var isWeeklyMap = (document.getElementById("dl-" + <? echo MapType::Weekly; ?>).className.indexOf('selected') >= 0);
var newMapStr;
if(isWeeklyMap)
{
var timerem = nextWeeklyMap.getTime() - new Date().getTime();
newMapStr = 'New weekly map: ' + formattedNextWeeklyMap + '<br />Time remaining: ' + millisecondsToTimeString(timerem);
}
else
{
var timerem = tomorrow.getTime() - new Date().getTime();
newMapStr = 'New maps: ' + formatedTomorrow + '<br />Time remaining: ' + millisecondsToTimeString(timerem);
}
document.getElementById("countdown").innerHTML = newMapStr;
//TODO: It would not be very hard to dynamically load the new map w/o refresh.
if (timerem <= 1000 && userConfirm == true) {
userConfirm = confirm("It's Tomorrow Today! Go to new maps?")
if (userConfirm) {
location.reload(true);
}
}
}
function addZero(num) {
num = Math.floor(num);
var numStr = num + '';
if (numStr.length < 2)
numStr = "0" + numStr;
return numStr;
}
</script>
</div>
<script>
var jmid=new Array();
<?
echo " jmid[0] = '1';\n";
foreach ($jmid as $key => $value) {
echo "jmid[$key] = '$value';\n";
}
?>
function showStats(type) {
for (var i = 1; i < jmid.length; i++) {
var elem = document.getElementById("yms-" + i);
elem.className = elem.className.replace('shown-maps', 'hidden-maps');
elem = document.getElementById("dl-" + i);
elem.className = elem.className.replace('selected', '');
}
elem = document.getElementById("yms-" + type);
elem.className = elem.className.replace('hidden-maps', 'shown-maps');
elem = document.getElementById("dl-" + type);
if (elem.className.indexOf('selected') < 0)
elem.className += 'selected';
scoresRequestPage(jmid[type], currentPage[jmid[type]]);
}
showStats(1);
</script>
<?PHP echo $noteScript; ?>
<?php
htmlFooter();
?>
|