aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/AdventureMapHandler.cpp
diff options
context:
space:
mode:
authorModoX <moardox@gmail.com>2024-02-24 18:44:42 +0100
committerGitHub <noreply@github.com>2024-02-24 18:44:42 +0100
commitf6646739908215311f110842ed41055a54dae1f0 (patch)
tree16173a0b713d9cc2ca7397aafb9bc528197524db /src/server/game/Handlers/AdventureMapHandler.cpp
parentcf026aa62747dfa0528a70badef69fcf33cbf8ba (diff)
Core/PacketIO: Implemented CMSG_CHECK_IS_ADVENTURE_MAP_POI_VALID and SMSG_PLAYER_IS_ADVENTURE_MAP_POI_VALID (#29626)
Diffstat (limited to 'src/server/game/Handlers/AdventureMapHandler.cpp')
-rw-r--r--src/server/game/Handlers/AdventureMapHandler.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/server/game/Handlers/AdventureMapHandler.cpp b/src/server/game/Handlers/AdventureMapHandler.cpp
index d25651e8ce0..4d2ae827613 100644
--- a/src/server/game/Handlers/AdventureMapHandler.cpp
+++ b/src/server/game/Handlers/AdventureMapHandler.cpp
@@ -21,6 +21,36 @@
#include "ObjectMgr.h"
#include "Player.h"
+void WorldSession::HandleCheckIsAdventureMapPoiValid(WorldPackets::AdventureMap::CheckIsAdventureMapPoiValid& checkIsAdventureMapPoiValid)
+{
+ AdventureMapPOIEntry const* entry = sAdventureMapPOIStore.LookupEntry(checkIsAdventureMapPoiValid.AdventureMapPoiID);
+ if (!entry)
+ return;
+
+ auto sendIsPoiValid = [this](uint32 adventureMapPoiId, bool isVisible) -> void
+ {
+ WorldPackets::AdventureMap::PlayerIsAdventureMapPoiValid isMapPoiValid;
+ isMapPoiValid.AdventureMapPoiID = adventureMapPoiId;
+ isMapPoiValid.IsVisible = isVisible;
+ SendPacket(isMapPoiValid.Write());
+ };
+
+ Quest const* quest = sObjectMgr->GetQuestTemplate(entry->QuestID);
+ if (!quest)
+ {
+ sendIsPoiValid(entry->ID, false);
+ return;
+ }
+
+ if (!_player->MeetPlayerCondition(entry->PlayerConditionID))
+ {
+ sendIsPoiValid(entry->ID, false);
+ return;
+ }
+
+ sendIsPoiValid(entry->ID, true);
+}
+
void WorldSession::HandleAdventureMapStartQuest(WorldPackets::AdventureMap::AdventureMapStartQuest& startQuest)
{
Quest const* quest = sObjectMgr->GetQuestTemplate(startQuest.QuestID);