Exemplo n.º 1
0
        public void HandleMacroDrop(GSPacketIn pkg)
        {
            Dictionary <int, int> temp = new Dictionary <int, int>();
            int num1 = pkg.ReadInt();

            for (int index = 0; index < num1; ++index)
            {
                int key  = pkg.ReadInt();
                int num2 = pkg.ReadInt();
                temp.Add(key, num2);
            }
            MacroDropMgr.DropNotice(temp);
            this.NeedSyncMacroDrop = true;
        }
Exemplo n.º 2
0
        public void HandleMacroDrop(GSPacketIn pkg)
        {
            Dictionary <int, int> temp = new Dictionary <int, int>();
            int count = pkg.ReadInt();

            for (int i = 0; i < count; i++)
            {
                int templateId = pkg.ReadInt();
                int dropCount  = pkg.ReadInt();
                temp.Add(templateId, dropCount);
            }
            MacroDropMgr.DropNotice(temp);
            NeedSyncMacroDrop = true;
        }
Exemplo n.º 3
0
        public void HandleMacroDrop(GSPacketIn pkg)
        {
            Dictionary <int, MacroDropInfo> temp = new Dictionary <int, MacroDropInfo>();
            int count = pkg.ReadInt();

            for (int i = 0; i < count; i++)
            {
                int           templateId = pkg.ReadInt();
                int           dropcount  = pkg.ReadInt();
                int           maxCount   = pkg.ReadInt();
                MacroDropInfo mdi        = new MacroDropInfo(dropcount, maxCount);
                temp.Add(templateId, mdi);
            }
            MacroDropMgr.UpdateDropInfo(temp);
        }
        public void HandleMacroDrop(GSPacketIn pkg)
        {
            Dictionary <int, MacroDropInfo> dictionary = new Dictionary <int, MacroDropInfo>();
            int num = pkg.ReadInt();

            for (int i = 0; i < num; i++)
            {
                int           key          = pkg.ReadInt();
                int           dropCount    = pkg.ReadInt();
                int           maxDropCount = pkg.ReadInt();
                MacroDropInfo value        = new MacroDropInfo(dropCount, maxDropCount);
                dictionary.Add(key, value);
            }
            MacroDropMgr.UpdateDropInfo(dictionary);
        }
Exemplo n.º 5
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);
            }
        }
Exemplo n.º 6
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);
            }
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
        public override bool Start()
        {
            bool result = true;

            try
            {
                IsRunning = 0;
                Thread.CurrentThread.Priority = ThreadPriority.Normal;
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(this.CurrentDomain_UnhandledException);


                if (!this.StartScriptComponents())
                {
                    result = false;
                    GameServer.log.Error("初始化脚本失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化脚本成功!");

                if (!this.InitSocket(IPAddress.Parse(this.Config.GameIP), this.Config.GamePort))
                {
                    result = false;
                    GameServer.log.Error("初始化监听端口失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化监听端口成功!");

                if (!this.AllocatePacketBuffers())
                {
                    result = false;
                    GameServer.log.Error("分配数据包缓冲区失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("分配数据包缓冲区成功!");

                //LogMgr.Setup

                if (!WorldMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化世界场景失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化世界场景成功!");



                if (!FusionMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化熔炼失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化熔炼成功!");

                if (!AwardMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化奖励失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化奖励成功!");


                if (!MissionInfoMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化关卡失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化关卡成功!");

                if (!PveInfoMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化pve失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化pve成功!");



                if (!FightRateMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化战斗倍率失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化战斗倍率成功!");

                if (!ConsortiaLevelMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化公会等级失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化公会等级成功!");

                if (!StrengthenMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化强化失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化强化成功!");

                if (!ShopMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化商店失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化商店成功!");

                if (!BoxMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化时间宝箱失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化时间宝箱成功!");

                if (!QuestMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化任务失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化任务成功!");

                if (!AchievementMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化成就失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化成就成功!");

                if (!AchievementMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化成就失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化成就成功!");

                if (!RoomMgr.Setup(this.Config.MaxRoomCount))
                {
                    result = false;
                    GameServer.log.Error("初始化房间管理服务失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化房间管理服务成功!");

                if (!GameMgr.Setup(1, 4))
                {
                    result = false;
                    GameServer.log.Error("初始化游戏管理服务失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化游戏管理服务成功!");

                if (!ConsortiaMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化公会失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化公会成功!");


                if (!Game.Server.Managers.RateMgr.Init(this.Config))
                {
                    result = false;
                    GameServer.log.Error("初始化经验倍率管理服务失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化经验倍率管理服务成功!");

                if (!MacroDropMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化宏观掉落失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化宏观掉落成功!");


                if (!BattleMgr.Setup(this.Config))
                {
                    result = false;
                    GameServer.log.Error("加载战斗管理服务失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("加载战斗管理服务成功!");

                if (!this.InitGlobalTimer())
                {
                    result = false;
                    GameServer.log.Error("初始化全局Timers失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化全局Timers成功!");

                if (!this.InitLoginServer())
                {
                    result = false;
                    GameServer.log.Error("登陆到中心服务器失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("登陆到中心服务器成功!");

                if (!MarryRoomMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化礼堂失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化礼堂成功!");

                if (!SpaRoomMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化温泉失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化温泉成功!");

                if (!ActiveMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化活动失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化活动成功!");
                if (!VIPMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化VIP失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化VIP成功!");
                if (!LevelMgr.Init())
                {
                    result = false;
                    GameServer.log.Error("初始化等级失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("初始化等级成功!");

                /*  if (!WorldBossMgr.Init())
                 * {
                 *    result = false;
                 *    GameServer.log.Error("初始化世界Boss失败,请检查!");
                 *    return result;
                 * }
                 * GameServer.log.Info("初始化世界Boss成功!");
                 */
                RoomMgr.Start();
                GameMgr.Start();
                BattleMgr.Start();
                MacroDropMgr.Start();

                if (!base.Start())
                {
                    result = false;
                    GameServer.log.Error("启动基础服务失败,请检查!");
                    return(result);
                }
                GameServer.log.Info("启动基础服务成功!");

                GameEventMgr.Notify(ScriptEvent.Loaded);
                GC.Collect(GC.MaxGeneration);
                //LogMgr.Setup(1, 1, 1);
                GameServer.log.Warn("游戏服务器启动成功!");
                IsRunning = 1;
            }
            catch (Exception e)
            {
                GameServer.log.Error("Failed to start the server", e);
                // throw e;
                result = false;
            }
            return(result);
        }