Browse Source

LoginServer Patches

- allow more than one world server
- fixed some of the fields in the WorldList being set properly
- Added a flag in CreateCharacterReply
Image 4 years ago
parent
commit
cbdef22c5f

+ 21 - 7
EQ2/source/LoginServer/LWorld.cpp

@@ -1127,31 +1127,45 @@ EQ2Packet* LWorldList::MakeServerListPacket(int8 lsadmin, int16 version) {
 	}
 	ServerNum+=3;
 	*/
+	uint32 tmpCount = 0;
+	map<int32, LWorld*>::iterator map_list;
+	for (map_list = worldmap.begin(); map_list != worldmap.end(); map_list++) {
+		LWorld* world = map_list->second;
+		if ((world->IsInit || (world->ShowDown() && world->ShowDownActive())) && world->GetType() == World) {
+			tmpCount++;
+		}
+	}
 
 	PacketStruct* packet = configReader.getStruct("LS_WorldList", version);
-	packet->setArrayLengthByName("num_worlds", 1);
+	packet->setArrayLengthByName("num_worlds", tmpCount);
 
 	string world_data;	
-	map<int32,LWorld*>::iterator map_list;
 	for( map_list = worldmap.begin(); map_list != worldmap.end(); map_list++) {
 		LWorld* world = map_list->second;
 		if ((world->IsInit || (world->ShowDown() && world->ShowDownActive())) && world->GetType() == World) {
 			ServerNum++;
 			packet->setArrayDataByName("id", world->GetID(), ServerNum-1);
-			packet->setArrayDataByName("allowed_races", 0x000FFFFF, ServerNum-1); //change later
+
+			if (version < 1096)
+				packet->setDataByName("allowed_races", 0x0007FFFF, ServerNum - 1); // no Freeblood and Aerakyn race
+			else if (version < 60006)
+				packet->setArrayDataByName("allowed_races", 0x000FFFFF, ServerNum - 1); // + Freeblood
+			else
+				packet->setArrayDataByName("allowed_races", 0x001FFFFF, ServerNum - 1);	// + Aerakyn
+
 			packet->setArrayDataByName("number_online_flag", 1, ServerNum-1);
 			packet->setArrayDataByName("num_players", world->GetPlayerNum(), ServerNum-1);
 			packet->setArrayDataByName("name", world->GetName(), ServerNum-1);
 			packet->setArrayDataByName("name2", world->GetName(), ServerNum-1);
 			packet->setArrayDataByName("feature_set",0, ServerNum-1);
-			packet->setArrayDataByName("load", 2, ServerNum-1);
+			packet->setArrayDataByName("load", world->GetWorldStatus(), ServerNum-1);
 			if(world->IsLocked())
-				packet->setArrayDataByName("locked", 1);
+				packet->setArrayDataByName("locked", 1, ServerNum - 1);
 
 			if(world->ShowDown())
-				packet->setArrayDataByName("tag", 0);
+				packet->setArrayDataByName("tag", 0, ServerNum - 1);
 			else
-				packet->setArrayDataByName("tag", 1);
+				packet->setArrayDataByName("tag", 1, ServerNum - 1);
 		}
 	}
 

+ 2 - 1
EQ2/source/LoginServer/client.cpp

@@ -420,9 +420,10 @@ void Client::CharacterApproved(int32 server_id,int32 char_id)
 		if(!world_server)
 			return;
 
-		PacketStruct* packet = configReader.getStruct("LS_CreateCharacterReply", GetVersion());
+		PacketStruct* packet = configReader.getStruct("LS_CreateCharacterReply", GetOrigVersion());
 		if(packet){
 			packet->setDataByName("account_id", GetAccountID());
+			packet->setDataByName("unknown", 0xFFFFFFFF);
 			packet->setDataByName("response", CREATESUCCESS_REPLY);
 			packet->setMediumStringByName("name", (char*)createRequest->getType_EQ2_16BitString_ByName("name").data.c_str());
 			EQ2Packet* outapp = packet->serialize();

+ 1 - 1
EQ2/source/LoginServer/net.cpp

@@ -222,7 +222,7 @@ bool NetConnection::ReadLoginConfig() {
 			items[2] = 1;
 			items[3] = 1;
 			if (!strncasecmp(type, "[", 1)) {
-				// new block after LoginServer, skip
+				// new block after LoginConfig, skip
 				break;
 			}
 			if (!strncasecmp(type, "serverport", 10)) {