diff --git a/Source/Framework/Constants/Network/Opcodes.cs b/Source/Framework/Constants/Network/Opcodes.cs index 534e67c55..cff932452 100644 --- a/Source/Framework/Constants/Network/Opcodes.cs +++ b/Source/Framework/Constants/Network/Opcodes.cs @@ -31,8 +31,8 @@ namespace Framework.Constants AddIgnore = 0x36d4, AddToy = 0x32a6, AdventureJournalOpenQuest = 0x3206, - AdventureJournalStartQuest = 0x335b, AdventureJournalUpdateSuggestions = 0x33e2, + AdventureMapStartQuest = 0x335b, AlterAppearance = 0x3503, AreaSpiritHealerQuery = 0x34b6, AreaSpiritHealerQueue = 0x34b7, diff --git a/Source/Framework/Database/Databases/HotfixDatabase.cs b/Source/Framework/Database/Databases/HotfixDatabase.cs index 21972d2fe..a09617ed0 100644 --- a/Source/Framework/Database/Databases/HotfixDatabase.cs +++ b/Source/Framework/Database/Databases/HotfixDatabase.cs @@ -33,6 +33,11 @@ namespace Framework.Database PrepareStatement(HotfixStatements.SEL_ADVENTURE_JOURNAL_LOCALE, "SELECT ID, Name_lang, Description_lang, ButtonText_lang, RewardDescription_lang, " + "ContinueDescription_lang FROM adventure_journal_locale WHERE locale = ?"); + // AdventureMapPoi.db2 + PrepareStatement(HotfixStatements.SEL_ADVENTURE_MAP_POI, "SELECT ID, Title, Description, WorldPositionX, WorldPositionY, Type, PlayerConditionID, QuestID, " + + "LfgDungeonID, RewardItemID, UiTextureAtlasMemberID, UiTextureKitID, MapID, AreaTableID FROM adventure_map_poi"); + PrepareStatement(HotfixStatements.SEL_ADVENTURE_MAP_POI_LOCALE, "SELECT ID, Title_lang, Description_lang FROM adventure_map_poi_locale WHERE locale = ?"); + // AnimationData.db2 PrepareStatement(HotfixStatements.SEL_ANIMATION_DATA, "SELECT ID, BehaviorID, BehaviorTier, Fallback, Flags1, Flags2 FROM animation_data"); @@ -1158,6 +1163,9 @@ namespace Framework.Database SEL_ADVENTURE_JOURNAL, SEL_ADVENTURE_JOURNAL_LOCALE, + SEL_ADVENTURE_MAP_POI, + SEL_ADVENTURE_MAP_POI_LOCALE, + SEL_ANIMATION_DATA, SEL_ANIM_KIT, diff --git a/Source/Game/DataStorage/CliDB.cs b/Source/Game/DataStorage/CliDB.cs index 18c434ff7..356a6169d 100644 --- a/Source/Game/DataStorage/CliDB.cs +++ b/Source/Game/DataStorage/CliDB.cs @@ -52,6 +52,7 @@ namespace Game.DataStorage AchievementStorage = ReadDB2("Achievement.db2", HotfixStatements.SEL_ACHIEVEMENT, HotfixStatements.SEL_ACHIEVEMENT_LOCALE); AdventureJournalStorage = ReadDB2("AdventureJournal.db2", HotfixStatements.SEL_ADVENTURE_JOURNAL, HotfixStatements.SEL_ADVENTURE_JOURNAL_LOCALE); + AdventureMapPOIStorage = ReadDB2("AdventureMapPOI.db2", HotfixStatements.SEL_ADVENTURE_MAP_POI, HotfixStatements.SEL_ADVENTURE_MAP_POI_LOCALE); AnimationDataStorage = ReadDB2("AnimationData.db2", HotfixStatements.SEL_ANIMATION_DATA); AnimKitStorage = ReadDB2("AnimKit.db2", HotfixStatements.SEL_ANIM_KIT); AreaGroupMemberStorage = ReadDB2("AreaGroupMember.db2", HotfixStatements.SEL_AREA_GROUP_MEMBER); @@ -412,6 +413,7 @@ namespace Game.DataStorage #region Main Collections public static DB6Storage AchievementStorage; public static DB6Storage AdventureJournalStorage; + public static DB6Storage AdventureMapPOIStorage; public static DB6Storage AnimationDataStorage; public static DB6Storage AnimKitStorage; public static DB6Storage AreaGroupMemberStorage; diff --git a/Source/Game/DataStorage/Structs/A_Records.cs b/Source/Game/DataStorage/Structs/A_Records.cs index f84556617..7f2191b2e 100644 --- a/Source/Game/DataStorage/Structs/A_Records.cs +++ b/Source/Game/DataStorage/Structs/A_Records.cs @@ -46,10 +46,10 @@ namespace Game.DataStorage { public uint Id; public LocalizedString Name; - public LocalizedString Description; - public LocalizedString ButtonText; - public LocalizedString RewardDescription; - public LocalizedString ContinueDescription; + public string Description; + public string ButtonText; + public string RewardDescription; + public string ContinueDescription; public byte Type; public uint PlayerConditionID; public byte Flags; @@ -69,6 +69,23 @@ namespace Game.DataStorage public byte[] BonusValue = new byte[2]; } + public sealed class AdventureMapPOIRecord + { + public uint Id; + public LocalizedString Title; + public string Description; + public Vector2 WorldPosition; + public sbyte Type; + public uint PlayerConditionID; + public uint QuestID; + public uint LfgDungeonID; + public int RewardItemID; + public uint UiTextureAtlasMemberID; + public uint UiTextureKitID; + public int MapID; + public uint AreaTableID; + } + public sealed class AnimationDataRecord { public uint Id; diff --git a/Source/Game/Handlers/AdventureJournalHandler.cs b/Source/Game/Handlers/AdventureJournalHandler.cs index c5baffe78..3c2535649 100644 --- a/Source/Game/Handlers/AdventureJournalHandler.cs +++ b/Source/Game/Handlers/AdventureJournalHandler.cs @@ -58,30 +58,6 @@ namespace Game _player.PlayerTalkClass.SendQuestGiverQuestDetails(quest, _player.GetGUID(), true, false); } - [WorldPacketHandler(ClientOpcodes.AdventureJournalStartQuest)] - void HandleAdventureJournalStartQuest(AdventureJournalStartQuest startQuest) - { - Quest quest = Global.ObjectMgr.GetQuestTemplate(startQuest.QuestID); - if (quest == null) - return; - - AdventureJournalRecord adventureJournalEntry = null; - foreach (var adventureJournal in CliDB.AdventureJournalStorage.Values) - { - if (quest.Id == adventureJournal.QuestID) - { - adventureJournalEntry = adventureJournal; - break; - } - } - - if (adventureJournalEntry == null) - return; - - if (_player.MeetPlayerCondition(adventureJournalEntry.PlayerConditionID) && _player.CanTakeQuest(quest, true)) - _player.AddQuestAndCheckCompletion(quest, null); - } - [WorldPacketHandler(ClientOpcodes.AdventureJournalUpdateSuggestions)] void HandleAdventureJournalUpdateSuggestions(AdventureJournalUpdateSuggestions updateSuggestions) { diff --git a/Source/Game/Handlers/AdventureMapHandler.cs b/Source/Game/Handlers/AdventureMapHandler.cs new file mode 100644 index 000000000..d43de62b5 --- /dev/null +++ b/Source/Game/Handlers/AdventureMapHandler.cs @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2012-2020 CypherCore + * + * 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 3 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 . + */ + +using Framework.Constants; +using Framework.IO; +using Game.BattleGrounds; +using Game.DataStorage; +using Game.Entities; +using Game.Groups; +using Game.Guilds; +using Game.Maps; +using Game.Misc; +using Game.Networking; +using Game.Networking.Packets; +using Game.PvP; +using System; +using System.Collections.Generic; +using System.Text; +using System.Linq; + +namespace Game +{ + public partial class WorldSession + { + [WorldPacketHandler(ClientOpcodes.AdventureMapStartQuest)] + void HandleAdventureMapStartQuest(AdventureMapStartQuest startQuest) + { + Quest quest = Global.ObjectMgr.GetQuestTemplate(startQuest.QuestID); + if (quest == null) + return; + + var adventureMapPOI = CliDB.AdventureMapPOIStorage.Values.FirstOrDefault(adventureMap => + { + return adventureMap.QuestID == startQuest.QuestID && _player.MeetPlayerCondition(adventureMap.PlayerConditionID); + }); + + if (adventureMapPOI == null) + return; + + if (_player.CanTakeQuest(quest, true)) + _player.AddQuestAndCheckCompletion(quest, _player); + } + } +} diff --git a/Source/Game/Networking/Packets/AdventureJournalPackets.cs b/Source/Game/Networking/Packets/AdventureJournalPackets.cs index 8bdcc7232..00a07d619 100644 --- a/Source/Game/Networking/Packets/AdventureJournalPackets.cs +++ b/Source/Game/Networking/Packets/AdventureJournalPackets.cs @@ -36,18 +36,6 @@ namespace Game.Networking.Packets public uint AdventureJournalID; } - class AdventureJournalStartQuest : ClientPacket - { - public AdventureJournalStartQuest(WorldPacket packet) : base(packet) { } - - public override void Read() - { - QuestID = _worldPacket.ReadUInt32(); - } - - public uint QuestID; - } - class AdventureJournalUpdateSuggestions : ClientPacket { public AdventureJournalUpdateSuggestions(WorldPacket packet) : base(packet) { } diff --git a/Source/Game/Networking/Packets/AdventureMapPackets.cs b/Source/Game/Networking/Packets/AdventureMapPackets.cs new file mode 100644 index 000000000..7a41f3ee6 --- /dev/null +++ b/Source/Game/Networking/Packets/AdventureMapPackets.cs @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2012-2020 CypherCore + * + * 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 3 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 . + */ + +using Framework.Constants; +using Framework.Dynamic; +using Framework.GameMath; +using Game.Entities; +using System; +using System.Collections.Generic; + +namespace Game.Networking.Packets +{ + class AdventureMapStartQuest : ClientPacket + { + public AdventureMapStartQuest(WorldPacket packet) : base(packet) { } + + public override void Read() + { + QuestID = _worldPacket.ReadUInt32(); + } + + public uint QuestID; + } +} diff --git a/sql/updates/hotfixes/master/2021_03_14_02_hotfixes.sql b/sql/updates/hotfixes/master/2021_03_14_02_hotfixes.sql new file mode 100644 index 000000000..9f3891dcd --- /dev/null +++ b/sql/updates/hotfixes/master/2021_03_14_02_hotfixes.sql @@ -0,0 +1,52 @@ +-- +-- Table structure for table `adventure_map_poi` +-- +DROP TABLE IF EXISTS `adventure_map_poi`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `adventure_map_poi` ( + `ID` int(10) unsigned NOT NULL DEFAULT '0', + `Title` text, + `Description` text, + `WorldPositionX` float NOT NULL DEFAULT '0', + `WorldPositionY` float NOT NULL DEFAULT '0', + `Type` tinyint(4) NOT NULL DEFAULT '0', + `PlayerConditionID` int(10) unsigned NOT NULL DEFAULT '0', + `QuestID` int(10) unsigned NOT NULL DEFAULT '0', + `LfgDungeonID` int(10) unsigned NOT NULL DEFAULT '0', + `RewardItemID` int(11) NOT NULL DEFAULT '0', + `UiTextureAtlasMemberID` int(10) unsigned NOT NULL DEFAULT '0', + `UiTextureKitID` int(10) unsigned NOT NULL DEFAULT '0', + `MapID` int(11) NOT NULL DEFAULT '0', + `AreaTableID` int(10) unsigned NOT NULL DEFAULT '0', + `VerifiedBuild` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`ID`,`VerifiedBuild`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `adventure_map_poi_locale` +-- +DROP TABLE IF EXISTS `adventure_map_poi_locale`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `adventure_map_poi_locale` ( + `ID` int(10) unsigned NOT NULL DEFAULT '0', + `locale` varchar(4) NOT NULL, + `Title_lang` text, + `Description_lang` text, + `VerifiedBuild` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`ID`,`locale`,`VerifiedBuild`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci +/*!50500 PARTITION BY LIST COLUMNS(locale) +(PARTITION deDE VALUES IN ('deDE') ENGINE = InnoDB, + PARTITION esES VALUES IN ('esES') ENGINE = InnoDB, + PARTITION esMX VALUES IN ('esMX') ENGINE = InnoDB, + PARTITION frFR VALUES IN ('frFR') ENGINE = InnoDB, + PARTITION itIT VALUES IN ('itIT') ENGINE = InnoDB, + PARTITION koKR VALUES IN ('koKR') ENGINE = InnoDB, + PARTITION ptBR VALUES IN ('ptBR') ENGINE = InnoDB, + PARTITION ruRU VALUES IN ('ruRU') ENGINE = InnoDB, + PARTITION zhCN VALUES IN ('zhCN') ENGINE = InnoDB, + PARTITION zhTW VALUES IN ('zhTW') ENGINE = InnoDB) */; +/*!40101 SET character_set_client = @saved_cs_client */;