internal static void ServerConsole() { if (Interface.Oxide.ServerConsole == null) { return; } Interface.Oxide.ServerConsole.Title = () => $"{GameManager.Instance.World.Players.Count} | {GamePrefs.GetString(EnumGamePrefs.ServerName)}"; Interface.Oxide.ServerConsole.Status1Left = () => GamePrefs.GetString(EnumGamePrefs.ServerName); Interface.Oxide.ServerConsole.Status1Right = () => { var time = TimeSpan.FromSeconds(Time.realtimeSinceStartup); var uptime = $"{time.TotalHours:00}h{time.Minutes:00}m{time.Seconds:00}s".TrimStart(' ', 'd', 'h', 'm', 's', '0'); return($"{Mathf.RoundToInt(1f / Time.smoothDeltaTime)}fps, {uptime}"); }; Interface.Oxide.ServerConsole.Status2Left = () => { var players = $"{GameManager.Instance.World.Players.Count}/{GamePrefs.GetInt(EnumGamePrefs.ServerMaxPlayerCount)}"; var entities = GameManager.Instance.World.Entities.Count; return($"{players}, {entities + (entities.Equals(1) ? " entity" : " entities")}"); }; Interface.Oxide.ServerConsole.Status2Right = () => string.Empty; // TODO: Network in/out Interface.Oxide.ServerConsole.Status3Left = () => { var gameTime = GameManager.Instance.World.worldTime; var dateTime = Convert.ToDateTime($"{GameUtils.WorldTimeToHours(gameTime)}:{GameUtils.WorldTimeToMinutes(gameTime)}").ToString("h:mm tt"); return($"{dateTime.ToLower()}, {GamePrefs.GetString(EnumGamePrefs.GameWorld)} [{GamePrefs.GetString(EnumGamePrefs.GameName)}]"); }; Interface.Oxide.ServerConsole.Status3Right = () => $"Oxide {OxideMod.Version} for {GamePrefs.GetString(EnumGamePrefs.GameVersion)}"; Interface.Oxide.ServerConsole.Status3RightColor = ConsoleColor.Yellow; }
public PrefabInstance FindPrefabsNear() { var pos = this.theEntity.position; EntityPlayer player = null; if (this.theEntity.Buffs.HasCustomVar("Leader")) { player = theEntity.world.GetEntity((int)this.theEntity.Buffs.GetCustomVar("Leader")) as EntityPlayerLocal; } else { return(null); } if (theEntity) { DynamicPrefabDecorator dynamicPrefabDecorator = GameManager.Instance.World.ChunkCache.ChunkProvider.GetDynamicPrefabDecorator(); if (dynamicPrefabDecorator == null) { return(null); } Vector3 position = player.position; int num = (player.ChunkObserver == null) ? GamePrefs.GetInt(EnumGamePrefs.OptionsViewDistance) : player.ChunkObserver.viewDim; num = (num - 1) * 16; if (!player.isEntityRemote) { dynamicPrefabDecorator.GetPrefabsAround(position, (float)num, (float)1000f, this.prefabsAroundFar, this.prefabsAroundNear, true); GameManager.Instance.prefabLODManager.UpdatePrefabsAround(this.prefabsAroundFar, this.prefabsAroundNear); } return(this.prefabsAroundNear.Values.FirstOrDefault(d => pos.x >= d.boundingBoxPosition.x && pos.x < d.boundingBoxPosition.x + d.boundingBoxSize.x && pos.z >= d.boundingBoxPosition.z && pos.z < d.boundingBoxPosition.z + d.boundingBoxSize.z)); } return(null); }
private SortedList <string, object> GetGamePrefs() { var sortedList = new SortedList <string, object>(); var enumerator = Enum.GetValues(typeof(EnumGamePrefs)).GetEnumerator(); while (enumerator.MoveNext()) { if (enumerator.Current == null) { continue; } var enumGamePrefs = (EnumGamePrefs)(int)enumerator.Current; if (!IsViewablePref(enumGamePrefs)) { continue; } try { sortedList.Add(enumGamePrefs.ToString(), GamePrefs.GetObject(enumGamePrefs)); } catch (Exception) { //Log.Out("Exception getting object for " + enumGamePrefs); } } (enumerator as IDisposable)?.Dispose(); sortedList.Add("ServerHostIP", BCUtils.GetIPAddress()); return(sortedList); }
public override BlockActivationCommand[] GetBlockActivationCommands(WorldBase _world, BlockValue _blockValue, int _clrIdx, Vector3i _blockPos, EntityAlive _entityFocusing) { var tileEntity = _world.GetTileEntity(_clrIdx, _blockPos); var secureLootEntity = tileEntity as TileEntitySecureLootContainer; if (secureLootEntity == null) { return(new BlockActivationCommand[0]); } string _steamID = GamePrefs.GetString(EnumGamePrefs.PlayerId); PersistentPlayerData playerData = _world.GetGameManager().GetPersistentPlayerList().GetPlayerData(secureLootEntity.GetOwner()); bool flag = !secureLootEntity.IsOwner(_steamID) && (playerData != null && playerData.ACL != null && playerData.ACL.Contains(_steamID)); _activationCommands[0].enabled = true; _activationCommands[1].enabled = !secureLootEntity.IsLocked() && (secureLootEntity.IsOwner(_steamID) || flag); _activationCommands[2].enabled = secureLootEntity.IsLocked() && secureLootEntity.IsOwner(_steamID); _activationCommands[3].enabled = !secureLootEntity.IsUserAllowed(_steamID) && secureLootEntity.HasPassword() && secureLootEntity.IsLocked() || secureLootEntity.IsOwner(_steamID); bool isMyLandProtectedBlock = _world.IsMyLandProtectedBlock(_blockPos, _world.GetGameManager().GetPersistentLocalPlayer(), false); _activationCommands[4].enabled = isMyLandProtectedBlock && secureLootEntity.IsOwner(_steamID) && _takeDelay > 0.0; _activationCommands[5].enabled = secureLootEntity.IsOwner(_steamID); return(_activationCommands); }
//NOTE : Requires [{daycolor|always}] variable in xml element 'windowCompass' in file windows.xml static void Postfix(XUiC_CompassWindow __instance, ref string value, ref BindingItem binding) { string fieldName = binding.FieldName; if (fieldName != null && fieldName == "daycolor") { value = "FFFFFF"; if (XUi.IsGameRunning()) { int v4 = GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime); int warning = GameStats.GetInt(EnumGameStats.BloodMoonWarning); if (warning != -1) { int bloodMoon = GameStats.GetInt(EnumGameStats.BloodMoonDay); if (v4 == bloodMoon) { value = "FF0000"; } // Only highlight previous 2 days if the BM is on a fixed cycle, i.e. every 3 days otherwise the warning willm spoil the suprise! if (GamePrefs.GetInt(EnumGamePrefs.BloodMoonRange) == 0) { if (v4 == bloodMoon - 1) { value = "FFA500"; } else if (v4 == bloodMoon - 2) { value = "FFFF00"; } } } } } }
private void Init() { // Configure remote logging RemoteLogger.SetTag("game", Title.ToLower()); RemoteLogger.SetTag("version", GamePrefs.GetString(EnumGamePrefs.GameVersion)); // Setup the default permission groups if (permission.IsLoaded) { var rank = 0; for (var i = DefaultGroups.Length - 1; i >= 0; i--) { var defaultGroup = DefaultGroups[i]; if (!permission.GroupExists(defaultGroup)) { permission.CreateGroup(defaultGroup, defaultGroup, rank++); } } permission.RegisterValidate(s => { ulong temp; if (!ulong.TryParse(s, out temp)) { return(false); } var digits = temp == 0 ? 1 : (int)Math.Floor(Math.Log10(temp) + 1); return(digits >= 17); }); permission.CleanUp(); } }
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 void Start() { int webPort = GamePrefs.GetInt(EnumUtils.Parse <EnumGamePrefs>("ControlPanelPort")); instance = new WebSocketServer("ws://0.0.0.0:" + (webPort + 5)); instance.AddWebSocketService <Logs>("/log"); instance.AuthenticationSchemes = AuthenticationSchemes.Basic; instance.Realm = "WebSocket 7D2D"; WebPermissions.AdminToken[] tokens = WebPermissions.Instance.GetAdmins(); instance.UserCredentialsFinder = id => { // Idk, there's no .Find here so I just iterate through // Probably a cleaner solution possible but ¯\_(ツ)_/¯ foreach (WebPermissions.AdminToken token in tokens) { if (token.name == id.Name && token.permissionLevel == 0) { return(new NetworkCredential(id.Name, token.token, "WebSocket 7D2D")); } } instance.Log.Error($"Tried to authenticate with invalid token {id.Name}"); return(null); }; instance.Start(); }
public static void Postfix(WorldEnvironment __instance, World ___m_World) { if (GamePrefs.GetString(EnumGamePrefs.GameWorld) == "Empty" || GamePrefs.GetString(EnumGamePrefs.GameWorld) == "Playtesting") { if (DistantTerrain.Instance != null) { DistantTerrain.Instance.Cleanup(); DistantTerrain.Instance = null; } return; } if (!GameManager.IsDedicatedServer && !GameManager.IsSplatMapAvailable()) { Debug.Log("Creating Legacy Distant Terrain"); if (DistantTerrain.Instance == null && !GameManager.Instance.World.ChunkClusters[0].IsFixedSize) { DistantTerrain.cShiftHiResChunks = new Vector3(0f, 0.5f, 0f); DistantTerrain.Instance = new DistantTerrain(); DistantTerrain.Instance.Init(); } DistantTerrainConstants.SeaLevel = 0f; DistantTerrain.Instance.Configure(new DelegateGetTerrainHeight(terrainHeightFuncAllOtherWorlds), GameManager.Instance.World.wcd, 0f); if (DistantTerrain.Instance != null) { DistantTerrain.Instance.SetTerrainVisible(true); } } }
void Start() { /*TODO DEBUG */ GamePrefs.SetSoundSetting(1); GamePrefs.SetMusicSetting(1); GamePrefs.SetHighscore(10); } //start
public bool LoadConfig() { XMLConfig conf = new XMLConfig("sdtmlib"); if (!conf.Load()) { Log.Out("Could not Load SDTMLib config"); return(false); } int tryTickRate = 0; string sTickRate = conf.Get("tickrate"); if (sTickRate != "") { int.TryParse(sTickRate, out tryTickRate); if (tryTickRate > 0) { tickRate = tryTickRate; } else { SaveConfig(); } } else { SaveConfig(); } ChatCommandsEnabled = conf.Get("chatcommandsenabled").ToLower() == "true" ? true : false; API.OverrideGamePrefs = conf.Get("overridegameprefs").ToLower() == "true" ? true : false; API.WebConsoleEnabled = conf.Get("webconsole_enabled").ToLower() == "true" ? true : false; API.WebConsolePort = conf.Get("webconsole_port"); if (WebConsolePort == "" || WebConsolePort == null) { WebConsolePort = GamePrefs.GetInt(EnumGamePrefs.ControlPanelPort).ToString(); } if (API.OverrideGamePrefs) { string confWorldType = conf.Get("WorldType"); string confWorldName = conf.Get("WorldName"); if (confWorldType != "") { SetConfig("worldtype", confWorldType, false, true); } if (confWorldName != "") { SetConfig("worldname", confWorldName, false, true); } } return(true); }
// Update the Approach speed, and add a randomized speed to it public override float GetApproachSpeed() { // default approach speed of this new class is 0, so if we are already above that, just re-use the value. if (flApproachSpeed > 0.0f) { return(flApproachSpeed); } // Find the default approach speed from the base class to give us a reference. float fDefaultSpeed = base.GetApproachSpeed(); // if it's greater than 1, just use the base value in the XML. // This would otherwise make the football and wights run even faster than they do now. if (fDefaultSpeed > 1.0f) { return(fDefaultSpeed); } // Set the minimum speed and maxSpeed of the bonus we want to give the zombie float minSpeed = 0.0f; float maxSpeed = 0.3f; // We want to cap the low and top ends. The maxSpeed is the fatest speed boost possible. minSpeed = Math.Max(minSpeed, 0.0f); maxSpeed = Math.Min(maxSpeed, 1.0f); // Grabs a random multiplier for the speed float fRandomMultiplier = UnityEngine.Random.Range(minSpeed, maxSpeed); // If the zombies are set never to run, still apply the multiplier, but don't bother doing calulations based on the night speed. if (GamePrefs.GetInt(EnumGamePrefs.ZombiesRun) == 1) { flApproachSpeed = this.speedApproach + fRandomMultiplier; } else { // Rnadomize the zombie speeds types If you have the blRunInDark set to true, then it'll randomize it too. if (blRunInDark && this.world.IsDark() || lightLevel < EntityZombieSDX.LightThreshold || this.Health < this.GetMaxHealth() * 0.4) { flApproachSpeed = this.speedApproachNight + fRandomMultiplier; } // If it's night time, then use the speedApproachNight value if (this.world.IsDark()) { flApproachSpeed = this.speedApproachNight + fRandomMultiplier; } else { flApproachSpeed = this.speedApproach + fRandomMultiplier; } } // Cap the top end of the speed to be 1.35 or less, otherwise animations may go wonky. return(Math.Min(flApproachSpeed, 1.35f)); }
// Update the Approach speed, and add a randomized speed to it public override float GetApproachSpeed() { // default approach speed of this new class is 0, so if we are already above that, just re-use the value. if (flApproachSpeed > 0.0f) { return(flApproachSpeed); } // Find the default approach speed from the base class to give us a reference. float fDefaultSpeed = base.GetApproachSpeed(); // If random run is disables, return the base speed if (!blRandomSpeeds) { return(fDefaultSpeed); } // if it's greater than 1, just use the base value in the XML. // This would otherwise make the football and wights run even faster than they do now. if (fDefaultSpeed > 1.0f) { return(fDefaultSpeed); } // new way to generate the multiplier to control their speeds float[] numbers = new float[9] { -0.2f, -0.2f, -0.1f, -0.1f, 0.0f, 0.0f, 0.0f, 0.1f, 0.1f }; int randomIndex = random.Next(0, numbers.Length); float fRandomMultiplier = numbers[randomIndex]; // If the zombies are set never to run, still apply the multiplier, but don't bother doing calulations based on the night speed. if (GamePrefs.GetInt(EnumGamePrefs.ZombiesRun) == 1) { flApproachSpeed = this.speedApproach + fRandomMultiplier; } else { // Rnadomize the zombie speeds types If you have the blRunInDark set to true, then it'll randomize it too. if (this.world.IsDark()) { flApproachSpeed = this.speedApproachNight + fRandomMultiplier; } else { flApproachSpeed = this.speedApproach + fRandomMultiplier; } } // If the approach speed is too low, set it to default speed if (flApproachSpeed <= 0) { flApproachSpeed = base.GetApproachSpeed(); } // Cap the top end of the speed to be 1.35 or less, otherwise animations may go wonky. return(Math.Min(flApproachSpeed, 1.1f)); }
public override void GameAwake() { if (!Directory.Exists(string.Format("{0}/ServerTools", GamePrefs.GetString(EnumGamePrefs.SaveGameFolder)))) { Directory.CreateDirectory(string.Format("{0}/ServerTools", GamePrefs.GetString(EnumGamePrefs.SaveGameFolder))); } Config.Init(); }
public void NewGame() { achievementManager.DestroyAllAchievements(); Destroy(GameObject.Find("MainMenuCanvas")); GamePrefs.DeletePlayerProgress(); LoadByIndex(2); }
public static bool Prefix(EntityHornet __instance, Context ___utilityAIContext, EntitySeeCache ___seeCache, EntityLookHelper ___lookHelper, ref int ___aggroCooldown) { if (!__instance.HasAnyTags(FastTags.Parse("allowEAI"))) { return(true); } if (GamePrefs.GetBool(EnumGamePrefs.DebugStopEnemiesMoving)) { __instance.SetMoveForwardWithModifiers(0f, 0f, false); if (__instance.aiManager != null) { __instance.aiManager.UpdateDebugName(); } return(true); } if (__instance.GetAttackTarget() != null) { __instance.SetRevengeTarget(__instance.GetAttackTarget()); } __instance.CheckDespawn(); ___seeCache.ClearIfExpired(); using (ProfilerUsingFactory.Profile("entities.live.ai.manager")) { __instance.aiManager.Update(); } using (ProfilerUsingFactory.Profile("entities.live.ai.getpath")) { PathInfo path = PathFinderThread.Instance.GetPath(__instance.entityId); if (path.path != null) { bool flag = true; flag = __instance.aiManager.CheckPath(path); if (flag) { __instance.navigator.SetPath(path, path.speed); } } __instance.navigator.UpdateNavigation(); } __instance.moveHelper.UpdateMoveHelper(); ___lookHelper.onUpdateLook(); if (__instance.distraction != null && (__instance.distraction.IsDead() || __instance.distraction.IsMarkedForUnload())) { __instance.distraction = null; } if (__instance.pendingDistraction != null && (__instance.pendingDistraction.IsDead() || __instance.pendingDistraction.IsMarkedForUnload())) { __instance.pendingDistraction = null; } return(true); }
private static void TestWriter(List <string> _params) { // Printer.Write("TestWriter"); Printer.Print("SGF", GamePrefs.GetString(EnumGamePrefs.SaveGameFolder)); // C:\Users\N4TH\AppData\Roaming/7DaysToDie/Saves Printer.Print("USF", GamePrefs.GetString(EnumGamePrefs.UserDataFolder)); // C:\Users\N4TH\AppData\Roaming/7DaysToDie string modpth = (Application.platform == RuntimePlatform.OSXPlayer) ? (Application.dataPath + "/../../Mods") : (Application.dataPath + "/../Mods"); Printer.Print("MF", modpth); // ModManager.MOD_PATH); // }
/// <inheritdoc/> public override void OnLoadPlugin() { this.LoadTranslations("ReservedSlots.Plugin"); this.reservedSlots = this.CreateConVar("ReservedSlots", "0", "The number of reserved slots.", true, 0).Value; this.AutoExecConfig(true, "ReservedSlots"); this.maxPlayers = GamePrefs.GetInt(EnumGamePrefs.ServerMaxPlayerCount); }
private void OnServerInitialized() { if (serverInitialized) { return; } serverInitialized = true; // Configure the hostname after it has been set RemoteLogger.SetTag("hostname", GamePrefs.GetString(EnumGamePrefs.ServerName)); }
public static bool Prefix(Prefab __instance, ref Vector3i _destinationPos, ChunkCluster _cluster, QuestTags _questTags) { // If they are pre-generated Winter Project worlds, don't apply this. They'd have already been applied. if (GamePrefs.GetString(EnumGamePrefs.GameWorld).ToLower().Contains("winter project")) { return(true); } _destinationPos.y -= 8; return(true); }
public Saver() { _myDocuments = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Polaris"); if (!Directory.Exists(_myDocuments)) { Directory.CreateDirectory(_myDocuments); } _gamePrefs = GetPrefsFromFile(); _gameStats = GetStatsFromFile(); }
public override WWWResponse ProcessRequest(WWWRequest request) { //GameManager.Instance.adminTools.IsWhiteListEnabled WWWResponse response = null; if (!request.Form.ContainsKey("password") || request.Form["password"] == "") { string loginTemplate = WWW._templates ["loginform"]; if (GameManager.Instance.adminTools.IsWhiteListEnabled()) { string steamButton = WWW._templates["steambutton"]; string hostAndPort = "http://" + request._request.Url.Host + ":" + request._request.Url.Port; string steamLoginUrl = EndPoint_SteamLogin.GetSteamLoginUrl(hostAndPort, hostAndPort + "/steam"); steamButton = steamButton.Replace("{login_url}", steamLoginUrl); loginTemplate = loginTemplate.Replace("{steam_button}", steamButton); loginTemplate = loginTemplate.Replace("{steam_button_title}", "Login with Steam"); } else { loginTemplate = loginTemplate.Replace("{steam_button}", ""); } response = new WWWResponse(loginTemplate); } else { string pw = request.Form["password"]; if (pw == GamePrefs.GetString(EnumGamePrefs.ServerPassword)) { request.User.SetType("user"); response = new WWWResponse("/", 302); } else { if (pw == GamePrefs.GetString(EnumGamePrefs.ControlPanelPassword)) { request.User.SetType("admin"); response = new WWWResponse("/", 302); } else { response = new WWWResponse("/login/?err=InvalidPassword", 302); } } } return(response); }
private static bool IsInit = false; // prevent on 2nd game ? public static void Init(int playerId) { /* * Should be safe to do multiple calls ... * - Depends on Map so need re apply on game change * - Should only be called once per game (mostly because of thread start) * * - Check: multiplayer local * - Called twice with 2 local players -> if below * - Each player triggers on connect ? */ /* I should put this all in the buff ?? Anythin here may be duplicate */ if (IsInit) { Printer.Write("Zombiome is already init !", playerId); // if (AutoStart) { // ZombiomeManager.Reset(playerId, ""); // } return; } Printer.Write("Zombiome.Init():", playerId); CSutils.Routines.Sanitizer.Fixer = () => ZombiomeManager._Reset(-1); CSutils.Catcher.SwallowErrors = SwallowError; rand = GameRandomManager.Instance.CreateGameRandom(); worldSeed = GamePrefs.GetString(EnumGamePrefs.WorldGenSeed); worldSize = GamePrefs.GetInt(EnumGamePrefs.WorldGenSize); ZBiomeInfo.Define(); if (nz4) { Zone.Get = Zone.GetFour; } else { Zone.Get = position => new Zone[] { Zone.GetSingle(position) } }; ZBActivity.ZombiomeActivitySelector.Initialize(); if (AutoStart) { ZombiomeManager.Reset(playerId, ""); } IsInit = true; // bugs on restart new game coz no one set to none - use World hash ? Printer.Write("Zombiome..Init: Done"); // ZombiomeManager.Start(playerId); // manually until release }
void OnCollisionEnter2D(Collision2D target) { if (target.gameObject.tag == "ball") { int randomSound = Random.Range(0, 100) % 4; if (GamePrefs.GetSoundSetting() != 0) { Debug.Log("Sound should be played here"); AudioSource.PlayClipAtPoint(sounds[randomSound], transform.position); } Ball2d.POT_SCORE = 1; } } //onCollisionEnter2D
private void OnServerInitialized() { if (serverInitialized) { return; } serverInitialized = true; // Configure the hostname after it has been set RemoteLogger.SetTag("hostname", GamePrefs.GetString(EnumGamePrefs.ServerName)); // Update server console window and status bars SevenDaysExtension.ServerConsole(); }
public static bool Prefix(ref Prefab __instance, ref Vector3i _prefabTargetPos) { // If they are pre-generated Winter Project worlds, don't apply this. They'd have already been applied. if (GamePrefs.GetString(EnumGamePrefs.GameWorld).ToLower().Contains("winter project")) { return(true); } _prefabTargetPos.y -= 8; __instance.bTraderArea = false; __instance.bExcludeDistantPOIMesh = true; __instance.bCopyAirBlocks = true; return(true); }
public static void PlayerLoginRPC_Postfix(bool __state) { try { if (__state) { int _maxCount = GamePrefs.GetInt(EnumGamePrefs.ServerMaxPlayerCount); GamePrefs.Set(EnumGamePrefs.ServerMaxPlayerCount, _maxCount - 1); } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in Injections.PlayerLoginRPC_Postfix: {0}", e.Message)); } }
public static int DaysRemaining(int _daysUntilHorde) { int _bloodmoonFrequency = GamePrefs.GetInt(EnumGamePrefs.BloodMoonFrequency); if (_daysUntilHorde <= _bloodmoonFrequency) { int _daysLeft = _bloodmoonFrequency - _daysUntilHorde; return(_daysLeft); } else { int _daysLeft = _daysUntilHorde - _bloodmoonFrequency; return(DaysRemaining(_daysLeft)); } }
internal static void ServerConsole() { if (Interface.Oxide.ServerConsole == null) { return; } Interface.Oxide.ServerConsole.Title = () => { return($"{GameManager.Instance?.World?.Players?.Count} | {GamePrefs.GetString(EnumGamePrefs.ServerName)}"); }; Interface.Oxide.ServerConsole.Status1Left = () => $" {GamePrefs.GetString(EnumGamePrefs.ServerName)}"; Interface.Oxide.ServerConsole.Status1Right = () => { var fps = Mathf.RoundToInt(1f / Time.smoothDeltaTime); var seconds = TimeSpan.FromSeconds(Time.realtimeSinceStartup); var uptime = $"{seconds.TotalHours:00}h{seconds.Minutes:00}m{seconds.Seconds:00}s".TrimStart(' ', 'd', 'h', 'm', 's', '0'); return(string.Concat(fps, "fps, ", uptime)); }; Interface.Oxide.ServerConsole.Status2Left = () => { var players = GameManager.Instance?.World?.Players?.Count; var playerLimit = GamePrefs.GetInt(EnumGamePrefs.ServerMaxPlayerCount); var entitiesCount = GameManager.Instance?.World?.Entities?.Count; var entities = entitiesCount + (entitiesCount.Equals(1) ? " entity" : " entities"); return(string.Concat(" ", players, "/", playerLimit, " players, ", entities)); }; Interface.Oxide.ServerConsole.Status2Right = () => string.Empty; // TODO: Network in/out Interface.Oxide.ServerConsole.Status3Left = () => { if (GameManager.Instance == null || GameManager.Instance.World == null) { return(string.Empty); } var time = DateTime.Today.Add(TimeSpan.FromSeconds(GameManager.Instance.World.GetWorldTime())).ToString("h:mm tt").ToLower(); var world = GamePrefs.GetString(EnumGamePrefs.GameWorld); var seed = GamePrefs.GetString(EnumGamePrefs.GameName); return(string.Concat(" ", time, ", ", world, " [", seed, "]")); }; Interface.Oxide.ServerConsole.Status3Right = () => $"Oxide {OxideMod.Version} for {GamePrefs.GetString(EnumGamePrefs.GameVersion)}"; Interface.Oxide.ServerConsole.Status3RightColor = ConsoleColor.Yellow; Interface.Oxide.ServerConsole.Input += ServerConsoleOnInput; Interface.Oxide.ServerConsole.Completion = input => { return(string.IsNullOrEmpty(input) ? null : SdtdConsole.Instance.commands.Keys.Where(c => c.StartsWith(input.ToLower())).ToArray()); }; }
// The vulture updateTasks() doesn't call down the chain, so it never does any checks on the AI Tasks. protected override void updateTasks() { base.updateTasks(); if (!GamePrefs.GetBool(EnumGamePrefs.DebugStopEnemiesMoving)) { if (!EntityClass.list[this.entityClass].UseAIPackages) { using (ProfilerUsingFactory.Profile("entities.live.ai.tasks")) { this.TaskList.OnUpdateTasks(); this.TargetList.OnUpdateTasks(); } } } }