public override void Entry(IModHelper helper) { ModHelper = helper; LoadConfig(); CoopMenuHolder.PublicCheckBox.IsChecked = Config.PublicCheckedByDefault; RefreshTexture = helper.Content.Load <Texture2D>("refresh.png"); Patch.PatchAll("Ilyaki.ServerBrowser"); callr = CallResult <LobbyMatchList_t> .Create(OnReceiveSteamServers); helper.ConsoleCommands.Add("serverbrowser_setTemporaryPassword", "Set a temporary password for the current server. Usage: serverbrowser_setTemporaryPassword <password>", (cmd, args) => { if (args.Length != 1) { Monitor.Log("Need a password to set", LogLevel.Error); } else if (!Game1.IsServer) { Monitor.Log("You need to be the server host", LogLevel.Error); } else if (CurrentCreatedLobby == null) { Monitor.Log("Can't find a connected server", LogLevel.Error); } else { ServerMetaData.SetTemporaryPassword(CurrentCreatedLobby, args[0]); Monitor.Log("Set the temporary password", LogLevel.Info); } }); helper.ConsoleCommands.Add("serverbrowser_reloadConfig", "Reload the config.json", (cmd, args) => { if (args.Length != 0) { Monitor.Log("This command required no parameters", LogLevel.Error); } else { LoadConfig(); Monitor.Log("Reloaded config", LogLevel.Info); if (Game1.IsServer && CurrentCreatedLobby != null) { ServerMetaData.InnitServer(CurrentCreatedLobby); } } }); helper.Events.GameLoop.UpdateTicked += (o, e) => { if (CurrentCreatedLobby != null && Game1.IsServer && e.IsMultipleOf(60 * 5)) { ServerMetaData.UpdateServerTick(CurrentCreatedLobby); } }; }
public static void Postfix(GalaxyID lobbyID, LobbyEnterResult result) { if (result == LobbyEnterResult.LOBBY_ENTER_RESULT_SUCCESS) { ModEntry.CurrentCreatedLobby = lobbyID; ServerMetaData.InnitServer(lobbyID); } else { Console.WriteLine("Failed to create galaxy lobby: " + result); } }