Files
CypherCore/Source/Game/Handlers/AdventureMapHandler.cs
T
2023-01-18 17:25:32 -05:00

34 lines
1.1 KiB
C#

// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
using Framework.Constants;
using Game.DataStorage;
using Game.Networking;
using Game.Networking.Packets;
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);
}
}
}