Пример #1
0
 public RoleplayModule(
     CharacterService charService,
     ExperienceService expService)
 {
     _charService = charService;
     _expService  = expService;
 }
Пример #2
0
        public static async Task ProcessExperienceAsync(ICommandContext context, Guild sguild)
        {
            if (sguild is null)
            {
                return;
            }

            using var Database = new SkuldDbContextFactory().CreateDbContext();

            if (!Database.Features.Any(x => x.Id == sguild.Id))
            {
                Database.Features.Add(new GuildFeatures
                {
                    Id = sguild.Id
                });
                await Database.SaveChangesAsync().ConfigureAwait(false);
            }

            GuildFeatures features = Database.Features.Find(sguild.Id);

            if (features.Experience)
            {
                await ExperienceService.HandleExperienceAsync(context);
            }
        }
Пример #3
0
        internal void Sync()
        {
            var person = Data.Submitter.GetRockPerson();

            if (person == null)
            {
                throw new Exception("Could not find Rock person for Rise Id: " + Data.Submitter.Id);
            }

            RiseClient riseClient = new RiseClient();
            var        course     = riseClient.SyncCourse(Data.Course);


            RockContext       rockContext       = new RockContext();
            ExperienceService experienceService = new ExperienceService(rockContext);

            var experience = new Experience
            {
                PersonAliasId = person.PrimaryAliasId ?? 0,
                VerbValueId   = xAPI.Utilities.VerbHelper.GetOrCreateVerb("http://activitystrea.ms/schema/1.0/author").Id,
                xObject       = new ExperienceObject
                {
                    EntityTypeId = EntityTypeCache.Get(typeof(Course)).Id,
                    ObjectId     = course.Id.ToString()
                },
                Result = new ExperienceResult
                {
                    IsComplete = true,
                    WasSuccess = true
                }
            };

            experienceService.Add(experience);
            rockContext.SaveChanges();
        }
Пример #4
0
 private void Awake()
 {
     _experienceService = ServiceProvider.ProvideExperience();
     _experienceService.OnNextLevelReached += NextLevelReached;
     _alpha       = GetComponent <CanvasGroup>();
     _alpha.alpha = 0;
 }
Пример #5
0
        internal void SaveUserCreated(Person person)
        {
            RockContext       rockContext       = new RockContext();
            ExperienceService experienceService = new ExperienceService(rockContext);

            var verb = xAPI.Utilities.VerbHelper.GetOrCreateVerb("http://activitystrea.ms/schema/1.0/join");

            var experience = new Experience
            {
                PersonAliasId = person.PrimaryAliasId ?? 0,
                VerbValueId   = verb.Id,
                xObject       = new ExperienceObject
                {
                    EntityTypeId = EntityTypeCache.Get(typeof(xAPIComponent)).Id,
                    ObjectId     = EntityTypeCache.Get(typeof(RiseComponent)).Id.ToString()
                },
                Result = new ExperienceResult
                {
                    WasSuccess = true,
                    IsComplete = true
                }
            };

            experienceService.Add(experience);
            rockContext.SaveChanges();

            var context     = experience.AddQualifier("context");
            var experiences = context.AddQualifier("experiences");

            experiences.AddQualifier(
                xAPI.Utilities.ExtensionHelper.GetOrCreateExtension("http://id.tincanapi.com/extension/datetime"),
                RockDateTime.Now.ToString());
        }
Пример #6
0
 public CharacterModule(
     CharacterService charService,
     ExperienceService expService,
     HelpService helpService)
 {
     _charService = charService;
     _expService  = expService;
     _helpService = helpService;
 }
Пример #7
0
        public static async Task HandleSideTasksAsync(ICommandContext context)
        {
            using var Database = new SkuldDbContextFactory().CreateDbContext();

            Guild sguild = null;

            if (context.Guild != null)
            {
                sguild = await
                         Database.InsertOrGetGuildAsync(context.Guild)
                         .ConfigureAwait(false);
            }

            if (sguild != null)
            {
                if (!Database.Features.Any(x => x.Id == sguild.Id))
                {
                    Database.Features.Add(new GuildFeatures
                    {
                        Id = sguild.Id
                    });
                    await Database.SaveChangesAsync().ConfigureAwait(false);
                }

                GuildFeatures features = Database.Features.Find(sguild.Id);
                if (features.Experience)
                {
                    _ = Task.Run(() => ExperienceService.HandleExperienceAsync(context));
                }

                if (!Database.Modules.Any(x => x.Id == sguild.Id))
                {
                    Database.Modules.Add(new GuildModules
                    {
                        Id = sguild.Id
                    });
                    await Database.SaveChangesAsync().ConfigureAwait(false);
                }

                GuildModules modules;
                if (!Database.Modules.Any(x => x.Id == sguild.Id))
                {
                    Database.Modules.Add(new GuildModules
                    {
                        Id = sguild.Id
                    });
                    await Database.SaveChangesAsync().ConfigureAwait(false);
                }

                modules = Database.Modules.Find(sguild.Id);

                if (modules.Custom)
                {
                    _ = Task.Run(() => CustomCommandService.HandleCustomCommandAsync(context, SkuldApp.Configuration));
                }
            }
        }
        private List <CourseData> GetData(Course course)
        {
            var xObj = course.GetExperienceObject();
            var completionValueId = org.secc.xAPI.Utilities.VerbHelper.GetOrCreateVerb("http://activitystrea.ms/schema/1.0/complete").Id;

            RockContext       rockContext       = new RockContext();
            ExperienceService experienceService = new ExperienceService(rockContext);
            var experiences = experienceService.Queryable("PersonAlias.Person,Result")
                              .Where(x => x.xObjectId == xObj.Id && x.VerbValueId == completionValueId)
                              .ToList();

            var data = course.EnrolledGroups
                       .SelectMany(g => g.Members)
                       .Select(gm => gm.Person)
                       .DistinctBy(p => p.Id)
                       .Select(p => new CourseData
            {
                Person   = p,
                Status   = "Incomplete",
                Enrolled = true
            })
                       .ToList();

            foreach (var exp in experiences)
            {
                var courseData = data.Where(d => exp.PersonAlias.PersonId == d.Person.Id).FirstOrDefault();

                if (courseData == null)
                {
                    courseData = new CourseData
                    {
                        Person   = exp.PersonAlias.Person,
                        Status   = "Incomplete",
                        Enrolled = false
                    };
                    data.Add(courseData);
                }

                if (exp.Result != null && exp.Result.IsComplete && exp.Result.WasSuccess)
                {
                    courseData.Status = "Complete";
                    var score = exp.Result.GetQualifier("score");
                    if (score != null)
                    {
                        var percent = score.GetQualifier("percent");
                        if (percent != null)
                        {
                            courseData.Score = percent.Value.AsIntegerOrNull();
                        }
                    }
                }
            }

            return(data.OrderBy(d => d.Person.LastName).ThenBy(d => d.Person.NickName).ToList());
        }
Пример #9
0
 public AdminModule(CharacterService charService,
                    ExperienceService experienceService,
                    SkillsService skillsService,
                    SpecialService specialService,
                    StatisticsService statService,
                    HelpService helpService)
 {
     _charService       = charService;
     _experienceService = experienceService;
     _skillsService     = skillsService;
     _specialService    = specialService;
     _statService       = statService;
     _helpService       = helpService;
 }
Пример #10
0
 public CommandHandler(
     DiscordSocketClient client,
     CommandService commands,
     ExperienceService expService,
     CharacterService charService,
     IServiceProvider services,
     IConfiguration config)
 {
     _client      = client;
     _commands    = commands;
     _expService  = expService;
     _charService = charService;
     _services    = services;
     _config      = config;
 }
Пример #11
0
        public static void UpdateCourseStatus(ExperienceObject xObject, Person person, bool complete, int?quizScorePercent, Dictionary <string, string> contextExtensions)
        {
            RockContext                rockContext                = new RockContext();
            ExperienceService          experienceService          = new ExperienceService(rockContext);
            ExperienceQualifierService experienceQualifierService = new ExperienceQualifierService(rockContext);

            var experience = experienceService.Queryable()
                             .Where(e => e.PersonAlias.PersonId == person.Id &&
                                    e.xObjectId == xObject.Id)
                             .FirstOrDefault();

            if (experience == null)
            {
                experience = new Experience
                {
                    PersonAliasId = person.PrimaryAliasId ?? 0,
                    VerbValueId   = xAPI.Utilities.VerbHelper.GetOrCreateVerb("http://activitystrea.ms/schema/1.0/complete").Id,
                    xObjectId     = xObject.Id,
                    Result        = new ExperienceResult
                    {
                        IsComplete = complete,
                        WasSuccess = complete
                    }
                };
                experienceService.Add(experience);
            }
            else
            {
                experience.Result.IsComplete = complete;
                experience.Result.WasSuccess = complete;
            }
            rockContext.SaveChanges();

            if (quizScorePercent.HasValue)
            {
                var score = experience.Result.AddQualifier("score");
                score.AddQualifier("percent", quizScorePercent.Value.ToString());
            }

            var context    = experience.AddQualifier("context");
            var extensions = context.AddQualifier("extensions");

            foreach (var extension in contextExtensions)
            {
                extensions.AddQualifier(extension.Key, extension.Value);
            }
        }
        public async Task ListAsyncWhenNoExperiencesReturnsEmptyCollection()
        {
            var mockExperienceRepository = GetDefaultIExperienceRepositoryInstance();

            mockExperienceRepository.Setup(r => r.ListAsync())
            .ReturnsAsync(new List <Experience>());
            var mockUnitOfWork = GetDefaultIUnitOfWorkInstance();
            var service        = new ExperienceService(
                mockExperienceRepository.Object,
                mockUnitOfWork.Object);

            // Act
            List <Experience> result = (List <Experience>) await service.ListAsync();

            int experiencesCount = result.Count;

            // Assert
            experiencesCount.Should().Equals(0);
        }
Пример #13
0
        public ActionResult GetAllEpGzjl(string eid)
        {
            //"[{ id: 1, name: \"林三\", sex: \"男\", birthday: \"1989/01/12\", score: 63.3 }]"
            //拿到前台发送来的是当前页面和页的大小
            int pageSize  = Request["pageSize"] == null ? 10 : int.Parse(Request["pageSize"]);
            int pageIndex = Request["page"] == null ? 1 : int.Parse(Request["page"]);
            int total     = 0;

            short delNormal = (short)Model.Enum.DelFlagEnum.Normal;

            #region 分页查询
            int intEid;
            if (eid != "")
            {
                intEid = int.Parse(eid);
            }
            else
            {
                intEid = 0;
            }

            var gzjlList = ExperienceService.LoadPageEntities(pageSize, pageIndex, out total, d => d.DelFlag == delNormal && d.EmployeeID == intEid, d => d.ID,
                                                              true);

            var data = new
            {
                Total = total,
                Rows  = (from u in gzjlList
                         select
                         new { u.ID, u.Code, u.Name
                               , Qssj = u.Qssj.ToString("yyyy-MM-dd")
                               , Jssj = u.Jssj.ToString("yyyy-MM-dd")
                               , u.Khxm, u.Gzdd, u.Gzpd, u.SubBy
                               , SubTime = u.SubTime.ToString("yyyy-MM-dd")
                               , TakeEffectTime = u.TakeEffectTime.ToString("yyyy-MM-dd")
                               , LoseEffectTime = u.LoseEffectTime.ToString("yyyy-MM-dd")
                               , u.Remark }).ToList()
            };

            return(Json(data, JsonRequestBehavior.AllowGet));

            #endregion
        }
Пример #14
0
 public CharacterSkillsModule(
     CharacterService charService,
     EffectsService effectsService,
     ExperienceService expService,
     ProgressionOptions progOptions,
     RoleplayOptions roleplayOptions,
     SkillsService skillsService,
     SpecialService specService,
     StatisticsService statsService,
     HelpService helpService)
 {
     _charService     = charService;
     _effectsService  = effectsService;
     _expService      = expService;
     _progOptions     = progOptions;
     _roleplayOptions = roleplayOptions;
     _skillsService   = skillsService;
     _specService     = specService;
     _statsService    = statsService;
     _helpService     = helpService;
 }
Пример #15
0
        /// <summary>
        /// Gets the expression.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="entityIdProperty">The entity identifier property.</param>
        /// <param name="selection">The selection.</param>
        /// <returns></returns>
        public override Expression GetExpression(RockContext rockContext, MemberExpression entityIdProperty, string selection)
        {
            if (selection.AsIntegerOrNull().HasValue)
            {
                CourseService     courseService     = new CourseService(rockContext);
                ExperienceService experienceService = new ExperienceService(rockContext);

                var course = courseService.Get(selection.AsInteger());

                var xObject     = course.GetExperienceObject(rockContext);
                var experiences = experienceService.Queryable()
                                  .Where(x => x.xObjectId == xObject.Id && x.Result.WasSuccess == true && x.Result.IsComplete == true)
                                  .Select(x => x.PersonAlias);

                var qry = new PersonService(rockContext).Queryable()
                          .Where(p => experiences.Any(xx => xx.PersonId == p.Id));

                var expression = SelectExpressionExtractor.Extract(qry, entityIdProperty, "p");
                return(expression);
            }
            return(null);
        }
        public override Expression GetExpression(Type entityType, IService serviceInstance, ParameterExpression parameterExpression, string selection)
        {
            if (selection.AsIntegerOrNull().HasValue)
            {
                var               rockContext       = ( RockContext )serviceInstance.Context;
                CourseService     courseService     = new CourseService(rockContext);
                ExperienceService experienceService = new ExperienceService(rockContext);

                var course = courseService.Get(selection.AsInteger());

                var xObject     = course.GetExperienceObject(rockContext);
                var experiences = experienceService.Queryable()
                                  .Where(x => x.xObjectId == xObject.Id && x.Result.WasSuccess == true && x.Result.IsComplete == true)
                                  .Select(x => x.PersonAlias);

                var qry = new PersonService(rockContext).Queryable()
                          .Where(p => experiences.Any(xx => xx.PersonId == p.Id));

                var expression = FilterExpressionExtractor.Extract <Person>(qry, parameterExpression, "p");
                return(expression);
            }
            return(null);
        }
Пример #17
0
 public ExperienceController()
 {
     _experienceService = new ExperienceService();
     _ctx = new ApplicationDbContext();
 }
Пример #18
0
        public ActionResult EditSave(Employee employee)
        {
            if (employee.Name == null)
            {
                return(Content("请输入姓名!"));
            }
            if (employee.nl == 0)
            {
                return(Content("请输入年龄!"));
            }
            if (employee.xb == null)
            {
                return(Content("请选择性别!"));
            }

            string strZp   = Request.Form["strZp"].ToString();
            string strSfzt = Request.Form["strSfzt"].ToString();

            HttpFileCollectionBase files    = Request.Files;
            HttpPostedFileBase     FileSfzt = files["sfzt"];
            string FileName = FileSfzt.FileName; //上传的原文件名

            if (FileName != "")                  //换了图片
            {
                string guidSfzt = "";
                if (FileName != null && FileName != "")
                {
                    string FileType = FileName.Substring(FileName.LastIndexOf(".") + 1);                    //得到文件的后缀名
                    guidSfzt = employee.Code + "-SFZ-" + System.Guid.NewGuid().ToString() + "." + FileType; //得到重命名的文件名
                    FileSfzt.SaveAs(Server.MapPath("/Upload/") + guidSfzt);                                 //保存操作
                }
                employee.sfzt = guidSfzt;
            }
            else
            {
                employee.sfzt = strSfzt;
            }


            HttpPostedFileBase FileZp     = files["Zp"];
            string             FileNameZp = FileZp.FileName; //上传的原文件名

            if (FileNameZp != "")                            //换了图片
            {
                string guidZp = "";
                if (FileNameZp != null && FileNameZp != "")
                {
                    string FileType = FileNameZp.Substring(FileNameZp.LastIndexOf(".") + 1);             //得到文件的后缀名
                    guidZp = employee.Code + "-ZP-" + System.Guid.NewGuid().ToString() + "." + FileType; //得到重命名的文件名
                    FileZp.SaveAs(Server.MapPath("/Upload/") + guidZp);                                  //保存操作
                }
                employee.zp = guidZp;
            }
            else
            {
                employee.zp = strZp;
            }

            string jtStr = Request.Form["jtStr"].ToString();
            string gzStr = Request.Form["gzStr"].ToString();
            string pxStr = Request.Form["pxStr"].ToString();

            JavaScriptSerializer js = new JavaScriptSerializer();
            //处理家庭成员
            int           jtCount = FamilyService.GetRecordCoutn(u => u.EmployeeID == employee.ID);
            List <Family> listJt  = js.Deserialize <List <Family> >(jtStr);

            for (int j = 0; j < listJt.Count; j++)
            {
                Family family1 = listJt[j];
                family1.Employee     = employee;
                family1.EmployeeID   = employee.ID;
                family1.ModifiedBy   = LoginUserInfo == null ? 0 : LoginUserInfo.ID;
                family1.ModifiedTIme = DateTime.Now;
                if (family1.Code == null)
                {
                    family1      = initFamily(family1);
                    family1.Code = employee.Code + "-F" + (jtCount + 1).ToString();
                    FamilyService.Add(family1);
                }
                else
                {
                    family1.ModifiedBy   = LoginUserInfo == null ? 0 : LoginUserInfo.ID;
                    family1.ModifiedTIme = DateTime.Now;
                    FamilyService.Update(family1);
                }
            }
            FamilyService.SaveChanges();

            //处理工作经历
            int gzCount = ExperienceService.GetRecordCoutn(u => u.EmployeeID == employee.ID);
            List <Experience> listGz = js.Deserialize <List <Experience> >(gzStr);

            for (int i = 0; i < listGz.Count; i++)
            {
                Experience experience = listGz[i];
                experience.Employee     = employee;
                experience.EmployeeID   = employee.ID;
                experience.ModifiedBy   = LoginUserInfo == null ? 0 : LoginUserInfo.ID;
                experience.ModifiedTIme = DateTime.Now;
                if (experience.Code == null)
                {
                    experience      = initExperience(experience);
                    experience.Code = employee.Code + "-E" + (gzCount + 1).ToString();
                    ExperienceService.Add(experience);
                }
                else
                {
                    experience.ModifiedBy   = LoginUserInfo == null ? 0 : LoginUserInfo.ID;
                    experience.ModifiedTIme = DateTime.Now;
                    ExperienceService.Update(experience);
                }
            }
            //处理培训经历
            int          pxCount = TrainService.GetRecordCoutn(u => u.EmployeeID == employee.ID);
            List <Train> listPx  = js.Deserialize <List <Train> >(pxStr);

            for (int i = 0; i < listPx.Count; i++)
            {
                Train train = listPx[i];
                train.Employee     = employee;
                train.EmployeeID   = employee.ID;
                train.ModifiedBy   = LoginUserInfo == null ? 0 : LoginUserInfo.ID;
                train.ModifiedTIme = DateTime.Now;
                if (train.Code == null)
                {
                    train      = initTrain(train);
                    train.Code = employee.Code + "-T" + (pxCount + 1).ToString();
                    TrainService.Add(train);
                }
                else
                {
                    train.ModifiedBy   = LoginUserInfo == null ? 0 : LoginUserInfo.ID;
                    train.ModifiedTIme = DateTime.Now;
                    TrainService.Update(train);
                }
            }

            employee.ModifiedBy   = LoginUserInfo == null ? 0 : LoginUserInfo.ID;
            employee.ModifiedTIme = DateTime.Now;
            if (EmployeeService.Update(employee))
            {
                TrainService.SaveChanges();
                ExperienceService.SaveChanges();
                FamilyService.SaveChanges();
                EmployeeService.SaveChanges();
                return(Content("ok"));
            }

            return(Content("修改失败了!"));
        }
Пример #19
0
 public FalloutModule(CharacterService charService, ExperienceService expService)
 {
     _charService = charService;
     _expService  = expService;
 }
Пример #20
0
 /// <summary>
 /// Represents contructor of controller.
 /// </summary>
 /// <param name="expirienceService"> Represents instance of ExperienceService.</param>
 public ExperienceController(ExperienceService expirienceService)
 {
     _expirienceService = expirienceService;
 }
Пример #21
0
        /// <summary>Gets the person courses.</summary>
        /// <param name="person">The person.</param>
        /// <param name="categories">The categories.</param>
        /// <returns></returns>
        public static List <CourseResult> GetPersonCourses(Person person, List <CategoryCache> categories, bool enrolledOnly = true)
        {
            if (person == null)
            {
                return(null);
            }

            RockContext           rockContext           = new RockContext();
            CourseService         courseService         = new CourseService(rockContext);
            GroupMemberService    groupMemberService    = new GroupMemberService(rockContext);
            AttributeValueService attributeValueService = new AttributeValueService(rockContext);

            var courseEntityTypeId = EntityTypeCache.Get(typeof(Course)).Id;

            var attributeValueQry = attributeValueService.Queryable().AsNoTracking()
                                    .Where(av => av.Attribute.EntityTypeId == courseEntityTypeId);

            var qry = courseService.Queryable().AsNoTracking();

            if (categories != null && categories.Any())
            {
                var categoryIds = categories.Select(ca => ca.Id).ToList();
                qry = qry.Where(c => c.Categories.Any(ca => categoryIds.Contains(ca.Id)));
            }

            if (enrolledOnly)
            {
                var riseGroupTypeId = Constants.GetRiseGroupTypeId();
                var riseGroups      = groupMemberService.Queryable().AsNoTracking()
                                      .Where(gm => gm.PersonId == person.Id && gm.Group.GroupTypeId == riseGroupTypeId)
                                      .Select(gm => gm.GroupId);

                qry = qry.Where(c => c.AvailableToAll == true || c.EnrolledGroups.Any(g => riseGroups.Contains(g.Id)));
            }

            var mixedResults = qry.GroupJoin(
                attributeValueQry,
                c => c.Id,
                av => av.EntityId,
                (c, av) => new { Course = c, AttributeValues = av })
                               .OrderBy(m => m.Course.Name)
                               .ToList();

            // Get the Experiences
            int[]    personAliasIds = person.Aliases.Select(a => a.Id).ToArray();
            string[] courseIds      = mixedResults.Select(m => m.Course.Id.ToString()).ToArray();

            ExperienceService experienceService = new ExperienceService(rockContext);
            var experiences = experienceService.Queryable("xObject").Where(e => personAliasIds.Contains(e.PersonAliasId) && courseIds.Contains(e.xObject.ObjectId)).ToList();

            var courses = new List <CourseResult>();

            foreach (var result in mixedResults)
            {
                var courseResult = new CourseResult();
                courseResult.Course = result.Course;
                courseResult.Course.AttributeValues = result.AttributeValues.ToDictionary(av => av.AttributeKey, av => new AttributeValueCache(av));
                courseResult.Course.Attributes      = result.AttributeValues.ToDictionary(av => av.AttributeKey, av => AttributeCache.Get(av.AttributeId));
                courseResult.Experiences            = experiences.Where(e => e.xObject != null && e.xObject.ObjectId == result.Course.Id.ToString()).ToList();
                courses.Add(courseResult);
            }

            return(courses);
        }
Пример #22
0
        private void EstateOwner_EstateExperienceDelta(AgentCircuit circuit, EstateOwnerMessage req)
        {
            if (req.ParamList.Count < 3)
            {
                return;
            }

            var  flags        = (EstateExperienceDeltaFlags)int.Parse(req.ParamList[1].FromUTF8Bytes());
            UUID experienceid = UUID.Parse(req.ParamList[2].FromUTF8Bytes());

            SceneInterface scene = circuit.Scene;
            UEI            experienceID;
            bool           isExpfromAgent = false;

            if (scene.ExperienceNameService != null && scene.ExperienceNameService.TryGetValue(experienceid, out experienceID))
            {
            }
            else if (ExperienceService != null && ExperienceService.TryGetValue(experienceid, out experienceID))
            {
                isExpfromAgent = true;
                scene.ExperienceNameService?.Store(experienceID);
            }
            else if (scene.ExperienceService != null && scene.ExperienceService.TryGetValue(experienceid, out experienceID))
            {
            }
            else
            {
                circuit.Agent.SendAlertMessage(this.GetLanguageString(circuit.Agent.CurrentCulture, "ChangingEstateExperienceNotPossibleSinceExperienceNotKnown", "Changing estate experience not possible since experience not known"), scene.ID);
                return;
            }

            EstateInfo estate;
            uint       estateID;
            var        allEstateIds  = new List <uint>();
            var        estateService = circuit.Scene.EstateService;

            if (estateService.RegionMap.TryGetValue(circuit.Scene.ID, out estateID) &&
                estateService.TryGetValue(estateID, out estate))
            {
                if ((flags & EstateExperienceDeltaFlags.AllEstates) != 0)
                {
                    allEstateIds = estateService.EstateOwner[estate.Owner];
                }
                else
                {
                    allEstateIds.Add(estateID);
                }
            }

            if (allEstateIds.Count == 0)
            {
                circuit.Agent.SendAlertMessage(this.GetLanguageString(circuit.Agent.CurrentCulture, "ChangingEstateExperienceNotPossibleSinceNoEstateFound", "Changing estate experience not possible since no estate found"), scene.ID);
                return;
            }

            foreach (var selectedEstateId in allEstateIds)
            {
                if ((flags & EstateExperienceDeltaFlags.AddAllowed) != 0)
                {
                    estateService.Experiences.Store(new EstateExperienceInfo {
                        EstateID = selectedEstateId, ExperienceID = experienceID, IsAllowed = true
                    });
                }
                if ((flags & EstateExperienceDeltaFlags.RemoveAllowed) != 0)
                {
                    estateService.Experiences.Remove(selectedEstateId, experienceID);
                }
                if ((flags & EstateExperienceDeltaFlags.AddBlocked) != 0)
                {
                    estateService.Experiences.Store(new EstateExperienceInfo {
                        EstateID = selectedEstateId, ExperienceID = experienceID, IsAllowed = false
                    });
                }
                if ((flags & EstateExperienceDeltaFlags.RemoveBlocked) != 0)
                {
                    estateService.Experiences.Remove(selectedEstateId, experienceID);
                }
                if ((flags & EstateExperienceDeltaFlags.AddTrusted) != 0)
                {
                    estateService.TrustedExperiences[selectedEstateId, experienceID] = true;
                }
                if ((flags & EstateExperienceDeltaFlags.RemoveTrusted) != 0)
                {
                    estateService.TrustedExperiences.Remove(selectedEstateId, experienceID);
                }
            }

            var m = new EstateOwnerMessage
            {
                TransactionID = req.TransactionID,
                Invoice       = req.Invoice,
                AgentID       = Owner.ID,
                SessionID     = SessionID,
                Method        = "setexperience"
            };

            m.ParamList.Add(StringToBytes(estateID.ToString()));
            m.ParamList.Add(StringToBytes("1"));

            var allowed = new List <UEI>();
            var blocked = new List <UEI>();

            foreach (EstateExperienceInfo info in estateService.Experiences[scene.ParentEstateID])
            {
                if (info.IsAllowed)
                {
                    allowed.Add(info.ExperienceID);
                }
                else
                {
                    blocked.Add(info.ExperienceID);
                }
            }
            List <UEI> trusted = estateService.TrustedExperiences[scene.ParentEstateID];

            m.ParamList.Add(StringToBytes(blocked.Count.ToString()));
            m.ParamList.Add(StringToBytes(trusted.Count.ToString()));
            m.ParamList.Add(StringToBytes(allowed.Count.ToString()));
            foreach (UEI id in blocked)
            {
                m.ParamList.Add(id.ID.GetBytes());
            }
            foreach (UEI id in trusted)
            {
                m.ParamList.Add(id.ID.GetBytes());
            }
            foreach (UEI id in allowed)
            {
                m.ParamList.Add(id.ID.GetBytes());
            }
            SendMessageAlways(m, req.CircuitSceneID);
        }