コード例 #1
0
ファイル: Character.php プロジェクト: nimetu/rrs_client
 /**
  * @param MemStream $f
  */
 public function serial(MemStream $f)
 {
     $version = 2;
     $f->serial_byte($version);
     $f->serial_byte($this->pktFormat);
     $f->serial_byte($this->race);
     $f->serial_byte($this->age);
     $this->vpa->serial($f);
     $this->vpb->serial($f);
     $this->vpc->serial($f);
     $f->serial_uint32($this->direction);
     $f->serial_uint32($this->angle);
     $b = $this->FaceShot ? 1 : 0;
     $f->serial_byte($b);
     $f->serial_uint32($this->background);
     $b = $this->useFx ? 1 : 0;
     $f->serial_byte($b);
 }
コード例 #2
0
 /**
  * Expand visual prop values into $args
  *
  * @param array $args
  *
  * @return array
  */
 private function decodeVisualProps(array $args)
 {
     $vpa = new SPropVisualA();
     $vpa->setValue($this->getUnsigned64bit($args['vpa']));
     $vpb = new SPropVisualB();
     $vpb->setValue($this->getUnsigned64bit($args['vpb']));
     $vpc = new SPropVisualC();
     $vpc->setValue($this->getUnsigned64bit($args['vpc']));
     unset($args['vpa'], $args['vpb'], $args['vpc']);
     $hat = ryzom_vs_sheet(EVisualSlot::HEAD_SLOT, $vpa->HatModel);
     if ($hat) {
         $args['race'] = substr($hat, 0, 2);
         // map any haircut to hair so that race check can be done later
         if (strstr($hat, '_hair_') !== false || strstr($hat, '_cheveux_') !== false) {
             // uses vs index
             $args['hair'] = $vpa->HatModel . '/' . $vpa->HatColor;
             unset($args['head']);
         } else {
             unset($args['hair']);
             // uses sheetid
             $args['head'] = $hat . '/' . $vpa->HatColor;
         }
     } elseif (!isset($args['race'])) {
         // fallback - unknown haircut and url does not have race set
         $args['race'] = TPeople::FYROS;
     }
     $args['gender'] = strtolower(EGender::toString($vpa->Sex));
     $args['race'] = strtolower(TPeople::toString($this->normalizeRace($args['race'])));
     // its fine if we fail items
     $s = ryzom_vs_sheet(EVisualSlot::ARMS_SLOT, $vpa->ArmModel);
     if ($s) {
         $args['arms'] = $s . '/' . $vpa->ArmColor;
     }
     $s = ryzom_vs_sheet(EVisualSlot::LEGS_SLOT, $vpa->TrouserModel);
     if ($s) {
         $args['legs'] = $s . '/' . $vpa->TrouserColor;
     }
     $s = ryzom_vs_sheet(EVisualSlot::HANDS_SLOT, $vpb->HandsModel);
     if ($s) {
         $args['hands'] = $s . '/' . $vpb->HandsColor;
     }
     $s = ryzom_vs_sheet(EVisualSlot::FEET_SLOT, $vpb->FeetModel);
     if ($s) {
         $args['feet'] = $s . '/' . $vpb->FeetColor;
     }
     $s = ryzom_vs_sheet(EVisualSlot::CHEST_SLOT, $vpa->JacketModel);
     if ($s) {
         $args['chest'] = $s . '/' . $vpa->JacketColor;
     }
     $args['tattoo'] = $vpc->Tattoo;
     $args['eyes'] = $vpc->EyesColor;
     $handr = ryzom_vs_sheet(EVisualSlot::RIGHT_HAND_SLOT, $vpa->WeaponRightHand);
     if ($handr) {
         $args['handr'] = $handr;
     }
     $handl = ryzom_vs_sheet(EVisualSlot::LEFT_HAND_SLOT, $vpa->WeaponLeftHand);
     if ($handl) {
         $args['handl'] = $handl;
     }
     $args['morph'] = join(',', [$vpc->MorphTarget1, $vpc->MorphTarget2, $vpc->MorphTarget3, $vpc->MorphTarget4, $vpc->MorphTarget5, $vpc->MorphTarget6, $vpc->MorphTarget7, $vpc->MorphTarget8]);
     $args['gabarit'] = join(',', [$vpc->CharacterHeight, $vpc->TorsoWidth, $vpc->ArmsWidth, $vpc->LegsWidth, $vpc->BreastSize]);
     return $args;
 }