コード例 #1
0
        private void ParseQuests(IList <string> lines)
        {
            for (int i = 0; i < lines.Count; i++)
            {
                if (!lines[i].ToUpper().StartsWith(QuestKey))
                {
                    continue;
                }

                var loadedNPC = NPCObject.Get(LoadedObjectID);

                if (loadedNPC == null)
                {
                    return;
                }

                while (++i < lines.Count)
                {
                    if (lines[i].StartsWith("["))
                    {
                        return;
                    }
                    if (String.IsNullOrEmpty(lines[i]))
                    {
                        continue;
                    }

                    int.TryParse(lines[i], out int index);

                    if (index == 0)
                    {
                        continue;
                    }

                    QuestInfo info = Envir.GetQuestInfo(Math.Abs(index));

                    if (info == null)
                    {
                        return;
                    }

                    if (index > 0)
                    {
                        info.NpcIndex = LoadedObjectID;
                    }
                    else
                    {
                        info.FinishNpcIndex = LoadedObjectID;
                    }

                    if (loadedNPC.Quests.All(x => x != info))
                    {
                        loadedNPC.Quests.Add(info);
                    }
                }
            }
        }