public function Decode(CodeEngine &$buf) { $len = $buf->DecodeInt16(); $len -= 2; $this->setBitMap($buf->DecodeInt32()); $len -= 4; $this->setMinPoint($buf->DecodeInt32()); $len -= 4; $this->setMaxPointGap($buf->DecodeInt32()); $len -= 4; $this->setMaxOfflineRate($buf->DecodeInt8()); $len -= 1; $this->setIPBit($buf->DecodeInt8()); $len -= 1; $this->setOtherSize($buf->DecodeInt8()); $len -= 1; if ($this->OtherSize > max_game_other_data_count) { $this->OtherSize = max_game_other_data_count; } $t = array(); for ($i = 0; $i < $this->getOtherSize(); $i++) { $t[] = $buf->DecodeInt32(); $len -= 4; } $this->setOthers($t); if ($len < 0) { return 0; } else { $buf->DecodeMemory($len); } return $len; }
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; }
public function decode_item_info2(CodeEngine &$buf) { $ItemSize = $buf->DecodeInt16(); $len = 0; $this->setItemID($buf->DecodeInt32()); $len += 4; $ItemSize -= 4; $this->setCount($buf->DecodeInt32()); $len += 4; $ItemSize -= 4; $this->setExpiredTime($buf->DecodeInt32()); $len += 4; $ItemSize -= 4; if ($ItemSize < 0) { return 0; } else { $buf->DecodeMemory($ItemSize); } return $len; }
public function Decode(CodeEngine &$buf) { # 未完善 # 不完善的地方是ExtInt这个地方,C++默认已经使用了max_game_ext_int_count的数值 $len = $buf->DecodeInt16(); $len -= 2; for ($i = 0; $i < 128 && $len > 0; $i++) { $this->ExtInt[] = $buf->DecodeInt32(); $len -= 4; } if ($len < 0) { return 0; } $this->ExtDataSize = $buf->DecodeInt16(); $len -= 2; if ($this->ExtDataSize > 0) { $this->ExtData = $buf->DecodeMemory($this->ExtDataSize); $len -= $this->ExtDataSize; } return $len; }
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; }
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; }
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; }