From 8d52f85e2cccb097aafccdb5194ba1f30d613aba Mon Sep 17 00:00:00 2001 From: Emagi Date: Wed, 15 Mar 2023 14:08:16 -0400 Subject: [PATCH] Enter House button is fixed! No longer intermittently displays as grey --- EQ2/source/WorldServer/Commands/Commands.cpp | 2 +- .../WorldServer/Housing/HousingPackets.cpp | 36 +++++++++++++++---- EQ2/source/WorldServer/Widget.cpp | 2 +- EQ2/source/WorldServer/client.cpp | 6 ++-- EQ2/source/WorldServer/zoneserver.cpp | 1 - server/WorldStructs.xml | 2 +- 6 files changed, 35 insertions(+), 14 deletions(-) diff --git a/EQ2/source/WorldServer/Commands/Commands.cpp b/EQ2/source/WorldServer/Commands/Commands.cpp index 45b2562ca..ab68c995d 100644 --- a/EQ2/source/WorldServer/Commands/Commands.cpp +++ b/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; } diff --git a/EQ2/source/WorldServer/Housing/HousingPackets.cpp b/EQ2/source/WorldServer/Housing/HousingPackets.cpp index f0220c648..e2680c419 100644 --- a/EQ2/source/WorldServer/Housing/HousingPackets.cpp +++ b/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); diff --git a/EQ2/source/WorldServer/Widget.cpp b/EQ2/source/WorldServer/Widget.cpp index 368526004..bfa83b455 100644 --- a/EQ2/source/WorldServer/Widget.cpp +++ b/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 { diff --git a/EQ2/source/WorldServer/client.cpp b/EQ2/source/WorldServer/client.cpp index 6de4639e1..1ffaf69be 100755 --- a/EQ2/source/WorldServer/client.cpp +++ b/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; diff --git a/EQ2/source/WorldServer/zoneserver.cpp b/EQ2/source/WorldServer/zoneserver.cpp index b9550fd00..e34ec2027 100644 --- a/EQ2/source/WorldServer/zoneserver.cpp +++ b/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; } diff --git a/server/WorldStructs.xml b/server/WorldStructs.xml index 5cdab654f..6a8a6f2d4 100644 --- a/server/WorldStructs.xml +++ b/server/WorldStructs.xml @@ -18531,7 +18531,7 @@ to zero and treated like placeholders." /> - +