Example #1
0
 public function parseAchievements($ID = null)
 {
     if (!$ID) {
         $ID = $this->getID();
     }
     if (!$ID) {
         echo "error: No ID Set.";
     } else {
         // Main achievement object
         $MA = new Achievements();
         // Loop through categories
         foreach ($this->AchievementCategories as $cID) {
             // Parse Achievements
             $this->parseAchievementsByCategory($cID, $ID);
             // Get Achievement Object
             $A = $this->Achievements[$cID];
             // Add onto main achievements object
             $MA->setTotalPoints($MA->getTotalPoints() + $A->getTotalPoints());
             $MA->setCurrentPoints($MA->getCurrentPoints() + $A->getCurrentPoints());
             $MA->setTotalAchievements($MA->getTotalAchievements() + $A->getTotalAchievements());
             $MA->setCurrentAchievements($MA->getCurrentAchievements() + $A->getCurrentAchievements());
             $MA->genPointsPercentage();
             $MA->addAchievements($A->get());
             $MA->addCategory($cID);
         }
         // Format Achievements
         $this->Achievements = $MA;
     }
 }