Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Majiir committed Nov 15, 2018
2 parents de2c691 + ef35ae6 commit 7f07b9f
Show file tree
Hide file tree
Showing 29 changed files with 813 additions and 181 deletions.
414 changes: 320 additions & 94 deletions Subsystem/AttributeLoader.cs

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions Subsystem/IRemovable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Subsystem
{
public interface IRemovable
{
bool Remove { get; }
}
}
14 changes: 14 additions & 0 deletions Subsystem/Patch/AttributeBuffPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using BBI.Core.Data;
using BBI.Game.Data;

namespace Subsystem.Patch
{
public class AttributeBuffPatch : IRemovable
{
public string Name { get; set; }
public Buff.CategoryAndID? Attribute { get; set; }
public AttributeBuffMode? Mode { get; set; }
public int? Value { get; set; }
public bool Remove { get; set; }
}
}
15 changes: 15 additions & 0 deletions Subsystem/Patch/DetectableAttributesPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using BBI.Game.Data;

namespace Subsystem.Patch
{
public class DetectableAttributesPatch
{
public bool? DisplayLastKnownLocation { get; set; }
public double? LastKnownDuration { get; set; }
public int? TimeVisibleAfterFiring { get; set; }
public bool? AlwaysVisible { get; set; }
public DetectionState? MinimumStateAfterDetection { get; set; }
public double? FOWFadeDuration { get; set; }
public bool? SetHasBeenSeenBeforeOnSpawn { get; set; }
}
}
3 changes: 3 additions & 0 deletions Subsystem/Patch/EntityTypePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ namespace Subsystem.Patch
{
public class EntityTypePatch
{
public ExperienceAttributesPatch ExperienceAttributes { get; set; }
public UnitAttributesPatch UnitAttributes { get; set; }
public ResearchItemAttributesPatch ResearchItemAttributes { get; set; }
public UnitHangarAttributesPatch UnitHangarAttributes { get; set; }
public DetectableAttributesPatch DetectableAttributes { get; set; }
public UnitMovementAttributesPatch UnitMovementAttributes { get; set; }
public Dictionary<string, AbilityAttributesPatch> AbilityAttributes { get; set; } = new Dictionary<string, AbilityAttributesPatch>();
public Dictionary<string, StorageAttributesPatch> StorageAttributes { get; set; } = new Dictionary<string, StorageAttributesPatch>();
public Dictionary<string, WeaponAttributesPatch> WeaponAttributes { get; set; } = new Dictionary<string, WeaponAttributesPatch>();
}
}
9 changes: 9 additions & 0 deletions Subsystem/Patch/EntityTypeToSpawnAttributesPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Subsystem.Patch
{
public class EntityTypeToSpawnAttributesPatch : IRemovable
{
public string EntityTypeToSpawn { get; set; }
public double? SpawnRotationOffsetDegrees { get; set; }
public bool Remove { get; set; }
}
}
9 changes: 9 additions & 0 deletions Subsystem/Patch/ExperienceAttributesPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Collections.Generic;

namespace Subsystem.Patch
{
public class ExperienceAttributesPatch
{
public Dictionary<string, ExperienceLevelAttributesPatch> Levels { get; set; } = new Dictionary<string, ExperienceLevelAttributesPatch>();
}
}
12 changes: 12 additions & 0 deletions Subsystem/Patch/ExperienceLevelAttributesPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Collections.Generic;

namespace Subsystem.Patch
{
public class ExperienceLevelAttributesPatch : IRemovable
{
public string BuffTooltipLocID { get; set; }
public int? RequiredExperience { get; set; }
public Dictionary<string, AttributeBuffPatch> Buff { get; set; } = new Dictionary<string, AttributeBuffPatch>();
public bool Remove { get; set; }
}
}
9 changes: 9 additions & 0 deletions Subsystem/Patch/InventoryAttributesPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Subsystem.Patch
{
public class InventoryAttributesPatch
{
public bool? HasUnlimitedCapacity { get; set; }
public int? StartingAmount { get; set; }
public int? Capacity { get; set; }
}
}
2 changes: 1 addition & 1 deletion Subsystem/Patch/RangeBasedWeaponAttributesPatch.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Subsystem.Patch
{
public class RangeBasedWeaponAttributesPatch
public class RangeBasedWeaponAttributesPatch : IRemovable
{
public double? Accuracy { get; set; }
public double? Distance { get; set; }
Expand Down
11 changes: 11 additions & 0 deletions Subsystem/Patch/StorageAttributesPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Collections.Generic;

namespace Subsystem.Patch
{
public class StorageAttributesPatch
{
public bool? LinkToPlayerBank { get; set; }
public bool? IsResourceController { get; set; }
public Dictionary<string, InventoryAttributesPatch> InventoryLoadout { get; set; } = new Dictionary<string, InventoryAttributesPatch>();
}
}
15 changes: 15 additions & 0 deletions Subsystem/Patch/TargetPrioritizationAttributesPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace Subsystem.Patch
{
public class TargetPrioritizationAttributesPatch
{
public double? WeaponEffectivenessWeight { get; set; }
public double? TargetThreatWeight { get; set; }
public double? DistanceWeight { get; set; }
public double? AngleWeight { get; set; }
public double? TargetPriorityWeight { get; set; }
public double? AutoTargetStickyBias { get; set; }
public double? ManualTargetStickyBias { get; }
public double? TargetSameCommanderBias { get; set; }
public double? TargetWithinFOVBias { get; set; }
}
}
9 changes: 9 additions & 0 deletions Subsystem/Patch/TurretAttributesPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Subsystem.Patch
{
public class TurretAttributesPatch
{
public double? FieldOfView { get; set; }
public double? FieldOfFire { get; set; }
public double? RotationSpeed { get; set; }
}
}
5 changes: 5 additions & 0 deletions Subsystem/Patch/WeaponAttributesPatch.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using BBI.Game.Data;
using System.Collections.Generic;

namespace Subsystem.Patch
{
Expand Down Expand Up @@ -29,17 +30,21 @@ public class WeaponAttributesPatch
public RevealTrigger? RevealTriggers { get; set; }
public UnitStatusAttackingTrigger? UnitStatusAttackingTriggers { get; set; }
public WeaponTargetStyle? TargetStyle { get; set; }
public Dictionary<string, WeaponModifierInfoPatch> Modifiers { get; set; } = new Dictionary<string, WeaponModifierInfoPatch>();
public AOEFalloffType? AreaOfEffectFalloffType { get; set; }
public double? AreaOfEffectRadius { get; set; }
public bool? ExcludeWeaponOwnerFromAreaOfEffect { get; set; }
public double? FriendlyFireDamageScalar { get; set; }
public double? WeaponOwnerFriendlyFireDamageScalar { get; set; }
public TurretAttributesPatch Turret { 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; }
public int? ActiveStatusEffectsIndex { get; set; }
public Dictionary<string, EntityTypeToSpawnAttributesPatch> EntityTypesToSpawnOnImpact { get; set; } = new Dictionary<string, EntityTypeToSpawnAttributesPatch>();
public TargetPrioritizationAttributesPatch TargetPrioritizationAttributes { get; set; }
}
}
13 changes: 13 additions & 0 deletions Subsystem/Patch/WeaponModifierInfoPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using BBI.Game.Data;

namespace Subsystem.Patch
{
public class WeaponModifierInfoPatch : IRemovable
{
public UnitClass? TargetClass { get; set; }
public FlagOperator? ClassOperator { get; set; }
public WeaponModifierType? Modifier { get; set; }
public int? Amount { get; set; }
public bool Remove { get; set; }
}
}
2 changes: 1 addition & 1 deletion Subsystem/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("0.3.0")]
[assembly: AssemblyInformationalVersion("0.4.0")]
106 changes: 21 additions & 85 deletions Subsystem/StringLogger.cs
Original file line number Diff line number Diff line change
@@ -1,69 +1,43 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;

namespace Subsystem
{
public class StringLogger
{
private readonly Stack<Scope> scopes = new Stack<Scope>();
private bool wroteNewline = true;
private int indent = 0;

public StringLogger()
private readonly TextWriter writer;

public StringLogger(TextWriter writer)
{
scopes.Push(new Scope());
this.writer = writer;
}

public IDisposable BeginScope(string name)
{
var scope = scopes.Peek();
var newScope = scope.CreateScope(name);
scopes.Push(newScope);
return new ScopeDisposer(this);
}
if (!wroteNewline)
{
writer.WriteLine();
}

public void Log(string log)
{
scopes.Peek().AddLog(log);
}
writeIndent(writer, indent);
writer.WriteLine(name);
writer.WriteLine();

public string GetLog()
{
var writer = new StringWriter();
WriteLog(writer);
return writer.ToString();
}
wroteNewline = true;
indent += 1;

public void WriteLog(TextWriter writer)
{
writeLog(writer, scopes.Peek(), indent: 0);
return new ScopeDisposer(this);
}

private void writeLog(TextWriter writer, Scope scope, int indent)
public void Log(string log)
{
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();
writeIndent(writer, indent);
writer.WriteLine(log);

writeLog(writer, childScope, indent + 1);
}
wroteNewline = false;
}

private static void writeIndent(TextWriter writer, int indent)
Expand All @@ -85,45 +59,7 @@ public ScopeDisposer(StringLogger logger)

public void Dispose()
{
logger.scopes.Pop();
}
}

private class Scope
{
public IList<KeyValuePair<string, Scope>> Scopes
{
get { return new ReadOnlyCollection<KeyValuePair<string, Scope>>(scopes); }
}

public IList<LogEntry> LogEntries
{
get { return new ReadOnlyCollection<LogEntry>(logEntries); }
}

private readonly List<KeyValuePair<string, Scope>> scopes = new List<KeyValuePair<string, Scope>>();
private readonly List<LogEntry> logEntries = new List<LogEntry>();

public void AddLog(string log)
{
logEntries.Add(new LogEntry(log));
}

public Scope CreateScope(string name)
{
var scope = new Scope();
scopes.Add(new KeyValuePair<string, Scope>(name, scope));
return scope;
}
}

private class LogEntry
{
public string Log { get; private set; }

public LogEntry(string log)
{
Log = log;
logger.indent -= 1;
}
}
}
Expand Down
22 changes: 22 additions & 0 deletions Subsystem/Subsystem.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,43 @@
<Reference Include="UnityEngine" />
</ItemGroup>
<ItemGroup>
<Compile Include="IRemovable.cs" />
<Compile Include="Patch\AbilityAttributesPatch.cs" />
<Compile Include="Patch\AttributeBuffPatch.cs" />
<Compile Include="Patch\EntityTypeToSpawnAttributesPatch.cs" />
<Compile Include="Patch\ExperienceAttributesPatch.cs" />
<Compile Include="Patch\ExperienceLevelAttributesPatch.cs" />
<Compile Include="Patch\InventoryAttributesPatch.cs" />
<Compile Include="Patch\StorageAttributesPatch.cs" />
<Compile Include="Patch\TargetPrioritizationAttributesPatch.cs" />
<Compile Include="Patch\TurretAttributesPatch.cs" />
<Compile Include="Patch\DetectableAttributesPatch.cs" />
<Compile Include="Patch\WeaponModifierInfoPatch.cs" />
<Compile Include="Wrappers\AbilityAttributesWrapper.cs" />
<Compile Include="AttributeLoader.cs" />
<Compile Include="Patch\AttributesPatch.cs" />
<Compile Include="Wrappers\AttributeBuffSetWrapper.cs" />
<Compile Include="Wrappers\AttributeBuffWrapper.cs" />
<Compile Include="Wrappers\TargetPrioritizationAttributesWrapper.cs" />
<Compile Include="Wrappers\DetectableAttributesWrapper.cs" />
<Compile Include="Wrappers\CostAttributesWrapper.cs" />
<Compile Include="Patch\EntityTypePatch.cs" />
<Compile Include="Patch\HangarBayPatch.cs" />
<Compile Include="Wrappers\EntityTypeToSpawnAttributesWrapper.cs" />
<Compile Include="Wrappers\ExperienceAttributesWrapper.cs" />
<Compile Include="Wrappers\ExperienceLevelAttributesWrapper.cs" />
<Compile Include="Wrappers\HangarBayWrapper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PropertyAccessor.cs" />
<Compile Include="Patch\RangeBasedWeaponAttributesPatch.cs" />
<Compile Include="Wrappers\InventoryAttributesWrapper.cs" />
<Compile Include="Wrappers\RangeBasedWeaponAttributesWrapper.cs" />
<Compile Include="Patch\ResearchItemAttributesPatch.cs" />
<Compile Include="Wrappers\ResearchItemAttributesWrapper.cs" />
<Compile Include="StringLogger.cs" />
<Compile Include="Patch\UnitAttributesPatch.cs" />
<Compile Include="Wrappers\StorageAttributesWrapper.cs" />
<Compile Include="Wrappers\TurretAttributesWrapper.cs" />
<Compile Include="Wrappers\UnitAttributesWrapper.cs" />
<Compile Include="Patch\UnitDynamicsAttributesPatch.cs" />
<Compile Include="Wrappers\UnitDynamicsAttributesWrapper.cs" />
Expand All @@ -67,6 +88,7 @@
<Compile Include="Wrappers\UnitMovementAttributesWrapper.cs" />
<Compile Include="Patch\WeaponAttributesPatch.cs" />
<Compile Include="Wrappers\WeaponAttributesWrapper.cs" />
<Compile Include="Wrappers\WeaponModifierInfoWrapper.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Loading

0 comments on commit 7f07b9f

Please sign in to comment.