Пример #1
0
// ---------------------------------------------------------
bool CPartyDef::SendAddList( CChar *pCharDest )
{
	ADDTOCALLSTACK("CPartyDef::SendAddList");

	if ( m_Chars.GetCharCount() <= 0 )
		return false;

	PacketPartyList cmd(&m_Chars);
	if (pCharDest)
		SendMemberMsg(pCharDest, &cmd);
	else
		SendAll(&cmd);

	return true;
}
Пример #2
0
void CPartyDef::SendAll( PacketSend * pPacket )
{
	ADDTOCALLSTACK("CPartyDef::SendAll");
	// Send this to all members of the party.
	size_t iQty = m_Chars.GetCharCount();
	for ( size_t i = 0; i < iQty; i++ )
	{
		CChar * pChar = m_Chars.GetChar(i).CharFind();
		ASSERT(pChar);
		if ( ! SendMemberMsg( pChar, pPacket ))
		{
			iQty--;
			i--;
		}
	}
}
Пример #3
0
// ---------------------------------------------------------
bool CPartyDef::MessageEvent( CGrayUID uidDst, CGrayUID uidSrc, const NCHAR * pText, int ilenmsg )
{
	ADDTOCALLSTACK("CPartyDef::MessageEvent");
	UNREFERENCED_PARAMETER(ilenmsg);
	if ( pText == NULL )
		return( false );

	if ( uidDst && !IsInParty( uidDst.CharFind() ) )
		return( false );

	CChar * pFrom = uidSrc.CharFind();
	CChar * pTo = NULL;
	if ( uidDst != (DWORD) 0 )
		pTo = uidDst.CharFind();

	TCHAR * szText = Str_GetTemp();
	CvtNUNICODEToSystem( szText, MAX_TALK_BUFFER, pText, MAX_TALK_BUFFER );

	if ( ! m_pSpeechFunction.IsEmpty() )
	{
		TRIGRET_TYPE tr = TRIGRET_RET_FALSE;
		CScriptTriggerArgs Args;
		Args.m_iN1 = uidSrc;
		Args.m_iN2 = uidDst;
		Args.m_s1 = szText;
		Args.m_s1_raw = szText;

		if ( r_Call(m_pSpeechFunction, &g_Serv, &Args, NULL, &tr) )
		{
			if ( tr == TRIGRET_RET_TRUE )
				return( false );
		}
	}

	if ( g_Log.IsLoggedMask( LOGM_PLAYER_SPEAK ))
		g_Log.Event( LOGM_PLAYER_SPEAK, "%lx:'%s' Says '%s' in party to '%s'\n", pFrom->GetClient()->GetSocketID(), pFrom->GetName(), szText, pTo ? pTo->GetName() : "all" );

	sprintf(szText, g_Cfg.GetDefaultMsg( DEFMSG_PARTY_MSG ), pText);
	PacketPartyChat cmd(pFrom, pText);

	if ( pTo != NULL )
		SendMemberMsg(pTo, &cmd);
	else
		SendAll(&cmd);

	return( true );
}
Пример #4
0
bool CPartyDef::SendRemoveList( CChar *pCharRemove, bool bFor )
{
	ADDTOCALLSTACK("CPartyDef::SendRemoveList");

	if ( bFor )
	{
		PacketPartyRemoveMember cmd(pCharRemove, NULL);
		SendMemberMsg(pCharRemove, &cmd);
	}
	else
	{
		if ( m_Chars.GetCharCount() <= 0 )
			return false;

		PacketPartyRemoveMember cmd(pCharRemove, &m_Chars);
		SendAll(&cmd);
	}

	return true;
}
Пример #5
0
void CPartyDef::SendAll( PacketSend *pPacket )
{
	ADDTOCALLSTACK("CPartyDef::SendAll");
	// Send this to all party members.
	size_t iQty = m_Chars.GetCharCount();
	if ( iQty <= 0 )
		return;

	CChar *pChar = NULL;
	for ( size_t i = 0; i < iQty; i++ )
	{
		pChar = m_Chars.GetChar(i).CharFind();
		if ( !pChar )
			continue;
		if ( !SendMemberMsg(pChar, pPacket) )
		{
			iQty--;
			i--;
		}
	}
}