summaryrefslogtreecommitdiffstats
path: root/pages
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2013-03-13 02:26:09 -0700
committerPatrick Davison <snapwilliam@gmail.com>2013-03-13 02:26:09 -0700
commit32cce4bee8a242f7a2e6d6a9e1c9e77b4af87728 (patch)
tree8f6068568fe0121380efb0e8bbb9985359245cf7 /pages
parent1c9f62a731637f1d373485473f064626d311d705 (diff)
downloadpathery-32cce4bee8a242f7a2e6d6a9e1c9e77b4af87728.tar.xz
Achievement back-end for Insane Speed - and any other 'Extra' unlocks like it.
Diffstat (limited to 'pages')
-rw-r--r--pages/achievements.php80
1 files changed, 38 insertions, 42 deletions
diff --git a/pages/achievements.php b/pages/achievements.php
index 249077c..a5e56ed 100644
--- a/pages/achievements.php
+++ b/pages/achievements.php
@@ -20,8 +20,9 @@ else
// $userID = 3;
$viewer = true;
-if ($userID == $_SESSION['userID'])
+if ($userID == $_SESSION['userID']) {
$viewer = false;
+}
if ($_GET['apply'] == 'true') {
applyCareerMazesAchievements($userID);
@@ -69,9 +70,9 @@ echo "</tr></table>";
$debug = false;
-if ($_GET['debuglevels'] == 'yes')
+if ($_GET['debuglevels'] == 'yes') {
$debug = true;
-
+}
if ($_GET['showemblems'] == 'all') {
@@ -147,10 +148,11 @@ return("#".substr("000000".dechex($n),-6));
//Self-healing code for unlocks.
if (!$viewer) {
- applyAchievements($userID, 1);
- applyAchievements($userID, 2);
- applyAchievements($userID, 3);
- applyAchievements($userID, 4);
+ applyAchievements($userID, ACHIEVEMENT_MOVES_CAREER);
+ applyAchievements($userID, ACHIEVEMENT_MAZE_CAREER);
+ applyAchievements($userID, ACHIEVEMENT_MAZE_MASTERY);
+ applyAchievements($userID, ACHIEVEMENT_CHAMPION_POINTS);
+ applyAchievements($userID, ACHIEVEMENT_PERFECT_DAY);
}
?>
@@ -307,8 +309,9 @@ order by maxLevel.type";
$result = mysql_query($sql);
if ($result) {
- while ($row = mysql_fetch_assoc($result))
+ while ($row = mysql_fetch_assoc($result)) {
$achievements[$row['type']] = $row;
+ }
}
@@ -358,35 +361,41 @@ echo "
<div style='width:100%; height:100%; background-color:transparent; background-size:100%;' class='grid_td_rocks grid_inner'></div>
</div>$UDisplay</h1>";
-function displayUnlockItem($uType, $item) {
+function unlockItemAsTD($uType, $item) {
$aLevel = $item['aLevel'];
$aCompleted = $item['dateUnlocked'];
- $aTypeNames[1] = "Path Career Level $aLevel";
- $aTypeNames[2] = "Mazes Career Level $aLevel";
- $aTypeNames[3] = "Maze Mastery Level $aLevel";
- $aTypeNames[4] = "Champion Level $aLevel";
- $aTypeNames[32] = 'Completing Tutorial';
+ $aTypeNames[ACHIEVEMENT_MOVES_CAREER] = "Path Career Level $aLevel";
+ $aTypeNames[ACHIEVEMENT_MAZE_CAREER] = "Mazes Career Level $aLevel";
+ $aTypeNames[ACHIEVEMENT_MAZE_MASTERY] = "Maze Mastery Level $aLevel";
+ $aTypeNames[ACHIEVEMENT_CHAMPION_POINTS] = "Champion Level $aLevel";
+ $aTypeNames[ACHIEVEMENT_PERFECT_DAY] = "Perfect Days $aLevel";
+ $aTypeNames[ACHIEVEMENT_TUTORIAL] = 'Completing Tutorial';
$by = $aTypeNames[$item['aType']];
$on = relative_date(strtotime($aCompleted));
$unlockTitle = "$item[name]. From $by $on";
- if ($item['aType'] == -1)
+ if ($item['aType'] == -1) {
$unlockTitle = "$item[name]";
+ }
$border = 'border: 1px solid #000; border-width: 2px 0px 2px 0px;';
$border = 'border: 1px solid #000;';
$class = 'grid_td_walls';
+ //$r .= displayUnlock($uType, $item[value], $unlockTitle);
+ //return $r;
+
switch ($uType) {
- case 1:
+ case 1:
if ($GLOBALS['wallColor'] == $item[value]) {
$class = 'grid_td_active';
$border = 'border: 1px solid #26b;';
}
$r .= "<td class='grid_td $class' id='color_$item[id]' title='$unlockTitle' onClick='colorclick(this,\"$item[value]\", \"$item[id]\")' style='padding: 0px;background-color:$item[value];$border'></td>";
break;
- case 2:
+
+ case 2:
if ($GLOBALS['wallEmblem'] == $item[value]) {
$class = 'grid_td_active';
$border = 'border: 1px solid #26b;';
@@ -394,13 +403,18 @@ function displayUnlockItem($uType, $item) {
$r .= "<td class='grid_td_walls' title='$unlockTitle' id='' onClick='emblemclick(this,\"$item[value]\", \"$item[id]\")' style='background: #999 url(../images/marks/$item[value]);$border' >
<div class='grid_inner $class grid_td_walls'></div></td>";
break;
- case 3:
+
+ case 3:
if ($GLOBALS['nameColor'] == $item[value])
$border = 'border: 1px solid #26b;';
$r .= "<td class='name_color_select'><span title='$unlockTitle' onClick='namecolorclick(this,\"$item[value]\", \"$item[id]\")' style='color:$item[value]; margin-right:15px;$border'>";
$r .= "&nbsp;$item[name]&nbsp;";
$r .= "</span></td>";
break;
+
+ case UNLOCK_EXTRAS:
+ $r .= "<td style='border: 1px solid gray;' class='name_color_select' title='$unlockTitle'>$item[name]</td>";
+ break;
}
return $r;
}
@@ -408,11 +422,12 @@ function displayUnlockItem($uType, $item) {
if (isset($unlocks)) {
echo "<h2>Unlocks</h2>";
-
+
//Define some names
$uTypeNames[1] = "Wall Colors";
$uTypeNames[2] = "Emblems";
$uTypeNames[3] = "Username Colors";
+ $uTypeNames[UNLOCK_EXTRAS] = "Extras";
$uSubtypeNames[1][0] = "Darker";
$uSubtypeNames[1][1] = "Brighter";
@@ -426,7 +441,7 @@ if (isset($unlocks)) {
echo "<h3>$uTypeNames[$uType] unlocked:</h3>";
foreach ($unlock as $item) {
- $subtype[$item['subtype']][] = displayUnlockItem($uType, $item);
+ $subtype[$item['subtype']][] = unlockItemAsTD($uType, $item);
if ((sizeof($subtype[$item['subtype']]) + 1) % 14 == 0)
$subtype[$item['subtype']][] = '</tr></table><table><tr>';
}
@@ -487,13 +502,14 @@ foreach($achievements as $aType => $a) {
$aTypeNames[1] = "<img src='../images/Achievement_PathCareer.png' style='width:36px;height:36px;vertical-align:middle'>Path Career Level $aLevel!";
$aTypeNames[2] = "<img src='../images/Achievement_MazeCareer.png' style='width:36px;height:36px;vertical-align:middle'>Mazes Career Level $aLevel!";
$aTypeNames[3] = "<img src='../images/MedalSilverCAR.png' style='width:36px;height:36px;vertical-align:middle'>Maze Mastery Level $aLevel!";
- $aTypeNames[4] = "<img src='../images/championpoints.png' style='width:36px;height:36px;vertical-align:middle'>Champion Level $aLevel!";
+ $aTypeNames[ACHIEVEMENT_CHAMPION_POINTS] = "<img src='../images/championpoints.png' style='width:36px;height:36px;vertical-align:middle'>Champion Level $aLevel!";
+ $aTypeNames[ACHIEVEMENT_PERFECT_DAY] = "Perfect Day level $aLevel!";
$aTypeNames[32] = 'Tutorial Complete!';
$aTypeCurrency[1] = "total moves mazed";
$aTypeCurrency[2] = "mazes played";
$aTypeCurrency[3] = "mazes with (tied) top score";
- $aTypeCurrency[4] = "champion points";
+ $aTypeCurrency[ACHIEVEMENT_CHAMPION_POINTS] = "champion points";
$name = $aTypeNames[$aType];
$currency = $aTypeCurrency[$aType];
@@ -543,26 +559,6 @@ foreach($achievements as $aType => $a) {
}
-function displayUnlock($uType, $uValue, $uName) {
- switch ($uType) {
- case 1:
- $r .= "$uName Wall Color!";
- $r .= "<table><tr><td onclick='changeWallColor(\"$uValue\")' style='background-color:$uValue;' class='grid_td_rocks'></td></tr></table>";
- break;
- case 2:
- $r .= "$uName Emblem!";
- $r .= "<div class='emblemDisplay' title='' style='background: #999 url(../images/marks/$uValue);' >";
- //$r .= "<div class='grid_inner grid_td_gray'></div></div>";
- $r .= "<div class='emblemDisplayInner' style='width:35px; height:35px;'></div></div>";
- break;
- case 3:
- $r .= "<br /><span style='color:$uValue;font-weight:bold;font-size:110%;background-color:#222;'>$uName Username color!</span>";
- break;
- }
- return $r;
-}
-
-
?>
</div>