summaryrefslogtreecommitdiffstats
path: root/pages/achievements.php
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2012-04-06 13:16:34 -0700
committerPatrick Davison <snapwilliam@gmail.com>2012-04-06 13:16:34 -0700
commit54f2d89db19c85701a2d67a7cd72d0f28bbc2dcf (patch)
treeb2ef4396958f10dd201a4a6af7e3e7ad29f6c8b4 /pages/achievements.php
parent4da60bce3b9fcffc185335f294a8fc32a431fe56 (diff)
downloadpathery-54f2d89db19c85701a2d67a7cd72d0f28bbc2dcf.tar.xz
Unlock lookups
Diffstat (limited to 'pages/achievements.php')
-rw-r--r--pages/achievements.php57
1 files changed, 34 insertions, 23 deletions
diff --git a/pages/achievements.php b/pages/achievements.php
index 6506442..38f9bdf 100644
--- a/pages/achievements.php
+++ b/pages/achievements.php
@@ -39,12 +39,6 @@ if ($_GET['applyall'] == 'true') {
// TESTING AREA !! REMOVE
-// echo trackMOTDstats(1);
-// echo trackMOTDstats(2);
-// echo trackMOTDstats(3);
-// echo trackMOTDstats(4);
-
-
$colors[] = '2';
$colors[] = '6';
$colors[] = 'a';
@@ -202,18 +196,22 @@ function namecolorclick(obj, color, unlockID) {
// Get unlocks data
//Defaults
-$unlocks[1][0] = array('id' => 0, 'subtype' => 0, 'name' => 'Default Charcoal', 'value' => '#666666');
-$unlocks[2][0] = array('id' => 0, 'subtype' => 0, 'name' => 'Default Blank', 'value' => 'blank.png');
-$unlocks[3][0] = array('id' => 0, 'subtype' => 0, 'name' => 'Default', 'value' => '#cccccc');
+$unlocks[1][0] = array('id' => 0, 'subtype' => 0, 'name' => 'Default Charcoal', 'value' => '#666666', 'aType' => -1);
+$unlocks[2][0] = array('id' => 0, 'subtype' => 0, 'name' => 'Default Blank', 'value' => 'blank.png', 'aType' => -1);
+$unlocks[3][0] = array('id' => 0, 'subtype' => 0, 'name' => 'Default', 'value' => '#cccccc', 'aType' => -1);
$sql = "SELECT
- id,
- type,
+ unlocks.id,
+ unlocks.type,
IfNull(subtype, 0) as subtype,
name,
value,
- dateUnlocked
+ dateUnlocked,
+ achievements.type as aType,
+ achievements.level as aLevel
FROM `unlocks`
-WHERE userID = '$userID'
+LEFT JOIN `achievements`
+ ON achievements.ID = unlocks.id
+WHERE unlocks.userID = '$userID'
ORDER BY `value` DESC";
$result = mysql_query($sql);
if ($result) {
@@ -345,16 +343,34 @@ echo "
</div>$UDisplay</h1>";
function displayUnlockItem($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';
+
+ $by = $aTypeNames[$item['aType']];
+ $on = relative_date(strtotime($aCompleted));
+
+ $unlockTitle = "$item[name]. From $by $on";
+ if ($item['aType'] == -1)
+ $unlockTitle = "$item[name]";
+
switch ($uType) {
case 1:
- $r .= "<td id='color_$item[id]' title='$item[name]' onClick='colorclick(this,\"$item[value]\", \"$item[id]\")' style='background-color:$item[value];' class='grid_td_walls'></td>";
+ if ($wallColor == $item[value])
+ $r .= '<td>s</td>';
+ $r .= "<td id='color_$item[id]' title='$unlockTitle' onClick='colorclick(this,\"$item[value]\", \"$item[id]\")' style='background-color:$item[value];' class='grid_td_walls'></td>";
break;
case 2:
- $r .= "<td class='grid_td_walls' title='$item[name]' id='' onClick='emblemclick(this,\"$item[value]\", \"$item[id]\")' style='background: #999 url(../images/marks/$item[value]);' >
+ $r .= "<td class='grid_td_walls' title='$unlockTitle' id='' onClick='emblemclick(this,\"$item[value]\", \"$item[id]\")' style='background: #999 url(../images/marks/$item[value]);' >
<div class='grid_inner grid_td_walls'></div></td>";
break;
case 3:
- $r .= "<td class='name_color_select'><span onClick='namecolorclick(this,\"$item[value]\", \"$item[id]\")' style='color:$item[value]; margin-right:15px;'>";
+ $r .= "<td class='name_color_select'><span title='$unlockTitle' onClick='namecolorclick(this,\"$item[value]\", \"$item[id]\")' style='color:$item[value]; margin-right:15px;'>";
$r .= "&nbsp;$item[name]&nbsp;";
$r .= "</span></td>";
break;
@@ -362,15 +378,10 @@ function displayUnlockItem($uType, $item) {
return $r;
}
+
+
if (isset($unlocks)) {
echo "<h2>Unlocks</h2>";
- //Set defaults.
- //$defaultColor = array('id' => 0, 'subtype' => 0, 'name' => 'Default Charcoal', 'value' => '#666666');
- //$defaultEmblem = array('id' => 0, 'subtype' => 0, 'name' => 'Default Blank', 'value' => 'blank.png');
- //$defaultNameColor = array('id' => 0, 'subtype' => 0, 'name' => 'Default Gray', 'value' => '#cccccc');
- //array_unshift($unlocks[1], $defaultColor);
- //array_unshift($unlocks[2], $defaultEmblem);
- //array_unshift($unlocks[3], $defaultNameColor);
$uTypeNames[1] = "Wall Colors";
$uTypeNames[2] = "Emblems";