public static void Vote(ClientInfo _cInfo) { int _playerCount = ConnectionManager.Instance.ClientCount(); if (_playerCount > 9) { if (!StartedVote.Contains(_cInfo.entityId)) { if (!GameManager.Instance.World.IsDaytime()) { if (!SkyManager.BloodMoon()) { StartedVote.Clear(); StartedVote.Add(_cInfo.entityId); VoteOpen = true; } else { string _phrase930; if (!Phrases.Dict.TryGetValue(930, out _phrase930)) { _phrase930 = "{PlayerName} you can not start a vote during a bloodmoon."; } _phrase930 = _phrase930.Replace("{PlayerName}", _cInfo.playerName); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase930), Config.Server_Response_Name, false, "ServerTools", false)); } } else { string _phrase931; if (!Phrases.Dict.TryGetValue(931, out _phrase931)) { _phrase931 = "{PlayerName} you can not start a vote during the day."; } _phrase931 = _phrase931.Replace("{PlayerName}", _cInfo.playerName); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase931), Config.Server_Response_Name, false, "ServerTools", false)); } } else { string _phrase932; if (!Phrases.Dict.TryGetValue(932, out _phrase932)) { _phrase932 = "{PlayerName} you started the last vote. Someone else must start the vote."; } _phrase932 = _phrase932.Replace("{PlayerName}", _cInfo.playerName); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase932), Config.Server_Response_Name, false, "ServerTools", false)); } } else { string _phrase933; if (!Phrases.Dict.TryGetValue(933, out _phrase933)) { _phrase933 = "{PlayerName} you can only start this vote if at least 10 players are online."; } _phrase933 = _phrase933.Replace("{PlayerName}", _cInfo.playerName); _cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", Config.Chat_Response_Color, _phrase933), Config.Server_Response_Name, false, "ServerTools", false)); } }
public void Update() { #if DEBUG var oldIsNight = IsNight; var oldIsBloodMoon = IsBloodMoon; var oldZombieSpeed = ZombieSpeed; #endif var world = GameManager.Instance.World; IsNight = world.IsDark(); IsBloodMoon = SkyManager.BloodMoon(); ZombieSpeed = CalculateZombieSpeed(); #if DEBUG if (oldIsNight != IsNight) { Logger.Debug("isNight, Old: {0}, New: {1}", oldIsNight, IsNight); } if (oldIsBloodMoon != IsBloodMoon) { Logger.Debug("isBloodMoon, Old: {0}, New: {1}", oldIsBloodMoon, IsBloodMoon); } if (oldZombieSpeed != ZombieSpeed) { Logger.Debug("zombieSpeed, Old: {0}, New: {1}", oldZombieSpeed, ZombieSpeed); } #endif if (_invalidated) { if (OnChange != null) { OnChange.Invoke(); } _invalidated = false; } }
public static void StatusCheck() { if (ConnectionManager.Instance.ClientCount() > 0) { int _daysRemaining = Day7.DaysRemaining(GameUtils.WorldTimeToDays(GameManager.Instance.World.GetWorldTime())); string _phrase301; string _phrase305; string _phrase306; if (!Phrases.Dict.TryGetValue(301, out _phrase301)) { _phrase301 = "Next horde night is in {DaysUntilHorde} days"; } if (!Phrases.Dict.TryGetValue(305, out _phrase305)) { _phrase305 = "The horde is here!"; } if (!Phrases.Dict.TryGetValue(306, out _phrase306)) { _phrase306 = "Next horde night is today"; } _phrase301 = _phrase301.Replace("{DaysUntilHorde}", _daysRemaining.ToString()); if (_daysRemaining == 0 && !SkyManager.BloodMoon()) { ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase306 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null); } else if (SkyManager.BloodMoon()) { ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase305 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null); } else { ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase301 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null); } } }
public static void PlayerLoginRPC_Prefix(string _playerId, out bool __state) { __state = false; try { if (_playerId != null && _playerId.Length == 17) { int __maxPlayers = GamePrefs.GetInt(EnumGamePrefs.ServerMaxPlayerCount); if (ReservedSlots.IsEnabled && ConnectionManager.Instance.ClientCount() > __maxPlayers) { if (ReservedSlots.FullServer(_playerId)) { GamePrefs.Set(EnumGamePrefs.ServerMaxPlayerCount, __maxPlayers + 1); __state = true; return; } } if (NewPlayer.IsEnabled && NewPlayer.Block_During_Bloodmoon && SkyManager.BloodMoon()) { PersistentPlayerData _ppd = PersistentOperations.GetPersistentPlayerDataFromSteamId(_playerId); if (_ppd == null) { ClientInfo _cInfo = ConnectionManager.Instance.Clients.ForPlayerId(_playerId); if (_cInfo != null) { _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackagePlayerDenied>().Setup(new GameUtils.KickPlayerData(GameUtils.EKickReason.ManualKick, 0, default, "[ServerTools] - New players are kicked during the bloodmoon. Please return after the bloodmoon is over")));
public static void Exec() { if (!SkyManager.BloodMoon()) { int _playerCount = ConnectionManager.Instance.ClientCount(); if (_playerCount > 5) { int _counter = 0; List <Entity> Entities = GameManager.Instance.World.Entities.list; for (int i = 0; i < Entities.Count; i++) { Entity _entity = Entities[i]; if (_entity != null) { if (!_entity.IsClientControlled()) { EntityType _type = _entity.entityType; if (_type == EntityType.Zombie) { _counter++; } } } } if (_counter < 30) { GameManager.Instance.World.aiDirector.GetComponent <AIDirectorWanderingHordeComponent>().SpawnWanderingHorde(false); Log.Out(string.Format("[SERVERTOOLS] Spawned a horde")); } } } }
public void Update() { #if DEBUG var oldIsNight = _isNight; var oldIsBloodMoon = _isBloodMoon; var oldZombieSpeed = _zombieSpeed; #endif var world = GameManager.Instance.World; _isNight = world.IsDark(); _isBloodMoon = SkyManager.BloodMoon(); _zombieSpeed = CalculateZombieSpeed(); #if DEBUG if (oldIsNight != _isNight) { Log.Out("[WalkerSim] isNight, Old: {0}, New: {1}", oldIsNight, _isNight); } if (oldIsBloodMoon != _isBloodMoon) { Log.Out("[WalkerSim] isBloodMoon, Old: {0}, New: {1}", oldIsBloodMoon, _isBloodMoon); } if (oldZombieSpeed != _zombieSpeed) { Log.Out("[WalkerSim] zombieSpeed, Old: {0}, New: {1}", oldZombieSpeed, _zombieSpeed); } #endif }
public static void Exec(ClientInfo _cInfo) { int _daysRemaining = Day7.DaysRemaining(GameUtils.WorldTimeToDays(GameManager.Instance.World.GetWorldTime())); string _phrase301; string _phrase305; string _phrase306; if (!Phrases.Dict.TryGetValue(301, out _phrase301)) { _phrase301 = "Next horde night is in {DaysUntilHorde} days"; } if (!Phrases.Dict.TryGetValue(305, out _phrase305)) { _phrase305 = "The horde is here!"; } if (!Phrases.Dict.TryGetValue(306, out _phrase306)) { _phrase306 = "Next horde night is today"; } _phrase301 = _phrase301.Replace("{DaysUntilHorde}", _daysRemaining.ToString()); if (_daysRemaining == 0 && !SkyManager.BloodMoon()) { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase306 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } else if (SkyManager.BloodMoon()) { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase305 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } else { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase301 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
public static void Vote(ClientInfo _cInfo) { if (!VoteOpen) { int _playerCount = ConnectionManager.Instance.ClientCount(); if (_playerCount >= Players_Online) { if (!GameManager.Instance.World.IsDaytime()) { if (!SkyManager.BloodMoon()) { VoteOpen = true; string _phrase932; if (!Phrases.Dict.TryGetValue(932, out _phrase932)) { _phrase932 = "A vote to skip the night has begun. You have 60 seconds to type {CommandPrivate}{Command70}."; } _phrase932 = _phrase932.Replace("{CommandPrivate}", ChatHook.Command_Private); _phrase932 = _phrase932.Replace("{Command70}", RestartVote.Command70); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase932 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Global, null); } else { string _phrase930; if (!Phrases.Dict.TryGetValue(930, out _phrase930)) { _phrase930 = " you can not start a vote during a bloodmoon."; } ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase930 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { string _phrase931; if (!Phrases.Dict.TryGetValue(931, out _phrase931)) { _phrase931 = " you can not start a vote during the day."; } ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase931 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } else { string _phrase933; if (!Phrases.Dict.TryGetValue(933, out _phrase933)) { _phrase933 = " you can only start this vote if at least {Count} players are online."; } _phrase933 = _phrase933.Replace("{Count}", Players_Online.ToString()); ChatHook.ChatMessage(_cInfo, ChatHook.Player_Name_Color + _cInfo.playerName + LoadConfig.Chat_Response_Color + _phrase933 + "[-]", _cInfo.entityId, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } } }
public static bool BloodMoonOver() { try { if (Shutdown.Bloodmoon && !SkyManager.BloodMoon() && !GameManager.Instance.World.IsDark()) { return(true); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in PersistentOperations.BloodMoonOver: {0}", e.Message)); } return(false); }
public static bool BloodMoonSky() { try { if (SkyManager.BloodMoon()) { return(true); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in PersistentOperations.BloodMoonSky: {0}.", e)); } return(false); }
public static void CheckBloodmoon() { ulong _worldTime = GameManager.Instance.World.worldTime; int _daysUntilHorde = Days_Until_Horde - GameUtils.WorldTimeToDays(_worldTime) % Days_Until_Horde; int _worldHours = (int)(_worldTime / 1000UL) % 24; if (SkyManager.BloodMoon()) { Bloodmoon = true; } else { Bloodmoon = false; Auto_Shutdown(); } }
public static bool DuskSky() { try { float _duskTime = SkyManager.GetDuskTime(); float _timeInMinutes = SkyManager.GetTimeOfDayAsMinutes(); if (!SkyManager.BloodMoon() && _timeInMinutes > _duskTime && !GameManager.Instance.World.IsDark()) { return(true); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in PersistentOperations.DuskSky: {0}.", e)); } return(false); }
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); }
public static bool Prefix(ref UMA.UMAData ___umaData) { // Check if this feature is enabled. if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature)) { return(true); } ___umaData.AtlasSize = 512; // Changing the Atlas size down for all UMAs if (SkyManager.BloodMoon() || SkyManager.IsDark()) { ___umaData.AtlasSize = 128; } AdvLogging.DisplayLog(AdvFeatureClass, Feature + " - Atlas Size: " + ___umaData.AtlasSize); return(true); }
public static void Exec(ClientInfo _cInfo) { int _daysRemaining = Day7.DaysRemaining(GameUtils.WorldTimeToDays(GameManager.Instance.World.GetWorldTime())); if (_daysRemaining == 0 && !SkyManager.BloodMoon()) { Phrases.Dict.TryGetValue(682, out string _phrase682); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase682 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } else if (SkyManager.BloodMoon()) { Phrases.Dict.TryGetValue(683, out string _phrase683); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase683 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } else { Phrases.Dict.TryGetValue(681, out string _phrase681); _phrase681 = _phrase681.Replace("{Value}", _daysRemaining.ToString()); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase681 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } }
public static void StatusCheck() { if (ConnectionManager.Instance.ClientCount() > 0) { int _daysRemaining = Day7.DaysRemaining(GameUtils.WorldTimeToDays(GameManager.Instance.World.GetWorldTime())); if (_daysRemaining == 0 && !SkyManager.BloodMoon()) { Phrases.Dict.TryGetValue(682, out string _phrase682); ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase682 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null); } else if (SkyManager.BloodMoon()) { Phrases.Dict.TryGetValue(683, out string _phrase683); ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase683 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null); } else { Phrases.Dict.TryGetValue(681, out string _phrase681); _phrase681 = _phrase681.Replace("{Value}", _daysRemaining.ToString()); ChatHook.ChatMessage(null, LoadConfig.Chat_Response_Color + _phrase681 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Global, null); } } }
public static void Response(ClientInfo _cInfo, string _fps, int _daysRemaining, int _playerCount, int _zombies, int _animals, int _bicycles, int _miniBikes, int _motorcycles, int _4x4, int _gyros, int _supplyCrates) { Phrases.Dict.TryGetValue(481, out string _phrase481); _phrase481 = _phrase481.Replace("{Value}", _fps); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase481 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); if (_daysRemaining == 0 && !SkyManager.BloodMoon()) { Phrases.Dict.TryGetValue(487, out string _phrase487); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase487 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } else if (SkyManager.BloodMoon()) { Phrases.Dict.TryGetValue(486, out string _phrase486); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase486 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } else { Phrases.Dict.TryGetValue(482, out string _phrase482); _phrase482 = _phrase482.Replace("{Value}", _daysRemaining.ToString()); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase482 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } Phrases.Dict.TryGetValue(483, out string _phrase483); _phrase483 = _phrase483.Replace("{Players}", _playerCount.ToString()); _phrase483 = _phrase483.Replace("{Zombies}", _zombies.ToString()); _phrase483 = _phrase483.Replace("{Animals}", _animals.ToString()); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase483 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); Phrases.Dict.TryGetValue(484, out string _phrase484); _phrase484 = _phrase484.Replace("{Bicycles}", _bicycles.ToString()); _phrase484 = _phrase484.Replace("{Minibikes}", _miniBikes.ToString()); _phrase484 = _phrase484.Replace("{Motorcycles}", _motorcycles.ToString()); _phrase484 = _phrase484.Replace("{4x4}", _4x4.ToString()); _phrase484 = _phrase484.Replace("{Gyros}", _gyros.ToString()); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase484 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); Phrases.Dict.TryGetValue(485, out string _phrase485); _phrase485 = _phrase485.Replace("{Value}", _supplyCrates.ToString()); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase485 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); }
static bool Postfix(bool __result, VehiclePart __instance) { bool isBloodMoon = SkyManager.BloodMoon(); if (__instance is VPEngine && isBloodMoon) { try { foreach (EntityPlayerLocal entityplayer in GameManager.Instance.World.GetLocalPlayers()) { if (entityplayer.AttachedToEntity && ((entityplayer.AttachedToEntity.GetType()) != typeof(EntityBicycle))) { GameManager.ShowTooltip(entityplayer, Localization.Get("BMEngineWarning")); } } } catch (Exception ex) { Debug.LogWarning("Caught exception: " + ex); } return(true); } return(__result); }
public static void CheckBloodmoon() { ulong _worldTime = GameManager.Instance.World.worldTime; int _daysUntilHorde = Days_Until_Horde - GameUtils.WorldTimeToDays(_worldTime) % Days_Until_Horde; int _worldHours = (int)(_worldTime / 1000UL) % 24; if (_daysUntilHorde == Days_Until_Horde && (_worldHours >= (int)SkyManager.GetDuskTime() - 3) || SkyManager.BloodMoon()) { Bloodmoon = true; } else { if (Lottery.OpenLotto) { Lottery.StartLotto(); } Lottery.ShuttingDown = true; Bloodmoon = false; Auto_Shutdown(); } }
public static void GetInfo(ClientInfo _cInfo) { string _fps = GameManager.Instance.fps.Counter.ToString(); int _playerCount = ConnectionManager.Instance.ClientCount(); int _zombies = 0, _animals = 0, _bicycles = 0, _miniBikes = 0, _motorcycles = 0, _4x4 = 0, _gyros = 0, _supplyCrates = 0; int _daysRemaining = 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 = _zombies + 1; } else if (_tags.Contains("animal") && _e.IsAlive()) { _animals = _animals + 1; } else { string _name = EntityClass.list[_e.entityClass].entityClassName; if (_name == "vehicleBicycle") { _bicycles = _bicycles + 1; } else if (_name == "vehicleMinibike") { _miniBikes = _miniBikes + 1; } else if (_name == "vehicleMotorcycle") { _motorcycles = _motorcycles + 1; } else if (_name == "vehicle4x4Truck") { _4x4 = _4x4 + 1; } else if (_name == "vehicleGyrocopter") { _gyros = _gyros + 1; } else if (_name == "sc_General") { _supplyCrates = _supplyCrates + 1; } } } Phrases.Dict.TryGetValue(481, out string _phrase481); _phrase481 = _phrase481.Replace("{Value}", _fps); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase481 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); if (_daysRemaining == 0 && !SkyManager.BloodMoon()) { Phrases.Dict.TryGetValue(487, out string _phrase487); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase487 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } else if (SkyManager.BloodMoon()) { Phrases.Dict.TryGetValue(486, out string _phrase486); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase486 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } else { Phrases.Dict.TryGetValue(482, out string _phrase482); _phrase482 = _phrase482.Replace("{Value}", _daysRemaining.ToString()); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase482 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); } Phrases.Dict.TryGetValue(483, out string _phrase483); _phrase483 = _phrase483.Replace("{Players}", _playerCount.ToString()); _phrase483 = _phrase483.Replace("{Zombies}", _zombies.ToString()); _phrase483 = _phrase483.Replace("{Animals}", _animals.ToString()); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase483 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); Phrases.Dict.TryGetValue(484, out string _phrase484); _phrase484 = _phrase484.Replace("{Bicycles}", _bicycles.ToString()); _phrase484 = _phrase484.Replace("{Minibikes}", _miniBikes.ToString()); _phrase484 = _phrase484.Replace("{Motorcycles}", _motorcycles.ToString()); _phrase484 = _phrase484.Replace("{4x4}", _4x4.ToString()); _phrase484 = _phrase484.Replace("{Gyros}", _gyros.ToString()); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase484 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); Phrases.Dict.TryGetValue(485, out string _phrase485); _phrase485 = _phrase485.Replace("{Value}", _supplyCrates.ToString()); ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + _phrase485 + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null); }
public override void Execute(List <string> _params, CommandSenderInfo _senderInfo) { try { if (_params.Count != 0 && _params.Count != 1) { 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 = _zombies + 1; } else if (_tags.Contains("animal") && _e.IsAlive()) { _animals = _animals + 1; } else { string _name = EntityClass.list[_e.entityClass].entityClassName; if (_name == "vehicleBicycle") { _bicycles = _bicycles + 1; } else if (_name == "vehicleMinibike") { _miniBikes = _miniBikes + 1; } else if (_name == "vehicleMotorcycle") { _motorcycles = _motorcycles + 1; } else if (_name == "vehicle4x4Truck") { _4x4 = _4x4 + 1; } else if (_name == "vehicleGyrocopter") { _gyros = _gyros + 1; } else if (_name == "sc_General") { _supplyCrates = _supplyCrates + 1; } } SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Server FPS:{0}", GameManager.Instance.fps.Counter)); if (_daysRemaining == 0 && !SkyManager.BloodMoon()) { SdtdConsole.Instance.Output("Next horde night is today"); } else if (SkyManager.BloodMoon()) { SdtdConsole.Instance.Output("The horde is here!"); } else { SdtdConsole.Instance.Output(string.Format("Next horde night: {0} days", _daysRemaining)); } SdtdConsole.Instance.Output(string.Format("Players:{0} Zombies:{1} Animals:{2}", ConnectionManager.Instance.ClientCount(), _zombies, _animals)); SdtdConsole.Instance.Output(string.Format("Bicycles:{0} Minibikes:{1} Motorcycles:{2} 4x4:{3} Gyros:{4}", _bicycles, _miniBikes, _motorcycles, _4x4, _gyros)); SdtdConsole.Instance.Output(string.Format("Supply Crates:{0}", _supplyCrates)); } } else { if (_params[0].ToLower().Equals("off")) { if (Day7.IsEnabled) { Day7.IsEnabled = false; Config.WriteXml(); SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Day7 has been set to off")); return; } else { 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(); SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Day7 has been set to on")); return; } else { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Day7 is already on")); return; } } else { 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)); } }
public static void GetInfo(ClientInfo _cInfo) { string _fps = GameManager.Instance.fps.Counter.ToString(); int _playerCount = ConnectionManager.Instance.ClientCount(); int _zombies = 0, _animals = 0, _bicycles = 0, _miniBikes = 0, _motorcycles = 0, _4x4 = 0, _gyros = 0, _supplyCrates = 0; int _daysRemaining = 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 = _zombies + 1; } else if (_tags.Contains("animal") && _e.IsAlive()) { _animals = _animals + 1; } else { string _name = EntityClass.list[_e.entityClass].entityClassName; if (_name == "vehicleBicycle") { _bicycles = _bicycles + 1; } else if (_name == "vehicleMinibike") { _miniBikes = _miniBikes + 1; } else if (_name == "vehicleMotorcycle") { _motorcycles = _motorcycles + 1; } else if (_name == "vehicle4x4Truck") { _4x4 = _4x4 + 1; } else if (_name == "vehicleGyrocopter") { _gyros = _gyros + 1; } else if (_name == "sc_General") { _supplyCrates = _supplyCrates + 1; } } } string _phrase300, _phrase301, _phrase302, _phrase303, _phrase304, _phrase305, _phrase306; if (!Phrases.Dict.TryGetValue(300, out _phrase300)) { _phrase300 = "Server FPS: {Fps}"; } if (!Phrases.Dict.TryGetValue(301, out _phrase301)) { _phrase301 = "Next horde night is in {DaysUntilHorde} days"; } if (!Phrases.Dict.TryGetValue(302, out _phrase302)) { _phrase302 = "Total Players:{Players} Total Zombies:{Zombies} Total Animals:{Animals}"; } if (!Phrases.Dict.TryGetValue(303, out _phrase303)) { _phrase303 = "Bicycles:{Bicycles} Minibikes:{Minibikes} Motorcycles:{Motorcycles} 4x4:{4x4} Gyros:{Gyros}"; } if (!Phrases.Dict.TryGetValue(304, out _phrase304)) { _phrase304 = "Total Supply Crates:{SupplyCrates}"; } if (!Phrases.Dict.TryGetValue(305, out _phrase305)) { _phrase305 = "The horde is here!"; } if (!Phrases.Dict.TryGetValue(306, out _phrase306)) { _phrase306 = "Next horde night is today"; } _phrase300 = _phrase300.Replace("{Fps}", _fps); _phrase301 = _phrase301.Replace("{DaysUntilHorde}", _daysRemaining.ToString()); _phrase302 = _phrase302.Replace("{Players}", _playerCount.ToString()); _phrase302 = _phrase302.Replace("{Zombies}", _zombies.ToString()); _phrase302 = _phrase302.Replace("{Animals}", _animals.ToString()); _phrase303 = _phrase303.Replace("{Bicycles}", _bicycles.ToString()); _phrase303 = _phrase303.Replace("{Minibikes}", _miniBikes.ToString()); _phrase303 = _phrase303.Replace("{Motorcycles}", _motorcycles.ToString()); _phrase303 = _phrase303.Replace("{4x4}", _4x4.ToString()); _phrase303 = _phrase303.Replace("{Gyros}", _gyros.ToString()); _phrase304 = _phrase304.Replace("{SupplyCrates}", _supplyCrates.ToString()); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase300 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); if (_daysRemaining == 0 && !SkyManager.BloodMoon()) { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase306 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } else if (SkyManager.BloodMoon()) { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase305 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } else { ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase301 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); } ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase302 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase303 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); ChatHook.ChatMessage(_cInfo, LoadConfig.Chat_Response_Color + _phrase304 + "[-]", -1, LoadConfig.Server_Response_Name, EChatType.Whisper, null); }