Exemple #1
0
        private static void ProcessTimeChangeRequest(ref BinaryReader reader, int playerNumber)
        {
            if (Network.Players[playerNumber].Group.HasPermission("ChangeTimeWeather"))
            {
                TimeChangeType tct = (TimeChangeType)reader.ReadByte();
                switch (tct)
                {
                case TimeChangeType.SetToNoon:
                    Main.dayTime = true;
                    Main.time    = 27000.0;
                    Network.SendTextToAllPlayers("The time has been changed to noon by " + Main.player[playerNumber].name);
                    break;

                case TimeChangeType.SetToMidnight:
                    Main.dayTime = false;
                    Main.time    = 27000.0;
                    Network.SendTextToAllPlayers("The time has been changed to midnight by " + Main.player[playerNumber].name);
                    break;

                case TimeChangeType.SetToNight:
                    Main.dayTime = false;
                    Main.time    = 0;
                    Network.SendTextToAllPlayers("The time has been changed to night by " + Main.player[playerNumber].name);
                    break;

                case TimeChangeType.Pause:
                    HEROsModServices.TimeWeatherChanger.TimePaused = !HEROsModServices.TimeWeatherChanger.TimePaused;
                    if (HEROsModServices.TimeWeatherChanger.TimePaused)
                    {
                        HEROsModServices.TimeWeatherChanger.PausedTime = Main.time;
                        Network.SendTextToAllPlayers("Time has been paused by " + Main.player[playerNumber].name);
                    }
                    else
                    {
                        Network.SendTextToAllPlayers("Time has been resumed by " + Main.player[playerNumber].name);
                    }
                    TimePausedOrResumed();
                    break;
                }
                NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0);
            }
        }
Exemple #2
0
 public static void ReqestTimeChange(TimeChangeType tct)
 {
     WriteHeader(MessageType.RequestTimeChange);
     Writer.Write((byte)tct);
     Network.SendDataToServer();
 }