Exemple #1
0
 public function Decode(CodeEngine &$buf)
 {
     $len = $buf->DecodeInt16();
     $len -= 2;
     $this->GameID = $buf->DecodeInt16();
     $len -= 2;
     $this->Level = $buf->DecodeInt8();
     $len -= 1;
     $this->Point = $buf->DecodeInt32();
     $len -= 4;
     $this->WinRound = $buf->DecodeInt32();
     $len -= 4;
     $this->LoseRound = $buf->DecodeInt32();
     $len -= 4;
     $this->DrawRound = $buf->DecodeInt32();
     $len -= 4;
     $this->EscapeRound = $buf->DecodeInt32();
     $len -= 4;
     $this->OrgID = $buf->DecodeInt32();
     $len -= 4;
     $this->Position = $buf->DecodeInt16();
     $len -= 2;
     $this->TotalSecs = $buf->DecodeInt32();
     $len -= 4;
     $this->LastDate = $buf->DecodeString();
     $len -= strlen($this->LastDate);
     $this->ExtGameInfo = new TDBExtGameInfo();
     $this->ExtGameInfo->Decode($buf);
     $this->GameConfig = new PlayerGameConfig();
     $this->GameConfig->Decode($buf);
     return $len;
 }
Exemple #2
0
 public function Decode(CodeEngine &$buf, &$BecomeVIPTime = null)
 {
     $outlength = 0;
     $len = $buf->DecodeInt16();
     $outlength += 2;
     $this->setGameVipExpireTime($buf->DecodeInt32());
     $outlength += 4;
     $this->setGameVIPScore($buf->DecodeInt32());
     $outlength += 4;
     $this->setGameVIPLevel($buf->DecodeInt32());
     $outlength += 4;
     $this->setNextUpdateVIPLevelTime($buf->DecodeInt32());
     $outlength += 4;
     $this->setVIPTips($buf->DecodeString());
     $outlength += strlen($this->VIPTips) + 2;
     $this->setGameVIPType($buf->DecodeInt32());
     $outlength += 4;
     if (!is_null($BecomeVIPTime)) {
         $BecomeVIPTime = $buf->DecodeInt32();
         $outlength += 4;
     }
     $vipsize = $len - $outlength;
     if ($vipsize > 0) {
         $buf->DecodeMemory($vipsize);
     }
     return $len;
 }
Exemple #3
0
 public function Decode(CodeEngine &$buf)
 {
     $len = 0;
     $PlayStatusSize = $buf->DecodeInt16();
     $len += 2;
     $this->Uin = $buf->DecodeInt32();
     $len += 4;
     $PlayStatusSize -= 4;
     $this->Account = $buf->DecodeString();
     //lsybegin
     //字符串前头自带2字节长度前缀,在字符数据之外
     $len += 2;
     $PlayStatusSize -= 2;
     //lsyend
     $len += strlen($this->Account);
     $PlayStatusSize -= strlen($this->Account);
     $this->ClassCount = $buf->DecodeInt8();
     $len += 1;
     $PlayStatusSize -= 1;
     if ($this->ClassCount > StateClass::MAX_CLASS_COUNT) {
         $this->ClassCount = StateClass::MAX_CLASS_COUNT;
     }
     $this->StateData = array();
     for ($i = 0; $i < $this->ClassCount; $i++) {
         $temp = new StateData();
         $r = $temp->Decode($buf);
         $len += $r;
         $PlayStatusSize -= $r;
         $this->StateData[] = $temp;
     }
     if ($PlayStatusSize < 0) {
         return 0;
     } else {
         $len += $PlayStatusSize;
         $buf->DecodeMemory($PlayStatusSize);
     }
     return $len;
 }
Exemple #4
0
 public function Decode(CodeEngine &$buf)
 {
     $len = 0;
     $StatusSize = $buf->DecodeInt16();
     $len += 2;
     $this->GameID = $buf->DecodeInt16();
     $len += 2;
     $StatusSize -= 2;
     $this->ServerID = $buf->DecodeInt32();
     $len += 4;
     $StatusSize -= 4;
     $this->RoomID = $buf->DecodeInt32();
     $len += 4;
     $StatusSize -= 4;
     $this->TableID = $buf->DecodeInt32();
     $len += 4;
     $StatusSize -= 4;
     $this->SeatID = $buf->DecodeInt8();
     $len += 1;
     $StatusSize -= 1;
     $this->State = $buf->DecodeInt8();
     $len += 1;
     $StatusSize -= 1;
     $this->Path = $buf->DecodeString();
     $StatusSize -= 2;
     $len += 2;
     $len += strlen($this->Path);
     $StatusSize -= strlen($this->Path);
     if ($StatusSize < 0) {
         return 0;
     } else {
         $buf->DecodeMemory($StatusSize);
         $len += $StatusSize;
     }
     return $len;
 }
Exemple #5
0
 public function Decode(CodeEngine &$buf)
 {
     $this->DataType = $buf->DecodeInt8();
     $this->DataValue = new DataValue();
     switch ($this->DataType) {
         case PlayCommandDataType::PCD_Charming:
             $this->DataValue->Charming = $buf->DecodeInt32();
             break;
         case PlayCommandDataType::PCD_Achievement:
             $this->DataValue->Achievement = $buf->DecodeInt32();
             break;
         case PlayCommandDataType::PCD_PunishMethod:
             $this->DataValue->Punish->ValidDate = $buf->DecodeString();
             $this->DataValue->Punish->BlackLevel = $buf->DecodeInt8();
             $this->DataValue->Punish->PunishMethod = $buf->DecodeInt16();
             $this->DataValue->Punish->DescString = $buf->DecodeString();
             break;
         case PlayCommandDataType::PCD_OtherData:
             $this->DataValue->OtherData->OtherDataIndex = $buf->DecodeInt8();
             $this->DataValue->OtherData->UpdateMode = $buf->DecodeInt8();
             $this->DataValue->OtherData->OtherDataValue = $buf->DecodeInt8();
             break;
         case PlayCommandDataType::PCD_LoginCount:
             $this->DataValue->LoginCount = $buf->DecodeInt32();
             break;
         case PlayCommandDataType::PCD_LastLoginTime:
             $this->DataValue->LastLoginTime = $buf->DecodeInt32();
             break;
         case PlayCommandDataType::PCD_LastLoginIP:
             $this->DataValue->LastLoginIP = $buf->DecodeInt32();
             break;
         case PlayCommandDataType::PCD_WebQunData:
             $this->DataValue->WebQunData->DataSize = $buf->DecodeInt32();
             $this->DataValue->WebQunData->WebQunInfo = $buf->DecodeMemory($this->DataValue->WebQunData->DataSize);
             break;
         case PlayCommandDataType::PCD_VipData:
             $this->DataValue->VipData = new VipData();
             $this->DataValue->VipData = $this->DataValue->VipData->Decode($buf);
             break;
         case PlayCommandDataType::PCD_IdCard:
             $this->DataValue->IDCard = $buf->DecodeString();
             break;
         case PlayCommandDataType::PCD_Sex:
             $this->DataValue->Sex = $buf->DecodeInt8();
             break;
         case PlayCommandDataType::PCD_Birthday:
             $this->DataValue->BirThday = new Birthday();
             $this->DataValue->BirThday->Year = $buf->DecodeInt16();
             $this->DataValue->BirThday->Month = $buf->DecodeInt16();
             $this->DataValue->BirThday->Day = $buf->DecodeInt16();
             break;
         default:
             break;
     }
     return $this;
 }
Exemple #6
0
 public function Decode(CodeEngine &$buf)
 {
     $playercommonSize = 0;
     $outlength = 0;
     $len = $buf->DecodeInt16();
     $outlength += 2;
     $this->setCoin($buf->DecodeInt32());
     $outlength += 4;
     $this->setLoginCount($buf->DecodeInt32());
     $outlength += 4;
     $this->setOfflineCount($buf->DecodeInt32());
     $outlength += 4;
     $this->setCharming($buf->DecodeInt32());
     $outlength += 4;
     $this->setAchievement($buf->DecodeInt32());
     $outlength += 4;
     $this->setHappyBean($buf->DecodeInt64());
     $outlength += 8;
     $this->setBlackLevel($buf->DecodeInt32());
     $outlength += 4;
     $this->setValidDate($buf->DecodeString());
     $outlength += strlen($this->ValidDate) + 2;
     $this->setPunishMethod($buf->DecodeInt32());
     $outlength += 4;
     $this->setLastLoginDate($buf->DecodeString());
     $outlength += strlen($this->LastLoginDate) + 2;
     $this->setLastLoginIP($buf->DecodeInt32());
     $outlength += 4;
     $this->setDescString($buf->DecodeString());
     $outlength += strlen($this->DescString) + 2;
     $this->setLastConsumeDate($buf->DecodeString());
     $outlength += strlen($this->LastConsumeDate) + 2;
     $this->setMiscFlag($buf->DecodeInt32());
     $outlength += 4;
     $this->setHappyBeanDailyPresentedCount($buf->DecodeInt32());
     $outlength += 4;
     $this->setHappyBeanDailyLastPresentedTime($buf->DecodeInt32());
     $outlength += 4;
     $t = new WebQunData();
     $t->DataSize = $buf->DecodeInt16();
     $outlength += 2;
     $t->WebQunInfo = $buf->DecodeMemory($t->DataSize);
     $outlength += $t->DataSize;
     $this->setWebQunData($t);
     # 如何获取Others的长度
     # 卡住了 貌似有逻辑问题
     $this->Others = array();
     for ($i = 0; $i < player_data_other_count; $i++) {
         $this->Others[] = $buf->DecodeInt32();
     }
     $outlength += player_data_other_count * 4;
     $this->FirstLoginDatetime = $buf->DecodeInt32();
     $outlength += 4;
     $tt = new VipData();
     $r = $tt->Decode($buf);
     $this->setVipData($tt);
     $outlength += $r;
     $this->setIDCard($buf->DecodeString());
     $outlength += strlen($this->IDCard) + 2;
     $this->setSex($buf->DecodeInt8());
     $outlength += 1;
     $ttt = new Birthday();
     $ttt->setYear($buf->DecodeInt16());
     $outlength += 2;
     $ttt->setMonth($buf->DecodeInt16());
     $outlength += 2;
     $ttt->setDay($buf->DecodeInt16());
     $outlength += 2;
     $this->setBirThday($ttt);
     $playercommonSize = $len - $outlength;
     if ($playercommonSize > 0) {
         $buf->DecodeMemory($playercommonSize);
     }
     return $len;
 }