本文整理汇总了C++中CDBAgent类的典型用法代码示例。如果您正苦于以下问题:C++ CDBAgent类的具体用法?C++ CDBAgent怎么用?C++ CDBAgent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CDBAgent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReqSaveCharacter
void CUser::ReqSaveCharacter()
{
if (m_bLevel == 0)
TRACE("### ReqSaveCharacter - Level is Zero : bRoom=%d, bNation=%d, bZone=%d ####\n", GetEventRoom(), GetNation(), GetZoneID());
g_DBAgent.UpdateUser(GetName(), UPDATE_PACKET_SAVE, this);
g_DBAgent.UpdateWarehouseData(GetAccountName(), UPDATE_PACKET_SAVE, this);
g_DBAgent.UpdateSavedMagic(this);
}
示例2: ReqUserLogOut
void CUser::ReqUserLogOut()
{
string strCharID = GetName();
g_DBAgent.UpdateUser(strCharID, UPDATE_LOGOUT, this);
g_DBAgent.UpdateWarehouseData(m_strAccountID, UPDATE_LOGOUT, this);
if (m_bLogout != 2) // zone change logout
g_DBAgent.AccountLogout(m_strAccountID);
// this session can be used again.
m_deleted = false;
}
示例3: ReqUserLogOut
void CUser::ReqUserLogOut()
{
g_DBAgent.UpdateUser(GetName(), UPDATE_LOGOUT, this);
g_DBAgent.UpdateWarehouseData(GetAccountName(), UPDATE_LOGOUT, this);
g_DBAgent.UpdateSavedMagic(this);
PlayerRanking(GetZoneID(), true);
if (m_bLogout != 2) // zone change logout
g_DBAgent.AccountLogout(GetAccountName());
// this session can be used again.
m_deleted = false;
}
示例4: ReqAllCharInfo
void CUser::ReqAllCharInfo(Packet & pkt)
{
Packet result(WIZ_ALLCHAR_INFO_REQ);
string strCharID1, strCharID2, strCharID3;
result << uint8(1);
#if __VERSION >= 1920
result << uint8(1); // 1.920+ flag, probably indicates whether there's any characters or not (stays 1 for 1+ characters though, so not a count :'(). Untested without.
#endif
g_DBAgent.GetAllCharID(m_strAccountID, strCharID1, strCharID2, strCharID3);
g_DBAgent.LoadCharInfo(strCharID1, result);
g_DBAgent.LoadCharInfo(strCharID2, result);
g_DBAgent.LoadCharInfo(strCharID3, result);
Send(&result);
}
示例5: ReqAllKnightsMember
void CKnightsManager::ReqAllKnightsMember(CUser *pUser, Packet & pkt)
{
Packet result(WIZ_KNIGHTS_PROCESS, uint8(KNIGHTS_MEMBER_REQ));
int nOffset;
uint16 sClanID, sCount;
pkt >> sClanID;
CKnights* pKnights = g_pMain->GetClanPtr(pUser->GetClanID());
if (pKnights == nullptr)
return;
result << uint8(1);
nOffset = result.wpos(); // store offset
result << uint16(0) // placeholder for packet length
<< uint16(0); // placeholder for user count
sCount = g_DBAgent.LoadKnightsAllMembers(sClanID, result);
if (sCount > MAX_CLAN_USERS)
return;
pkt.put(nOffset, uint16(result.size() - 3));
pkt.put(nOffset + 2, sCount);
pUser->Send(&result);
}
示例6: ReqKnightsList
void CKnightsManager::ReqKnightsList(Packet & pkt)
{
// Okay, this effectively makes this useless in the majority of cases.
if (g_pMain->m_nServerNo != BATTLE)
return;
string strKnightsName;
uint32 nPoints;
uint16 sClanID = pkt.read<uint16>(), sMembers;
uint8 bNation, bRank;
if (!g_DBAgent.LoadKnightsInfo(sClanID, bNation, strKnightsName, sMembers, nPoints, bRank))
return;
CKnights *pKnights = g_pMain->GetClanPtr(sClanID);
if (pKnights == nullptr)
{
pKnights = new CKnights();
if (!g_pMain->m_KnightsArray.PutData(sClanID, pKnights))
{
delete pKnights;
return;
}
}
// TO-DO: Move this all to a single method, as this is done multiple times
pKnights->m_sIndex = sClanID;
pKnights->m_byNation = bNation;
pKnights->m_strName = strKnightsName;
pKnights->m_sMembers = sMembers;
pKnights->m_nPoints = nPoints;
pKnights->m_byGrade = g_pMain->GetKnightsGrade(nPoints);
pKnights->m_byRanking = bRank;
}
示例7: ReqChangeName
/**
* @brief Handles name change requests.
*
* @param pkt The packet.
*/
void CUser::ReqChangeName(Packet & pkt)
{
NameChangeOpcode response;
uint8 opcode;
string strName;
pkt >> opcode >> strName;
switch (opcode)
{
case NameChangePlayerRequest:
response = g_DBAgent.UpdateCharacterName(GetAccountName(), GetName(), strName);
// On success, update the name in the server & remove the scroll.
// (we checked if it existed before handling the request).
if (response == NameChangeSuccess)
{
// Replace the character's name (in both the session and the character lookup hashmap).
g_pMain->ReplaceCharacterName(this, strName);
// Take the scroll...
RobItem(ITEM_SCROLL_OF_IDENTITY);
// Remove user from others' view & make them reappear again so
// the name can be updated for those currently in range.
UserInOut(INOUT_OUT);
UserInOut(INOUT_IN);
}
break;
}
SendNameChange(response);
}
示例8: ReqChangeCape
/**
* @brief Handles clan cape update requests.
*
* @param pkt The packet.
*/
void CUser::ReqChangeCape(Packet & pkt)
{
uint16 sClanID, sCapeID;
uint8 r, g, b;
pkt >> sClanID >> sCapeID >> r >> g >> b;
g_DBAgent.UpdateCape(sClanID, sCapeID, r, g, b);
}
示例9: ReqSkillDataLoad
void CUser::ReqSkillDataLoad(Packet & pkt)
{
Packet result(WIZ_SKILLDATA, uint8(SKILL_DATA_LOAD));
if (!g_DBAgent.LoadSkillShortcut(result, this))
result << uint16(0);
Send(&result);
}
示例10: ReqUpdateGrade
/**
* @brief Request a clan's grade (and cape) be updated
* in the database.
*
* @param pkt The packet.
*/
void CKnightsManager::ReqUpdateGrade(Packet & pkt)
{
uint16 sClanID, sCapeID;
uint8 byFlag;
pkt >> sClanID >> byFlag >> sCapeID;
g_DBAgent.UpdateClanGrade(sClanID, byFlag, sCapeID);
}
示例11: ReqUpdateClanNotice
/**
* @brief Requests a clan's notice be updated in the database.
*
* @param pkt The packet.
*/
void CKnightsManager::ReqUpdateClanNotice(Packet & pkt)
{
uint16 sClanID;
string strClanNotice;
pkt >> sClanID >> strClanNotice;
g_DBAgent.UpdateClanNotice(sClanID, strClanNotice);
}
示例12: ReqLetterUnread
void CUser::ReqLetterUnread()
{
// TO-DO: Force this to use cached list data (or update if stale). Calling the DB for just this is pointless.
Packet result(WIZ_SHOPPING_MALL, uint8(STORE_LETTER));
result << uint8(LETTER_UNREAD)
<< g_DBAgent.GetUnreadLetterCount(m_strUserID);
Send(&result);
}
示例13: ReqSelectNation
void CUser::ReqSelectNation(Packet & pkt)
{
Packet result(WIZ_SEL_NATION);
uint8 bNation = pkt.read<uint8>(), bResult;
bResult = g_DBAgent.NationSelect(m_strAccountID, bNation) ? bNation : 0;
result << bResult;
Send(&result);
}
示例14: ReqDestroyKnights
void CKnightsManager::ReqDestroyKnights(CUser *pUser, Packet & pkt)
{
uint16 sClanID = pkt.read<uint16>();
CKnights *pKnights = g_pMain->GetClanPtr(sClanID);
if (pKnights == nullptr)
return;
int8 bResult = int8(g_DBAgent.DeleteKnights(sClanID));
pKnights->Disband(pUser);
}
示例15: ReqLetterList
void CUser::ReqLetterList(bool bNewLettersOnly /*= true*/)
{
Packet result(WIZ_SHOPPING_MALL, uint8(STORE_LETTER));
result << uint8(bNewLettersOnly ? LETTER_LIST : LETTER_HISTORY);
if (!g_DBAgent.GetLetterList(m_strUserID, result, bNewLettersOnly))
result << int8(-1);
Send(&result);
}