Esempio n. 1
0
        /// <summary>
        /// Check list of available NPC gossip options and click on each
        /// </summary>
        /// <param name="npc">NPC</param>
        /// <returns>true if NPC has any service</returns>
        private static bool CheckAvailGossips(NPC npc, string lfs)
        {
            // Get list of options
            string[][] opts = GetGossipList(lfs);

            if (opts == null || (opts[0].Length > 0))
            {
                Output.Instance.Log("Checking each available gossip option");
                // TODO We only need test standard service but not talking one, especially teleporting one

                for (int i = 0; i < opts[0].Length; i++)
                {
                    string cur_opts  = opts[0][i];
                    string cur_descr = opts[1][i];

                    // Select only options that brings extra dialog
                    // like vendor
                    switch (cur_opts)
                    {
                    case "gossip":
                        // Check if it's binding options
                        npc.AddGossip(cur_descr, DataManager.CurWoWVersion.
                                      NpcConfig.PortOptionRx.IsMatch(cur_descr));
                        break;

                    case "vendor":
                    case "trainer":
                        Output.Instance.Debug("Selecting gossip option: " + i + "; " + cur_opts);
                        SelectNpcOption(npc, "SelectGossipOption", i + 1, lfs);
                        break;

                    case "binder":
                    case "taxi":
                    case "banker":
                    case "battlemaster":
                        AddNpcService(npc, cur_opts, null, lfs);
                        break;

                    default:
                        throw new UnknownServiceException(cur_opts);
                    }
                }
            }

            return(true);
        }