/// <summary> /// Constructs a new SquelchDB for network sending /// </summary> public SquelchDB(List <CharacterPropertiesSquelch> squelches, SquelchMask globals) { Accounts = new Dictionary <string, uint>(); Characters = new Dictionary <uint, SquelchInfo>(); Globals = new SquelchInfo(); foreach (var squelch in squelches) { var squelchPlayer = PlayerManager.FindByGuid(squelch.SquelchCharacterId); if (squelchPlayer == null) { log.Warn($"BuildSquelchDB(): couldn't find character {squelch.SquelchCharacterId:X8}"); continue; } if (squelch.SquelchAccountId == 0) { // chracter squelch var squelchInfo = new SquelchInfo((SquelchMask)squelch.Type, squelchPlayer.Name, false); Characters.Add(squelch.SquelchCharacterId, squelchInfo); } else { // account squelch Accounts.Add(squelchPlayer.Account.AccountName, squelchPlayer.Guid.Full); } } // global squelch if (globals != SquelchMask.None) { Globals.Filters.Add(globals); } }
/// <summary> /// Copy constructor /// </summary> public SquelchInfo(SquelchInfo info) { Filters = info.Filters; PlayerName = info.PlayerName; Account = info.Account; }
public static void Write(this BinaryWriter writer, SquelchInfo info) { writer.Write(info.Filters); writer.WriteString16L(info.PlayerName); writer.Write(Convert.ToUInt32(info.Account)); }
/// <summary> /// Constructs a new empty Squelch database /// </summary> public SquelchDB() { Accounts = new Dictionary <string, uint>(); Characters = new Dictionary <ObjectGuid, SquelchInfo>(); Globals = new SquelchInfo(); }