public static byte GetNPCIcon(ActorPC pc, Npc npc) { byte icon = 0; SagaDB.Quest.Quest q = Quest.QuestsManager.GetActiveQuest(pc); 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(pc, q.ID, s.ID)) { icon += 2; } if (icon >= 2) { break; } } } } Npc.QuestReqirement pq = npc.GetAvaluablePersonalQuest(pc); if (pq != null) { icon += 1; } q = QuestsManager.GetActivePersonalQuest(pc); if (icon != 3 && icon != 2) { 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(pc, q.ID, s.ID)) { icon += 2; } if (icon >= 2) { break; } } } } } return(icon); }
public void OnPersonalRequest(Packets.Client.NPCPersonalRequest p) { if (this.Char.CurTarget == null) { return; } Npc npc = (Npc)this.Char.CurTarget.e; Npc.QuestReqirement quest = npc.GetAvaluablePersonalQuest(this.Char); if (quest != null) { if (npc.Functable.ContainsKey((byte)Npc.Functions.AcceptPersonalRequest)) { npc.Functable[(byte)Npc.Functions.AcceptPersonalRequest].DynamicInvoke(this.Char, quest.QID, p.GetValue()); } } }
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); }
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);; }