diff options
author | Shauren <shauren.trinity@gmail.com> | 2021-03-14 14:46:07 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-03-14 14:46:07 +0100 |
commit | 08e017b3512ce8189adc6762e3670c20c900f54e (patch) | |
tree | 6514720b6888539245254ea0326e75ba60180942 /src/server | |
parent | da77b300f48df88cd52e69d37510db028d0fa2e8 (diff) |
Core/AdventureMap: Handle CMSG_ADVENTURE_MAP_START_QUEST
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/database/Database/Implementation/HotfixDatabase.cpp | 7 | ||||
-rw-r--r-- | src/server/database/Database/Implementation/HotfixDatabase.h | 4 | ||||
-rw-r--r-- | src/server/game/DataStores/DB2LoadInfo.h | 26 | ||||
-rw-r--r-- | src/server/game/DataStores/DB2Stores.cpp | 2 | ||||
-rw-r--r-- | src/server/game/DataStores/DB2Stores.h | 1 | ||||
-rw-r--r-- | src/server/game/DataStores/DB2Structure.h | 17 | ||||
-rw-r--r-- | src/server/game/Handlers/AdventureMapHandler.cpp | 39 | ||||
-rw-r--r-- | src/server/game/Server/Packets/AdventureMapPackets.cpp | 29 | ||||
-rw-r--r-- | src/server/game/Server/Packets/AdventureMapPackets.h | 39 | ||||
-rw-r--r-- | src/server/game/Server/Packets/AllPackets.h | 1 | ||||
-rw-r--r-- | src/server/game/Server/Protocol/Opcodes.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Server/Protocol/Opcodes.h | 2 | ||||
-rw-r--r-- | src/server/game/Server/WorldSession.h | 8 |
13 files changed, 175 insertions, 2 deletions
diff --git a/src/server/database/Database/Implementation/HotfixDatabase.cpp b/src/server/database/Database/Implementation/HotfixDatabase.cpp index ec64cfec926..157ca5319b1 100644 --- a/src/server/database/Database/Implementation/HotfixDatabase.cpp +++ b/src/server/database/Database/Implementation/HotfixDatabase.cpp @@ -52,6 +52,13 @@ void HotfixDatabaseConnection::DoPrepareStatements() PREPARE_LOCALE_STMT(HOTFIX_SEL_ADVENTURE_JOURNAL, "SELECT ID, Name_lang, Description_lang, ButtonText_lang, RewardDescription_lang, " "ContinueDescription_lang FROM adventure_journal_locale WHERE (`VerifiedBuild` > 0) = ? AND locale = ?", CONNECTION_SYNCH); + // AdventureMapPoi.db2 + PrepareStatement(HOTFIX_SEL_ADVENTURE_MAP_POI, "SELECT ID, Title, Description, WorldPositionX, WorldPositionY, Type, PlayerConditionID, QuestID, " + "LfgDungeonID, RewardItemID, UiTextureAtlasMemberID, UiTextureKitID, MapID, AreaTableID FROM adventure_map_poi WHERE (`VerifiedBuild` > 0) = ?", CONNECTION_SYNCH); + PREPARE_MAX_ID_STMT(HOTFIX_SEL_ADVENTURE_MAP_POI, "SELECT MAX(ID) + 1 FROM adventure_map_poi", CONNECTION_SYNCH); + PREPARE_LOCALE_STMT(HOTFIX_SEL_ADVENTURE_MAP_POI, "SELECT ID, Title_lang, Description_lang FROM adventure_map_poi_locale" + " WHERE (`VerifiedBuild` > 0) = ? AND locale = ?", CONNECTION_SYNCH); + // AnimationData.db2 PrepareStatement(HOTFIX_SEL_ANIMATION_DATA, "SELECT ID, BehaviorID, BehaviorTier, Fallback, Flags1, Flags2 FROM animation_data" " WHERE (`VerifiedBuild` > 0) = ?", CONNECTION_SYNCH); diff --git a/src/server/database/Database/Implementation/HotfixDatabase.h b/src/server/database/Database/Implementation/HotfixDatabase.h index 25578abe017..c3071db7754 100644 --- a/src/server/database/Database/Implementation/HotfixDatabase.h +++ b/src/server/database/Database/Implementation/HotfixDatabase.h @@ -39,6 +39,10 @@ enum HotfixDatabaseStatements : uint32 HOTFIX_SEL_ADVENTURE_JOURNAL_MAX_ID, HOTFIX_SEL_ADVENTURE_JOURNAL_LOCALE, + HOTFIX_SEL_ADVENTURE_MAP_POI, + HOTFIX_SEL_ADVENTURE_MAP_POI_MAX_ID, + HOTFIX_SEL_ADVENTURE_MAP_POI_LOCALE, + HOTFIX_SEL_ANIMATION_DATA, HOTFIX_SEL_ANIMATION_DATA_MAX_ID, diff --git a/src/server/game/DataStores/DB2LoadInfo.h b/src/server/game/DataStores/DB2LoadInfo.h index 9334aa9410b..cf7a7bd6d1f 100644 --- a/src/server/game/DataStores/DB2LoadInfo.h +++ b/src/server/game/DataStores/DB2LoadInfo.h @@ -90,6 +90,32 @@ struct AdventureJournalLoadInfo } }; +struct AdventureMapPoiLoadInfo +{ + static DB2LoadInfo const* Instance() + { + static DB2FieldMeta const fields[] = + { + { false, FT_INT, "ID" }, + { false, FT_STRING, "Title" }, + { false, FT_STRING, "Description" }, + { false, FT_FLOAT, "WorldPositionX" }, + { false, FT_FLOAT, "WorldPositionY" }, + { true, FT_BYTE, "Type" }, + { false, FT_INT, "PlayerConditionID" }, + { false, FT_INT, "QuestID" }, + { false, FT_INT, "LfgDungeonID" }, + { true, FT_INT, "RewardItemID" }, + { false, FT_INT, "UiTextureAtlasMemberID" }, + { false, FT_INT, "UiTextureKitID" }, + { true, FT_INT, "MapID" }, + { false, FT_INT, "AreaTableID" }, + }; + static DB2LoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, AdventureMapPOIMeta::Instance(), HOTFIX_SEL_ADVENTURE_MAP_POI); + return &loadInfo; + } +}; + struct AnimationDataLoadInfo { static DB2LoadInfo const* Instance() diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp index ca25dca78ba..cf7cc0ca5dc 100644 --- a/src/server/game/DataStores/DB2Stores.cpp +++ b/src/server/game/DataStores/DB2Stores.cpp @@ -43,6 +43,7 @@ DB2Storage<AchievementEntry> sAchievementStore("Achievement.db2", AchievementLoadInfo::Instance()); DB2Storage<AdventureJournalEntry> sAdventureJournalStore("AdventureJournal.db2", AdventureJournalLoadInfo::Instance()); +DB2Storage<AdventureMapPOIEntry> sAdventureMapPOIStore("AdventureMapPOI.db2", AdventureMapPoiLoadInfo::Instance()); DB2Storage<AnimationDataEntry> sAnimationDataStore("AnimationData.db2", AnimationDataLoadInfo::Instance()); DB2Storage<AnimKitEntry> sAnimKitStore("AnimKit.db2", AnimKitLoadInfo::Instance()); DB2Storage<AreaGroupMemberEntry> sAreaGroupMemberStore("AreaGroupMember.db2", AreaGroupMemberLoadInfo::Instance()); @@ -579,6 +580,7 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul LOAD_DB2(sAchievementStore); LOAD_DB2(sAdventureJournalStore); + LOAD_DB2(sAdventureMapPOIStore); LOAD_DB2(sAnimationDataStore); LOAD_DB2(sAnimKitStore); LOAD_DB2(sAreaGroupMemberStore); diff --git a/src/server/game/DataStores/DB2Stores.h b/src/server/game/DataStores/DB2Stores.h index e6736fd4fd1..0b44f539cac 100644 --- a/src/server/game/DataStores/DB2Stores.h +++ b/src/server/game/DataStores/DB2Stores.h @@ -37,6 +37,7 @@ class DB2HotfixGeneratorBase; TC_GAME_API extern DB2Storage<AchievementEntry> sAchievementStore; TC_GAME_API extern DB2Storage<AdventureJournalEntry> sAdventureJournalStore; +TC_GAME_API extern DB2Storage<AdventureMapPOIEntry> sAdventureMapPOIStore; TC_GAME_API extern DB2Storage<AnimationDataEntry> sAnimationDataStore; TC_GAME_API extern DB2Storage<AnimKitEntry> sAnimKitStore; TC_GAME_API extern DB2Storage<AreaTableEntry> sAreaTableStore; diff --git a/src/server/game/DataStores/DB2Structure.h b/src/server/game/DataStores/DB2Structure.h index fc4a7fa6b21..928d104b5ef 100644 --- a/src/server/game/DataStores/DB2Structure.h +++ b/src/server/game/DataStores/DB2Structure.h @@ -73,6 +73,23 @@ struct AdventureJournalEntry uint8 BonusValue[2]; }; +struct AdventureMapPOIEntry +{ + uint32 ID; + LocalizedString Title; + LocalizedString Description; + DBCPosition2D WorldPosition; + int8 Type; + uint32 PlayerConditionID; + uint32 QuestID; + uint32 LfgDungeonID; + int32 RewardItemID; + uint32 UiTextureAtlasMemberID; + uint32 UiTextureKitID; + int32 MapID; + uint32 AreaTableID; +}; + struct AnimationDataEntry { uint32 ID; diff --git a/src/server/game/Handlers/AdventureMapHandler.cpp b/src/server/game/Handlers/AdventureMapHandler.cpp new file mode 100644 index 00000000000..e75425be870 --- /dev/null +++ b/src/server/game/Handlers/AdventureMapHandler.cpp @@ -0,0 +1,39 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "WorldSession.h" +#include "AdventureMapPackets.h" +#include "DB2Stores.h" +#include "Player.h" + +void WorldSession::HandleAdventureMapStartQuest(WorldPackets::AdventureMap::AdventureMapStartQuest& startQuest) +{ + Quest const* quest = sObjectMgr->GetQuestTemplate(startQuest.QuestID); + if (!quest) + return; + + auto itr = std::find_if(sAdventureMapPOIStore.begin(), sAdventureMapPOIStore.end(), [&](AdventureMapPOIEntry const* adventureMap) + { + return adventureMap->QuestID == startQuest.QuestID && _player->MeetPlayerCondition(adventureMap->PlayerConditionID); + }); + + if (itr == sAdventureMapPOIStore.end()) + return; + + if (_player->CanTakeQuest(quest, true)) + _player->AddQuestAndCheckCompletion(quest, _player); +} diff --git a/src/server/game/Server/Packets/AdventureMapPackets.cpp b/src/server/game/Server/Packets/AdventureMapPackets.cpp new file mode 100644 index 00000000000..1058aabf209 --- /dev/null +++ b/src/server/game/Server/Packets/AdventureMapPackets.cpp @@ -0,0 +1,29 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "AdventureMapPackets.h" + +namespace WorldPackets +{ +namespace AdventureMap +{ +void AdventureMapStartQuest::Read() +{ + _worldPacket >> QuestID; +} +} +} diff --git a/src/server/game/Server/Packets/AdventureMapPackets.h b/src/server/game/Server/Packets/AdventureMapPackets.h new file mode 100644 index 00000000000..39dc41d023a --- /dev/null +++ b/src/server/game/Server/Packets/AdventureMapPackets.h @@ -0,0 +1,39 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef AdventureMapPackets_h__ +#define AdventureMapPackets_h__ + +#include "Packet.h" + +namespace WorldPackets +{ + namespace AdventureMap + { + class AdventureMapStartQuest final : public ClientPacket + { + public: + AdventureMapStartQuest(WorldPacket&& packet) : ClientPacket(CMSG_ADVENTURE_MAP_START_QUEST, std::move(packet)) { } + + void Read() override; + + int32 QuestID = 0; + }; + } +} + +#endif // AdventureMapPackets_h__ diff --git a/src/server/game/Server/Packets/AllPackets.h b/src/server/game/Server/Packets/AllPackets.h index 2f7d09f732d..a6416d2e37c 100644 --- a/src/server/game/Server/Packets/AllPackets.h +++ b/src/server/game/Server/Packets/AllPackets.h @@ -21,6 +21,7 @@ #include "AchievementPackets.h" #include "AddonPackets.h" #include "AdventureJournalPackets.h" +#include "AdventureMapPackets.h" #include "AreaTriggerPackets.h" #include "ArtifactPackets.h" #include "AuctionHousePackets.h" diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index 91942f5937d..da33ce85f02 100644 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -142,8 +142,8 @@ void OpcodeTable::Initialize() DEFINE_HANDLER(CMSG_ADD_IGNORE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAddIgnoreOpcode); DEFINE_HANDLER(CMSG_ADD_TOY, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAddToy); DEFINE_HANDLER(CMSG_ADVENTURE_JOURNAL_OPEN_QUEST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAdventureJournalOpenQuest); - DEFINE_HANDLER(CMSG_ADVENTURE_JOURNAL_START_QUEST, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::Handle_NULL); DEFINE_HANDLER(CMSG_ADVENTURE_JOURNAL_UPDATE_SUGGESTIONS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAdventureJournalUpdateSuggestions); + DEFINE_HANDLER(CMSG_ADVENTURE_MAP_START_QUEST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAdventureMapStartQuest); DEFINE_HANDLER(CMSG_ALTER_APPEARANCE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAlterAppearance); DEFINE_HANDLER(CMSG_AREA_SPIRIT_HEALER_QUERY, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAreaSpiritHealerQueryOpcode); DEFINE_HANDLER(CMSG_AREA_SPIRIT_HEALER_QUEUE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAreaSpiritHealerQueueOpcode); diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h index b8e3c4d2413..9ef346da4e7 100644 --- a/src/server/game/Server/Protocol/Opcodes.h +++ b/src/server/game/Server/Protocol/Opcodes.h @@ -56,8 +56,8 @@ enum OpcodeClient : uint16 CMSG_ADD_IGNORE = 0x36D4, CMSG_ADD_TOY = 0x32A6, CMSG_ADVENTURE_JOURNAL_OPEN_QUEST = 0x3206, - CMSG_ADVENTURE_JOURNAL_START_QUEST = 0x335B, CMSG_ADVENTURE_JOURNAL_UPDATE_SUGGESTIONS = 0x33E2, + CMSG_ADVENTURE_MAP_START_QUEST = 0x335B, CMSG_ALTER_APPEARANCE = 0x3503, CMSG_AREA_SPIRIT_HEALER_QUERY = 0x34B6, CMSG_AREA_SPIRIT_HEALER_QUEUE = 0x34B7, diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index aabd13e98c9..2269bc1dc8e 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -98,6 +98,11 @@ namespace WorldPackets class AdventureJournalUpdateSuggestions; } + namespace AdventureMap + { + class AdventureMapStartQuest; + } + namespace AreaTrigger { class AreaTrigger; @@ -1690,6 +1695,9 @@ class TC_GAME_API WorldSession void HandleAdventureJournalOpenQuest(WorldPackets::AdventureJournal::AdventureJournalOpenQuest& openQuest); void HandleAdventureJournalUpdateSuggestions(WorldPackets::AdventureJournal::AdventureJournalUpdateSuggestions& updateSuggestions); + // Adventure Map + void HandleAdventureMapStartQuest(WorldPackets::AdventureMap::AdventureMapStartQuest& startQuest); + // Toys void HandleAddToy(WorldPackets::Toy::AddToy& packet); void HandleUseToy(WorldPackets::Toy::UseToy& packet); |