From f6646739908215311f110842ed41055a54dae1f0 Mon Sep 17 00:00:00 2001 From: ModoX Date: Sat, 24 Feb 2024 18:44:42 +0100 Subject: Core/PacketIO: Implemented CMSG_CHECK_IS_ADVENTURE_MAP_POI_VALID and SMSG_PLAYER_IS_ADVENTURE_MAP_POI_VALID (#29626) --- src/server/game/Handlers/AdventureMapHandler.cpp | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/server/game/Handlers/AdventureMapHandler.cpp') 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); -- cgit v1.2.3