void XSpotPrivateRaid::Serialize( XArchive& ar ) { XBREAK( m_listEnterEnemy.empty() && GetspLegion() ); // 적군단 if( ar.IsForDB() ) { // db저장시에는 적군단 정보를 저장하지 않는다. 출전리스트가 있으므로. DestroyLegion(); } // XSpot::Serialize( ar ); // // 플레이어 군단 ar << m_legionDatPlayer; // 플레이어측 전체 출전영웅 ar << m_listEnterPlayer; if( !ar.IsForDB() ) { // 랜덤목록이므로 DB에 저장하지 않는다. // 적부대추가 출전인원 // 본 부대외에 추가 영웅들 리스트를 풀버전으로 보낸다. SerializeEnterEnemy( ar ); } else { ar << 0; } ar << (char)m_numWins; ar << (char)0; ar << (char)0; ar << (char)0; ar << m_secTimer; }
int XWorld::Serialize( XArchive& ar ) { int size = ar.size(); // int ver = VER_WORLD_SERIALIZE; ar << (BYTE)ver; // XBREAK( m_listSpots.size() == 0 ); XBREAK( m_listSpots.size() > 255 ); ar << (BYTE)m_listSpots.size(); // 최초 생성계정이면 스팟이 없을수도 있음. ar << (WORD)0; int idx = 0; for( XSpot *pSpot : m_listSpots ) { XBREAK( pSpot == nullptr ); int size2 = ar.size(); XSpot::sSerialize( ar, pSpot ); int sizeSpot = ar.size() - size2; int sizeWorld = ar.size() - size; #ifdef _GAME_SERVER XTRACE( "%s: %s bytes", pSpot->GetpBaseProp()->strIdentifier.c_str(), XE::NtS( sizeSpot ) ); #endif // _GAME_SERVER ++idx; } ar << m_secLastCalc; ar << m_listOpendArea; // 월드 아카이브의 크기를 리턴한다. return ar.size() - size; }
int XCampObjHero3::Serialize( XArchive& ar ) { XLOCK_OBJ; XCampObjBase::Serialize( ar ); int sizeOld = ar.size(); XBREAK( m_aryStages[0].size() > 0x7f ); XBREAK( m_idxLastUnlock > 0x7f ); //XBREAK( m_idxLastPlay > 0x7f ); const int numFloor = m_aryStages.size(); ar << (char)m_aryStages[0].size(); // 모든층은 스테이지 수가 똑같다고 가정. ar << (char)m_idxLastUnlock; ar << (char)numFloor; //m_idxLastPlay; ar << (char)m_cntTry; ar << m_timerOpen; for( auto& aryStages : m_aryStages ) { for( auto& spStageObj : aryStages ) { int size2 = ar.size(); XArchive arStage; arStage.SetbForDB( ar.IsForDB() ); spStageObj->Serialize( arStage ); ar << arStage; // 만약 스테이지가 사라지거나 해서 통째로 건너뛰려고 이렇게 함. int size22 = ar.size() - size2; // TRACE("%d", size22 ); } } int size = ar.size() - sizeOld; XBREAK( ar.IsForDB() && size >= 8000 ); ar << (short)m_idxFloorByOpen; ar << (short)0; return 1; }
int XCampObjCommon::sSerialize( XSPCampObjCommon& spCampObj, XArchive& ar ) { if( spCampObj == nullptr ) { ar << 0; return 1; } ar << (BYTE)VER_CAMP_SERIALIZE; ar << (BYTE)spCampObj->GetType(); ar << (BYTE)0; ar << (BYTE)0; ar << spCampObj->GetidProp(); XArchive arCamp; // 캠페인이 프로퍼티에서 없어질경우를 대비에 이렇게 함. 한꺼번에 건너뛰려고. arCamp.SetbForDB( ar.IsForDB() ); spCampObj->Serialize( arCamp ); ar << arCamp; return 1; }
int XAccount::DeSerialize( XArchive& ar ) { XDBAccount::DeSerialize( ar ); CONSOLE("Deserialize:idAcc=%d", GetidAccount()); TCHAR szBuff[1024]; // ar >> m_Ver; ar.ReadString( szBuff ); m_strID = szBuff; ar.ReadString( szBuff ); m_strPassword = szBuff; ar.ReadString( szBuff ); m_strName = szBuff; ar.ReadString( szBuff ); m_strUUID = szBuff; ar.ReadString( szBuff ); m_StrSessionKey = szBuff; ar >> m_CurrSN; // m_Level.DeSerialize( ar ); return 1; }
void XSpot::Serialize( XArchive& ar ) { ar << (BYTE)m_typeSpot; XBREAK( m_Level > 255 ); ar << (BYTE)m_Level; XBREAK( m_Score > 0xffff ); ar << (WORD)m_Score; ar << m_snSpot; m_timerSpawn.Serialize( ar ); ar << (BYTE)xboolToByte(m_bDestroy); ar << (BYTE)(*((BYTE*)(&m_bitFlag))); XBREAK( GetpBaseProp()->idSpot > 0xffff ); ar << (WORD)GetpBaseProp()->idSpot; XBREAK( m_aryDropItems.size() > 10 ); ar << m_aryDropItems; ar << m_Power; int num = 0; for( auto loot : m_aryLoots ) if( loot != 0 ) ++num; XBREAK( m_numLose > 0xff ); XBREAK( m_Difficult <= -128 || m_Difficult >= 128 ); ar << (BYTE)m_numLose; ar << (char)m_Difficult; ar << (BYTE)0; ar << (BYTE)num; XBREAK( m_aryLoots.size() > XGAME::xRES_MAX ); int idx = 0; for( auto loot : m_aryLoots ) { if( loot != 0 ) { ar << idx; ar << loot; } ++idx; } int size = 0; // 패킷 최적화 대상. 군단정보는 꼭 필요할때만 보내도록 최적화 해야함. if( m_spLegion != nullptr && ar.IsForDB() == false ) { int sizeOld = ar.size(); m_spLegion->SerializeFull( ar ); size = ar.size() - sizeOld; XTRACE("size legion=%d", size ); } else ar << 0; }
int XCampObjCommon::Serialize( XArchive& ar ) { XLOCK_OBJ; XCampObjBase::Serialize( ar ); int sizeOld = ar.size(); // strIdentifier는 용량때문에 생략하고 idProp으로 대체 // ar << VER_CAMP_SERIALIZE; // if( XBREAK( m_pProp == nullptr ) ) // return 0; // ar << m_pProp->idProp; // ar << m_snCampaign; XBREAK( m_aryStages[0].size() > 0x7f ); XBREAK( m_idxLastUnlock > 0x7f ); //XBREAK( m_idxLastPlay > 0x7f ); ar << (char)m_aryStages[0].size(); // 모든층은 스테이지 수가 똑같다고 가정. ar << (char)m_idxLastUnlock; ar << (char)0; //m_idxLastPlay; ar << (char)m_cntTry; ar << m_idAccTrying; ar << m_strTryer; ar << m_timerEnter; ar << m_timerOpen; XBREAK( m_Grade > 0x7f ); ar << (char)m_Grade; ar << (char)0; ar << (char)0; const int numFloor = m_aryStages.size(); ar << (char)numFloor; for( auto& aryStages : m_aryStages ) { for( auto& spStageObj : aryStages ) { int size2 = ar.size(); XArchive arStage; arStage.SetbForDB( ar.IsForDB() ); spStageObj->Serialize( arStage ); ar << arStage; // 만약 스테이지가 사라지거나 해서 통째로 건너뛰려고 이렇게 함. int size22 = ar.size() - size2; // TRACE("%d", size22 ); } } int size = ar.size() - sizeOld; XBREAK( ar.IsForDB() && size >= 8000 ); return 1; }
/** @brief 영웅캠페인은 스테이지가 많으므로 이걸 전부 DB에 저장할필요는 없다. */ int XStageObjHero2::Serialize( XArchive& ar ) { XLOCK_OBJ; ar << (char)GetnumClear(); ar << (char)GetnumStar(); ar << (short)0; if( ar.IsForDB() ) { // DB저장시엔 모든정보를 저장할필요는 없다. ar << (int)0; } else { ar << m_idHero; ar << GetPower(); ar << (char)GetLevelLegion(); ar << (char)0; ar << (short)0; } return 1; }
void XGameCommon::ArchivingProp( XArchive& ar ) { int sizeMax = 0; ar << _DEV_LEVEL; { XArchive arProp; XGlobalConst::sGet()->Serialize( arProp ); const int sizeComp = arProp.DoCompress(); sizeMax += sizeComp; XTRACE( "globalxml:%d, ", sizeComp ); ar << arProp; } { XArchive arProp; CONSTANT->Serialize( arProp ); XArchive arGlobal; XGlobalConst::sGet()->Serialize( arGlobal ); const int sizeComp = arProp.DoCompress(); sizeMax += sizeComp; XTRACE( "XConstant:%d, ", sizeComp ); ar << arProp; } { XArchive arProp; PROP_UNIT->Serialize( arProp ); const int sizeComp = arProp.DoCompress(); sizeMax += sizeComp; XTRACE("propUnit:%d, ", sizeComp); ar << arProp; } { XArchive arProp; PROP_HERO->Serialize( arProp ); const int sizeComp = arProp.DoCompress(); sizeMax += sizeComp; XTRACE("propHero: %d, ", sizeComp); ar << arProp; } { XArchive arProp; PROP_ITEM->Serialize( arProp ); const int sizeComp = arProp.DoCompress(); sizeMax += sizeComp; XTRACE("propitem: %d, ", sizeComp); ar << arProp; } { XArchive arProp; XPropLegion::sGet()->Serialize( arProp ); const int sizeComp = arProp.DoCompress(); sizeMax += sizeComp; XTRACE("propLegion: %d, ", sizeComp); ar << arProp; } { XArchive arProp; PROP_WORLD->Serialize( arProp ); const int sizeComp = arProp.DoCompress(); sizeMax += sizeComp; XTRACE("propworld: %d, ", sizeComp); ar << arProp; } { XArchive arProp; PROP_CLOUD->Serialize( arProp ); const int sizeComp = arProp.DoCompress(); sizeMax += sizeComp; XTRACE("propCloud: %d, ", sizeComp); ar << arProp; } #if defined(_CLIENT) || defined(_GAME_SERVER) { XArchive arProp; SKILL_MNG->Serialize( arProp ); const int sizeComp = arProp.DoCompress(); sizeMax += sizeComp; XTRACE( "propSkill: %d, ", sizeComp ); ar << arProp; } { XArchive arProp; XPropTech::sGet()->Serialize( arProp ); const int sizeComp = arProp.DoCompress(); sizeMax += sizeComp; XTRACE( "propTech: %d, ", sizeComp ); ar << arProp; } { XArchive arProp; XPropUpgrade::sGet()->Serialize( arProp ); const int sizeComp = arProp.DoCompress(); sizeMax += sizeComp; XTRACE( "propUpgrade: %d, ", sizeComp ); ar << arProp; } #endif { XArchive arProp; PROP_SQUAD->Serialize( arProp ); const int sizeComp = arProp.DoCompress(); sizeMax += sizeComp; XTRACE( "propSquad: %d, ", sizeComp ); ar << arProp; } { XArchive arProp; XPropCamp::sGet()->Serialize( arProp ); const int sizeComp = arProp.DoCompress(); sizeMax += sizeComp; XTRACE( "propCamp: %d, ", sizeComp ); ar << arProp; } { XArchive arProp; XQuestProp::sGet()->Serialize( arProp ); const int sizeComp = arProp.DoCompress(); sizeMax += sizeComp; XTRACE( "propQuest: %d, ", sizeComp ); ar << arProp; } { XArchive arProp; XPropHelp::sGet()->Serialize( arProp ); const int sizeComp = arProp.DoCompress(); sizeMax += sizeComp; XTRACE( "propHelp: %d, ", sizeComp ); ar << arProp; } XTRACE("sizeMax=%d", sizeMax); }