Пример #1
0
        public void AddBlockedUser(string name)
        {
            var blocked = WorldManager.Instance.GetCharacter(name);

            if (blocked == null || BlockedList.ContainsKey(blocked.Id))
            {
                return;                                                         // already blocked
            }
            var template = new BlockedTemplate()
            {
                BlockedId = blocked.Id,
                Owner     = Owner.Id
            };

            BlockedList.Add(blocked.Id, template);
            Owner.SendPacket(new SCAddBlockedUserPacket(blocked.Id, blocked.Name, true, 0));
        }
Пример #2
0
 public void Load(MySqlConnection connection)
 {
     using (var command = connection.CreateCommand())
     {
         command.CommandText = "SELECT * FROM blocked WHERE `owner` = @owner";
         command.Parameters.AddWithValue("@owner", Owner.Id);
         command.Prepare();
         using (var reader = command.ExecuteReader())
         {
             while (reader.Read())
             {
                 var template = new BlockedTemplate()
                 {
                     Owner     = reader.GetUInt32("owner"),
                     BlockedId = reader.GetUInt32("blocked_id")
                 };
                 BlockedList.Add(template.BlockedId, template);
             }
         }
     }
 }