From c5175d4a06c993ff7f42c16178b6d4db49b7387e Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Mon, 18 Mar 2013 01:32:14 -0700 Subject: Wall orientation achievements - huge commit. --- pages/achievements.php | 94 ++++++++++++++++++++++++++++++++++++-------------- pages/chat.php | 2 +- 2 files changed, 70 insertions(+), 26 deletions(-) (limited to 'pages') diff --git a/pages/achievements.php b/pages/achievements.php index 383de70..fb20f2b 100644 --- a/pages/achievements.php +++ b/pages/achievements.php @@ -55,8 +55,6 @@ foreach ($ac3 as $c3) { echo ""; foreach ($ac1 as $c1) { foreach ($ac2 as $c2) { - - $c = "#$c1$c2$c3"; if ($_GET['showcolor'] == 'all') { //echo ""; @@ -177,7 +175,8 @@ function emblemclick(obj, emblem, unlockID) { if (viewer) return; var hbadge = document.getElementById('badge'); - hbadge.style.backgroundImage="url(images/marks/"+emblem+")"; + var orientation = document.getElementById('selectOrientation').value; + hbadge.style.backgroundImage="url("+linkEmblem(emblem, orientation)+")" document.getElementById('selectEmblem').value = emblem; document.getElementById('selectEmblemID').value = unlockID; } @@ -190,6 +189,17 @@ function namecolorclick(obj, color, unlockID) { document.getElementById('selectNameColor').value = color; document.getElementById('selectNameColorID').value = unlockID; } +function wallOrientationClick(obj, orientation, unlockID) { + if (viewer) return; + var emblem = document.getElementById('selectEmblem').value; + var hbadge = document.getElementById('badge'); + hbadge.style.backgroundImage="url("+linkEmblem(emblem, orientation)+")"; + +// hbadge.style.backgroundImage="url("+linkEmblem(emblem, +")"; + document.getElementById('selectOrientation').value = orientation; + document.getElementById('selectOrientationID').value = unlockID; +} + 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); +$unlocks[4][0] = array('id' => 0, 'subtype' => 0, 'name' => 'Default: (0*)', 'value' => '0', 'aType' => -1); $sql = "SELECT unlocks.id, unlocks.type, @@ -221,6 +232,9 @@ if ($result) { $unlocks[$row['type']][$row['id']] = $row; } +//Destroy some defaults to make them not show up. +if (count($unlocks[3]) == 1) unset($unlocks[3]); +if (count($unlocks[4]) == 1) unset($unlocks[4]); //print_R($_POST); @@ -237,12 +251,14 @@ if (isset($_POST['doupdate']) AND !$viewer) { $unlockIDNC = $_POST['selectNameColorID']; $unlockNameColor = $unlocks[3][$unlockIDNC]['value']; - if ($unlockIDC == 0) - $unlockColor = '#666666'; - if ($unlockIDE == 0) - $unlockEmblem = 'blank.png'; - if ($unlockIDNC == 0) - $unlockNameColor = '#cccccc'; + $orientationUnlockID = $_POST['selectOrientationID']; + $orientationNewValue = $unlocks[UNLOCK_WALL_ORIENTATION][$orientationUnlockID]['value']; + + //Default values + if ($unlockIDC == 0) $unlockColor = '#666666'; + if ($unlockIDE == 0) $unlockEmblem = 'blank.png'; + if ($unlockIDNC == 0) $unlockNameColor = '#cccccc'; + if ($orientationUnlockID == 0) $orientationNewValue = '0'; if ($unlockColor == $_POST['selectColor']) { $sql = "UPDATE `users` @@ -271,7 +287,6 @@ if (isset($_POST['doupdate']) AND !$viewer) { $data['post'] = print_r($_POST, true); EmailError($data); } - } if ($unlockNameColor == $_POST['selectNameColor']) { $sql = "UPDATE `users` @@ -287,6 +302,20 @@ if (isset($_POST['doupdate']) AND !$viewer) { EmailError($data); } } + if ($orientationNewValue == $_POST['selectOrientation']) { + $sql = "UPDATE `users` + SET `wallOrientation` = '$orientationNewValue' + WHERE `ID` = '$userID'"; + $result = mysql_query($sql); + if (!$result) { + echo "Error updating wall Orientation"; + $data = array(); + $data['error'] = "Error when updating wall orientation"; + $data['session'] = print_r($_SESSION, true); + $data['post'] = print_r($_POST, true); + EmailError($data); + } + } } $achievements = array(); @@ -325,7 +354,8 @@ SELECT users.totalMazes AS totalSolutions, users.wallColor, users.displayColor, - users.wallEmblem + users.wallEmblem, + users.wallOrientation FROM `users` LEFT JOIN `solutions` ON users.ID = solutions.userID @@ -341,7 +371,7 @@ if (!$result OR mysql_num_rows($result) <= 0) { htmlFooter(); exit; } -list($UDisplay, $UAdmin, $UTotalMoves, $UTotalSolutions, $wallColor, $nameColor, $wallEmblem) = mysql_fetch_row($result); +list($UDisplay, $UAdmin, $UTotalMoves, $UTotalSolutions, $wallColor, $nameColor, $wallEmblem, $wallOrientation) = mysql_fetch_row($result); if ($wallEmblem == '') $wallEmblem = 'blank.png'; @@ -353,11 +383,12 @@ $uStats[1] = $UTotalMoves; $uStats[2] = $UTotalSolutions; echo "
"; -if ($viewer) - echo "

Viewing

"; +if ($viewer) echo "

Viewing

"; + +$badgeURL = linkEmblem($wallEmblem, $wallOrientation); echo "

-
+
$UDisplay

"; @@ -387,7 +418,7 @@ function unlockItemAsTD($uType, $item) { //return $r; switch ($uType) { - case 1: + case UNLOCK_WALL_COLOR: if ($GLOBALS['wallColor'] == $item[value]) { $class = 'grid_td_active'; $border = 'border: 1px solid #26b;'; @@ -395,7 +426,7 @@ function unlockItemAsTD($uType, $item) { $r .= ""; break; - case 2: + case UNLOCK_WALL_EMBLEM: if ($GLOBALS['wallEmblem'] == $item[value]) { $class = 'grid_td_active'; $border = 'border: 1px solid #26b;'; @@ -404,13 +435,22 @@ function unlockItemAsTD($uType, $item) {
"; break; - case 3: + case UNLOCK_DISPLAY_COLOR: if ($GLOBALS['nameColor'] == $item[value]) $border = 'border: 1px solid #26b;'; $r .= ""; $r .= " $item[name] "; $r .= ""; break; + + case UNLOCK_WALL_ORIENTATION: + $checked = ''; + if (intval($GLOBALS['wallOrientation']) == intval($item[value])) $checked = 'checked'; + //$r .= ""; + $r .= ""; + $r .= "$item[name] "; + $r .= ""; + break; case UNLOCK_EXTRAS: $r .= "$item[name]"; @@ -424,16 +464,17 @@ if (isset($unlocks)) { echo "

Unlocks

"; //Define some names - $uTypeNames[1] = "Wall Colors"; - $uTypeNames[2] = "Emblems"; - $uTypeNames[3] = "Username Colors"; + $uTypeNames[UNLOCK_WALL_COLOR] = "Wall Colors"; + $uTypeNames[UNLOCK_WALL_EMBLEM] = "Emblems"; + $uTypeNames[UNLOCK_DISPLAY_COLOR] = "Username Colors"; + $uTypeNames[UNLOCK_WALL_ORIENTATION] = "Emblem Rotations"; $uTypeNames[UNLOCK_EXTRAS] = "Extras"; - $uSubtypeNames[1][0] = "Darker"; - $uSubtypeNames[1][1] = "Brighter"; + $uSubtypeNames[UNLOCK_WALL_COLOR][0] = "Darker"; + $uSubtypeNames[UNLOCK_WALL_COLOR][1] = "Brighter"; - $uSubtypeNames[2][0] = "Simple"; - $uSubtypeNames[2][1] = "Complicated"; + $uSubtypeNames[UNLOCK_WALL_EMBLEM][0] = "Simple"; + $uSubtypeNames[UNLOCK_WALL_EMBLEM][1] = "Complicated"; //For every unlock type that the user has. foreach ($unlocks as $uType => $unlock) { @@ -463,6 +504,7 @@ echo "
"; if (!$viewer) { + //TODO add wall orientation echo "
@@ -470,6 +512,8 @@ if (!$viewer) { + + diff --git a/pages/chat.php b/pages/chat.php index 5be6689..68a0abf 100644 --- a/pages/chat.php +++ b/pages/chat.php @@ -101,7 +101,7 @@ function getChatDone(data) { p = ''; p = p+ "
"; p = p+ " ["+timestamp+"]"; - p = p+ "
"; + p = p+ "
"; p = p+ "
"; p = p+ "
"; p = p+ "
"; -- cgit v1.2.3