static string MakeUrl(string url) { if (MyGuiSandbox.IsUrlWhitelisted(url)) { return(url); } return($"https://steamcommunity.com/linkfilter/?url={url}"); }
public void SendMotd(MyPlayer player) { long playerId = player.Identity.IdentityId; if (!string.IsNullOrEmpty(Config.MotdUrl) && !Config.NewUserMotdUrl) { if (MyGuiSandbox.IsUrlWhitelisted(Config.MotdUrl)) { MyVisualScriptLogicProvider.OpenSteamOverlay(Config.MotdUrl, playerId); } else { MyVisualScriptLogicProvider.OpenSteamOverlay($"https://steamcommunity.com/linkfilter/?url={Config.MotdUrl}", playerId); } } var id = player.Client.SteamUserId; if (id <= 0) //can't remember if this returns 0 or -1 on error. { return; } string name = player.Identity?.DisplayName ?? "player"; bool newUser = !Config.KnownSteamIds.Contains(id); if (newUser) { Config.KnownSteamIds.Add(id); } if (!string.IsNullOrEmpty(Config.MotdUrl) && newUser && Config.NewUserMotdUrl) { if (MyGuiSandbox.IsUrlWhitelisted(Config.MotdUrl)) { MyVisualScriptLogicProvider.OpenSteamOverlay(Config.MotdUrl, playerId); } else { MyVisualScriptLogicProvider.OpenSteamOverlay($"https://steamcommunity.com/linkfilter/?url={Config.MotdUrl}", playerId); } } if (newUser && !string.IsNullOrEmpty(Config.NewUserMotd)) { ModCommunication.SendMessageTo(new DialogMessage(MySession.Static.Name, "New User Message Of The Day", Config.NewUserMotd.Replace("%player%", name)), id); } else if (!string.IsNullOrEmpty(Config.Motd)) { ModCommunication.SendMessageTo(new DialogMessage(MySession.Static.Name, "Message Of The Day", Config.Motd.Replace("%player%", name)), id); } }
void OnWwwTextChanged(MyGuiControlTextbox source) { if (source.Text.Length == 0 || MyGuiSandbox.IsUrlWhitelisted(source.Text)) { source.ColorMask = Vector4.One; source.SetToolTip((MyToolTips)null); m_okButton.Enabled = true; } else { m_wwwTextbox.SetToolTip(MySpaceTexts.WwwLinkNotAllowed); source.ColorMask = Color.Red.ToVector4(); m_okButton.Enabled = false; } }
public void SendMotd(long playerId = 0) { if (!string.IsNullOrEmpty(Config.MotdUrl)) { if (MyGuiSandbox.IsUrlWhitelisted(Config.MotdUrl)) { MyVisualScriptLogicProvider.OpenSteamOverlay(Config.MotdUrl, playerId); } else { MyVisualScriptLogicProvider.OpenSteamOverlay($"https://steamcommunity.com/linkfilter/?url={Config.MotdUrl}", playerId); } } if (!string.IsNullOrEmpty(Config.Motd)) { if (MySession.Static.Players.TryGetPlayerId(playerId, out MyPlayer.PlayerId info)) { Torch.CurrentSession?.Managers?.GetManager <IChatManagerServer>() .SendMessageAsOther("MOTD", Config.Motd, MyFontEnum.Blue, info.SteamId); } } }