Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Game"/> class.
        /// </summary>
        /// <param name="conns">The conns.</param>
        internal Game(int conns)
        {
            Console.WriteLine();
            Console.WriteLine(@" ╔═╗╔╗╔╗────  ╔═╗╔═╗ ", @"");
            Console.WriteLine(@" ║╔╝╠╣║╚╗╔╦╗  ║╬║║╬║ ", @"");
            Console.WriteLine(@" ║╚╗║║║╔╣║║║  ║╗╣║╔╝", @"");
            Console.WriteLine(@" ╚═╝╚╝╚═╝╠╗║  ╚╩╝╚╝─ ", @"");
            Console.WriteLine(@" ────────╚═╝  ──────     ", @"");
            Console.WriteLine();
            Out.WriteLine(@"Mereos Developer", @"", ConsoleColor.Red);
            Out.WriteLine(@"Emulador desenvolvido para CityRP.", @"", ConsoleColor.Red);
            Console.WriteLine();
            Out.WriteLine(@"CityRP Emulador está inicializando...", @"", ConsoleColor.Green);
            Console.WriteLine();

            _clientManager = new GameClientManager();
            using (var queryReactor = Plus.GetDatabaseManager().GetQueryReactor())
            {
                AbstractBar bar = new AnimatedBar();
                const int   wait = 15, end = 5;

                uint itemsLoaded;
                uint navigatorLoaded;
                uint roomModelLoaded;
                uint achievementLoaded;
                uint pollLoaded;

                Progress(bar, wait, end, "Loading Bans...");
                _banManager = new ModerationBanManager();
                _banManager.Init();

                Progress(bar, wait, end, "Loading Roles...");
                _roleManager = new RoleManager();
                _roleManager.LoadRights(queryReactor);

                Progress(bar, wait, end, "Loading Items...");
                _itemManager = new ItemManager();
                _itemManager.LoadItems(queryReactor, out itemsLoaded);

                Progress(bar, wait, end, "Loading Catalog...");
                _catalog = new Catalog();

                Progress(bar, wait, end, "Loading Clothing...");
                _clothingManager = new ClothingManager();
                _clothingManager.Initialize(queryReactor);

                Progress(bar, wait, end, "Loading Crafting...");
                _craftingManager = new CraftingManager();
                _craftingManager.Initialize(queryReactor);

                Progress(bar, wait, end, "Loading Rooms...");
                _roomManager = new RoomManager();
                _roomManager.LoadModels(queryReactor, out roomModelLoaded);

                Progress(bar, wait, end, "Loading Navigator...");
                _navigator = new Navigator();
                _navigator.Initialize(queryReactor, out navigatorLoaded);

                Progress(bar, wait, end, "Loading Groups...");
                _groupManager = new GroupManager();
                _groupManager.InitGroups();

                _globalInventory = new InventoryGlobal();

                Progress(bar, wait, end, "Loading HotelView...");
                _hotelView = new HotelView();

                Progress(bar, wait, end, "Loading ModerationTool...");
                _moderationTool = new ModerationTool();
                _moderationTool.LoadMessagePresets(queryReactor);
                _moderationTool.LoadPendingTickets(queryReactor);

                Progress(bar, wait, end, "Loading Bots...");
                _botManager = new BotManager();

                Progress(bar, wait, end, "Loading Quests...");
                _questManager = new QuestManager();
                _questManager.Initialize(queryReactor);

                Progress(bar, wait, end, "Loading Events...");
                _events = new RoomEvents();

                Progress(bar, wait, end, "Loading Ranks...");
                _roomRankConfig = new RoomRankConfig();
                _roomRankConfig.Initialize();

                Progress(bar, wait, end, "Loading Talents...");
                _talentManager = new TalentManager();
                _talentManager.Initialize(queryReactor);

                Progress(bar, wait, end, "Loading Pinata...");
                _pinataHandler = new PinataHandler();
                _pinataHandler.Initialize(queryReactor);

                Progress(bar, wait, end, "Loading Crackable Eggs...");
                _crackableEggHandler = new CrackableEggHandler();
                _crackableEggHandler.Initialize(queryReactor);

                Progress(bar, wait, end, "Loading Polls...");
                _pollManager = new PollManager();
                _pollManager.Init(queryReactor, out pollLoaded);

                Progress(bar, wait, end, "Loading Achievements...");
                _achievementManager = new AchievementManager(queryReactor, out achievementLoaded);

                Progress(bar, wait, end, "Loading StaticMessages ...");
                StaticMessagesManager.Load();

                Progress(bar, wait, end, "Loading Guides ...");
                _guideManager = new GuideManager();


                #region Roleplay

                Console.Write("[" + DateTime.Now.ToString("HH:mm:ss") + "] >> Lista de procurados gerada!");
                Console.WriteLine(" -> READY!");
                RoleplayManager.GenerateWantedList();

                JobManager.init();
                Console.Write("[" + DateTime.Now.ToString("HH:mm:ss") + "] >> " + JobManager.JobData.Count + " Trabalhos carregados");
                Console.WriteLine(" -> READY!");
                GetGroupManager().InitGroups();

                GangManager.init();
                Console.Write("[" + DateTime.Now.ToString("HH:mm:ss") + "] >> " + GangManager.GangData.Count + " Gangues carregadas");
                Console.WriteLine(" -> READY!");

                WeaponManager.init();
                Console.Write("[" + DateTime.Now.ToString("HH:mm:ss") + "] >> " + WeaponManager.WeaponsData.Count + " Armas carregadas");
                Console.WriteLine(" -> READY!");

                ColourManager.Initialize();
                MafiaWars = new MafiaWarManager();
                Console.Write("[" + DateTime.Now.ToString("HH:mm:ss") + "] >> Mini Games iniciados!");
                Console.WriteLine(" -> READY!");

                RoleplayManager.init();

                #endregion

                Manager.Cache.StartProcess();

                using (var dbCleanUp = Plus.GetDatabaseManager().GetQueryReactor())
                    DatabaseCleanup(dbCleanUp);

                Console.Write("\r".PadLeft(Console.WindowWidth - Console.CursorLeft - 1));
            }
        }