Esempio n. 1
0
void CGameSocket::RecvGateOpen(Packet & pkt)
{
	uint16 nid;
	bool byGateOpen;

	pkt >> nid >> byGateOpen;
	if (nid < NPC_BAND)	
	{
		TRACE("####   RecvGateOpen()  nid Fail --> nid = %d  ####\n", nid);
		return;
	}

	CNpc* pNpc = g_pMain->m_arNpc.GetData(nid);
	if (pNpc == nullptr)		
		return;

	if (!pNpc->isGate()) 
	{
		TRACE("####   RecvGateOpen()  NpcType Fail --> type = %d  ####\n", pNpc->GetType());
		return;
	}

	pNpc->m_byGateOpen = byGateOpen;
	TRACE("****  RecvGateOpen()---> nid = %d, byGateOpen = %d  ******\n", nid, byGateOpen);
}
Esempio n. 2
0
void CAISocket::RecvGateOpen( char* pBuf )
{
	int index = 0, nNid = 0, nSid = 0, nGateFlag = 0;
	CNpc* pNpc = NULL;
	_OBJECT_EVENT* pEvent = NULL;

	nNid = GetShort(pBuf, index);
	nSid = GetShort(pBuf, index);
	nGateFlag = GetByte(pBuf, index);

	pNpc = m_pMain->m_arNpcArray.GetData(nNid);
	if (pNpc == NULL)	
	{
		TRACE("#### RecvGateOpen Npc Pointer null : nid=%d ####\n", nNid);
		return;
	}

	pNpc->m_byGateOpen = nGateFlag; // possibly not needed (we'll do it below), but need to make sure.

	pEvent = pNpc->GetMap()->GetObjectEvent(nSid);
	if (pEvent == NULL)	
	{
		TRACE("#### RecvGateOpen Npc Object fail : nid=%d, sid=%d ####\n", nNid, nSid);
		return;
	}

	//TRACE("---> RecvGateOpen Npc Object fail : nid=%d, sid=%d, nGateFlag = %d ####\n", nNid, nSid, nGateFlag);
	if (pNpc->isGate())
		pNpc->SendGateFlag(nGateFlag, false);
}