Beispiel #1
0
        /// <summary>Handles the quest giver complete quest.</summary>
        /// <param name="client">The client.</param>
        /// <param name="packet">The packet.</param>
        public static void HandleQuestGiverCompleteQuest(IRealmClient client, RealmPacketIn packet)
        {
            EntityId     guid            = packet.ReadEntityId();
            Character    activeCharacter = client.ActiveCharacter;
            IQuestHolder questGiver      = activeCharacter.QuestLog.GetQuestGiver(guid);

            if (questGiver == null)
            {
                return;
            }
            uint  qid       = packet.ReadUInt32();
            Quest questById = activeCharacter.QuestLog.GetQuestById(qid);

            if (questById == null || !questGiver.QuestHolderInfo.QuestEnds.Contains(questById.Template))
            {
                return;
            }
            if (questById.CompleteStatus != QuestCompleteStatus.Completed)
            {
                QuestHandler.SendRequestItems(questGiver, questById.Template, activeCharacter, false);
            }
            else
            {
                questById.OfferQuestReward(questGiver);
            }
        }
Beispiel #2
0
        /// <summary>Handles the quest giver query quest.</summary>
        public static void HandleQuestGiverQueryQuest(IRealmClient client, RealmPacketIn packet)
        {
            EntityId      guid            = packet.ReadEntityId();
            Character     activeCharacter = client.ActiveCharacter;
            uint          num             = packet.ReadUInt32();
            IQuestHolder  questGiver      = activeCharacter.QuestLog.GetQuestGiver(guid);
            QuestTemplate template        = QuestMgr.GetTemplate(num);

            if (questGiver == null || template == null)
            {
                return;
            }
            if (!activeCharacter.QuestLog.HasActiveQuest(num))
            {
                bool flag = template.Flags.HasFlag((Enum)QuestFlags.AutoAccept);
                QuestHandler.SendDetails((IEntity)questGiver, template, activeCharacter, !flag);
                if (!flag)
                {
                    return;
                }
                activeCharacter.QuestLog.TryAddQuest(template, questGiver);
            }
            else
            {
                QuestHandler.SendRequestItems(questGiver, template, activeCharacter, false);
            }
        }
Beispiel #3
0
        /// <summary>Handles the quest query.</summary>
        /// <param name="client">The client.</param>
        /// <param name="packet">The packet.</param>
        public static void HandleQuestQuery(IRealmClient client, RealmPacketIn packet)
        {
            QuestTemplate template = QuestMgr.GetTemplate(packet.ReadUInt32());

            if (template == null)
            {
                return;
            }
            QuestHandler.SendQuestQueryResponse(template, client.ActiveCharacter);
        }
Beispiel #4
0
        /// <summary>Handles the quest position of interest query.</summary>
        /// <param name="client">The client.</param>
        /// <param name="packet">The packet.</param>
        public static void HandleQuestPOIQuery(IRealmClient client, RealmPacketIn packet)
        {
            uint        count    = packet.ReadUInt32();
            List <uint> uintList = new List <uint>();

            for (int index = 0; (long)index < (long)count; ++index)
            {
                uintList.Add(packet.ReadUInt32());
            }
            QuestHandler.SendQuestPOIResponse(client, count, (IEnumerable <uint>)uintList);
        }
Beispiel #5
0
        public static void HandleQuestPushResult(IRealmClient client, RealmPacketIn packet)
        {
            EntityId  id    = packet.ReadEntityId();
            byte      num   = packet.ReadByte();
            Character giver = client.ActiveCharacter.Map.GetObject(id) as Character;

            if (giver == null || client.ActiveCharacter.Group == null || client.ActiveCharacter.Group != giver.Group)
            {
                return;
            }
            QuestHandler.SendQuestPushResult(client.ActiveCharacter, (QuestPushResponse)num, giver);
        }
Beispiel #6
0
        /// <summary>Handles the quest giver status query.</summary>
        /// <param name="client">The client.</param>
        /// <param name="packet">The packet.</param>
        public static void HandleQuestGiverStatusQuery(IRealmClient client, RealmPacketIn packet)
        {
            EntityId     guid            = packet.ReadEntityId();
            Character    activeCharacter = client.ActiveCharacter;
            IQuestHolder questGiver      = activeCharacter.QuestLog.GetQuestGiver(guid);

            if (questGiver == null)
            {
                return;
            }
            QuestStatus questGiverStatus = questGiver.QuestHolderInfo.GetHighestQuestGiverStatus(activeCharacter);

            QuestHandler.SendQuestGiverStatus(questGiver, questGiverStatus, activeCharacter);
        }
Beispiel #7
0
        public static void HandlePushQuestToParty(IRealmClient client, RealmPacketIn packet)
        {
            QuestTemplate qt = QuestMgr.GetTemplate(packet.ReadUInt32());

            if (qt == null || !qt.Sharable || client.ActiveCharacter.QuestLog.GetActiveQuest(qt.Id) == null)
            {
                return;
            }
            Group group = client.ActiveCharacter.Group;

            if (group == null)
            {
                return;
            }
            group.ForeachCharacter((Action <Character>)(chr =>
            {
                if (chr == null)
                {
                    return;
                }
                if (chr.QuestLog.ActiveQuestCount >= 25)
                {
                    QuestHandler.SendQuestPushResult(chr, QuestPushResponse.QuestlogFull, client.ActiveCharacter);
                }
                else if (chr.QuestLog.GetActiveQuest(qt.Id) != null)
                {
                    QuestHandler.SendQuestPushResult(chr, QuestPushResponse.AlreadyHave, client.ActiveCharacter);
                }
                else if (chr.QuestLog.FinishedQuests.Contains(qt.Id) && !qt.Repeatable)
                {
                    QuestHandler.SendQuestPushResult(chr, QuestPushResponse.AlreadyFinished, client.ActiveCharacter);
                }
                else if (qt.CheckBasicRequirements(chr) != QuestInvalidReason.Ok || !chr.IsAlive)
                {
                    QuestHandler.SendQuestPushResult(chr, QuestPushResponse.CannotTake, client.ActiveCharacter);
                }
                else if (!chr.IsInRadius((WorldObject)client.ActiveCharacter, 30f))
                {
                    QuestHandler.SendQuestPushResult(chr, QuestPushResponse.TooFar, client.ActiveCharacter);
                }
                else
                {
                    QuestHandler.SendQuestPushResult(chr, QuestPushResponse.Sharing, client.ActiveCharacter);
                    QuestHandler.SendDetails((IEntity)client.ActiveCharacter, qt, chr, true);
                }
            }));
        }
Beispiel #8
0
 /// <summary>Handles the quest confirm accept.</summary>
 /// <param name="client">The client.</param>
 /// <param name="packet">The packet.</param>
 public static void HandleQuestConfirmAccept(IRealmClient client, RealmPacketIn packet)
 {
     QuestHandler.SendQuestConfirmAccept(client);
 }
Beispiel #9
0
 public static void HandleQuestCompletedQuery(IRealmClient client, RealmPacketIn packet)
 {
     QuestHandler.SendQuestCompletedQueryResponse(client.ActiveCharacter);
 }