public Game(int conns) { ClientManager = new GameClientManager(conns); if (PhoenixEnvironment.GetConfig().data["client.ping.enabled"] == "1") { ClientManager.StartConnectionChecker(); } DateTime Now = DateTime.Now; Logging.Write("Connecting to database..."); using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient()) { Logging.WriteLine("completed!"); PhoenixEnvironment.GameInstance = this; LoadSettings(adapter); BanManager = new ModerationBanManager(); RoleManager = new RoleManager(); HelpTool = new HelpTool(); Catalog = new Catalog(); Navigator = new Navigator(); ItemManager = new ItemManager(); RoomManager = new RoomManager(); AdvertisementManager = new AdvertisementManager(); PixelManager = new PixelManager(); AchievementManager = new AchievementManager(); ModerationTool = new ModerationTool(); BotManager = new BotManager(); Marketplace = new Marketplace(); QuestManager = new QuestManager(); TextManage = new TextManager(); Guilds = new GroupManager(); TextManager.LoadTexts(adapter); BanManager.LoadBans(adapter); RoleManager.LoadRoles(adapter); HelpTool.LoadCategories(adapter); HelpTool.LoadTopics(adapter); ModerationTool.LoadMessagePresets(adapter); ModerationTool.LoadPendingTickets(adapter); ItemManager.LoadItems(adapter); Catalog.Initialize(adapter); Catalog.InitCache(); Navigator.Initialize(adapter); RoomManager.LoadModels(adapter); RoomManager.LoadCache(); NavigatorCache = new NavigatorCache(); AdvertisementManager.LoadRoomAdvertisements(adapter); BotManager.LoadBots(adapter); AchievementManager.LoadAchievements(adapter); PixelManager.Start(); ChatCommandHandler.InitFilter(adapter); QuestManager.InitQuests(); GroupManager.LoadGroups(adapter); DatabaseCleanup(adapter, 1); } Task = new Task(new Action(LowPriorityWorker.Process)); Task.Start(); }
public static void UpdateGroup(DatabaseClient dbClient, int id) { Group group = GroupManager.GetGroup(id); if (group != null) { DataRow Row = dbClient.ReadDataRow("SELECT * FROM groups WHERE Id = " + id + " LIMIT 1"); group.Name = (string)Row["name"]; group.Badge = (string)Row["badge"]; group.RoomId = (uint)Row["roomid"]; group.Desc = (string)Row["desc"]; group.Locked = (string)Row["locked"]; group.List.Clear(); DataTable dataTable = dbClient.ReadDataTable("SELECT userid FROM group_memberships WHERE groupid = " + id + ";"); foreach (DataRow row2 in dataTable.Rows) { group.AddMember((int)row2["userid"]); } } }