Ejemplo n.º 1
0
 public AreaInstance(AreaTemplate area, int hash, int realLevel)
 {
     Hash         = hash;
     RealLevel    = realLevel;
     NominalLevel = area.NominalLevel;
     Name         = area.Name;
     Act          = area.Act;
     IsTown       = area.IsTown;
     HasWaypoint  = area.HasWaypoint;
 }
Ejemplo n.º 2
0
 public AreaInstance(AreaTemplate area, int hash, int realLevel)
 {
     this.Hash         = hash;
     this.RealLevel    = realLevel;
     this.NominalLevel = area.NominalLevel;
     this.Name         = area.Name;
     this.Act          = area.Act;
     this.IsTown       = area.IsTown;
     this.HasWaypoint  = area.HasWaypoint;
 }
Ejemplo n.º 3
0
 public AreaInstance(AreaTemplate area, uint hash, int realLevel)
 {
     Area        = area;
     Hash        = hash;
     RealLevel   = realLevel;
     Name        = area.Name;
     Act         = area.Act;
     IsTown      = area.IsTown;
     IsHideout   = Name.Contains("Hideout") && !Name.Contains("Syndicate Hideout");
     HasWaypoint = area.HasWaypoint || IsHideout;
 }
Ejemplo n.º 4
0
 public AreaInstance(AreaTemplate area, uint hash, int realLevel)
 {
     Area        = area;
     Hash        = hash;
     RealLevel   = realLevel;
     Name        = area.Name;
     Act         = area.Act;
     IsTown      = area.IsTown;
     HasWaypoint = area.HasWaypoint;
     IsHideout   = area.RawName.ToLower().Contains("hideout");
 }
Ejemplo n.º 5
0
 public AreaInstance(AreaTemplate area, int hash, int realLevel)
 {
     Hash         = hash;
     RealLevel    = realLevel;
     NominalLevel = area.NominalLevel;
     Name         = area.Name;
     Act          = area.Act;
     IsTown       = area.IsTown;
     IsHideout    = Name.Contains("Hideout");
     HasWaypoint  = area.HasWaypoint;
 }
        internal void RegisterController()
        {
            var features = _extensionManager.LoadFeaturesAsync().Result;

            foreach (var feature in features)
            {
                _mvcControllerBuilderFactory.ForAll <IAppService>(AreaTemplate.GetAreaKey(new AreaOption()
                {
                    AreaName     = feature.FeatureInfo.Id,
                    FunctionType = "api"
                }), feature.ExportedTypes.Where(IsController)).Build();
            }
        }
Ejemplo n.º 7
0
        public void RefreshState()
        {
            var          igsd        = this.Root.Game.IngameState.Data;
            AreaTemplate clientsArea = igsd.CurrentArea;
            int          curAreaHash = igsd.CurrentAreaHash;

            if (CurrentArea != null && curAreaHash == CurrentArea.Hash)
            {
                return;
            }

            CurrentArea = new AreaInstance(clientsArea, curAreaHash, igsd.CurrentAreaLevel);
            this.OnAreaChange(this);
        }
Ejemplo n.º 8
0
        public void RefreshState()
        {
            GController.Cache.UpdateCache();
            var          ingameData  = GController.Game.IngameState.Data;
            AreaTemplate clientsArea = ingameData.CurrentArea;
            var          curAreaHash = ingameData.CurrentAreaHash;

            if (CurrentArea != null && curAreaHash == CurrentArea.Hash)
            {
                return;
            }

            CurrentArea = new AreaInstance(clientsArea, curAreaHash, ingameData.CurrentAreaLevel);
            OnAreaChange?.Invoke(this);
        }
Ejemplo n.º 9
0
        private void poe_OnUpdate()
        {
            var          igsd        = this.Poe.Internal.game.IngameState.Data;
            AreaTemplate clientsArea = igsd.CurrentArea;
            int          curAreaHash = igsd.CurrentAreaHash;

            if (CurrentArea != null && curAreaHash == CurrentArea.Hash)
            {
                return;
            }

            // try to find the new area in our dictionary
            AreaInstance             //area;
            //if (!AreasVisited.TryGetValue(curAreaHash, out area)) {
                area = new AreaInstance(clientsArea, curAreaHash, igsd.CurrentAreaLevel);

            // }

            CurrentArea = area;

            this.OnAreaChange(this);
        }
Ejemplo n.º 10
0
        public IList <RouteDescriptor> GetRoutes()
        {
            var runningShells = _shellHost.ListShellContextsAsync().Result
                                .Where(sc => sc.Settings.State == TenantState.Running);

            var activeFeatures = runningShells.SelectMany(r => r.Blueprint.Descriptor.Features);


            return(activeFeatures.Select(f =>
            {
                var areaName = AreaTemplate.GetAreaKey(new AreaOption()
                {
                    AreaName = f.Id, FunctionType = "Views"
                });
                return new RouteDescriptor
                {
                    Name = areaName + "Route",
                    AreaName = areaName,
                    Priority = -10,
                    RouteTemplate = areaName + "/{controller}/{action}/{id?}",
                    Defaults = new { area = areaName, controller = "home", action = "index" }
                };
            }).ToList());
        }
Ejemplo n.º 11
0
        private static void AddAreaData(AutomaticaContext context)
        {
            var areaTypes = Enum.GetValues(typeof(AreaTypes));

            foreach (var areaType in areaTypes)
            {
                var type       = areaType.GetType();
                var memInfo    = type.GetMember(areaType.ToString());
                var attributes = memInfo[0].GetCustomAttributes(typeof(AreaTypeAttribute), false);

                if (attributes.Length == 0)
                {
                    continue;
                }

                if (attributes[0] is AreaTypeAttribute attribute)
                {
                    var areaTypeDb = context.AreaTypes.SingleOrDefault(a => a.ObjId == attribute.ObjId);
                    var isNew      = false;
                    if (areaTypeDb == null)
                    {
                        areaTypeDb       = new AreaType();
                        areaTypeDb.ObjId = attribute.ObjId;

                        isNew = true;
                    }

                    areaTypeDb.Name        = attribute.Name;
                    areaTypeDb.Description = attribute.Description;

                    if (isNew)
                    {
                        context.AreaTypes.Add(areaTypeDb);
                    }
                    else
                    {
                        context.AreaTypes.Update(areaTypeDb);
                    }
                }
            }

            context.SaveChanges();

            var areaTemplates = Enum.GetValues(typeof(AreaTemplates));

            foreach (var areaTemplate in areaTemplates)
            {
                var type       = areaTemplate.GetType();
                var memInfo    = type.GetMember(areaTemplate.ToString());
                var attributes = memInfo[0].GetCustomAttributes(typeof(AreaTemplateAttribute), false);

                if (attributes.Length == 0)
                {
                    continue;
                }

                if (attributes[0] is AreaTemplateAttribute attribute)
                {
                    var areaTemplateDb = context.AreaTemplates.SingleOrDefault(a => a.ObjId == attribute.ObjId);
                    var isNew          = false;
                    if (areaTemplateDb == null)
                    {
                        areaTemplateDb       = new AreaTemplate();
                        areaTemplateDb.ObjId = attribute.ObjId;

                        isNew = true;
                    }

                    areaTemplateDb.Name                   = attribute.Name;
                    areaTemplateDb.Description            = attribute.Description;
                    areaTemplateDb.This2AreaType          = AreaTypeAttribute.GetFromEnum(attribute.IsAreaType);
                    areaTemplateDb.NeedsThis2AreaType     = AreaTypeAttribute.GetFromEnum(attribute.NeedsAreaType);
                    areaTemplateDb.ProvidesThis2AreayType = AreaTypeAttribute.GetFromEnum(attribute.ProvidesAreayType);
                    areaTemplateDb.Icon                   = attribute.Icon;
                    areaTemplateDb.IsDeleteable           = attribute.IsDeletable;

                    if (isNew)
                    {
                        context.AreaTemplates.Add(areaTemplateDb);
                    }
                    else
                    {
                        context.AreaTemplates.Update(areaTemplateDb);
                    }

                    context.SaveChanges();
                }
            }
        }