示例#1
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);
            }
        }
示例#2
0
        private static void rebindWeaponAttributes(EntityTypeAttributes entityType, WeaponAttributesWrapper weaponAttributesWrapper)
        {
            var unitAttributes = entityType.Get <UnitAttributes>();

            if (unitAttributes != null)
            {
                for (var i = 0; i < unitAttributes.WeaponLoadout.Length; i++)
                {
                    var weaponBinding = unitAttributes.WeaponLoadout[i];
                    if (weaponBinding.Weapon.Name == weaponAttributesWrapper.Name)
                    {
                        unitAttributes.WeaponLoadout[i] = new WeaponBinding(
                            weaponID: weaponBinding.WeaponID,
                            weaponBindingIndex: weaponBinding.WeaponBindingIndex,
                            weapon: weaponAttributesWrapper,
                            ammoID: weaponBinding.AmmoID,
                            turretIndex: weaponBinding.TurretIndex,
                            defaultTurretAngleOffsetRadians: weaponBinding.DefaultTurretAngleOffsetRadians,
                            disabledOnSpawn: weaponBinding.DisabledOnSpawn,
                            weaponOffsetFromUnitOrigin: weaponBinding.OffsetFromUnitCenterInLocalSpace,
                            showAmmoOnHUD: weaponBinding.ShowAmmoOnHUD
                            );
                    }
                }
            }
        }
示例#3
0
        private void applyNamedCPatch <TAttributes, TWrapper, TSubsystemPatch>(
            EntityTypeAttributes entityType, Dictionary <string, TSubsystemPatch> patch, Func <TAttributes, TWrapper> createWrapper)
            where TAttributes : class
            where TWrapper : TAttributes
            where TSubsystemPatch : SubsystemPatch
        {
            foreach (var kvp in patch)
            {
                if (kvp.Key != "Any")
                {
                    applyCPatch(entityType, kvp.Value, createWrapper, kvp.Key);
                }
            }

            if (patch.ContainsKey("Any"))
            {
                TSubsystemPatch anyPatch = patch["Any"];
                foreach (var attributes in entityType.GetAll <TAttributes>())
                {
                    if (attributes is INamed a)
                    {
                        applyCPatch(entityType, anyPatch, createWrapper, a.Name);
                    }
                }
            }
        }
示例#4
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);
            }
        }
示例#5
0
 private void applyUnnamedComponentPatch <TPatch, TAttributes, TWrapper>(EntityTypeAttributes entityType, TPatch patch, Func <TAttributes, TWrapper> createWrapper, Action <TPatch, TWrapper> applyPatch)
     where TAttributes : class
     where TWrapper : TAttributes
 {
     if (patch != null)
     {
         applyComponentPatch(entityType, patch, createWrapper, applyPatch);
     }
 }
示例#6
0
 private void applyUnnamedCPatch <TAttributes, TWrapper>(
     EntityTypeAttributes entityType, SubsystemPatch patch, Func <TAttributes, TWrapper> createWrapper)
     where TAttributes : class
     where TWrapper : TAttributes
 {
     if (patch != null)
     {
         applyCPatch(entityType, patch, createWrapper);
     }
 }
示例#7
0
        private void applyNamedComponentPatch <TPatch, TAttributes, TWrapper>(EntityTypeAttributes entityType, Dictionary <string, TPatch> patch, Func <TAttributes, TWrapper> createWrapper, Action <TPatch, TWrapper> applyPatch)
            where TAttributes : class
            where TWrapper : TAttributes
        {
            foreach (var kvp in patch)
            {
                var elementName  = kvp.Key;
                var elementPatch = kvp.Value;

                applyComponentPatch(entityType, elementPatch, createWrapper, applyPatch, elementName);
            }
        }
示例#8
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);
                }
            }
        }
示例#9
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);
                }
            }
        }
示例#10
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);
                    }
                }
            }
        }
示例#11
0
 protected void OutputForTechTree(EntityTypeAttributes entityTypeAttributes)
 {
     using (BeginScope("entries"))
     {
         TechTreeAttributes techTreeAttributes = entityTypeAttributes.Get <TechTreeAttributes>();
         for (int i = 0; i < techTreeAttributes.TechTrees.Length; ++i)
         {
             TechTree techTree = techTreeAttributes.TechTrees[i];
             using (BeginScope(techTree.TechTreeName))
             {
                 Print($"icon: {techTree.IconSpriteName}");
                 using (BeginScope("tiers"))
                 {
                     for (int j = 0; j < techTree.Tiers.Length; ++j)
                     {
                         TechTreeTier tier = techTree.Tiers[j];
                         using (BeginScope(tier.TierName))
                         {
                             for (int k = 0; k < tier.ResearchItems.Length; ++k)
                             {
                                 Print($"- {tier.ResearchItems[k]}");
                             }
                         }
                     }
                 }
                 using (BeginScope("upgrades"))
                 {
                     for (int j = 0; j < techTree.Upgrades.Length; ++j)
                     {
                         TechUpgrade upgrade = techTree.Upgrades[j];
                         using (BeginScope(upgrade.UpgradeName))
                         {
                             Print($"researchItem: {upgrade.ResearchItem}");
                         }
                     }
                 }
             }
         }
     }
 }
示例#12
0
        private void applyCPatch <TAttributes, TWrapper>(
            EntityTypeAttributes entityType, SubsystemPatch patch, Func <TAttributes, TWrapper> createWrapper, string name = null)
            where TAttributes : class
            where TWrapper : TAttributes
        {
            var attributes = name != null?entityType.Get <TAttributes>(name) : entityType.Get <TAttributes>();

            if (attributes == null)
            {
                if (notFoundErrors)
                {
                    logger.Log($"ERROR: {typeof(TAttributes).Name}" + (name != null ? $": {name}" : "") + " not found");
                }
                return;
            }
            using (logger.BeginScope($"{typeof(TAttributes).Name}: {name}"))
            {
                var wrapper = createWrapper(attributes);
                patch.Apply(this, wrapper, entityType);
                entityType.Replace(attributes, wrapper);
            }
        }
示例#13
0
        private void applyComponentPatch <TPatch, TAttributes, TWrapper>(EntityTypeAttributes entityType, TPatch patch, Func <TAttributes, TWrapper> createWrapper, Action <TPatch, TWrapper> applyPatch, string name = null)
            where TAttributes : class
            where TWrapper : TAttributes
        {
            using (logger.BeginScope($"{typeof(TAttributes).Name}: {name}"))
            {
                var attributes = name != null
                    ? entityType.Get <TAttributes>(name)
                    : entityType.Get <TAttributes>();

                if (attributes == null)
                {
                    logger.Log($"ERROR: {typeof(TAttributes).Name} not found");
                    return;
                }

                var wrapper = createWrapper(attributes);

                applyPatch(patch, wrapper);

                entityType.Replace(attributes, wrapper);
            }
        }
示例#14
0
        private void ApplyEntityTypePatch(EntityTypeAttributes entityType, EntityTypePatch entityTypePatch)
        {
            applyUnnamedCPatch <ExperienceAttributes, ExperienceAttributesWrapper>(entityType, entityTypePatch.ExperienceAttributes, x => new ExperienceAttributesWrapper(x));
            applyUnnamedCPatch <HarvesterAttributes, HarvesterAttributesWrapper>(entityType, entityTypePatch.HarvesterAttributes, x => new HarvesterAttributesWrapper(x));
            applyUnnamedCPatch <UnitAttributes, UnitAttributesWrapper>(entityType, entityTypePatch.UnitAttributes, x => new UnitAttributesWrapper(x));
            applyUnnamedCPatch <ResearchItemAttributes, ResearchItemAttributesWrapper>(entityType, entityTypePatch.ResearchItemAttributes, x => new ResearchItemAttributesWrapper(x));
            applyUnnamedCPatch <UnitHangarAttributes, UnitHangarAttributesWrapper>(entityType, entityTypePatch.UnitHangarAttributes, x => new UnitHangarAttributesWrapper(x));
            applyUnnamedCPatch <DetectableAttributes, DetectableAttributesWrapper>(entityType, entityTypePatch.DetectableAttributes, x => new DetectableAttributesWrapper(x));
            applyUnnamedCPatch <UnitMovementAttributes, UnitMovementAttributesWrapper>(entityType, entityTypePatch.UnitMovementAttributes, x => new UnitMovementAttributesWrapper(x));
            applyUnnamedCPatch <StatusEffectAttributes, StatusEffectAttributesWrapper>(entityType, entityTypePatch.StatusEffectAttributes, x => new StatusEffectAttributesWrapper(x));
            applyUnnamedCPatch <PowerShuntAttributes, PowerShuntAttributesWrapper>(entityType, entityTypePatch.PowerShuntAttributes, x => new PowerShuntAttributesWrapper(x));
            applyUnnamedCPatch <ProjectileAttributes, ProjectileAttributesWrapper>(entityType, entityTypePatch.ProjectileAttributes, x => new ProjectileAttributesWrapper(x));
            applyUnnamedCPatch <ResourceAttributes, ResourceAttributesWrapper>(entityType, entityTypePatch.ResourceAttributes, x => new ResourceAttributesWrapper(x));
            applyUnnamedCPatch <RelicAttributes, RelicAttributesWrapper>(entityType, entityTypePatch.RelicAttributes, x => new RelicAttributesWrapper(x));
            applyUnnamedCPatch <AbilityViewAttributes, AbilityViewAttributes>(entityType, entityTypePatch.AbilityViewAttributes, x => ViewCloneFunctions.CloneAbilityViewAttributes(x));

            applyNamedCPatch <AbilityAttributes, AbilityAttributesWrapper, Patch.AbilityAttributesPatch>(entityType, entityTypePatch.AbilityAttributes, x => new AbilityAttributesWrapper(x));
            applyNamedCPatch <StorageAttributes, StorageAttributesWrapper, Patch.StorageAttributesPatch>(entityType, entityTypePatch.StorageAttributes, x => new StorageAttributesWrapper(x));
            applyNamedCPatch <WeaponAttributes, WeaponAttributesWrapper, Patch.WeaponAttributesPatch>(entityType, entityTypePatch.WeaponAttributes, x => new WeaponAttributesWrapper(x));

            // Changing these doesn't seem to do anything, they are likely a special case, maybe are loaded before the game
            applyUnnamedCPatch <FactionAttributes, FactionAttributesWrapper>(entityType, entityTypePatch.FactionAttributes, x => new FactionAttributesWrapper(x));
            applyUnnamedCPatch <TechTreeAttributes, TechTreeAttributesWrapper>(entityType, entityTypePatch.TechTreeAttributes, x => new TechTreeAttributesWrapper(x));
        }
示例#15
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);
                }
            }
        }
示例#16
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.");
        }
示例#17
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);*/
        }
示例#18
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]}");
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
示例#19
0
 public virtual void Apply(AttributeLoader loader, object wrapper, EntityTypeAttributes entityType)
 {
     Apply(loader, wrapper);
 }
示例#20
0
        public override void Apply(AttributeLoader loader, object wrapperObj, EntityTypeAttributes entityType)
        {
            base.Apply(loader, wrapperObj, entityType);

            RebindWeaponAttributes(entityType, wrapperObj as WeaponAttributesWrapper);
        }