From 4840f633923a6d5d64537ebc8d56006a2a849619 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Sat, 20 Oct 2018 21:56:30 -0400 Subject: [PATCH 01/23] Downgrade to .NET Framework 3.5 --- Subsystem/Subsystem.csproj | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Subsystem/Subsystem.csproj b/Subsystem/Subsystem.csproj index 09c291b..535d82a 100644 --- a/Subsystem/Subsystem.csproj +++ b/Subsystem/Subsystem.csproj @@ -9,8 +9,9 @@ Properties Subsystem Subsystem - v4.6.1 + v3.5 512 + true @@ -36,9 +37,7 @@ - - From ef17b05de16e815ea22ce144749c27fd9e5b23d6 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Sat, 20 Oct 2018 22:00:13 -0400 Subject: [PATCH 02/23] Add support for logging attribute changes --- Subsystem/AttributeLoader.cs | 55 +++++++++++++++++++++++++++++++++-- Subsystem/PropertyAccessor.cs | 41 ++++++++++++++++++++++++++ Subsystem/Subsystem.csproj | 1 + 3 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 Subsystem/PropertyAccessor.cs diff --git a/Subsystem/AttributeLoader.cs b/Subsystem/AttributeLoader.cs index 9d35061..51a6924 100644 --- a/Subsystem/AttributeLoader.cs +++ b/Subsystem/AttributeLoader.cs @@ -3,14 +3,18 @@ using BBI.Core.Utility.FixedPoint; using BBI.Game.Data; using LitJson; +using System; using System.IO; using System.Linq; +using System.Linq.Expressions; using UnityEngine; namespace Subsystem { public class AttributeLoader { + private readonly TextWriter logger = new StringWriter(); + public static void LoadAttributes(EntityTypeCollection entityTypeCollection) { var jsonPath = Path.Combine(Application.dataPath, "patch.json"); @@ -18,10 +22,11 @@ public static void LoadAttributes(EntityTypeCollection entityTypeCollection) var attributesPatch = JsonMapper.ToObject(json); - ApplyAttributesPatch(entityTypeCollection, attributesPatch); + var loader = new AttributeLoader(); + loader.ApplyAttributesPatch(entityTypeCollection, attributesPatch); } - public static void ApplyAttributesPatch(EntityTypeCollection entityTypeCollection, AttributesPatch attributesPatch) + public void ApplyAttributesPatch(EntityTypeCollection entityTypeCollection, AttributesPatch attributesPatch) { foreach (var kvp in attributesPatch.Entities) { @@ -78,6 +83,52 @@ public static void ApplyAttributesPatch(EntityTypeCollection entityTypeCollectio rebindWeaponAttributes(entityType, weaponAttributesWrapper); } } + + Debug.Log($"[SUBSYSTEM] Applied attributes patch:\n\n{logger.ToString()}"); + } + + private void applyPropertyPatch(TProperty? newValue, Expression> expression) where TProperty : struct + { + if (newValue.HasValue) + { + setProperty(newValue.Value, expression, x => x); + } + } + + private void applyPropertyPatch(TProperty newValue, Expression> expression) where TProperty : class + { + if (newValue != null) + { + setProperty(newValue, expression, x => x); + } + } + + private void applyPropertyPatch(TValue? newValue, Expression> expression, Func projection) where TValue : struct + { + if (newValue.HasValue) + { + setProperty(newValue.Value, expression, projection); + } + } + + private void applyPropertyPatch(TValue newValue, Expression> expression, Func projection) where TValue : class + { + if (newValue != null) + { + setProperty(newValue, expression, projection); + } + } + + private void setProperty(TValue newValue, Expression> expression, Func projection) + { + var value = projection(newValue); + + var accessor = new PropertyAccessor(expression); + + var oldValue = accessor.Get(); + accessor.Set(value); + + logger.WriteLine($" set {accessor.Name} = {value} (old value: {oldValue})"); } private static void rebindWeaponAttributes(EntityTypeAttributes entityType, WeaponAttributesWrapper weaponAttributesWrapper) diff --git a/Subsystem/PropertyAccessor.cs b/Subsystem/PropertyAccessor.cs new file mode 100644 index 0000000..50adf69 --- /dev/null +++ b/Subsystem/PropertyAccessor.cs @@ -0,0 +1,41 @@ +using System; +using System.Linq.Expressions; +using System.Reflection; + +namespace Subsystem +{ + public class PropertyAccessor + { + private Func getter; + private Action setter; + + public T Get() => getter(); + public void Set(T value) => setter(value); + public string Name { get; private set; } + + public PropertyAccessor(Expression> expression) + { + var memberExpression = expression.Body as MemberExpression; + + if (memberExpression == null) + { + throw new ArgumentException("must be a MemberExpression", nameof(expression)); + } + + var instanceExpression = memberExpression.Expression; + var parameter = Expression.Parameter(typeof(T), "obj"); + + var propertyInfo = memberExpression.Member as PropertyInfo; + + if (propertyInfo == null) + { + throw new ArgumentException("must refer to a property", nameof(expression)); + } + + Name = propertyInfo.Name; + + getter = Expression.Lambda>(Expression.Call(instanceExpression, propertyInfo.GetGetMethod())).Compile(); + setter = Expression.Lambda>(Expression.Call(instanceExpression, propertyInfo.GetSetMethod(), parameter), parameter).Compile(); + } + } +} diff --git a/Subsystem/Subsystem.csproj b/Subsystem/Subsystem.csproj index 535d82a..a99ece7 100644 --- a/Subsystem/Subsystem.csproj +++ b/Subsystem/Subsystem.csproj @@ -49,6 +49,7 @@ + From 30627a6cd75415d0b9b7f6629f896d30f42df22f Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Sat, 20 Oct 2018 22:00:23 -0400 Subject: [PATCH 03/23] Log changes to ResearchItemAttributes --- Subsystem/AttributeLoader.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Subsystem/AttributeLoader.cs b/Subsystem/AttributeLoader.cs index 51a6924..dbe4b12 100644 --- a/Subsystem/AttributeLoader.cs +++ b/Subsystem/AttributeLoader.cs @@ -212,18 +212,18 @@ public static void ApplyUnitAttributesPatch(UnitAttributesPatch unitAttributesPa if (unitAttributesPatch.Resource2Cost.HasValue) { unitAttributesWrapper.Resource2Cost = unitAttributesPatch.Resource2Cost.Value; } } - public static void ApplyResearchItemAttributesPatch(ResearchItemAttributesPatch researchItemAttributesPatch, ResearchItemAttributesWrapper researchItemAttributesWrapper) + public void ApplyResearchItemAttributesPatch(ResearchItemAttributesPatch researchItemAttributesPatch, ResearchItemAttributesWrapper researchItemAttributesWrapper) { - if (researchItemAttributesPatch.TypeOfResearch.HasValue) { researchItemAttributesWrapper.TypeOfResearch = researchItemAttributesPatch.TypeOfResearch.Value; } - if (researchItemAttributesPatch.IconSpriteName != null) { researchItemAttributesWrapper.IconSpriteName = researchItemAttributesPatch.IconSpriteName; } - if (researchItemAttributesPatch.LocalizedResearchTitleStringID != null) { researchItemAttributesWrapper.LocalizedResearchTitleStringID = researchItemAttributesPatch.LocalizedResearchTitleStringID; } - if (researchItemAttributesPatch.LocalizedShortDescriptionStringID != null) { researchItemAttributesWrapper.LocalizedShortDescriptionStringID = researchItemAttributesPatch.LocalizedShortDescriptionStringID; } - if (researchItemAttributesPatch.LocalizedLongDescriptionStringID != null) { researchItemAttributesWrapper.LocalizedLongDescriptionStringID = researchItemAttributesPatch.LocalizedLongDescriptionStringID; } - if (researchItemAttributesPatch.ResearchTime.HasValue) { researchItemAttributesWrapper.ResearchTime = Fixed64.UnsafeFromDouble(researchItemAttributesPatch.ResearchTime.Value); } - if (researchItemAttributesPatch.Dependencies != null) { researchItemAttributesWrapper.Dependencies = researchItemAttributesPatch.Dependencies; } - if (researchItemAttributesPatch.ResearchVOCode != null) { researchItemAttributesWrapper.ResearchVOCode = researchItemAttributesPatch.ResearchVOCode; } - if (researchItemAttributesPatch.Resource1Cost.HasValue) { researchItemAttributesWrapper.Resource1Cost = researchItemAttributesPatch.Resource1Cost.Value; } - if (researchItemAttributesPatch.Resource2Cost.HasValue) { researchItemAttributesWrapper.Resource2Cost = researchItemAttributesPatch.Resource2Cost.Value; } + applyPropertyPatch(researchItemAttributesPatch.TypeOfResearch, () => researchItemAttributesWrapper.TypeOfResearch); + applyPropertyPatch(researchItemAttributesPatch.IconSpriteName, () => researchItemAttributesWrapper.IconSpriteName); + applyPropertyPatch(researchItemAttributesPatch.LocalizedResearchTitleStringID, () => researchItemAttributesWrapper.LocalizedResearchTitleStringID); + applyPropertyPatch(researchItemAttributesPatch.LocalizedShortDescriptionStringID, () => researchItemAttributesWrapper.LocalizedShortDescriptionStringID); + applyPropertyPatch(researchItemAttributesPatch.LocalizedLongDescriptionStringID, () => researchItemAttributesWrapper.LocalizedLongDescriptionStringID); + applyPropertyPatch(researchItemAttributesPatch.ResearchTime, () => researchItemAttributesWrapper.ResearchTime, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(researchItemAttributesPatch.Dependencies, () => researchItemAttributesWrapper.Dependencies); + applyPropertyPatch(researchItemAttributesPatch.ResearchVOCode, () => researchItemAttributesWrapper.ResearchVOCode); + applyPropertyPatch(researchItemAttributesPatch.Resource1Cost, () => researchItemAttributesWrapper.Resource1Cost); + applyPropertyPatch(researchItemAttributesPatch.Resource2Cost, () => researchItemAttributesWrapper.Resource2Cost); } public static void ApplyAbilityAttributesPatch(AbilityAttributesPatch abilityAttributesPatch, AbilityAttributesWrapper abilityAttributesWrapper) From 58b7be02df926ca056786682f710d8d86578f00d Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Sat, 20 Oct 2018 22:32:07 -0400 Subject: [PATCH 04/23] Add logging for property changes to supported attribute types --- Subsystem/AttributeLoader.cs | 226 +++++++++++++++++++---------------- 1 file changed, 121 insertions(+), 105 deletions(-) diff --git a/Subsystem/AttributeLoader.cs b/Subsystem/AttributeLoader.cs index dbe4b12..c327d09 100644 --- a/Subsystem/AttributeLoader.cs +++ b/Subsystem/AttributeLoader.cs @@ -35,23 +35,34 @@ public void ApplyAttributesPatch(EntityTypeCollection entityTypeCollection, Attr var entityType = entityTypeCollection.GetEntityType(entityTypeName); + logger.WriteLine($"EntityType: {entityTypeName}"); + logger.WriteLine(); + if (entityTypePatch.UnitAttributes != null) { + logger.WriteLine($" UnitAttributes:"); + var unitAttributes = entityType.Get(); var unitAttributesWrapper = new UnitAttributesWrapper(unitAttributes); ApplyUnitAttributesPatch(entityTypePatch.UnitAttributes, unitAttributesWrapper); + logger.WriteLine(); + entityType.Replace(unitAttributes, unitAttributesWrapper); } if (entityTypePatch.ResearchItemAttributes != null) { + logger.WriteLine($" ResearchItemAttributes:"); + var researchItemAttributes = entityType.Get(); var researchItemAttributesWrapper = new ResearchItemAttributesWrapper(researchItemAttributes); ApplyResearchItemAttributesPatch(entityTypePatch.ResearchItemAttributes, researchItemAttributesWrapper); + logger.WriteLine(); + entityType.Replace(researchItemAttributes, researchItemAttributesWrapper); } @@ -60,11 +71,15 @@ public void ApplyAttributesPatch(EntityTypeCollection entityTypeCollection, Attr var abilityAttributesName = kvp2.Key; var abilityAttributesPatch = kvp2.Value; + logger.WriteLine($" AbilityAttributes: {abilityAttributesName}"); + var abilityAttributes = entityType.Get(abilityAttributesName); var abilityAttributesWrapper = new AbilityAttributesWrapper(abilityAttributes); ApplyAbilityAttributesPatch(abilityAttributesPatch, abilityAttributesWrapper); + logger.WriteLine(); + entityType.Replace(abilityAttributes, abilityAttributesWrapper); } @@ -73,11 +88,15 @@ public void ApplyAttributesPatch(EntityTypeCollection entityTypeCollection, Attr var weaponAttributesName = kvp2.Key; var weaponAttributesPatch = kvp2.Value; + logger.WriteLine($" WeaponAttributes: {weaponAttributesName}"); + var weaponAttributes = entityType.Get(weaponAttributesName); var weaponAttributesWrapper = new WeaponAttributesWrapper(weaponAttributes); ApplyWeaponAttributesPatch(weaponAttributesPatch, weaponAttributesWrapper); + logger.WriteLine(); + entityType.Replace(weaponAttributes, weaponAttributesWrapper); rebindWeaponAttributes(entityType, weaponAttributesWrapper); @@ -128,7 +147,7 @@ private void setProperty(TValue newValue, Expression new ThreatCounter(x)); } - if (unitAttributesPatch.ThreatCounteredBys != null) { unitAttributesWrapper.ThreatCounteredBys = unitAttributesPatch.ThreatCounteredBys.Select(x => new ThreatCounter(x)); } - - if (unitAttributesPatch.Resource1Cost.HasValue) { unitAttributesWrapper.Resource1Cost = unitAttributesPatch.Resource1Cost.Value; } - if (unitAttributesPatch.Resource2Cost.HasValue) { unitAttributesWrapper.Resource2Cost = unitAttributesPatch.Resource2Cost.Value; } + applyPropertyPatch(unitAttributesPatch.Class, () => unitAttributesWrapper.Class); + applyPropertyPatch(unitAttributesPatch.SelectionFlags, () => unitAttributesWrapper.SelectionFlags); + applyPropertyPatch(unitAttributesPatch.MaxHealth, () => unitAttributesWrapper.MaxHealth); + applyPropertyPatch(unitAttributesPatch.Armour, () => unitAttributesWrapper.Armour); + applyPropertyPatch(unitAttributesPatch.DamageReceivedMultiplier, () => unitAttributesWrapper.DamageReceivedMultiplier, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitAttributesPatch.AccuracyReceivedMultiplier, () => unitAttributesWrapper.AccuracyReceivedMultiplier, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitAttributesPatch.PopCapCost, () => unitAttributesWrapper.PopCapCost); + applyPropertyPatch(unitAttributesPatch.ExperienceValue, () => unitAttributesWrapper.ExperienceValue); + applyPropertyPatch(unitAttributesPatch.ProductionTime, () => unitAttributesWrapper.ProductionTime, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitAttributesPatch.AggroRange, () => unitAttributesWrapper.AggroRange, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitAttributesPatch.LeashRange, () => unitAttributesWrapper.LeashRange, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitAttributesPatch.AlertRange, () => unitAttributesWrapper.AlertRange, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitAttributesPatch.RepairPickupRange, () => unitAttributesWrapper.RepairPickupRange, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitAttributesPatch.UnitPositionReaggroConditions, () => unitAttributesWrapper.UnitPositionReaggroConditions); + applyPropertyPatch(unitAttributesPatch.LeashPositionReaggroConditions, () => unitAttributesWrapper.LeashPositionReaggroConditions); + applyPropertyPatch(unitAttributesPatch.LeadPriority, () => unitAttributesWrapper.LeadPriority); + applyPropertyPatch(unitAttributesPatch.Selectable, () => unitAttributesWrapper.Selectable); + applyPropertyPatch(unitAttributesPatch.Controllable, () => unitAttributesWrapper.Controllable); + applyPropertyPatch(unitAttributesPatch.Targetable, () => unitAttributesWrapper.Targetable); + applyPropertyPatch(unitAttributesPatch.NonAutoTargetable, () => unitAttributesWrapper.NonAutoTargetable); + applyPropertyPatch(unitAttributesPatch.RetireTargetable, () => unitAttributesWrapper.RetireTargetable); + applyPropertyPatch(unitAttributesPatch.HackedReturnTargetable, () => unitAttributesWrapper.HackedReturnTargetable); + applyPropertyPatch(unitAttributesPatch.HackableProperties, () => unitAttributesWrapper.HackableProperties); + applyPropertyPatch(unitAttributesPatch.ExcludeFromUnitStats, () => unitAttributesWrapper.ExcludeFromUnitStats); + applyPropertyPatch(unitAttributesPatch.BlocksLOF, () => unitAttributesWrapper.BlocksLOF); + applyPropertyPatch(unitAttributesPatch.WorldHeightOffset, () => unitAttributesWrapper.WorldHeightOffset, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitAttributesPatch.DoNotPersist, () => unitAttributesWrapper.DoNotPersist); + applyPropertyPatch(unitAttributesPatch.LevelBound, () => unitAttributesWrapper.LevelBound); + applyPropertyPatch(unitAttributesPatch.StartsInHangar, () => unitAttributesWrapper.StartsInHangar); + applyPropertyPatch(unitAttributesPatch.SensorRadius, () => unitAttributesWrapper.SensorRadius, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitAttributesPatch.ContactRadius, () => unitAttributesWrapper.ContactRadius, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitAttributesPatch.NumProductionQueues, () => unitAttributesWrapper.NumProductionQueues); + applyPropertyPatch(unitAttributesPatch.ProductionQueueDepth, () => unitAttributesWrapper.ProductionQueueDepth); + applyPropertyPatch(unitAttributesPatch.ShowProductionQueues, () => unitAttributesWrapper.ShowProductionQueues); + applyPropertyPatch(unitAttributesPatch.NoTextNotifications, () => unitAttributesWrapper.NoTextNotifications); + applyPropertyPatch(unitAttributesPatch.NotificationFlags, () => unitAttributesWrapper.NotificationFlags); + applyPropertyPatch(unitAttributesPatch.FireRateDisplay, () => unitAttributesWrapper.FireRateDisplay); + applyPropertyPatch(unitAttributesPatch.PriorityAsTarget, () => unitAttributesWrapper.PriorityAsTarget, x => Fixed64.UnsafeFromDouble(x)); + + applyPropertyPatch(unitAttributesPatch.BaseThreat, () => unitAttributesWrapper.ThreatData.BaseThreat); + applyPropertyPatch(unitAttributesPatch.ThreatTier, () => unitAttributesWrapper.ThreatData.Tier); + + applyPropertyPatch(unitAttributesPatch.ThreatCounters, () => unitAttributesWrapper.ThreatCounters, c => c.Select(x => new ThreatCounter(x))); + applyPropertyPatch(unitAttributesPatch.ThreatCounteredBys, () => unitAttributesWrapper.ThreatCounteredBys, c => c.Select(x => new ThreatCounter(x))); + + applyPropertyPatch(unitAttributesPatch.Resource1Cost, () => unitAttributesWrapper.Resource1Cost); + applyPropertyPatch(unitAttributesPatch.Resource2Cost, () => unitAttributesWrapper.Resource2Cost); } public void ApplyResearchItemAttributesPatch(ResearchItemAttributesPatch researchItemAttributesPatch, ResearchItemAttributesWrapper researchItemAttributesWrapper) @@ -226,67 +242,67 @@ public void ApplyResearchItemAttributesPatch(ResearchItemAttributesPatch researc applyPropertyPatch(researchItemAttributesPatch.Resource2Cost, () => researchItemAttributesWrapper.Resource2Cost); } - public static void ApplyAbilityAttributesPatch(AbilityAttributesPatch abilityAttributesPatch, AbilityAttributesWrapper abilityAttributesWrapper) + public void ApplyAbilityAttributesPatch(AbilityAttributesPatch abilityAttributesPatch, AbilityAttributesWrapper abilityAttributesWrapper) { - if (abilityAttributesPatch.AbilityType.HasValue) { abilityAttributesWrapper.AbilityType = abilityAttributesPatch.AbilityType.Value; } - if (abilityAttributesPatch.TargetingType.HasValue) { abilityAttributesWrapper.TargetingType = abilityAttributesPatch.TargetingType.Value; } - if (abilityAttributesPatch.TargetAlignment.HasValue) { abilityAttributesWrapper.TargetAlignment = abilityAttributesPatch.TargetAlignment.Value; } - if (abilityAttributesPatch.AbilityMapTargetLayers.HasValue) { abilityAttributesWrapper.AbilityMapTargetLayers = abilityAttributesPatch.AbilityMapTargetLayers.Value; } - if (abilityAttributesPatch.GroundAutoTargetAlignment.HasValue) { abilityAttributesWrapper.GroundAutoTargetAlignment = abilityAttributesPatch.GroundAutoTargetAlignment.Value; } - if (abilityAttributesPatch.EdgeOfTargetShapeMinDistance.HasValue) { abilityAttributesWrapper.EdgeOfTargetShapeMinDistance = Fixed64.UnsafeFromDouble(abilityAttributesPatch.EdgeOfTargetShapeMinDistance.Value); } - if (abilityAttributesPatch.CasterMovesToTarget.HasValue) { abilityAttributesWrapper.CasterMovesToTarget = abilityAttributesPatch.CasterMovesToTarget.Value; } - if (abilityAttributesPatch.GroupActivationType.HasValue) { abilityAttributesWrapper.GroupActivationType = abilityAttributesPatch.GroupActivationType.Value; } - if (abilityAttributesPatch.StartsRemovedInGameMode.HasValue) { abilityAttributesWrapper.StartsRemovedInGameMode = abilityAttributesPatch.StartsRemovedInGameMode.Value; } - if (abilityAttributesPatch.CooldownTimeSecs.HasValue) { abilityAttributesWrapper.CooldownTimeSecs = Fixed64.UnsafeFromDouble(abilityAttributesPatch.CooldownTimeSecs.Value); } - if (abilityAttributesPatch.WarmupTimeSecs.HasValue) { abilityAttributesWrapper.WarmupTimeSecs = Fixed64.UnsafeFromDouble(abilityAttributesPatch.WarmupTimeSecs.Value); } - if (abilityAttributesPatch.SharedCooldownChannel.HasValue) { abilityAttributesWrapper.SharedCooldownChannel = abilityAttributesPatch.SharedCooldownChannel.Value; } - if (abilityAttributesPatch.SkipCastOnArrivalConditions.HasValue) { abilityAttributesWrapper.SkipCastOnArrivalConditions = abilityAttributesPatch.SkipCastOnArrivalConditions.Value; } - if (abilityAttributesPatch.IsToggleable.HasValue) { abilityAttributesWrapper.IsToggleable = abilityAttributesPatch.IsToggleable.Value; } - if (abilityAttributesPatch.CastOnDeath.HasValue) { abilityAttributesWrapper.CastOnDeath = abilityAttributesPatch.CastOnDeath.Value; } + applyPropertyPatch(abilityAttributesPatch.AbilityType, () => abilityAttributesWrapper.AbilityType); + applyPropertyPatch(abilityAttributesPatch.TargetingType, () => abilityAttributesWrapper.TargetingType); + applyPropertyPatch(abilityAttributesPatch.TargetAlignment, () => abilityAttributesWrapper.TargetAlignment); + applyPropertyPatch(abilityAttributesPatch.AbilityMapTargetLayers, () => abilityAttributesWrapper.AbilityMapTargetLayers); + applyPropertyPatch(abilityAttributesPatch.GroundAutoTargetAlignment, () => abilityAttributesWrapper.GroundAutoTargetAlignment); + applyPropertyPatch(abilityAttributesPatch.EdgeOfTargetShapeMinDistance, () => abilityAttributesWrapper.EdgeOfTargetShapeMinDistance, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(abilityAttributesPatch.CasterMovesToTarget, () => abilityAttributesWrapper.CasterMovesToTarget); + applyPropertyPatch(abilityAttributesPatch.GroupActivationType, () => abilityAttributesWrapper.GroupActivationType); + applyPropertyPatch(abilityAttributesPatch.StartsRemovedInGameMode, () => abilityAttributesWrapper.StartsRemovedInGameMode); + applyPropertyPatch(abilityAttributesPatch.CooldownTimeSecs, () => abilityAttributesWrapper.CooldownTimeSecs, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(abilityAttributesPatch.WarmupTimeSecs, () => abilityAttributesWrapper.WarmupTimeSecs, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(abilityAttributesPatch.SharedCooldownChannel, () => abilityAttributesWrapper.SharedCooldownChannel); + applyPropertyPatch(abilityAttributesPatch.SkipCastOnArrivalConditions, () => abilityAttributesWrapper.SkipCastOnArrivalConditions); + applyPropertyPatch(abilityAttributesPatch.IsToggleable, () => abilityAttributesWrapper.IsToggleable); + applyPropertyPatch(abilityAttributesPatch.CastOnDeath, () => abilityAttributesWrapper.CastOnDeath); var cost = new CostAttributesWrapper(abilityAttributesWrapper.Cost); abilityAttributesWrapper.Cost = cost; - if (abilityAttributesPatch.Resource1Cost.HasValue) { cost.Resource1Cost = abilityAttributesPatch.Resource1Cost.Value; } - if (abilityAttributesPatch.Resource2Cost.HasValue) { cost.Resource2Cost = abilityAttributesPatch.Resource2Cost.Value; } + applyPropertyPatch(abilityAttributesPatch.Resource1Cost, () => cost.Resource1Cost); + applyPropertyPatch(abilityAttributesPatch.Resource2Cost, () => cost.Resource2Cost); } - public static void ApplyWeaponAttributesPatch(WeaponAttributesPatch weaponAttributesPatch, WeaponAttributesWrapper weaponAttributesWrapper) + public void ApplyWeaponAttributesPatch(WeaponAttributesPatch weaponAttributesPatch, WeaponAttributesWrapper weaponAttributesWrapper) { - if (weaponAttributesPatch.ExcludeFromAutoTargetAcquisition.HasValue) { weaponAttributesWrapper.ExcludeFromAutoTargetAcquisition = weaponAttributesPatch.ExcludeFromAutoTargetAcquisition.Value; } - if (weaponAttributesPatch.ExcludeFromAutoFire.HasValue) { weaponAttributesWrapper.ExcludeFromAutoFire = weaponAttributesPatch.ExcludeFromAutoFire.Value; } - if (weaponAttributesPatch.ExcludeFromHeightAdvantage.HasValue) { weaponAttributesWrapper.ExcludeFromHeightAdvantage = weaponAttributesPatch.ExcludeFromHeightAdvantage.Value; } - if (weaponAttributesPatch.DamageType.HasValue) { weaponAttributesWrapper.DamageType = weaponAttributesPatch.DamageType.Value; } - if (weaponAttributesPatch.IsTracer.HasValue) { weaponAttributesWrapper.IsTracer = weaponAttributesPatch.IsTracer.Value; } - if (weaponAttributesPatch.TracerSpeed.HasValue) { weaponAttributesWrapper.TracerSpeed = Fixed64.UnsafeFromDouble(weaponAttributesPatch.TracerSpeed.Value); } - if (weaponAttributesPatch.TracerLength.HasValue) { weaponAttributesWrapper.TracerLength = Fixed64.UnsafeFromDouble(weaponAttributesPatch.TracerLength.Value); } - if (weaponAttributesPatch.BaseDamagePerRound.HasValue) { weaponAttributesWrapper.BaseDamagePerRound = Fixed64.UnsafeFromDouble(weaponAttributesPatch.BaseDamagePerRound.Value); } - if (weaponAttributesPatch.BaseWreckDamagePerRound.HasValue) { weaponAttributesWrapper.BaseWreckDamagePerRound = Fixed64.UnsafeFromDouble(weaponAttributesPatch.BaseWreckDamagePerRound.Value); } - if (weaponAttributesPatch.FiringRecoil.HasValue) { weaponAttributesWrapper.FiringRecoil = weaponAttributesPatch.FiringRecoil.Value; } - if (weaponAttributesPatch.WindUpTimeMS.HasValue) { weaponAttributesWrapper.WindUpTimeMS = weaponAttributesPatch.WindUpTimeMS.Value; } - if (weaponAttributesPatch.RateOfFire.HasValue) { weaponAttributesWrapper.RateOfFire = weaponAttributesPatch.RateOfFire.Value; } - if (weaponAttributesPatch.NumberOfBursts.HasValue) { weaponAttributesWrapper.NumberOfBursts = weaponAttributesPatch.NumberOfBursts.Value; } - if (weaponAttributesPatch.DamagePacketsPerShot.HasValue) { weaponAttributesWrapper.DamagePacketsPerShot = weaponAttributesPatch.DamagePacketsPerShot.Value; } - if (weaponAttributesPatch.BurstPeriodMinTimeMS.HasValue) { weaponAttributesWrapper.BurstPeriodMinTimeMS = weaponAttributesPatch.BurstPeriodMinTimeMS.Value; } - if (weaponAttributesPatch.BurstPeriodMaxTimeMS.HasValue) { weaponAttributesWrapper.BurstPeriodMaxTimeMS = weaponAttributesPatch.BurstPeriodMaxTimeMS.Value; } - if (weaponAttributesPatch.CooldownTimeMS.HasValue) { weaponAttributesWrapper.CooldownTimeMS = weaponAttributesPatch.CooldownTimeMS.Value; } - if (weaponAttributesPatch.WindDownTimeMS.HasValue) { weaponAttributesWrapper.WindDownTimeMS = weaponAttributesPatch.WindDownTimeMS.Value; } - if (weaponAttributesPatch.ReloadTimeMS.HasValue) { weaponAttributesWrapper.ReloadTimeMS = weaponAttributesPatch.ReloadTimeMS.Value; } - if (weaponAttributesPatch.LineOfSightRequired.HasValue) { weaponAttributesWrapper.LineOfSightRequired = weaponAttributesPatch.LineOfSightRequired.Value; } - if (weaponAttributesPatch.LeadsTarget.HasValue) { weaponAttributesWrapper.LeadsTarget = weaponAttributesPatch.LeadsTarget.Value; } - if (weaponAttributesPatch.KillSkipsUnitDeathSequence.HasValue) { weaponAttributesWrapper.KillSkipsUnitDeathSequence = weaponAttributesPatch.KillSkipsUnitDeathSequence.Value; } - if (weaponAttributesPatch.RevealTriggers.HasValue) { weaponAttributesWrapper.RevealTriggers = weaponAttributesPatch.RevealTriggers.Value; } - if (weaponAttributesPatch.UnitStatusAttackingTriggers.HasValue) { weaponAttributesWrapper.UnitStatusAttackingTriggers = weaponAttributesPatch.UnitStatusAttackingTriggers.Value; } - if (weaponAttributesPatch.TargetStyle.HasValue) { weaponAttributesWrapper.TargetStyle = weaponAttributesPatch.TargetStyle.Value; } - if (weaponAttributesPatch.AreaOfEffectFalloffType.HasValue) { weaponAttributesWrapper.AreaOfEffectFalloffType = weaponAttributesPatch.AreaOfEffectFalloffType.Value; } - if (weaponAttributesPatch.AreaOfEffectRadius.HasValue) { weaponAttributesWrapper.AreaOfEffectRadius = Fixed64.UnsafeFromDouble(weaponAttributesPatch.AreaOfEffectRadius.Value); } - if (weaponAttributesPatch.ExcludeWeaponOwnerFromAreaOfEffect.HasValue) { weaponAttributesWrapper.ExcludeWeaponOwnerFromAreaOfEffect = weaponAttributesPatch.ExcludeWeaponOwnerFromAreaOfEffect.Value; } - if (weaponAttributesPatch.FriendlyFireDamageScalar.HasValue) { weaponAttributesWrapper.FriendlyFireDamageScalar = Fixed64.UnsafeFromDouble(weaponAttributesPatch.FriendlyFireDamageScalar.Value); } - if (weaponAttributesPatch.WeaponOwnerFriendlyFireDamageScalar.HasValue) { weaponAttributesWrapper.WeaponOwnerFriendlyFireDamageScalar = Fixed64.UnsafeFromDouble(weaponAttributesPatch.WeaponOwnerFriendlyFireDamageScalar.Value); } - if (weaponAttributesPatch.ProjectileEntityTypeToSpawn != null) { weaponAttributesWrapper.ProjectileEntityTypeToSpawn = weaponAttributesPatch.ProjectileEntityTypeToSpawn; } - if (weaponAttributesPatch.StatusEffectsTargetAlignment.HasValue) { weaponAttributesWrapper.StatusEffectsTargetAlignment = weaponAttributesPatch.StatusEffectsTargetAlignment.Value; } - if (weaponAttributesPatch.StatusEffectsExcludeTargetType.HasValue) { weaponAttributesWrapper.StatusEffectsExcludeTargetType = weaponAttributesPatch.StatusEffectsExcludeTargetType.Value; } - if (weaponAttributesPatch.ActiveStatusEffectsIndex.HasValue) { weaponAttributesWrapper.ActiveStatusEffectsIndex = weaponAttributesPatch.ActiveStatusEffectsIndex.Value; } + applyPropertyPatch(weaponAttributesPatch.ExcludeFromAutoTargetAcquisition, () => weaponAttributesWrapper.ExcludeFromAutoTargetAcquisition); + applyPropertyPatch(weaponAttributesPatch.ExcludeFromAutoFire, () => weaponAttributesWrapper.ExcludeFromAutoFire); + applyPropertyPatch(weaponAttributesPatch.ExcludeFromHeightAdvantage, () => weaponAttributesWrapper.ExcludeFromHeightAdvantage); + applyPropertyPatch(weaponAttributesPatch.DamageType, () => weaponAttributesWrapper.DamageType); + applyPropertyPatch(weaponAttributesPatch.IsTracer, () => weaponAttributesWrapper.IsTracer); + applyPropertyPatch(weaponAttributesPatch.TracerSpeed, () => weaponAttributesWrapper.TracerSpeed, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(weaponAttributesPatch.TracerLength, () => weaponAttributesWrapper.TracerLength, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(weaponAttributesPatch.BaseDamagePerRound, () => weaponAttributesWrapper.BaseDamagePerRound, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(weaponAttributesPatch.BaseWreckDamagePerRound, () => weaponAttributesWrapper.BaseWreckDamagePerRound, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(weaponAttributesPatch.FiringRecoil, () => weaponAttributesWrapper.FiringRecoil); + applyPropertyPatch(weaponAttributesPatch.WindUpTimeMS, () => weaponAttributesWrapper.WindUpTimeMS); + applyPropertyPatch(weaponAttributesPatch.RateOfFire, () => weaponAttributesWrapper.RateOfFire); + applyPropertyPatch(weaponAttributesPatch.NumberOfBursts, () => weaponAttributesWrapper.NumberOfBursts); + applyPropertyPatch(weaponAttributesPatch.DamagePacketsPerShot, () => weaponAttributesWrapper.DamagePacketsPerShot); + applyPropertyPatch(weaponAttributesPatch.BurstPeriodMinTimeMS, () => weaponAttributesWrapper.BurstPeriodMinTimeMS); + applyPropertyPatch(weaponAttributesPatch.BurstPeriodMaxTimeMS, () => weaponAttributesWrapper.BurstPeriodMaxTimeMS); + applyPropertyPatch(weaponAttributesPatch.CooldownTimeMS, () => weaponAttributesWrapper.CooldownTimeMS); + applyPropertyPatch(weaponAttributesPatch.WindDownTimeMS, () => weaponAttributesWrapper.WindDownTimeMS); + applyPropertyPatch(weaponAttributesPatch.ReloadTimeMS, () => weaponAttributesWrapper.ReloadTimeMS); + applyPropertyPatch(weaponAttributesPatch.LineOfSightRequired, () => weaponAttributesWrapper.LineOfSightRequired); + applyPropertyPatch(weaponAttributesPatch.LeadsTarget, () => weaponAttributesWrapper.LeadsTarget); + applyPropertyPatch(weaponAttributesPatch.KillSkipsUnitDeathSequence, () => weaponAttributesWrapper.KillSkipsUnitDeathSequence); + applyPropertyPatch(weaponAttributesPatch.RevealTriggers, () => weaponAttributesWrapper.RevealTriggers); + applyPropertyPatch(weaponAttributesPatch.UnitStatusAttackingTriggers, () => weaponAttributesWrapper.UnitStatusAttackingTriggers); + applyPropertyPatch(weaponAttributesPatch.TargetStyle, () => weaponAttributesWrapper.TargetStyle); + applyPropertyPatch(weaponAttributesPatch.AreaOfEffectFalloffType, () => weaponAttributesWrapper.AreaOfEffectFalloffType); + applyPropertyPatch(weaponAttributesPatch.AreaOfEffectRadius, () => weaponAttributesWrapper.AreaOfEffectRadius, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(weaponAttributesPatch.ExcludeWeaponOwnerFromAreaOfEffect, () => weaponAttributesWrapper.ExcludeWeaponOwnerFromAreaOfEffect); + applyPropertyPatch(weaponAttributesPatch.FriendlyFireDamageScalar, () => weaponAttributesWrapper.FriendlyFireDamageScalar, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(weaponAttributesPatch.WeaponOwnerFriendlyFireDamageScalar, () => weaponAttributesWrapper.WeaponOwnerFriendlyFireDamageScalar, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(weaponAttributesPatch.ProjectileEntityTypeToSpawn, () => weaponAttributesWrapper.ProjectileEntityTypeToSpawn); + applyPropertyPatch(weaponAttributesPatch.StatusEffectsTargetAlignment, () => weaponAttributesWrapper.StatusEffectsTargetAlignment); + applyPropertyPatch(weaponAttributesPatch.StatusEffectsExcludeTargetType, () => weaponAttributesWrapper.StatusEffectsExcludeTargetType); + applyPropertyPatch(weaponAttributesPatch.ActiveStatusEffectsIndex, () => weaponAttributesWrapper.ActiveStatusEffectsIndex); } } } From f2bd990354f1964e20a54a6076622eba4093883b Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Sat, 20 Oct 2018 23:25:16 -0400 Subject: [PATCH 05/23] Add simple catch-all error logging --- Subsystem/AttributeLoader.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Subsystem/AttributeLoader.cs b/Subsystem/AttributeLoader.cs index c327d09..ac7d140 100644 --- a/Subsystem/AttributeLoader.cs +++ b/Subsystem/AttributeLoader.cs @@ -17,13 +17,20 @@ public class AttributeLoader public static void LoadAttributes(EntityTypeCollection entityTypeCollection) { - var jsonPath = Path.Combine(Application.dataPath, "patch.json"); - var json = File.ReadAllText(jsonPath); + try + { + var jsonPath = Path.Combine(Application.dataPath, "patch.json"); + var json = File.ReadAllText(jsonPath); - var attributesPatch = JsonMapper.ToObject(json); + var attributesPatch = JsonMapper.ToObject(json); - var loader = new AttributeLoader(); - loader.ApplyAttributesPatch(entityTypeCollection, attributesPatch); + var loader = new AttributeLoader(); + loader.ApplyAttributesPatch(entityTypeCollection, attributesPatch); + } + catch (Exception e) + { + Debug.LogWarning($"[SUBSYSTEM] Error applying patch file: {e}"); + } } public void ApplyAttributesPatch(EntityTypeCollection entityTypeCollection, AttributesPatch attributesPatch) From 0eb2121e5fe94ef6f4c97f8021ecb3baec0c6b11 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Sun, 21 Oct 2018 01:18:00 -0400 Subject: [PATCH 06/23] Add patch support for RangeBasedWeaponAttributes --- Subsystem/AttributeLoader.cs | 33 +++++++++++++++++++ Subsystem/RangeBasedWeaponAttributesPatch.cs | 9 +++++ .../RangeBasedWeaponAttributesWrapper.cs | 29 ++++++++++++++++ Subsystem/Subsystem.csproj | 2 ++ Subsystem/WeaponAttributesPatch.cs | 3 ++ 5 files changed, 76 insertions(+) create mode 100644 Subsystem/RangeBasedWeaponAttributesPatch.cs create mode 100644 Subsystem/RangeBasedWeaponAttributesWrapper.cs diff --git a/Subsystem/AttributeLoader.cs b/Subsystem/AttributeLoader.cs index ac7d140..24429d0 100644 --- a/Subsystem/AttributeLoader.cs +++ b/Subsystem/AttributeLoader.cs @@ -306,10 +306,43 @@ public void ApplyWeaponAttributesPatch(WeaponAttributesPatch weaponAttributesPat applyPropertyPatch(weaponAttributesPatch.ExcludeWeaponOwnerFromAreaOfEffect, () => weaponAttributesWrapper.ExcludeWeaponOwnerFromAreaOfEffect); applyPropertyPatch(weaponAttributesPatch.FriendlyFireDamageScalar, () => weaponAttributesWrapper.FriendlyFireDamageScalar, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(weaponAttributesPatch.WeaponOwnerFriendlyFireDamageScalar, () => weaponAttributesWrapper.WeaponOwnerFriendlyFireDamageScalar, x => Fixed64.UnsafeFromDouble(x)); + + applyRangeAttributes(WeaponRange.Short, weaponAttributesPatch.RangeAttributesShort, weaponAttributesWrapper); + applyRangeAttributes(WeaponRange.Medium, weaponAttributesPatch.RangeAttributesMedium, weaponAttributesWrapper); + applyRangeAttributes(WeaponRange.Long, weaponAttributesPatch.RangeAttributesLong, weaponAttributesWrapper); + applyPropertyPatch(weaponAttributesPatch.ProjectileEntityTypeToSpawn, () => weaponAttributesWrapper.ProjectileEntityTypeToSpawn); applyPropertyPatch(weaponAttributesPatch.StatusEffectsTargetAlignment, () => weaponAttributesWrapper.StatusEffectsTargetAlignment); applyPropertyPatch(weaponAttributesPatch.StatusEffectsExcludeTargetType, () => weaponAttributesWrapper.StatusEffectsExcludeTargetType); applyPropertyPatch(weaponAttributesPatch.ActiveStatusEffectsIndex, () => weaponAttributesWrapper.ActiveStatusEffectsIndex); } + + private void applyRangeAttributes(WeaponRange weaponRange, RangeBasedWeaponAttributesPatch rangePatch, WeaponAttributesWrapper weaponWrapper) + { + if (rangePatch == null) { return; } + + var ranges = weaponWrapper.Ranges; + + var range = ranges.SingleOrDefault(r => r.Range == weaponRange); + + var rangeWrapper = range != null + ? new RangeBasedWeaponAttributesWrapper(range) + : new RangeBasedWeaponAttributesWrapper(weaponRange); + + ApplyRangeBasedWeaponAttributesPatch(rangePatch, rangeWrapper); + + weaponWrapper.Ranges = + ranges.Where(r => r.Range < weaponRange) + .Concat(new[] { rangeWrapper }) + .Concat(ranges.Where(r => r.Range > weaponRange)) + .ToArray(); + } + + public void ApplyRangeBasedWeaponAttributesPatch(RangeBasedWeaponAttributesPatch rangePatch, RangeBasedWeaponAttributesWrapper rangeWrapper) + { + applyPropertyPatch(rangePatch.Accuracy, () => rangeWrapper.Accuracy, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(rangePatch.Distance, () => rangeWrapper.Distance, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(rangePatch.MinDistance, () => rangeWrapper.MinDistance, x => Fixed64.UnsafeFromDouble(x)); + } } } diff --git a/Subsystem/RangeBasedWeaponAttributesPatch.cs b/Subsystem/RangeBasedWeaponAttributesPatch.cs new file mode 100644 index 0000000..ed87f8d --- /dev/null +++ b/Subsystem/RangeBasedWeaponAttributesPatch.cs @@ -0,0 +1,9 @@ +namespace Subsystem +{ + public class RangeBasedWeaponAttributesPatch + { + public double? Accuracy { get; set; } + public double? Distance { get; set; } + public double? MinDistance { get; set; } + } +} diff --git a/Subsystem/RangeBasedWeaponAttributesWrapper.cs b/Subsystem/RangeBasedWeaponAttributesWrapper.cs new file mode 100644 index 0000000..1602886 --- /dev/null +++ b/Subsystem/RangeBasedWeaponAttributesWrapper.cs @@ -0,0 +1,29 @@ +using BBI.Core.Utility.FixedPoint; +using BBI.Game.Data; + +namespace Subsystem +{ + public class RangeBasedWeaponAttributesWrapper : RangeBasedWeaponAttributes + { + public RangeBasedWeaponAttributesWrapper(WeaponRange range) + { + Range = range; + } + + public RangeBasedWeaponAttributesWrapper(RangeBasedWeaponAttributes other) + { + Range = other.Range; + Accuracy = other.Accuracy; + Distance = other.Distance; + MinDistance = other.MinDistance; + } + + public WeaponRange Range { get; set; } + + public Fixed64 Accuracy { get; set; } + + public Fixed64 Distance { get; set; } + + public Fixed64 MinDistance { get; set; } + } +} diff --git a/Subsystem/Subsystem.csproj b/Subsystem/Subsystem.csproj index a99ece7..75402d8 100644 --- a/Subsystem/Subsystem.csproj +++ b/Subsystem/Subsystem.csproj @@ -50,6 +50,8 @@ + + diff --git a/Subsystem/WeaponAttributesPatch.cs b/Subsystem/WeaponAttributesPatch.cs index 5f01838..e102e26 100644 --- a/Subsystem/WeaponAttributesPatch.cs +++ b/Subsystem/WeaponAttributesPatch.cs @@ -33,6 +33,9 @@ public class WeaponAttributesPatch public bool? ExcludeWeaponOwnerFromAreaOfEffect { get; set; } public double? FriendlyFireDamageScalar { get; set; } public double? WeaponOwnerFriendlyFireDamageScalar { get; set; } + public RangeBasedWeaponAttributesPatch RangeAttributesShort { get; set; } + public RangeBasedWeaponAttributesPatch RangeAttributesMedium { get; set; } + public RangeBasedWeaponAttributesPatch RangeAttributesLong { get; set; } public string ProjectileEntityTypeToSpawn { get; set; } public AbilityTargetAlignment? StatusEffectsTargetAlignment { get; set; } public UnitClass? StatusEffectsExcludeTargetType { get; set; } From 66ca0d4c55829aff0fb5695c06dfd41366159bc3 Mon Sep 17 00:00:00 2001 From: AGameAnx Date: Sun, 21 Oct 2018 13:31:39 +0300 Subject: [PATCH 07/23] Add bad entity type, ability, weapon name reporting --- Subsystem/AttributeLoader.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Subsystem/AttributeLoader.cs b/Subsystem/AttributeLoader.cs index 24429d0..64ba619 100644 --- a/Subsystem/AttributeLoader.cs +++ b/Subsystem/AttributeLoader.cs @@ -42,6 +42,12 @@ public void ApplyAttributesPatch(EntityTypeCollection entityTypeCollection, Attr var entityType = entityTypeCollection.GetEntityType(entityTypeName); + if (entityType == null) + { + logger.WriteLine($"NOTICE: EntityType {entityTypeName} Not found"); + continue; + } + logger.WriteLine($"EntityType: {entityTypeName}"); logger.WriteLine(); @@ -81,6 +87,12 @@ public void ApplyAttributesPatch(EntityTypeCollection entityTypeCollection, Attr logger.WriteLine($" AbilityAttributes: {abilityAttributesName}"); var abilityAttributes = entityType.Get(abilityAttributesName); + if (abilityAttributes == null) + { + logger.WriteLine($"ERROR: Ability name {abilityAttributesName} not found"); + continue; + } + var abilityAttributesWrapper = new AbilityAttributesWrapper(abilityAttributes); ApplyAbilityAttributesPatch(abilityAttributesPatch, abilityAttributesWrapper); @@ -98,6 +110,12 @@ public void ApplyAttributesPatch(EntityTypeCollection entityTypeCollection, Attr logger.WriteLine($" WeaponAttributes: {weaponAttributesName}"); var weaponAttributes = entityType.Get(weaponAttributesName); + if (weaponAttributes == null) + { + logger.WriteLine($"ERROR: Weapon name {weaponAttributesName} not found"); + continue; + } + var weaponAttributesWrapper = new WeaponAttributesWrapper(weaponAttributes); ApplyWeaponAttributesPatch(weaponAttributesPatch, weaponAttributesWrapper); From 49586581c9c3c1420b6e09a686779b6293f0fa34 Mon Sep 17 00:00:00 2001 From: AGameAnx Date: Sun, 21 Oct 2018 18:16:53 +0300 Subject: [PATCH 08/23] Extra newline after notice/warnings --- Subsystem/AttributeLoader.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Subsystem/AttributeLoader.cs b/Subsystem/AttributeLoader.cs index 64ba619..1de2b63 100644 --- a/Subsystem/AttributeLoader.cs +++ b/Subsystem/AttributeLoader.cs @@ -41,10 +41,10 @@ public void ApplyAttributesPatch(EntityTypeCollection entityTypeCollection, Attr var entityTypePatch = kvp.Value; var entityType = entityTypeCollection.GetEntityType(entityTypeName); - if (entityType == null) { logger.WriteLine($"NOTICE: EntityType {entityTypeName} Not found"); + logger.WriteLine(); continue; } @@ -90,6 +90,7 @@ public void ApplyAttributesPatch(EntityTypeCollection entityTypeCollection, Attr if (abilityAttributes == null) { logger.WriteLine($"ERROR: Ability name {abilityAttributesName} not found"); + logger.WriteLine(); continue; } @@ -113,6 +114,7 @@ public void ApplyAttributesPatch(EntityTypeCollection entityTypeCollection, Attr if (weaponAttributes == null) { logger.WriteLine($"ERROR: Weapon name {weaponAttributesName} not found"); + logger.WriteLine(); continue; } From e4b5017b8e6ff49c56ec7070baca881ad3191471 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Sun, 21 Oct 2018 12:28:33 -0400 Subject: [PATCH 09/23] Support removal of range sections --- Subsystem/AttributeLoader.cs | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Subsystem/AttributeLoader.cs b/Subsystem/AttributeLoader.cs index 1de2b63..943e44b 100644 --- a/Subsystem/AttributeLoader.cs +++ b/Subsystem/AttributeLoader.cs @@ -339,23 +339,27 @@ public void ApplyWeaponAttributesPatch(WeaponAttributesPatch weaponAttributesPat private void applyRangeAttributes(WeaponRange weaponRange, RangeBasedWeaponAttributesPatch rangePatch, WeaponAttributesWrapper weaponWrapper) { - if (rangePatch == null) { return; } - var ranges = weaponWrapper.Ranges; var range = ranges.SingleOrDefault(r => r.Range == weaponRange); - var rangeWrapper = range != null - ? new RangeBasedWeaponAttributesWrapper(range) - : new RangeBasedWeaponAttributesWrapper(weaponRange); + if (rangePatch == null && range == null) { return; } + + var newRanges = ranges.Where(r => r.Range < weaponRange); + + if (rangePatch != null) + { + var rangeWrapper = range != null + ? new RangeBasedWeaponAttributesWrapper(range) + : new RangeBasedWeaponAttributesWrapper(weaponRange); + + ApplyRangeBasedWeaponAttributesPatch(rangePatch, rangeWrapper); + newRanges = newRanges.Concat(new[] { rangeWrapper }); + } - ApplyRangeBasedWeaponAttributesPatch(rangePatch, rangeWrapper); + newRanges = newRanges.Concat(ranges.Where(r => r.Range > weaponRange)); - weaponWrapper.Ranges = - ranges.Where(r => r.Range < weaponRange) - .Concat(new[] { rangeWrapper }) - .Concat(ranges.Where(r => r.Range > weaponRange)) - .ToArray(); + weaponWrapper.Ranges = newRanges.ToArray(); } public void ApplyRangeBasedWeaponAttributesPatch(RangeBasedWeaponAttributesPatch rangePatch, RangeBasedWeaponAttributesWrapper rangeWrapper) From 9926ff5efb472639a68c75915c83c9a20a62dcda Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Sun, 21 Oct 2018 12:46:14 -0400 Subject: [PATCH 10/23] Revert "Support removal of range sections" This reverts commit e4b5017b8e6ff49c56ec7070baca881ad3191471. --- Subsystem/AttributeLoader.cs | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/Subsystem/AttributeLoader.cs b/Subsystem/AttributeLoader.cs index 943e44b..1de2b63 100644 --- a/Subsystem/AttributeLoader.cs +++ b/Subsystem/AttributeLoader.cs @@ -339,27 +339,23 @@ public void ApplyWeaponAttributesPatch(WeaponAttributesPatch weaponAttributesPat private void applyRangeAttributes(WeaponRange weaponRange, RangeBasedWeaponAttributesPatch rangePatch, WeaponAttributesWrapper weaponWrapper) { + if (rangePatch == null) { return; } + var ranges = weaponWrapper.Ranges; var range = ranges.SingleOrDefault(r => r.Range == weaponRange); - if (rangePatch == null && range == null) { return; } - - var newRanges = ranges.Where(r => r.Range < weaponRange); - - if (rangePatch != null) - { - var rangeWrapper = range != null - ? new RangeBasedWeaponAttributesWrapper(range) - : new RangeBasedWeaponAttributesWrapper(weaponRange); - - ApplyRangeBasedWeaponAttributesPatch(rangePatch, rangeWrapper); - newRanges = newRanges.Concat(new[] { rangeWrapper }); - } + var rangeWrapper = range != null + ? new RangeBasedWeaponAttributesWrapper(range) + : new RangeBasedWeaponAttributesWrapper(weaponRange); - newRanges = newRanges.Concat(ranges.Where(r => r.Range > weaponRange)); + ApplyRangeBasedWeaponAttributesPatch(rangePatch, rangeWrapper); - weaponWrapper.Ranges = newRanges.ToArray(); + weaponWrapper.Ranges = + ranges.Where(r => r.Range < weaponRange) + .Concat(new[] { rangeWrapper }) + .Concat(ranges.Where(r => r.Range > weaponRange)) + .ToArray(); } public void ApplyRangeBasedWeaponAttributesPatch(RangeBasedWeaponAttributesPatch rangePatch, RangeBasedWeaponAttributesWrapper rangeWrapper) From 61eed4f2ef6afbada8a3a7ddb7c79e1e0c70f473 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Mon, 22 Oct 2018 07:40:34 -0400 Subject: [PATCH 11/23] Only rebind weapons which match the name of the weapon being changed --- Subsystem/AttributeLoader.cs | 37 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/Subsystem/AttributeLoader.cs b/Subsystem/AttributeLoader.cs index 1de2b63..512adb4 100644 --- a/Subsystem/AttributeLoader.cs +++ b/Subsystem/AttributeLoader.cs @@ -182,25 +182,24 @@ private static void rebindWeaponAttributes(EntityTypeAttributes entityType, Weap var unitAttributes = entityType.Get(); if (unitAttributes != null) { - var unitAttributesWrapper = new UnitAttributesWrapper(unitAttributes); - - var weaponLoadout = unitAttributesWrapper.WeaponLoadout.Select(weaponBinding => - 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 - ) - ); - - unitAttributesWrapper.WeaponLoadout = weaponLoadout.ToArray(); - - entityType.Replace(unitAttributes, unitAttributesWrapper); + 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 + ); + } + } } } From 88b960233ebe7f2a2208591f99260e68e2421874 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Mon, 22 Oct 2018 08:22:08 -0400 Subject: [PATCH 12/23] Use StringLogger to more cleanly format log output with scopes --- Subsystem/AttributeLoader.cs | 151 +++++++++++++++++------------------ Subsystem/StringLogger.cs | 130 ++++++++++++++++++++++++++++++ Subsystem/Subsystem.csproj | 1 + 3 files changed, 205 insertions(+), 77 deletions(-) create mode 100644 Subsystem/StringLogger.cs diff --git a/Subsystem/AttributeLoader.cs b/Subsystem/AttributeLoader.cs index 512adb4..add93bd 100644 --- a/Subsystem/AttributeLoader.cs +++ b/Subsystem/AttributeLoader.cs @@ -13,7 +13,7 @@ namespace Subsystem { public class AttributeLoader { - private readonly TextWriter logger = new StringWriter(); + private readonly StringLogger logger = new StringLogger(); public static void LoadAttributes(EntityTypeCollection entityTypeCollection) { @@ -41,96 +41,90 @@ public void ApplyAttributesPatch(EntityTypeCollection entityTypeCollection, Attr var entityTypePatch = kvp.Value; var entityType = entityTypeCollection.GetEntityType(entityTypeName); - if (entityType == null) - { - logger.WriteLine($"NOTICE: EntityType {entityTypeName} Not found"); - logger.WriteLine(); - continue; - } - - logger.WriteLine($"EntityType: {entityTypeName}"); - logger.WriteLine(); - - if (entityTypePatch.UnitAttributes != null) - { - logger.WriteLine($" UnitAttributes:"); - - var unitAttributes = entityType.Get(); - var unitAttributesWrapper = new UnitAttributesWrapper(unitAttributes); - - ApplyUnitAttributesPatch(entityTypePatch.UnitAttributes, unitAttributesWrapper); - - logger.WriteLine(); - entityType.Replace(unitAttributes, unitAttributesWrapper); - } - - if (entityTypePatch.ResearchItemAttributes != null) + using (logger.BeginScope($"EntityType: {entityTypeName}")) { - logger.WriteLine($" ResearchItemAttributes:"); - - var researchItemAttributes = entityType.Get(); - var researchItemAttributesWrapper = new ResearchItemAttributesWrapper(researchItemAttributes); + if (entityType == null) + { + logger.Log($"NOTICE: EntityType not found"); + continue; + } - ApplyResearchItemAttributesPatch(entityTypePatch.ResearchItemAttributes, researchItemAttributesWrapper); + if (entityTypePatch.UnitAttributes != null) + { + using (logger.BeginScope($"UnitAttributes:")) + { + var unitAttributes = entityType.Get(); + var unitAttributesWrapper = new UnitAttributesWrapper(unitAttributes); - logger.WriteLine(); + ApplyUnitAttributesPatch(entityTypePatch.UnitAttributes, unitAttributesWrapper); - entityType.Replace(researchItemAttributes, researchItemAttributesWrapper); - } + entityType.Replace(unitAttributes, unitAttributesWrapper); + } + } - foreach (var kvp2 in entityTypePatch.AbilityAttributes) - { - var abilityAttributesName = kvp2.Key; - var abilityAttributesPatch = kvp2.Value; + if (entityTypePatch.ResearchItemAttributes != null) + { + using (logger.BeginScope($"ResearchItemAttributes:")) + { + var researchItemAttributes = entityType.Get(); + var researchItemAttributesWrapper = new ResearchItemAttributesWrapper(researchItemAttributes); - logger.WriteLine($" AbilityAttributes: {abilityAttributesName}"); + ApplyResearchItemAttributesPatch(entityTypePatch.ResearchItemAttributes, researchItemAttributesWrapper); - var abilityAttributes = entityType.Get(abilityAttributesName); - if (abilityAttributes == null) - { - logger.WriteLine($"ERROR: Ability name {abilityAttributesName} not found"); - logger.WriteLine(); - continue; + entityType.Replace(researchItemAttributes, researchItemAttributesWrapper); + } } - var abilityAttributesWrapper = new AbilityAttributesWrapper(abilityAttributes); + foreach (var kvp2 in entityTypePatch.AbilityAttributes) + { + var abilityAttributesName = kvp2.Key; + var abilityAttributesPatch = kvp2.Value; - ApplyAbilityAttributesPatch(abilityAttributesPatch, abilityAttributesWrapper); + using (logger.BeginScope($"AbilityAttributes: {abilityAttributesName}")) + { + var abilityAttributes = entityType.Get(abilityAttributesName); + if (abilityAttributes == null) + { + logger.Log($"ERROR: AbilityAttributes not found"); + continue; + } - logger.WriteLine(); + var abilityAttributesWrapper = new AbilityAttributesWrapper(abilityAttributes); - entityType.Replace(abilityAttributes, abilityAttributesWrapper); - } + ApplyAbilityAttributesPatch(abilityAttributesPatch, abilityAttributesWrapper); - foreach (var kvp2 in entityTypePatch.WeaponAttributes) - { - var weaponAttributesName = kvp2.Key; - var weaponAttributesPatch = kvp2.Value; - - logger.WriteLine($" WeaponAttributes: {weaponAttributesName}"); + entityType.Replace(abilityAttributes, abilityAttributesWrapper); + } + } - var weaponAttributes = entityType.Get(weaponAttributesName); - if (weaponAttributes == null) + foreach (var kvp2 in entityTypePatch.WeaponAttributes) { - logger.WriteLine($"ERROR: Weapon name {weaponAttributesName} not found"); - logger.WriteLine(); - continue; - } + var weaponAttributesName = kvp2.Key; + var weaponAttributesPatch = kvp2.Value; - var weaponAttributesWrapper = new WeaponAttributesWrapper(weaponAttributes); + using (logger.BeginScope($"WeaponAttributes: {weaponAttributesName}")) + { + var weaponAttributes = entityType.Get(weaponAttributesName); + if (weaponAttributes == null) + { + logger.Log($"ERROR: WeaponAttributes not found"); + continue; + } - ApplyWeaponAttributesPatch(weaponAttributesPatch, weaponAttributesWrapper); + var weaponAttributesWrapper = new WeaponAttributesWrapper(weaponAttributes); - logger.WriteLine(); + ApplyWeaponAttributesPatch(weaponAttributesPatch, weaponAttributesWrapper); - entityType.Replace(weaponAttributes, weaponAttributesWrapper); + entityType.Replace(weaponAttributes, weaponAttributesWrapper); - rebindWeaponAttributes(entityType, weaponAttributesWrapper); + rebindWeaponAttributes(entityType, weaponAttributesWrapper); + } + } } } - Debug.Log($"[SUBSYSTEM] Applied attributes patch:\n\n{logger.ToString()}"); + Debug.Log($"[SUBSYSTEM] Applied attributes patch:\n\n{logger.GetLog()}"); } private void applyPropertyPatch(TProperty? newValue, Expression> expression) where TProperty : struct @@ -174,7 +168,7 @@ private void setProperty(TValue newValue, Expression r.Range == weaponRange); - var rangeWrapper = range != null - ? new RangeBasedWeaponAttributesWrapper(range) - : new RangeBasedWeaponAttributesWrapper(weaponRange); + using (logger.BeginScope($"RangeAttributes{weaponRange}:")) + { + var rangeWrapper = range != null + ? new RangeBasedWeaponAttributesWrapper(range) + : new RangeBasedWeaponAttributesWrapper(weaponRange); - ApplyRangeBasedWeaponAttributesPatch(rangePatch, rangeWrapper); + ApplyRangeBasedWeaponAttributesPatch(rangePatch, rangeWrapper); - weaponWrapper.Ranges = - ranges.Where(r => r.Range < weaponRange) - .Concat(new[] { rangeWrapper }) - .Concat(ranges.Where(r => r.Range > weaponRange)) - .ToArray(); + weaponWrapper.Ranges = + ranges.Where(r => r.Range < weaponRange) + .Concat(new[] { rangeWrapper }) + .Concat(ranges.Where(r => r.Range > weaponRange)) + .ToArray(); + } } public void ApplyRangeBasedWeaponAttributesPatch(RangeBasedWeaponAttributesPatch rangePatch, RangeBasedWeaponAttributesWrapper rangeWrapper) diff --git a/Subsystem/StringLogger.cs b/Subsystem/StringLogger.cs new file mode 100644 index 0000000..93e8f64 --- /dev/null +++ b/Subsystem/StringLogger.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; + +namespace Subsystem +{ + public class StringLogger + { + private readonly Stack scopes = new Stack(); + + public StringLogger() + { + scopes.Push(new Scope()); + } + + public IDisposable BeginScope(string name) + { + var scope = scopes.Peek(); + var newScope = scope.CreateScope(name); + scopes.Push(newScope); + return new ScopeDisposer(this); + } + + public void Log(string log) + { + scopes.Peek().AddLog(log); + } + + public string GetLog() + { + var writer = new StringWriter(); + WriteLog(writer); + return writer.ToString(); + } + + public void WriteLog(TextWriter writer) + { + writeLog(writer, scopes.Peek(), indent: 0); + } + + private void writeLog(TextWriter writer, Scope scope, int indent) + { + foreach (var logEntry in scope.LogEntries) + { + writeIndent(writer, indent); + writer.WriteLine(logEntry.Log); + } + + if (scope.LogEntries.Any()) + { + writer.WriteLine(); + } + + foreach (var kvp in scope.Scopes) + { + var childScopeName = kvp.Key; + var childScope = kvp.Value; + + writeIndent(writer, indent); + writer.WriteLine(childScopeName); + writer.WriteLine(); + + writeLog(writer, childScope, indent + 1); + } + } + + private static void writeIndent(TextWriter writer, int indent) + { + for (var i = 0; i < indent; i++) + { + writer.Write(" "); + } + } + + private class ScopeDisposer : IDisposable + { + private readonly StringLogger logger; + + public ScopeDisposer(StringLogger logger) + { + this.logger = logger; + } + + public void Dispose() + { + logger.scopes.Pop(); + } + } + + private class Scope + { + public IList> Scopes + { + get { return new ReadOnlyCollection>(scopes); } + } + + public IList LogEntries + { + get { return new ReadOnlyCollection(logEntries); } + } + + private readonly List> scopes = new List>(); + private readonly List logEntries = new List(); + + public void AddLog(string log) + { + logEntries.Add(new LogEntry(log)); + } + + public Scope CreateScope(string name) + { + var scope = new Scope(); + scopes.Add(new KeyValuePair(name, scope)); + return scope; + } + } + + private class LogEntry + { + public string Log { get; private set; } + + public LogEntry(string log) + { + Log = log; + } + } + } +} diff --git a/Subsystem/Subsystem.csproj b/Subsystem/Subsystem.csproj index 75402d8..0362b88 100644 --- a/Subsystem/Subsystem.csproj +++ b/Subsystem/Subsystem.csproj @@ -54,6 +54,7 @@ + From 35c90c93b3819ec264894e5ec7598b24dcda159f Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Mon, 22 Oct 2018 08:23:00 -0400 Subject: [PATCH 13/23] Write patch log to Subsystem.log --- Subsystem/AttributeLoader.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Subsystem/AttributeLoader.cs b/Subsystem/AttributeLoader.cs index add93bd..1c94e8b 100644 --- a/Subsystem/AttributeLoader.cs +++ b/Subsystem/AttributeLoader.cs @@ -124,7 +124,8 @@ public void ApplyAttributesPatch(EntityTypeCollection entityTypeCollection, Attr } } - Debug.Log($"[SUBSYSTEM] Applied attributes patch:\n\n{logger.GetLog()}"); + File.WriteAllText(Path.Combine(Application.dataPath, "Subsystem.log"), logger.GetLog()); + Debug.Log($"[SUBSYSTEM] Applied attributes patch. See Subsystem.log for details."); } private void applyPropertyPatch(TProperty? newValue, Expression> expression) where TProperty : struct From 5a4cd386de71e613b5232a07e2d1a9e153407955 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Mon, 22 Oct 2018 08:44:14 -0400 Subject: [PATCH 14/23] Add flag to remove weapon range --- Subsystem/AttributeLoader.cs | 27 +++++++++++++------- Subsystem/RangeBasedWeaponAttributesPatch.cs | 1 + 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Subsystem/AttributeLoader.cs b/Subsystem/AttributeLoader.cs index 1c94e8b..b382594 100644 --- a/Subsystem/AttributeLoader.cs +++ b/Subsystem/AttributeLoader.cs @@ -337,22 +337,31 @@ private void applyRangeAttributes(WeaponRange weaponRange, RangeBasedWeaponAttri var ranges = weaponWrapper.Ranges; + var newRanges = ranges.Where(r => r.Range < weaponRange); + var range = ranges.SingleOrDefault(r => r.Range == weaponRange); using (logger.BeginScope($"RangeAttributes{weaponRange}:")) { - var rangeWrapper = range != null - ? new RangeBasedWeaponAttributesWrapper(range) - : new RangeBasedWeaponAttributesWrapper(weaponRange); + if (rangePatch.Remove) + { + logger.Log("(removed)"); + } + else + { + var rangeWrapper = range != null + ? new RangeBasedWeaponAttributesWrapper(range) + : new RangeBasedWeaponAttributesWrapper(weaponRange); - ApplyRangeBasedWeaponAttributesPatch(rangePatch, rangeWrapper); + ApplyRangeBasedWeaponAttributesPatch(rangePatch, rangeWrapper); - weaponWrapper.Ranges = - ranges.Where(r => r.Range < weaponRange) - .Concat(new[] { rangeWrapper }) - .Concat(ranges.Where(r => r.Range > weaponRange)) - .ToArray(); + newRanges = newRanges.Concat(new[] { rangeWrapper }); + } } + + newRanges = newRanges.Concat(ranges.Where(r => r.Range > weaponRange)); + + weaponWrapper.Ranges = newRanges.ToArray(); } public void ApplyRangeBasedWeaponAttributesPatch(RangeBasedWeaponAttributesPatch rangePatch, RangeBasedWeaponAttributesWrapper rangeWrapper) diff --git a/Subsystem/RangeBasedWeaponAttributesPatch.cs b/Subsystem/RangeBasedWeaponAttributesPatch.cs index ed87f8d..245056d 100644 --- a/Subsystem/RangeBasedWeaponAttributesPatch.cs +++ b/Subsystem/RangeBasedWeaponAttributesPatch.cs @@ -5,5 +5,6 @@ public class RangeBasedWeaponAttributesPatch public double? Accuracy { get; set; } public double? Distance { get; set; } public double? MinDistance { get; set; } + public bool Remove { get; set; } } } From 9f54a8e347130d90759a2bcb314cb62a54fc5507 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Mon, 22 Oct 2018 08:47:33 -0400 Subject: [PATCH 15/23] Log creation of new weapon ranges --- Subsystem/AttributeLoader.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Subsystem/AttributeLoader.cs b/Subsystem/AttributeLoader.cs index b382594..8be56ee 100644 --- a/Subsystem/AttributeLoader.cs +++ b/Subsystem/AttributeLoader.cs @@ -349,9 +349,17 @@ private void applyRangeAttributes(WeaponRange weaponRange, RangeBasedWeaponAttri } else { - var rangeWrapper = range != null - ? new RangeBasedWeaponAttributesWrapper(range) - : new RangeBasedWeaponAttributesWrapper(weaponRange); + RangeBasedWeaponAttributesWrapper rangeWrapper; + + if (range != null) + { + rangeWrapper = new RangeBasedWeaponAttributesWrapper(range); + } + else + { + logger.Log("(created)"); + rangeWrapper = new RangeBasedWeaponAttributesWrapper(weaponRange); + } ApplyRangeBasedWeaponAttributesPatch(rangePatch, rangeWrapper); From f084f20403ce4c8084e1b299c152c7e0fa856ac3 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Mon, 22 Oct 2018 09:00:12 -0400 Subject: [PATCH 16/23] Add basic patch support for UnitHangarAttributes --- Subsystem/AttributeLoader.cs | 19 +++++++++++++++ Subsystem/EntityTypePatch.cs | 1 + Subsystem/Subsystem.csproj | 2 ++ Subsystem/UnitHangarAttributesPatch.cs | 8 +++++++ Subsystem/UnitHangarAttributesWrapper.cs | 30 ++++++++++++++++++++++++ 5 files changed, 60 insertions(+) create mode 100644 Subsystem/UnitHangarAttributesPatch.cs create mode 100644 Subsystem/UnitHangarAttributesWrapper.cs diff --git a/Subsystem/AttributeLoader.cs b/Subsystem/AttributeLoader.cs index 8be56ee..f146c08 100644 --- a/Subsystem/AttributeLoader.cs +++ b/Subsystem/AttributeLoader.cs @@ -76,6 +76,19 @@ public void ApplyAttributesPatch(EntityTypeCollection entityTypeCollection, Attr } } + if (entityTypePatch.UnitHangarAttributes != null) + { + using (logger.BeginScope($"UnitHangarAttributes:")) + { + var unitHangarAttributes = entityType.Get(); + var unitHangarAttributesWrapper = new UnitHangarAttributesWrapper(unitHangarAttributes); + + ApplyUnitHangarAttributesPatch(entityTypePatch.UnitHangarAttributes, unitHangarAttributesWrapper); + + entityType.Replace(unitHangarAttributes, unitHangarAttributesWrapper); + } + } + foreach (var kvp2 in entityTypePatch.AbilityAttributes) { var abilityAttributesName = kvp2.Key; @@ -378,5 +391,11 @@ public void ApplyRangeBasedWeaponAttributesPatch(RangeBasedWeaponAttributesPatch applyPropertyPatch(rangePatch.Distance, () => rangeWrapper.Distance, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(rangePatch.MinDistance, () => rangeWrapper.MinDistance, x => Fixed64.UnsafeFromDouble(x)); } + + public void ApplyUnitHangarAttributesPatch(UnitHangarAttributesPatch unitHangarPatch, UnitHangarAttributesWrapper unitHangarWrapper) + { + applyPropertyPatch(unitHangarPatch.AlignmentTime, () => unitHangarWrapper.AlignmentTime, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitHangarPatch.ApproachTime, () => unitHangarWrapper.ApproachTime, x => Fixed64.UnsafeFromDouble(x)); + } } } diff --git a/Subsystem/EntityTypePatch.cs b/Subsystem/EntityTypePatch.cs index d3dcad0..7cb7998 100644 --- a/Subsystem/EntityTypePatch.cs +++ b/Subsystem/EntityTypePatch.cs @@ -6,6 +6,7 @@ public class EntityTypePatch { public UnitAttributesPatch UnitAttributes { get; set; } public ResearchItemAttributesPatch ResearchItemAttributes { get; set; } + public UnitHangarAttributesPatch UnitHangarAttributes { get; set; } public Dictionary AbilityAttributes { get; set; } = new Dictionary(); public Dictionary WeaponAttributes { get; set; } = new Dictionary(); } diff --git a/Subsystem/Subsystem.csproj b/Subsystem/Subsystem.csproj index 0362b88..0c92fc7 100644 --- a/Subsystem/Subsystem.csproj +++ b/Subsystem/Subsystem.csproj @@ -57,6 +57,8 @@ + + diff --git a/Subsystem/UnitHangarAttributesPatch.cs b/Subsystem/UnitHangarAttributesPatch.cs new file mode 100644 index 0000000..f5787d4 --- /dev/null +++ b/Subsystem/UnitHangarAttributesPatch.cs @@ -0,0 +1,8 @@ +namespace Subsystem +{ + public class UnitHangarAttributesPatch + { + public double? AlignmentTime { get; set; } + public double? ApproachTime { get; set; } + } +} diff --git a/Subsystem/UnitHangarAttributesWrapper.cs b/Subsystem/UnitHangarAttributesWrapper.cs new file mode 100644 index 0000000..180ec33 --- /dev/null +++ b/Subsystem/UnitHangarAttributesWrapper.cs @@ -0,0 +1,30 @@ +using BBI.Core.Utility.FixedPoint; +using BBI.Game.Data; + +namespace Subsystem +{ + public class UnitHangarAttributesWrapper : UnitHangarAttributes + { + public UnitHangarAttributesWrapper(UnitHangarAttributes other) + { + HangarBays = other.HangarBays; + UnitDockingTriggers = other.UnitDockingTriggers; + HangarDockingTriggers = other.HangarDockingTriggers; + BoneResetTriggers = other.BoneResetTriggers; + AlignmentTime = other.AlignmentTime; + ApproachTime = other.ApproachTime; + } + + public HangarBay[] HangarBays { get; set; } + + public UnitDockingTrigger[] UnitDockingTriggers { get; set; } + + public HangarDockingTrigger[] HangarDockingTriggers { get; set; } + + public HangarDockingBoneResetTrigger[] BoneResetTriggers { get; set; } + + public Fixed64 AlignmentTime { get; set; } + + public Fixed64 ApproachTime { get; set; } + } +} From d40e83b5b006201a5c32bd4ff81f975e5918f928 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Mon, 22 Oct 2018 09:12:43 -0400 Subject: [PATCH 17/23] Add patch support for HangarBays --- Subsystem/AttributeLoader.cs | 42 +++++++++++++ Subsystem/HangarBayPatch.cs | 33 ++++++++++ Subsystem/HangarBayWrapper.cs | 87 ++++++++++++++++++++++++++ Subsystem/Subsystem.csproj | 2 + Subsystem/UnitHangarAttributesPatch.cs | 5 +- 5 files changed, 168 insertions(+), 1 deletion(-) create mode 100644 Subsystem/HangarBayPatch.cs create mode 100644 Subsystem/HangarBayWrapper.cs diff --git a/Subsystem/AttributeLoader.cs b/Subsystem/AttributeLoader.cs index f146c08..1df1ab8 100644 --- a/Subsystem/AttributeLoader.cs +++ b/Subsystem/AttributeLoader.cs @@ -396,6 +396,48 @@ public void ApplyUnitHangarAttributesPatch(UnitHangarAttributesPatch unitHangarP { applyPropertyPatch(unitHangarPatch.AlignmentTime, () => unitHangarWrapper.AlignmentTime, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(unitHangarPatch.ApproachTime, () => unitHangarWrapper.ApproachTime, x => Fixed64.UnsafeFromDouble(x)); + + for (var i = 0; i < unitHangarWrapper.HangarBays.Length; i++) + { + var hangarBay = unitHangarWrapper.HangarBays[i]; + if (unitHangarPatch.HangarBays.TryGetValue(hangarBay.Name, out var hangarBayPatch)) + { + using (logger.BeginScope($"HangarBay: {hangarBay.Name}")) + { + var hangarBayWrapper = new HangarBayWrapper(hangarBay); + ApplyHangarBayPatch(hangarBayPatch, hangarBayWrapper); + unitHangarWrapper.HangarBays[i] = hangarBayWrapper; + } + } + } + } + + public void ApplyHangarBayPatch(HangarBayPatch hangarBayPatch, HangarBayWrapper hangarBayWrapper) + { + applyPropertyPatch(hangarBayPatch.EntityType, () => hangarBayWrapper.EntityType); + applyPropertyPatch(hangarBayPatch.MaxCount, () => hangarBayWrapper.MaxCount); + applyPropertyPatch(hangarBayPatch.UsesStrictClassMatching, () => hangarBayWrapper.UsesStrictClassMatching); + applyPropertyPatch(hangarBayPatch.HoldsClass, () => hangarBayWrapper.HoldsClass); + applyPropertyPatch(hangarBayPatch.SlotCount, () => hangarBayWrapper.SlotCount); + applyPropertyPatch(hangarBayPatch.UndockPresCtrlBone, () => hangarBayWrapper.UndockPresCtrlBone); + applyPropertyPatch(hangarBayPatch.UndockTotalSeconds, () => hangarBayWrapper.UndockTotalSeconds, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(hangarBayPatch.UndockAnimationSeconds, () => hangarBayWrapper.UndockAnimationSeconds, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(hangarBayPatch.UndockSlotStaggerSeconds, () => hangarBayWrapper.UndockSlotStaggerSeconds, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(hangarBayPatch.UndockXOffsetPos, () => hangarBayWrapper.UndockXOffsetPos, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(hangarBayPatch.UndockYOffsetPos, () => hangarBayWrapper.UndockYOffsetPos, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(hangarBayPatch.UndockSlotXSeperationOffset, () => hangarBayWrapper.UndockSlotXSeperationOffset, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(hangarBayPatch.DegreesOffsetUndockAngle, () => hangarBayWrapper.DegreesOffsetUndockAngle, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(hangarBayPatch.UndockSpeed, () => hangarBayWrapper.UndockSpeed, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(hangarBayPatch.DockPresCtrlBone, () => hangarBayWrapper.DockPresCtrlBone); + applyPropertyPatch(hangarBayPatch.DockBringInAnimationSeconds, () => hangarBayWrapper.DockBringInAnimationSeconds, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(hangarBayPatch.DockSlotStaggerSeconds, () => hangarBayWrapper.DockSlotStaggerSeconds, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(hangarBayPatch.MaxDamageCoolingSeconds, () => hangarBayWrapper.MaxDamageCoolingSeconds, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(hangarBayPatch.MaxPayloadCoolingSeconds, () => hangarBayWrapper.MaxPayloadCoolingSeconds, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(hangarBayPatch.MinDockCoolingSeconds, () => hangarBayWrapper.MinDockCoolingSeconds, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(hangarBayPatch.DockReceivingXOffset, () => hangarBayWrapper.DockReceivingXOffset, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(hangarBayPatch.DockReceivingYOffset, () => hangarBayWrapper.DockReceivingYOffset, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(hangarBayPatch.DoorAnimationSeconds, () => hangarBayWrapper.DoorAnimationSeconds, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(hangarBayPatch.UndockLiftTime, () => hangarBayWrapper.UndockLiftTime, x => Fixed64.UnsafeFromDouble(x)); } } } diff --git a/Subsystem/HangarBayPatch.cs b/Subsystem/HangarBayPatch.cs new file mode 100644 index 0000000..8c28656 --- /dev/null +++ b/Subsystem/HangarBayPatch.cs @@ -0,0 +1,33 @@ +using BBI.Game.Data; + +namespace Subsystem +{ + public class HangarBayPatch + { + public string EntityType { get; set; } + public int? MaxCount { get; set; } + public bool? UsesStrictClassMatching { get; set; } + public UnitClass? HoldsClass { get; set; } + public int? SlotCount { get; set; } + public string UndockPresCtrlBone { get; set; } + public double? UndockTotalSeconds { get; set; } + public double? UndockAnimationSeconds { get; set; } + public double? UndockSlotStaggerSeconds { get; set; } + public double? UndockXOffsetPos { get; set; } + public double? UndockYOffsetPos { get; set; } + public double? UndockSlotXSeperationOffset { get; set; } + public double? DegreesOffsetUndockAngle { get; set; } + public double? UndockSpeed { get; set; } + public string DockPresCtrlBone { get; set; } + public double? DockBringInAnimationSeconds { get; set; } + public double? DockSlotStaggerSeconds { get; set; } + public double? MaxDamageCoolingSeconds { get; set; } + public double? MaxPayloadCoolingSeconds { get; set; } + public double? MinDockCoolingSeconds { get; set; } + public double? DockReceivingXOffset { get; set; } + public double? DockReceivingYOffset { get; set; } + public double? DoorAnimationSeconds { get; set; } + public double? UndockLiftTime { get; set; } + + } +} diff --git a/Subsystem/HangarBayWrapper.cs b/Subsystem/HangarBayWrapper.cs new file mode 100644 index 0000000..46b18e8 --- /dev/null +++ b/Subsystem/HangarBayWrapper.cs @@ -0,0 +1,87 @@ +using BBI.Core.Utility.FixedPoint; +using BBI.Game.Data; + +namespace Subsystem +{ + public class HangarBayWrapper : HangarBay + { + public HangarBayWrapper(HangarBay other) + { + Name = other.Name; + EntityType = other.EntityType; + MaxCount = other.MaxCount; + UsesStrictClassMatching = other.UsesStrictClassMatching; + HoldsClass = other.HoldsClass; + SlotCount = other.SlotCount; + UndockPresCtrlBone = other.UndockPresCtrlBone; + UndockTotalSeconds = other.UndockTotalSeconds; + UndockAnimationSeconds = other.UndockAnimationSeconds; + UndockSlotStaggerSeconds = other.UndockSlotStaggerSeconds; + UndockXOffsetPos = other.UndockXOffsetPos; + UndockYOffsetPos = other.UndockYOffsetPos; + UndockSlotXSeperationOffset = other.UndockSlotXSeperationOffset; + DegreesOffsetUndockAngle = other.DegreesOffsetUndockAngle; + UndockSpeed = other.UndockSpeed; + DockPresCtrlBone = other.DockPresCtrlBone; + DockBringInAnimationSeconds = other.DockBringInAnimationSeconds; + DockSlotStaggerSeconds = other.DockSlotStaggerSeconds; + MaxDamageCoolingSeconds = other.MaxDamageCoolingSeconds; + MaxPayloadCoolingSeconds = other.MaxPayloadCoolingSeconds; + MinDockCoolingSeconds = other.MinDockCoolingSeconds; + DockReceivingXOffset = other.DockReceivingXOffset; + DockReceivingYOffset = other.DockReceivingYOffset; + DoorAnimationSeconds = other.DoorAnimationSeconds; + UndockLiftTime = other.UndockLiftTime; + } + + public string Name { get; set; } + + public string EntityType { get; set; } + + public int MaxCount { get; set; } + + public bool UsesStrictClassMatching { get; set; } + + public UnitClass HoldsClass { get; set; } + + public int SlotCount { get; set; } + + public string UndockPresCtrlBone { get; set; } + + public Fixed64 UndockTotalSeconds { get; set; } + + public Fixed64 UndockAnimationSeconds { get; set; } + + public Fixed64 UndockSlotStaggerSeconds { get; set; } + + public Fixed64 UndockXOffsetPos { get; set; } + + public Fixed64 UndockYOffsetPos { get; set; } + + public Fixed64 UndockSlotXSeperationOffset { get; set; } + + public Fixed64 DegreesOffsetUndockAngle { get; set; } + + public Fixed64 UndockSpeed { get; set; } + + public string DockPresCtrlBone { get; set; } + + public Fixed64 DockBringInAnimationSeconds { get; set; } + + public Fixed64 DockSlotStaggerSeconds { get; set; } + + public Fixed64 MaxDamageCoolingSeconds { get; set; } + + public Fixed64 MaxPayloadCoolingSeconds { get; set; } + + public Fixed64 MinDockCoolingSeconds { get; set; } + + public Fixed64 DockReceivingXOffset { get; set; } + + public Fixed64 DockReceivingYOffset { get; set; } + + public Fixed64 DoorAnimationSeconds { get; set; } + + public Fixed64 UndockLiftTime { get; set; } + } +} diff --git a/Subsystem/Subsystem.csproj b/Subsystem/Subsystem.csproj index 0c92fc7..853c440 100644 --- a/Subsystem/Subsystem.csproj +++ b/Subsystem/Subsystem.csproj @@ -48,6 +48,8 @@ + + diff --git a/Subsystem/UnitHangarAttributesPatch.cs b/Subsystem/UnitHangarAttributesPatch.cs index f5787d4..f03d2c7 100644 --- a/Subsystem/UnitHangarAttributesPatch.cs +++ b/Subsystem/UnitHangarAttributesPatch.cs @@ -1,7 +1,10 @@ -namespace Subsystem +using System.Collections.Generic; + +namespace Subsystem { public class UnitHangarAttributesPatch { + public Dictionary HangarBays { get; set; } = new Dictionary(); public double? AlignmentTime { get; set; } public double? ApproachTime { get; set; } } From 68b8ff655c32fc2210f1464305edaed93e7e5339 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Mon, 22 Oct 2018 09:41:44 -0400 Subject: [PATCH 18/23] Clone array to sidestep covariance issues --- Subsystem/UnitHangarAttributesWrapper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Subsystem/UnitHangarAttributesWrapper.cs b/Subsystem/UnitHangarAttributesWrapper.cs index 180ec33..f2fed4a 100644 --- a/Subsystem/UnitHangarAttributesWrapper.cs +++ b/Subsystem/UnitHangarAttributesWrapper.cs @@ -1,5 +1,6 @@ using BBI.Core.Utility.FixedPoint; using BBI.Game.Data; +using System.Linq; namespace Subsystem { @@ -7,7 +8,7 @@ public class UnitHangarAttributesWrapper : UnitHangarAttributes { public UnitHangarAttributesWrapper(UnitHangarAttributes other) { - HangarBays = other.HangarBays; + HangarBays = other.HangarBays.ToArray(); UnitDockingTriggers = other.UnitDockingTriggers; HangarDockingTriggers = other.HangarDockingTriggers; BoneResetTriggers = other.BoneResetTriggers; From bf98d6853c225627866b1bdcd1ff9a582b724e29 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Mon, 22 Oct 2018 09:55:05 -0400 Subject: [PATCH 19/23] Add basic patch support for UnitMovementAttributes --- Subsystem/AttributeLoader.cs | 18 +++++++++++ Subsystem/EntityTypePatch.cs | 1 + Subsystem/Subsystem.csproj | 2 ++ Subsystem/UnitMovementAttributesPatch.cs | 9 ++++++ Subsystem/UnitMovementAttributesWrapper.cs | 35 ++++++++++++++++++++++ 5 files changed, 65 insertions(+) create mode 100644 Subsystem/UnitMovementAttributesPatch.cs create mode 100644 Subsystem/UnitMovementAttributesWrapper.cs diff --git a/Subsystem/AttributeLoader.cs b/Subsystem/AttributeLoader.cs index 1df1ab8..5f5283e 100644 --- a/Subsystem/AttributeLoader.cs +++ b/Subsystem/AttributeLoader.cs @@ -89,6 +89,19 @@ public void ApplyAttributesPatch(EntityTypeCollection entityTypeCollection, Attr } } + if (entityTypePatch.UnitMovementAttributes != null) + { + using (logger.BeginScope($"UnitMovementAttributes:")) + { + var unitMovementAttributes = entityType.Get(); + var unitMovementAttributesWrapper = new UnitMovementAttributesWrapper(unitMovementAttributes); + + ApplyUnitMovementAttributesPatch(entityTypePatch.UnitMovementAttributes, unitMovementAttributesWrapper); + + entityType.Replace(unitMovementAttributes, unitMovementAttributesWrapper); + } + } + foreach (var kvp2 in entityTypePatch.AbilityAttributes) { var abilityAttributesName = kvp2.Key; @@ -439,5 +452,10 @@ public void ApplyHangarBayPatch(HangarBayPatch hangarBayPatch, HangarBayWrapper applyPropertyPatch(hangarBayPatch.DoorAnimationSeconds, () => hangarBayWrapper.DoorAnimationSeconds, x => Fixed64.UnsafeFromDouble(x)); applyPropertyPatch(hangarBayPatch.UndockLiftTime, () => hangarBayWrapper.UndockLiftTime, x => Fixed64.UnsafeFromDouble(x)); } + + public void ApplyUnitMovementAttributesPatch(UnitMovementAttributesPatch unitMovementAttributesPatch, UnitMovementAttributesWrapper unitMovementAttributesWrapper) + { + applyPropertyPatch(unitMovementAttributesPatch.DriveType, () => unitMovementAttributesWrapper.DriveType); + } } } diff --git a/Subsystem/EntityTypePatch.cs b/Subsystem/EntityTypePatch.cs index 7cb7998..d721181 100644 --- a/Subsystem/EntityTypePatch.cs +++ b/Subsystem/EntityTypePatch.cs @@ -7,6 +7,7 @@ public class EntityTypePatch public UnitAttributesPatch UnitAttributes { get; set; } public ResearchItemAttributesPatch ResearchItemAttributes { get; set; } public UnitHangarAttributesPatch UnitHangarAttributes { get; set; } + public UnitMovementAttributesPatch UnitMovementAttributes { get; set; } public Dictionary AbilityAttributes { get; set; } = new Dictionary(); public Dictionary WeaponAttributes { get; set; } = new Dictionary(); } diff --git a/Subsystem/Subsystem.csproj b/Subsystem/Subsystem.csproj index 853c440..08caeca 100644 --- a/Subsystem/Subsystem.csproj +++ b/Subsystem/Subsystem.csproj @@ -61,6 +61,8 @@ + + diff --git a/Subsystem/UnitMovementAttributesPatch.cs b/Subsystem/UnitMovementAttributesPatch.cs new file mode 100644 index 0000000..f0a934b --- /dev/null +++ b/Subsystem/UnitMovementAttributesPatch.cs @@ -0,0 +1,9 @@ +using BBI.Game.Data; + +namespace Subsystem +{ + public class UnitMovementAttributesPatch + { + public UnitDriveType? DriveType { get; set; } + } +} diff --git a/Subsystem/UnitMovementAttributesWrapper.cs b/Subsystem/UnitMovementAttributesWrapper.cs new file mode 100644 index 0000000..c66ac0a --- /dev/null +++ b/Subsystem/UnitMovementAttributesWrapper.cs @@ -0,0 +1,35 @@ +using BBI.Game.Data; + +namespace Subsystem +{ + public class UnitMovementAttributesWrapper : UnitMovementAttributes + { + public UnitMovementAttributesWrapper(UnitMovementAttributes other) + { + DriveType = other.DriveType; + Dynamics = other.Dynamics; + RandomDynamicsVariance = other.RandomDynamicsVariance; + Maneuvers = other.Maneuvers; + Hover = other.Hover; + Combat = other.Combat; + Avoidance = other.Avoidance; + ReversePolarity = other.ReversePolarity; + } + + public UnitDriveType DriveType { get; set; } + + public UnitDynamicsAttributes Dynamics { get; set; } + + public UnitDynamicsRandomizationParameters RandomDynamicsVariance { get; set; } + + public UnitManeuverAttributes Maneuvers { get; set; } + + public HoverDynamicsAttributes Hover { get; set; } + + public UnitCombatBehavior Combat { get; set; } + + public UnitAvoidanceAttributes Avoidance { get; set; } + + public ReversePolarityAttributes ReversePolarity { get; set; } + } +} From 59e328b87034345bdb6c78a465d1e640f6e2b5c6 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Mon, 22 Oct 2018 10:04:10 -0400 Subject: [PATCH 20/23] Add patch support for simple UnitDynamicsAttributes properties --- Subsystem/AttributeLoader.cs | 33 ++++++++++ Subsystem/Subsystem.csproj | 2 + Subsystem/UnitDynamicsAttributesPatch.cs | 28 ++++++++ Subsystem/UnitDynamicsAttributesWrapper.cs | 76 ++++++++++++++++++++++ Subsystem/UnitMovementAttributesPatch.cs | 1 + 5 files changed, 140 insertions(+) create mode 100644 Subsystem/UnitDynamicsAttributesPatch.cs create mode 100644 Subsystem/UnitDynamicsAttributesWrapper.cs diff --git a/Subsystem/AttributeLoader.cs b/Subsystem/AttributeLoader.cs index 5f5283e..8a96ba6 100644 --- a/Subsystem/AttributeLoader.cs +++ b/Subsystem/AttributeLoader.cs @@ -456,6 +456,39 @@ public void ApplyHangarBayPatch(HangarBayPatch hangarBayPatch, HangarBayWrapper public void ApplyUnitMovementAttributesPatch(UnitMovementAttributesPatch unitMovementAttributesPatch, UnitMovementAttributesWrapper unitMovementAttributesWrapper) { applyPropertyPatch(unitMovementAttributesPatch.DriveType, () => unitMovementAttributesWrapper.DriveType); + + if (unitMovementAttributesPatch.Dynamics != null) + { + using (logger.BeginScope($"UnitDynamicsAttributes:")) + { + var unitDynamicsAttributesWrapper = new UnitDynamicsAttributesWrapper(unitMovementAttributesWrapper.Dynamics); + ApplyUnitDynamicsAttributesPatch(unitMovementAttributesPatch.Dynamics, unitDynamicsAttributesWrapper); + unitMovementAttributesWrapper.Dynamics = unitDynamicsAttributesWrapper; + } + } + } + + private void ApplyUnitDynamicsAttributesPatch(UnitDynamicsAttributesPatch unitDynamicsAttributesPatch, UnitDynamicsAttributesWrapper unitDynamicsAttributesWrapper) + { + applyPropertyPatch(unitDynamicsAttributesPatch.DriveType, () => unitDynamicsAttributesWrapper.DriveType); + applyPropertyPatch(unitDynamicsAttributesPatch.Length, () => unitDynamicsAttributesWrapper.Length, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitDynamicsAttributesPatch.Width, () => unitDynamicsAttributesWrapper.Width, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitDynamicsAttributesPatch.MaxSpeed, () => unitDynamicsAttributesWrapper.MaxSpeed, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitDynamicsAttributesPatch.ReverseFactor, () => unitDynamicsAttributesWrapper.ReverseFactor, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitDynamicsAttributesPatch.AccelerationTime, () => unitDynamicsAttributesWrapper.AccelerationTime, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitDynamicsAttributesPatch.BrakingTime, () => unitDynamicsAttributesWrapper.BrakingTime, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitDynamicsAttributesPatch.MaxSpeedTurnRadius, () => unitDynamicsAttributesWrapper.MaxSpeedTurnRadius, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitDynamicsAttributesPatch.MaxEaseIntoTurnTime, () => unitDynamicsAttributesWrapper.MaxEaseIntoTurnTime, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitDynamicsAttributesPatch.DriftType, () => unitDynamicsAttributesWrapper.DriftType, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitDynamicsAttributesPatch.ReverseDriftMultiplier, () => unitDynamicsAttributesWrapper.ReverseDriftMultiplier, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitDynamicsAttributesPatch.DriftOvershootFactor, () => unitDynamicsAttributesWrapper.DriftOvershootFactor, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitDynamicsAttributesPatch.FishTailingTimeIntervals, () => unitDynamicsAttributesWrapper.FishTailingTimeIntervals, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitDynamicsAttributesPatch.FishTailControlRecover, () => unitDynamicsAttributesWrapper.FishTailControlRecover, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitDynamicsAttributesPatch.MinDriftSlipSpeed, () => unitDynamicsAttributesWrapper.MinDriftSlipSpeed, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitDynamicsAttributesPatch.MaxDriftRecoverTime, () => unitDynamicsAttributesWrapper.MaxDriftRecoverTime, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitDynamicsAttributesPatch.MinCruiseSpeed, () => unitDynamicsAttributesWrapper.MinCruiseSpeed, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitDynamicsAttributesPatch.DeathDriftTime, () => unitDynamicsAttributesWrapper.DeathDriftTime, x => Fixed64.UnsafeFromDouble(x)); + applyPropertyPatch(unitDynamicsAttributesPatch.PermanentlyImmobile, () => unitDynamicsAttributesWrapper.PermanentlyImmobile); } } } diff --git a/Subsystem/Subsystem.csproj b/Subsystem/Subsystem.csproj index 08caeca..4eee61d 100644 --- a/Subsystem/Subsystem.csproj +++ b/Subsystem/Subsystem.csproj @@ -59,6 +59,8 @@ + + diff --git a/Subsystem/UnitDynamicsAttributesPatch.cs b/Subsystem/UnitDynamicsAttributesPatch.cs new file mode 100644 index 0000000..fb1c2d9 --- /dev/null +++ b/Subsystem/UnitDynamicsAttributesPatch.cs @@ -0,0 +1,28 @@ +using BBI.Game.Data; + +namespace Subsystem +{ + public class UnitDynamicsAttributesPatch + { + public UnitDriveType? DriveType { get; set; } + public double? Length { get; set; } + public double? Width { get; set; } + public double? MaxSpeed { get; set; } + public double? ReverseFactor { get; set; } + public double? AccelerationTime { get; set; } + public double? BrakingTime { get; set; } + public double? MaxSpeedTurnRadius { get; set; } + public double? MaxEaseIntoTurnTime { get; set; } + public double? DriftType { get; set; } + public double? ReverseDriftMultiplier { get; set; } + public double? DriftOvershootFactor { get; set; } + public double? FishTailingTimeIntervals { get; set; } + public double? FishTailControlRecover { get; set; } + public double? MinDriftSlipSpeed { get; set; } + public double? MaxDriftRecoverTime { get; set; } + public double? MinCruiseSpeed { get; set; } + public double? DeathDriftTime { get; set; } + public bool? PermanentlyImmobile { get; set; } + + } +} diff --git a/Subsystem/UnitDynamicsAttributesWrapper.cs b/Subsystem/UnitDynamicsAttributesWrapper.cs new file mode 100644 index 0000000..33ca35e --- /dev/null +++ b/Subsystem/UnitDynamicsAttributesWrapper.cs @@ -0,0 +1,76 @@ +using BBI.Core.Utility; +using BBI.Core.Utility.FixedPoint; +using BBI.Game.Data; + +namespace Subsystem +{ + public class UnitDynamicsAttributesWrapper : UnitDynamicsAttributes + { + public UnitDynamicsAttributesWrapper(UnitDynamicsAttributes other) + { + DriveType = other.DriveType; + Length = other.Length; + Width = other.Width; + MaxSpeed = other.MaxSpeed; + ReverseFactor = other.ReverseFactor; + AccelerationTime = other.AccelerationTime; + BrakingTime = other.BrakingTime; + MaxSpeedTurnRadius = other.MaxSpeedTurnRadius; + MaxEaseIntoTurnTime = other.MaxEaseIntoTurnTime; + DriftType = other.DriftType; + ReverseDriftMultiplier = other.ReverseDriftMultiplier; + DriftOvershootFactor = other.DriftOvershootFactor; + FishTailingTimeIntervals = other.FishTailingTimeIntervals; + FishTailControlRecover = other.FishTailControlRecover; + MinDriftSlipSpeed = other.MinDriftSlipSpeed; + MaxDriftRecoverTime = other.MaxDriftRecoverTime; + MinCruiseSpeed = other.MinCruiseSpeed; + DeathDriftTime = other.DeathDriftTime; + PermanentlyImmobile = other.PermanentlyImmobile; + CruiseSpeedVariation = other.CruiseSpeedVariation; + CruiseDirectionVariation = other.CruiseDirectionVariation; + } + + public UnitDriveType DriveType { get; set; } + + public Fixed64 Length { get; set; } + + public Fixed64 Width { get; set; } + + public Fixed64 MaxSpeed { get; set; } + + public Fixed64 ReverseFactor { get; set; } + + public Fixed64 AccelerationTime { get; set; } + + public Fixed64 BrakingTime { get; set; } + + public Fixed64 MaxSpeedTurnRadius { get; set; } + + public Fixed64 MaxEaseIntoTurnTime { get; set; } + + public Fixed64 DriftType { get; set; } + + public Fixed64 ReverseDriftMultiplier { get; set; } + + public Fixed64 DriftOvershootFactor { get; set; } + + public Fixed64 FishTailingTimeIntervals { get; set; } + + public Fixed64 FishTailControlRecover { get; set; } + + public Fixed64 MinDriftSlipSpeed { get; set; } + + public Fixed64 MaxDriftRecoverTime { get; set; } + + public Fixed64 MinCruiseSpeed { get; set; } + + public Fixed64 DeathDriftTime { get; set; } + + public bool PermanentlyImmobile { get; set; } + + public WaveletAttributes[] CruiseSpeedVariation { get; set; } + + public WaveletAttributes[] CruiseDirectionVariation { get; set; } + } +} diff --git a/Subsystem/UnitMovementAttributesPatch.cs b/Subsystem/UnitMovementAttributesPatch.cs index f0a934b..74fb610 100644 --- a/Subsystem/UnitMovementAttributesPatch.cs +++ b/Subsystem/UnitMovementAttributesPatch.cs @@ -5,5 +5,6 @@ namespace Subsystem public class UnitMovementAttributesPatch { public UnitDriveType? DriveType { get; set; } + public UnitDynamicsAttributesPatch Dynamics { get; set; } } } From cc0b121105ae9431306c6c9008cdc0e672715b5a Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Mon, 22 Oct 2018 10:22:31 -0400 Subject: [PATCH 21/23] Reorganize patch and wrapper types into namespaces --- Subsystem/AttributeLoader.cs | 2 + .../{ => Patch}/AbilityAttributesPatch.cs | 2 +- Subsystem/{ => Patch}/AttributesPatch.cs | 2 +- Subsystem/{ => Patch}/EntityTypePatch.cs | 2 +- Subsystem/{ => Patch}/HangarBayPatch.cs | 2 +- .../RangeBasedWeaponAttributesPatch.cs | 2 +- .../ResearchItemAttributesPatch.cs | 2 +- Subsystem/{ => Patch}/UnitAttributesPatch.cs | 2 +- .../UnitDynamicsAttributesPatch.cs | 2 +- .../{ => Patch}/UnitHangarAttributesPatch.cs | 2 +- .../UnitMovementAttributesPatch.cs | 2 +- .../{ => Patch}/WeaponAttributesPatch.cs | 2 +- Subsystem/Subsystem.csproj | 42 +++++++++---------- .../AbilityAttributesWrapper.cs | 2 +- .../{ => Wrappers}/CostAttributesWrapper.cs | 2 +- Subsystem/{ => Wrappers}/HangarBayWrapper.cs | 2 +- .../RangeBasedWeaponAttributesWrapper.cs | 2 +- .../ResearchItemAttributesWrapper.cs | 2 +- .../{ => Wrappers}/UnitAttributesWrapper.cs | 2 +- .../UnitDynamicsAttributesWrapper.cs | 2 +- .../UnitHangarAttributesWrapper.cs | 2 +- .../UnitMovementAttributesWrapper.cs | 2 +- .../{ => Wrappers}/WeaponAttributesWrapper.cs | 2 +- 23 files changed, 44 insertions(+), 42 deletions(-) rename Subsystem/{ => Patch}/AbilityAttributesPatch.cs (97%) rename Subsystem/{ => Patch}/AttributesPatch.cs (88%) rename Subsystem/{ => Patch}/EntityTypePatch.cs (96%) rename Subsystem/{ => Patch}/HangarBayPatch.cs (98%) rename Subsystem/{ => Patch}/RangeBasedWeaponAttributesPatch.cs (89%) rename Subsystem/{ => Patch}/ResearchItemAttributesPatch.cs (96%) rename Subsystem/{ => Patch}/UnitAttributesPatch.cs (98%) rename Subsystem/{ => Patch}/UnitDynamicsAttributesPatch.cs (97%) rename Subsystem/{ => Patch}/UnitHangarAttributesPatch.cs (92%) rename Subsystem/{ => Patch}/UnitMovementAttributesPatch.cs (88%) rename Subsystem/{ => Patch}/WeaponAttributesPatch.cs (98%) rename Subsystem/{ => Wrappers}/AbilityAttributesWrapper.cs (99%) rename Subsystem/{ => Wrappers}/CostAttributesWrapper.cs (92%) rename Subsystem/{ => Wrappers}/HangarBayWrapper.cs (99%) rename Subsystem/{ => Wrappers}/RangeBasedWeaponAttributesWrapper.cs (96%) rename Subsystem/{ => Wrappers}/ResearchItemAttributesWrapper.cs (98%) rename Subsystem/{ => Wrappers}/UnitAttributesWrapper.cs (99%) rename Subsystem/{ => Wrappers}/UnitDynamicsAttributesWrapper.cs (98%) rename Subsystem/{ => Wrappers}/UnitHangarAttributesWrapper.cs (97%) rename Subsystem/{ => Wrappers}/UnitMovementAttributesWrapper.cs (97%) rename Subsystem/{ => Wrappers}/WeaponAttributesWrapper.cs (99%) diff --git a/Subsystem/AttributeLoader.cs b/Subsystem/AttributeLoader.cs index 8a96ba6..45d4f31 100644 --- a/Subsystem/AttributeLoader.cs +++ b/Subsystem/AttributeLoader.cs @@ -3,6 +3,8 @@ using BBI.Core.Utility.FixedPoint; using BBI.Game.Data; using LitJson; +using Subsystem.Patch; +using Subsystem.Wrappers; using System; using System.IO; using System.Linq; diff --git a/Subsystem/AbilityAttributesPatch.cs b/Subsystem/Patch/AbilityAttributesPatch.cs similarity index 97% rename from Subsystem/AbilityAttributesPatch.cs rename to Subsystem/Patch/AbilityAttributesPatch.cs index 835efad..ace6110 100644 --- a/Subsystem/AbilityAttributesPatch.cs +++ b/Subsystem/Patch/AbilityAttributesPatch.cs @@ -1,6 +1,6 @@ using BBI.Game.Data; -namespace Subsystem +namespace Subsystem.Patch { public class AbilityAttributesPatch { diff --git a/Subsystem/AttributesPatch.cs b/Subsystem/Patch/AttributesPatch.cs similarity index 88% rename from Subsystem/AttributesPatch.cs rename to Subsystem/Patch/AttributesPatch.cs index 0a2c8f7..40fb664 100644 --- a/Subsystem/AttributesPatch.cs +++ b/Subsystem/Patch/AttributesPatch.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Subsystem +namespace Subsystem.Patch { public class AttributesPatch { diff --git a/Subsystem/EntityTypePatch.cs b/Subsystem/Patch/EntityTypePatch.cs similarity index 96% rename from Subsystem/EntityTypePatch.cs rename to Subsystem/Patch/EntityTypePatch.cs index d721181..b43ba4e 100644 --- a/Subsystem/EntityTypePatch.cs +++ b/Subsystem/Patch/EntityTypePatch.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Subsystem +namespace Subsystem.Patch { public class EntityTypePatch { diff --git a/Subsystem/HangarBayPatch.cs b/Subsystem/Patch/HangarBayPatch.cs similarity index 98% rename from Subsystem/HangarBayPatch.cs rename to Subsystem/Patch/HangarBayPatch.cs index 8c28656..257f859 100644 --- a/Subsystem/HangarBayPatch.cs +++ b/Subsystem/Patch/HangarBayPatch.cs @@ -1,6 +1,6 @@ using BBI.Game.Data; -namespace Subsystem +namespace Subsystem.Patch { public class HangarBayPatch { diff --git a/Subsystem/RangeBasedWeaponAttributesPatch.cs b/Subsystem/Patch/RangeBasedWeaponAttributesPatch.cs similarity index 89% rename from Subsystem/RangeBasedWeaponAttributesPatch.cs rename to Subsystem/Patch/RangeBasedWeaponAttributesPatch.cs index 245056d..af11dbe 100644 --- a/Subsystem/RangeBasedWeaponAttributesPatch.cs +++ b/Subsystem/Patch/RangeBasedWeaponAttributesPatch.cs @@ -1,4 +1,4 @@ -namespace Subsystem +namespace Subsystem.Patch { public class RangeBasedWeaponAttributesPatch { diff --git a/Subsystem/ResearchItemAttributesPatch.cs b/Subsystem/Patch/ResearchItemAttributesPatch.cs similarity index 96% rename from Subsystem/ResearchItemAttributesPatch.cs rename to Subsystem/Patch/ResearchItemAttributesPatch.cs index f326f48..306fb1e 100644 --- a/Subsystem/ResearchItemAttributesPatch.cs +++ b/Subsystem/Patch/ResearchItemAttributesPatch.cs @@ -1,6 +1,6 @@ using BBI.Game.Data; -namespace Subsystem +namespace Subsystem.Patch { public class ResearchItemAttributesPatch { diff --git a/Subsystem/UnitAttributesPatch.cs b/Subsystem/Patch/UnitAttributesPatch.cs similarity index 98% rename from Subsystem/UnitAttributesPatch.cs rename to Subsystem/Patch/UnitAttributesPatch.cs index c4f9ffe..414af43 100644 --- a/Subsystem/UnitAttributesPatch.cs +++ b/Subsystem/Patch/UnitAttributesPatch.cs @@ -1,6 +1,6 @@ using BBI.Game.Data; -namespace Subsystem +namespace Subsystem.Patch { public class UnitAttributesPatch { diff --git a/Subsystem/UnitDynamicsAttributesPatch.cs b/Subsystem/Patch/UnitDynamicsAttributesPatch.cs similarity index 97% rename from Subsystem/UnitDynamicsAttributesPatch.cs rename to Subsystem/Patch/UnitDynamicsAttributesPatch.cs index fb1c2d9..9fea5ff 100644 --- a/Subsystem/UnitDynamicsAttributesPatch.cs +++ b/Subsystem/Patch/UnitDynamicsAttributesPatch.cs @@ -1,6 +1,6 @@ using BBI.Game.Data; -namespace Subsystem +namespace Subsystem.Patch { public class UnitDynamicsAttributesPatch { diff --git a/Subsystem/UnitHangarAttributesPatch.cs b/Subsystem/Patch/UnitHangarAttributesPatch.cs similarity index 92% rename from Subsystem/UnitHangarAttributesPatch.cs rename to Subsystem/Patch/UnitHangarAttributesPatch.cs index f03d2c7..54023c2 100644 --- a/Subsystem/UnitHangarAttributesPatch.cs +++ b/Subsystem/Patch/UnitHangarAttributesPatch.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Subsystem +namespace Subsystem.Patch { public class UnitHangarAttributesPatch { diff --git a/Subsystem/UnitMovementAttributesPatch.cs b/Subsystem/Patch/UnitMovementAttributesPatch.cs similarity index 88% rename from Subsystem/UnitMovementAttributesPatch.cs rename to Subsystem/Patch/UnitMovementAttributesPatch.cs index 74fb610..6d3aaeb 100644 --- a/Subsystem/UnitMovementAttributesPatch.cs +++ b/Subsystem/Patch/UnitMovementAttributesPatch.cs @@ -1,6 +1,6 @@ using BBI.Game.Data; -namespace Subsystem +namespace Subsystem.Patch { public class UnitMovementAttributesPatch { diff --git a/Subsystem/WeaponAttributesPatch.cs b/Subsystem/Patch/WeaponAttributesPatch.cs similarity index 98% rename from Subsystem/WeaponAttributesPatch.cs rename to Subsystem/Patch/WeaponAttributesPatch.cs index e102e26..71799c6 100644 --- a/Subsystem/WeaponAttributesPatch.cs +++ b/Subsystem/Patch/WeaponAttributesPatch.cs @@ -1,5 +1,5 @@ using BBI.Game.Data; -namespace Subsystem +namespace Subsystem.Patch { public class WeaponAttributesPatch { diff --git a/Subsystem/Subsystem.csproj b/Subsystem/Subsystem.csproj index 4eee61d..a5ca846 100644 --- a/Subsystem/Subsystem.csproj +++ b/Subsystem/Subsystem.csproj @@ -42,31 +42,31 @@ - - + + - - - - - + + + + + - - - - + + + + - - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/Subsystem/AbilityAttributesWrapper.cs b/Subsystem/Wrappers/AbilityAttributesWrapper.cs similarity index 99% rename from Subsystem/AbilityAttributesWrapper.cs rename to Subsystem/Wrappers/AbilityAttributesWrapper.cs index 47f9bad..647fd75 100644 --- a/Subsystem/AbilityAttributesWrapper.cs +++ b/Subsystem/Wrappers/AbilityAttributesWrapper.cs @@ -2,7 +2,7 @@ using BBI.Core.Utility.FixedPoint; using BBI.Game.Data; -namespace Subsystem +namespace Subsystem.Wrappers { public class AbilityAttributesWrapper : NamedObjectBase, AbilityAttributes { diff --git a/Subsystem/CostAttributesWrapper.cs b/Subsystem/Wrappers/CostAttributesWrapper.cs similarity index 92% rename from Subsystem/CostAttributesWrapper.cs rename to Subsystem/Wrappers/CostAttributesWrapper.cs index 6350221..047002b 100644 --- a/Subsystem/CostAttributesWrapper.cs +++ b/Subsystem/Wrappers/CostAttributesWrapper.cs @@ -1,6 +1,6 @@ using BBI.Game.Data; -namespace Subsystem +namespace Subsystem.Wrappers { public class CostAttributesWrapper : CostAttributes { diff --git a/Subsystem/HangarBayWrapper.cs b/Subsystem/Wrappers/HangarBayWrapper.cs similarity index 99% rename from Subsystem/HangarBayWrapper.cs rename to Subsystem/Wrappers/HangarBayWrapper.cs index 46b18e8..4f609a4 100644 --- a/Subsystem/HangarBayWrapper.cs +++ b/Subsystem/Wrappers/HangarBayWrapper.cs @@ -1,7 +1,7 @@ using BBI.Core.Utility.FixedPoint; using BBI.Game.Data; -namespace Subsystem +namespace Subsystem.Wrappers { public class HangarBayWrapper : HangarBay { diff --git a/Subsystem/RangeBasedWeaponAttributesWrapper.cs b/Subsystem/Wrappers/RangeBasedWeaponAttributesWrapper.cs similarity index 96% rename from Subsystem/RangeBasedWeaponAttributesWrapper.cs rename to Subsystem/Wrappers/RangeBasedWeaponAttributesWrapper.cs index 1602886..dc10e4d 100644 --- a/Subsystem/RangeBasedWeaponAttributesWrapper.cs +++ b/Subsystem/Wrappers/RangeBasedWeaponAttributesWrapper.cs @@ -1,7 +1,7 @@ using BBI.Core.Utility.FixedPoint; using BBI.Game.Data; -namespace Subsystem +namespace Subsystem.Wrappers { public class RangeBasedWeaponAttributesWrapper : RangeBasedWeaponAttributes { diff --git a/Subsystem/ResearchItemAttributesWrapper.cs b/Subsystem/Wrappers/ResearchItemAttributesWrapper.cs similarity index 98% rename from Subsystem/ResearchItemAttributesWrapper.cs rename to Subsystem/Wrappers/ResearchItemAttributesWrapper.cs index 18b54d9..bc6443b 100644 --- a/Subsystem/ResearchItemAttributesWrapper.cs +++ b/Subsystem/Wrappers/ResearchItemAttributesWrapper.cs @@ -2,7 +2,7 @@ using BBI.Core.Utility.FixedPoint; using BBI.Game.Data; -namespace Subsystem +namespace Subsystem.Wrappers { public class ResearchItemAttributesWrapper : NamedObjectBase, ResearchItemAttributes { diff --git a/Subsystem/UnitAttributesWrapper.cs b/Subsystem/Wrappers/UnitAttributesWrapper.cs similarity index 99% rename from Subsystem/UnitAttributesWrapper.cs rename to Subsystem/Wrappers/UnitAttributesWrapper.cs index 7977e96..dfc9738 100644 --- a/Subsystem/UnitAttributesWrapper.cs +++ b/Subsystem/Wrappers/UnitAttributesWrapper.cs @@ -3,7 +3,7 @@ using BBI.Game.Data; using System.Collections.Generic; -namespace Subsystem +namespace Subsystem.Wrappers { public class UnitAttributesWrapper : NamedObjectBase, UnitAttributes { diff --git a/Subsystem/UnitDynamicsAttributesWrapper.cs b/Subsystem/Wrappers/UnitDynamicsAttributesWrapper.cs similarity index 98% rename from Subsystem/UnitDynamicsAttributesWrapper.cs rename to Subsystem/Wrappers/UnitDynamicsAttributesWrapper.cs index 33ca35e..d3aaa09 100644 --- a/Subsystem/UnitDynamicsAttributesWrapper.cs +++ b/Subsystem/Wrappers/UnitDynamicsAttributesWrapper.cs @@ -2,7 +2,7 @@ using BBI.Core.Utility.FixedPoint; using BBI.Game.Data; -namespace Subsystem +namespace Subsystem.Wrappers { public class UnitDynamicsAttributesWrapper : UnitDynamicsAttributes { diff --git a/Subsystem/UnitHangarAttributesWrapper.cs b/Subsystem/Wrappers/UnitHangarAttributesWrapper.cs similarity index 97% rename from Subsystem/UnitHangarAttributesWrapper.cs rename to Subsystem/Wrappers/UnitHangarAttributesWrapper.cs index f2fed4a..49a9d19 100644 --- a/Subsystem/UnitHangarAttributesWrapper.cs +++ b/Subsystem/Wrappers/UnitHangarAttributesWrapper.cs @@ -2,7 +2,7 @@ using BBI.Game.Data; using System.Linq; -namespace Subsystem +namespace Subsystem.Wrappers { public class UnitHangarAttributesWrapper : UnitHangarAttributes { diff --git a/Subsystem/UnitMovementAttributesWrapper.cs b/Subsystem/Wrappers/UnitMovementAttributesWrapper.cs similarity index 97% rename from Subsystem/UnitMovementAttributesWrapper.cs rename to Subsystem/Wrappers/UnitMovementAttributesWrapper.cs index c66ac0a..4d0741f 100644 --- a/Subsystem/UnitMovementAttributesWrapper.cs +++ b/Subsystem/Wrappers/UnitMovementAttributesWrapper.cs @@ -1,6 +1,6 @@ using BBI.Game.Data; -namespace Subsystem +namespace Subsystem.Wrappers { public class UnitMovementAttributesWrapper : UnitMovementAttributes { diff --git a/Subsystem/WeaponAttributesWrapper.cs b/Subsystem/Wrappers/WeaponAttributesWrapper.cs similarity index 99% rename from Subsystem/WeaponAttributesWrapper.cs rename to Subsystem/Wrappers/WeaponAttributesWrapper.cs index fa311c0..fbdf94a 100644 --- a/Subsystem/WeaponAttributesWrapper.cs +++ b/Subsystem/Wrappers/WeaponAttributesWrapper.cs @@ -2,7 +2,7 @@ using BBI.Core.Utility.FixedPoint; using BBI.Game.Data; -namespace Subsystem +namespace Subsystem.Wrappers { public class WeaponAttributesWrapper : NamedObjectBase, WeaponAttributes { From 92022c88b662bc2201df0846a25563cff0c9317a Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Mon, 22 Oct 2018 10:22:44 -0400 Subject: [PATCH 22/23] Formatting --- Subsystem/Patch/WeaponAttributesPatch.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Subsystem/Patch/WeaponAttributesPatch.cs b/Subsystem/Patch/WeaponAttributesPatch.cs index 71799c6..a73c707 100644 --- a/Subsystem/Patch/WeaponAttributesPatch.cs +++ b/Subsystem/Patch/WeaponAttributesPatch.cs @@ -1,4 +1,5 @@ using BBI.Game.Data; + namespace Subsystem.Patch { public class WeaponAttributesPatch From 3a2ffff7d89a71900fde1ab4988b3a46777891e0 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Mon, 22 Oct 2018 10:26:40 -0400 Subject: [PATCH 23/23] Version 0.3.0 --- Subsystem/Properties/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Subsystem/Properties/AssemblyInfo.cs b/Subsystem/Properties/AssemblyInfo.cs index 2c8d5f5..a214525 100644 --- a/Subsystem/Properties/AssemblyInfo.cs +++ b/Subsystem/Properties/AssemblyInfo.cs @@ -34,4 +34,4 @@ // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("0.2.0")] +[assembly: AssemblyInformationalVersion("0.3.0")]