Ejemplo n.º 1
0
        protected void Application_Start(object sender, EventArgs e)
        {
            string path = Server.MapPath("~");

            LanguageMgr.Setup(path);
            log4net.Config.XmlConfigurator.Configure();
            StaticsMgr.Setup();
            PlayerManager.Setup();
        }
Ejemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            LanguageMgr.Setup(ConfigurationManager.AppSettings["ReqPath"]);
            bool   value   = false;
            string message = LanguageMgr.GetTranslation("Tank.Request.RenameConsortiaName.Fail1");// "Login Fail!";

            XElement result = new XElement("Result");

            try
            {
                BaseInterface inter = BaseInterface.CreateInterface();
                string        p     = context.Request["p"];
                string        site  = context.Request["site"] == null ? "" : HttpUtility.UrlDecode(context.Request["site"]);
                //string nickname = context.Request["nickname"] == null ? "" : HttpUtility.UrlDecode(context.Request["nickname"]);
                //string newNickname = context.Request["consortiaName"] == null ? "" : HttpUtility.UrlDecode(context.Request["consortiaName"]);
                string IP = context.Request.UserHostAddress;
                if (!string.IsNullOrEmpty(p))
                {
                    //解密
                    byte[]   src     = CryptoHelper.RsaDecryt2(StaticFunction.RsaCryptor, p);
                    string[] strList = Encoding.UTF8.GetString(src, 7, src.Length - 7).Split(',');
                    if (strList.Length == 5)
                    {
                        string name          = strList[0];
                        string pwd           = strList[1];
                        string newPwd        = strList[2];
                        string nickname      = strList[3];
                        string consortiaName = strList[4];

                        if (PlayerManager.Login(name, pwd))
                        {
                            using (PlayerBussiness db = new PlayerBussiness())
                            {
                                if (db.RenameConsortiaName(name, nickname, consortiaName, ref message))
                                {
                                    PlayerManager.Update(name, newPwd);
                                    value   = true;
                                    message = LanguageMgr.GetTranslation("Tank.Request.RenameConsortiaName.Success");
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error("RenameConsortiaName", ex);
                value   = false;
                message = LanguageMgr.GetTranslation("Tank.Request.RenameConsortiaName.Fail2");
            }

            result.Add(new XAttribute("value", value));
            result.Add(new XAttribute("message", message));

            context.Response.ContentType = "text/plain";
            context.Response.Write(result.ToString(false));
        }
Ejemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            LanguageMgr.Setup(ConfigurationManager.AppSettings["ReqPath"]);
            bool value = false;
            //string message = "Name is Exist!";
            string   message = LanguageMgr.GetTranslation("Tank.Request.NickNameCheck.Exist");
            XElement result  = new XElement("Result");

            try
            {
                string nickName = csFunction.ConvertSql(HttpUtility.UrlDecode(context.Request["NickName"]));
                if (System.Text.Encoding.Default.GetByteCount(nickName) <= 14)
                {
                    if (!string.IsNullOrEmpty(nickName))
                    {
                        using (PlayerBussiness db = new PlayerBussiness())
                        {
                            if (db.GetUserSingleByNickName(nickName) == null)
                            {
                                value = true;
                                //message = "You can register!";
                                message = LanguageMgr.GetTranslation("Tank.Request.NickNameCheck.Right", new object [0]);
                            }
                        }
                    }
                }
                else
                {
                    message = LanguageMgr.GetTranslation("Tank.Request.NickNameCheck.Long", new object[0]);
                }
            }
            catch (Exception ex)
            {
                log.Error("NickNameCheck", ex);
                value = false;
            }

            result.Add(new XAttribute("value", value));
            result.Add(new XAttribute("message", message));

            context.Response.ContentType = "text/plain";
            context.Response.Write(result.ToString(false));
        }
Ejemplo n.º 4
0
        public override bool Start()
        {
            try
            {
                Thread.CurrentThread.Priority = ThreadPriority.Normal;

                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                GameProperties.Refresh();

                if (!InitComponent(RecompileScripts(), "Recompile Scripts"))
                {
                    return(false);
                }

                //初始化脚本
                if (!InitComponent(StartScriptComponents(), "Script components"))
                {
                    return(false);
                }

                //检查版本是否和数据库一致
                if (!InitComponent(GameProperties.EDITION == Edition, "Check Server Edition:" + Edition))
                {
                    return(false);
                }

                //初始化监听端口
                if (!InitComponent(InitSocket(IPAddress.Parse(_config.Ip), _config.Port), "InitSocket Port:" + _config.Port))
                {
                    return(false);
                }

                //启动服务监听
                if (!InitComponent(CenterService.Start(), "Center Service"))
                {
                    return(false);
                }

                //加载服务器列表
                if (!InitComponent(ServerMgr.Start(), "Load serverlist"))
                {
                    return(false);
                }

                //加载公会等级信息
                if (!InitComponent(ConsortiaLevelMgr.Init(), "Init ConsortiaLevelMgr"))
                {
                    return(false);
                }

                //初始化宏观掉落表
                if (!InitComponent(MacroDropMgr.Init(), "Init MacroDropMgr"))
                {
                    return(false);
                }

                //初始化语言包
                if (!InitComponent(LanguageMgr.Setup(@""), "LanguageMgr Init"))
                {
                    return(false);
                }

                //初始化全局Timer
                if (!InitComponent(InitGlobalTimers(), "Init Global Timers"))
                {
                    return(false);
                }

                //发布脚本已加载事件
                GameEventMgr.Notify(ScriptEvent.Loaded);

                //宏观掉落控制开始
                MacroDropMgr.Start();

                if (!InitComponent(base.Start(), "base.Start()"))
                {
                    return(false);
                }

                //发布服务器开始事件
                GameEventMgr.Notify(GameServerEvent.Started, this);

                GC.Collect(GC.MaxGeneration);

                log.Info("GameServer is now open for connections!");


                GameProperties.Save();
                return(true);
            }
            catch (Exception e)
            {
                log.Error("Failed to start the server", e);
                return(false);
            }
        }
Ejemplo n.º 5
0
        public override bool Start()
        {
            if (m_isRunning)
            {
                return(false);
            }
            try
            {
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                Thread.CurrentThread.Priority = ThreadPriority.Normal;

                GameProperties.Refresh();


                if (!InitComponent(RecompileScripts(), "Recompile Scripts"))
                {
                    return(false);
                }

                if (!InitComponent(StartScriptComponents(), "Script components"))
                {
                    return(false);
                }

                if (!InitComponent((GameProperties.EDITION == Edition), "Edition:" + Edition))
                {
                    return(false);
                }

                if (!InitComponent(InitSocket(IPAddress.Parse(Configuration.Ip), Configuration.Port), "InitSocket Port:" + Configuration.Port))
                {
                    return(false);
                }

                if (!InitComponent(AllocatePacketBuffers(), "AllocatePacketBuffers()"))
                {
                    return(false);
                }

                if (!InitComponent(LogMgr.Setup(Configuration.GAME_TYPE, Configuration.ServerID, Configuration.AreaID), "LogMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(WorldMgr.Init(), "WorldMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(MapMgr.Init(), "MapMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(ItemMgr.Init(), "ItemMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(ItemBoxMgr.Init(), "ItemBox Init"))
                {
                    return(false);
                }

                if (!InitComponent(BallMgr.Init(), "BallMgr Init"))
                {
                    return(false);
                }
                if (!InitComponent(BallConfigMgr.Init(), "BallConfigMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(FusionMgr.Init(), "FusionMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(AwardMgr.Init(), "AwardMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(NPCInfoMgr.Init(), "NPCInfoMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(MissionInfoMgr.Init(), "MissionInfoMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(PveInfoMgr.Init(), "PveInfoMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(DropMgr.Init(), "Drop Init"))
                {
                    return(false);
                }

                if (!InitComponent(FightRateMgr.Init(), "FightRateMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(ConsortiaLevelMgr.Init(), "ConsortiaLevelMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(RefineryMgr.Init(), "RefineryMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(StrengthenMgr.Init(), "StrengthenMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(PropItemMgr.Init(), "PropItemMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(ShopMgr.Init(), "ShopMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(QuestMgr.Init(), "QuestMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(RoomMgr.Setup(Configuration.MaxRoomCount), "RoomMgr.Setup"))
                {
                    return(false);
                }

                if (!InitComponent(GameMgr.Setup(Configuration.ServerID, GameProperties.BOX_APPEAR_CONDITION), "GameMgr.Start()"))
                {
                    return(false);
                }

                if (!InitComponent(ConsortiaMgr.Init(), "ConsortiaMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(LanguageMgr.Setup(@""), "LanguageMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(RateMgr.Init(Configuration), "ExperienceRateMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(MacroDropMgr.Init(), "MacroDropMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(BattleMgr.Setup(), "BattleMgr Setup"))
                {
                    return(false);
                }

                if (!InitComponent(InitGlobalTimer(), "Init Global Timers"))
                {
                    return(false);
                }

                if (!InitComponent(MarryRoomMgr.Init(), "MarryRoomMgr Init"))
                {
                    return(false);
                }
                if (!InitComponent(LogMgr.Setup(1, 4, 4), "LogMgr Setup"))
                {
                    return(false);
                }
                GameEventMgr.Notify(ScriptEvent.Loaded);

                if (!InitComponent(InitLoginServer(), "Login To CenterServer"))
                {
                    return(false);
                }

                RoomMgr.Start();
                GameMgr.Start();
                BattleMgr.Start();
                MacroDropMgr.Start();

                if (!InitComponent(base.Start(), "base.Start()"))
                {
                    return(false);
                }



                GameEventMgr.Notify(GameServerEvent.Started, this);

                GC.Collect(GC.MaxGeneration);

                if (log.IsInfoEnabled)
                {
                    log.Info("GameServer is now open for connections!");
                }

                m_isRunning = true;
                return(true);
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Failed to start the server", e);
                }

                return(false);
            }
        }
Ejemplo n.º 6
0
        public void ProcessRequest(HttpContext context)
        {
            LanguageMgr.Setup(ConfigurationManager.AppSettings["ReqPath"]);
            bool   value   = false;
            string message = LanguageMgr.GetTranslation("Tank.Request.Login.Fail1");// "Login Fail!";
            string style   = "";
            bool   isError = false;

            XElement result = new XElement("Result");

            try
            {
                BaseInterface inter = BaseInterface.CreateInterface();
                string        p     = context.Request["p"];//?
                string        site  = context.Request["site"] == null ? "" : HttpUtility.UrlDecode(context.Request["site"]);
                //string nickname = context.Request["nickname"] == null ? "" : HttpUtility.UrlDecode(context.Request["nickname"]);
                string IP = context.Request.UserHostAddress;
                if (!string.IsNullOrEmpty(p))
                {
                    //解密
                    byte[]   src     = CryptoHelper.RsaDecryt2(StaticFunction.RsaCryptor, p);
                    string[] strList = Encoding.UTF8.GetString(src, 7, src.Length - 7).Split(',');
                    if (strList.Length == 4)
                    {
                        string name     = strList[0];
                        string pwd      = strList[1];
                        string newPwd   = strList[2];
                        string nickname = strList[3];

                        if (true)    //(PlayerManager.Login(name, pwd))
                        {
                            int  isFirst       = 0;
                            bool isActive      = false;
                            bool firstValidate = PlayerManager.GetByUserIsFirst(name);
                            //using (PlayerBussiness db = new PlayerBussiness())
                            //{
                            //    PlayerInfo[] infos = db.GetUserLoginList(name);

                            //    if (infos.Length <= 0)
                            //    {
                            //        throw new Exception();
                            //    }
                            //}
                            PlayerInfo player = inter.CreateLogin(name, newPwd, ref message, ref isFirst, IP, ref isError, firstValidate, ref isActive, site, nickname);

                            if (player != null && !isError)
                            {
                                if (isFirst == 0)
                                {
                                    PlayerManager.Update(name, newPwd);
                                }
                                else
                                {
                                    PlayerManager.Remove(name);
                                }
                                style         = string.IsNullOrEmpty(player.Style) ? ",,,,,,,," : player.Style;
                                player.Colors = string.IsNullOrEmpty(player.Colors) ? ",,,,,,,," : player.Colors;

                                XElement node = new XElement("Item",
                                                             new XAttribute("ID", player.ID),
                                                             new XAttribute("IsFirst", isFirst),
                                                             new XAttribute("NickName", player.NickName),
                                                             new XAttribute("Date", ""),
                                                             new XAttribute("IsConsortia", 0),
                                                             new XAttribute("ConsortiaID", player.ConsortiaID),
                                                             new XAttribute("Sex", player.Sex),
                                                             new XAttribute("WinCount", player.Win),
                                                             new XAttribute("TotalCount", player.Total),
                                                             new XAttribute("EscapeCount", player.Escape),
                                                             new XAttribute("DutyName", player.DutyName == null ? "" : player.DutyName),
                                                             new XAttribute("GP", player.GP),
                                                             new XAttribute("Honor", ""),
                                                             new XAttribute("Style", player.Style == null ? style : player.Style),
                                                             new XAttribute("Gold", player.Gold),
                                                             new XAttribute("Colors", player.Colors == null ? "" : player.Colors),
                                                             new XAttribute("Attack", player.Attack),
                                                             new XAttribute("Defence", player.Defence),
                                                             new XAttribute("Agility", player.Agility),
                                                             new XAttribute("Luck", player.Luck),
                                                             new XAttribute("Grade", player.Grade),
                                                             new XAttribute("Hide", player.Hide),
                                                             new XAttribute("Repute", player.Repute),
                                                             new XAttribute("ConsortiaName", player.ConsortiaName == null ? "" : player.ConsortiaName),
                                                             new XAttribute("Offer", player.Offer),
                                                             new XAttribute("Skin", player.Skin == null ? "" : player.Skin),
                                                             new XAttribute("ReputeOffer", player.ReputeOffer),
                                                             new XAttribute("ConsortiaHonor", player.ConsortiaHonor),
                                                             new XAttribute("ConsortiaLevel", player.ConsortiaLevel),
                                                             new XAttribute("ConsortiaRepute", player.ConsortiaRepute),
                                                             new XAttribute("Money", player.Money),
                                                             new XAttribute("AntiAddiction", player.AntiAddiction),
                                                             new XAttribute("IsMarried", player.IsMarried),
                                                             new XAttribute("SpouseID", player.SpouseID),
                                                             new XAttribute("SpouseName", player.SpouseName == null ? "" : player.SpouseName),
                                                             new XAttribute("MarryInfoID", player.MarryInfoID),
                                                             new XAttribute("IsCreatedMarryRoom", player.IsCreatedMarryRoom),
                                                             new XAttribute("IsGotRing", player.IsGotRing),
                                                             new XAttribute("LoginName", player.UserName == null ? "" : player.UserName),
                                                             new XAttribute("Nimbus", player.Nimbus),
                                                             new XAttribute("FightPower", player.FightPower),
                                                             new XAttribute("AnswerSite", player.AnswerSite),
                                                             new XAttribute("WeaklessGuildProgressStr", player.WeaklessGuildProgressStr == null ? "" : player.WeaklessGuildProgressStr),
                                                             new XAttribute("IsOldPlayer", player.IsOldPlayer));

                                result.Add(node);
                                value   = true;
                                message = LanguageMgr.GetTranslation("Tank.Request.Login.Success");;
                            }
                            else
                            {
                                PlayerManager.Remove(name);
                            }
                        }
                        else
                        {
                            message = LanguageMgr.GetTranslation("BaseInterface.LoginAndUpdate.Try");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error("User Login error", ex);
                value   = false;
                message = LanguageMgr.GetTranslation("Tank.Request.Login.Fail2");
            }
            finally
            {
                result.Add(new XAttribute("value", value));
                result.Add(new XAttribute("message", message));
                context.Response.ContentType = "text/plain";
                context.Response.Write(result.ToString(false));
            }
        }
Ejemplo n.º 7
0
        public void ProcessRequest(HttpContext context)
        {
            LanguageMgr.Setup(ConfigurationManager.AppSettings["ReqPath"]);
            bool     value   = false;
            string   message = LanguageMgr.GetTranslation("Tank.Request.VisualizeRegister.Fail1");
            XElement result  = new XElement("Result");

            try
            {
                NameValueCollection para = context.Request.Params;
                string name       = para["Name"] as string;
                string pass       = para["Pass"] as string;
                string nickName   = para["NickName"].Trim().Replace(",", "");;
                string armColor   = para["Arm"] as string;
                string hairColor  = para["Hair"] as string;
                string faceColor  = para["Face"] as string;
                string ClothColor = para["Cloth"] as string;
                string HatColor   = para["Cloth"] as string;

                string armID   = para["ArmID"] as string;
                string hairID  = para["HairID"] as string;
                string faceID  = para["FaceID"] as string;
                string ClothID = para["ClothID"] as string;
                string HatID   = para["ClothID"] as string;

                int sex = -1;
                if (bool.Parse(ConfigurationManager.AppSettings["MustSex"]))
                {
                    sex = bool.Parse(para["Sex"]) ? 1 : 0;
                }


                if ((System.Text.Encoding.Default.GetByteCount(nickName) <= 14))
                {
                    if (!fileIllegal.checkIllegalChar(nickName))
                    {
                        if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(pass) && !string.IsNullOrEmpty(nickName))
                        {
                            string[] styles = sex == 1 ? ConfigurationManager.AppSettings["BoyVisualizeItem"].Split(';') : ConfigurationManager.AppSettings["GrilVisualizeItem"].Split(';');
                            //if (styles[0].Split(',').Contains(armID) && styles[1].Split(',').Contains(hairID) && styles[2].Split(',').Contains(faceID) && styles[3].Split(',').Contains(ClothID))
                            //{
                            armID      = styles[0].Split(',')[0];
                            hairID     = styles[0].Split(',')[1];
                            faceID     = styles[0].Split(',')[2];
                            ClothID    = styles[0].Split(',')[3];
                            HatID      = styles[0].Split(',')[4];
                            armColor   = "";
                            hairColor  = "";
                            faceColor  = "";
                            ClothColor = "";
                            HatColor   = "";
                            using (PlayerBussiness db = new PlayerBussiness())
                            {
                                string style = armID + "," + hairID + "," + faceID + "," + ClothID + "," + HatID;
                                if (db.RegisterPlayer(name, pass, nickName, style,
                                                      style, armColor, hairColor, faceColor, ClothColor, HatColor, sex,
                                                      ref message, int.Parse(ConfigurationManager.AppSettings["ValidDate"])))
                                {
                                    value   = true;
                                    message = LanguageMgr.GetTranslation("Tank.Request.VisualizeRegister.Success");
                                }
                                else
                                {
                                    message = LanguageMgr.GetTranslation("Tạo nhân vật thất bại!");    //message = LanguageMgr.GetTranslation("Register Player Fail!");
                                }
                            }
                            //}
                            //else
                            //{
                            //    message = LanguageMgr.GetTranslation("(styles[0].Split(',').Contains(armID)");
                            //}
                        }
                        else
                        {
                            message = LanguageMgr.GetTranslation("!string.IsNullOrEmpty(name) && !");
                        }
                    }
                    else
                    {
                        message = LanguageMgr.GetTranslation("Tên nhân vật có kí tự đặc biệt!"); //message = LanguageMgr.GetTranslation("Tank.Request.VisualizeRegister.Illegalcharacters");
                    }
                }
                else
                {
                    //message = "NickName is very long!";
                    message = LanguageMgr.GetTranslation("Tên nhân vật quá dài!");//message = LanguageMgr.GetTranslation("Tank.Request.VisualizeRegister.Long");
                }
            }
            catch (Exception ex)
            {
                log.Error("VisualizeRegister", ex);
            }

            result.Add(new XAttribute("value", value));
            result.Add(new XAttribute("message", message));
            context.Response.ContentType = "text/plain";
            context.Response.Write(result.ToString(false));
        }
Ejemplo n.º 8
0
        public override bool Start()
        {
            if (m_running)
            {
                return(false);
            }
            try
            {
                m_running = true;

                Thread.CurrentThread.Priority = ThreadPriority.Normal;

                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                //初始化监听端口
                if (!InitComponent(InitSocket(m_config.Ip, m_config.Port), "InitSocket Port:" + m_config.Port))
                {
                    return(false);
                }

                //初始化脚本
                if (!InitComponent(StartScriptComponents(), "Script components"))
                {
                    return(false);
                }

                if (!InitComponent(ProxyRoomMgr.Setup(), "RoomMgr.Setup"))
                {
                    return(false);
                }

                if (!InitComponent(GameMgr.Setup(0, 4), "GameMgr.Setup"))
                {
                    return(false);
                }

                if (!InitComponent(MapMgr.Init(), "MapMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(ItemMgr.Init(), "ItemMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(PropItemMgr.Init(), "ItemMgr Init"))
                {
                    return(false);
                }

                //if (!InitComponent(VaneMgr.ByteAray(), "VaneMgr ByteAray"))
                //   return false;

                if (!InitComponent(BallMgr.Init(), "BallMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(BallConfigMgr.Init(), "BallConfigMgr Init"))
                {
                    return(false);
                }
                if (!InitComponent(DropMgr.Init(), "DropMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(NPCInfoMgr.Init(), "NPCInfoMgr Init"))
                {
                    return(false);
                }

                if (!InitComponent(LanguageMgr.Setup(@""), "LanguageMgr Init"))
                {
                    return(false);
                }

                //发布脚本已加载事件
                GameEventMgr.Notify(ScriptEvent.Loaded);

                if (!InitComponent(base.Start(), "base.Start()"))
                {
                    return(false);
                }

                ProxyRoomMgr.Start();
                GameMgr.Start();

                //发布服务器开始事件
                GameEventMgr.Notify(GameServerEvent.Started, this);

                GC.Collect(GC.MaxGeneration);

                log.Info("GameServer is now open for connections!");

                return(true);
            }
            catch (Exception e)
            {
                log.Error("Failed to start the server", e);
                return(false);
            }
        }
Ejemplo n.º 9
0
        public override bool Start()
        {
            if (this.m_running)
            {
                return(false);
            }
            bool result;

            try
            {
                this.m_running = true;
                Thread.CurrentThread.Priority = ThreadPriority.Normal;
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(this.CurrentDomain_UnhandledException);
                if (!this.InitComponent(this.InitSocket(this.m_config.Ip, this.m_config.Port), "InitSocket Port:" + this.m_config.Port))
                {
                    result = false;
                }
                else
                {
                    if (!this.InitComponent(this.StartScriptComponents(), "Script components"))
                    {
                        result = false;
                    }
                    else
                    {
                        if (!this.InitComponent(ProxyRoomMgr.Setup(), "RoomMgr.Setup"))
                        {
                            result = false;
                        }
                        else
                        {
                            if (!this.InitComponent(GameMgr.Setup(0, 4), "GameMgr.Setup"))
                            {
                                result = false;
                            }
                            else
                            {
                                if (!this.InitComponent(MapMgr.Init(), "MapMgr Init"))
                                {
                                    result = false;
                                }
                                else
                                {
                                    if (!this.InitComponent(ItemMgr.Init(), "ItemMgr Init"))
                                    {
                                        result = false;
                                    }
                                    else
                                    {
                                        if (!this.InitComponent(PropItemMgr.Init(), "PropItemMgr Init"))
                                        {
                                            result = false;
                                        }
                                        else
                                        {
                                            if (!this.InitComponent(BallMgr.Init(), "BallMgr Init"))
                                            {
                                                result = false;
                                            }
                                            else
                                            {
                                                if (!this.InitComponent(BallConfigMgr.Init(), "BallConfigMgr Init"))
                                                {
                                                    result = false;
                                                }
                                                else
                                                {
                                                    if (!this.InitComponent(DropMgr.Init(), "DropMgr Init"))
                                                    {
                                                        result = false;
                                                    }
                                                    else
                                                    {
                                                        if (!this.InitComponent(NPCInfoMgr.Init(), "NPCInfoMgr Init"))
                                                        {
                                                            result = false;
                                                        }
                                                        else
                                                        {
                                                            if (!this.InitComponent(WindMgr.Init(), "WindMgr Init"))
                                                            {
                                                                result = false;
                                                            }
                                                            else
                                                            {
                                                                if (!this.InitComponent(GoldEquipMgr.Init(), "GoldEquipMgr Init"))
                                                                {
                                                                    result = false;
                                                                }
                                                                else
                                                                {
                                                                    if (!this.InitComponent(LanguageMgr.Setup(""), "LanguageMgr Init"))
                                                                    {
                                                                        result = false;
                                                                    }
                                                                    else
                                                                    {
                                                                        GameEventMgr.Notify(ScriptEvent.Loaded);
                                                                        if (!this.InitComponent(base.Start(), "base.Start()"))
                                                                        {
                                                                            result = false;
                                                                        }
                                                                        else
                                                                        {
                                                                            ProxyRoomMgr.Start();
                                                                            GameMgr.Start();
                                                                            GameEventMgr.Notify(GameServerEvent.Started, this);
                                                                            GC.Collect(GC.MaxGeneration);
                                                                            FightServer.log.Info("GameServer is now open for connections!");
                                                                            result = true;
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                FightServer.log.Error("Failed to start the server", exception);
                result = false;
            }
            return(result);
        }
Ejemplo n.º 10
0
        public override bool Start()
        {
            bool result;

            try
            {
                Thread.CurrentThread.Priority = ThreadPriority.Normal;
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(this.CurrentDomain_UnhandledException);
                GameProperties.Refresh();
                if (!this.InitComponent(this.RecompileScripts(), "Recompile Scripts"))
                {
                    result = false;
                }
                else
                {
                    if (!this.InitComponent(this.StartScriptComponents(), "Script components"))
                    {
                        result = false;
                    }
                    else
                    {
                        if (!this.InitComponent(GameProperties.EDITION == this.Edition, "Check Server Edition:" + this.Edition))
                        {
                            result = false;
                        }
                        else
                        {
                            if (!this.InitComponent(this.InitSocket(IPAddress.Parse(this._config.Ip), this._config.Port), "InitSocket Port:" + this._config.Port))
                            {
                                result = false;
                            }
                            else
                            {
                                if (!this.InitComponent(CenterService.Start(), "Center Service"))
                                {
                                    result = false;
                                }
                                else
                                {
                                    if (!this.InitComponent(ServerMgr.Start(), "Load serverlist"))
                                    {
                                        result = false;
                                    }
                                    else
                                    {
                                        if (!this.InitComponent(ConsortiaLevelMgr.Init(), "Init ConsortiaLevelMgr"))
                                        {
                                            result = false;
                                        }
                                        else
                                        {
                                            if (!this.InitComponent(MacroDropMgr.Init(), "Init MacroDropMgr"))
                                            {
                                                result = false;
                                            }
                                            else
                                            {
                                                if (!this.InitComponent(LanguageMgr.Setup(""), "LanguageMgr Init"))
                                                {
                                                    result = false;
                                                }
                                                else
                                                {
                                                    if (!this.InitComponent(this.InitGlobalTimers(), "Init Global Timers"))
                                                    {
                                                        result = false;
                                                    }
                                                    else
                                                    {
                                                        GameEventMgr.Notify(ScriptEvent.Loaded);
                                                        MacroDropMgr.Start();
                                                        if (!this.InitComponent(base.Start(), "base.Start()"))
                                                        {
                                                            result = false;
                                                        }
                                                        else
                                                        {
                                                            GameEventMgr.Notify(GameServerEvent.Started, this);
                                                            GC.Collect(GC.MaxGeneration);
                                                            CenterServer.log.Info("GameServer is now open for connections!");
                                                            GameProperties.Save();
                                                            result = true;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                CenterServer.log.Error("Failed to start the server", exception);
                result = false;
            }
            return(result);
        }