Exemple #1
0
        /// <summary>
        /// Initialize configuration parameters. 
        /// This method must be first called on application start
        /// For GUI mode from Main Form constructor
        /// For CMD mode from main thread
        /// The rest of events can be bind later but those 3 are mandatory
        /// </summary>
        /// <param name="OnFirstTimeRun">OnFirstTimeRun event handler</param>
        /// <param name="OnConfigFileChanged">OnConfigFileChanged event handler</param>
        /// <param name="OnShowErrorMessage">OnShowErrorMessage event handler</param>
        public static void Initialize(FirstTimeRunHandler OnFirstTimeRun,
            ConfigFileChangedHandler OnConfigFileChanged,
            ShowErrorMessageHandler OnShowErrorMessage)
        {
            Process.EnterDebugMode();

            // Load the configuration file
            // Configuration must be loaded first of all.
            FirstTimeRun += OnFirstTimeRun;
            ConfigFileChanged += OnConfigFileChanged;
            ShowErrorMessage += OnShowErrorMessage;

            XmlManager.Init();

            //\\ TEST
            // SaveNpcData();

            // Everything else after
            LoadConfig();
            XmlManager.Merge(config.WoWInfo.Version);
            XmlManager.AfterInit();

            #if DEBUG
            List<Route> lr = new List<Route>();
            Route r1 = new Route(new Endpoint(EndpointTypes.UNDEF, "", new Vector3D(1, 1, 1)),
                new Endpoint(EndpointTypes.UNDEF, "", new Vector3D(100, 100, 100)), "", true);
            lr.Add(r1);
            RouteListManager.Waypoints.Add(1F, lr);

            Route r2 = RouteListManager.FindRoute(new Vector3D(2, 2, 2));
            if (!ReferenceEquals(r1, r2))
                throw new Exception("Waypoints access failed");

            //\\ Test
            // Quest merge test
            Quest q1 = new Quest(1, "Test 1", "Test", "", 1, new int[6], new string[3], "", "", "");
            Quest q2 = new Quest(1, "Test 1", "Test", "", 1, new int[6], new string[3], "", "", "");

            if (!q1.Equals(q2))
                 throw new Exception("Quest Test 1 failed");

            // Add link  and dest
            q2.Relations.Add(11);
            q2.DestName = "npc";

            // Merge
            q1.MergeWith(q2);

            // check
            if (!q1.DestName.Equals("npc"))
                throw new Exception("Quest Test 2 failed");

            if (!q1.RelatedTo.Equals("11"))
                throw new Exception("Quest Test 3 failed");

            // Add extra relation
            q2.Relations.Add("10");
            q1.MergeWith(q2);
            if (!q1.RelatedTo.Equals("10,11"))
                throw new Exception("Quest Test 4 failed");

            if (!typeof(IMergeable).IsAssignableFrom(typeof(Quest)))
                throw new Exception("Quest Test 5 failed");
            /*
            NPC npc1 = ndata.Items[0].Items[2];
            NPC npc2 = ndata.Items[0].Items[2];

            if (!npc1.Equals(npc2))
                Environment.Exit(1);
            */
            /*
            LuaFunction lf = CurWoWVersion.FindLuaFunction("GetNpcDialogInfo");
            string c = lf.Code;
            // string c = "{0} {{}} {{'dd','xx'}}";
            string s = string.Format(c, 1);
            */
            /*
            NPC npc = new NPC();

            npc.Name = "Test XXX";
            npc.WPList.Add(new Vector3D(1, 2, 3));
            npc.AddService(new ClassTrainingService("HUNTER"));
            npc.AddQuest(new QuestHeader("Catch if u can", 1));

            SaveNpcData(); */
            #endif
        }
Exemple #2
0
        /// <summary>
        /// Initialize configuration parameters.
        /// This method must be first called on application start
        /// For GUI mode from Main Form constructor
        /// For CMD mode from main thread
        /// The rest of events can be bind later but those 3 are mandatory
        /// </summary>
        /// <param name="OnFirstTimeRun">OnFirstTimeRun event handler</param>
        /// <param name="OnConfigFileChanged">OnConfigFileChanged event handler</param>
        /// <param name="OnShowErrorMessage">OnShowErrorMessage event handler</param>
        public static void Initialize(FirstTimeRunHandler OnFirstTimeRun,
                                      ConfigFileChangedHandler OnConfigFileChanged,
                                      ShowErrorMessageHandler OnShowErrorMessage)
        {
            Process.EnterDebugMode();

            // Load the configuration file
            // Configuration must be loaded first of all.
            FirstTimeRun      += OnFirstTimeRun;
            ConfigFileChanged += OnConfigFileChanged;
            ShowErrorMessage  += OnShowErrorMessage;

            XmlManager.Init();

            //\\ TEST
            // SaveNpcData();

            // Everything else after
            LoadConfig();
            XmlManager.Merge(config.WoWInfo.Version);
            XmlManager.AfterInit();

#if DEBUG
            List <Route> lr = new List <Route>();
            Route        r1 = new Route(new Endpoint(EndpointTypes.UNDEF, "", new Vector3D(1, 1, 1)),
                                        new Endpoint(EndpointTypes.UNDEF, "", new Vector3D(100, 100, 100)), "", true);
            lr.Add(r1);
            RouteListManager.Waypoints.Add(1F, lr);

            Route r2 = RouteListManager.FindRoute(new Vector3D(2, 2, 2));
            if (!ReferenceEquals(r1, r2))
            {
                throw new Exception("Waypoints access failed");
            }

            //\\ Test
            // Quest merge test
            Quest q1 = new Quest(1, "Test 1", "Test", "", 1, new int[6], new string[3], "", "", "");
            Quest q2 = new Quest(1, "Test 1", "Test", "", 1, new int[6], new string[3], "", "", "");

            if (!q1.Equals(q2))
            {
                throw new Exception("Quest Test 1 failed");
            }

            // Add link  and dest
            q2.Relations.Add(11);
            q2.DestName = "npc";

            // Merge
            q1.MergeWith(q2);

            // check
            if (!q1.DestName.Equals("npc"))
            {
                throw new Exception("Quest Test 2 failed");
            }

            if (!q1.RelatedTo.Equals("11"))
            {
                throw new Exception("Quest Test 3 failed");
            }

            // Add extra relation
            q2.Relations.Add("10");
            q1.MergeWith(q2);
            if (!q1.RelatedTo.Equals("10,11"))
            {
                throw new Exception("Quest Test 4 failed");
            }

            if (!typeof(IMergeable).IsAssignableFrom(typeof(Quest)))
            {
                throw new Exception("Quest Test 5 failed");
            }

            /*
             * NPC npc1 = ndata.Items[0].Items[2];
             * NPC npc2 = ndata.Items[0].Items[2];
             *
             * if (!npc1.Equals(npc2))
             *  Environment.Exit(1);
             */
            /*
             * LuaFunction lf = CurWoWVersion.FindLuaFunction("GetNpcDialogInfo");
             * string c = lf.Code;
             * // string c = "{0} {{}} {{'dd','xx'}}";
             * string s = string.Format(c, 1);
             */
            /*
             * NPC npc = new NPC();
             *
             * npc.Name = "Test XXX";
             * npc.WPList.Add(new Vector3D(1, 2, 3));
             * npc.AddService(new ClassTrainingService("HUNTER"));
             * npc.AddQuest(new QuestHeader("Catch if u can", 1));
             *
             * SaveNpcData(); */
#endif
        }