Пример #1
0
        private void questToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int updated = 0;
            int added   = 0;
            List <QuestInfo> newList = new List <QuestInfo>();

            foreach (var NewQuest in EditEnvir.QuestInfoList)
            {
                QuestInfo OldQuest = Envir.QuestInfoList.Find(x => x.Index == NewQuest.Index);
                if (OldQuest != null)
                {
                    OldQuest.UpdateQuestInfo(NewQuest);
                    OldQuest.LoadInfo();
                    updated++;
                }
                else if (OldQuest == null)
                {
                    QuestInfo CloneQuest = QuestInfo.CloneQuest(NewQuest);
                    CloneQuest.LoadInfo();
                    Envir.QuestInfoList.Add(CloneQuest);
                    added++;
                }
            }
            Enqueue("[Quest DataBase] total quests :" + Envir.QuestInfoList.Count.ToString());
            Enqueue(string.Format("[Quest Database] {0} quests have been updated", updated));
            Enqueue("[Quest DataBase] " + added.ToString() + " have been added");

            nPCScriptToolStripMenuItem_Click(null, null);


            foreach (var p in Envir.Players)
            {
                p.Connection.SentQuestInfo.Clear();
                p.Enqueue(new S.RefreshQuestInfo());
                p.GetQuestInfo();

                for (int i = 0; i < p.CurrentQuests.Count; i++)
                {
                    if (p.CurrentQuests[i].Completed)
                    {
                        continue;
                    }

                    p.CurrentQuests[i].ResyncTasks();
                    p.SendUpdateQuest(p.CurrentQuests[i], QuestState.Update);
                }
                p.GetCompletedQuests();
                p.GetClientCompletedQuests();
            }
        }