public function parseProfile($ID)
 {
     $this->log(__LINE__, 'function: parseProfile() - parsing profile: ' . $ID);
     if (!$ID) {
         echo "error: No ID Set.";
     }
     // Get the source
     $this->log(__LINE__, 'function: parseProfile() - get source');
     $this->getSource($this->URL['character']['profile'] . $ID);
     $this->log(__LINE__, 'function: parseProfile() - obtained source');
     if ($this->errorPage($ID)) {
         return "error: Character page does not exist.";
     } else {
         $this->log(__LINE__, 'function: parseProfile() - starting parse');
         // Create a new character object
         $Character = new Character();
         $this->log(__LINE__, 'function: parseProfile() - new character object');
         // Set Character Data
         $Character->setID(trim($ID), $this->URL['character']['profile'] . $ID);
         $Character->setNameServer($this->findRange('player_name_thumb', 15));
         $this->log(__LINE__, 'function: parseProfile() - set id, name and server');
         // Only process if character name set
         if (strlen($Character->getName()) > 3) {
             $this->log(__LINE__, 'function: parseProfile() - parsing chunk 1');
             $Character->setTitle($this->findRange('chara_title', 2, NULL, false));
             $Character->setAvatar($this->findRange('player_name_thumb', 10, NULL, false));
             $Character->setPortrait($this->findRange('bg_chara_264', 2, NULL, false));
             $Character->setRaceClan($this->find('chara_profile_title'));
             //$Character->setLegacy($this->find('bt_legacy_history'));
             $Character->setNamedayCityCompanyFC($this->findRange('chara_profile_left', null, "chara_class_box", false));
             //$Character->setCity($this->findRange('#62;City-state', 5));
             $Character->setBiography($this->findRange('txt_selfintroduction', 5));
             $Character->setHPMPTP($this->findRange('param_power_area', 10));
             $Character->setStats($this->findAll('param_left_area_inner', 12, null, false));
             $Character->setActiveClassLevel($this->findAll('class_info', 5, null, false));
             $this->log(__LINE__, 'function: parseProfile() - parsing chunk 2');
             // Set Gear (Also sets Active Class and Job), then set item level from the gear
             $Character->setGear($this->findAll('-- ITEM Detail --', NULL, '-- //ITEM Detail --', false));
             $Character->setItemLevel($this->GearSlots);
             #$this->segment('area_header_w358_inner');
             $this->log(__LINE__, 'function: parseProfile() - parsing chunk 3');
             // Set Minions
             $Minions = $this->findRange('-- Minion --', NULL, '//Minion', false);
             $Character->setMinions($Minions);
             // Set Mounts
             $this->log(__LINE__, 'function: parseProfile() - parsing chunk 4');
             $Mounts = $this->findRange('-- Mount --', NULL, '//Mount', false);
             $Character->setMounts($Mounts);
             #$this->segment('class_fighter');
             // Set ClassJob
             $this->log(__LINE__, 'function: parseProfile() - parsing chunk 5');
             $Character->setClassJob($this->findRange('class_fighter', NULL, '//Class Contents', false));
             // Validate data
             $Character->validate();
             $this->log(__LINE__, 'function: parseProfile() - complete profile parse for: ' . $ID);
             // Append character to array
             $this->Characters[$ID] = $Character;
         } else {
             $this->Characters[$ID] = NULL;
         }
     }
 }
Beispiel #2
0
 /**
  * Draw a single character to a page at a certain position within this layout
  *
  * @param Character $character character to draw
  * @param int $position where to draw the character in the layout
  * @param \SimplePdf\Page $page page to draw on
  * @param int $dpi DPI to render the character image at
  */
 public function drawCharacter(Character $character, $position, \SimplePdf\Page $page, $dpi)
 {
     // First, draw the character's image:
     $x1 = $this->x + $this->colOffset * ($position % $this->numberOfColumns);
     $x2 = $x1 + $this->colWidth;
     $y1 = $this->y + $this->rowOffset * floor($position / $this->numberOfColumns);
     $y2 = $y1 + $this->rowHeight * self::IMAGE_SPACE;
     $character->drawToPage($page, $x1, $y1, $x2, $y2, $dpi);
     // Then, draw the character's name below it:
     $x1 += 0.1 * $this->colWidth;
     $x2 -= 0.1 * $this->colWidth;
     $temp = $y1;
     $y1 = $y2;
     $y2 = $temp + $this->rowHeight;
     $page->setFontSize($this->fontSize);
     $page->setLineSpacing(self::LINE_SPACING);
     $fontHeight = $page->getFontSize() * 1.2;
     $page->convertFromPoints($fontHeight);
     $text = $character->getName();
     $lineCount = substr_count($page->wordWrapText($text, $x2 - $x1), PHP_EOL) + 1;
     $textHeight = ($lineCount - 1) * $page->getLineHeight() + $fontHeight;
     $y = $y1 + ($y2 - $y1 - $textHeight) / 2;
     $page->drawTextBlock($text, $y, \SimplePdf\Page::TEXT_ALIGN_CENTER, $x1, $x2);
 }