private void OnServerInitialized() { if (serverInitialized) { return; } serverInitialized = true; // Configure the hostname after it has been set RemoteLogger.SetTag("hostname", PlayerPrefs.GetString("MpGameName")); // Add 'oxide' and 'modded' tags SteamGameServer.SetGameTags("oxide,modded"); // Update server console window and status bars TheForestExtension.ServerConsole(); // Disable audio and client-side elements if not dedicated if (TheForestExtension.DisableClient) { DisableAudio(); DisableClient(); } // Save the level every X minutes Interface.Oxide.GetLibrary <Timer>().Once(300f, () => LevelSerializer.SaveGame("Game")); }
private void OnServerInitialized() { if (serverInitialized) { return; } serverInitialized = true; Analytics.Collect(); // Add some Steam tags SteamGameServer.SetGameTags("oxide,modded"); // Update server console window and status bars TheForestExtension.ServerConsole(); // Save the level every X minutes Interface.Oxide.GetLibrary <Timer>().Repeat(300f, 0, () => { LevelSerializer.SaveGame("Game"); // TODO: Make optional LevelSerializer.Checkpoint(); Interface.Oxide.LogInfo("Server has been saved!"); }); // Check if client should be disabled //if (commandLine.HasVariable("batchmode") || commandLine.HasVariable("nographics")) //{ TheForestExtension.DisableAudio(); TheForestExtension.DisableClient(); //} }
private void UpdateSteamGameServerValues() { if (Configuration.Instance.largeServer) { if (Provider.maxPlayers > 24) { SteamGameServer.SetMaxPlayerCount(24); } else { Logger.Log("Skipping large server due to server count being below 24 players"); } } if (Configuration.Instance.gameName != null) { SteamGameServer.SetGameTags((!Provider.isPvP ? "PVE" : "PVP") + ",GAMEMODE:" + Configuration.Instance.gameName + ',' + (!Provider.hasCheats ? "STAEHC" : "CHEATS") + ',' + Provider.mode.ToString() + "," + Provider.cameraMode.ToString() + "," + (Provider.serverWorkshopFileIDs.Count <= 0 ? "KROW" : "WORK") + "," + (!Provider.isGold ? "YLNODLOG" : "GOLDONLY") + "," + (!Provider.configData.Server.BattlEye_Secure ? "BATTLEYE_OFF" : "BATTLEYE_ON")); } if (Configuration.Instance.hideWorkshop) { SteamGameServer.SetKeyValue("Browser_Workshop_Count", null); } if (Configuration.Instance.hideConfiguration) { SteamGameServer.SetKeyValue("Browser_Config_Count", null); } if (Configuration.Instance.rocketPlugins != null) { SteamGameServer.SetKeyValue("rocketplugins", string.Join(",", Configuration.Instance.rocketPlugins.ToArray())); } }
private void OnServerInitialized() { if (serverInitialized) { return; } serverInitialized = true; // Configure remote logging RemoteLogger.SetTag("hostname", PlayerPrefs.GetString("MpGameName")); // Add some Steam tags SteamGameServer.SetGameTags("oxide,modded"); // Update server console window and status bars TheForestExtension.ServerConsole(); // Save the level every X minutes Interface.Oxide.GetLibrary <Timer>().Repeat(300f, 0, () => { LevelSerializer.SaveGame("Game"); // TODO: Make optional LevelSerializer.Checkpoint(); Interface.Oxide.LogInfo("Server has been saved!"); }); }
private void SendUpdatedServerDetailsToSteam() { SteamGameServer.SetMaxPlayerCount(SteamDSConfig.ServerPlayers); SteamGameServer.SetPasswordProtected(!string.IsNullOrEmpty(SteamDSConfig.ServerPassword)); SteamGameServer.SetServerName(SteamDSConfig.ServerName); SteamGameServer.SetMapName(SteamDSConfig.MapName); SteamGameServer.SetGameTags(SteamDSConfig.ServerGUID + ";__E3C26D06F07B6AB14EC25F4823E9A30D6B4ED0450527C1E768739D96C9F061AE"); SteamGameServer.ForceHeartbeat(); }
private void SendUpdatedServerDetailsToSteam() { SteamGameServer.SetMaxPlayerCount(SteamDSConfig.ServerPlayers); SteamGameServer.SetPasswordProtected(!string.IsNullOrEmpty(SteamDSConfig.ServerPassword)); SteamGameServer.SetServerName(SteamDSConfig.ServerName); SteamGameServer.SetMapName(SteamDSConfig.MapName); SteamGameServer.SetGameTags(SteamDSConfig.ServerGUID + ";__F486E3E06B8E13E0388571BE0FDC8A35182D8BE83E9256BA53BC5FBBDBCF23BC"); SteamGameServer.ForceHeartbeat(); }
private void OnServerInitialized() { if (serverInitialized) { return; } serverInitialized = true; Analytics.Collect(); SteamGameServer.SetGameTags("oxide,modded"); TheForestExtension.ServerConsole(); }
public void SetAdditionalGameInfo() { var type = ServerConfig.GameType.ToString(); var mode = ServerConfig.SceneMode.ToString(); var UID = ServerConfig.ServerUID.ToString("X"); var state = (uLinkNetwork.ServerStatus & CustomData.EServerStatus.Gameing) == CustomData.EServerStatus.Gameing ? 4 : 1; var numPlayers = uLink.Network.connections.Length; var masterName = ServerConfig.MasterRoleName; var pub = ServerConfig.PublicServer ? ",public" : ""; SteamGameServer.SetGameTags($"{type},{mode},{UID},{state},{numPlayers},{masterName}{pub}"); }
private void OnServerInitialized() { if (serverInitialized) { return; } Analytics.Collect(); HurtworldExtension.ServerConsole(); SteamGameServer.SetGameTags("oxide,modded"); serverInitialized = true; }
public static void SetModded() { try { using (TimeWarning.New("UpdateServerInformation", 0.1f)) { SteamGameServer.SetServerName(ConVar.Server.hostname); SteamGameServer.SetMaxPlayerCount(ConVar.Server.maxplayers); SteamGameServer.SetPasswordProtected(false); SteamGameServer.SetMapName(UnityEngine.SceneManagement.SceneManager.GetActiveScene().name); string pchGameTags = string.Format("mp{0},cp{1},v{2}{3}{4}", new object[] { ConVar.Server.maxplayers, BasePlayer.activePlayerList.Count, Rust.Protocol.network, ConVar.Server.pve ? ",pve" : string.Empty, pluton.enabled ? ",modded,pluton" : string.Empty }); SteamGameServer.SetGameTags(pchGameTags); string[] array = ConVar.Server.description.SplitToChunks(100).ToArray <string>(); for (int i = 0; i < 16; i++) { if (i < array.Length) { SteamGameServer.SetKeyValue(string.Format("description_{0:00}", i), array[i]); } else { SteamGameServer.SetKeyValue(string.Format("description_{0:00}", i), String.Empty); } } SteamGameServer.SetKeyValue("country", SteamGameServerUtils.GetIPCountry()); SteamGameServer.SetKeyValue("world.seed", global::World.Seed.ToString()); SteamGameServer.SetKeyValue("world.size", global::World.Size.ToString()); SteamGameServer.SetKeyValue("official", ConVar.Server.official.ToString()); SteamGameServer.SetKeyValue("pve", ConVar.Server.pve.ToString()); SteamGameServer.SetKeyValue("headerimage", ConVar.Server.headerimage); SteamGameServer.SetKeyValue("url", ConVar.Server.url); SteamGameServer.SetKeyValue("uptime", ((int)Time.realtimeSinceStartup).ToString()); SteamGameServer.SetKeyValue("mem_ws", Performance.usedMemoryWorkingSetMB.ToString()); SteamGameServer.SetKeyValue("mem_pv", Performance.usedMemoryPrivateMB.ToString()); SteamGameServer.SetKeyValue("gc_mb", Performance.memoryAllocations.ToString()); SteamGameServer.SetKeyValue("gc_cl", Performance.memoryCollections.ToString()); SteamGameServer.SetKeyValue("fps", Performance.frameRate.ToString()); SteamGameServer.SetKeyValue("fps_avg", Performance.frameRateAverage.ToString("0.00")); SteamGameServer.SetKeyValue("ent_cnt", BaseNetworkable.serverEntities.Count.ToString()); SteamGameServer.SetKeyValue("build", BuildInformation.VersionStampDays.ToString()); } } catch (Exception ex) { Logger.LogError("[Hooks] Error while setting the server modded."); Logger.LogException(ex); } }
private void OnServerInitialized() { if (serverInitialized) { return; } serverInitialized = true; // Add 'oxide' and 'modded' tags SteamGameServer.SetGameTags("oxide,modded"); // Configure the hostname after it has been set RemoteLogger.SetTag("hostname", GameManager.Instance.ServerConfig.GameName); }
private void IOnServerInitialized() { if (!serverInitialized) { Analytics.Collect(); HurtworldExtension.ServerConsole(); SteamGameServer.SetGameTags("oxide,modded"); // Let plugins know server startup is complete serverInitialized = true; Interface.CallHook("OnServerInitialized", serverInitialized); Interface.Oxide.LogInfo($"Server version is: {Server.Version}"); } }
private void OnServerInitialized() { if (serverInitialized) { return; } serverInitialized = true; // Add 'oxide' and 'modded' tags SteamGameServer.SetGameTags("oxide,modded"); // Configure the hostname after it has been set RemoteLogger.SetTag("hostname", GameManager.Instance.ServerConfig.GameName); // Update server console window and status bars HurtworldExtension.ServerConsole(); }
public static bool RegisterServer_modded(string name, bool password, string version, bool publicServer, string worldName, ZSteamMatchmaking __instance) { __instance.UnregisterServer(); SteamGameServer.SetServerName(config.ServerName); SteamGameServer.SetMapName(config.SteamMapName); SteamGameServer.SetPasswordProtected(password); SteamGameServer.SetGameTags(version); SteamGameServer.EnableHeartbeats(publicServer); SteamGameServer.SetMaxPlayerCount(config.Size); SteamGameServer.SetGameDescription("Valheim"); AccessTools.Field(typeof(ZSteamMatchmaking), "m_registerServerName").SetValue(__instance, config.ServerName); AccessTools.Field(typeof(ZSteamMatchmaking), "m_registerPassword").SetValue(__instance, password); AccessTools.Field(typeof(ZSteamMatchmaking), "m_registerVerson").SetValue(__instance, version); print("Registering lobby (modded)"); return(false); }
private void OnServerInitialized() { if (serverInitialized) { return; } Analytics.Collect(); HoldfastExtension.ServerConsole(); SteamGameServer.SetGameTags("modded,oxide"); messageManager = ServerComponentReferenceManager.ServerInstance.serverAdminBroadcastMessageManager; banManager = ServerComponentReferenceManager.ServerInstance.serverBannedPlayersManager; serverConfig = ServerConfigurationFileManager.CurrentConfigurationFile; connectionManager = ServerComponentReferenceManager.ServerInstance.serverConnectionManager; gameDetails = ServerComponentReferenceManager.ServerInstance.serverGameManager.CreateGameDetailsFromConfigFile(0); gameManager = ServerComponentReferenceManager.ServerInstance.serverGameManager; serverInitialized = true; }
private void EditLobby() { string mode; string perspective; string thumbnail; bool workshop = Provider.getServerWorkshopFileIDs().Count > 0; #region Plugins if (m_Configuration.GetSection("Hide:Rocket").Get <bool>()) { SteamGameServer.SetBotPlayerCount(0); } if (!m_Configuration.GetSection("Hide:Plugins").Get <bool>()) { if (m_Configuration.GetSection("Edit:Plugins").Get <bool>()) { SteamGameServer.SetKeyValue("rocketplugins", string.Join(",", m_Configuration.GetSection("PluginsOverride").Get <string[]>())); } else { SteamGameServer.SetKeyValue("rocketplugins", string.Join(",", m_PluginActivator.ActivatedPlugins.ToList().Select(p => p.DisplayName).ToArray())); } } else { SteamGameServer.SetKeyValue("rocketplugins", ""); } if (m_Configuration.GetSection("GameTags:Vanilla").Get <bool>()) { SteamGameServer.SetBotPlayerCount(0); SteamGameServer.SetKeyValue("rocketplugins", ""); SteamGameServer.SetKeyValue("rocket", ""); } else { if (!m_Configuration.GetSection("Hide:Rocket").Get <bool>()) { SteamGameServer.SetBotPlayerCount(1); } if (!m_Configuration.GetSection("Hide:Plugins").Get <bool>() && !m_Configuration.GetSection("Edit:Plugins").Get <bool>()) { SteamGameServer.SetKeyValue("rocketplugins", string.Join(",", m_PluginActivator.ActivatedPlugins.ToList().Select(p => p.DisplayName).ToArray())); } string version = ModuleHook.modules.Find(a => a.config.Name == "Rocket.Unturned")?.config.Version ?? "4.9.3.3"; SteamGameServer.SetKeyValue("rocket", version); } #endregion #region Workshops /*if (Configuration.Instance.HideWorkshop) * { * workshop = false; * SteamGameServer.SetKeyValue("Browser_Workshop_Count", "0"); * } * else if (Configuration.Instance.EditWorkshop) * { * workshop = true; * string txt = string.Join(",", Configuration.Instance.Workshop); * SteamGameServer.SetKeyValue("Browser_Workshop_Count", ((txt.Length - 1) / 120 + 1).ToString()); * * int line = 0; * for (int i = 0; i < txt.Length; i += 120) * { * int num6 = 120; * * if (i + num6 > txt.Length) * num6 = txt.Length - i; * * string pValue2 = txt.Substring(i, num6); * SteamGameServer.SetKeyValue("Browser_Workshop_Line_" + line, pValue2); * line++; * } * } * else * { * SteamGameServer.SetKeyValue("Browser_Workshop_Count", GetWorkshopCount().ToString()); * }*/ #endregion #region Configs if (m_Configuration.GetSection("Hide:Config").Get <bool>()) { SteamGameServer.SetKeyValue("Browser_Config_Count", "0"); } else { SteamGameServer.SetKeyValue("Browser_Config_Count", GetConfigurationCount().ToString()); } switch (m_Configuration["GameTags:Mode"].ToLower().Trim()) { case "easy": mode = "EZY"; break; case "hard": mode = "HRD"; break; default: mode = "NRM"; break; } switch (m_Configuration["GameTags:Perspective"].ToLower().Trim()) { case "first": perspective = "1Pp"; break; case "third": perspective = "3Pp"; break; case "vehicle": perspective = "4Pp"; break; default: perspective = "2Pp"; break; } #endregion #region Thumbnail if (!m_Configuration.GetSection("Hide:Thumbnail").Get <bool>()) { switch (m_Configuration.GetSection("Edit:Thumbnail").Get <bool>()) { case true: thumbnail = m_Configuration["ThumbnailOverride"]; break; case false: thumbnail = Provider.configData.Browser.Thumbnail; break; default: thumbnail = Provider.configData.Browser.Thumbnail; break; } } else { thumbnail = ""; } #endregion #region GameTags string tags = string.Concat(new string[] { m_Configuration.GetSection("GameTags:PVP").Get <bool>() ? "PVP" : "PVE", ",<gm>", m_Configuration["GameTags:GameMode"], "</gm>,", m_Configuration.GetSection("GameTags:Cheats").Get <bool>() ? "CHy" : "CHn", ",", mode, ",", perspective, ",", workshop ? "WSy" : "WSn", ",", m_Configuration.GetSection("GameTags:Gold").Get <bool>() ? "GLD" : "F2P", ",", m_Configuration.GetSection("GameTags:BattlEyeSecure").Get <bool>() ? "BEy" : "BEn", ",<tn>", thumbnail, "</tn>" }); SteamGameServer.SetGameTags(tags); #endregion }
public void ModifyGameTags() { string tags = ""; #region Workshop if (Configuration.Instance.HideWorkshop) { tags += "KROW"; // No workshop SteamGameServer.SetKeyValue("Browser_Workshop_Count", "0"); } else if (Configuration.Instance.MessWorkshop) { tags += "WORK"; // Workshop string txt = ""; foreach (string a in Configuration.Instance.Workshop) { if (txt.Length > 0) { txt += ","; } txt += a; } SteamGameServer.SetKeyValue("Browser_Workshop_Count", ((txt.Length - 1) / 120 + 1).ToString()); int num5 = 0; for (int m = 0; m < txt.Length; m += 120) { int num6 = 120; if (m + num6 > txt.Length) { num6 = txt.Length - m; } string pValue2 = txt.Substring(m, num6); SteamGameServer.SetKeyValue("Browser_Workshop_Line_" + num5, pValue2); num5++; } } else { if (Provider.serverWorkshopFileIDs.Count <= 0) { tags += "KROW"; } else { tags += "WORK"; // Workshop SteamGameServer.SetKeyValue("Browser_Workshop_Count", GetWorkshopCount().ToString()); } } #endregion #region Gamemode if (Configuration.Instance.MessGamemode) { tags += ",GAMEMODE:" + Configuration.Instance.Gamemode; } else if (Provider.gameMode != null) { tags += ",GAMEMODE:" + Provider.gameMode.GetType().Name; } #endregion #region Config if (Configuration.Instance.MessConfig) { tags += ","; if (Configuration.Instance.IsPVP) { tags += "PVP"; } else { tags += "PVE"; } tags += ","; if (Configuration.Instance.HasCheats) { tags += "CHEATS"; } else { tags += "STAEHC"; } tags += ","; tags += Configuration.Instance.Difficulty; tags += ","; tags += Configuration.Instance.CameraMode; tags += ","; if (Configuration.Instance.GoldOnly) { tags += "GOLDONLY"; } else { tags += "YLNODLOG"; } tags += ","; if (Configuration.Instance.HasBattleye) { tags += "BATTLEYE_ON"; } else { tags += "BATTLEYE_OFF"; } } else { tags += ","; tags += (!Provider.isPvP) ? "PVE" : "PVP"; tags += ","; tags += (!Provider.hasCheats) ? "STAEHC" : "CHEATS"; tags += ","; tags += Provider.mode.ToString(); tags += ","; tags += Provider.cameraMode.ToString(); tags += ","; tags += (!Provider.isGold) ? "YLNODLOG" : "GOLDONLY"; tags += ","; tags += (!Provider.configData.Server.BattlEye_Secure) ? "BATTLEYE_OFF" : "BATTLEYE_ON"; } #endregion #region Configuration if (Configuration.Instance.HideConfig) { SteamGameServer.SetKeyValue("Browser_Config_Count", "0"); } else { SteamGameServer.SetKeyValue("Browser_Config_Count", GetConfigurationCount().ToString()); } #endregion SteamGameServer.SetGameTags(tags); #region Plugins if (Configuration.Instance.InvisibleRocket) { SteamGameServer.SetBotPlayerCount(0); // Bypasses unturned's filter for rocket <3 } if (!Configuration.Instance.HidePlugins) { if (Configuration.Instance.MessPlugins) { SteamGameServer.SetKeyValue("rocketplugins", string.Join(",", Configuration.Instance.Plugins)); } else { SteamGameServer.SetKeyValue("rocketplugins", string.Join(",", R.Plugins.GetPlugins().Select(p => p.Name).ToArray())); } } else { SteamGameServer.SetKeyValue("rocketplugins", ""); } if (Configuration.Instance.IsVannila) { SteamGameServer.SetBotPlayerCount(0); SteamGameServer.SetKeyValue("rocketplugins", ""); SteamGameServer.SetKeyValue("rocket", ""); } else { if (!Configuration.Instance.InvisibleRocket) { SteamGameServer.SetBotPlayerCount(1); } if (!Configuration.Instance.HidePlugins && !Configuration.Instance.MessPlugins) { SteamGameServer.SetKeyValue("rocketplugins", string.Join(",", R.Plugins.GetPlugins().Select(p => p.Name).ToArray())); } SteamGameServer.SetKeyValue("rocket", ModuleHook.modules.FirstOrDefault(a => a.config.Name == "Rocket.Unturned").config.Version); } #endregion }