예제 #1
0
        public void OnNPCChat(Packets.Client.NPCChat p)
        {
            Actor aActor = map.GetActor(p.GetActorID());

            if (aActor == null || aActor.type == ActorType.PC)
            {
                return;
            }
            this.Char.CurTarget = aActor;
            ActorNPC CurNpc = (ActorNPC)aActor;
            Npc      npc    = (Npc)CurNpc.e;

            byte[]             tmp = null;
            SagaDB.Quest.Quest q   = Quest.QuestsManager.GetActiveQuest(this.Char);
            if (q != null)
            {
                if (npc.Questtable.ContainsKey(q.ID))
                {
                    foreach (SagaDB.Quest.Step s in npc.Questtable[q.ID].Steps.Values)
                    {
                        if (s.Status == Quest.QuestsManager.GetQuestStepStatus(this.Char, q.ID, s.ID))
                        {
                            tmp = new byte[CurNpc.Attribute.icons.Length + 1];
                            CurNpc.Attribute.icons.CopyTo(tmp, 0);
                            tmp[CurNpc.Attribute.icons.Length] = (byte)Npc.Functions.OfficialQuest;
                        }
                    }
                }
            }
            q = Quest.QuestsManager.GetActivePersonalQuest(this.Char);
            if (q != null)
            {
                if (npc.PersonalQuesttable.ContainsKey(q.ID))
                {
                    foreach (SagaDB.Quest.Step s in npc.PersonalQuesttable[q.ID].Steps.Values)
                    {
                        if (s.Status == Quest.QuestsManager.GetQuestStepStatus(this.Char, q.ID, s.ID))
                        {
                            tmp = new byte[CurNpc.Attribute.icons.Length + 1];
                            CurNpc.Attribute.icons.CopyTo(tmp, 0);
                            tmp[CurNpc.Attribute.icons.Length] = (byte)Npc.Functions.PersonalQuest;
                        }
                    }
                }
            }
            Npc.QuestReqirement pq = npc.GetAvaluablePersonalQuest(this.Char);
            if (pq != null)
            {
                if (tmp != null)
                {
                    byte[] tmp2 = new byte[tmp.Length + 1];
                    tmp.CopyTo(tmp2, 0);
                    tmp2[tmp.Length] = (byte)Npc.Functions.AcceptPersonalRequest;
                    tmp = tmp2;
                }
                else
                {
                    tmp = new byte[CurNpc.Attribute.icons.Length + 1];
                    CurNpc.Attribute.icons.CopyTo(tmp, 0);
                    tmp[CurNpc.Attribute.icons.Length] = (byte)Npc.Functions.AcceptPersonalRequest;
                }
            }
            if (tmp == null)
            {
                tmp = CurNpc.Attribute.icons;
            }
            Packets.Server.NPCChat sendPacket = new SagaMap.Packets.Server.NPCChat();
            sendPacket.SetActor(p.GetActorID());
            sendPacket.SetScript(CurNpc.Attribute.script);
            sendPacket.SetIcons((byte)tmp.Length, tmp);
            sendPacket.SetUnknown(1);

            this.netIO.SendPacket(sendPacket, this.SessionID);
        }
예제 #2
0
        public void OnNPCChat(Packets.Client.NPCChat p)
        {
            Actor aActor = map.GetActor(p.GetActorID());
            if (aActor == null || aActor.type == ActorType.PC) return;
            this.Char.CurTarget = aActor;
            ActorNPC CurNpc = (ActorNPC)aActor;
            Npc npc = (Npc)CurNpc.e;
            byte[] tmp = null;
            SagaDB.Quest.Quest q = Quest.QuestsManager.GetActiveQuest(this.Char);
            if (q != null)
            {
                if (npc.Questtable.ContainsKey(q.ID))
                {
                    foreach (SagaDB.Quest.Step s in npc.Questtable[q.ID].Steps.Values)
                    {
                        if (s.Status == Quest.QuestsManager.GetQuestStepStatus(this.Char, q.ID, s.ID))
                        {
                            tmp = new byte[CurNpc.Attribute.icons.Length + 1];
                            CurNpc.Attribute.icons.CopyTo(tmp, 0);
                            tmp[CurNpc.Attribute.icons.Length] = (byte)Npc.Functions.OfficialQuest;
                        }
                    }
                }
            }
            q = Quest.QuestsManager.GetActivePersonalQuest(this.Char);
            if (q != null)
            {
                if (npc.PersonalQuesttable.ContainsKey(q.ID))
                {
                    foreach (SagaDB.Quest.Step s in npc.PersonalQuesttable[q.ID].Steps.Values)
                    {
                        if (s.Status == Quest.QuestsManager.GetQuestStepStatus(this.Char, q.ID, s.ID))
                        {
                            tmp = new byte[CurNpc.Attribute.icons.Length + 1];
                            CurNpc.Attribute.icons.CopyTo(tmp, 0);
                            tmp[CurNpc.Attribute.icons.Length] = (byte)Npc.Functions.PersonalQuest;
                        }
                    }
                }
            }
            Npc.QuestReqirement pq = npc.GetAvaluablePersonalQuest(this.Char);
            if (pq != null)
            {
                if (tmp != null)
                {
                    byte[] tmp2 = new byte[tmp.Length + 1];
                    tmp.CopyTo(tmp2, 0);
                    tmp2[tmp.Length] = (byte)Npc.Functions.AcceptPersonalRequest;
                    tmp = tmp2;
                }
                else
                {
                    tmp = new byte[CurNpc.Attribute.icons.Length + 1];
                    CurNpc.Attribute.icons.CopyTo(tmp, 0);
                    tmp[CurNpc.Attribute.icons.Length] = (byte)Npc.Functions.AcceptPersonalRequest;
                }
            }
            if (tmp == null)
            {
                tmp = CurNpc.Attribute.icons;
            }
            Packets.Server.NPCChat sendPacket = new SagaMap.Packets.Server.NPCChat();
            sendPacket.SetActor(p.GetActorID());
            sendPacket.SetScript(CurNpc.Attribute.script);
            sendPacket.SetIcons((byte)tmp.Length, tmp);
            sendPacket.SetUnknown(1);

            this.netIO.SendPacket(sendPacket, this.SessionID);
        }
예제 #3
0
        public void OnNPCChat(Npc npc)
        {
            byte[]             tmp = null;
            SagaDB.Quest.Quest q   = Quest.QuestsManager.GetActiveQuest(this.Char);
            if (q != null)
            {
                if (npc.Questtable.ContainsKey(q.ID))
                {
                    foreach (SagaDB.Quest.Step s in npc.Questtable[q.ID].Steps.Values)
                    {
                        if (s.Status == Quest.QuestsManager.GetQuestStepStatus(this.Char, q.ID, s.ID))
                        {
                            tmp = new byte[npc.Actor.Attribute.icons.Length + 1];
                            npc.Actor.Attribute.icons.CopyTo(tmp, 0);
                            tmp[npc.Actor.Attribute.icons.Length] = (byte)Npc.Functions.OfficialQuest;
                        }
                    }
                }
            }
            q = Quest.QuestsManager.GetActivePersonalQuest(this.Char);
            if (q != null)
            {
                if (npc.PersonalQuesttable.ContainsKey(q.ID))
                {
                    foreach (SagaDB.Quest.Step s in npc.PersonalQuesttable[q.ID].Steps.Values)
                    {
                        if (s.Status == Quest.QuestsManager.GetQuestStepStatus(this.Char, q.ID, s.ID))
                        {
                            tmp = new byte[npc.Actor.Attribute.icons.Length + 1];
                            npc.Actor.Attribute.icons.CopyTo(tmp, 0);
                            tmp[npc.Actor.Attribute.icons.Length] = (byte)Npc.Functions.PersonalQuest;
                        }
                    }
                }
            }
            Npc.QuestReqirement pq = npc.GetAvaluablePersonalQuest(this.Char);
            if (pq != null)
            {
                if (tmp != null)
                {
                    byte[] tmp2 = new byte[tmp.Length + 1];
                    tmp.CopyTo(tmp2, 0);
                    tmp2[tmp.Length] = (byte)Npc.Functions.AcceptPersonalRequest;
                    tmp = tmp2;
                }
                else
                {
                    tmp = new byte[npc.Actor.Attribute.icons.Length + 1];
                    npc.Actor.Attribute.icons.CopyTo(tmp, 0);
                    tmp[npc.Actor.Attribute.icons.Length] = (byte)Npc.Functions.AcceptPersonalRequest;
                }
            }
            if (tmp == null)
            {
                tmp = npc.Actor.Attribute.icons;
            }
            Packets.Server.NPCChat sendPacket = new SagaMap.Packets.Server.NPCChat();
            sendPacket.SetActor(npc.Actor.id);
            sendPacket.SetScript(0);
            sendPacket.SetIcons((byte)tmp.Length, tmp);
            sendPacket.SetUnknown(1);

            this.netIO.SendPacket(sendPacket, this.SessionID);;
        }
예제 #4
0
        public void OnNPCChat(Npc npc)
        {
            byte[] tmp = null;
            SagaDB.Quest.Quest q = Quest.QuestsManager.GetActiveQuest(this.Char);
            if (q != null)
            {
                if (npc.Questtable.ContainsKey(q.ID))
                {
                    foreach (SagaDB.Quest.Step s in npc.Questtable[q.ID].Steps.Values)
                    {
                        if (s.Status == Quest.QuestsManager.GetQuestStepStatus(this.Char, q.ID, s.ID))
                        {
                            tmp = new byte[npc.Actor.Attribute.icons.Length + 1];
                            npc.Actor.Attribute.icons.CopyTo(tmp, 0);
                            tmp[npc.Actor.Attribute.icons.Length] = (byte)Npc.Functions.OfficialQuest;
                        }
                    }
                }
            }
            q = Quest.QuestsManager.GetActivePersonalQuest(this.Char);
            if (q != null)
            {
                if (npc.PersonalQuesttable.ContainsKey(q.ID))
                {
                    foreach (SagaDB.Quest.Step s in npc.PersonalQuesttable[q.ID].Steps.Values)
                    {
                        if (s.Status == Quest.QuestsManager.GetQuestStepStatus(this.Char, q.ID, s.ID))
                        {
                            tmp = new byte[npc.Actor.Attribute.icons.Length + 1];
                            npc.Actor.Attribute.icons.CopyTo(tmp, 0);
                            tmp[npc.Actor.Attribute.icons.Length] = (byte)Npc.Functions.PersonalQuest;
                        }
                    }
                }
            }
            Npc.QuestReqirement pq = npc.GetAvaluablePersonalQuest(this.Char);
            if (pq != null)
            {
                if (tmp != null)
                {
                    byte[] tmp2 = new byte[tmp.Length + 1];
                    tmp.CopyTo(tmp2, 0);
                    tmp2[tmp.Length] = (byte)Npc.Functions.AcceptPersonalRequest;
                    tmp = tmp2;
                }
                else
                {
                    tmp = new byte[npc.Actor.Attribute.icons.Length + 1];
                    npc.Actor.Attribute.icons.CopyTo(tmp, 0);
                    tmp[npc.Actor.Attribute.icons.Length] = (byte)Npc.Functions.AcceptPersonalRequest;
                }
            }
            if (tmp == null)
            {
                tmp = npc.Actor.Attribute.icons;
            }
            Packets.Server.NPCChat sendPacket = new SagaMap.Packets.Server.NPCChat();
            sendPacket.SetActor(npc.Actor.id);
            sendPacket.SetScript(0);
            sendPacket.SetIcons((byte)tmp.Length, tmp);
            sendPacket.SetUnknown(1);

            this.netIO.SendPacket(sendPacket, this.SessionID); ;
        }