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

            List <Quest> Starter = WorldMgr.GetStartQuests(Entry);

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

            return(Starter.Find(q => Plr.QtsInterface.CanStartQuest(q)) != null);
        }
예제 #2
0
 public bool HasQuestStarter(UInt16 QuestID)
 {
     return(WorldMgr.GetStartQuests(Entry).Find(info => info.Entry == QuestID) != null);
 }
예제 #3
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);
        }