Ejemplo n.º 1
0
 public static void Start()
 {
     world_.Hax      = false;
     world_.gameMode = GameMode.TeamDeathMatch; //set the game mode
     delayTask       = Scheduler.NewTask(t => world_.Players.Message("&WTEAM DEATHMATCH &fwill be starting in {0} seconds: &WGet ready!", MessageType.Announcement, timeDelay));
     delayTask.RunRepeating(TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(10), 1);
 }
Ejemplo n.º 2
0
 public static void Start()
 {
     world_.Hax      = false;
     world_.gameMode = GameMode.FFA; //set the game mode
     delayTask       = Scheduler.NewTask(t => world_.Players.Message("&WFFA &fwill be starting in {0} seconds: &WGet ready!", 0, (timeDelay - (DateTime.Now - startTime).ToSeconds())));
     delayTask.RunRepeating(TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(10), (timeDelay / 10));
 }
Ejemplo n.º 3
0
        public static void Start()
        {
            world_.Hax = false;

            //world_.Players.Send(PacketWriter.MakeHackControl(0,0,0,0,0,-1)); Commented out until classicube clients support hax packet
            stopwatch.Reset();
            stopwatch.Start();
            world_.gameMode = GameMode.CaptureTheFlag;
            delayTask       = Scheduler.NewTask(t => world_.Players.Message("&WCTF &fwill be starting in {0} seconds: &WGet ready!", 0, (timeDelay - stopwatch.Elapsed.Seconds)));
            delayTask.RunRepeating(TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(10), (int)Math.Floor((double)(timeDelay / 10)));//Start task immediately, send message every 10s
            if (stopwatch.Elapsed.Seconds > 11)
            {
                stopwatch.Stop();
            }
        }
Ejemplo n.º 4
0
        public static void Start()
        {
            timeLimit = 300;//reset variables incase of a server using custom and then start
            timeDelay = 20;

            world_.Hax = false;
            foreach (Player pl in world_.Players)
            {
                pl.JoinWorld(world_, WorldChangeReason.Rejoin);
            }
            //world_.Players.Send(PacketWriter.MakeHackControl(0,0,0,0,0,-1)); Commented out until classicube clients support hax packet
            stopwatch.Reset();
            stopwatch.Start();
            world_.gameMode = GameMode.Infection;
            delayTask       = Scheduler.NewTask(t => world_.Players.Message("&WInfection &fwill be starting in {0} seconds: &WGet ready!", 0, (timeDelay - stopwatch.Elapsed.Seconds)));
            delayTask.RunRepeating(TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(10), (int)Math.Floor((double)(timeDelay / 10)));//Start task immediately, send message every 10s
            if (stopwatch.Elapsed.Seconds > 11)
            {
                stopwatch.Stop();
            }
        }
Ejemplo n.º 5
0
        ChatTimer(TimeSpan duration, [CanBeNull] string message, [NotNull] string startedBy)
        {
            if (startedBy == null)
            {
                throw new ArgumentNullException("startedBy");
            }
            StartedBy = startedBy;
            Message   = message;
            StartTime = DateTime.UtcNow;
            EndTime   = StartTime.Add(duration);
            Duration  = duration;
            int oneSecondRepeats = (int)duration.TotalSeconds + 1;

            if (duration > Hour)
            {
                announceIntervalIndex = AnnounceIntervals.Length - 1;
                lastHourAnnounced     = (int)duration.TotalHours;
            }
            else
            {
                for (int i = 0; i < AnnounceIntervals.Length; i++)
                {
                    if (duration <= AnnounceIntervals[i])
                    {
                        announceIntervalIndex = i - 1;
                        break;
                    }
                }
            }
            task = Scheduler.NewTask(TimerCallback, this);
            Id   = Interlocked.Increment(ref timerCounter);
            AddTimerToList(this);
            IsRunning = true;
            task.RunRepeating(TimeSpan.Zero,
                              TimeSpan.FromSeconds(1),
                              oneSecondRepeats);
        }
Ejemplo n.º 6
0
        public static void Start()
        {
            timeLimit = 300;//reset variables incase of a server using custom and then start
            timeDelay = 20;

            world_.Hax = false;
            foreach (Player pl in world_.Players)
            {
                pl.JoinWorld(world_, WorldChangeReason.Rejoin);
            }
            //world_.Players.Send(PacketWriter.MakeHackControl(0,0,0,0,0,-1)); Commented out until classicube clients support hax packet
            stopwatch.Reset();
            stopwatch.Start();
            world_.gameMode = GameMode.Infection;
            delayTask = Scheduler.NewTask(t => world_.Players.Message("&WInfection &fwill be starting in {0} seconds: &WGet ready!", (timeDelay - stopwatch.Elapsed.Seconds)));
            delayTask.RunRepeating(TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(10), (int)Math.Floor((double)(timeDelay/10)));//Start task immediately, send message every 10s
            if (stopwatch.Elapsed.Seconds > 11)
            {
                stopwatch.Stop();
            }
        }