Browse Source

Fix for 'enter house' being unavailable when switching between characters

- Fix a bug with not being able to enter house if switching between multiple characters
Image 3 years ago
parent
commit
7a21db869b

+ 1 - 1
EQ2/source/WorldServer/Commands/Commands.cpp

@@ -2733,7 +2733,7 @@ void Commands::Process(int32 index, EQ2_16BitString* command_parms, Client* clie
 				if ( ph )
 					hz = world.GetHouseZone(ph->house_id);
 				// there is a arg[1] that is true/false, but not sure what it is for investigate more later
-				ClientPacketFunctions::SendBaseHouseWindow(client, hz, ph, cmdTarget ? cmdTarget->GetID() : 0);
+				ClientPacketFunctions::SendBaseHouseWindow(client, hz, ph, 0);
 			}
 			break;
 		}

+ 6 - 3
EQ2/source/WorldServer/Housing/HousingPackets.cpp

@@ -85,14 +85,14 @@ void ClientPacketFunctions::SendHousingList(Client* client) {
 		packet->setArrayDataByName("house_city", hz->name.c_str(), i);
 		packet->setArrayDataByName("house_address", "", i); // need this pulled from live
 		packet->setArrayDataByName("house_description", name.c_str(), i);
-		packet->setArrayDataByName("index", i + 1, i); // they send 2, 4, 6, 8 as the index ID's on the client..
+		packet->setArrayDataByName("index", i, i); // they send 2, 4, 6, 8 as the index ID's on the client..
 
 		// this seems to be some kind of timestamp, if we keep updating then in conjunction with upkeep_due
 		// in SendBaseHouseWindow/WS_PlayerHouseBaseScreen being a >0 number we can access 'enter house'
 		if ( client->GetVersion() >= 63119 )
-			packet->setArrayDataByName("unknown2a", ph->upkeep_due, i);
+			packet->setArrayDataByName("unknown2a", 1, i);
 		else
-			packet->setArrayDataByName("unknown2", ph->upkeep_due, i);
+			packet->setArrayDataByName("unknown2", 1, i);
 	}
 	client->QueuePacket(packet->serialize());
 }
@@ -110,6 +110,9 @@ void ClientPacketFunctions::SendBaseHouseWindow(Client* client, HouseZone* hz, P
 	name.append("'s ");
 	name.append(hz->name);
 
+	if (spawnID)
+		SendHousingList(client);
+
 	PacketStruct* packet = configReader.getStruct("WS_PlayerHouseBaseScreen", client->GetVersion());
 	if (packet) {
 		packet->setDataByName("house_id", ph->unique_id);

+ 5 - 2
EQ2/source/WorldServer/Widget.cpp

@@ -389,7 +389,7 @@ void Widget::HandleUse(Client* client, string command, int8 overrideWidgetType){
 			ph = world.GetPlayerHouseByHouseID(client->GetPlayer()->GetCharacterID(), hz->id);
 		if (ph) {
 			// if we aren't in our own house we should get the full list of houses we can visit
-			if ( client->GetCurrentZone()->GetInstanceType() != Instance_Type::PERSONAL_HOUSE_INSTANCE )
+			if ( m_houseID && client->GetCurrentZone()->GetInstanceType() != Instance_Type::PERSONAL_HOUSE_INSTANCE )
 				ClientPacketFunctions::SendHouseVisitWindow(client, world.GetAllPlayerHousesByHouseID(m_houseID));
 
 			ClientPacketFunctions::SendBaseHouseWindow(client, hz, ph, id);
@@ -406,12 +406,15 @@ void Widget::HandleUse(Client* client, string command, int8 overrideWidgetType){
 			HouseZone* hz = world.GetHouseZone(ph->house_id);
 			if (hz) {
 				int32 id = client->GetPlayer()->GetIDWithPlayerSpawn(this);
-				ClientPacketFunctions::SendHouseVisitWindow(client, world.GetAllPlayerHousesByHouseID(m_houseID));
+				if (m_houseID)
+					ClientPacketFunctions::SendHouseVisitWindow(client, world.GetAllPlayerHousesByHouseID(m_houseID));
+
 				ClientPacketFunctions::SendBaseHouseWindow(client, hz, ph, id);
 			}
 		}
 	}
 	else if (client && m_houseID > 0 && strncasecmp("visit", command.c_str(), 6) == 0) {
+		ClientPacketFunctions::SendHousingList(client);
 		ClientPacketFunctions::SendHouseVisitWindow(client, world.GetAllPlayerHousesByHouseID(m_houseID));
 	}
 	else if (client && command.length() > 0) {

+ 2 - 2
EQ2/source/WorldServer/client.cpp

@@ -1806,7 +1806,7 @@ bool Client::HandlePacket(EQApplicationPacket* app) {
 				int32 upkeep_due = Timer::GetUnixTimeStamp() + 604800; // 604800 = 7 days
 				int64 unique_id = database.AddPlayerHouse(GetPlayer()->GetCharacterID(), hz->id, instance_zone->GetInstanceID(), upkeep_due);
 				world.AddPlayerHouse(GetPlayer()->GetCharacterID(), hz->id, unique_id, instance_zone->GetInstanceID(), upkeep_due, 0, 0, GetPlayer()->GetName());
-				ClientPacketFunctions::SendHousingList(this);
+				//ClientPacketFunctions::SendHousingList(this);
 				PlayerHouse* ph = world.GetPlayerHouseByUniqueID(unique_id);
 				ClientPacketFunctions::SendBaseHouseWindow(this, hz, ph, this->GetPlayer()->GetID());
 			}
@@ -1872,7 +1872,7 @@ bool Client::HandlePacket(EQApplicationPacket* app) {
 				{
 					ph->upkeep_due = upkeep_due;
 					database.SetHouseUpkeepDue(GetCharacterID(), ph->house_id, ph->instance_id, ph->upkeep_due);
-					ClientPacketFunctions::SendHousingList(this);
+					//ClientPacketFunctions::SendHousingList(this);
 					ClientPacketFunctions::SendBaseHouseWindow(this, hz, ph, this->GetPlayer()->GetID());
 					PlaySound("coin_cha_ching");
 				}