示例#1
0
文件: inter.c 项目: Celso1415/Fusion
int inter_parse_frommap (int fd)
{
	int cmd;
	int len = 0;
	cmd = RFIFOW (fd, 0);

	// Determine inter's jurisdiction mackerel
	if (cmd < 0x3000 || cmd >= 0x3000 + ARRAYLENGTH (inter_recv_packet_length) || inter_recv_packet_length[cmd - 0x3000] == 0)
		return 0;

	// Examinize the length of the packet
	if ( (len = inter_check_length (fd, inter_recv_packet_length[cmd - 0x3000])) == 0)
		return 2;

	switch (cmd) {
		case 0x3000: mapif_parse_broadcast (fd); break;

		case 0x3001: mapif_parse_WisRequest (fd); break;

		case 0x3002: mapif_parse_WisReply (fd); break;

		case 0x3003: mapif_parse_WisToGM (fd); break;

		case 0x3004: mapif_parse_Registry (fd); break;

		case 0x3005: mapif_parse_RegistryRequest (fd); break;

		case 0x3006: mapif_parse_NameChangeRequest (fd); break;

		case 0x3007: mapif_parse_accinfo (fd); break;

		default:
			if (inter_party_parse_frommap (fd)
					|| inter_guild_parse_frommap (fd)
					|| inter_storage_parse_frommap (fd)
					|| inter_pet_parse_frommap (fd)
					|| inter_homunculus_parse_frommap (fd)
					|| inter_mercenary_parse_frommap (fd)
					|| inter_elemental_parse_frommap (fd)
					|| inter_mail_parse_frommap (fd)
					|| inter_auction_parse_frommap (fd)
					|| inter_quest_parse_frommap (fd)
			   )
				break;
			else
				return 0;
	}

	RFIFOSKIP (fd, len);
	return 1;
}
示例#2
0
int inter_parse_frommap(int fd)
{
	int cmd;
	int len = 0;
	cmd = RFIFOW(fd,0);
	// Check is valid packet entry
	if(cmd < 0x3000 || cmd >= 0x3000 + ARRAYLENGTH(inter_recv_packet_length) || inter_recv_packet_length[cmd - 0x3000] == 0)
		return 0;

	// Check packet length
	if((len = inter_check_length(fd, inter_recv_packet_length[cmd - 0x3000])) == 0)
		return 2;

	switch(cmd) {
	case 0x3000: mapif_parse_broadcast(fd); break;
	case 0x3001: mapif_parse_WisRequest(fd); break;
	case 0x3002: mapif_parse_WisReply(fd); break;
	case 0x3003: mapif_parse_WisToGM(fd); break;
	case 0x3004: mapif_parse_Registry(fd); break;
	case 0x3005: mapif_parse_RegistryRequest(fd); break;
	case 0x3006: mapif_parse_NameChangeRequest(fd); break;
	case 0x3007: mapif_parse_accinfo(fd); break;
	/* 0x3008 unused */
	case 0x3009: mapif_parse_broadcast_item(fd); break;
	default:
		if(  inter_party_parse_frommap(fd)
		  || inter_guild_parse_frommap(fd)
		  || inter_storage_parse_frommap(fd)
		  || inter_pet_parse_frommap(fd)
		  || inter_homunculus_parse_frommap(fd)
		  || inter_mercenary_parse_frommap(fd)
		  || inter_elemental_parse_frommap(fd)
		  || inter_mail_parse_frommap(fd)
		  || inter_auction_parse_frommap(fd)
		  || inter_quest_parse_frommap(fd)
		  || inter_clan_parse_frommap(fd)
		  || inter_achievement_parse_frommap(fd)
		   )
			break;
		else
			return 0;
	}

	RFIFOSKIP(fd, len);
	return 1;
}