Exemple #1
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);
 }
Exemple #2
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);
 }
Exemple #3
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);
 }
Exemple #4
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);
 }
Exemple #5
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);
 }
Exemple #6
0
 /**
  * @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);
 }
Exemple #7
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;
     }
 }
 public function serial(MemStream $s)
 {
     // CGenderInfo
     $gi = function (&$var) use($s) {
         $var = new \stdClass();
         $nbItems = 7;
         $s->serial_string($var->Items, $nbItems);
         $s->serial_string($var->Skelfilename);
         $s->serial_string($var->AnimSetBaseName);
         $s->serial_string($var->LodCharacterName);
         $s->serial_float($var->LodCharacterDistance);
         $s->serial_float($var->CharacterScalePos);
         $var->GroundFX = array();
         $s->serial_uint32($nbItems);
         for ($nb = 0; $nb < $nbItems; $nb++) {
             $row = new \stdClass();
             $s->serial_uint32($row->GroundID);
             $s->Serial_string($row->FXName);
             $var->GroundFX[] = $row;
         }
         for ($nb = 0; $nb < 8; $nb++) {
             $s->serial_float($var->BlendShapeMin[$nb]);
             $s->serial_float($var->BlendShapeMax[$nb]);
         }
         $s->serial_float($var->NamePosZLow);
         $s->serial_float($var->NamePosZNormal);
         $s->serial_float($var->NamePosZHigh);
     };
     $numCharacteristice = 8;
     $s->serial_byte($this->CharacStartValue, 8);
     $gi($this->GenderInfos[0]);
     $gi($this->GenderInfos[1]);
     $s->serial_byte($this->People);
     $s->serial_byte($this->Skin);
     $s->serial_string($this->Automaton);
     $this->BodyToBone = new \stdClass();
     $s->serial_string($this->BodyToBone->Head);
     $s->serial_string($this->BodyToBone->Chest);
     $s->serial_string($this->BodyToBone->LeftArm);
     $s->serial_string($this->BodyToBone->RightArm);
     $s->serial_string($this->BodyToBone->LeftHand);
     $s->serial_string($this->BodyToBone->RightHand);
     $s->serial_string($this->BodyToBone->LeftLeg);
     $s->serial_string($this->BodyToBone->RightLeg);
     $s->serial_string($this->BodyToBone->LeftFoot);
     $s->serial_string($this->BodyToBone->RightFoot);
     $s->serial_uint32($nbItems);
     $s->serial_int_string($this->AttackLists, $nbItems);
 }
Exemple #9
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);
 }
 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;
 }
Exemple #11
0
 protected function readHeader(MemStream $s)
 {
     // check header
     $s->serial_buffer($hskp, 4);
     if ($hskp !== self::HEADER) {
         throw new \RuntimeException('Wrong packed sheets header, expected "' . self::HEADER . '"');
     }
     $s->serial_uint32($header_version);
     if ($header_version != self::HEADER_VERSION) {
         throw new \RuntimeException('Wrong packed sheets version, expected "' . self::HEADER_VERSION . '", got "' . $header_version . '"');
     }
     $s->serial_byte($this->compat);
     $s->serial_uint32($dependBlockSize);
     if ($this->skipDependBlock) {
         // skip dependency block
         $pos = $s->getPos();
         $s->seek($pos + $dependBlockSize);
     } else {
         // read dictionary
         $s->serial_uint32($nb);
         $s->serial_int_string($this->dictionnary, $nb);
         // read dependency data
         $this->dependencies = array();
         $s->serial_uint32($depSize);
         for ($i = 0; $i < $depSize; $i++) {
             $s->serial_uint32($sheetId);
             $s->serial_uint32($nb);
             $s->serial_uint32($this->dependencies[$sheetId], $nb);
         }
     }
 }
 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;
     }
 }
Exemple #13
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);
 }
Exemple #14
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);
 }
Exemple #15
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;
     }
 }
 /**
  * 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;
         }
     }
 }
Exemple #17
0
 public function serial(MemStream $s)
 {
     $s->serial_uint32($nbItems);
     $s->serial_uint32($this->UsedSkills, $nbItems);
     $s->serial_uint32($this->BrickFamily);
     $s->serial_byte($this->IndexInFamily);
     $s->serial_byte($this->Level);
     $s->serial_string($this->sTmp);
     $s->serial_string($this->Icon, 4);
     $s->serial_sint32($this->IconColor, 4);
     $s->serial_sint32($this->SabrinaCost);
     $s->serial_float($this->SabrinaRelativeCost);
     $s->serial_uint32($nbItems);
     $s->serial_short($this->MandatoryFamilies, $nbItems);
     $s->serial_uint32($nbItems);
     $s->serial_short($this->OptionalFamilies, $nbItems);
     $s->serial_uint32($nbItems);
     $s->serial_short($this->ParameterFamilies, $nbItems);
     $s->serial_uint32($nbItems);
     $s->serial_short($this->CreditFamilies, $nbItems);
     $s->serial_string($this->ForbiddenDef);
     $s->serial_string($this->ForbiddenExclude);
     $this->FaberPlan = new CFaberPlan();
     $this->FaberPlan->serial($s);
     $this->Properties = array();
     $s->serial_uint32($nbItems);
     for ($nb = 0; $nb < $nbItems; $nb++) {
         $row = new \stdClass();
         $s->serial_string($row->Text);
         $this->Properties[] = $row;
     }
     $s->serial_byte($this->MinCastTime);
     $s->serial_byte($this->MaxCastTime);
     $s->serial_byte($this->MinRange);
     $s->serial_byte($this->MaxRange);
     $s->serial_uint64($this->BrickRequiredFlags);
     $s->serial_uint32($this->SPCost);
     $s->serial_uint32($this->ActionNature);
     $this->RequiredSkills = array();
     $s->serial_uint32($nbItems);
     for ($nb = 0; $nb < $nbItems; $nb++) {
         $row = new CRequiredSkill();
         $row->serial($s);
         $this->RequiredSkills[] = $row;
     }
     $s->serial_uint32($nbItems);
     $s->serial_uint32($this->RequiredBricks, $nbItems);
     $s->serial_byte($this->AvoidCyclic);
     $s->serial_byte($this->UsableWithEmptyHands);
     $s->serial_uint32($this->CivRestriction);
     $s->serial_sint32($this->FactionIndex);
     $s->serial_sint32($this->MinFameValue);
     $s->serial_uint32($this->MagicResistType);
 }
 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);
 }
Exemple #19
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;
     }
 }
Exemple #20
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;
     }
 }
Exemple #21
0
 /**
  * Send message
  *
  * @param StreamInterface $message
  */
 public function sendMessage(StreamInterface $message)
 {
     // TFormat from <nel/message.h>
     $messageType = 0;
     // build packet
     // <int32> packet length (length itself is not counted)
     // <int32> packet number
     // <byte>  message type
     // <.....> message
     // first pass - to get packet length
     $hd = new MemStream();
     $hd->serial_uint32($this->msgNum);
     $hd->serial_byte($messageType);
     // include original message
     $message->serial($hd);
     $this->msgNum++;
     $buf = $hd->getBuffer();
     $len = strlen($buf);
     // second pass - final packet
     $hd = new MemStream();
     $hd->serial_uint32_n($len);
     $hd->serial_buffer($buf);
     $this->sock->write($hd->getBuffer());
 }
Exemple #22
0
 public function serial(MemStream $s)
 {
     $s->serial_uint32($this->Type);
 }
 public function serial(MemStream $s)
 {
     $s->serial_uint32($this->Skill);
     $s->serial_uint32($this->Value);
 }
Exemple #24
0
 public function serial(MemStream $s)
 {
     $s->serial_uint32($this->MoneyCost);
     $s->serial_uint32($this->XpCost);
 }
Exemple #25
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;
 }
Exemple #26
0
 public function serial(MemStream $s)
 {
     $s->serial_uint32($this->Skill);
     $s->serial_uint32($this->DamageType);
     $s->serial_uint32($this->Magazine);
 }
Exemple #27
0
 public function serial(MemStream $s)
 {
     $s->serial_uint32($this->WeaponType);
     $s->serial_uint32($this->Skill);
     $s->serial_uint32($this->RangeWeaponType);
 }
Exemple #28
0
 public function serial(MemStream $s)
 {
     $s->serial_uint32($this->FaberTypeFilter);
     $s->serial_uint32($this->Quantity);
 }
Exemple #29
0
 /**
  * @param MemStream $s
  */
 protected function serialInSceneBubbleInfo(MemStream $s)
 {
     $this->SceneBubbleInfo = array();
     $s->serial_uint32($nb);
     for ($i = 0; $i < $nb; $i++) {
         $s->serial_string($string);
         $this->SceneBubbleInfo[] = $string;
     }
 }
Exemple #30
0
 public function serial(MemStream $s)
 {
     $s->serial_uint32($this->VPValue);
     $s->serial_uint32($this->Gender);
 }