Example #1
0
bool CGameSocket::HandlePacket(Packet & pkt)
{
	switch (pkt.GetOpcode())
	{
	case AI_SERVER_CONNECT:
		RecvServerConnect(pkt);
		break;
	case AG_USER_INFO:
		RecvUserInfo(pkt);
		break;
	case AG_USER_INOUT:
		RecvUserInOut(pkt);
		break;
	case AG_USER_MOVE:
		RecvUserMove(pkt);
		break;
	case AG_USER_MOVEEDGE:
		RecvUserMoveEdge(pkt);
		break;
	case AG_ATTACK_REQ:
		RecvAttackReq(pkt);
		break;
	case AG_USER_LOG_OUT:
		RecvUserLogOut(pkt);
		break;
	case AG_USER_REGENE:
		RecvUserRegene(pkt);
		break;
	case AG_USER_SET_HP:
		RecvUserSetHP(pkt);
		break;
	case AG_NPC_HP_CHANGE:
		RecvNpcHpChange(pkt);
		break;
	case AG_USER_UPDATE:
		RecvUserUpdate(pkt);
		break;
	case AG_ZONE_CHANGE:
		RecvZoneChange(pkt);
		break;
	case AG_USER_PARTY:
		m_Party.PartyProcess(pkt);
		break;
	case AG_USER_INFO_ALL:
		RecvUserInfoAllData(pkt);
		break;
	case AG_PARTY_INFO_ALL:
		RecvPartyInfoAllData(pkt);
		break;
	case AG_CHECK_ALIVE_REQ:
		RecvCheckAlive(pkt);
		break;
	case AG_HEAL_MAGIC:
		RecvHealMagic(pkt);
		break;
	case AG_TIME_WEATHER:
		RecvTimeAndWeather(pkt);
		break;
	case AG_USER_FAIL:
		RecvUserFail(pkt);
		break;
	case AG_BATTLE_EVENT:
		RecvBattleEvent(pkt);
		break;
	case AG_NPC_GATE_OPEN:
		RecvGateOpen(pkt);
		break;
	case AG_USER_VISIBILITY:
		RecvUserVisibility(pkt);
		break;
	}
	return true;
}
void CGameSocket::Parsing( int length, char* pData )
{
	int index = 0;
	BYTE bType = GetByte(pData, index);

	switch(bType)
	{
	case SERVER_CONNECT:
		RecvServerConnect(pData);
		break;
	case AG_USER_INFO:
		RecvUserInfo(pData+index);
		break;
	case AG_USER_INOUT:
		RecvUserInOut(pData+index);
		break;
	case AG_USER_MOVE:
		RecvUserMove(pData+index);
		break;
	case AG_USER_MOVEEDGE:
		RecvUserMoveEdge(pData+index);
		break;
	case AG_ATTACK_REQ:
		RecvAttackReq(pData+index);
		break;
	case AG_USER_LOG_OUT:
		RecvUserLogOut(pData+index);
		break;
	case AG_USER_REGENE:
		RecvUserRegene(pData+index);
		break;
	case AG_USER_SET_HP:
		RecvUserSetHP(pData+index);
		break;
	case AG_USER_UPDATE:
		RecvUserUpdate(pData+index);
		break;
	case AG_ZONE_CHANGE:
		RecvZoneChange(pData+index);
		break;
	case AG_USER_PARTY:
		//if(m_pParty)
		m_Party.PartyProcess(pData+index);
		break;
	case AG_MAGIC_ATTACK_REQ:
		RecvMagicAttackReq(pData+index);
		break;
	case AG_COMPRESSED_DATA:
		RecvCompressedData(pData+index);
		break;
	case AG_USER_INFO_ALL:
		RecvUserInfoAllData(pData+index);
		break;
	case AG_PARTY_INFO_ALL:
		RecvPartyInfoAllData(pData+index);
		break;
	case AG_CHECK_ALIVE_REQ:
		RecvCheckAlive(pData+index);
		break;
	case AG_HEAL_MAGIC:
		RecvHealMagic(pData+index);
		break;
	case AG_TIME_WEATHER:
		RecvTimeAndWeather(pData+index);
		break;
	case AG_USER_FAIL:
		RecvUserFail(pData+index);
		break;
	case AG_BATTLE_EVENT:
		RecvBattleEvent(pData+index);
		break;
	case AG_NPC_GATE_OPEN:
		RecvGateOpen(pData+index);
		break;
	}
}