summaryrefslogtreecommitdiffstats
path: root/pages
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2013-03-18 01:32:14 -0700
committerPatrick Davison <snapwilliam@gmail.com>2013-03-18 01:32:14 -0700
commitc5175d4a06c993ff7f42c16178b6d4db49b7387e (patch)
treed8629d21c81c27fe2cb52b2e201285c3449d1e7c /pages
parentaa2388203ebc2fad01b8280777e5a40de4fcc813 (diff)
downloadpathery-c5175d4a06c993ff7f42c16178b6d4db49b7387e.tar.xz
Wall orientation achievements - huge commit.
Diffstat (limited to 'pages')
-rw-r--r--pages/achievements.php94
-rw-r--r--pages/chat.php2
2 files changed, 70 insertions, 26 deletions
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 "</tr><tr>";
foreach ($ac1 as $c1) {
foreach ($ac2 as $c2) {
-
-
$c = "#$c1$c2$c3";
if ($_GET['showcolor'] == 'all') {
//echo "<td onclick='changeWallColor(\"#$c1$c2$c3\")' title='#$c1$c2$c3' style='background-color:#$c3$c1$c2;' class='grid_td_rocks'></td>";
@@ -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;
+}
+
</script>
<?
@@ -201,6 +211,7 @@ function namecolorclick(obj, color, unlockID) {
$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);
+$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 "<div class='wrapper' style='padding-left:30px; width:800px;'>";
-if ($viewer)
- echo "<center><h3>Viewing</h3></center>";
+if ($viewer) echo "<center><h3>Viewing</h3></center>";
+
+$badgeURL = linkEmblem($wallEmblem, $wallOrientation);
echo "
<h1 id='badgeheader' style='margin-left:10px;color:$nameColor;'>
-<div id='badge' style='margin-right:10px; background:$wallColor url(../images/marks/$wallEmblem);float:left;background-size:100%;' class='badge'>
+<div id='badge' style='margin-right:10px; background:$wallColor url($badgeURL);float:left;background-size:100%;' class='badge'>
<div style='width:100%; height:100%; background-color:transparent; background-size:100%;' class='grid_td_rocks grid_inner'></div>
</div>$UDisplay</h1>";
@@ -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 .= "<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 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) {
<div class='grid_inner $class grid_td_walls'></div></td>";
break;
- case 3:
+ case UNLOCK_DISPLAY_COLOR:
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_WALL_ORIENTATION:
+ $checked = '';
+ if (intval($GLOBALS['wallOrientation']) == intval($item[value])) $checked = 'checked';
+ //$r .= "<td class='name_color_select'>";
+ $r .= "<td class='name_color_select'>";
+ $r .= "<input onClick='wallOrientationClick(this,\"$item[value]\", \"$item[id]\")' type='radio' name='wallOrientation' value='male' $checked>$item[name] ";
+ $r .= "</td>";
+ break;
case UNLOCK_EXTRAS:
$r .= "<td style='border: 1px solid gray;' class='name_color_select' title='$unlockTitle'>$item[name]</td>";
@@ -424,16 +464,17 @@ if (isset($unlocks)) {
echo "<h2>Unlocks</h2>";
//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 "<br />";
if (!$viewer) {
+ //TODO add wall orientation
echo "
<form action='achievements' method='post' name='updateBadge'>
<input id='doupdate' type='hidden' name='doupdate' value='true' />
@@ -470,6 +512,8 @@ if (!$viewer) {
<input id='selectColorID' type='hidden' name='selectColorID' value='' />
<input id='selectEmblem' type='hidden' name='selectEmblem' value='$wallEmblem' />
<input id='selectEmblemID' type='hidden' name='selectEmblemID' value='' />
+ <input id='selectOrientation' type='hidden' name='selectOrientation' value='$wallOrientation' />
+ <input id='selectOrientationID' type='hidden' name='selectOrientationID' value='' />
<input id='selectNameColor' type='hidden' name='selectNameColor' value='$nameColor' />
<input id='selectNameColorID' type='hidden' name='selectNameColorID' value='' />
<input type='submit' value='Save Changes' />
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+ " <div class='chatColumn1'>";
p = p+ " <span class='chatTimestamp' title='"+timestampDetails+"'>["+timestamp+"]</span>";
- p = p+ " <div class='grid_td chatBadge' style='float:left; width:35px; height:35px; background:"+chat.wallColor+" url(images/marks/"+chat.wallEmblem+");'>";
+ p = p+ " <div class='grid_td chatBadge' style='float:left; width:35px; height:35px; background:"+chat.wallColor+" url("+linkEmblem(chat.wallEmblem, chat.wallOrientation)+");'>";
p = p+ " <div style='background-color:transparent;' class='grid_td_inner grid_td_rocks'>";
p = p+ " </div>";
p = p+ " </div>";