Browse Source

Added support for packet sending map data(0xAC5)

Lemongrass3110 6 năm trước cách đây
mục cha
commit
145b60f7b6
1 tập tin đã thay đổi với 24 bổ sung10 xóa
  1. 24 10
      src/char/char_clif.cpp

+ 24 - 10
src/char/char_clif.cpp

@@ -769,6 +769,29 @@ int chclif_parse_req_charlist(int fd, struct char_session_data* sd){
 	return 1;
 }
 
+//Send player to map
+void chclif_send_map_data( int fd, struct mmo_charstatus *cd, uint32 ipl, int map_server_index ){
+#if PACKETVER >= 20170315
+	int cmd = 0xAC5;
+	int size = 156;
+#else
+	int cmd = 0x71;
+	int size = 28;
+#endif
+
+	WFIFOHEAD(fd,size);
+	WFIFOW(fd,0) = cmd;
+	WFIFOL(fd,2) = cd->char_id;
+	mapindex_getmapname_ext(mapindex_id2name(cd->last_point.map), WFIFOCP(fd,6));
+	uint32 subnet_map_ip = char_lan_subnetcheck(ipl); // Advanced subnet check [LuzZza]
+	WFIFOL(fd,22) = htonl((subnet_map_ip) ? subnet_map_ip : map_server[map_server_index].ip);
+	WFIFOW(fd,26) = ntows(htons(map_server[map_server_index].port)); // [!] LE byte order here [!]
+#if PACKETVER >= 20170315
+	memset(WFIFOP(fd, 28), 0, 128); // Unknown
+#endif
+	WFIFOSET(fd,size);
+}
+
 int chclif_parse_charselect(int fd, struct char_session_data* sd,uint32 ipl){
 	FIFOSD_CHECK(3);
 	{
@@ -776,7 +799,6 @@ int chclif_parse_charselect(int fd, struct char_session_data* sd,uint32 ipl){
 		struct mmo_charstatus *cd;
 		char* data;
 		uint32 char_id;
-		uint32 subnet_map_ip;
 		struct auth_node* node;
 		int i, map_fd;
 		DBMap *auth_db = char_get_authdb();
@@ -886,15 +908,7 @@ int chclif_parse_charselect(int fd, struct char_session_data* sd,uint32 ipl){
 			return 1;
 		}
 
-		//Send player to map
-		WFIFOHEAD(fd,28);
-		WFIFOW(fd,0) = 0x71;
-		WFIFOL(fd,2) = cd->char_id;
-		mapindex_getmapname_ext(mapindex_id2name(cd->last_point.map), WFIFOCP(fd,6));
-		subnet_map_ip = char_lan_subnetcheck(ipl); // Advanced subnet check [LuzZza]
-		WFIFOL(fd,22) = htonl((subnet_map_ip) ? subnet_map_ip : map_server[i].ip);
-		WFIFOW(fd,26) = ntows(htons(map_server[i].port)); // [!] LE byte order here [!]
-		WFIFOSET(fd,28);
+		chclif_send_map_data( fd, cd, ipl, i );
 
 		// create temporary auth entry
 		CREATE(node, struct auth_node, 1);