private static void AddNpcQuestStart(NPC npc, string[] opts, string lfs) { Quest q = null; // Check parsing result for (int i = 1; i < 4; i++) { string s = opts[i]; if (string.IsNullOrEmpty(opts[i])) { Output.Instance.LogError(lfs, i + " parameter from quest info result is empty"); return; } // Check each value against pattern Regex rx = DataManager.CurWoWVersion.QuestConfig.Patterns[i - 1]; if (!rx.IsMatch(s)) { Output.Instance.LogError(lfs, i + " parameter '" + s + "' from quest scan" + " doesn't match template '" + rx.ToString() + "'"); return; } } // Read header string[] headers = opts[1].Split(new string[] { "::" }, StringSplitOptions.None); string qtitle = headers[0]; // At this point we staying in front of NPC and quest opened // Accepting quest and reading it info from toon's quest log try { QuestHelper.DoAction(QuestHelper.MakeAcceptQuestReq(), lfs); // Look on quest log for all details string[] ret = ProcessManager.Injector. Lua_ExecByName("GetLogQuestInfo", new string[] { qtitle }); // Parse result string[] info = opts[2].Split(','); string[] details = opts[3].Split(new string[] { "||" }, StringSplitOptions.None); Output.Instance.Log("Assign current NPC as start for quest '" + qtitle + "'"); q = new Quest(Convert.ToInt32(ret[1]), qtitle, headers[1], headers[2], Convert.ToInt32(ret[2]), new int[] { Convert.ToInt32(info[3]), Convert.ToInt32(info[4]), Convert.ToInt32(info[5]) }, details, ret[4], info[0], ret[3]); } catch (Exception e) { Output.Instance.LogError(lfs, "Error creating quest with parameters " + "Header: " + headers[1] + "; Text: " + headers[2] + "; Level: " + headers[3], e); throw new QuestProcessingException("Failed add quest" + e.Message); } finally { // Whatever happened need abandon quest QuestHelper.AbandonQuest(qtitle, lfs); } if (q != null) { // Screen in npcdata how many quests with same title exists Quest mq = DataManager.CurWoWVersion.GameObjData.FindMaxQuestByTitle(q.Title); if (mq != null) { q.QNum = mq.QNum + 1; // Probably I need link to high lvl quest with same title q.Relations.Add(q.Id); } npc.AddQuest(q); } }