예제 #1
0
 public function serial(MemStream $s)
 {
     $s->serial_uint32($this->NbMaxSpawnedSquads);
     $s->serial_uint32($this->NbMaxSpawnedMercenarySquads);
     $s->serial_uint32($this->ChallengeCost);
     $s->serial_uint32($this->MaxTotalSquad);
 }
예제 #2
0
 public function serial(MemStream $s)
 {
     $s->serial_uint32($this->Skill);
     $s->serial_uint32($this->CraftingToolType);
     $s->serial_uint32($this->CommandRange);
     $s->serial_uint32($this->MaxDonkey);
 }
예제 #3
0
 public function serial(MemStream $s)
 {
     $s->serial_byte($ver);
     $continents = array();
     $s->serial_uint32($nbItems);
     for ($i = 0; $i < $nbItems; $i++) {
         $cont = new Client\CContinent();
         $cont->serial($s);
         $name = $cont->Name;
         $continents[$name] = $cont;
     }
     $this->entries['continents'] = $continents;
     $worldmap = array();
     $s->serial_uint32($nbItems);
     for ($i = 0; $i < $nbItems; $i++) {
         $map = new Client\CContLandMark();
         $map->serial($s);
         $name = $map->TitleText;
         $worldmap[$name] = $map;
     }
     $this->entries['worldmap'] = $worldmap;
     $aliasmap = array();
     if ($ver >= 1) {
         $s->serial_uint32($nbItems);
         for ($i = 0; $i < $nbItems; $i++) {
             $s->serial_uint32($id);
             $s->serial_string($key);
             $aliasmap[$id] = $key;
         }
     }
     $this->entries['aliasmap'] = $aliasmap;
 }
예제 #4
0
 public function serial(MemStream $s)
 {
     $s->serial_float($this->X);
     $s->serial_float($this->Y);
     $s->serial_float($this->Z);
     $s->serial_byte($this->Selected);
 }
예제 #5
0
 public function serial(MemStream $s)
 {
     $s->serial_uint32($this->WeaponType);
     $s->serial_uint32($this->Skill);
     $s->serial_uint32($this->DamageType);
     $s->serial_sint32($this->MeleeRange);
 }
예제 #6
0
 public function serial(MemStream $s)
 {
     $s->serial_short($this->OverdoseTimer);
     $s->serial_short($this->ConsumptionTime);
     $s->serial_uint32($nbItems);
     $s->serial_int_string($this->Properties, $nbItems);
 }
예제 #7
0
 public function testSerialRead()
 {
     $vpb = new SPropVisualB();
     $this->assertEquals(0, $vpb->getValue());
     $mem = new MemStream();
     $mem->setBuffer($this->buffer);
     $vpb->serial($mem);
     $this->assertEquals($this->value, $vpb->getValue());
 }
예제 #8
0
 public function serial(MemStream $s)
 {
     $this->skills = array();
     $s->serial_uint32($nbSkills);
     for ($nb = 0; $nb < $nbSkills; $nb++) {
         $skill = new CSkill();
         $skill->serial($s);
         $this->skills[$skill->Skill] = $skill;
     }
 }
예제 #9
0
 /**
  * @param MemStream $s
  */
 public function serial(MemStream $s)
 {
     if ($s->isReading()) {
         $s->serial_uint64($val);
         $this->setValue($val);
     } else {
         $val = $this->getValue();
         $s->serial_uint64($val);
     }
 }
예제 #10
0
 public function serial(MemStream $s)
 {
     $s->serial_byte($ver);
     $s->serial_uint32($this->Type);
     $this->Pos = new CVector2f();
     $this->Pos->serial($s);
     $this->Zone = new CPrimZone();
     $this->Zone->serial($s);
     $s->serial_string($this->TitleText);
 }
예제 #11
0
 /**
  * Read user landmarks
  *
  * @param MemStream $s
  */
 protected function serialContinent(MemStream $s)
 {
     $s->serial_string($name);
     $this->Continents[$name] = array();
     $s->serial_uint32($nb);
     for ($i = 0; $i < $nb; $i++) {
         $lm = new CUserLandMark();
         $lm->serial($s);
         $this->Continents[$name][] = $lm;
     }
 }
예제 #12
0
 public function serial(MemStream $s)
 {
     // IPrimitive::serial()
     $s->serial_uint32($this->fillerZeros, 3);
     $this->VPoints = array();
     $s->serial_uint32($nbEntries);
     for ($i = 0; $i < $nbEntries; $i++) {
         $vec = new CPrimVector();
         $vec->serial($s);
         $this->VPoints[] = $vec;
     }
 }
예제 #13
0
파일: CMp.php 프로젝트: nimetu/ryzom_sheets
 /**
  * @param MemStream $s
  */
 public function serial(MemStream $s)
 {
     $s->serial_uint32($this->Ecosystem);
     $s->serial_uint32($this->MpCategory);
     $s->serial_uint32($this->HarvestSkill);
     $s->serial_uint32($this->Family);
     $s->serial_uint64($this->ItemPartBF);
     $s->serial_byte($this->UsedAsCraftRequirement);
     $s->serial_byte($this->MpColor);
     $s->serial_short($this->StatEnergy);
 }
예제 #14
0
파일: CFX.php 프로젝트: nimetu/ryzom_sheets
 public function serial(MemStream $s)
 {
     $s->serial_float($this->TrailMinSliceTime);
     $s->serial_float($this->TrailMaxSliceTime);
     $s->serial_float($this->AttackFXOffset, 3);
     $s->serial_string($this->Trail);
     $s->serial_string($this->AdvantageFX);
     $s->serial_string($this->AttackFX);
     $s->serial_float($this->AttackFXRot, 3);
     $s->serial_float($this->ImpactFXDelay);
 }
예제 #15
0
 public function serial(MemStream $s)
 {
     $s->serial_string($this->Name);
     $this->Zone = new CPrimZone();
     $this->Zone->serial($s);
     $this->ZoneCenter = new CVector2f();
     $this->ZoneCenter->serial($s);
     $this->ContLandMarks = array();
     $s->serial_uint32($nbItems);
     for ($i = 0; $i < $nbItems; $i++) {
         $cont = new CContLandMark();
         $cont->serial($s);
         $this->ContLandMarks[] = $cont;
     }
 }
예제 #16
0
 public function serial(MemStream $s)
 {
     $s->serial_string($this->Name);
     $s->serial_string($this->ContinentName);
     $s->serial_string($this->BitmapName);
     $s->serial_float($this->MinX);
     $s->serial_float($this->MinY);
     $s->serial_float($this->MaxX);
     $s->serial_float($this->MaxY);
     $this->Children = array();
     $s->serial_uint32($nbChilds);
     for ($j = 0; $j < $nbChilds; $j++) {
         $child = new SMapChild();
         $child->serial($s);
         $this->Children[] = $child;
     }
 }
예제 #17
0
 public function serial(MemStream $s)
 {
     $s->serial_uint32($this->OBType);
     $s->serial_uint32($this->CostDapper);
     $s->serial_uint32($this->CostTime);
     $s->serial_uint32($this->MPLevelOfHighestExtractRate);
     $s->serial_uint32($nbItems);
     $s->serial_uint32($this->Mps, $nbItems);
     $s->serial_string($this->Icon, 4);
 }
예제 #18
0
 public function serial(MemStream $s)
 {
     $s->serial_uint32($this->Skill);
     $s->serial_string($this->SkillCode);
     $s->serial_short($this->MaxSkillValue);
     $s->serial_short($this->StageType);
     $s->serial_uint32($this->ParentSkill);
     $s->serial_short($nbChildSkills);
     $s->serial_uint32($this->ChildSkills, $nbChildSkills);
 }
예제 #19
0
 public function serial(MemStream $s)
 {
     $s->serial_string($this->Name);
     $this->ContLocs = array();
     $s->serial_uint32($nbItems);
     for ($i = 0; $i < $nbItems; $i++) {
         $cont = new SContLoc();
         $cont->serial($s);
         $this->ContLocs[] = $cont;
     }
     $this->Maps = array();
     $s->serial_uint32($nbItems);
     for ($i = 0; $i < $nbItems; $i++) {
         $map = new SMap();
         $map->serial($s);
         $this->Maps[] = $map;
     }
 }
예제 #20
0
 public function serial(MemStream $s)
 {
     $s->serial_string($this->SelectionName);
     $s->serial_string($this->ContinentName);
     $s->serial_float($this->MinX);
     $s->serial_float($this->MinY);
     $s->serial_float($this->MaxX);
     $s->serial_float($this->MaxY);
 }
예제 #21
0
 public function serial(MemStream $s)
 {
     $s->serial_uint32($this->ItemBuilt);
     $this->ItemPartMps = array();
     $s->serial_uint32($nbItems);
     for ($nb = 0; $nb < $nbItems; $nb++) {
         $row = new CItemPartMps();
         $row->serial($s);
         $this->ItemPartMps[] = $row;
     }
     $this->FormulaMps = array();
     $s->serial_uint32($nbItems);
     for ($nb = 0; $nb < $nbItems; $nb++) {
         $row = new CFormulaMps();
         $row->serial($s);
         $this->FormulaMps[] = $row;
     }
     $s->serial_uint32($this->ToolType);
     $s->serial_uint32($this->NbItemBuilt);
 }
예제 #22
0
 /**
  * Parse 'visual_slot.tab' file and build map entries
  *
  * @param MemStream $f
  *
  * @throws \RuntimeException
  */
 public function serial(MemStream $f)
 {
     $f->serial_uint32($nbSlots);
     for ($slot = 0; $slot < $nbSlots; $slot++) {
         $f->serial_uint32($nbEntries);
         for ($i = 0; $i < $nbEntries; $i++) {
             $f->serial_uint32($index);
             $f->serial_uint32($sheet);
             // sanity check
             if (isset($this->indexMap[$slot][$index])) {
                 throw new \RuntimeException("FATAL: duplicate visual slot ({$slot}) index ({$index}), sheetid ({$sheet})");
             } elseif (isset($this->sheetMap[$slot][$sheet])) {
                 throw new \RuntimeException("FATAL: duplicate sheet_id ({$sheet}), visual slot ({$slot}), index ({$index})");
             }
             // remember both mappings
             $this->indexMap[$slot][$index] = $sheet;
             $this->sheetMap[$slot][$sheet] = $index;
         }
     }
 }
예제 #23
0
 /**
  * Waits message from server
  *
  * @param StreamInterface $message
  *
  * @return bool
  * @throws \RuntimeException
  */
 public function waitMessage(StreamInterface $message)
 {
     // packet format
     // <int32>   packet length (length itself is not counted)
     // <byte>[5] ignore
     // <.....> message
     $buffer = $this->sock->read(4);
     $s = new MemStream($buffer);
     $s->serial_uint32_n($size);
     $buffer = $this->sock->read($size);
     $len = strlen($buffer);
     if ($size != $len) {
         throw new \RuntimeException("Partial packet received (got {$len}, expected {$size})");
     }
     // discard 5 first bytes
     // <uint32> 'zeroValue=123'
     // <byte>   TFormat (bitfield)
     $buffer = substr($buffer, 5);
     $message->serial(new MemStream($buffer));
 }
예제 #24
0
 public function serial(MemStream $s)
 {
     $s->serial_uint32($nbItems);
     $s->serial_uint32($this->Bricks, $nbItems);
     $s->serial_byte($this->Castable);
     $s->serial_byte($this->ShowInActionProgression);
     $s->serial_byte($this->ShowInAPOnlyIfLearnt);
 }
예제 #25
0
 /**
  * {@inheritdoc}
  */
 public function serial(MemStream $s)
 {
     // string with <uint32> length counter
     $s->serial_string($this->name);
     if ($s->isReading()) {
         // read all remaining bytes from buffer
         $length = $s->getSize() - $s->getPos();
     } else {
         $length = strlen($this->payload);
     }
     $s->serial_buffer($this->payload, $length);
 }
예제 #26
0
 public function serial(MemStream $s)
 {
     $s->serial_uint32($this->WeaponType);
     $s->serial_uint32($this->Skill);
     $s->serial_uint32($this->RangeWeaponType);
 }
예제 #27
0
 public function serial(MemStream $s)
 {
     $s->serial_uint32($this->Type);
 }
예제 #28
0
 public function serial(MemStream $s)
 {
     $s->serial_uint32($this->Skill);
     $s->serial_uint32($this->Value);
 }
예제 #29
0
 public function serial(MemStream $s)
 {
     $s->serial_uint32($this->MoneyCost);
     $s->serial_uint32($this->XpCost);
 }
예제 #30
0
 /**
  * Read header from bnp file
  */
 private function initialize()
 {
     if ($this->header !== false) {
         return;
     }
     $this->bnp = fopen($this->filename, 'r');
     $stats = fstat($this->bnp);
     $size = $stats['size'];
     $s = new MemStream();
     // read last <int> to get position for FAT block
     fseek($this->bnp, $size - 4);
     $buf = fread($this->bnp, 4);
     $s->setBuffer($buf);
     $s->serial_uint32($pos);
     // now read FAT block
     fseek($this->bnp, $pos);
     $fat = fread($this->bnp, $size - $pos);
     $s->setBuffer($fat);
     $s->serial_uint32($nbFiles);
     $this->header = array();
     for ($i = 0; $i < $nbFiles; $i++) {
         $s->serial_byte_string($name);
         $s->serial_uint32($size);
         $s->serial_uint32($start);
         $this->header[$name] = array('size' => $size, 'start' => $start);
     }
     $this->headerCount = count($this->header);
     $this->headerFiles = array_keys($this->header);
     $this->headerPosition = 0;
 }