Example #1
0
CChatChanMember::~CChatChanMember()
{
	if ( IsChatActive()) // Are we chatting currently ?
	{
		g_Serv.m_Chats.QuitChat(this);
	}
}
Example #2
0
void CClient::CharDisconnect()
{
	ADDTOCALLSTACK("CClient::CharDisconnect");
	// Disconnect the CChar from the client.
	// Even tho the CClient might stay active.
	if ( !m_pChar )
		return;

	Announce(false);
	bool bCanInstaLogOut = CanInstantLogOut();
	int	iLingerTime = g_Cfg.m_iClientLingerTime;

	//	we are not a client anymore
	if ( IsChatActive() )
		g_Serv.m_Chats.QuitChat(this);

	if ( m_pHouseDesign )
		m_pHouseDesign->EndCustomize(true);

	if ( IsTrigUsed(TRIGGER_LOGOUT) )
	{
		CScriptTriggerArgs Args(iLingerTime, bCanInstaLogOut);
		m_pChar->OnTrigger(CTRIG_LogOut, m_pChar, &Args);
		iLingerTime = static_cast<int>(Args.m_iN1);
		bCanInstaLogOut = (Args.m_iN2 != 0);
	}

	m_pChar->ClientDetach();	// we are not a client any more.

	if ( iLingerTime <= 0 )
		bCanInstaLogOut = true;

	// Gump memory cleanup, we don't want them on logged out players
	m_mapOpenedGumps.clear();

	// Layer dragging, moving it to backpack
	CItem *pItemDragging = m_pChar->LayerFind(LAYER_DRAGGING);
	if ( pItemDragging )
		m_pChar->ItemBounce(pItemDragging);

	// log out immediately ? (test before ClientDetach())
	if ( !bCanInstaLogOut )
	{
		// become an NPC for a little while
		CItem *pItemChange = CItem::CreateBase(ITEMID_RHAND_POINT_W);
		ASSERT(pItemChange);
		pItemChange->SetName("Client Linger");
		pItemChange->SetType(IT_EQ_CLIENT_LINGER);
		pItemChange->SetTimeout(iLingerTime);
		m_pChar->LayerAdd(pItemChange, LAYER_FLAG_ClientLinger);
	}
	else
	{
		// remove me from other clients screens now.
		m_pChar->SetDisconnected();
	}

	m_pChar = NULL;
}
Example #3
0
void CChatChanMember::SetChatActive()
{
	ADDTOCALLSTACK("CChatChanMember::SetChatActive");
	// called from Event_ChatButton
	if ( IsChatActive() )
		return;

	CClient * pClient = GetClient();
	if ( pClient )
	{
		m_fChatActive = true;

		// Tell the client to open the chat window dialog
		pClient->addChatSystemMessage( CHATMSG_OpenChatWindow, GetChatName() );

		// Send all existing channel names to this client
		const CChatChannel *pChannel = g_Serv.m_Chats.GetFirstChannel();
		for ( ; pChannel != NULL; pChannel = pChannel->GetNext() )
		{
			pClient->addChatSystemMessage(CHATMSG_SendChannelName, pChannel->GetName(), pChannel->GetModeString());
		}
	}
}