Exemplo n.º 1
0
        public static EntityTypeCollection GetCollection(EntityEnum entityName)
        {
            EntityTypeCollection tempList = null;

            using (SqlConnection myConnection = new SqlConnection(AppConfiguration.ConnectionString))
            {
                using (SqlCommand myCommand = new SqlCommand("usp_GetEntityType", myConnection))
                {
                    myCommand.CommandType = CommandType.StoredProcedure;

                    myCommand.Parameters.AddWithValue("@QueryId", SelectTypeEnum.GetCollectionByName);
                    myCommand.Parameters.AddWithValue("@EntityName", entityName.ToString());

                    myConnection.Open();
                    using (SqlDataReader myReader = myCommand.ExecuteReader())
                    {
                        if (myReader.HasRows)
                        {
                            tempList = new EntityTypeCollection();
                            while (myReader.Read())
                            {
                                tempList.Add(FillDataRecord(myReader));
                            }
                        }
                        myReader.Close();
                    }
                }
            }
            return(tempList);
        }
Exemplo n.º 2
0
        protected void OutputForExperience(EntityTypeCollection entityTypeCollection, EntityTypeAttributes entityTypeAttributes, StatsSheetSettings.UnitSetting unitSetting = null)
        {
            UnitAttributes unitAttributes = entityTypeAttributes.Get <UnitAttributes>();

            if (unitAttributes == null)
            {
                return;
            }

            using (BeginScope(entityTypeAttributes.Name))
            {
                // Unit Attributes
                Print($"readableName: {unitSetting.readableName}");
                Print($"cu: {unitAttributes.Resource1Cost}");
                Print($"ru: {unitAttributes.Resource2Cost}");
                Print($"time: {unitAttributes.ProductionTime}");
                Print($"pop: {unitAttributes.PopCapCost}");
                Print($"hp: {unitAttributes.MaxHealth}");
                Print($"armor: {unitAttributes.Armour}");
                Print($"sensor: {unitAttributes.SensorRadius}");
                Print($"contact: {unitAttributes.ContactRadius}");
                Print($"xp: {unitAttributes.ExperienceValue}");

                // Experience Attributes
                ExperienceAttributes experience = entityTypeAttributes.Get <ExperienceAttributes>();
                if (experience != null)
                {
                    OutputForExperienceAttributes(experience);
                }
            }
        }
Exemplo n.º 3
0
        protected void OutputForMovement(EntityTypeCollection entityTypeCollection, EntityTypeAttributes entityTypeAttributes, StatsSheetSettings.UnitSetting unitSetting = null)
        {
            UnitAttributes unitAttributes = entityTypeAttributes.Get <UnitAttributes>();

            if (unitAttributes == null)
            {
                return;
            }

            UnitMovementAttributes movement = entityTypeAttributes.Get <UnitMovementAttributes>();

            if (movement == null)
            {
                return;
            }

            using (BeginScope(entityTypeAttributes.Name))
            {
                // Unit Attributes
                Print($"readableName: {unitSetting.readableName}");
                Print($"cu: {unitAttributes.Resource1Cost}");
                Print($"ru: {unitAttributes.Resource2Cost}");
                Print($"time: {unitAttributes.ProductionTime}");
                Print($"pop: {unitAttributes.PopCapCost}");
                Print($"hp: {unitAttributes.MaxHealth}");
                Print($"armor: {unitAttributes.Armour}");
                Print($"sensor: {unitAttributes.SensorRadius}");

                OutputForMovementAttributes(movement, true);
            }
        }
Exemplo n.º 4
0
        public void LoadAttributes(EntityTypeCollection entityTypeCollection, string customFile = "")
        {
            AttributesPatch attributesPatch = GetPatchObject(GetPatchData(customFile));

            if (attributesPatch != null)
            {
                statsSheetSettings = attributesPatch.StatsSheetSettings;

                ApplyAttributesPatch(entityTypeCollection, attributesPatch);

                if (statsSheetSettings.Generate)
                {
                    Console.WriteLine("[SUBSYSTEM] Generating stats sheet...");
                    new StatsSheetGenerator(statsSheetSettings).Generate(entityTypeCollection);
                    Console.WriteLine("[SUBSYSTEM] Stats sheet generated!");
                }
            }
            else
            {
                writer.WriteLine("Patch file empty, not found or json parse failed. See output_log.txt for details");
            }

            string logName;

            if (customFile.Length > 0)
            {
                logName = MakeValidFileName($"Subsystem_{customFile}.log");
            }
            else
            {
                logName = "Subsystem.log";
            }

            File.WriteAllText(Path.Combine(DataFolderPath(), logName), writer.ToString());
        }
Exemplo n.º 5
0
        protected void OutputForDPS(EntityTypeCollection entityTypeCollection, EntityTypeAttributes entityTypeAttributes, StatsSheetSettings.UnitSetting unitSetting = null)
        {
            UnitAttributes unitAttributes = entityTypeAttributes.Get <UnitAttributes>();

            if (unitAttributes == null)
            {
                return;
            }

            if (unitAttributes.WeaponLoadout.Length == 0 || !(unitSetting.weapons == null || unitSetting.weapons.Length > 0))
            {
                return;
            }

            using (BeginScope(entityTypeAttributes.Name))
            {
                // Unit Attributes
                Print($"readableName: {unitSetting.readableName}");
                Print($"cu: {unitAttributes.Resource1Cost}");
                Print($"ru: {unitAttributes.Resource2Cost}");
                Print($"time: {unitAttributes.ProductionTime}");
                Print($"pop: {unitAttributes.PopCapCost}");
                Print($"hp: {unitAttributes.MaxHealth}");
                Print($"armor: {unitAttributes.Armour}");
                Print($"sensor: {unitAttributes.SensorRadius}");

                // Weapons
                OutputForWeapons(entityTypeCollection, entityTypeAttributes, unitSetting.weapons, true);
            }
        }
Exemplo n.º 6
0
        public static EntityTypeCollection GetCollection(EntityEnum entityName)
        {
            EntityTypeCollection tempList = null;
           
            using (SqlConnection myConnection = new SqlConnection(AppConfiguration.ConnectionString))
            {
                using (SqlCommand myCommand = new SqlCommand("usp_GetEntityType", myConnection))
                {
                    myCommand.CommandType = CommandType.StoredProcedure;
                    myCommand.Parameters.AddWithValue("@QueryId", SelectTypeEnum.GetCollectionByName);
                    myCommand.Parameters.AddWithValue("@EntityName", entityName.ToString());
                    myConnection.Open();
                    using (SqlDataReader myReader = myCommand.ExecuteReader())
                    {
                        if (myReader.HasRows)
                        {
                            tempList = new EntityTypeCollection();
                            while (myReader.Read())
                            {
                                tempList.Add(FillDataRecord(myReader));
                            }

                        }
                        myReader.Close();
                    }
                }
            }

            return tempList;
        }
        private EntityTypeDTOCollection HydrateEntityTypeDTO(EntityTypeCollection entityTypeCollection)
        {
            EntityTypeDTOCollection tempCollection = new EntityTypeDTOCollection();

            if (entityTypeCollection != null && entityTypeCollection.Count > 0)
            {
                foreach (EntityType item in entityTypeCollection)
                {
                    if (!string.IsNullOrEmpty(item.EntityTypeName))
                    {
                        EntityTypeDTO temp = new EntityTypeDTO()
                        {
                            EntityTypeId   = item.EntityTypeId,
                            EntityTypeName = item.EntityTypeName
                        };
                        if (!string.IsNullOrEmpty(item.DisplayName))
                        {
                            temp.DisplayName = item.EntityTypeName;
                        }

                        tempCollection.Add(temp);
                    }
                    else
                    {
                        tempCollection.Add(new EntityTypeDTO {
                            EntityTypeId = item.EntityTypeId
                        });
                    }
                }
            }
            return(tempCollection);
        }
Exemplo n.º 8
0
        private void BindEntityTypeList()
        {
            EntityTypeCollection entityTypeList = new EntityTypeCollection();

            entityTypeList = EntityTypeDAL.GetCollection();
            rptEntityTypeList.DataSource = entityTypeList;
            rptEntityTypeList.DataBind();
        }
Exemplo n.º 9
0
 private void Reset(Project project)
 {
     _entityTypes = _result.EntityTypes;
     _enumTypes   = _result.EnumTypes;
     _entityTypes.Clear();
     _enumTypes.Clear();
     _unknownProperties.Clear();
 }
Exemplo n.º 10
0
        private void BindEntityTypeList()
        {
            EntityTypeCollection entityTypeList = new EntityTypeCollection();

            entityTypeList = EntityTypeManager.GetCollection(EntityEnum.EmployeeType);

            rptEntityTypeList.DataSource = entityTypeList;
            rptEntityTypeList.DataBind();
        }
Exemplo n.º 11
0
        private void BindEmailType()
        {
            EntityTypeCollection items = EntityTypeManager.GetCollection(EntityEnum.EmailType);

            drpEmailType.DataSource = items;
            drpEmailType.DataBind();

            drpEmailType.Items.Insert(0, new ListItem {
                Text = "Select Email Type", Value = "0"
            });
        }
Exemplo n.º 12
0
        private void BindEmployeeType()
        {
            EntityTypeCollection employeeTypeList = EntityTypeManager.GetCollection(EntityEnum.EmployeeType);

            drpEmployeeType.DataSource = employeeTypeList;
            drpEmployeeType.DataBind();

            drpEmployeeType.Items.Insert(0, new ListItem {
                Text = "(Select Emplyee Type)"
            });
        }
Exemplo n.º 13
0
        protected void OutputForUpgradeResearch(EntityTypeCollection entityTypeCollection, EntityTypeAttributes entityTypeAttributes)
        {
            TechTreeAttributes techTreeAttributes = entityTypeAttributes.Get <TechTreeAttributes>();

            for (int i = 0; i < techTreeAttributes.TechTrees.Length; ++i)
            {
                TechTree techTree = techTreeAttributes.TechTrees[i];
                for (int j = 0; j < techTree.Upgrades.Length; ++j)
                {
                    TechUpgrade            upgrade = techTree.Upgrades[j];
                    EntityTypeAttributes   researchItemEntityTypeAttributes = entityTypeCollection.GetEntityType(upgrade.ResearchItem);
                    ResearchItemAttributes researchItemAttributes           = researchItemEntityTypeAttributes.Get <ResearchItemAttributes>();
                    OutputForResearchItem(researchItemAttributes);
                }
            }
        }
Exemplo n.º 14
0
        public void LoadAttributes(EntityTypeCollection entityTypeCollection)
        {
            try
            {
                var jsonPath = Path.Combine(Application.dataPath, "patch.json");
                var json     = File.ReadAllText(jsonPath);

                var attributesPatch = JsonMapper.ToObject <AttributesPatch>(json);

                ApplyAttributesPatch(entityTypeCollection, attributesPatch);
            }
            catch (Exception e)
            {
                Debug.LogWarning($"[SUBSYSTEM] Error applying patch file: {e}");
            }
        }
Exemplo n.º 15
0
        private EntityTypeDTOCollection HydrateEntityTypeDTO(EntityTypeCollection entityTypeCollection)
        {
            EntityTypeDTOCollection tempCollection = new EntityTypeDTOCollection();

            if (entityTypeCollection != null && entityTypeCollection.Count > 0)
            {
                foreach (EntityType item in entityTypeCollection)
                {
                    if (!string.IsNullOrEmpty(item.EntityTypeValue))
                        tempCollection.Add(new EntityTypeDTO { EntityTypeId = item.EntityTypeId, EntityTypeValue = item.EntityTypeValue });
                    else
                        tempCollection.Add(new EntityTypeDTO { EntityTypeId = item.EntityTypeId });
                }
            }

            return tempCollection;
        }
Exemplo n.º 16
0
        protected void OutputForGeneral(EntityTypeCollection entityTypeCollection, EntityTypeAttributes entityTypeAttributes, StatsSheetSettings.UnitSetting unitSetting = null)
        {
            UnitAttributes unitAttributes = entityTypeAttributes.Get <UnitAttributes>();

            if (unitAttributes == null)
            {
                return;
            }

            using (BeginScope(entityTypeAttributes.Name))
            {
                // Unit Attributes
                Print($"readableName: {unitSetting.readableName}");
                Print($"cu: {unitAttributes.Resource1Cost}");
                Print($"ru: {unitAttributes.Resource2Cost}");
                Print($"time: {unitAttributes.ProductionTime}");
                Print($"pop: {unitAttributes.PopCapCost}");
                Print($"hp: {unitAttributes.MaxHealth}");
                Print($"armor: {unitAttributes.Armour}");
                Print($"sensor: {unitAttributes.SensorRadius}");
                Print($"contact: {unitAttributes.ContactRadius}");
                Print($"xp: {unitAttributes.ExperienceValue}");
                Print($"priorityAsTarget: {unitAttributes.PriorityAsTarget}");

                // Movement Attributes
                UnitMovementAttributes movement = entityTypeAttributes.Get <UnitMovementAttributes>();
                if (movement != null)
                {
                    OutputForMovementAttributes(movement);
                }

                // Harvester Attributes
                HarvesterAttributes harvester = entityTypeAttributes.Get <HarvesterAttributes>();
                if (harvester != null)
                {
                    OutputForHarvesterAttributes(harvester);
                }

                // Weapons
                if (unitAttributes.WeaponLoadout.Length > 0 && (unitSetting.weapons == null || unitSetting.weapons.Length > 0))
                {
                    OutputForWeapons(entityTypeCollection, entityTypeAttributes, unitSetting.weapons);
                }
            }
        }
Exemplo n.º 17
0
        protected void OutputForTierResearch(EntityTypeCollection entityTypeCollection, EntityTypeAttributes entityTypeAttributes)
        {
            TechTreeAttributes techTreeAttributes = entityTypeAttributes.Get <TechTreeAttributes>();

            for (int i = 0; i < techTreeAttributes.TechTrees.Length; ++i)
            {
                TechTree techTree = techTreeAttributes.TechTrees[i];
                for (int j = 0; j < techTree.Tiers.Length; ++j)
                {
                    TechTreeTier tier = techTree.Tiers[j];
                    for (int k = 0; k < tier.ResearchItems.Length; ++k)
                    {
                        EntityTypeAttributes   researchItemEntityTypeAttributes = entityTypeCollection.GetEntityType(tier.ResearchItems[k]);
                        ResearchItemAttributes researchItemAttributes           = researchItemEntityTypeAttributes.Get <ResearchItemAttributes>();
                        OutputForResearchItem(researchItemAttributes);
                    }
                }
            }
        }
Exemplo n.º 18
0
        private BunqEntity[] GetEntities(JArray response)
        {
            var entities = new List <BunqEntity>();

            foreach (var element in response.Cast <JObject>())
            {
                var property      = (JProperty)element.First;
                var propertyValue = (JObject)property.Value;

                var type = EntityTypeCollection.FindByName(property.Name);

                var entity = (BunqEntity)propertyValue.ToObject(type);
                entity.ApiClient = this;

                entities.Add(entity);
            }

            return(entities.ToArray());
        }
Exemplo n.º 19
0
        private void BindEmailType()
        {
            EntityTypeCollection items = EntityTypeManager.GetCollection(EntityEnum.Email);

            //ListItemCollection drpItems = new ListItemCollection();

            //ListItem option01 = new ListItem { Text = "List Item 01", Value = "1" };
            //ListItem option02 = new ListItem { Text = "List Item 02", Value = "2" };
            //ListItem option03 = new ListItem { Text = "List Item 03", Value = "3" };

            //drpItems.Add(option01);
            //drpItems.Add(option02);
            //drpItems.Add(option03);

            drpEmailType.DataSource = items;
            drpEmailType.DataBind();

            drpEmailType.Items.Insert(0, new ListItem {
                Text = "(Select Email Type)", Value = "0"
            });
        }
Exemplo n.º 20
0
        public void ApplyAttributesPatch(EntityTypeCollection entityTypeCollection, AttributesPatch attributesPatch)
        {
            foreach (var kvp in attributesPatch.Entities)
            {
                var entityTypeName  = kvp.Key;
                var entityTypePatch = kvp.Value;

                var entityType = entityTypeCollection.GetEntityType(entityTypeName);

                using (logger.BeginScope($"EntityType: {entityTypeName}"))
                {
                    if (entityType == null)
                    {
                        logger.Log($"NOTICE: EntityType not found");
                        continue;
                    }

                    applyUnnamedComponentPatch <ExperienceAttributesPatch, ExperienceAttributes, ExperienceAttributesWrapper>(entityType, entityTypePatch.ExperienceAttributes, x => new ExperienceAttributesWrapper(x), ApplyExperienceAttributesPatch);
                    applyUnnamedComponentPatch <UnitAttributesPatch, UnitAttributes, UnitAttributesWrapper>(entityType, entityTypePatch.UnitAttributes, x => new UnitAttributesWrapper(x), ApplyUnitAttributesPatch);
                    applyUnnamedComponentPatch <ResearchItemAttributesPatch, ResearchItemAttributes, ResearchItemAttributesWrapper>(entityType, entityTypePatch.ResearchItemAttributes, x => new ResearchItemAttributesWrapper(x), ApplyResearchItemAttributesPatch);
                    applyUnnamedComponentPatch <UnitHangarAttributesPatch, UnitHangarAttributes, UnitHangarAttributesWrapper>(entityType, entityTypePatch.UnitHangarAttributes, x => new UnitHangarAttributesWrapper(x), ApplyUnitHangarAttributesPatch);
                    applyUnnamedComponentPatch <DetectableAttributesPatch, DetectableAttributes, DetectableAttributesWrapper>(entityType, entityTypePatch.DetectableAttributes, x => new DetectableAttributesWrapper(x), ApplyDetectableAttributesPatch);
                    applyUnnamedComponentPatch <UnitMovementAttributesPatch, UnitMovementAttributes, UnitMovementAttributesWrapper>(entityType, entityTypePatch.UnitMovementAttributes, x => new UnitMovementAttributesWrapper(x), ApplyUnitMovementAttributesPatch);

                    applyNamedComponentPatch <AbilityAttributesPatch, AbilityAttributes, AbilityAttributesWrapper>(entityType, entityTypePatch.AbilityAttributes, x => new AbilityAttributesWrapper(x), ApplyAbilityAttributesPatch);
                    applyNamedComponentPatch <StorageAttributesPatch, StorageAttributes, StorageAttributesWrapper>(entityType, entityTypePatch.StorageAttributes, x => new StorageAttributesWrapper(x), ApplyStorageAttributesPatch);
                    applyNamedComponentPatch <WeaponAttributesPatch, WeaponAttributes, WeaponAttributesWrapper>(entityType, entityTypePatch.WeaponAttributes, x => new WeaponAttributesWrapper(x), (patch, wrapper) =>
                    {
                        ApplyWeaponAttributesPatch(patch, wrapper);
                        rebindWeaponAttributes(entityType, wrapper);
                    });
                }
            }

            File.WriteAllText(Path.Combine(Application.dataPath, "Subsystem.log"), writer.ToString());
            Debug.Log($"[SUBSYSTEM] Applied attributes patch. See Subsystem.log for details.");
        }
Exemplo n.º 21
0
        public void ApplyAttributesPatch(EntityTypeCollection entityTypeCollection, AttributesPatch attributesPatch)
        {
            logger.Log("[ APPLYING ENTITY TYPE ATTRIBUTES ]");

            foreach (var kvp in attributesPatch.Entities)
            {
                string          entityTypeName  = kvp.Key;
                EntityTypePatch entityTypePatch = kvp.Value;

                EntityTypeAttributes entityType;
                if (!entityTypePatch.CloneFrom.IsNullOrEmpty())
                {
                    EntityTypeAttributes toClone = entityTypeCollection.GetEntityType(entityTypePatch.CloneFrom);
                    if (toClone == null)
                    {
                        logger.Log($"ERROR: CloneFrom {entityTypePatch.CloneFrom} attributes not found");
                        continue;
                    }

                    entityType = new EntityTypeAttributes(entityTypeName)
                    {
                        Flags = toClone.Flags
                    };

                    var attributes = toClone.GetAll <object>();
                    foreach (var w in attributes)
                    {
                        entityType.Add(w);
                    }

                    entityTypeCollection.Add(entityType);

                    logger.BeginScope($"Cloned {entityTypeName} from {entityTypePatch.CloneFrom}").Dispose();
                }
                else
                {
                    entityType = entityTypeCollection.GetEntityType(entityTypeName);
                }

                using (logger.BeginScope($"EntityType: {entityTypeName}"))
                {
                    if (entityType == null)
                    {
                        if (entityTypePatch.CloneFrom.IsNullOrEmpty())
                        {
                            logger.Log("NOTICE: EntityType not found");
                        }
                        else
                        {
                            logger.Log("ERROR: Entity cloning failed");
                        }
                        continue;
                    }

                    ApplyEntityTypePatch(entityType, entityTypePatch);
                }
            }

            if (attributesPatch.Global != null)
            {
                logger.Log("[ APPLYING GLOBAL TYPE ATTRIBUTES ]");
                //logger.enable = false;
                notFoundErrors = false;
                foreach (var kvp in entityTypeCollection.GetAllEntityTypeNames())
                {
                    using (logger.BeginScope($"{kvp}:"))
                    {
                        ApplyEntityTypePatch(entityTypeCollection.GetEntityType(kvp), attributesPatch.Global);
                    }
                }
                //logger.enable = true;
                notFoundErrors = true;
            }

            Debug.Log($"[SUBSYSTEM] Applied attributes patch. See Subsystem.log for details.");
        }
Exemplo n.º 22
0
 private void Reset(Project project)
 {
     _entityTypes = _result.EntityTypes;
     _enumTypes = _result.EnumTypes;
     _entityTypes.Clear();
     _enumTypes.Clear();
     _unknownProperties.Clear();
 }
Exemplo n.º 23
0
        public void Generate(EntityTypeCollection entityTypeCollection)
        {
            System.Text.StringBuilder sb = writer.GetStringBuilder();

            indent = 0;

            // Tech / Research
            using (BeginScope("techTrees"))
            {
                foreach (var treeName in settings.TechTrees)
                {
                    using (BeginScope(treeName))
                    {
                        EntityTypeAttributes entityTypeAttributes = entityTypeCollection.GetEntityType(treeName);
                        if (entityTypeAttributes != null)
                        {
                            OutputForTechTree(entityTypeAttributes);
                        }
                    }
                }
            }
            using (BeginScope("tierResearch"))
            {
                foreach (var treeName in settings.TechTrees)
                {
                    using (BeginScope(treeName))
                    {
                        EntityTypeAttributes entityTypeAttributes = entityTypeCollection.GetEntityType(treeName);
                        if (entityTypeAttributes != null)
                        {
                            OutputForTierResearch(entityTypeCollection, entityTypeAttributes);
                        }
                    }
                }
            }
            using (BeginScope("upgradeResearch"))
            {
                foreach (var treeName in settings.TechTrees)
                {
                    using (BeginScope(treeName))
                    {
                        EntityTypeAttributes entityTypeAttributes = entityTypeCollection.GetEntityType(treeName);
                        if (entityTypeAttributes != null)
                        {
                            OutputForUpgradeResearch(entityTypeCollection, entityTypeAttributes);
                        }
                    }
                }
            }
            File.WriteAllText(Path.Combine(Application.dataPath, settings.FilenameResearch), writer.ToString());
            sb.Remove(0, sb.Length);

            // General
            foreach (var kvp in settings.UnitList)
            {
                EntityTypeAttributes entityTypeAttributes = entityTypeCollection.GetEntityType(kvp.Key);
                if (entityTypeAttributes != null)
                {
                    OutputForGeneral(entityTypeCollection, entityTypeAttributes, kvp.Value);
                }
            }
            File.WriteAllText(Path.Combine(Application.dataPath, settings.FilenameGeneral), writer.ToString());
            sb.Remove(0, sb.Length);

            // Carrier
            foreach (var kvp in settings.CarrierList)
            {
                EntityTypeAttributes entityTypeAttributes = entityTypeCollection.GetEntityType(kvp.Key);
                if (entityTypeAttributes != null)
                {
                    OutputForCarrier(entityTypeCollection, entityTypeAttributes, kvp.Value);
                }
            }
            File.WriteAllText(Path.Combine(Application.dataPath, settings.FilenameCarrier), writer.ToString());
            sb.Remove(0, sb.Length);

            // Experience
            foreach (var kvp in settings.UnitList)
            {
                EntityTypeAttributes entityTypeAttributes = entityTypeCollection.GetEntityType(kvp.Key);
                if (entityTypeAttributes != null)
                {
                    OutputForExperience(entityTypeCollection, entityTypeAttributes, kvp.Value);
                }
            }
            File.WriteAllText(Path.Combine(Application.dataPath, settings.FilenameExperience), writer.ToString());
            sb.Remove(0, sb.Length);

            // Movement
            foreach (var kvp in settings.UnitList)
            {
                EntityTypeAttributes entityTypeAttributes = entityTypeCollection.GetEntityType(kvp.Key);
                if (entityTypeAttributes != null)
                {
                    OutputForMovement(entityTypeCollection, entityTypeAttributes, kvp.Value);
                }
            }
            File.WriteAllText(Path.Combine(Application.dataPath, settings.FilenameMovement), writer.ToString());
            sb.Remove(0, sb.Length);

            // DPS
            foreach (var kvp in settings.UnitList)
            {
                EntityTypeAttributes entityTypeAttributes = entityTypeCollection.GetEntityType(kvp.Key);
                if (entityTypeAttributes != null)
                {
                    OutputForDPS(entityTypeCollection, entityTypeAttributes, kvp.Value);
                }
            }
            File.WriteAllText(Path.Combine(Application.dataPath, settings.FilenameDPS), writer.ToString());
            sb.Remove(0, sb.Length);

            // Other

            /*using (BeginScope("ranges"))
             * {
             *      WeaponRange[] allRanges = (WeaponRange[])Enum.GetValues(typeof(WeaponRange));
             *      for (int i = 0; i < allRanges.Length; ++i)
             *              Print($"{allRanges[i]}");
             * }
             * using (BeginScope("falloffTypes"))
             * {
             *      AOEFalloffType[] allFallofftypes = (AOEFalloffType[])Enum.GetValues(typeof(AOEFalloffType));
             *      for (int i = 0; i < allFallofftypes.Length; ++i)
             *              Print($"{allFallofftypes[i]}");
             * }
             * File.WriteAllText(Path.Combine(Application.dataPath, settings.FilenameOther), writer.ToString());
             * sb.Remove(0, sb.Length);*/
        }
        public EntityTypeDTOCollection GetEntityTypeCollection(int entityId)
        {
            EntityTypeCollection entityTypeCollection = EntityTypeManager.GetCollection(entityId);

            return(HydrateEntityTypeDTO(entityTypeCollection));
        }
Exemplo n.º 25
0
        public static EntityTypeCollection GetCollection(EntityEnum entityName)
        {
            EntityTypeCollection collection = EntityTypeDAL.GetCollection(entityName);

            return(collection);
        }
Exemplo n.º 26
0
        public static EntityTypeCollection GetCollection(int entityId)
        {
            EntityTypeCollection entityTypeCollection = EntityTypeDAL.GetCollection(entityId);

            return(entityTypeCollection);
        }
Exemplo n.º 27
0
        protected void OutputForWeapons(EntityTypeCollection entityTypeCollection, EntityTypeAttributes entityTypeAttributes, string[] selectedWeapons, bool dps = false)
        {
            using (BeginScope("weapons"))
            {
                WeaponAttributes[] weaponAttributes = entityTypeAttributes.GetAll <WeaponAttributes>();
                for (int i = 0; i < weaponAttributes.Length; ++i)
                {
                    WeaponAttributes w = weaponAttributes[i];
                    if (selectedWeapons == null || Array.IndexOf(selectedWeapons, w.Name) >= 0)
                    {
                        using (BeginScope(w.Name))
                        {
                            Print($"damageType: {w.DamageType}");
                            Print($"dmg: {w.BaseDamagePerRound}");
                            Print($"packets: {w.DamagePacketsPerShot}");
                            Print($"excludeFromHighGround: {w.ExcludeFromHeightAdvantage}");
                            Print($"lineOfSightRequired: {w.LineOfSightRequired}");
                            Print($"friendlyFireDamageScalar: {w.FriendlyFireDamageScalar}");
                            Print($"leadsTarget: {w.LeadsTarget}");
                            Print($"windUp: {w.WindUpTimeMS}");
                            Print($"windDown: {w.WindDownTimeMS}");
                            Print($"rof: {w.RateOfFire}");
                            Print($"burstMin: {w.BurstPeriodMinTimeMS}");
                            Print($"burstMax: {w.BurstPeriodMaxTimeMS}");
                            Print($"numBursts: {w.NumberOfBursts}");
                            Print($"cooldown: {w.CooldownTimeMS}");
                            Print($"reload: {w.ReloadTimeMS}");
                            Print($"aoe: {w.AreaOfEffectRadius}");
                            Print($"falloff: {Enum.GetName(typeof(AOEFalloffType), w.AreaOfEffectFalloffType)}");

                            using (BeginScope($"ranges"))
                            {
                                foreach (var r in w.Ranges)
                                {
                                    using (BeginScope(Enum.GetName(typeof(WeaponRange), r.Range)))
                                    {
                                        Print($"distance: {r.Distance}");
                                        Print($"accuracy: {r.Accuracy}");
                                    }
                                }
                            }

                            if (!dps)
                            {
                                using (BeginScope($"turret"))
                                {
                                    Print($"fieldOfView: {w.Turret.FieldOfView}");
                                    Print($"fieldOfFire: {w.Turret.FieldOfFire}");
                                    Print($"rotationSpeed: {w.Turret.RotationSpeed}");
                                }

                                if (w.Modifiers.Length > 0)
                                {
                                    using (BeginScope($"modifiers"))
                                    {
                                        for (int j = 0; j < w.Modifiers.Length; ++j)
                                        {
                                            WeaponModifierInfo modifierInfo = w.Modifiers[j];
                                            using (BeginScope(j.ToString()))
                                            {
                                                Print($"targetClass: {modifierInfo.TargetClass}");
                                                Print($"classOperator: {modifierInfo.ClassOperator}");
                                                Print($"modifierType: {modifierInfo.Modifier}");
                                                Print($"amount: {modifierInfo.Amount}");
                                            }
                                        }
                                    }
                                }
                                if (w.StatusEffectsSets.Length > 0)
                                {
                                    Print($"statusEffectsExcludeTargetType: {w.StatusEffectsExcludeTargetType}");
                                    Print($"statusEffectsTargetAlignment: {w.StatusEffectsTargetAlignment}");
                                    using (BeginScope("statusEffectSets"))
                                    {
                                        for (int j = 0; j < w.StatusEffectsSets.Length; ++j)
                                        {
                                            for (int k = 0; k < w.StatusEffectsSets[j].StatusEffects.Length; ++k)
                                            {
                                                using (BeginScope(w.StatusEffectsSets[j].StatusEffects[k]))
                                                {
                                                    EntityTypeAttributes     seEntityTypeAttributes = entityTypeCollection.GetEntityType(w.StatusEffectsSets[j].StatusEffects[k]);
                                                    StatusEffectAttributes[] statusEffectAttributes = seEntityTypeAttributes.GetAll <StatusEffectAttributes>();
                                                    if (statusEffectAttributes.Length > 0)
                                                    {
                                                        OutputForStatusEffect(statusEffectAttributes[0]);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            WeaponDPSInfo weaponDPSInfo = new WeaponDPSInfo(w);
                            using (BeginScope("dpsInfo"))
                            {
                                Print($"avgShots: {weaponDPSInfo.AverageShotsPerBurst}");
                                Print($"trueROF: {weaponDPSInfo.TrueROF}");
                                Print($"sequenceDuration: {weaponDPSInfo.SequenceDuration}");
                                if (dps)
                                {
                                    using (BeginScope("dpsVsArmor"))
                                    {
                                        int[] armorVals = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 18, 21, 25, 50, 75, 100 };
                                        for (int j = 0; j < armorVals.Length; ++j)
                                        {
                                            using (BeginScope(armorVals[j].ToString()))
                                            {
                                                double armorDPS = weaponDPSInfo.ArmorDPS(armorVals[j]);
                                                Print($"dpsBeforeAccuracy: {armorDPS}");

                                                using (BeginScope("accuracyDps"))
                                                {
                                                    Dictionary <WeaponRange, double> rangeDPS = weaponDPSInfo.RangeDPS(armorDPS);
                                                    foreach (RangeBasedWeaponAttributes r in w.Ranges)
                                                    {
                                                        Print($"{Enum.GetName(typeof(WeaponRange), r.Range)}: {rangeDPS[r.Range]}");
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    double armorDPS = weaponDPSInfo.ArmorDPS(0);
                                    Print($"dpsBeforeAccuracy: {armorDPS}");

                                    using (BeginScope("accuracyDps"))
                                    {
                                        Dictionary <WeaponRange, double> rangeDPS = weaponDPSInfo.RangeDPS(armorDPS);
                                        foreach (RangeBasedWeaponAttributes r in w.Ranges)
                                        {
                                            Print($"{Enum.GetName(typeof(WeaponRange), r.Range)}: {rangeDPS[r.Range]}");
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }