From a1beb6acb0e644b1b518a5ac07f7a30341d717d1 Mon Sep 17 00:00:00 2001 From: Emagi <image.emagi@gmail.com> Date: Fri, 15 Jul 2022 08:59:44 -0400 Subject: [PATCH] spawn access requirement can now be enforced with spawn signs to not show title and description --- EQ2/source/WorldServer/Spawn.cpp | 17 ++++++++++++++--- EQ2/source/WorldServer/Spawn.h | 2 ++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/EQ2/source/WorldServer/Spawn.cpp b/EQ2/source/WorldServer/Spawn.cpp index 80f2fbda1..552f0656e 100644 --- a/EQ2/source/WorldServer/Spawn.cpp +++ b/EQ2/source/WorldServer/Spawn.cpp @@ -119,6 +119,7 @@ Spawn::Spawn(){ pickup_unique_item_id = 0; disable_sounds = false; has_quests_required = false; + has_history_required = false; is_flying_creature = false; is_water_creature = false; region_map = nullptr; @@ -410,12 +411,18 @@ void Spawn::InitializeFooterPacketData(Player* player, PacketStruct* footer) { footer->setDataByName("widget_x", sign->GetWidgetX()); footer->setDataByName("widget_y", sign->GetWidgetY()); footer->setDataByName("widget_z", sign->GetWidgetZ()); + + int8 showSignText = 1; + if((HasQuestsRequired() || HasHistoryRequired()) && !MeetsSpawnAccessRequirements(player)) { + showSignText = 0; + } + if (sign->GetSignTitle()) footer->setMediumStringByName("title", sign->GetSignTitle()); if (sign->GetSignDescription()) footer->setMediumStringByName("description", sign->GetSignDescription()); footer->setDataByName("sign_distance", sign->GetSignDistance()); - footer->setDataByName("show", 1); + footer->setDataByName("show", showSignText); // in live we see that the language is set when the player does not have it, otherwise its left as 00's. if(!player->HasLanguage(sign->GetLanguage())) { footer->setDataByName("language", sign->GetLanguage()); @@ -2004,11 +2011,14 @@ void Spawn::SetQuestsRequired(int32 quest_id, int16 quest_step){ m_requiredQuests.releasewritelock(__FUNCTION__, __LINE__); } -bool Spawn::HasQuestsRequired() -{ +bool Spawn::HasQuestsRequired(){ return has_quests_required; } +bool Spawn::HasHistoryRequired(){ + return has_history_required; +} + void Spawn::SetRequiredHistory(int32 event_id, int32 value1, int32 value2){ LUAHistory* set_value = new LUAHistory(); set_value->Value = value1; @@ -2023,6 +2033,7 @@ void Spawn::SetRequiredHistory(int32 event_id, int32 value1, int32 value2){ required_history[event_id] = set_value; safe_delete(tmp_value); } + has_history_required = true; m_requiredHistory.releasewritelock(__FUNCTION__, __LINE__); } diff --git a/EQ2/source/WorldServer/Spawn.h b/EQ2/source/WorldServer/Spawn.h index 94befeceb..aa013f9dc 100644 --- a/EQ2/source/WorldServer/Spawn.h +++ b/EQ2/source/WorldServer/Spawn.h @@ -1033,6 +1033,7 @@ public: void SetQuestsRequired(Spawn* new_spawn); void SetQuestsRequired(int32 quest_id, int16 quest_step); bool HasQuestsRequired(); + bool HasHistoryRequired(); void SetRequiredHistory(int32 event_id, int32 value1, int32 value2); void SetTransporterID(int32 id); int32 GetTransporterID(); @@ -1289,6 +1290,7 @@ public: protected: bool has_quests_required; + bool has_history_required; bool send_spawn_changes; bool invulnerable; bool attack_resume_needed;