From 638ff8a06aae2b1bc9fcbb9406a7a1a30b741ef3 Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Mon, 19 Mar 2012 19:24:31 -0700 Subject: achievements.php debug data and some fixes. --- js/mapspecs.js | 47 ++++-- pages/about.php | 1 + pages/achievements.php | 385 +++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 364 insertions(+), 69 deletions(-) diff --git a/js/mapspecs.js b/js/mapspecs.js index ff86a28..1f9702e 100644 --- a/js/mapspecs.js +++ b/js/mapspecs.js @@ -30,9 +30,15 @@ var mapjson = new Array(); var htmlscores = ''; var htmlnotification = ''; var jsonmapdata = new Object; +//var jsonmapdata.solutions = new Array(); -function loadSol(sol) { +// function loadAllSolutions() { + // for(var i in jsonmapdata.solutions) { + // } +// } + +function loadSol(sol, moves) { if (sol == null) if (document.getElementById('mapsol') != undefined) sol = document.getElementById('mapsol').innerHTML; @@ -53,13 +59,20 @@ function loadSol(sol) { } } } + if (moves && mapid) { + updateDsp(mapid, 'dspCount', moves+ " moves"); + } + } function showNotification(html) { var div = document.createElement('div'); var pref = '
'; - var suff = '
'; + pref += '
[Close]
'; + pref += '
'; + var suff = '
'; + //var suff = ''; div.innerHTML = pref+html+suff; document.body.appendChild(div.firstChild); } @@ -197,24 +210,23 @@ function doSend(mapid) { }); } -function requestSol(solid) { - ajax.requestFile = "do.php?r=getsol&solutionid="+solid; //prepare strdata +function requestSol(mapID) { + ajax.requestFile = "do.php?r=getsol&mapID="+mapID; //prepare strdata ajax.onCompletion = requestSolDone; // specify function to be executed on response ajax.runAJAX(); } function requestSolDone() { - if (typeof(JSON) == 'undefined') { text = ajax.response; var JO = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + text + ')'); - //mapdata[mapid] = eval(document.getElementById(mapid+',mapdata').innerHTML); } else { var JO = JSON.parse(ajax.response); } - + if (JO.solution == 'undefined') + return; clearwalls(JO.mapid); - loadSol(JO.mapid + ":" + JO.solution); + loadSol(JO.mapid + ":" + JO.solution, JO.moves); } function clearwalls(mapid) { @@ -691,7 +703,7 @@ function savePref(pref, value) { setCookie('pref_'+pref, value,31); } -//Cookie function from w3schools.com +//Cookie functions from w3schools.com function setCookie(c_name,value,exdays) { var exdate=new Date(); @@ -699,7 +711,20 @@ function setCookie(c_name,value,exdays) var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()); document.cookie=c_name + "=" + c_value; } - +function getCookie(c_name) +{ +var i,x,y,ARRcookies=document.cookie.split(";"); +for (i=0;iMatt
Radivel
Splax +
chord "; +foreach ($ac3 as $c3) { + echo ""; + foreach ($ac1 as $c1) { + foreach ($ac2 as $c2) { + + + $c = "#$c1$c2$c3"; + if ($_GET['showcolor'] == 'all') { + //echo ""; + echo ""; + } + //if ($c2 == 'f') break 2; + } + } +} +echo ""; + +$debug = false; + +if ($_GET['debuglevels'] == 'yes') + $debug = true; + + +if ($_GET['showemblems'] == 'all') { + + echo ""; + $dir = "./images/marks/"; + // Open a known directory, and proceed to read its contents + $i = 0; + if (is_dir($dir)) { + if ($dh = opendir($dir)) { + while (($file = readdir($dh)) !== false) { + $c = $file; + if (strpos($file, '.png') == false) + continue; + $c = "$c"; + + if (($i % 20) == 0) + echo ""; + + $i++; + + echo ""; + // echo "filename: $file : filetype: " . filetype($dir . $file) . "\n"; + } + closedir($dh); + } + } + echo "
+
"; +} + + +$dir = "./images/marks/tmpmarks/"; + +// Open a known directory, and proceed to read its contents +if (is_dir($dir)) { + if ($dh = opendir($dir)) { + while (($file = readdir($dh)) !== false) { + //echo "
$file \n"; + } + closedir($dh); + } +} + + + +if ($_GET['showcolor'] == 'grad') { + makeColorGradient(.3,.3,.3,0,2,4); + makeColorGradient(.3,.3,.3,0,2,4, 230,25); + makeColorGradient(.1,.1,.1,120,120,120,128,128); +} + + function makeColorGradient($frequency1, $frequency2, $frequency3, + $phase1, $phase2, $phase3, + $center = 128, $width = 127, $len = 30) + { + echo ""; + for ($i = 0; $i < $len; $i++) { + $red = sin($frequency1*$i + $phase1) * $width + $center; + $grn = sin($frequency2*$i + $phase2) * $width + $center; + $blu = sin($frequency3*$i + $phase3) * $width + $center; + //document.write( ''); + $c = toColor(($grn * 256) + ($red * (256 * 256)) + $blu); + echo ""; + } + echo "
"; + } +function toColor($n) +{ +return("#".substr("000000".dechex($n),-6)); +} + +// !! END TESTING AREA; + +//Self-healing code for unlocks. +if (!$viewer) { + applyAchievements($userID, 1); + applyAchievements($userID, 2); + applyAchievements($userID, 3); + applyAchievements($userID, 4); +} + ?>