예제 #1
0
        public bool CreatureHasQuestToAchieve(Player Plr)
        {
            if (Entry == 0)
            {
                return(false);
            }

            List <Quest> Finisher = WorldMgr.GetFinishersQuests(Entry);

            if (Finisher == null)
            {
                return(false);
            }

            foreach (Quest Q in Finisher)
            {
                Character_quest CQ = Plr.QtsInterface.GetQuest(Q.Entry);
                if (CQ != null && !CQ.Done && CQ.IsDone())
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #2
0
        public bool hasQuestFinisher(UInt16 QuestID)
        {
            List <Quest> Quests = WorldMgr.GetFinishersQuests(Entry);

            if (Quests != null)
            {
                return(WorldMgr.GetFinishersQuests(Entry).Find(info => info.Entry == QuestID) != null);
            }

            return(false);
        }
예제 #3
0
        public bool CreatureHasQuestToComplete(Player Plr)
        {
            if (Entry == 0)
            {
                return(false);
            }

            List <Quest> Finisher = WorldMgr.GetFinishersQuests(Entry);

            if (Finisher == null)
            {
                return(false);
            }

            return(Finisher.Find(q => Plr.QtsInterface.CanEndQuest(q)) != null);
        }
예제 #4
0
        public void HandleInteract(Player Plr, InteractMenu Menu)
        {
            if (Entry == 0)
            {
                return;
            }

            List <Quest> Starter    = WorldMgr.GetStartQuests(Entry);
            List <Quest> Finisher   = WorldMgr.GetFinishersQuests(Entry);
            List <Quest> InProgress = Starter != null?Starter.FindAll(info => Plr.QtsInterface.HasQuest(info.Entry) && !Plr.QtsInterface.HasDoneQuest(info.Entry)) : null;

            string Text = WorldMgr.GetCreatureText(Entry);

            if (Starter == null && Finisher == null && Text.Length <= 0 && InProgress == null)
            {
                return;
            }

            PacketOut Out = new PacketOut((byte)Opcodes.F_INTERACT_RESPONSE);

            Out.WriteByte(0);
            Out.WriteUInt16(Obj.Oid);
            Out.Fill(0, 3);
            Out.WriteByte(0x60);
            Out.WriteUInt32(0);
            Out.WriteUInt16(Plr.Oid);

            if (Starter != null)
            {
                List <Quest> Starts = Starter.FindAll(q => Plr.QtsInterface.CanStartQuest(q));

                Log.Success("QuestInterface", "Handle Interact : Starts=" + Starts.Count);

                Out.WriteByte((byte)Starts.Count);
                foreach (Quest Q in Starts)
                {
                    Out.WriteByte(0);
                    Out.WriteUInt16(Q.Entry);
                    Out.WriteUInt16(0);
                    Out.WritePascalString(Q.Name);
                }
            }
            else
            {
                Out.WriteByte(0);
            }

            if (Finisher != null)
            {
                List <Quest> Finishs = Finisher.FindAll(q => Plr.QtsInterface.CanEndQuest(q));

                Log.Success("QuestInterface", "Handle Interact : Finishs=" + Finishs.Count);

                Out.WriteByte((byte)Finishs.Count);
                foreach (Quest Q in Finishs)
                {
                    Out.WriteByte(0);
                    Out.WriteUInt16(Q.Entry);
                    Out.WritePascalString(Q.Name);
                }
            }
            else if (InProgress != null)
            {
                Log.Success("QuestInterface", "Handle Interact : InProgress=" + InProgress.Count);

                Out.WriteByte((byte)InProgress.Count);
                foreach (Quest Q in InProgress)
                {
                    Out.WriteByte(0);
                    Out.WriteUInt16(Q.Entry);
                    Out.WritePascalString(Q.Name);
                }
            }
            else
            {
                Out.WriteByte(0);
            }

            Log.Info("QTS", "Text=" + Text);
            Out.WriteUInt16((ushort)Text.Length);
            Out.WriteStringBytes(Text);
            Out.WriteByte(0);

            Plr.SendPacket(Out);
        }