Browse Source

Enter House button is fixed! No longer intermittently displays as grey

Emagi 1 year ago
parent
commit
8d52f85e2c

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

@@ -3867,7 +3867,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, 0);
+				ClientPacketFunctions::SendBaseHouseWindow(client, hz, ph, client->GetPlayer()->GetID());
 			}
 			break;
 		}

+ 29 - 7
EQ2/source/WorldServer/Housing/HousingPackets.cpp

@@ -93,10 +93,16 @@ void ClientPacketFunctions::SendHousingList(Client* 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'
+		
+		int32 upkeep_due = 0;
+
+		if (((sint64)ph->upkeep_due - (sint64)Timer::GetUnixTimeStamp()) > 0)
+			upkeep_due = ph->upkeep_due - Timer::GetUnixTimeStamp();
+		
 		if ( client->GetVersion() >= 63119 )
-			packet->setArrayDataByName("unknown2a", 1, i);
+			packet->setArrayDataByName("unknown2a", 0xFFFFFFFF, i);
 		else
-			packet->setArrayDataByName("unknown2", 1, i);
+			packet->setArrayDataByName("unknown2", 0xFFFFFFFF, i);
 	}
 	client->QueuePacket(packet->serialize());
 	safe_delete(packet);
@@ -118,7 +124,26 @@ void ClientPacketFunctions::SendBaseHouseWindow(Client* client, HouseZone* hz, P
 	if (spawnID)
 		SendHousingList(client);
 
-	PacketStruct* packet = configReader.getStruct("WS_PlayerHouseBaseScreen", client->GetVersion());
+	int32 upkeep_due = 0;
+
+	if (((sint64)ph->upkeep_due - (sint64)Timer::GetUnixTimeStamp()) > 0)
+		upkeep_due = ph->upkeep_due - Timer::GetUnixTimeStamp();
+		
+	// need this to enable the "enter house" button
+	PacketStruct* packet = configReader.getStruct("WS_UpdateHouseAccessDataMsg", client->GetVersion());
+	if(client->GetCurrentZone()->GetInstanceType() != PERSONAL_HOUSE_INSTANCE
+			&& client->GetCurrentZone()->GetInstanceType() != GUILD_HOUSE_INSTANCE) {
+		if (packet) {
+			packet->setDataByName("house_id", 0xFFFFFFFFFFFFFFFF);
+			packet->setDataByName("success",  (upkeep_due > 0) ? 0xFFFFFFFF : 0);
+			packet->setDataByName("unknown2", 0xFFFFFFFF);
+			packet->setDataByName("unknown3", 0xFFFFFFFF);
+		}
+		client->QueuePacket(packet->serialize());
+	}
+	safe_delete(packet);
+		
+	packet = configReader.getStruct("WS_PlayerHouseBaseScreen", client->GetVersion());
 	if (packet) {
 		packet->setDataByName("house_id", ph->unique_id);
 		packet->setDataByName("spawn_id", spawnID);
@@ -127,10 +152,6 @@ void ClientPacketFunctions::SendBaseHouseWindow(Client* client, HouseZone* hz, P
 		packet->setDataByName("zone_name", hz->name.c_str());
 		packet->setDataByName("upkeep_cost_coins", hz->upkeep_coin);
 		packet->setDataByName("upkeep_cost_status", hz->upkeep_status);
-		int32 upkeep_due = 0;
-
-		if (((sint64)ph->upkeep_due - (sint64)Timer::GetUnixTimeStamp()) > 0)
-			upkeep_due = ph->upkeep_due - Timer::GetUnixTimeStamp();
 
 		packet->setDataByName("upkeep_due", upkeep_due);
 
@@ -184,6 +205,7 @@ void ClientPacketFunctions::SendBaseHouseWindow(Client* client, HouseZone* hz, P
 		}
 
 		client->QueuePacket(packet->serialize());
+		safe_delete(packet);
 	}
 
 	safe_delete(packet);

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

@@ -411,7 +411,7 @@ void Widget::HandleUse(Client* client, string command, int8 overrideWidgetType){
 			if ( m_houseID && client->GetCurrentZone()->GetInstanceType() != Instance_Type::PERSONAL_HOUSE_INSTANCE )
 				ClientPacketFunctions::SendHouseVisitWindow(client, world.GetAllPlayerHousesByHouseID(m_houseID));
 
-			ClientPacketFunctions::SendBaseHouseWindow(client, hz, ph, 0);
+			ClientPacketFunctions::SendBaseHouseWindow(client, hz, ph, client->GetPlayer()->GetID());
 			client->GetCurrentZone()->SendHouseItems(client);
 		}
 		else {

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

@@ -752,6 +752,9 @@ void Client::SendCharInfo() {
 	//sending bad spawn packet?
 
 	//SendAchievementsList();
+	//if (version > 546)
+		//ClientPacketFunctions::SendHousingList(this);
+	
 	ClientPacketFunctions::SendCharacterSheet(this);
 	ClientPacketFunctions::SendTraitList(this);// moved from below
 	ClientPacketFunctions::SendAbilities(this);
@@ -880,9 +883,6 @@ void Client::SendCharInfo() {
 				SetHasOwnerOrEditAccess(true);
 		}
 	}
-
-	if (version > 546)
-		ClientPacketFunctions::SendHousingList(this);
 	
 	bool groupMentor = false;
 	GetPlayer()->group_id = rejoin_group_id;

+ 0 - 1
EQ2/source/WorldServer/zoneserver.cpp

@@ -4922,7 +4922,6 @@ void ZoneServer::SendDamagePacket(Spawn* attacker, Spawn* victim, int8 type1, in
 	}
 
 	if(damage_type == DAMAGE_PACKET_DAMAGE_TYPE_FOCUS) {
-		type1 = DAMAGE_PACKET_TYPE_SIMPLE_DAMAGE;
 		damage_type = 0;
 		type2 = DAMAGE_PACKET_RESULT_FOCUS;
 	}

+ 1 - 1
server/WorldStructs.xml

@@ -18531,7 +18531,7 @@ to zero and treated like placeholders." />
  </Data> 
 </Struct>
 <Struct Name="WS_UpdateHouseAccessDataMsg" ClientVersion="1" OpcodeName="OP_UpdateHouseAccessDataMsg">
-  <Data ElementName="unknown" Type="int8" Size="4" />
+  <Data ElementName="success" Type="int32"/>
   <Data ElementName="house_id" Type="int64" />
   <Data ElementName="unknown2" Type="int32" />
   <Data ElementName="unknown3" Type="int32" />