Exemple #1
0
        public void Init()
        {
            using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient())
            {
                ServerConfiguration.LoadConfigsFromDB(dbClient);

                this.GameClientManager = new GameClientManager();

                this.NavigatorManager = new NavigatorManager();
                this.NavigatorManager.LoadPublicRooms(dbClient);
                this.NavigatorManager.LoadFlatCats(dbClient);

                this.RoomManager = new RoomManager();
                this.RoomManager.LoadRoomModels(dbClient);
                this.RoomManager.LoadNewbieRooms(dbClient);

                this.ItemManager = new ItemManager();
                this.ItemManager.LoadItems(dbClient);
                this.ItemManager.LoadSoundtracks(dbClient);
                this.ItemManager.LoadNewbieRoomItems(dbClient);

                this.CatalogManager = new CatalogManager();
                this.CatalogManager.LoadCatalogItems(dbClient);
                this.CatalogManager.LoadCatalogPages(dbClient);
                this.CatalogManager.LoadPetRaces(dbClient);
                this.CatalogManager.LoadPresents(dbClient);

                this.CatalogManager.GetMarketplaceManager().LoadMarketplaceOffers(dbClient);

                this.PermissionManager = new PermissionManager();
                this.PermissionManager.LoadRanks(dbClient);

                this.BanManager = new BanManager();
                this.BanManager.LoadBans(dbClient);

                this.ModerationToolManager = new ModerationToolManager();
                this.ModerationToolManager.LoadIssues(dbClient);
                this.ModerationToolManager.LoadPresents(dbClient);
                this.ModerationToolManager.LoadSupportTickets(dbClient);

                this.CautionManager = new CautionManager();
                this.CautionManager.LoadCauctions(dbClient);

                this.HelpManager = new HelpManager();
                this.HelpManager.LoadFAQs(dbClient);

                this.ChatlogManager = new ChatlogManager();

                this.RoomvisitManager = new RoomvisitManager();

                this.AchievementManager = new AchievementManager();
                this.AchievementManager.LoadAchievements(dbClient);

                this.BotManager = new BotManager();
                this.BotManager.LoadBots(dbClient);
                this.BotManager.LoadNewbieBotActions(dbClient);

                TextUtilies.LoadWordfilter(dbClient);

                this.QuestManager = new QuestManager();
                this.QuestManager.LoadQuests(dbClient);

                this.TalentManager = new TalentManager();
                this.TalentManager.LoadTalents(dbClient);

                this.FastFoodManager = new FastFoodManager();
                this.FastFoodManager.CreateNewConnection();

                this.UserProfileManager = new UserProfileManager();

                this.GuideManager = new GuideManager();
            }

            this.ClientPingEnabled = TextUtilies.StringToBool(Skylight.GetConfig()["client.ping.enabled"]);

            this.AutoRestartEnabled = TextUtilies.StringToBool(Skylight.GetConfig()["auto.restart.enabled"]);
            if (this.AutoRestartEnabled)
            {
                this.AutoRestartBackup         = TextUtilies.StringToBool(Skylight.GetConfig()["auto.restart.backup"]);
                this.AutoRestartBackupCompress = TextUtilies.StringToBool(Skylight.GetConfig()["auto.restart.backup.compress"]);
                this.AutoRestartTime           = DateTime.ParseExact(Skylight.GetConfig()["auto.restart.time"], "HH:mm", CultureInfo.InvariantCulture);
            }

            this.LastUpdateEmulatorStatus = Stopwatch.StartNew();
            this.LastActivityBonusesCheck = Stopwatch.StartNew();
            this.LastTimeoutCheck         = Stopwatch.StartNew();

            this.GameCycleTimer           = new System.Timers.Timer();
            this.GameCycleTimer.Elapsed  += this.GameCycle;
            this.GameCycleTimer.AutoReset = true;
            this.GameCycleTimer.Interval  = 1; //moved from 25ms, 40 times in a second to 1ms, 1000 times in second to help keep everything be in sync
            this.GameCycleTimer.Start();
            GC.KeepAlive(this.GameCycleTimer); //IK timer adds itself to the gc already, but just for sure ;P
        }
Exemple #2
0
        public void Shutdown()
        {
            //we dont wnat dispose gameclientmanager

            if (this.GameCycleTimer != null)
            {
                this.GameCycleTimer.Stop();
            }
            this.GameCycleTimer = null;

            if (this.NavigatorManager != null)
            {
                this.NavigatorManager.Shutdown();
            }
            this.NavigatorManager = null;

            if (this.RoomManager != null)
            {
                this.RoomManager.Shutdown();
            }
            this.RoomManager = null;

            if (this.ItemManager != null)
            {
                this.ItemManager.Shutdown();
            }
            this.ItemManager = null;

            if (this.CatalogManager != null)
            {
                this.CatalogManager.Shutdown();
            }
            this.CatalogManager = null;

            if (this.PermissionManager != null)
            {
                this.PermissionManager.Shutdown();
            }
            this.PermissionManager = null;

            if (this.BanManager != null)
            {
                this.BanManager.Shutdown();
            }
            this.BanManager = null;

            if (this.ModerationToolManager != null)
            {
                this.ModerationToolManager.Shutdown();
            }
            this.ModerationToolManager = null;

            if (this.CautionManager != null)
            {
                this.CautionManager.Shutdown();
            }
            this.CautionManager = null;

            if (this.HelpManager != null)
            {
                this.HelpManager.Shutdown();
            }
            this.HelpManager = null;

            if (this.ChatlogManager != null)
            {
                this.ChatlogManager.Shutdown();
            }
            this.ChatlogManager = null;

            if (this.RoomvisitManager != null)
            {
                this.RoomvisitManager.Shutdown();
            }
            this.RoomvisitManager = null;

            if (this.AchievementManager != null)
            {
                this.AchievementManager.Shutdown();
            }
            this.AchievementManager = null;
        }