public static void DeleteBlackWord(string typeStr, string word) { BlackWordType type; if (!BlackWordType.TryParse(typeStr, true, out type)) { return; } var wordStruct = Words.FirstOrDefault(wordS => wordS.Type == type && word.Contains(wordS.Word)); if (string.IsNullOrEmpty(wordStruct.Word)) { return; } Words.Remove(wordStruct); using (var adapter = Azure.GetDatabaseManager().GetQueryReactor()) { adapter.SetQuery("DELETE FROM server_blackwords WHERE word = @word AND type = @type"); adapter.AddParameter("word", word); adapter.AddParameter("type", typeStr); adapter.RunQuery(); } }
/// <summary> /// Checks the specified string. /// </summary> /// <param name="str">The string.</param> /// <param name="type">The type.</param> /// <param name="word">The word.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> public static bool Check(string str, BlackWordType type, out BlackWord word) { word = Empty; if (!Replaces.ContainsKey(type)) return false; var data = Replaces[type]; str = Filter.Replace(data.Filter, str); var wordFirst = Words.FirstOrDefault(wordStruct => wordStruct.Type == type && str.Contains(wordStruct.Word)); word = wordFirst; return !string.IsNullOrEmpty(wordFirst.Word); }
/// <summary> /// Checks the specified string. /// </summary> /// <param name="str">The string.</param> /// <param name="type">The type.</param> /// <param name="word">The word.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> public static bool Check(string str, BlackWordType type, out BlackWord word) { word = Empty; if (!Replaces.ContainsKey(type)) { return(false); } var data = Replaces[type]; str = Filter.Replace(data.Filter, str); var wordFirst = Words.FirstOrDefault(wordStruct => wordStruct.Type == type && str.Contains(wordStruct.Word)); word = wordFirst; return(!string.IsNullOrEmpty(wordFirst.Word)); }
public static void AddBlackWord(string typeStr, string word) { BlackWordType type; if (!BlackWordType.TryParse(typeStr, true, out type)) { return; } if (Words.Any(wordStruct => wordStruct.Type == type && word.Contains(wordStruct.Word))) { return; } using (var adapter = Azure.GetDatabaseManager().GetQueryReactor()) { adapter.SetQuery("INSERT INTO server_blackwords VALUES (null, @word, @type)"); adapter.AddParameter("word", word); adapter.AddParameter("type", typeStr); adapter.RunQuery(); } AddPrivateBlackWord(typeStr, word); }
/// <summary> /// Initializes a new instance of the <see cref="BlackWord"/> struct. /// </summary> /// <param name="word">The word.</param> /// <param name="type">The type.</param> public BlackWord(string word, BlackWordType type) { Word = word; Type = type; }
/// <summary> /// Gets the settings. /// </summary> /// <param name="type">The type.</param> /// <returns>BlackWordTypeSettings.</returns> public static BlackWordTypeSettings GetSettings(BlackWordType type) => Replaces[type];
public BlackWord(string word, BlackWordType type) { Word = word; Type = type; }
public static bool Check(string str, BlackWordType type, GameClient Session, string WhereInfo) { BlackWord word = new BlackWord(); if (!Replaces.ContainsKey(type)) { return(false); } var strParsed = Filter.Replace(Replaces[type].Filter, str); word = Words.FirstOrDefault(wordStruct => wordStruct.Type == type && strParsed.Contains(wordStruct.Word)); #region En caso de ser una palabra prohibida if (!string.IsNullOrEmpty(word.Word)) { if (Session == null || Session.GetHabbo() == null) { return(true); } if (word.TypeSettings.ShowMessage && !Session.GetHabbo().HasFuse("fuse_mod")) { Room room = Session.GetHabbo().CurrentRoom; if (room != null) { RoomUser user = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (user != null) { user.WhisperComposer(LanguageLocale.GetValue("filter.message")); } } } Session.GetHabbo().publicHotelCount++; if (Session.GetHabbo().publicHotelCount >= 4) { return(true); } ServerMessage serverAlert = new ServerMessage(Outgoing.InstantChat); serverAlert.AppendUInt(EmuSettings.CHAT_USER_ID); serverAlert.AppendString(Session.GetHabbo().Username + " foi pego no filtro " + WhereInfo + ":\n" + str); serverAlert.AppendInt32(0); OtanixEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(serverAlert, "fuse_chat_staff", 0); return(true); } #endregion #region ¿Posible Flood? if (Session.GetHabbo().LastMessage == str) { Session.GetHabbo().LastMessageCount++; if (Session.GetHabbo().LastMessageCount >= 3) { ServerMessage serverAlert = new ServerMessage(Outgoing.InstantChat); serverAlert.AppendUInt(EmuSettings.CHAT_USER_ID); serverAlert.AppendString(Session.GetHabbo().Username + " ha escrito " + Session.GetHabbo().LastMessageCount + " veces en " + WhereInfo + ":\n" + str); serverAlert.AppendInt32(0); OtanixEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(serverAlert, "fuse_chat_staff", 0); Session.GetHabbo().LastMessageCount = 0; } return(false); } Session.GetHabbo().LastMessageCount = 0; Session.GetHabbo().LastMessage = str; #endregion return(false); }
public static BlackWordTypeSettings GetSettings(BlackWordType type) { return(Replaces[type]); }
/// <summary> /// Gets the settings. /// </summary> /// <param name="type">The type.</param> /// <returns>BlackWordTypeSettings.</returns> public static BlackWordTypeSettings GetSettings(BlackWordType type) { return Replaces[type]; }