void CUser::PartyProcess(char *pBuf)
{
	int index = 0, idlength = 0, memberid = -1;
	char strid[MAX_ID_SIZE+1]; memset( strid, 0x00, MAX_ID_SIZE+1 );
	BYTE subcommand, result;
	CUser* pUser = NULL;

	subcommand = GetByte( pBuf, index );
	switch( subcommand ) {
	case PARTY_CREATE:
		idlength = GetShort( pBuf, index );
		if (idlength <= 0 || idlength > MAX_ID_SIZE) return ;
		GetString( strid, pBuf, idlength, index );
		pUser = m_pMain->GetUserPtr(strid, TYPE_CHARACTER);
		if( pUser ) {
			memberid = pUser->GetSocketID();
			PartyRequest( memberid, TRUE );
		}
		break;
	case PARTY_PERMIT:
		result = GetByte( pBuf, index );
		if( result ) 
			PartyInsert();
		else							
			PartyCancel();
		break;
	case PARTY_INSERT:
		idlength = GetShort( pBuf, index );
		if (idlength <= 0 || idlength > MAX_ID_SIZE) return ;
		GetString( strid, pBuf, idlength, index );
		pUser = m_pMain->GetUserPtr(strid, TYPE_CHARACTER);
		if( pUser ) {
			memberid = pUser->GetSocketID();
			PartyRequest( memberid, FALSE );
		}
		break;
	case PARTY_REMOVE:
		memberid = GetShort( pBuf, index );
		PartyRemove( memberid );
		break;
	case PARTY_DELETE:
		PartyDelete();
		break;
	}
}
Beispiel #2
0
void CParty::PartyProcess(Packet & pkt)
{
	uint8 opcode = pkt.read<uint8>();
	switch (opcode)
	{
	case PARTY_CREATE:
		PartyCreate(pkt);
		break;
	case PARTY_INSERT:
		PartyInsert(pkt);
		break;
	case PARTY_REMOVE:
		PartyRemove(pkt);
		break;
	case PARTY_DELETE:
		PartyDelete(pkt);
		break;
	}
}