function getAwardsByPID($PID) { $PlayerAwards = array(); # grab all badges # $PlayerAwards[$awd] # $PlayerAwards[$awd][$level] # $PlayerAwards[$awd][$level]['earned'] # $PlayerAwards[$awd][$level]['first'] $PlayerAwards = array(); #get badges $count = getBadgeCount(); for ($i = 0; $i < $count; $i++) { $AWD = trim(getBadge($i)); for ($LEVEL = 0; $LEVEL < 4; $LEVEL++) { $award = getAwardByPID_and_AWD($PID, $AWD, $LEVEL); $PlayerAwards[$i][$LEVEL][AWD] = isset($AWD) ? $AWD : 0; $PlayerAwards[$i][$LEVEL][LEVEL] = $LEVEL; $PlayerAwards[$i][$LEVEL][EARNED] = isset($award[0]['earned']) ? $award[0]['earned'] : 0; $PlayerAwards[$i][$LEVEL][FIRST] = isset($award[0]['first']) ? $award[0]['first'] : 0; $PlayerAwards[$i][$LEVEL][NAME] = getBadgeByID($AWD); } } #append next after those #get Medals $oldcount = $count; $count = $oldcount + getMedalCount(); for ($i = $oldcount; $i < $count; $i++) { $AWD = trim(getMedal($i - $oldcount)); $LEVEL = 0; // levels! $award = getAwardByPID_and_AWD_NOLEVEL($PID, $AWD); $PlayerAwards[$i][$LEVEL][AWD] = isset($AWD) ? $AWD : 0; $PlayerAwards[$i][$LEVEL][LEVEL] = isset($award[0]['level']) ? $award[0]['level'] : 0; $PlayerAwards[$i][$LEVEL][EARNED] = isset($award[0]['earned']) ? $award[0]['earned'] : 0; $PlayerAwards[$i][$LEVEL][FIRST] = isset($award[0]['first']) ? $award[0]['first'] : 0; $PlayerAwards[$i][$LEVEL][NAME] = getMedalByID($AWD); } #append next after those #get Ribbons $oldcount = $count; $count = $oldcount + getRibbonCount(); for ($i = $oldcount; $i < $count; $i++) { $AWD = trim(getRibbon($i - $oldcount)); $LEVEL = 0; // levels! $award = getAwardByPID_and_AWD_NOLEVEL($PID, $AWD); $PlayerAwards[$i][$LEVEL][AWD] = isset($AWD) ? $AWD : 0; $PlayerAwards[$i][$LEVEL][LEVEL] = isset($award[0]['level']) ? $award[0]['level'] : 0; $PlayerAwards[$i][$LEVEL][EARNED] = isset($award[0]['earned']) ? $award[0]['earned'] : 0; $PlayerAwards[$i][$LEVEL][FIRST] = isset($award[0]['first']) ? $award[0]['first'] : 0; $PlayerAwards[$i][$LEVEL][NAME] = getRibbonByID($AWD); } #append next after those #get SFbadges $oldcount = $count; $count = $oldcount + getSFBadgeCount(); for ($i = $oldcount; $i < $count; $i++) { $AWD = trim(getSFBadge($i - $oldcount)); for ($LEVEL = 0; $LEVEL < 4; $LEVEL++) { $award = getAwardByPID_and_AWD($PID, $AWD, $LEVEL); $PlayerAwards[$i][$LEVEL][AWD] = isset($AWD) ? $AWD : 0; $PlayerAwards[$i][$LEVEL][LEVEL] = $LEVEL; $PlayerAwards[$i][$LEVEL][EARNED] = isset($award[0]['earned']) ? $award[0]['earned'] : 0; $PlayerAwards[$i][$LEVEL][FIRST] = isset($award[0]['first']) ? $award[0]['first'] : 0; $PlayerAwards[$i][$LEVEL][NAME] = getSFBadgeByID($AWD); } } #append next after those #get SFRibbons $oldcount = $count; $count = $oldcount + getSFRibbonCount(); for ($i = $oldcount; $i < $count; $i++) { $AWD = trim(getSFRibbon($i - $oldcount)); $LEVEL = 0; // levels! $award = getAwardByPID_and_AWD_NOLEVEL($PID, $AWD); $PlayerAwards[$i][$LEVEL][AWD] = isset($AWD) ? $AWD : 0; $PlayerAwards[$i][$LEVEL][LEVEL] = isset($award[0]['level']) ? $award[0]['level'] : 0; $PlayerAwards[$i][$LEVEL][EARNED] = isset($award[0]['earned']) ? $award[0]['earned'] : 0; $PlayerAwards[$i][$LEVEL][FIRST] = isset($award[0]['first']) ? $award[0]['first'] : 0; $PlayerAwards[$i][$LEVEL][NAME] = getSFRibbonByID($AWD); } return $PlayerAwards; }
} $template .= ' </td> </tr> </table> <!-- <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> --> <table border="0" cellspacing="0" cellpadding="0" id="awards" class="stat"> <tr><th colspan="2">Awards</th></tr> <tr><td>Badges</td> <td class="awards-row"> '; $count = getBadgeCount(); for ($i = 0; $i < $count; $i++) { $awardlevel = getBadgeLevel($PlayerAwards[$i]); $template .= '<div class="award-inline" onMouseOver="show_mine(this);" onMouseOut="hide_mine(this);"> <img src="' . $ROOT . 'spacer.gif" style="background: url(\'' . $ROOT . 'game-images/awards/'; if ($awardlevel > 0) { $template .= 'front/' . $PlayerAwards[$i][$awardlevel][AWD] . '_' . $awardlevel; } else { $template .= 'locked/' . $PlayerAwards[$i][$awardlevel][AWD] . '_0'; } $template .= '.png\');" width="42" height="42" alt="" /> <div class="award-pop dir-'; if ($i < $count / 2) { $template .= 'left'; } else {