public static bool IsOpen(int userId) { TimeSpan startTime = TimeSpan.Parse(GameConfigs.GetString("Pvp_Start_Time_Everyday", "4:00:00")); TimeSpan endTime = TimeSpan.Parse(GameConfigs.GetString("Pvp_End_Time_Everyday", "16:00:00")); DateTime todayStartTime = DateTime.Today.Add(startTime); DateTime todayEndTime = DateTime.Today.Add(endTime); DateTime now = DateTime.UtcNow; if (now < todayStartTime || now > todayEndTime) { return(false); } PlayerLogic p = new PlayerLogic().SetUser(userId); if (p.MyPlayer.Level < GameConfigs.GetInt("Pvp_Require_Player_Level", 30)) { return(false); } return(true); }