Exemple #1
0
 public static void StatusCheck()
 {
     if (ConnectionManager.Instance.ClientCount() > 0)
     {
         int daysRemaining = Day7.DaysRemaining(GameUtils.WorldTimeToDays(GameManager.Instance.World.GetWorldTime()));
         if (daysRemaining == 0 && !PersistentOperations.IsBloodmoon())
         {
             Phrases.Dict.TryGetValue("Bloodmoon2", out string phrase);
             phrase = phrase.Replace("{Time}", GameManager.Instance.World.DuskHour.ToString());
             ChatHook.ChatMessage(null, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null);
         }
         else if (PersistentOperations.IsBloodmoon())
         {
             Phrases.Dict.TryGetValue("Bloodmoon3", out string phrase);
             phrase = phrase.Replace("{Time}", GameManager.Instance.World.DawnHour.ToString());
             ChatHook.ChatMessage(null, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null);
         }
         else
         {
             Phrases.Dict.TryGetValue("Bloodmoon1", out string phrase);
             phrase = phrase.Replace("{Value}", daysRemaining.ToString());
             ChatHook.ChatMessage(null, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Global, null);
         }
     }
 }
 public static bool BloodMoonDuskSky()
 {
     try
     {
         int   _daysRemaining = Day7.DaysRemaining(GameUtils.WorldTimeToDays(GameManager.Instance.World.GetWorldTime()));
         float _duskTime      = SkyManager.GetDuskTime();
         float _timeInMinutes = SkyManager.GetTimeOfDayAsMinutes();
         if (_daysRemaining == 0 && !SkyManager.BloodMoon() && _timeInMinutes > _duskTime && !GameManager.Instance.World.IsDark())
         {
             return(true);
         }
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in PersistentOperations.BloodMoonDuskSky: {0}.", e));
     }
     return(false);
 }
Exemple #3
0
 public static void BloodmoonCheck()
 {
     try
     {
         if (Day7.DaysRemaining(GameUtils.WorldTimeToDays(GameManager.Instance.World.GetWorldTime())) == 0)
         {
             Bloodmoon = true;
             return;
         }
         else if (Bloodmoon)
         {
             Bloodmoon     = false;
             BloodmoonOver = true;
             return;
         }
         Shutdown();
     }
     catch (Exception e)
     {
         Log.Out(string.Format("[SERVERTOOLS] Error in AutoShutdown.BloodmoonCheck: {0}", e.Message));
     }
 }
Exemple #4
0
        public override void Execute(List <string> _params, CommandSenderInfo _senderInfo)
        {
            try
            {
                if (_params.Count != 0 && _params.Count != 1)
                {
                    SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 0 or 1, found '{0}'", _params.Count));

                    return;
                }
                if (_params.Count == 0)
                {
                    int           _zombies = 0, _animals = 0, _bicycles = 0, _miniBikes = 0, _motorcycles = 0, _4x4 = 0, _gyros = 0, _supplyCrates = 0;
                    int           _daysRemaining = Day7.DaysRemaining(GameUtils.WorldTimeToDays(GameManager.Instance.World.GetWorldTime()));
                    List <Entity> _entities      = GameManager.Instance.World.Entities.list;
                    foreach (Entity _e in _entities)
                    {
                        if (_e.IsClientControlled())
                        {
                            continue;
                        }
                        string _tags = _e.EntityClass.Tags.ToString();
                        if (_tags.Contains("zombie") && _e.IsAlive())
                        {
                            _zombies++;
                        }
                        else if (_tags.Contains("animal") && _e.IsAlive())
                        {
                            _animals++;
                        }
                        else
                        {
                            string _name = EntityClass.list[_e.entityClass].entityClassName;
                            if (_name == "vehicleBicycle")
                            {
                                _bicycles++;
                            }
                            else if (_name == "vehicleMinibike")
                            {
                                _miniBikes++;
                            }
                            else if (_name == "vehicleMotorcycle")
                            {
                                _motorcycles++;
                            }
                            else if (_name == "vehicle4x4Truck")
                            {
                                _4x4++;
                            }
                            else if (_name == "vehicleGyrocopter")
                            {
                                _gyros++;
                            }
                            else if (_name == "sc_General")
                            {
                                _supplyCrates++;
                            }
                        }
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Server FPS '{0}'", GameManager.Instance.fps.Counter));

                        if (_daysRemaining == 0 && !GameManager.Instance.World.aiDirector.BloodMoonComponent.BloodMoonActive)
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output("Next horde night is today");
                        }
                        else if (GameManager.Instance.World.aiDirector.BloodMoonComponent.BloodMoonActive)
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output("The horde is here!");
                        }
                        else
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Next horde night in '{0}' days", _daysRemaining));
                        }
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Players '{0}' Zombies '{1}' Animals '{2}'", ConnectionManager.Instance.ClientCount(), _zombies, _animals));

                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Bicycles '{0}' Minibikes '{1}' Motorcycles '{2}' 4x4 '{3}' Gyros '{4}'", _bicycles, _miniBikes, _motorcycles, _4x4, _gyros));

                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("Supply crates '{0}'", _supplyCrates));
                    }
                }
                else
                {
                    if (_params[0].ToLower().Equals("off"))
                    {
                        if (Day7.IsEnabled)
                        {
                            Day7.IsEnabled = false;
                            Config.WriteXml();
                            Config.LoadXml();
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Day7 has been set to off"));

                            return;
                        }
                        else
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Day7 is already off"));

                            return;
                        }
                    }
                    else if (_params[0].ToLower().Equals("on"))
                    {
                        if (!Day7.IsEnabled)
                        {
                            Day7.IsEnabled = true;
                            Config.WriteXml();
                            Config.LoadXml();
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Day7 has been set to on"));

                            return;
                        }
                        else
                        {
                            SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Day7 is already on"));

                            return;
                        }
                    }
                    else
                    {
                        SingletonMonoBehaviour <SdtdConsole> .Instance.Output(string.Format("[SERVERTOOLS] Invalid argument '{0}'", _params[0]));
                    }
                }
            }
            catch (Exception e)
            {
                Log.Out(string.Format("[SERVERTOOLS] Error in Day7Console.Execute: {0}", e.Message));
            }
        }