Beispiel #1
0
        void HandleQuestLogRemoveQuest(QuestLogRemoveQuest packet)
        {
            if (packet.Entry < SharedConst.MaxQuestLogSize)
            {
                uint questId = GetPlayer().GetQuestSlotQuestId(packet.Entry);
                if (questId != 0)
                {
                    if (!GetPlayer().TakeQuestSourceItem(questId, true))
                    {
                        return;                                     // can't un-equip some items, reject quest cancel
                    }
                    Quest       quest     = Global.ObjectMgr.GetQuestTemplate(questId);
                    QuestStatus oldStatus = _player.GetQuestStatus(questId);

                    if (quest != null)
                    {
                        if (quest.HasSpecialFlag(QuestSpecialFlags.Timed))
                        {
                            GetPlayer().RemoveTimedQuest(questId);
                        }

                        if (quest.HasFlag(QuestFlags.Pvp))
                        {
                            GetPlayer().pvpInfo.IsHostile = GetPlayer().pvpInfo.IsInHostileArea || GetPlayer().HasPvPForcingQuest();
                            GetPlayer().UpdatePvPState();
                        }
                    }

                    GetPlayer().TakeQuestSourceItem(questId, true); // remove quest src item from player
                    GetPlayer().AbandonQuest(questId);              // remove all quest items player received before abandoning quest. Note, this does not remove normal drop items that happen to be quest requirements.
                    GetPlayer().RemoveActiveQuest(questId);
                    GetPlayer().RemoveCriteriaTimer(CriteriaTimedTypes.Quest, questId);

                    Log.outInfo(LogFilter.Network, "Player {0} abandoned quest {1}", GetPlayer().GetGUID().ToString(), questId);

                    Global.ScriptMgr.OnQuestStatusChange(_player, questId);

                    if (quest != null)
                    {
                        Global.ScriptMgr.OnQuestStatusChange(_player, quest, oldStatus, QuestStatus.None);
                    }
                }

                GetPlayer().SetQuestSlot(packet.Entry, 0);

                GetPlayer().UpdateCriteria(CriteriaTypes.QuestAbandoned, 1);
            }
        }
Beispiel #2
0
        void HandleQuestConfirmAccept(QuestConfirmAccept packet)
        {
            Quest quest = Global.ObjectMgr.GetQuestTemplate(packet.QuestID);

            if (quest != null)
            {
                if (!quest.HasFlag(QuestFlags.PartyAccept))
                {
                    return;
                }

                Player originalPlayer = Global.ObjAccessor.FindPlayer(GetPlayer().GetPlayerSharingQuest());
                if (originalPlayer == null)
                {
                    return;
                }

                if (!GetPlayer().IsInSameRaidWith(originalPlayer))
                {
                    return;
                }

                if (!originalPlayer.IsActiveQuest(packet.QuestID))
                {
                    return;
                }

                if (!GetPlayer().CanTakeQuest(quest, true))
                {
                    return;
                }

                if (GetPlayer().CanAddQuest(quest, true))
                {
                    GetPlayer().AddQuestAndCheckCompletion(quest, null);                // NULL, this prevent DB script from duplicate running

                    if (quest.SourceSpellID > 0)
                    {
                        _player.CastSpell(_player, quest.SourceSpellID, true);
                    }
                }
            }

            GetPlayer().ClearQuestSharingInfo();
        }
Beispiel #3
0
        void HandleQuestgiverAcceptQuest(QuestGiverAcceptQuest packet)
        {
            WorldObject obj;

            if (!packet.QuestGiverGUID.IsPlayer())
            {
                obj = Global.ObjAccessor.GetObjectByTypeMask(_player, packet.QuestGiverGUID, TypeMask.Unit | TypeMask.GameObject | TypeMask.Item);
            }
            else
            {
                obj = Global.ObjAccessor.FindPlayer(packet.QuestGiverGUID);
            }

            var CLOSE_GOSSIP_CLEAR_SHARING_INFO = new System.Action(() =>
            {
                GetPlayer().PlayerTalkClass.SendCloseGossip();
                GetPlayer().ClearQuestSharingInfo();
            });

            // no or incorrect quest giver
            if (obj == null)
            {
                CLOSE_GOSSIP_CLEAR_SHARING_INFO();
                return;
            }

            Player playerQuestObject = obj.ToPlayer();

            if (playerQuestObject)
            {
                if ((_player.GetPlayerSharingQuest().IsEmpty() && _player.GetPlayerSharingQuest() != packet.QuestGiverGUID) || !playerQuestObject.CanShareQuest(packet.QuestID))
                {
                    CLOSE_GOSSIP_CLEAR_SHARING_INFO();
                    return;
                }
                if (!_player.IsInSameRaidWith(playerQuestObject))
                {
                    CLOSE_GOSSIP_CLEAR_SHARING_INFO();
                    return;
                }
            }
            else
            {
                if (!obj.HasQuest(packet.QuestID))
                {
                    CLOSE_GOSSIP_CLEAR_SHARING_INFO();
                    return;
                }
            }

            // some kind of WPE protection
            if (!_player.CanInteractWithQuestGiver(obj))
            {
                CLOSE_GOSSIP_CLEAR_SHARING_INFO();
                return;
            }

            Quest quest = Global.ObjectMgr.GetQuestTemplate(packet.QuestID);

            if (quest != null)
            {
                // prevent cheating
                if (!GetPlayer().CanTakeQuest(quest, true))
                {
                    CLOSE_GOSSIP_CLEAR_SHARING_INFO();
                    return;
                }

                if (!_player.GetPlayerSharingQuest().IsEmpty())
                {
                    Player player = Global.ObjAccessor.FindPlayer(_player.GetPlayerSharingQuest());
                    if (player != null)
                    {
                        player.SendPushToPartyResponse(_player, QuestPushReason.Accepted);
                        _player.ClearQuestSharingInfo();
                    }
                }

                if (_player.CanAddQuest(quest, true))
                {
                    _player.AddQuestAndCheckCompletion(quest, obj);

                    if (quest.HasFlag(QuestFlags.PartyAccept))
                    {
                        var group = _player.GetGroup();
                        if (group)
                        {
                            for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
                            {
                                Player player = refe.GetSource();

                                if (!player || player == _player)     // not self
                                {
                                    continue;
                                }

                                if (player.CanTakeQuest(quest, true))
                                {
                                    player.SetQuestSharingInfo(_player.GetGUID(), quest.Id);

                                    //need confirmation that any gossip window will close
                                    player.PlayerTalkClass.SendCloseGossip();

                                    _player.SendQuestConfirmAccept(quest, player);
                                }
                            }
                        }
                    }

                    _player.PlayerTalkClass.SendCloseGossip();

                    return;
                }
            }

            CLOSE_GOSSIP_CLEAR_SHARING_INFO();
        }
Beispiel #4
0
        void HandlePushQuestToParty(PushQuestToParty packet)
        {
            if (!GetPlayer().CanShareQuest(packet.QuestID))
            {
                return;
            }

            Quest quest = Global.ObjectMgr.GetQuestTemplate(packet.QuestID);

            if (quest == null)
            {
                return;
            }

            Player sender = GetPlayer();

            Group group = sender.GetGroup();

            if (!group)
            {
                sender.SendPushToPartyResponse(sender, QuestPushReason.NotInParty);
                return;
            }

            for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
            {
                Player receiver = refe.GetSource();

                if (!receiver || receiver == sender)
                {
                    continue;
                }

                if (!receiver.SatisfyQuestStatus(quest, false))
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.OnQuest);
                    continue;
                }

                if (receiver.GetQuestStatus(packet.QuestID) == QuestStatus.Complete)
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.AlreadyDone);
                    continue;
                }

                if (!receiver.SatisfyQuestDay(quest, false))
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.DifferentServerDaily);
                    continue;
                }

                if (!receiver.CanTakeQuest(quest, false))
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.Invalid);
                    continue;
                }

                if (!receiver.SatisfyQuestLog(false))
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.LogFull);
                    continue;
                }

                if (!receiver.GetPlayerSharingQuest().IsEmpty())
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.Busy);
                    continue;
                }

                sender.SendPushToPartyResponse(receiver, QuestPushReason.Success);

                if (quest.IsAutoAccept() && receiver.CanAddQuest(quest, true) && receiver.CanTakeQuest(quest, true))
                {
                    receiver.AddQuestAndCheckCompletion(quest, sender);
                }

                if ((quest.IsAutoComplete() && quest.IsRepeatable() && !quest.IsDailyOrWeekly()) || quest.HasFlag(QuestFlags.AutoComplete))
                {
                    receiver.PlayerTalkClass.SendQuestGiverRequestItems(quest, sender.GetGUID(), receiver.CanCompleteRepeatableQuest(quest), true);
                }
                else
                {
                    receiver.SetQuestSharingInfo(sender.GetGUID(), quest.Id);
                    receiver.PlayerTalkClass.SendQuestGiverQuestDetails(quest, receiver.GetGUID(), true, false);
                }
            }
        }
Beispiel #5
0
        void HandleQuestgiverCompleteQuest(QuestGiverCompleteQuest packet)
        {
            bool autoCompleteMode = packet.FromScript; // 0 - standart complete quest mode with npc, 1 - auto-complete mode

            Quest quest = Global.ObjectMgr.GetQuestTemplate(packet.QuestID);

            if (quest == null)
            {
                return;
            }

            if (autoCompleteMode && !quest.HasFlag(QuestFlags.AutoComplete))
            {
                return;
            }

            WorldObject obj;

            if (autoCompleteMode)
            {
                obj = GetPlayer();
            }
            else
            {
                obj = Global.ObjAccessor.GetObjectByTypeMask(GetPlayer(), packet.QuestGiverGUID, TypeMask.Unit | TypeMask.GameObject);
            }

            if (!obj)
            {
                return;
            }

            if (!autoCompleteMode)
            {
                if (!obj.HasInvolvedQuest(packet.QuestID))
                {
                    return;
                }

                // some kind of WPE protection
                if (!GetPlayer().CanInteractWithQuestGiver(obj))
                {
                    return;
                }
            }
            else
            {
                // Do not allow completing quests on other players.
                if (packet.QuestGiverGUID != GetPlayer().GetGUID())
                {
                    return;
                }
            }

            if (!GetPlayer().CanSeeStartQuest(quest) && GetPlayer().GetQuestStatus(packet.QuestID) == QuestStatus.None)
            {
                Log.outError(LogFilter.Network, "Possible hacking attempt: Player {0} ({1}) tried to complete quest [entry: {2}] without being in possession of the quest!",
                             GetPlayer().GetName(), GetPlayer().GetGUID().ToString(), packet.QuestID);
                return;
            }
            Battleground bg = GetPlayer().GetBattleground();

            if (bg)
            {
                bg.HandleQuestComplete(packet.QuestID, GetPlayer());
            }

            if (GetPlayer().GetQuestStatus(packet.QuestID) != QuestStatus.Complete)
            {
                if (quest.IsRepeatable())
                {
                    GetPlayer().PlayerTalkClass.SendQuestGiverRequestItems(quest, packet.QuestGiverGUID, GetPlayer().CanCompleteRepeatableQuest(quest), false);
                }
                else
                {
                    GetPlayer().PlayerTalkClass.SendQuestGiverRequestItems(quest, packet.QuestGiverGUID, GetPlayer().CanRewardQuest(quest, false), false);
                }
            }
            else
            {
                if (quest.HasSpecialFlag(QuestSpecialFlags.Deliver))                  // some items required
                {
                    GetPlayer().PlayerTalkClass.SendQuestGiverRequestItems(quest, packet.QuestGiverGUID, GetPlayer().CanRewardQuest(quest, false), false);
                }
                else                                            // no items required
                {
                    GetPlayer().PlayerTalkClass.SendQuestGiverOfferReward(quest, packet.QuestGiverGUID, true);
                }
            }
        }
Beispiel #6
0
        void HandleQuestgiverChooseReward(QuestGiverChooseReward packet)
        {
            Quest quest = Global.ObjectMgr.GetQuestTemplate(packet.QuestID);

            if (quest == null)
            {
                return;
            }

            if (packet.Choice.Item.ItemID != 0)
            {
                switch (packet.Choice.LootItemType)
                {
                case LootItemType.Item:
                    ItemTemplate rewardProto = Global.ObjectMgr.GetItemTemplate(packet.Choice.Item.ItemID);
                    if (rewardProto == null)
                    {
                        Log.outError(LogFilter.Network, "Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player {0} ({1}) tried to get invalid reward item (Item Entry: {2}) for quest {3} (possible packet-hacking detected)", GetPlayer().GetName(), GetPlayer().GetGUID().ToString(), packet.Choice.Item.ItemID, packet.QuestID);
                        return;
                    }

                    bool itemValid = false;
                    for (uint i = 0; i < quest.GetRewChoiceItemsCount(); ++i)
                    {
                        if (quest.RewardChoiceItemId[i] != 0 && quest.RewardChoiceItemType[i] == LootItemType.Item && quest.RewardChoiceItemId[i] == packet.Choice.Item.ItemID)
                        {
                            itemValid = true;
                            break;
                        }
                    }

                    if (!itemValid && quest.PackageID != 0)
                    {
                        var questPackageItems = Global.DB2Mgr.GetQuestPackageItems(quest.PackageID);
                        if (questPackageItems != null)
                        {
                            foreach (var questPackageItem in questPackageItems)
                            {
                                if (questPackageItem.ItemID != packet.Choice.Item.ItemID)
                                {
                                    continue;
                                }

                                if (_player.CanSelectQuestPackageItem(questPackageItem))
                                {
                                    itemValid = true;
                                    break;
                                }
                            }
                        }

                        if (!itemValid)
                        {
                            var questPackageItems1 = Global.DB2Mgr.GetQuestPackageItemsFallback(quest.PackageID);
                            if (questPackageItems1 != null)
                            {
                                foreach (var questPackageItem in questPackageItems1)
                                {
                                    if (questPackageItem.ItemID != packet.Choice.Item.ItemID)
                                    {
                                        continue;
                                    }

                                    itemValid = true;
                                    break;
                                }
                            }
                        }
                    }

                    if (!itemValid)
                    {
                        Log.outError(LogFilter.Network, "Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player {0} ({1}) tried to get reward item (Item Entry: {2}) wich is not a reward for quest {3} (possible packet-hacking detected)", GetPlayer().GetName(), GetPlayer().GetGUID().ToString(), packet.Choice.Item.ItemID, packet.QuestID);
                        return;
                    }
                    break;

                case LootItemType.Currency:
                    if (!CliDB.CurrencyTypesStorage.HasRecord(packet.Choice.Item.ItemID))
                    {
                        Log.outError(LogFilter.Player, $"Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player {_player.GetName()} ({_player.GetGUID()}) tried to get invalid reward currency (Currency ID: {packet.Choice.Item.ItemID}) for quest {packet.QuestID} (possible packet-hacking detected)");
                        return;
                    }

                    bool currencyValid = false;
                    for (uint i = 0; i < quest.GetRewChoiceItemsCount(); ++i)
                    {
                        if (quest.RewardChoiceItemId[i] != 0 && quest.RewardChoiceItemType[i] == LootItemType.Currency && quest.RewardChoiceItemId[i] == packet.Choice.Item.ItemID)
                        {
                            currencyValid = true;
                            break;
                        }
                    }
                    if (!currencyValid)
                    {
                        Log.outError(LogFilter.Player, $"Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player {_player.GetName()} ({_player.GetGUID()}) tried to get reward currency (Currency ID: {packet.Choice.Item.ItemID}) wich is not a reward for quest {packet.QuestID} (possible packet-hacking detected)");
                        return;
                    }
                    break;
                }
            }

            WorldObject obj = GetPlayer();

            if (!quest.HasFlag(QuestFlags.AutoComplete))
            {
                obj = Global.ObjAccessor.GetObjectByTypeMask(GetPlayer(), packet.QuestGiverGUID, TypeMask.Unit | TypeMask.GameObject);
                if (!obj || !obj.HasInvolvedQuest(packet.QuestID))
                {
                    return;
                }

                // some kind of WPE protection
                if (!GetPlayer().CanInteractWithQuestGiver(obj))
                {
                    return;
                }
            }

            if ((!GetPlayer().CanSeeStartQuest(quest) && GetPlayer().GetQuestStatus(packet.QuestID) == QuestStatus.None) ||
                (GetPlayer().GetQuestStatus(packet.QuestID) != QuestStatus.Complete && !quest.IsAutoComplete()))
            {
                Log.outError(LogFilter.Network, "Error in QuestStatus.Complete: player {0} ({1}) tried to complete quest {2}, but is not allowed to do so (possible packet-hacking or high latency)",
                             GetPlayer().GetName(), GetPlayer().GetGUID().ToString(), packet.QuestID);
                return;
            }

            if (GetPlayer().CanRewardQuest(quest, packet.Choice.LootItemType, packet.Choice.Item.ItemID, true))
            {
                GetPlayer().RewardQuest(quest, packet.Choice.LootItemType, packet.Choice.Item.ItemID, obj);

                switch (obj.GetTypeId())
                {
                case TypeId.Unit:
                case TypeId.Player:
                {
                    //For AutoSubmition was added plr case there as it almost same exclute AI script cases.
                    Unit unitQGiver = obj.ToUnit();
                    // Send next quest
                    Quest nextQuest = _player.GetNextQuest(packet.QuestGiverGUID, quest);
                    if (nextQuest != null)
                    {
                        // Only send the quest to the player if the conditions are met
                        if (_player.CanTakeQuest(nextQuest, false))
                        {
                            if (nextQuest.IsAutoAccept() && _player.CanAddQuest(nextQuest, true))
                            {
                                _player.AddQuestAndCheckCompletion(nextQuest, obj);
                            }

                            _player.PlayerTalkClass.SendQuestGiverQuestDetails(nextQuest, packet.QuestGiverGUID, true, false);
                        }
                    }

                    _player.PlayerTalkClass.ClearMenus();
                    var qGiverAI = unitQGiver.GetAI();
                    if (qGiverAI != null)
                    {
                        qGiverAI.QuestReward(_player, quest, packet.Choice.LootItemType, packet.Choice.Item.ItemID);
                    }
                    break;
                }

                case TypeId.GameObject:
                {
                    GameObject questGiver = obj.ToGameObject();
                    // Send next quest
                    Quest nextQuest = _player.GetNextQuest(packet.QuestGiverGUID, quest);
                    if (nextQuest != null)
                    {
                        // Only send the quest to the player if the conditions are met
                        if (_player.CanTakeQuest(nextQuest, false))
                        {
                            if (nextQuest.IsAutoAccept() && _player.CanAddQuest(nextQuest, true))
                            {
                                _player.AddQuestAndCheckCompletion(nextQuest, obj);
                            }

                            _player.PlayerTalkClass.SendQuestGiverQuestDetails(nextQuest, packet.QuestGiverGUID, true, false);
                        }
                    }

                    _player.PlayerTalkClass.ClearMenus();
                    questGiver.GetAI().QuestReward(_player, quest, packet.Choice.LootItemType, packet.Choice.Item.ItemID);
                    break;
                }

                default:
                    break;
                }
            }
            else
            {
                GetPlayer().PlayerTalkClass.SendQuestGiverOfferReward(quest, packet.QuestGiverGUID, true);
            }
        }
Beispiel #7
0
        void HandlePushQuestToParty(PushQuestToParty packet)
        {
            Quest quest = Global.ObjectMgr.GetQuestTemplate(packet.QuestID);

            if (quest == null)
            {
                return;
            }

            Player sender = GetPlayer();

            if (!_player.CanShareQuest(packet.QuestID))
            {
                sender.SendPushToPartyResponse(sender, QuestPushReason.NotAllowed);
                return;
            }

            // in pool and not currently available (wintergrasp weekly, dalaran weekly) - can't share
            if (Global.QuestPoolMgr.IsQuestActive(packet.QuestID))
            {
                sender.SendPushToPartyResponse(sender, QuestPushReason.NotDaily);
                return;
            }

            Group group = sender.GetGroup();

            if (!group)
            {
                sender.SendPushToPartyResponse(sender, QuestPushReason.NotInParty);
                return;
            }

            for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
            {
                Player receiver = refe.GetSource();

                if (!receiver || receiver == sender)
                {
                    continue;
                }

                if (!receiver.GetPlayerSharingQuest().IsEmpty())
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.Busy);
                    continue;
                }

                if (!receiver.IsAlive())
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.Dead);
                    receiver.SendPushToPartyResponse(sender, QuestPushReason.DeadToRecipient, quest);
                    continue;
                }

                switch (receiver.GetQuestStatus(packet.QuestID))
                {
                case QuestStatus.Rewarded:
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.AlreadyDone);
                    receiver.SendPushToPartyResponse(sender, QuestPushReason.AlreadyDoneToRecipient, quest);
                    continue;
                }

                case QuestStatus.Incomplete:
                case QuestStatus.Complete:
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.OnQuest);
                    receiver.SendPushToPartyResponse(sender, QuestPushReason.OnQuestToRecipient, quest);
                    continue;
                }

                default:
                    break;
                }

                if (!receiver.SatisfyQuestLog(false))
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.LogFull);
                    receiver.SendPushToPartyResponse(sender, QuestPushReason.LogFullToRecipient, quest);
                    continue;
                }

                if (!receiver.SatisfyQuestDay(quest, false))
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.AlreadyDone);
                    receiver.SendPushToPartyResponse(sender, QuestPushReason.AlreadyDoneToRecipient, quest);
                    continue;
                }

                if (!receiver.SatisfyQuestMinLevel(quest, false))
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.LowLevel);
                    receiver.SendPushToPartyResponse(sender, QuestPushReason.LowLevelToRecipient, quest);
                    continue;
                }

                if (!receiver.SatisfyQuestMaxLevel(quest, false))
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.HighLevel);
                    receiver.SendPushToPartyResponse(sender, QuestPushReason.HighLevelToRecipient, quest);
                    continue;
                }

                if (!receiver.SatisfyQuestClass(quest, false))
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.Class);
                    receiver.SendPushToPartyResponse(sender, QuestPushReason.ClassToRecipient, quest);
                    continue;
                }

                if (!receiver.SatisfyQuestRace(quest, false))
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.Race);
                    receiver.SendPushToPartyResponse(sender, QuestPushReason.RaceToRecipient, quest);
                    continue;
                }

                if (!receiver.SatisfyQuestReputation(quest, false))
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.LowFaction);
                    receiver.SendPushToPartyResponse(sender, QuestPushReason.LowFactionToRecipient, quest);
                    continue;
                }

                if (!receiver.SatisfyQuestDependentQuests(quest, false))
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.Prerequisite);
                    receiver.SendPushToPartyResponse(sender, QuestPushReason.PrerequisiteToRecipient, quest);
                    continue;
                }

                if (!receiver.SatisfyQuestExpansion(quest, false))
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.Expansion);
                    receiver.SendPushToPartyResponse(sender, QuestPushReason.ExpansionToRecipient, quest);
                    continue;
                }

                if (!receiver.CanTakeQuest(quest, false))
                {
                    sender.SendPushToPartyResponse(receiver, QuestPushReason.Invalid);
                    receiver.SendPushToPartyResponse(sender, QuestPushReason.InvalidToRecipient, quest);
                    continue;
                }

                sender.SendPushToPartyResponse(receiver, QuestPushReason.Success);

                if (quest.IsAutoAccept() && receiver.CanAddQuest(quest, true) && receiver.CanTakeQuest(quest, true))
                {
                    receiver.AddQuestAndCheckCompletion(quest, sender);
                }

                if ((quest.IsAutoComplete() && quest.IsRepeatable() && !quest.IsDailyOrWeekly()) || quest.HasFlag(QuestFlags.AutoComplete))
                {
                    receiver.PlayerTalkClass.SendQuestGiverRequestItems(quest, sender.GetGUID(), receiver.CanCompleteRepeatableQuest(quest), true);
                }
                else
                {
                    receiver.SetQuestSharingInfo(sender.GetGUID(), quest.Id);
                    receiver.PlayerTalkClass.SendQuestGiverQuestDetails(quest, receiver.GetGUID(), true, false);
                }
            }
        }