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. --- pages/achievements.php | 385 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 327 insertions(+), 58 deletions(-) (limited to 'pages/achievements.php') diff --git a/pages/achievements.php b/pages/achievements.php index edcb893..6506442 100644 --- a/pages/achievements.php +++ b/pages/achievements.php @@ -16,13 +16,149 @@ if (is_int($_GET['id'] * 1) AND isset($_GET['id'])) else if (isset($_SESSION['userID'])) $userID = $_SESSION['userID']; - else - $userID = 3; + //else + // $userID = 3; $viewer = true; if ($userID == $_SESSION['userID']) $viewer = false; +if ($_GET['apply'] == 'true') { + applyCareerMazesAchievements($userID); + applyCareerPathAchievements($userID); +} +if ($_GET['applyall'] == 'true') { + for ($x = 1; $x <= 11; $x++) { + for ($i = 1; $i <= 11; $i++) { + applyCareerMazesAchievements($i); + applyCareerPathAchievements($i); + } + } +} + + +// TESTING AREA !! REMOVE + +// echo trackMOTDstats(1); +// echo trackMOTDstats(2); +// echo trackMOTDstats(3); +// echo trackMOTDstats(4); + + +$colors[] = '2'; +$colors[] = '6'; +$colors[] = 'a'; +$colors[] = 'd'; +$colors[] = 'f'; + +$ac1 = $colors; +$ac2 = $colors; +$ac3 = $colors; + +echo ""; +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); +} + ?>