Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,336 @@
|
||||
#include "stdafx.h"
|
||||
#include "PartyDBInfo.h"
|
||||
|
||||
#include <DataStorage/CharacterData.h>
|
||||
#include <DataStorage/CharacterDataMgr.h>
|
||||
|
||||
#include <DataStorage/SessionData.h>
|
||||
#include <DataStorage/SessionDataMgr.h>
|
||||
|
||||
#include <Log/ServerLog.h>
|
||||
|
||||
|
||||
namespace DBAgent
|
||||
{
|
||||
|
||||
CPartyDBInfo::CPartyDBInfo(unsigned long PartyID_In)
|
||||
{
|
||||
memset(&m_Party, 0, sizeof(PARTY));
|
||||
m_Party.m_dwPartyID = PartyID_In;
|
||||
|
||||
std::fill_n(&m_Party.ServerID[0], int(PARTY::MAX_MEM), 0);
|
||||
std::fill_n(&m_bAutoRouting[0], int(PARTY::MAX_MEM), 1);
|
||||
|
||||
std::fill_n(&m_Party.m_cLevel[0], int(PARTY::MAX_MEM), 0);
|
||||
std::fill_n(&m_Party.m_wClass[0], int(PARTY::MAX_MEM), 0);
|
||||
std::fill_n(&m_Party.m_dwGID[0], int(PARTY::MAX_MEM), 0);
|
||||
}
|
||||
|
||||
bool CPartyDBInfo::SerializeIn(PARTY_INFO& PartyInfo_In, PARTY_USER_INFO& PartyUserInfo_In)
|
||||
{
|
||||
int Count = 0;
|
||||
for (; Count < PARTY::MAX_MEM; ++Count)
|
||||
{
|
||||
if (0 == PartyInfo_In.MemberCID[Count])
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
strncpy((char *)m_Party.Name[Count], (char *)PartyInfo_In.Name[Count], CHAR_INFOST::MAX_NAME_LEN);
|
||||
m_Party.MemberCID[Count] = PartyInfo_In.MemberCID[Count];
|
||||
m_Party.ServerID[Count] = 0;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> //
|
||||
m_Party.m_cLevel[Count] = PartyUserInfo_In.m_cLevel[Count];
|
||||
m_Party.m_wClass[Count] = PartyUserInfo_In.m_wClass[Count];
|
||||
m_Party.m_dwGID[Count] = PartyUserInfo_In.m_dwGID[Count];
|
||||
}
|
||||
|
||||
m_Party.m_cMemberNum = Count;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPartyDBInfo::SerializeOut(PARTY_INFO& PartyInfo_Out, PARTY_USER_INFO& PartyUserInfo_Out)
|
||||
{
|
||||
if (m_Party.m_cMemberNum > PARTY::MAX_MEM)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int Count = 0; Count < m_Party.m_cMemberNum; ++Count)
|
||||
{
|
||||
PartyInfo_Out.MemberCID[Count] = m_Party.MemberCID[Count];
|
||||
strncpy((char *)PartyInfo_Out.Name[Count], (char *)m_Party.Name[Count], CHAR_INFOST::MAX_NAME_LEN);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> //
|
||||
PartyUserInfo_Out.m_cLevel[Count] = m_Party.m_cLevel[Count];
|
||||
PartyUserInfo_Out.m_wClass[Count] = m_Party.m_wClass[Count];
|
||||
PartyUserInfo_Out.m_dwGID[Count] = m_Party.m_dwGID[Count];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned long CPartyDBInfo::GetFirstMem(void)
|
||||
{
|
||||
for (int Count = 0; Count < m_Party.m_cMemberNum; ++Count)
|
||||
{
|
||||
if (0 != m_Party.ServerID[Count])
|
||||
{
|
||||
return m_Party.MemberCID[Count];
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool CPartyDBInfo::IsMember(unsigned long CharID_In)
|
||||
{
|
||||
for (int Count = 0; Count < m_Party.m_cMemberNum; ++Count)
|
||||
{
|
||||
if (m_Party.MemberCID[Count] == CharID_In)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CPartyDBInfo::PartyMemLogin(unsigned long dwCharID_In, unsigned long dwServerID_In)
|
||||
{
|
||||
for (int Count = 0; Count < m_Party.m_cMemberNum; ++Count)
|
||||
{
|
||||
if (m_Party.MemberCID[Count] == dwCharID_In)
|
||||
{
|
||||
m_Party.ServerID[Count] = dwServerID_In;
|
||||
if (0 == m_Party.m_dwLeaderID)
|
||||
{
|
||||
SetLeader(dwCharID_In);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CPartyDBInfo::PartyMemLogout(unsigned long CharID_In)
|
||||
{
|
||||
for (int Count = 0; Count < m_Party.m_cMemberNum; ++Count)
|
||||
{
|
||||
if (m_Party.MemberCID[Count] == CharID_In)
|
||||
{
|
||||
m_Party.ServerID[Count] = 0;
|
||||
if (m_Party.m_dwLeaderID == CharID_In)
|
||||
{
|
||||
SetLeader(GetFirstMem());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CPartyDBInfo::PartyMemAllLogout(void)
|
||||
{
|
||||
std::fill_n(&m_Party.ServerID[0], int(PARTY::MAX_MEM), 0);
|
||||
}
|
||||
|
||||
bool CPartyDBInfo::IsLogined(unsigned long CharID_In)
|
||||
{
|
||||
for (int Count = 0; Count < m_Party.m_cMemberNum; ++Count)
|
||||
{
|
||||
if (m_Party.MemberCID[Count] == CharID_In)
|
||||
{
|
||||
if (m_Party.ServerID[Count] != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CPartyDBInfo::TransferLeader(unsigned long OldLeaderID, unsigned long NewLeaderID)
|
||||
{
|
||||
if (OldLeaderID != GetLeader())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (false == IsLogined(OldLeaderID) || false == IsLogined(NewLeaderID))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SetLeader(NewLeaderID);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPartyDBInfo::InsertPartyMem(unsigned long ServerID_In, unsigned long CharID_In, unsigned short Class_In, char Level_In, unsigned long GID_In, const char* CharName_In)
|
||||
{
|
||||
if (PARTY::MAX_MEM <= m_Party.m_cMemberNum) // <20><>Ƽ<EFBFBD>ο<EFBFBD><CEBF><EFBFBD> 10<31><30> <20>̻<EFBFBD>
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Party.ServerID[m_Party.m_cMemberNum] = ServerID_In;
|
||||
m_Party.MemberCID[m_Party.m_cMemberNum] = CharID_In;
|
||||
m_Party.m_cLevel[m_Party.m_cMemberNum] = Level_In;
|
||||
m_Party.m_wClass[m_Party.m_cMemberNum] = Class_In;
|
||||
m_Party.m_dwGID[m_Party.m_cMemberNum] = GID_In;
|
||||
|
||||
strncpy(m_Party.Name[m_Party.m_cMemberNum], CharName_In, CHAR_INFOST::MAX_NAME_LEN);
|
||||
|
||||
++m_Party.m_cMemberNum;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPartyDBInfo::DeletePartyMem(unsigned long CharID_In, unsigned long& ServerID_Out)
|
||||
{
|
||||
using namespace DBAgent::DataStorage;
|
||||
|
||||
int nCount = 0;
|
||||
|
||||
for (; nCount < m_Party.m_cMemberNum; ++nCount)
|
||||
{
|
||||
if (m_Party.MemberCID[nCount] == CharID_In)
|
||||
{
|
||||
CSessionData* lpSessionData = 0;
|
||||
CCharacterData* lpCharacterData = 0;
|
||||
|
||||
if(0 == m_Party.ServerID[nCount])
|
||||
{
|
||||
lpCharacterData = static_cast<CCharacterData*>(
|
||||
CCharacterDataMgr::GetInstance().GetLogoutData(CharID_In));
|
||||
}
|
||||
else
|
||||
{
|
||||
lpSessionData = CSessionDataMgr::GetInstance().GetCharLoadedSession(CharID_In);
|
||||
if(0 != lpSessionData)
|
||||
{
|
||||
lpCharacterData = lpSessionData->GetCharacterData();
|
||||
}
|
||||
}
|
||||
|
||||
if (0 != lpCharacterData && m_Party.m_dwPartyID == lpCharacterData->GetPID())
|
||||
{
|
||||
RULLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : ij<><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> PID<49><44> 0<><30><EFBFBD><EFBFBD> <20><>",
|
||||
m_Party.m_dwPartyID, CharID_In);
|
||||
|
||||
lpCharacterData->SetPID(0);
|
||||
}
|
||||
|
||||
ServerID_Out = m_Party.ServerID[nCount];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nCount == m_Party.m_cMemberNum)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (; nCount < m_Party.m_cMemberNum; ++nCount)
|
||||
{
|
||||
if ((nCount + 1) >= PARTY::MAX_MEM)
|
||||
{
|
||||
m_Party.ServerID[nCount] = 0;
|
||||
m_Party.MemberCID[nCount] = 0;
|
||||
m_Party.m_cLevel[nCount] = 0;
|
||||
m_Party.m_dwGID[nCount] = 0;
|
||||
m_Party.m_wClass[nCount] = 0;
|
||||
|
||||
std::fill_n(&m_Party.Name[nCount][0], int(CHAR_INFOST::MAX_NAME_LEN), 0);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
m_Party.ServerID[nCount] = m_Party.ServerID[nCount + 1];
|
||||
m_Party.MemberCID[nCount] = m_Party.MemberCID[nCount + 1];
|
||||
m_Party.m_cLevel[nCount] = m_Party.m_cLevel[nCount + 1];
|
||||
m_Party.m_dwGID[nCount] = m_Party.m_dwGID[nCount + 1];
|
||||
m_Party.m_wClass[nCount] = m_Party.m_wClass[nCount + 1];
|
||||
strncpy((char *)m_Party.Name[nCount], (char *)m_Party.Name[nCount + 1], CHAR_INFOST::MAX_NAME_LEN);
|
||||
}
|
||||
|
||||
if (m_Party.m_dwLeaderID == CharID_In)
|
||||
{
|
||||
SetLeader(GetFirstMem());
|
||||
}
|
||||
|
||||
--m_Party.m_cMemberNum;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPartyDBInfo::SetUserInfoLevel(unsigned long dwCID, char cLevel)
|
||||
{
|
||||
for(unsigned char cIndex = 0; cIndex < m_Party.m_cMemberNum; ++cIndex)
|
||||
{
|
||||
if(m_Party.MemberCID[cIndex]==dwCID)
|
||||
{
|
||||
m_Party.m_cLevel[cIndex] = cLevel;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CPartyDBInfo::SetUserInfoClass(unsigned long dwCID, unsigned short wClass)
|
||||
{
|
||||
for(unsigned char cIndex = 0; cIndex < m_Party.m_cMemberNum; ++cIndex)
|
||||
{
|
||||
if(m_Party.MemberCID[cIndex]==dwCID)
|
||||
{
|
||||
m_Party.m_wClass[cIndex] = wClass;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CPartyDBInfo::SetUserInfoGID(unsigned long dwCID, unsigned long dwGID)
|
||||
{
|
||||
for(unsigned char cIndex = 0; cIndex < m_Party.m_cMemberNum; ++cIndex)
|
||||
{
|
||||
if(m_Party.MemberCID[cIndex]==dwCID)
|
||||
{
|
||||
m_Party.m_dwGID[cIndex] = dwGID;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CPartyDBInfo::AutoRouting(unsigned long CharID_In, bool bOn, bool bAll)
|
||||
{
|
||||
if (bAll == true)
|
||||
{
|
||||
int Count = 0;
|
||||
for (; Count < m_Party.m_cMemberNum; ++Count)
|
||||
{
|
||||
m_bAutoRouting[Count] = bOn;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int Count = 0;
|
||||
for (; Count < m_Party.m_cMemberNum; ++Count)
|
||||
{
|
||||
if (m_Party.MemberCID[Count] == CharID_In)
|
||||
{
|
||||
m_bAutoRouting[Count] = bOn;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
#ifndef _RYL_DBAGENT_PARTY_DB_INFO_H_
|
||||
#define _RYL_DBAGENT_PARTY_DB_INFO_H_
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <DB/DBdefine.h>
|
||||
|
||||
|
||||
namespace DBAgent
|
||||
{
|
||||
|
||||
class CPartyDBInfo
|
||||
{
|
||||
public:
|
||||
|
||||
CPartyDBInfo(unsigned long PartyID_In);
|
||||
|
||||
bool SerializeIn(PARTY_INFO& PartyInfo_In, PARTY_USER_INFO& PartyUserInfo_In);
|
||||
bool SerializeOut(PARTY_INFO& PartyInfo_Out, PARTY_USER_INFO& PartyUserInfo_Out);
|
||||
|
||||
unsigned long GetFirstMem();
|
||||
bool IsMember(unsigned long CharID_In);
|
||||
|
||||
bool PartyMemLogin(unsigned long dwCharID_In, unsigned long dwServer_In);
|
||||
bool PartyMemLogout(unsigned long dwCharID_In);
|
||||
void PartyMemAllLogout();
|
||||
|
||||
bool IsLogined(unsigned long CharID_In);
|
||||
bool IsLoginedByIndex(unsigned long Index) { return m_Party.ServerID[Index]; }
|
||||
|
||||
bool TransferLeader(unsigned long OldLeaderID, unsigned long NewLeaderID);
|
||||
bool InsertPartyMem(unsigned long ServerID_In, unsigned long CharID_In, unsigned short Class_In, char Level_In, unsigned long GID_In, const char* CharName_In);
|
||||
bool DeletePartyMem(unsigned long CharID_In, unsigned long& ServerID_Out);
|
||||
|
||||
bool AutoRouting(unsigned long CharID_In, bool bOn, bool bAll = false);
|
||||
|
||||
const PARTY& GetParty() const { return m_Party; }
|
||||
|
||||
unsigned long GetPID() { return m_Party.m_dwPartyID; }
|
||||
unsigned long GetLeader() { return m_Party.m_dwLeaderID; }
|
||||
unsigned long GetPartyMemNum() { return m_Party.m_cMemberNum; }
|
||||
|
||||
unsigned long SetPID(unsigned long PID_In) { return m_Party.m_dwPartyID = PID_In; }
|
||||
unsigned long SetLeader(unsigned long ID_In) { return m_Party.m_dwLeaderID = ID_In; }
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> //
|
||||
|
||||
const PARTY_USERINFO& GetPartyUserInfo() const { return m_PartyUserInfo; }
|
||||
|
||||
bool SetUserInfoLevel(unsigned long dwCID, char cLevel);
|
||||
bool SetUserInfoClass(unsigned long dwCID, unsigned short wClass);
|
||||
bool SetUserInfoGID(unsigned long dwCID, unsigned long dwGID);
|
||||
|
||||
private:
|
||||
|
||||
PARTY m_Party; // <20><>Ƽ<EFBFBD><C6BC> <20>⺻ <20><><EFBFBD><EFBFBD>.
|
||||
bool m_bAutoRouting[PARTY::MAX_MEM];
|
||||
|
||||
PARTY_USERINFO m_PartyUserInfo; // <20><>Ƽ<EFBFBD><C6BC> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,709 @@
|
||||
#include "stdafx.h"
|
||||
#include "PartyDBMgr.h"
|
||||
#include "PartyDBInfo.h"
|
||||
|
||||
#include <Network/SendPacket/SendParty.h>
|
||||
#include <Network/Dispatch/GameDispatch.h>
|
||||
|
||||
#include <DataStorage/CharacterData.h>
|
||||
#include <DataStorage/CharacterDataMgr.h>
|
||||
|
||||
#include <DataStorage/SessionData.h>
|
||||
#include <DataStorage/SessionDataMgr.h>
|
||||
|
||||
#include <DB/DBComponent.h>
|
||||
#include <DB/GameDBComponent.h>
|
||||
|
||||
#include <Log/ServerLog.h>
|
||||
|
||||
#include <Network/Packet/PacketStruct/PartyPacket.h>
|
||||
#include <Network/Packet/PacketCommand.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
namespace DBAgent
|
||||
{
|
||||
|
||||
CPartyDBMgr& CPartyDBMgr::GetInstance()
|
||||
{
|
||||
static CPartyDBMgr partyDBMgr;
|
||||
return partyDBMgr;
|
||||
}
|
||||
|
||||
CPartyDBMgr::CPartyDBMgr()
|
||||
: m_PartyDBPool(sizeof(CPartyDBInfo))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
CPartyDBInfo* CPartyDBMgr::CreatePartyDBInfo(unsigned long dwPID)
|
||||
{
|
||||
return new CPartyDBInfo(dwPID);
|
||||
|
||||
// return new (m_PartyDBPool.malloc()) CPartyDBInfo(dwPID);
|
||||
}
|
||||
|
||||
void CPartyDBMgr::DeletePartyDBInfo(CPartyDBInfo* lpPartyDBInfo)
|
||||
{
|
||||
delete lpPartyDBInfo;
|
||||
|
||||
// lpPartyDBInfo->~CPartyDBInfo();
|
||||
// m_PartyDBPool.free(lpPartyDBInfo);
|
||||
}
|
||||
|
||||
|
||||
CPartyDBMgr::~CPartyDBMgr()
|
||||
{
|
||||
PartyMap::iterator pos = m_PartyMap.begin();
|
||||
PartyMap::iterator end = m_PartyMap.end();
|
||||
|
||||
for(; pos != end; ++pos)
|
||||
{
|
||||
DeletePartyDBInfo(pos->second);
|
||||
}
|
||||
|
||||
m_PartyMap.clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool CPartyDBMgr::InsertPartyMap(unsigned long dwPartyID, CPartyDBInfo* lpParty)
|
||||
{
|
||||
m_PartyMap.insert(std::make_pair(dwPartyID, lpParty)).second;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPartyDBMgr::DeletePartyMap(unsigned long dwPartyID)
|
||||
{
|
||||
PartyMap::iterator itr = m_PartyMap.find(dwPartyID);
|
||||
if (itr == m_PartyMap.end())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
itr->second->~CPartyDBInfo();
|
||||
DeletePartyDBInfo(itr->second);
|
||||
|
||||
m_PartyMap.erase(dwPartyID);
|
||||
return true;
|
||||
}
|
||||
|
||||
CPartyDBInfo* CPartyDBMgr::FindPartyMap(unsigned long dwPartyID_In)
|
||||
{
|
||||
PartyMap::iterator itr = m_PartyMap.find(dwPartyID_In);
|
||||
if (itr == m_PartyMap.end())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CPartyDBInfo* CPartyDBMgr::OpenParty(CDBComponent& DBComponent, unsigned long dwPartyID)
|
||||
{
|
||||
CPartyDBInfo* lpParty = 0;
|
||||
|
||||
if (0 != dwPartyID)
|
||||
{
|
||||
lpParty = FindPartyMap(dwPartyID);
|
||||
|
||||
if (0 == lpParty)
|
||||
{
|
||||
// <20><>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
PARTY_DB_INFO PartyDBInfo = {0,};
|
||||
|
||||
if (!DBComponent::GameDB::GetPartyInfo(DBComponent, dwPartyID, &PartyDBInfo))
|
||||
{
|
||||
ERRLOG1(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / <20><>Ƽ<EFBFBD><C6BC> GetPartyInfo<66><6F> ȣ<><C8A3><EFBFBD>ϴµ<CFB4> <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>.", dwPartyID);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lpParty = CreatePartyDBInfo(dwPartyID);
|
||||
if (0 == lpParty)
|
||||
{
|
||||
ERRLOG1(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>.", dwPartyID);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!lpParty->SerializeIn(PartyDBInfo.PartyInfo, PartyDBInfo.PartyUserInfo))
|
||||
{
|
||||
ERRLOG1(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> Serialize<7A><65> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>.", dwPartyID);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// <20><>Ƽ <20>ʿ<EFBFBD> <20>߰<EFBFBD>
|
||||
InsertPartyMap(dwPartyID, lpParty);
|
||||
}
|
||||
}
|
||||
|
||||
return lpParty;
|
||||
}
|
||||
|
||||
bool CPartyDBMgr::CloseParty(CDBComponent& DBComponent, unsigned long dwPartyID)
|
||||
{
|
||||
CPartyDBInfo* lpParty = OpenParty(DBComponent, dwPartyID);
|
||||
if (0 == lpParty)
|
||||
{
|
||||
ERRLOG1(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>", dwPartyID);
|
||||
return false;
|
||||
}
|
||||
|
||||
PARTY_DB_INFO PartyInfo = {0,};
|
||||
|
||||
if (!lpParty->SerializeOut(PartyInfo.PartyInfo, PartyInfo.PartyUserInfo))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!DBComponent::GameDB::UpdatePartyInfo(DBComponent, dwPartyID, &PartyInfo))
|
||||
{
|
||||
ERRLOG1(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / <20><>Ƽ<EFBFBD><C6BC> UpdatePartyInfo<66><6F> ȣ<><C8A3><EFBFBD>ϴµ<CFB4> <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>.", dwPartyID);
|
||||
return false;
|
||||
}
|
||||
|
||||
RULLOG1(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / <20><>Ƽ <20>ݱ<EFBFBD>.", dwPartyID);
|
||||
return DeletePartyMap(dwPartyID);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CPartyDBInfo* CPartyDBMgr::CreateParty(CDBComponent& DBComponent, unsigned long dwLeaderID, char cLeaderLevel, unsigned short wLeaderClass, unsigned long dwLeaderGID,
|
||||
unsigned long dwMemberID, char cMemberLevel, unsigned short wMemberClass, unsigned long dwMemberGID)
|
||||
{
|
||||
using namespace DataStorage;
|
||||
|
||||
CSessionData* lpLeaderSessionData =
|
||||
CSessionDataMgr::GetInstance().GetCharLoadedSession(dwLeaderID);
|
||||
|
||||
CSessionData* lpMemberSessionData =
|
||||
CSessionDataMgr::GetInstance().GetCharLoadedSession(dwMemberID);
|
||||
|
||||
CCharacterData* lpLeaderCharData = 0;
|
||||
CCharacterData* lpMemberCharData = 0;
|
||||
|
||||
CPartyDBInfo* lpParty = 0;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>Ἲ <20>˻<EFBFBD>.
|
||||
if (0 == lpLeaderSessionData || 0 == lpMemberSessionData)
|
||||
{
|
||||
ERRLOG4(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : LeaderCID:%10u(0x%p) / MemberCID:%10u(0x%p) / "
|
||||
"<EFBFBD><EFBFBD>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.",
|
||||
dwLeaderID, lpLeaderSessionData, dwMemberID, lpMemberSessionData);
|
||||
}
|
||||
else if(CSessionData::SE_CHAR_ENABLED != lpLeaderSessionData->GetSessionState() ||
|
||||
CSessionData::SE_CHAR_ENABLED != lpMemberSessionData->GetSessionState())
|
||||
{
|
||||
ERRLOG4(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : LeaderCID:%10u(ST:%s) / MemberCID:%10u(ST:%s) / "
|
||||
"<EFBFBD><EFBFBD>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : <20><><EFBFBD><EFBFBD> <20><><EFBFBD>°<EFBFBD> Ȱ<><C8B0>ȭ<EFBFBD><C8AD><EFBFBD><EFBFBD> <20>ʾҽ<CABE><D2BD>ϴ<EFBFBD>.",
|
||||
dwLeaderID, g_szSessionStateString[lpLeaderSessionData->GetSessionState()],
|
||||
dwMemberID, g_szSessionStateString[lpMemberSessionData->GetSessionState()]);
|
||||
}
|
||||
else if(0 == (lpLeaderCharData = lpLeaderSessionData->GetCharacterData()) ||
|
||||
0 == (lpMemberCharData = lpMemberSessionData->GetCharacterData()))
|
||||
{
|
||||
ERRLOG4(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : LeaderCID:%10u(CharData:0x%p) / MemberCID:%10u(CharData:0x%p) / "
|
||||
"<EFBFBD><EFBFBD>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.",
|
||||
dwLeaderID, lpLeaderCharData, dwMemberID, lpMemberCharData);;
|
||||
}
|
||||
else
|
||||
{
|
||||
PARTY_DB_INFO PartyInfo = {0,};
|
||||
|
||||
PartyInfo.PartyInfo.MemberCID[0] = lpLeaderCharData->GetCID();
|
||||
PartyInfo.PartyUserInfo.m_cLevel[0] = cLeaderLevel;
|
||||
PartyInfo.PartyUserInfo.m_wClass[0] = wLeaderClass;
|
||||
PartyInfo.PartyUserInfo.m_dwGID[0] = dwLeaderGID;
|
||||
strncpy(PartyInfo.PartyInfo.Name[0], lpLeaderCharData->GetName(), CHAR_INFOST::MAX_NAME_LEN);
|
||||
|
||||
|
||||
PartyInfo.PartyInfo.MemberCID[1] = lpMemberCharData->GetCID();
|
||||
PartyInfo.PartyUserInfo.m_cLevel[1] = cMemberLevel;
|
||||
PartyInfo.PartyUserInfo.m_wClass[1] = wMemberClass;
|
||||
PartyInfo.PartyUserInfo.m_dwGID[1] = dwMemberGID;
|
||||
strncpy(PartyInfo.PartyInfo.Name[1], lpMemberCharData->GetName(), CHAR_INFOST::MAX_NAME_LEN);
|
||||
|
||||
// DB <20><>Ƽ <20><><EFBFBD><EFBFBD>
|
||||
unsigned long dwPartyID = 0;
|
||||
|
||||
if (!DBComponent::GameDB::InsertParty(DBComponent, &PartyInfo, &dwPartyID))
|
||||
{
|
||||
ERRLOG3(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / LeaderCID:%10u / MemberCID:%10u / "
|
||||
"<EFBFBD><EFBFBD>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : <20><>Ƽ<EFBFBD><C6BC> InsertParty<74><79> ȣ<><C8A3><EFBFBD>ϴµ<CFB4> <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>.",
|
||||
dwPartyID, dwLeaderID, dwMemberID);
|
||||
}
|
||||
else if (0 == dwPartyID)
|
||||
{
|
||||
ERRLOG3(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / LeaderCID:%10u / MemberCID:%10u / "
|
||||
"<EFBFBD><EFBFBD>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : DB<44><42><EFBFBD><EFBFBD> <20><>Ƽ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>.",
|
||||
dwPartyID, dwLeaderID, dwMemberID);
|
||||
}
|
||||
else if (0 == (lpParty = CreatePartyDBInfo(dwPartyID)))
|
||||
{
|
||||
ERRLOG3(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / LeaderCID:%10u / MemberCID:%10u / "
|
||||
"<EFBFBD><EFBFBD>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : CPartyDBInfo<66><6F><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||||
dwPartyID, dwLeaderID, dwMemberID);
|
||||
}
|
||||
else if (!lpParty->SerializeIn(PartyInfo.PartyInfo, PartyInfo.PartyUserInfo))
|
||||
{
|
||||
DeletePartyDBInfo(lpParty);
|
||||
lpParty = 0;
|
||||
|
||||
ERRLOG3(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / LeaderCID:%10u / MemberCID:%10u / "
|
||||
"<EFBFBD><EFBFBD>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : <20><>Ƽ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Serialize <20><><EFBFBD><EFBFBD>",
|
||||
dwPartyID, dwLeaderID, dwMemberID);
|
||||
}
|
||||
else
|
||||
{
|
||||
lpParty->PartyMemLogin(dwLeaderID, lpLeaderSessionData->GetServerID());
|
||||
lpParty->PartyMemLogin(dwMemberID, lpMemberSessionData->GetServerID());
|
||||
|
||||
InsertPartyMap(dwPartyID, lpParty);
|
||||
|
||||
RULLOG3(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / LeaderCID:%10u / MemberCID;%10u / "
|
||||
"<EFBFBD><EFBFBD>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ", dwPartyID, dwLeaderID, dwMemberID);
|
||||
}
|
||||
}
|
||||
|
||||
return lpParty;
|
||||
}
|
||||
|
||||
bool CPartyDBMgr::DestoryParty(CDBComponent& DBComponent, unsigned long dwPartyID)
|
||||
{
|
||||
CPartyDBInfo* lpParty = FindPartyMap(dwPartyID);
|
||||
if (0 == lpParty)
|
||||
{
|
||||
ERRLOG1(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / <20><>Ƽ <20>Ҹ<EFBFBD> <20><><EFBFBD><EFBFBD> : <20><>Ƽ<EFBFBD><C6BC> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>", dwPartyID);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (MIN_MEMBER_NUM != lpParty->GetPartyMemNum())
|
||||
{
|
||||
ERRLOG1(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / <20><>Ƽ <20>Ҹ<EFBFBD> <20><><EFBFBD><EFBFBD> : <20>ο<EFBFBD><CEBF><EFBFBD><EFBFBD><EFBFBD> <20>ּ<EFBFBD><D6BC>ο<EFBFBD><CEBF><EFBFBD> <20>ƴմϴ<D5B4>", dwPartyID);
|
||||
return false;
|
||||
}
|
||||
|
||||
PARTY_DB_INFO PartyInfo = {0,};
|
||||
if (!lpParty->SerializeOut(PartyInfo.PartyInfo, PartyInfo.PartyUserInfo))
|
||||
{
|
||||
ERRLOG1(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / <20><>Ƽ <20>Ҹ<EFBFBD> <20><><EFBFBD><EFBFBD> : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>", dwPartyID);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!DBComponent::GameDB::DeleteParty(DBComponent, &PartyInfo, dwPartyID))
|
||||
{
|
||||
ERRLOG1(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / <20><>Ƽ <20>Ҹ<EFBFBD> <20><><EFBFBD><EFBFBD> : DBȣ<42><C8A3> DeleteParty<74><79> <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>.", dwPartyID);
|
||||
return false;
|
||||
}
|
||||
|
||||
// ij<><C4B3> DB<44><42> <20><><EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD> <20>ִ<EFBFBD> ij<><C4B3><EFBFBD>ʹ<EFBFBD> PID <20>缳<EFBFBD><E7BCB3> <20><><EFBFBD>־<EFBFBD><D6BE><EFBFBD> <20>Ѵ<EFBFBD>.
|
||||
using namespace DataStorage;
|
||||
|
||||
CCharacterData* lpMember = 0;
|
||||
for (unsigned long nCount = 0; nCount < lpParty->GetPartyMemNum(); ++nCount)
|
||||
{
|
||||
if (0 == lpParty->IsLoginedByIndex(nCount))
|
||||
{
|
||||
lpMember = static_cast<CCharacterData*>(CCharacterDataMgr::GetInstance().GetLogoutData(PartyInfo.PartyInfo.MemberCID[nCount]));
|
||||
|
||||
if (0 != lpMember)
|
||||
{
|
||||
if (dwPartyID == lpMember->GetPID())
|
||||
{
|
||||
RULLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:10u / <20><>Ƽ <20>Ҹ<EFBFBD> <20><><EFBFBD><EFBFBD> : <20><>Ƽ <20>Ҹ<EFBFBD><D2B8><EFBFBD>, ij<><C4B3> ij<><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> PID<49><44><EFBFBD><EFBFBD>",
|
||||
dwPartyID, PartyInfo.PartyInfo.MemberCID[nCount]);
|
||||
|
||||
lpMember->SetPID(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SendPacket::DeleteParty(lpParty);
|
||||
|
||||
RULLOG1(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / <20><>Ƽ <20>Ҹ<EFBFBD> <20><><EFBFBD><EFBFBD>", dwPartyID);
|
||||
return DeletePartyMap(dwPartyID);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool CPartyDBMgr::InsertPartyMember(CDBComponent& DBComponent, unsigned long dwPartyID, unsigned long dwCharID, unsigned long dwGID,
|
||||
unsigned short wClass, char cLevel)
|
||||
{
|
||||
using namespace DataStorage;
|
||||
|
||||
CSessionData* lpInsertMember = CSessionDataMgr::GetInstance().GetCharLoadedSession(dwCharID);
|
||||
CCharacterData* lpInsertMemberCharData = 0;
|
||||
CPartyDBInfo* lpParty = 0;
|
||||
|
||||
PARTY_DB_INFO PartyInfo = {0,};
|
||||
|
||||
if(0 == lpInsertMember)
|
||||
{
|
||||
ERRLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD> <20><><EFBFBD><EFBFBD> : <20><>Ƽ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>",
|
||||
dwPartyID, dwCharID);
|
||||
|
||||
return false;
|
||||
}
|
||||
else if(0 == (lpParty = OpenParty(DBComponent, dwPartyID)))
|
||||
{
|
||||
ERRLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD> <20><><EFBFBD><EFBFBD> : ij<><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||||
dwPartyID, dwCharID);
|
||||
|
||||
return false;
|
||||
}
|
||||
else if(0 == (lpInsertMemberCharData = lpInsertMember->GetCharacterData()))
|
||||
{
|
||||
ERRLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD> <20><><EFBFBD><EFBFBD> : <20><><EFBFBD>ǿ<EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||||
dwPartyID, dwCharID);
|
||||
|
||||
return false;
|
||||
}
|
||||
else if(!lpParty->InsertPartyMem(lpInsertMember->GetServerID(), dwCharID, wClass, cLevel, dwGID, lpInsertMemberCharData->GetName()))
|
||||
{
|
||||
ERRLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD> <20><><EFBFBD><EFBFBD> : <20><>Ƽ<EFBFBD><C6BC> ij<><C4B3><EFBFBD><EFBFBD> <20>߰<EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||||
dwPartyID, dwCharID);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!lpParty->SerializeOut(PartyInfo.PartyInfo, PartyInfo.PartyUserInfo))
|
||||
{
|
||||
ERRLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD> <20><><EFBFBD><EFBFBD> : <20><>Ƽ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||||
dwPartyID, dwCharID);
|
||||
|
||||
return false;
|
||||
}
|
||||
else if(!DBComponent::GameDB::InsertPartyMember(DBComponent, dwPartyID, &PartyInfo, dwCharID))
|
||||
{
|
||||
ERRLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD> <20><><EFBFBD><EFBFBD> : DB<44><42> InsertPartyMember ȣ<><C8A3> <20><><EFBFBD><EFBFBD>",
|
||||
dwPartyID, dwCharID);
|
||||
|
||||
return false;
|
||||
}
|
||||
else if(!SendPacket::PartyCmd(PktDD::SCmdInsertPartyMem, lpParty->GetPID(), dwCharID, dwGID,
|
||||
wClass, lpInsertMember->GetServerID(), cLevel, lpInsertMemberCharData->GetName()))
|
||||
{
|
||||
ERRLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD> <20><><EFBFBD><EFBFBD> : <20><><EFBFBD>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD><EFBFBD> <20><>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||||
dwPartyID, dwCharID);
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
DETLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20>߰<EFBFBD> <20><><EFBFBD><EFBFBD>", dwPartyID, dwCharID);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CPartyDBMgr::DeletePartyMember(CDBComponent& DBComponent, unsigned long dwPartyID,
|
||||
unsigned long dwCharID, unsigned long dwReference)
|
||||
{
|
||||
CPartyDBInfo* lpParty = OpenParty(DBComponent, dwPartyID);
|
||||
if (0 == lpParty)
|
||||
{
|
||||
ERRLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : <20><>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||||
dwPartyID, dwCharID);
|
||||
|
||||
return false;
|
||||
}
|
||||
else if (MIN_MEMBER_NUM == lpParty->GetPartyMemNum())
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ƽ<EFBFBD><C6BC> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
return DestoryParty(DBComponent, dwPartyID);
|
||||
}
|
||||
|
||||
unsigned long dwServerID = 0;
|
||||
unsigned long dwOldLeader = lpParty->GetLeader();
|
||||
if (!lpParty->DeletePartyMem(dwCharID, dwServerID))
|
||||
{
|
||||
ERRLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : <20><>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||||
dwPartyID, dwCharID);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
DETLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>", dwPartyID, dwCharID);
|
||||
|
||||
PARTY_DB_INFO PartyInfo = {0,};
|
||||
if (!lpParty->SerializeOut(PartyInfo.PartyInfo, PartyInfo.PartyUserInfo))
|
||||
{
|
||||
ERRLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : <20><>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||||
dwPartyID, dwCharID);
|
||||
|
||||
return false;
|
||||
}
|
||||
else if(!DBComponent::GameDB::DeletePartyMember(DBComponent, dwPartyID, &PartyInfo, dwCharID))
|
||||
{
|
||||
ERRLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : DB<44><42> DeletePartyMember ȣ<><C8A3> <20><><EFBFBD><EFBFBD>",
|
||||
dwPartyID, dwCharID);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> üũ
|
||||
unsigned long dwLeader = lpParty->GetLeader();
|
||||
if (dwOldLeader != dwLeader)
|
||||
{
|
||||
// <20><>Ƽ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ٲ<EFBFBD>
|
||||
dwReference = dwLeader;
|
||||
}
|
||||
|
||||
if(!SendPacket::PartyCmd(PktDD::SCmdDeletePartyMem, lpParty->GetPID(), dwCharID, dwReference, 0, 0, 0, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"))
|
||||
{
|
||||
ERRLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : <20><><EFBFBD>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ٲ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||||
dwPartyID, dwCharID);
|
||||
}
|
||||
|
||||
if (0 == dwLeader)
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ƽ<EFBFBD><C6BC> <20>ݴ´<DDB4>.
|
||||
if(CloseParty(DBComponent, dwPartyID))
|
||||
{
|
||||
DETLOG3(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / Leader:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> : <20><>Ƽ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><>Ƽ<EFBFBD><C6BC> <20>ݽ<EFBFBD><DDBD>ϴ<EFBFBD>.",
|
||||
dwPartyID, dwCharID, dwLeader);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPartyDBMgr::AutoRoutingOn(CDBComponent& DBComponent, unsigned long dwPartyID, unsigned long dwCharID)
|
||||
{
|
||||
// CharID <20><> 0 <20≯<EFBFBD> ALL
|
||||
CPartyDBInfo* lpParty = OpenParty(DBComponent, dwPartyID);
|
||||
if (0 == lpParty)
|
||||
{
|
||||
ERRLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ON <20><><EFBFBD><EFBFBD> : <20><>Ƽ<EFBFBD><C6BC> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>",
|
||||
dwPartyID, dwCharID);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!lpParty->AutoRouting(dwCharID, true, (0 == dwCharID) ? true : false))
|
||||
{
|
||||
ERRLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ON <20><><EFBFBD><EFBFBD> : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ѱ<EFBFBD> <20><><EFBFBD><EFBFBD> (CID<49><44> 0<≯<EFBFBD> <20><><EFBFBD><EFBFBD>)",
|
||||
dwPartyID, dwCharID);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendPacket::PartyCmd(PktDD::SCmdAutoRoutingOn, lpParty->GetPID(), dwCharID, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
bool CPartyDBMgr::AutoRoutingOff(CDBComponent& DBComponent, unsigned long dwPartyID, unsigned long dwCharID)
|
||||
{
|
||||
// CharID <20><> 0 <20≯<EFBFBD> ALL
|
||||
CPartyDBInfo* lpParty = OpenParty(DBComponent, dwPartyID);
|
||||
if (0 == lpParty)
|
||||
{
|
||||
ERRLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> OFF <20><><EFBFBD><EFBFBD> : <20><>Ƽ<EFBFBD><C6BC> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>",
|
||||
dwPartyID, dwCharID);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (false == lpParty->AutoRouting(dwCharID, false, (0 == dwCharID) ? true : false))
|
||||
{
|
||||
ERRLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> OFF <20><><EFBFBD><EFBFBD> : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ѱ<EFBFBD> <20><><EFBFBD><EFBFBD> (CID<49><44> 0<≯<EFBFBD> <20><><EFBFBD><EFBFBD>)",
|
||||
dwPartyID, dwCharID);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendPacket::PartyCmd(PktDD::SCmdAutoRoutingOff, lpParty->GetPID(), dwCharID, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
void CPartyDBMgr::LoginPartyMember(CPartyDBInfo* lpParty, unsigned long dwUserID, unsigned long dwCharID, unsigned long dwGID,
|
||||
unsigned short wClass, unsigned long dwServerID, char cLevel)
|
||||
{
|
||||
if (0 == lpParty)
|
||||
{
|
||||
ERRLOG3(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : UID:%10u / CID:%10u / ServerID:0x%08X / "
|
||||
"<EFBFBD><EFBFBD>Ƽ <20><><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1><EFBFBD> <20><><EFBFBD><EFBFBD> : <20><>Ƽ<EFBFBD><C6BC> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>", dwUserID, dwCharID, dwServerID);
|
||||
}
|
||||
else if (!lpParty->IsMember(dwCharID))
|
||||
{
|
||||
ERRLOG4(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / UID:%10u / CID:%10u / ServerID:0x%08X / "
|
||||
"<EFBFBD><EFBFBD>Ƽ <20><><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1><EFBFBD> <20><><EFBFBD><EFBFBD> : <20><>Ƽ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ƴմϴ<D5B4>",
|
||||
lpParty->GetPID(), dwUserID, dwCharID, dwServerID);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned long dwPartyID = lpParty->GetPID();
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> DB<44><42><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> Ȯ<><C8AE>
|
||||
|
||||
using namespace DataStorage;
|
||||
|
||||
CSessionData* lpSessionData = CSessionDataMgr::GetInstance().GetCharLoadedSession(dwCharID);
|
||||
CCharacterData* lpCharacterData = 0;
|
||||
|
||||
if (0 == dwPartyID || 0 == lpSessionData || 0 == (lpCharacterData = lpSessionData->GetCharacterData()))
|
||||
{
|
||||
ERRLOG6(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / UID:%10u / CID:%10u(Session:0x%p/Character:0x%p) / ServerID:0x%08X / "
|
||||
"<EFBFBD><EFBFBD>Ƽ <20><><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1><EFBFBD> <20><><EFBFBD><EFBFBD> : <20><><EFBFBD><EFBFBD> Ȥ<><C8A4> ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>",
|
||||
dwPartyID, dwUserID, dwCharID, lpSessionData, lpCharacterData, dwServerID);
|
||||
}
|
||||
else if (lpCharacterData->GetPID() != dwPartyID)
|
||||
{
|
||||
ERRLOG5(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CharacterDataPID:%10u / UID:%10u / CID:%10u / ServerID:0x%08X / "
|
||||
"<EFBFBD><EFBFBD>Ƽ <20><><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1><EFBFBD> <20><><EFBFBD><EFBFBD> : <20><>û PID<49><44> ij<><C4B3><EFBFBD><EFBFBD> PID<49><44> <20>ٸ<EFBFBD><D9B8>ϴ<EFBFBD>",
|
||||
dwPartyID, lpCharacterData->GetPID(), dwUserID, dwCharID, dwServerID);
|
||||
}
|
||||
else if (!lpParty->PartyMemLogin(dwCharID, dwServerID))
|
||||
{
|
||||
GET_MULTI_DISPATCH(lpGameDispatch, dwServerID,
|
||||
DBAgent::CGameDispatch, DBAgent::CGameDispatch::GetDispatchTable());
|
||||
|
||||
if(0 != lpGameDispatch)
|
||||
{
|
||||
ERRLOG4(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / UID:%10u / CID:%10u / ServerID:0x%08X / "
|
||||
"<EFBFBD><EFBFBD>Ƽ <20><><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1><EFBFBD> <20><><EFBFBD><EFBFBD> : <20><>Ƽ <20>α<EFBFBD><CEB1><EFBFBD> <20><><EFBFBD><EFBFBD>",
|
||||
dwPartyID, dwUserID, dwCharID, dwServerID);
|
||||
|
||||
SendPacket::PartyCmd(lpGameDispatch->GetSendStream(), PktDD::SCmdLoginPartyMem,
|
||||
dwPartyID, dwCharID, dwGID, wClass, dwServerID, cLevel, lpCharacterData->GetName(), 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DETLOG4(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / UID:%10u / CID:%10u / ServerID:0x%08X / "
|
||||
"<EFBFBD><EFBFBD>Ƽ <20><><EFBFBD><EFBFBD> <20>α<EFBFBD><CEB1><EFBFBD> <20><><EFBFBD><EFBFBD>", dwPartyID, dwUserID, dwCharID, dwServerID);
|
||||
|
||||
CPartyDBInfo* lpParty = CPartyDBMgr::GetInstance().OpenParty(CDBSingleObject::GetInstance(), dwPartyID);
|
||||
|
||||
if(lpParty)
|
||||
{
|
||||
// ij<><C4B3><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ //
|
||||
lpParty->SetUserInfoLevel(dwCharID, cLevel);
|
||||
lpParty->SetUserInfoClass(dwCharID, wClass);
|
||||
lpParty->SetUserInfoGID(dwCharID, dwGID);
|
||||
}
|
||||
|
||||
SendPacket::PartyCmd(PktDD::SCmdLoginPartyMem, lpParty->GetPID(),
|
||||
dwCharID, dwGID, wClass, dwServerID, cLevel, lpCharacterData->GetName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPartyDBMgr::LogoutPartyMember(CDBComponent& DBComponent, CPartyDBInfo* lpParty, unsigned long dwCharID)
|
||||
{
|
||||
if (0 == lpParty)
|
||||
{
|
||||
ERRLOG1(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : CID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20>αƿ<D7BE> <20><><EFBFBD><EFBFBD> : <20><>Ƽ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>", dwCharID);
|
||||
}
|
||||
else if (!lpParty->IsMember(dwCharID))
|
||||
{
|
||||
ERRLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20>αƿ<D7BE> <20><><EFBFBD><EFBFBD> : <20><>Ƽ<EFBFBD><C6BC><EFBFBD><EFBFBD> <20>ƴմϴ<D5B4>",
|
||||
lpParty->GetPID(), dwCharID);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned long dwPartyID = lpParty->GetPID();
|
||||
unsigned long dwOldLeader = lpParty->GetLeader();
|
||||
|
||||
if (!lpParty->PartyMemLogout(dwCharID))
|
||||
{
|
||||
ERRLOG2(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20>αƿ<D7BE> <20><><EFBFBD><EFBFBD> : <20><><EFBFBD><EFBFBD> <20>αƿ<D7BE> <20><><EFBFBD><EFBFBD>",
|
||||
dwPartyID, dwCharID);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned long dwLeader = lpParty->GetLeader();
|
||||
unsigned long dwReference = 0;
|
||||
if (dwOldLeader != dwLeader)
|
||||
{
|
||||
dwReference = dwLeader;
|
||||
}
|
||||
|
||||
DETLOG3(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / NewLeader:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20>αƿ<D7BE> <20><><EFBFBD><EFBFBD>",
|
||||
dwPartyID, dwCharID, dwReference);
|
||||
|
||||
SendPacket::PartyCmd(PktDD::SCmdLogoutPartyMem, lpParty->GetPID(), dwCharID, dwReference, 0, 0, 0, 0);
|
||||
|
||||
if (0 == dwLeader)
|
||||
{
|
||||
// <20><>Ƽ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><>Ƽ<EFBFBD><C6BC> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.
|
||||
if(CloseParty(DBComponent, dwPartyID))
|
||||
{
|
||||
DETLOG3(g_Log, "<EFBFBD><EFBFBD>Ƽ <20>α<EFBFBD> : PID:%10u / CID:%10u / Leader:%10u / <20><>Ƽ <20><><EFBFBD><EFBFBD> <20>αƿ<D7BE> : <20><>Ƽ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><>Ƽ<EFBFBD><C6BC> <20>ݽ<EFBFBD><DDBD>ϴ<EFBFBD>.",
|
||||
dwPartyID, dwCharID, dwLeader);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPartyDBMgr::SendToGameServerPartyData(CSendStream& SendStream)
|
||||
{
|
||||
// <20><>Ƽ<EFBFBD><C6BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD>. //]
|
||||
PartyMap::iterator start = m_PartyMap.begin();
|
||||
PartyMap::iterator end = m_PartyMap.end();
|
||||
|
||||
for(; start!=end; ++start)
|
||||
{
|
||||
// <20><>Ƽ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD> //
|
||||
CPartyDBInfo* lpPartyDBInfo = start->second;
|
||||
|
||||
if(lpPartyDBInfo)
|
||||
{
|
||||
// <20><>Ƽ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //
|
||||
|
||||
PARTY sParty = lpPartyDBInfo->GetParty();
|
||||
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktPIDAck));
|
||||
|
||||
PktPIDAck* lppktPIDAck = reinterpret_cast<PktPIDAck*>(lpBuffer);
|
||||
|
||||
memset(lppktPIDAck, 0, sizeof(PktPIDAck));
|
||||
|
||||
lppktPIDAck->m_wCmd = PktDD::SCmdGetPartyInfo;
|
||||
lppktPIDAck->m_Party = lpPartyDBInfo->GetParty();
|
||||
|
||||
SendStream.WrapHeader(sizeof(PktPIDAck), CmdAgentParty, 0, PktPMD::NO_SERVER_ERR);
|
||||
|
||||
// <20><>Ƽ<EFBFBD><C6BC> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //
|
||||
PARTY_USERINFO sPartyUserInfo = lpPartyDBInfo->GetPartyUserInfo();
|
||||
|
||||
for(unsigned char cIndex = 0; cIndex < PARTY::MAX_MEM; cIndex++)
|
||||
{
|
||||
// <20>ٸ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ӵǾ<D3B5><C7BE>ִ<EFBFBD> ij<><C4B3><EFBFBD><EFBFBD> //
|
||||
if(sParty.MemberCID[cIndex] && sParty.ServerID[cIndex])
|
||||
{
|
||||
char* lpBuffer = SendStream.GetBuffer(sizeof(PktPMD));
|
||||
|
||||
if(0 != lpBuffer)
|
||||
{
|
||||
PktPMD* lpPktPMD = reinterpret_cast<PktPMD*>(lpBuffer);
|
||||
|
||||
lpPktPMD->m_wCmd = PktDD::SCmdLoginPartyMem;
|
||||
lpPktPMD->m_dwPartyID = sParty.m_dwPartyID;
|
||||
lpPktPMD->m_dwSenderID = sParty.MemberCID[cIndex];
|
||||
lpPktPMD->m_dwGID = sPartyUserInfo.m_dwGID[cIndex];
|
||||
lpPktPMD->m_wClass = sParty.m_wClass[cIndex];
|
||||
lpPktPMD->m_dwServerID = sParty.ServerID[cIndex];
|
||||
lpPktPMD->m_cLevel = sParty.m_cLevel[cIndex];
|
||||
|
||||
if(sParty.Name[cIndex])
|
||||
{
|
||||
strncpy(lpPktPMD->m_strSenderName, sParty.Name[cIndex], CHAR_INFOST::MAX_NAME_LEN);
|
||||
lpPktPMD->m_strSenderName[CHAR_INFOST::MAX_NAME_LEN - 1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(lpPktPMD->m_strSenderName, 0, sizeof(char) * CHAR_INFOST::MAX_NAME_LEN);
|
||||
}
|
||||
|
||||
SendStream.WrapHeader(sizeof(PktPMD), CmdAgentParty, 0, PktPMD::NO_SERVER_ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
#ifndef _RYL_DBAGENT_PARTY_DB_MGR_H_
|
||||
#define _RYL_DBAGENT_PARTY_DB_MGR_H_
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <boost/pool/pool_alloc.hpp>
|
||||
#include <boost/pool/pool.hpp>
|
||||
|
||||
// forward decl.
|
||||
class CDBComponent;
|
||||
class CSendStream;
|
||||
|
||||
namespace DBAgent
|
||||
{
|
||||
|
||||
// forward delc.
|
||||
class CPartyDBInfo;
|
||||
|
||||
class CPartyDBMgr
|
||||
{
|
||||
public:
|
||||
|
||||
static CPartyDBMgr& GetInstance();
|
||||
|
||||
CPartyDBInfo* OpenParty(CDBComponent& DBComponent, unsigned long dwPartyID);
|
||||
bool CloseParty(CDBComponent& DBComponent, unsigned long dwPartyID);
|
||||
|
||||
CPartyDBInfo* CreateParty(CDBComponent& DBComponent, unsigned long dwLeaderID, char cLeaderLevel, unsigned short wLeaderClass, unsigned long dwLeaderGID,
|
||||
unsigned long dwMemberID, char cMemberLevel, unsigned short wMemberClass, unsigned long dwMemberGID);
|
||||
|
||||
bool DestoryParty(CDBComponent& DBComponent, unsigned long dwPartyID);
|
||||
|
||||
bool InsertPartyMember(CDBComponent& DBComponent, unsigned long dwPartyID, unsigned long dwCharID, unsigned long dwGID,
|
||||
unsigned short wClass, char cLevel);
|
||||
|
||||
bool DeletePartyMember(CDBComponent& DBComponent, unsigned long dwPartyID,
|
||||
unsigned long dwCharID, unsigned long dwReference);
|
||||
|
||||
bool AutoRoutingOn(CDBComponent& DBComponent, unsigned long dwPartyID, unsigned long dwCharID);
|
||||
bool AutoRoutingOff(CDBComponent& DBComponent, unsigned long dwPartyID, unsigned long dwCharID);
|
||||
|
||||
bool InsertPartyMap(unsigned long dwPartyID, CPartyDBInfo* lpParty);
|
||||
bool DeletePartyMap(unsigned long dwPartyID);
|
||||
CPartyDBInfo* FindPartyMap(unsigned long dwPartyID_In);
|
||||
|
||||
void LoginPartyMember(CPartyDBInfo* lpParty, unsigned long dwUserID, unsigned long dwCharID, unsigned long dwGID,
|
||||
unsigned short wClass, unsigned long dwServerID, char cLevel);
|
||||
|
||||
void LogoutPartyMember(CDBComponent& DBComponent, CPartyDBInfo* lpParty, unsigned long dwCharID);
|
||||
|
||||
void SendToGameServerPartyData(CSendStream& SendStream);
|
||||
|
||||
private:
|
||||
|
||||
CPartyDBMgr();
|
||||
~CPartyDBMgr();
|
||||
|
||||
CPartyDBInfo* CreatePartyDBInfo(unsigned long dwPID);
|
||||
void DeletePartyDBInfo(CPartyDBInfo* lpPartyDBInfo);
|
||||
|
||||
enum Const
|
||||
{
|
||||
MIN_MEMBER_NUM = 2
|
||||
};
|
||||
|
||||
typedef std::map<unsigned long, CPartyDBInfo*, std::less<unsigned long>,
|
||||
boost::fast_pool_allocator<std::pair<unsigned long, CPartyDBInfo*> > > PartyMap;
|
||||
|
||||
PartyMap m_PartyMap;
|
||||
boost::pool<> m_PartyDBPool;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user