Пример #1
0
        /// <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);
            }
        }
Пример #2
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 public SquelchInfo(SquelchInfo info)
 {
     Filters    = info.Filters;
     PlayerName = info.PlayerName;
     Account    = info.Account;
 }
Пример #3
0
 public static void Write(this BinaryWriter writer, SquelchInfo info)
 {
     writer.Write(info.Filters);
     writer.WriteString16L(info.PlayerName);
     writer.Write(Convert.ToUInt32(info.Account));
 }
Пример #4
0
 /// <summary>
 /// Constructs a new empty Squelch database
 /// </summary>
 public SquelchDB()
 {
     Accounts   = new Dictionary <string, uint>();
     Characters = new Dictionary <ObjectGuid, SquelchInfo>();
     Globals    = new SquelchInfo();
 }