初步修复
This commit is contained in:
parent
8fc4357cc6
commit
e4714f3f0e
46705 changed files with 12004901 additions and 0 deletions
112
Server/DNGameServer/DNGuildTask.cpp
Normal file
112
Server/DNGameServer/DNGuildTask.cpp
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
#include "stdafx.h"
|
||||
#include "DNGuildTask.h"
|
||||
#include "GameSendPacket.h"
|
||||
#include "DnPlayerActor.h"
|
||||
#include "DNUserSession.h"
|
||||
#include "DNLogConnection.h"
|
||||
#include "DNMasterConnectionManager.h"
|
||||
#include "DNLogConnection.h"
|
||||
#include "DNUserSession.h"
|
||||
#include "DNGameDataManager.h"
|
||||
#include "TaskManager.h"
|
||||
#include "DnGameTask.h"
|
||||
#include "DNDBConnectionManager.h"
|
||||
#include "DNGuildSystem.h"
|
||||
#include "DnDbConnection.h"
|
||||
#include "DnDbConnectionManager.h"
|
||||
|
||||
CDnGuildTask::CDnGuildTask(CDNGameRoom * pRoom) : CTask(pRoom), CMultiSingleton<CDnGuildTask, MAX_SESSION_COUNT>( pRoom ) /*, m_pEmblemFactory( new CDnEmblemFactory )*/
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CDnGuildTask::~CDnGuildTask()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CDnGuildTask::Initialize()
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CDnGuildTask::Process(LOCAL_TIME LocalTime, float fDelta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int CDnGuildTask::OnDispatchMessage(CDNUserSession * pSession, int nMainCmd, int nSubCmd, char *pData, int nLen)
|
||||
{
|
||||
switch( nMainCmd ) {
|
||||
case CS_GUILD: return OnRecvGuildMessage( pSession, nSubCmd, pData, nLen );
|
||||
}
|
||||
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
int CDnGuildTask::OnRecvGuildMessage(CDNUserSession * pSession, int nSubCmd, char *pData, int nLen)
|
||||
{
|
||||
switch( nSubCmd )
|
||||
{
|
||||
case eGuild::CS_GETGUILDINFO:
|
||||
{
|
||||
if (sizeof(CSGetGuildInfo) != nLen)
|
||||
return ERROR_INVALIDPACKET;
|
||||
|
||||
g_pGuildManager->OnRecvCsGetGuildInfo(pSession, reinterpret_cast<CSGetGuildInfo*>(pData));
|
||||
}
|
||||
return ERROR_NONE;
|
||||
case eGuild::CS_PLAYER_REQUEST_GUILDINFO:
|
||||
{
|
||||
const CSPlayerGuildInfo *pPacket = reinterpret_cast<CSPlayerGuildInfo*>(pData);
|
||||
|
||||
if (sizeof(CSPlayerGuildInfo) != nLen)
|
||||
return ERROR_INVALIDPACKET;
|
||||
|
||||
CDNUserSession *pUserObj = pSession->GetGameRoom()->GetUserSession(pPacket->nSessionID);
|
||||
|
||||
if( !pUserObj )
|
||||
{
|
||||
pSession->SendPlayerGuildInfo( ERROR_GENERIC_INVALIDREQUEST, 0, NULL, NULL, 0, 0, 0, NULL );
|
||||
return ERROR_GENERIC_INVALIDREQUEST;
|
||||
}
|
||||
|
||||
const TGuildUID GuildUID = pUserObj->GetGuildUID();
|
||||
if (!GuildUID.IsSet())
|
||||
{
|
||||
pSession->SendPlayerGuildInfo( ERROR_NONE, pUserObj->GetSessionID(), NULL, NULL, 0, 0, 0, NULL );
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
CDNGuildBase* pGuild = g_pGuildManager->At(GuildUID);
|
||||
|
||||
if (!pGuild)
|
||||
{
|
||||
pSession->SendPlayerGuildInfo( ERROR_NONE, pUserObj->GetSessionID(), NULL, NULL, 0, 0, 0, NULL );
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
#if !defined( PRE_ADD_NODELETEGUILD )
|
||||
CDetachAutoEx<CDNGuildBase> AutoDetach(pGuild);
|
||||
if (FALSE == pGuild->IsEnable())
|
||||
{
|
||||
pSession->SendPlayerGuildInfo( ERROR_NONE, pUserObj->GetSessionID(), NULL, NULL, 0, 0, 0, NULL );
|
||||
return ERROR_NONE;
|
||||
}
|
||||
#endif
|
||||
|
||||
TGuildMember *GuildMaster = pGuild->GetGuildMaster();
|
||||
if( GuildMaster )
|
||||
pSession->SendPlayerGuildInfo( ERROR_NONE, pUserObj->GetSessionID(), pGuild->GetInfo()->GuildView.wszGuildName, GuildMaster->wszCharacterName, pGuild->GetLevel(), pGuild->GetMemberCount(), pGuild->GetGuildMemberSize(), pGuild->GetGuildRewardItem() );
|
||||
else
|
||||
pSession->SendPlayerGuildInfo( ERROR_NONE, pUserObj->GetSessionID(), pGuild->GetInfo()->GuildView.wszGuildName, NULL, pGuild->GetLevel(), pGuild->GetMemberCount(), pGuild->GetGuildMemberSize(), pGuild->GetGuildRewardItem() );
|
||||
|
||||
return ERROR_NONE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return ERROR_UNKNOWN_HEADER; // 상위에서 리턴이 되지 않았다면 진짜 처리 않하는 패킷 수신이 된 것임
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue