Пример #1
0
        private void StartMENU_Click(object sender, System.EventArgs e)
        {
            WinLoader wl = this;

            if (!Info.StartLoginServer(wl))
            {
                return;
            }
            if (true)
            {
                string Items = DataServer.Database.GetObjectCount(typeof(DBItemTemplate)).ToString();
                string Acc   = DataServer.Database.GetObjectCount(typeof(DBAccount)).ToString();
                string Char  = DataServer.Database.GetObjectCount(typeof(DBCharacter)).ToString();
                string IP    = LoginServer.RemoteEndPoint.ToString();
                string Spawn = DataServer.Database.GetObjectCount(typeof(DBSpawn)).ToString();

                this.onoffINFO.ForeColor = System.Drawing.Color.Green;
                this.onoffINFO.Text      = "Online";
                this.onoffINFO.Refresh();
                this.itemnINFO.Text = Items;
                this.itemnINFO.Refresh();
                this.accnINFO.Text = Acc;
                this.accnINFO.Refresh();
                this.charsnINFO.Text = Char;
                this.charsnINFO.Refresh();
                this.ipTEXT.Text = IP;
                this.ipTEXT.Refresh();
                this.spawnsINFO.Text = Spawn;
                this.spawnsINFO.Refresh();
            }
        }
Пример #2
0
        public static bool StartLoginServer(WinLoader wl)
        {
            wl.consoleLISTBOX.Items.Add("Welcome to WoWDaemon 1.3, brought to you by team WoW-Quest");
            wl.consoleLISTBOX.Items.Add("Loading server...");

            try
            {
                DataServer.Database.LoadDatabaseTables();
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: " + e.Message);
                return(false);
            }

            wl.consoleLISTBOX.Items.Add("Loaded " + DataServer.Database.GetObjectCount(typeof(DBAccount)) + " accounts");
            wl.consoleLISTBOX.Items.Add("Loaded " + DataServer.Database.GetObjectCount(typeof(DBCharacter)) + " characters");
            wl.consoleLISTBOX.Items.Add("Loaded " + DataServer.Database.GetObjectCount(typeof(DBItemTemplate)) + " items");
            wl.consoleLISTBOX.Items.Add("Loaded " + DataServer.Database.GetObjectCount(typeof(DBSpawn)) + " spawns");
            wl.consoleLISTBOX.Items.Add("Loaded " + DataServer.Database.GetObjectCount(typeof(DBGuild)) + " guilds");
            wl.consoleLISTBOX.Items.Add("Loaded " + DataServer.Database.GetObjectCount(typeof(DBTabard)) + " tabards");
            wl.consoleLISTBOX.Items.Add("Loaded " + DataServer.Database.GetObjectCount(typeof(DBWorldMap)) + " World Maps");

            wl.consoleLISTBOX.Items.Add("Done!");

            LoginServerConfig config = new LoginServerConfig(m_configDir + "loginserver.config");

            if (config.Document["LoginServerConfig"] == null)
            {
                config.SetDefaultValues();
            }

            XmlNodeList list = config.Document["LoginServerConfig"].SelectNodes("descendant::RealmList");

            Console.WriteLine("Parsing realmlists...");
            if (ParseRealmLists(list) == false)
            {
                return(false);
            }

            list = config.Document["LoginServerConfig"].SelectNodes("descendant::WorldServer");
            Console.WriteLine("Parsing worldservers...");
            if (ParseWorldServers(list) == false)
            {
                return(false);
            }

            list = config.Document["LoginServerConfig"].SelectNodes("descendant::ScriptReference");
            foreach (XmlNode node in list)
            {
                LoginServer.AddScriptReference(node.InnerText);
            }

            LoginServer.ServerName = config.ServerName;
            if (!LoginServer.LoadScripts(config.Scripts))
            {
                return(false);
            }
            IPAddress address = GetAddress(config.Address);

            if (address == null)
            {
                return(false);
            }
            IPEndPoint iep        = new IPEndPoint(address, config.Port);
            string     ExternalIP = GetAddress(config.ExternalHost).ToString();

            if (!LoginServer.Start(iep, config.RedirectPort, ExternalIP))
            {
                Console.WriteLine("Failed to start Loginserver.");
                return(false);
            }
            wl.consoleLISTBOX.Items.Add("Loginserver started on " + LoginServer.EndPoint);
            wl.consoleLISTBOX.Items.Add("Redirectserver started on " + RedirectServer.LocalEndPoint);

            if (localRealmListServerStarted)
            {
                wl.consoleLISTBOX.Items.Add("Realmlist server started on " + RealmListServer.Instance.LocalEndPoint);
            }
            return(true);
        }