BOOL DBGuildExtraInfo::Load() { __ENTER_FUNCTION LONG_DB_QUERY* pQuery = GetLongInterQuery(); if(!pQuery) { Assert(FALSE); } pQuery->Clear(); if(m_GuildID==INVALID_ID) { return FALSE; } pQuery->Parse(LoadWorldGuildExtraInfo,GUILD_TABLE,m_GuildID); return ODBCBase::LongLoad(); __LEAVE_FUNCTION return FALSE; }
BOOL DBCrcInfo::Save(VOID* pSource) { __ENTER_FUNCTION FULLUSERDATA* pCharFullData = static_cast<FULLUSERDATA*>(pSource); Assert(pCharFullData); //保存CRC校验数据 do { //FullData CHAR FullDataInfo[102400]; memset(FullDataInfo,0,102400); Binary2String((CHAR*)(pCharFullData), sizeof(FULLUSERDATA), FullDataInfo); //LogoutTime UINT nLogoutTime = pCharFullData->m_Human.m_LastLogoutTime; //Prepare Query LONG_DB_QUERY* pQuery = GetLongInterQuery(); if(!pQuery) { Assert(FALSE); } pQuery->Clear(); if(m_CharGuid == INVALID_ID) { return FALSE; } //Parse Query pQuery->Parse(SaveCrcInfo, CRC32_TABLE, m_CharGuid, nLogoutTime, m_Crc32, FullDataInfo, 1, m_ServerId); //Execute Query if(!ODBCBase::LongSave(pCharFullData)) return FALSE; }while(0); return TRUE; __LEAVE_FUNCTION return FALSE; }
BOOL DBPetItemInfo::Load() { __ENTER_FUNCTION LONG_DB_QUERY* pQuery = GetLongInterQuery(); if(!pQuery) { Assert(FALSE); } pQuery->Clear(); pQuery->Parse(LoadPetItemInfo,PETITEM_TABLE); return ODBCBase::LongLoad(); __LEAVE_FUNCTION return FALSE; }
BOOL DBGuildExtraInfo::Save(VOID* pSource) { __ENTER_FUNCTION INT Result; enum { DB_GuildID = 1, DB_GuildExtraInfo, }; GUILD_USER_EXTRA_DATA_DB_t* pGuildExtraInfo = static_cast<GUILD_USER_EXTRA_DATA_DB_t*>(pSource); Assert(pGuildExtraInfo); //±£´æExtraInfoÊý¾Ý do { CHAR GuildExtraInfo[MAX_LONG_COLUMN_BUFFER] = {0}; Binary2String((CHAR*)(pGuildExtraInfo), sizeof(GUILD_USER_EXTRA_DATA_DB_t)*USER_ARRAY_SIZE, GuildExtraInfo); LONG_DB_QUERY* pQuery = GetLongInterQuery(); if(!pQuery) { Assert(FALSE); } pQuery->Clear(); pQuery->Parse(SaveWorldGuildExtraInfo,GUILD_TABLE,GuildExtraInfo,m_GuildID); if(!ODBCBase::LongSave(&Result)) return FALSE; }while(0); return TRUE; __LEAVE_FUNCTION return FALSE; }
BOOL DBCrcInfo::Load() { __ENTER_FUNCTION LONG_DB_QUERY* pQuery = GetLongInterQuery(); if(!pQuery) { Assert(FALSE); } pQuery->Clear(); if(m_aid==INVALID_ID) { return FALSE; } pQuery->Parse(LoadCrcInfo,CRC32_TABLE,m_aid); return ODBCBase::LongLoad(); __LEAVE_FUNCTION return FALSE; }
BOOL DBPetItemInfo::Save(VOID* pSource) { __ENTER_FUNCTION enum { DB_PetPairData = 1, }; INT Result; SMUPool<PetProcreateItemSM>* pPoolPtr = static_cast<SMUPool<PetProcreateItemSM>*>(pSource); Assert(pPoolPtr); PetProcreateItem PetProItem; do { INT SmuCount = pPoolPtr->GetPoolMaxSize(); if(SmuCount>MAX_PET_PROCREATE_ITEM_NUM) Assert(FALSE); INT UseStats; for(INT i = 0 ;i<SmuCount;i++) { PetProcreateItemSM* pSMU = pPoolPtr->GetPoolObj(i); if(!pSMU) { Assert(pSMU); return FALSE; } UseStats =pSMU->GetUseStatus(SM_C_READ); pSMU->Lock(SM_C_READ); PetProcreateItem* pPetItem = &pSMU->m_PetProcreateItem; Assert(pPetItem); if(pPetItem == NULL) { pSMU->UnLock(SM_C_READ); Assert(FALSE); } if(pPetItem->IsInvalid() == TRUE && UseStats != PET_DELETE) { pSMU->UnLock(SM_C_READ); continue; } memcpy(&PetProItem,pPetItem,sizeof(PetProcreateItem)); pSMU->m_SMUHead.UseStatus = PET_SAVED; pSMU->UnLock(SM_C_READ); //继续存储 mInterface->Clear(); CheckDBConnect("DBPetItemInfo"); LONG_DB_QUERY* pQuery = GetLongInterQuery(); if(!pQuery) { Assert(FALSE); } pQuery->Clear(); CHAR PairDataList[20480] = {0}; Binary2String(((CHAR*)pPetItem),sizeof(PetProcreateItem), PairDataList); pQuery->Parse(SavePetItemInfo, PairDataList, i, ((UseStats!=PET_DELETE)?1:0)); ODBCBase::LongSave(&Result); //保存数据版本 pQuery->Clear(); pQuery->Parse(SavePetItemDataVersion,PETITEM_TABLE,PETPROCREATE_CURRENT_ITEM_VERSION,i); ODBCBase::LongSave(&Result); } }while(0); return TRUE; __LEAVE_FUNCTION return FALSE; }
BOOL DBGuildInfo::Save(VOID* pSource) { __ENTER_FUNCTION enum { DB_GuildID = 1, DB_GuildName, DB_Guildstat, DB_Chiefguid, DB_PCount, DB_UCount, DB_MUCount, DB_GPoint, DB_GuildMoney, DB_CityID, DB_Time, DB_Logvity, DB_Contribu, DB_Honor, DB_Indlvl, DB_Agrlvl, DB_Comlvl, DB_Deflvl, DB_Techlvl, DB_Amblvl, DB_Admin, DB_GuildDesc, DB_Chiefname, DB_Cname, DB_Glvl, }; INT Result; SMUPool<GuildSMU>* pPoolPtr = static_cast<SMUPool<GuildSMU>*>(pSource); Assert(pPoolPtr); //保存工会数据 GUILD_DB SaveGuild; do { INT SmuCount = pPoolPtr->GetPoolMaxSize(); if(SmuCount>MAX_GUILD_SIZE) Assert(FALSE); INT UseStats; for(INT i = 0 ;i<SmuCount;i++) { GuildSMU* pSMU = pPoolPtr->GetPoolObj(i); if(!pSMU) { Assert(pSMU); return FALSE; } UseStats =pSMU->GetUseStatus(SM_C_READ); pSMU->Lock(SM_C_READ); GUILD_DB* pGuild = &(pSMU->m_GuildSM); if(pGuild == NULL) { pSMU->UnLock(SM_C_READ); Assert(FALSE); } memcpy(&SaveGuild,pGuild,sizeof(GUILD_DB)); pSMU->m_SMUHead.UseStatus = GUILD_SAVED; if(UseStats ==GUILD_DELETE) { pGuild->CleanUp(); } pSMU->UnLock(SM_C_READ); if(SaveGuild.m_GuildID == INVALID_ID) continue; CHAR AdminInfo[4096] = {0}; Binary2String((CHAR*)(&SaveGuild.m_AdminLayout), sizeof(GUILD_ADMIN_t), AdminInfo); CHAR GuildUser[MAX_LONG_COLUMN_BUFFER] = {0}; Binary2String((CHAR*)(SaveGuild.m_aGuildUser), sizeof(GUILDUSER_DB)*USER_ARRAY_SIZE, GuildUser); LONG_DB_QUERY* pQuery = GetLongInterQuery(); if(!pQuery) { Assert(FALSE); } pQuery->Clear(); pQuery->Parse(SaveWorldGuildInfo, SaveGuild.m_GuildID, SaveGuild.m_GuildName, SaveGuild.m_Status, SaveGuild.m_ChieftainGUID, SaveGuild.m_nProposerCount, SaveGuild.m_UserCount, SaveGuild.m_MaxUserSize, SaveGuild.m_GuildPoint, SaveGuild.m_GuildMoney, SaveGuild.m_CityID, SaveGuild.m_nTime, SaveGuild.m_Longevity, SaveGuild.m_Contribute, SaveGuild.m_Honor, SaveGuild.m_nIndustryLevel, SaveGuild.m_nAgrLevel, SaveGuild.m_nComLevel, SaveGuild.m_nDefLevel, SaveGuild.m_nTechLevel, SaveGuild.m_nAmbiLevel, AdminInfo, SaveGuild.m_GuildDesc, SaveGuild.m_GuildChiefName, SaveGuild.m_GuildCreatorName, SaveGuild.m_GuildLevel, GuildUser, ((UseStats!=GUILD_DELETE)?1:0) ); if(!ODBCBase::LongSave(&Result)) return FALSE; } }while(0); return TRUE; __LEAVE_FUNCTION return FALSE; }
BOOL DBCharFullData::Save(VOID* pSource) { __ENTER_FUNCTION LONG_DB_QUERY* pQuery = GetLongInterQuery(); if(!pQuery) { Assert(FALSE); } pQuery->Clear(); if(m_CharGuid==INVALID_ID) { return FALSE; } FULLUSERDATA* pCharFullData = static_cast<FULLUSERDATA*>(pSource); Assert(pCharFullData); if(!StrSafeCheck(pCharFullData->m_Human.m_Title,MAX_CHARACTER_TITLE)) return FALSE; if(!StrSafeCheck(pCharFullData->m_Human.m_Passwd,MAX_PWD)) return FALSE; CHAR CharCamp[100]; memset(CharCamp,0,100); Binary2String((CHAR*)(&pCharFullData->m_Human.m_CampData), sizeof(_CAMP_DATA), CharCamp); CHAR CharSetting[2048*2]; memset(CharSetting,0,2048*2); Binary2String((CHAR*)(&pCharFullData->m_Setting), sizeof(_SETTING_DB_LOAD), CharSetting); CHAR CharShopInfo[512]; memset(CharShopInfo,0,512); _HUMAN_DB_LOAD::_PSHOP_INFO ShopInfo; memcpy(ShopInfo.m_ShopGuid,pCharFullData->m_Human.m_ShopGuid,sizeof(_PLAYERSHOP_GUID)*MAX_SHOP_NUM_PER_PLAYER); memcpy(ShopInfo.m_FavoriteList,pCharFullData->m_Human.m_FavoriteList,sizeof(_PLAYERSHOP_GUID)*MAX_FAVORITE_SHOPS); Binary2String((CHAR*)&ShopInfo, sizeof(ShopInfo), CharShopInfo); CHAR CharCarryPet[100]; memset(CharCarryPet,0,100); Binary2String((CHAR*)&pCharFullData->m_Human.m_guidCurrentPet, sizeof(PET_GUID_t), CharCarryPet); pQuery->Parse(UpdateCharFullData, CHAR_TABLE, pCharFullData->m_Human.m_bFirstEnterScence, pCharFullData->m_Human.m_Title, pCharFullData->m_Human.m_Sex, pCharFullData->m_Human.m_Level, pCharFullData->m_Human.m_Energy, pCharFullData->m_Human.m_Exp, pCharFullData->m_Human.m_Money, pCharFullData->m_Human.m_Passwd, pCharFullData->m_Human.m_HairColor, pCharFullData->m_Human.m_FaceColor, pCharFullData->m_Human.m_HairModel, pCharFullData->m_Human.m_FaceModel, pCharFullData->m_Human.m_StartScene, Float2Int(pCharFullData->m_Human.m_Position.m_fX*100), Float2Int(pCharFullData->m_Human.m_Position.m_fZ*100), pCharFullData->m_Human.m_LastLoginTime, pCharFullData->m_Human.m_LastLogoutTime, pCharFullData->m_Human.m_DBVersion, CharCamp, pCharFullData->m_Human.m_MenPai, pCharFullData->m_Human.m_nCountry, pCharFullData->m_Human.m_HP, pCharFullData->m_Human.m_MP, pCharFullData->m_Human.m_StrikePoint, pCharFullData->m_Human.m_BaseAttrLevel1.m_pAttr[CATTR_LEVEL1_STR], pCharFullData->m_Human.m_BaseAttrLevel1.m_pAttr[CATTR_LEVEL1_CON], pCharFullData->m_Human.m_BaseAttrLevel1.m_pAttr[CATTR_LEVEL1_INT], pCharFullData->m_Human.m_BaseAttrLevel1.m_pAttr[CATTR_LEVEL1_DEX], pCharFullData->m_Human.m_Level1Points, CharSetting,// tmd 太大了 [6/6/2008 wuwenbin] CharShopInfo, CharCarryPet, pCharFullData->m_Human.m_GuildID, pCharFullData->m_Human.m_TeamID, pCharFullData->m_Human.m_PortraitID, pCharFullData->m_Human.m_EnergyRegeneRate, pCharFullData->m_Human.m_Vigor, pCharFullData->m_Human.m_MaxVigor, pCharFullData->m_Human.m_VigorRegeneRate, pCharFullData->m_Human.m_MaxEnergy, pCharFullData->m_Human.m_uPwdDelTime, pCharFullData->m_Human.m_LeftDieTime, pCharFullData->m_Bank.m_Money, pCharFullData->m_Bank.m_CurEndIndex, pCharFullData->m_Human.m_BakScene, Float2Int(pCharFullData->m_Human.m_BakPosition.m_fX*100), Float2Int(pCharFullData->m_Human.m_BakPosition.m_fZ*100), pCharFullData->m_Human.m_Rage, m_CharGuid, pCharFullData->m_Human.m_DBVersion); if(!ODBCBase::LongSave(pSource)) return FALSE; Assert(mResultCount<=1); mInterface->Clear(); if(mResultCount==0) { return TRUE; } UINT dbVersion = pCharFullData->m_Human.m_DBVersion; //保存装备 DBItemList ItemListObject(mInterface); ItemListObject.SetCharGuid(m_CharGuid); ItemListObject.SetDBVersion(dbVersion); if(!ItemListObject.Save(pCharFullData)) return FALSE; ItemListObject.ParseResult(pCharFullData); //保存技能 DBSkillList SkillListObject(mInterface); SkillListObject.SetCharGuid(m_CharGuid); SkillListObject.SetDBVersion(dbVersion); if(!SkillListObject.Save(pCharFullData)) return FALSE; SkillListObject.ParseResult(pCharFullData); //保存心法 DBXinFaList XinFaListObject(mInterface); XinFaListObject.SetCharGuid(m_CharGuid); XinFaListObject.SetDBVersion(dbVersion); if(!XinFaListObject.Save(pCharFullData)) return FALSE; XinFaListObject.ParseResult(pCharFullData); //保存生活技能 DBAbilityList AbilityListObject(mInterface); AbilityListObject.SetCharGuid(m_CharGuid); AbilityListObject.SetDBVersion(dbVersion); if(!AbilityListObject.Save(pCharFullData)) return FALSE; AbilityListObject.ParseResult(pCharFullData); //保存任务信息 DBTaskList TaskListObject(mInterface); TaskListObject.SetCharGuid(m_CharGuid); TaskListObject.SetDBVersion(dbVersion); if(!TaskListObject.Save(pCharFullData)) return FALSE; TaskListObject.ParseResult(pCharFullData); //保存关系列表 DBRelationList RelationListObject(mInterface); RelationListObject.SetCharGuid(m_CharGuid); RelationListObject.SetDBVersion(dbVersion); if(!RelationListObject.Save(pCharFullData)) return FALSE; RelationListObject.ParseResult(pCharFullData); //保存Impact 列表 DBImpactList ImpactListObject(mInterface); ImpactListObject.SetCharGuid(m_CharGuid); ImpactListObject.SetDBVersion(dbVersion); if(!ImpactListObject.Save(pCharFullData)) return FALSE; ImpactListObject.ParseResult(pCharFullData); ////保存宠物 列表 //DBPetList PetListObject(mInterface); //PetListObject.SetCharGuid(m_CharGuid); //PetListObject.SetDBVersion(dbVersion); //if(!PetListObject.Save(pCharFullData)) // return FALSE; //PetListObject.ParseResult(pCharFullData); //私人信息 DBPrivateInfo PrivateInfoObject(mInterface); PrivateInfoObject.SetCharGuid(m_CharGuid); PrivateInfoObject.SetDBVersion(dbVersion); if(!PrivateInfoObject.Save(pCharFullData)) return FALSE; PrivateInfoObject.ParseResult(pCharFullData); //称号信息 DBTitleInfo TitleInfoObject(mInterface); TitleInfoObject.SetCharGuid(m_CharGuid); TitleInfoObject.SetDBVersion(dbVersion); if(!TitleInfoObject.Save(pCharFullData)) return FALSE; TitleInfoObject.ParseResult(pCharFullData); //冷却信息 DBCoolDownInfo CoolDownInfoObject(mInterface); CoolDownInfoObject.SetCharGuid(m_CharGuid); CoolDownInfoObject.SetDBVersion(dbVersion); if(!CoolDownInfoObject.Save(pCharFullData)) return FALSE; CoolDownInfoObject.ParseResult(pCharFullData); //搜侠信息add by gh 2010/06/07 DBSouXiaList SouXiaInfoObject(mInterface); SouXiaInfoObject.SetCharGuid(m_CharGuid); SouXiaInfoObject.SetDBVersion(dbVersion); if(!SouXiaInfoObject.Save(pCharFullData)) return FALSE; SouXiaInfoObject.ParseResult(pCharFullData); return TRUE; __LEAVE_FUNCTION return FALSE; }