⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 handler_fromguildserver.cpp

📁 奇迹世界data 服务器代码,研究游戏的朋友有帮助
💻 CPP
📖 第 1 页 / 共 2 页
字号:
	CreateGuildQuery::FREE(pQResult); pQResult = NULL;
}

Handler_FromGuildServer_IMPL( DZ_GUILD_DESTROY_SYN )
{
	MSG_DZ_GUILD_DESTROY_SYN * pRecvMsg = (MSG_DZ_GUILD_DESTROY_SYN *)pMsg;

	TCHAR szQueryBuff[64];
	_sntprintf( szQueryBuff, sizeof(szQueryBuff), 
		"{?=call S_Guild_DestroyDel(%d, %d)}",
		pRecvMsg->m_GuildGuid, pRecvMsg->m_MasterCharGuid );

	DestroyGuildQuery * pQuery = DestroyGuildQuery::ALLOC();
	pQuery->SetGuildGuid( pRecvMsg->m_GuildGuid );
	pQuery->SetUserKey( pRecvMsg->m_dwKey );
	pQuery->SetSessionIndex( pRecvMsg->m_dwSessionIndex );

	pQuery->SetQuery(szQueryBuff);
	pQuery->SetIndex( MAKEDWORD( (WORD)DZ_GUILD, (WORD)DZ_GUILD_DESTROY_DBR ) );
	pQuery->SetVoidObject( pServerSession );
	pServerSession->DBQuery( pQuery );
}

Handler_FromGuildServer_IMPL( DZ_GUILD_DESTROY_DBR )
{
	MSG_DBPROXY_RESULT * pResult	= (MSG_DBPROXY_RESULT *)pMsg;
	DestroyGuildQuery * pQResult	= (DestroyGuildQuery *)pResult->m_pData;

	if( !pQResult->ResultSuccess() )
	{
		MSG_DZ_GUILD_DESTROY_NAK nmsg;
		nmsg.m_dwKey			= pQResult->GetUserKey();
		nmsg.m_dwSessionIndex	= pQResult->GetSessionIndex();
		nmsg.m_byErrorCode		= 0;
		nmsg.m_GuildGuid		= pQResult->GetGuildGuid();
		pServerSession->SendPacket( &nmsg, sizeof(nmsg) );
		DestroyGuildQuery::FREE(pQResult); pQResult = NULL;
		return;
	}

	MSG_DZ_GUILD_DESTROY_ACK msg;
	msg.m_dwKey				= pQResult->GetUserKey();
	msg.m_dwSessionIndex	= pQResult->GetSessionIndex();
	msg.m_GuildGuid			= pQResult->GetGuildGuid();
	pServerSession->SendPacket( &msg, sizeof(msg) );

	DestroyGuildQuery::FREE(pQResult); pQResult = NULL;
}

Handler_FromGuildServer_IMPL( DZ_GUILD_JOIN_SYN )
{
	MSG_DZ_GUILD_JOIN_SYN * pRecvMsg = (MSG_DZ_GUILD_JOIN_SYN *)pMsg;


	TCHAR tszTmpCharName[MAX_CHARNAME_LENGTH+1];
	memcpy( tszTmpCharName, pRecvMsg->m_tszCharName, MAX_CHARNAME_LENGTH*sizeof(TCHAR) );
	tszTmpCharName[MAX_CHARNAME_LENGTH] = '\0';

	TCHAR szQueryBuff[64];
	_sntprintf( szQueryBuff, sizeof(szQueryBuff), 
		"{?=call S_Guild_JoinMember(%d,%d,%d,'%s')}",
		pRecvMsg->m_GuildGuid, pRecvMsg->m_MasterCharGuid, pRecvMsg->m_CharGuid, tszTmpCharName );

	JoinGuildMemberQuery * pQuery = JoinGuildMemberQuery::ALLOC();
	pQuery->SetGuildGuid( pRecvMsg->m_GuildGuid );
	pQuery->SetCharGuid( pRecvMsg->m_CharGuid );
	pQuery->SetUserKey( pRecvMsg->m_dwKey );
	pQuery->SetSessionIndex( pRecvMsg->m_dwSessionIndex );

	pQuery->SetQuery(szQueryBuff);
	pQuery->SetIndex( MAKEDWORD( (WORD)DZ_GUILD, (WORD)DZ_GUILD_JOIN_DBR ) );
	pQuery->SetVoidObject( pServerSession );
	pServerSession->DBQuery( pQuery );
}

Handler_FromGuildServer_IMPL( DZ_GUILD_JOIN_DBR )
{
	MSG_DBPROXY_RESULT * pResult	= (MSG_DBPROXY_RESULT *)pMsg;
	JoinGuildMemberQuery * pQResult	= (JoinGuildMemberQuery *)pResult->m_pData;

	if( pQResult->ResultCode() != JoinGuildMemberQuery::RETURNCODE_SUCCESS )
	{
		MSG_DZ_GUILD_JOIN_NAK nmsg;
		nmsg.m_dwKey			= pQResult->GetUserKey();
		nmsg.m_dwSessionIndex	= pQResult->GetSessionIndex();
		nmsg.m_GuildGuid		= pQResult->GetGuildGuid();
		nmsg.m_CharGuid			= pQResult->GetCharGuid();
		nmsg.m_byErrorCode		= pQResult->ResultCode();
		pServerSession->SendPacket( &nmsg, sizeof(nmsg) );
		JoinGuildMemberQuery::FREE(pQResult); pQResult = NULL;
		return;
	}

	MSG_DZ_GUILD_JOIN_ACK msg;
	msg.m_dwKey				= pQResult->GetUserKey();
	msg.m_dwSessionIndex	= pQResult->GetSessionIndex();
	msg.m_GuildGuid			= pQResult->GetGuildGuid();
	msg.m_CharGuid			= pQResult->GetCharGuid();
	memcpy(msg.m_tszCharName, pQResult->GetCharName(), MAX_CHARNAME_LENGTH*sizeof(TCHAR));
	pServerSession->SendPacket( &msg, sizeof(msg) );

	JoinGuildMemberQuery::FREE(pQResult); pQResult = NULL;
}

Handler_FromGuildServer_IMPL( DZ_GUILD_WITHDRAW_SYN )
{
	MSG_DZ_GUILD_WITHDRAW_SYN * pRecvMsg = (MSG_DZ_GUILD_WITHDRAW_SYN *)pMsg;

	TCHAR szQueryBuff[64];
	_sntprintf( szQueryBuff, sizeof(szQueryBuff), 
		"{?=call S_Guild_WithdrawMember(%d, %d)}",
		pRecvMsg->m_GuildGuid, pRecvMsg->m_CharGuid );

	WithdrawGuildMemberQuery * pQuery = WithdrawGuildMemberQuery::ALLOC();
	pQuery->SetGuildGuid( pRecvMsg->m_GuildGuid );
	pQuery->SetCharGuid( pRecvMsg->m_CharGuid );
	pQuery->SetUserKey( pRecvMsg->m_dwKey );
	pQuery->SetSessionIndex( pRecvMsg->m_dwSessionIndex );

	pQuery->SetQuery(szQueryBuff);
	pQuery->SetIndex( MAKEDWORD( (WORD)DZ_GUILD, (WORD)DZ_GUILD_WITHDRAW_DBR ) );
	pQuery->SetVoidObject( pServerSession );
	pServerSession->DBQuery( pQuery );
}

Handler_FromGuildServer_IMPL( DZ_GUILD_WITHDRAW_DBR )
{
	MSG_DBPROXY_RESULT * pResult		= (MSG_DBPROXY_RESULT *)pMsg;
	WithdrawGuildMemberQuery * pQResult	= (WithdrawGuildMemberQuery *)pResult->m_pData;

	if( !pQResult->ResultSuccess() )
	{
		MSG_DZ_GUILD_WITHDRAW_NAK nmsg;
		nmsg.m_dwKey			= pQResult->GetUserKey();
		nmsg.m_dwSessionIndex	= pQResult->GetSessionIndex();
		nmsg.m_GuildGuid		= pQResult->GetGuildGuid();
		nmsg.m_CharGuid			= pQResult->GetCharGuid();
		nmsg.m_byErrorCode		= 1;
		pServerSession->SendPacket( &nmsg, sizeof(nmsg) );
		WithdrawGuildMemberQuery::FREE(pQResult); pQResult = NULL;
		return;
	}

	MSG_DZ_GUILD_WITHDRAW_ACK msg;
	msg.m_dwKey				= pQResult->GetUserKey();
	msg.m_dwSessionIndex	= pQResult->GetSessionIndex();
	msg.m_GuildGuid			= pQResult->GetGuildGuid();
	msg.m_CharGuid			= pQResult->GetCharGuid();
	pServerSession->SendPacket( &msg, sizeof(msg) );

	WithdrawGuildMemberQuery::FREE(pQResult); pQResult = NULL;
}

Handler_FromGuildServer_IMPL( DZ_GUILD_CHANGE_POSITION_SYN )
{
	MSG_DZ_GUILD_CHANGE_POSITION_SYN * pRecvMsg = (MSG_DZ_GUILD_CHANGE_POSITION_SYN *)pMsg;

	TCHAR szQueryBuff[64];
	_sntprintf( szQueryBuff, sizeof(szQueryBuff), 
		"{?=call S_Guild_ChangeMemberPosition(%d, %d, %d)}",
		pRecvMsg->m_GuildGuid, pRecvMsg->m_CharGuid, pRecvMsg->m_Position );

	ChangeGuildPositionQuery * pQuery = ChangeGuildPositionQuery::ALLOC();
	pQuery->SetGuildGuid( pRecvMsg->m_GuildGuid );
	pQuery->SetUserKey( pRecvMsg->m_dwKey );
	pQuery->SetSessionIndex( pRecvMsg->m_dwSessionIndex );

	pQuery->SetQuery(szQueryBuff);
	pQuery->SetIndex( MAKEDWORD( (WORD)DZ_GUILD, (WORD)DZ_GUILD_CHANGE_POSITION_DBR ) );
	pQuery->SetVoidObject( pServerSession );
	pServerSession->DBQuery( pQuery );
}


Handler_FromGuildServer_IMPL( DZ_GUILD_CHANGE_POSITION_DBR )
{
	MSG_DBPROXY_RESULT * pResult		= (MSG_DBPROXY_RESULT *)pMsg;
	ChangeGuildPositionQuery * pQResult	= (ChangeGuildPositionQuery *)pResult->m_pData;

	if( !pQResult->ResultSuccess() )
	{
		MSG_DZ_GUILD_CHANGE_POSITION_NAK nmsg;
		nmsg.m_dwKey			= pQResult->GetUserKey();
		nmsg.m_dwSessionIndex	= pQResult->GetSessionIndex();
		nmsg.m_byErrorCode		= 0;
		pServerSession->SendPacket( &nmsg, sizeof(nmsg) );
		ChangeGuildPositionQuery::FREE(pQResult); pQResult = NULL;
		return;
	}

	MSG_DZ_GUILD_CHANGE_POSITION_ACK msg;
	msg.m_dwKey				= pQResult->GetUserKey();
	msg.m_dwSessionIndex	= pQResult->GetSessionIndex();
	msg.m_GuildGuid			= pQResult->GetGuildGuid();
	//msg.m_CharGuid = ;
	//msg.m_Position = ;
	pServerSession->SendPacket( &msg, sizeof(msg) );

	ChangeGuildPositionQuery::FREE(pQResult); pQResult = NULL;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -